From 4474ffdc85fac7d17063dd4f648c9b84678d6a09 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Sun, 22 Mar 2020 17:48:41 +0000 Subject: [PATCH 0001/1862] Initial version of the code. --- .../core-java-date-operations-2/README.md | 1 + .../dayofweek/DayOfWeekExtractor.java | 35 +++++++++++++ .../dayofweek/DayOfWeekExtractorUnitTest.java | 52 +++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 core-java-modules/core-java-date-operations-2/src/main/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractor.java create mode 100644 core-java-modules/core-java-date-operations-2/src/test/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractorUnitTest.java diff --git a/core-java-modules/core-java-date-operations-2/README.md b/core-java-modules/core-java-date-operations-2/README.md index 728162ca1a..0f57686fe4 100644 --- a/core-java-modules/core-java-date-operations-2/README.md +++ b/core-java-modules/core-java-date-operations-2/README.md @@ -7,4 +7,5 @@ This module contains articles about date operations in Java. - [Checking If Two Java Dates Are on the Same Day](https://www.baeldung.com/java-check-two-dates-on-same-day) - [Converting Java Date to OffsetDateTime](https://www.baeldung.com/java-convert-date-to-offsetdatetime) - [How to Set the JVM Time Zone](https://www.baeldung.com/java-jvm-time-zone) +- [Extracting the Day of the Week](http://inprogress.baeldung.com/wp-admin/post.php?post=184664&action=edit&classic-editor) - [[<-- Prev]](/core-java-modules/core-java-date-operations-1) diff --git a/core-java-modules/core-java-date-operations-2/src/main/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractor.java b/core-java-modules/core-java-date-operations-2/src/main/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractor.java new file mode 100644 index 0000000000..b027790e35 --- /dev/null +++ b/core-java-modules/core-java-date-operations-2/src/main/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractor.java @@ -0,0 +1,35 @@ +package com.baeldung.datetime.dayofweek; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.format.TextStyle; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; + +public class DayOfWeekExtractor { + + public static int getDayNumberOld(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal.get(Calendar.DAY_OF_WEEK); + } + + public static String getDayStringOld(Date date, Locale locale ) { + DateFormat formatter = new SimpleDateFormat("EEEE", locale); + return formatter.format(date); + } + + public static int getDayNumberNew(LocalDate date) { + DayOfWeek day = date.getDayOfWeek(); + return day.getValue(); + } + + public static String getDayStringNew(LocalDate date, Locale locale ) { + DayOfWeek day = date.getDayOfWeek(); + return day.getDisplayName(TextStyle.FULL, locale); + } + +} diff --git a/core-java-modules/core-java-date-operations-2/src/test/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractorUnitTest.java b/core-java-modules/core-java-date-operations-2/src/test/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractorUnitTest.java new file mode 100644 index 0000000000..0dfd50dca2 --- /dev/null +++ b/core-java-modules/core-java-date-operations-2/src/test/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractorUnitTest.java @@ -0,0 +1,52 @@ +package com.baeldung.datetime.dayofweek; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.Calendar; +import java.util.Locale; + +import org.junit.Test; + +public class DayOfWeekExtractorUnitTest { + + private DateFormat oldDateParser = new SimpleDateFormat("yyyy-MM-dd"); + + @Test + public void givenFeb29_2020_thenOldSaturdayNumber() throws ParseException { + assertThat(DayOfWeekExtractor.getDayNumberOld(oldDateParser.parse("2020-02-29")) == Calendar.SATURDAY); + } + + @Test + public void givenFeb29_2020_and_localeUS_thenOldSaturdayText() throws ParseException { + assertThat("Saturday".equals(DayOfWeekExtractor.getDayStringOld(oldDateParser.parse("2020-02-29"), Locale.US)) ); + } + + @Test + public void givenFeb29_2020_and_localeDE_thenOldSaturdayText() throws ParseException { + assertThat("Samstag".equals(DayOfWeekExtractor.getDayStringOld(oldDateParser.parse("2020-02-29"), Locale.GERMANY)) ); + } + + @Test + public void givenFeb29_2020_thenNewSaturdayNumber() throws ParseException { + assertThat(DayOfWeekExtractor.getDayNumberNew(LocalDate.parse("2020-02-29")) == Calendar.SATURDAY); + } + + @Test + public void givenFeb29_2020_and_localeUS_thenNewSaturdayText() throws ParseException { + assertThat("Saturday".equals(DayOfWeekExtractor.getDayStringOld(oldDateParser.parse("2020-02-29"), Locale.US)) ); + } + + @Test + public void givenFeb29_2020_and_localeDE_thenNewSaturdayText() throws ParseException { + assertThat("Samstag".equals(DayOfWeekExtractor.getDayStringOld(oldDateParser.parse("2020-02-29"), Locale.GERMANY)) ); + } + + +} + + + From b5787f39cd9092dd05e93abbef6fe0e3808b318b Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Mon, 23 Mar 2020 16:27:23 +0000 Subject: [PATCH 0002/1862] Addressed PR comment. --- core-java-modules/core-java-date-operations-2/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-date-operations-2/README.md b/core-java-modules/core-java-date-operations-2/README.md index 0f57686fe4..728162ca1a 100644 --- a/core-java-modules/core-java-date-operations-2/README.md +++ b/core-java-modules/core-java-date-operations-2/README.md @@ -7,5 +7,4 @@ This module contains articles about date operations in Java. - [Checking If Two Java Dates Are on the Same Day](https://www.baeldung.com/java-check-two-dates-on-same-day) - [Converting Java Date to OffsetDateTime](https://www.baeldung.com/java-convert-date-to-offsetdatetime) - [How to Set the JVM Time Zone](https://www.baeldung.com/java-jvm-time-zone) -- [Extracting the Day of the Week](http://inprogress.baeldung.com/wp-admin/post.php?post=184664&action=edit&classic-editor) - [[<-- Prev]](/core-java-modules/core-java-date-operations-1) From 5a042b6f80be92564624504084385e67fe3e490a Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Wed, 25 Mar 2020 21:53:40 +0530 Subject: [PATCH 0003/1862] Java Example of Hexagonal Architecture --- hexagonaljava/.gitignore | 31 ++ .../.mvn/wrapper/MavenWrapperDownloader.java | 117 +++++++ hexagonaljava/.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 50710 bytes .../.mvn/wrapper/maven-wrapper.properties | 2 + hexagonaljava/mvnw | 310 ++++++++++++++++++ hexagonaljava/mvnw.cmd | 182 ++++++++++ hexagonaljava/pom.xml | 60 ++++ .../HexagonaljavaApplication.java | 13 + .../controller/StudentResultController.java | 29 ++ .../hexagonaljava/entity/Student.java | 37 +++ .../repository/StudentResultJdbcRepoImpl.java | 84 +++++ .../repository/StudentResultRepo.java | 11 + .../repository/StudentResultRepoImpl.java | 26 ++ .../service/StudentResultService.java | 11 + .../service/StudentResultServiceImpl.java | 32 ++ .../src/main/resources/application.properties | 5 + hexagonaljava/src/main/resources/schema.sql | 11 + .../HexagonaljavaApplicationTests.java | 13 + 18 files changed, 974 insertions(+) create mode 100644 hexagonaljava/.gitignore create mode 100644 hexagonaljava/.mvn/wrapper/MavenWrapperDownloader.java create mode 100644 hexagonaljava/.mvn/wrapper/maven-wrapper.jar create mode 100644 hexagonaljava/.mvn/wrapper/maven-wrapper.properties create mode 100755 hexagonaljava/mvnw create mode 100644 hexagonaljava/mvnw.cmd create mode 100644 hexagonaljava/pom.xml create mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java create mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java create mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java create mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java create mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java create mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java create mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java create mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java create mode 100644 hexagonaljava/src/main/resources/application.properties create mode 100644 hexagonaljava/src/main/resources/schema.sql create mode 100644 hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java diff --git a/hexagonaljava/.gitignore b/hexagonaljava/.gitignore new file mode 100644 index 0000000000..a2a3040aa8 --- /dev/null +++ b/hexagonaljava/.gitignore @@ -0,0 +1,31 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ diff --git a/hexagonaljava/.mvn/wrapper/MavenWrapperDownloader.java b/hexagonaljava/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..e76d1f3241 --- /dev/null +++ b/hexagonaljava/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/hexagonaljava/.mvn/wrapper/maven-wrapper.jar b/hexagonaljava/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054 GIT binary patch literal 50710 zcmbTd1CVCTmM+|7+wQV$+qP}n>auOywyU~q+qUhh+uxis_~*a##hm*_WW?9E7Pb7N%LRFiwbEGCJ0XP=%-6oeT$XZcYgtzC2~q zk(K08IQL8oTl}>>+hE5YRgXTB@fZ4TH9>7=79e`%%tw*SQUa9~$xKD5rS!;ZG@ocK zQdcH}JX?W|0_Afv?y`-NgLum62B&WSD$-w;O6G0Sm;SMX65z)l%m1e-g8Q$QTI;(Q z+x$xth4KFvH@Bs6(zn!iF#nenk^Y^ce;XIItAoCsow38eq?Y-Auh!1in#Rt-_D>H^ z=EjbclGGGa6VnaMGmMLj`x3NcwA43Jb(0gzl;RUIRAUDcR1~99l2SAPkVhoRMMtN} zXvC<tOmX83grD8GSo_Lo?%lNfhD#EBgPo z*nf@ppMC#B!T)Ae0RG$mlJWmGl7CkuU~B8-==5i;rS;8i6rJ=PoQxf446XDX9g|c> zU64ePyMlsI^V5Jq5A+BPe#e73+kpc_r1tv#B)~EZ;7^67F0*QiYfrk0uVW;Qb=NsG zN>gsuCwvb?s-KQIppEaeXtEMdc9dy6Dfduz-tMTms+i01{eD9JE&h?Kht*$eOl#&L zJdM_-vXs(V#$Ed;5wyNWJdPNh+Z$+;$|%qR(t`4W@kDhd*{(7-33BOS6L$UPDeE_53j${QfKN-0v-HG z(QfyvFNbwPK%^!eIo4ac1;b>c0vyf9}Xby@YY!lkz-UvNp zwj#Gg|4B~?n?G^{;(W;|{SNoJbHTMpQJ*Wq5b{l9c8(%?Kd^1?H1om1de0Da9M;Q=n zUfn{f87iVb^>Exl*nZ0hs(Yt>&V9$Pg`zX`AI%`+0SWQ4Zc(8lUDcTluS z5a_KerZWe}a-MF9#Cd^fi!y3%@RFmg&~YnYZ6<=L`UJ0v={zr)>$A;x#MCHZy1st7 ztT+N07NR+vOwSV2pvWuN1%lO!K#Pj0Fr>Q~R40{bwdL%u9i`DSM4RdtEH#cW)6}+I-eE< z&tZs+(Ogu(H_;$a$!7w`MH0r%h&@KM+<>gJL@O~2K2?VrSYUBbhCn#yy?P)uF3qWU z0o09mIik+kvzV6w>vEZy@&Mr)SgxPzUiDA&%07m17udz9usD82afQEps3$pe!7fUf z0eiidkJ)m3qhOjVHC_M(RYCBO%CZKZXFb8}s0-+}@CIn&EF(rRWUX2g^yZCvl0bI} zbP;1S)iXnRC&}5-Tl(hASKqdSnO?ASGJ*MIhOXIblmEudj(M|W!+I3eDc}7t`^mtg z)PKlaXe(OH+q-)qcQ8a@!llRrpGI8DsjhoKvw9T;TEH&?s=LH0w$EzI>%u;oD@x83 zJL7+ncjI9nn!TlS_KYu5vn%f*@qa5F;| zEFxY&B?g=IVlaF3XNm_03PA)=3|{n-UCgJoTr;|;1AU9|kPE_if8!Zvb}0q$5okF$ zHaJdmO&gg!9oN|M{!qGE=tb|3pVQ8PbL$}e;NgXz<6ZEggI}wO@aBP**2Wo=yN#ZC z4G$m^yaM9g=|&!^ft8jOLuzc3Psca*;7`;gnHm}tS0%f4{|VGEwu45KptfNmwxlE~ z^=r30gi@?cOm8kAz!EylA4G~7kbEiRlRIzwrb~{_2(x^$-?|#e6Bi_**(vyr_~9Of z!n>Gqf+Qwiu!xhi9f53=PM3`3tNF}pCOiPU|H4;pzjcsqbwg*{{kyrTxk<;mx~(;; z1NMrpaQ`57yn34>Jo3b|HROE(UNcQash!0p2-!Cz;{IRv#Vp5!3o$P8!%SgV~k&Hnqhp`5eLjTcy93cK!3Hm-$`@yGnaE=?;*2uSpiZTs_dDd51U%i z{|Zd9ou-;laGS_x=O}a+ zB||za<795A?_~Q=r=coQ+ZK@@ zId~hWQL<%)fI_WDIX#=(WNl!Dm$a&ROfLTd&B$vatq!M-2Jcs;N2vps$b6P1(N}=oI3<3luMTmC|0*{ zm1w8bt7vgX($!0@V0A}XIK)w!AzUn7vH=pZEp0RU0p?}ch2XC-7r#LK&vyc2=-#Q2 z^L%8)JbbcZ%g0Du;|8=q8B>X=mIQirpE=&Ox{TiuNDnOPd-FLI^KfEF729!!0x#Es z@>3ursjFSpu%C-8WL^Zw!7a0O-#cnf`HjI+AjVCFitK}GXO`ME&on|^=~Zc}^LBp9 zj=-vlN;Uc;IDjtK38l7}5xxQF&sRtfn4^TNtnzXv4M{r&ek*(eNbIu!u$>Ed%` z5x7+&)2P&4>0J`N&ZP8$vcR+@FS0126s6+Jx_{{`3ZrIMwaJo6jdrRwE$>IU_JTZ} z(||hyyQ)4Z1@wSlT94(-QKqkAatMmkT7pCycEB1U8KQbFX&?%|4$yyxCtm3=W`$4fiG0WU3yI@c zx{wfmkZAYE_5M%4{J-ygbpH|(|GD$2f$3o_Vti#&zfSGZMQ5_f3xt6~+{RX=$H8at z?GFG1Tmp}}lmm-R->ve*Iv+XJ@58p|1_jRvfEgz$XozU8#iJS})UM6VNI!3RUU!{5 zXB(+Eqd-E;cHQ>)`h0(HO_zLmzR3Tu-UGp;08YntWwMY-9i^w_u#wR?JxR2bky5j9 z3Sl-dQQU$xrO0xa&>vsiK`QN<$Yd%YXXM7*WOhnRdSFt5$aJux8QceC?lA0_if|s> ze{ad*opH_kb%M&~(~&UcX0nFGq^MqjxW?HJIP462v9XG>j(5Gat_)#SiNfahq2Mz2 zU`4uV8m$S~o9(W>mu*=h%Gs(Wz+%>h;R9Sg)jZ$q8vT1HxX3iQnh6&2rJ1u|j>^Qf`A76K%_ubL`Zu?h4`b=IyL>1!=*%!_K)=XC z6d}4R5L+sI50Q4P3upXQ3Z!~1ZXLlh!^UNcK6#QpYt-YC=^H=EPg3)z*wXo*024Q4b2sBCG4I# zlTFFY=kQ>xvR+LsuDUAk)q%5pEcqr(O_|^spjhtpb1#aC& zghXzGkGDC_XDa%t(X`E+kvKQ4zrQ*uuQoj>7@@ykWvF332)RO?%AA&Fsn&MNzmFa$ zWk&&^=NNjxLjrli_8ESU)}U|N{%j&TQmvY~lk!~Jh}*=^INA~&QB9em!in_X%Rl1&Kd~Z(u z9mra#<@vZQlOY+JYUwCrgoea4C8^(xv4ceCXcejq84TQ#sF~IU2V}LKc~Xlr_P=ry zl&Hh0exdCbVd^NPCqNNlxM3vA13EI8XvZ1H9#bT7y*U8Y{H8nwGpOR!e!!}*g;mJ#}T{ekSb}5zIPmye*If(}}_=PcuAW#yidAa^9-`<8Gr0 z)Fz=NiZ{)HAvw{Pl5uu)?)&i&Us$Cx4gE}cIJ}B4Xz~-q7)R_%owbP!z_V2=Aq%Rj z{V;7#kV1dNT9-6R+H}}(ED*_!F=~uz>&nR3gb^Ce%+0s#u|vWl<~JD3MvS0T9thdF zioIG3c#Sdsv;LdtRv3ml7%o$6LTVL>(H`^@TNg`2KPIk*8-IB}X!MT0`hN9Ddf7yN z?J=GxPL!uJ7lqwowsl?iRrh@#5C$%E&h~Z>XQcvFC*5%0RN-Opq|=IwX(dq(*sjs+ zqy99+v~m|6T#zR*e1AVxZ8djd5>eIeCi(b8sUk)OGjAsKSOg^-ugwl2WSL@d#?mdl zib0v*{u-?cq}dDGyZ%$XRY=UkQwt2oGu`zQneZh$=^! zj;!pCBWQNtvAcwcWIBM2y9!*W|8LmQy$H~5BEx)78J`4Z0(FJO2P^!YyQU{*Al+fs z){!4JvT1iLrJ8aU3k0t|P}{RN)_^v%$$r;+p0DY7N8CXzmS*HB*=?qaaF9D@#_$SN zSz{moAK<*RH->%r7xX~9gVW$l7?b|_SYI)gcjf0VAUJ%FcQP(TpBs; zg$25D!Ry_`8xpS_OJdeo$qh#7U+cepZ??TII7_%AXsT$B z=e)Bx#v%J0j``00Zk5hsvv6%T^*xGNx%KN-=pocSoqE5_R)OK%-Pbu^1MNzfds)mL zxz^F4lDKV9D&lEY;I+A)ui{TznB*CE$=9(wgE{m}`^<--OzV-5V4X2w9j(_!+jpTr zJvD*y6;39&T+==$F&tsRKM_lqa1HC}aGL0o`%c9mO=fts?36@8MGm7Vi{Y z^<7m$(EtdSr#22<(rm_(l_(`j!*Pu~Y>>xc>I9M#DJYDJNHO&4=HM%YLIp?;iR&$m z#_$ZWYLfGLt5FJZhr3jpYb`*%9S!zCG6ivNHYzNHcI%khtgHBliM^Ou}ZVD7ehU9 zS+W@AV=?Ro!=%AJ>Kcy9aU3%VX3|XM_K0A+ZaknKDyIS3S-Hw1C7&BSW5)sqj5Ye_ z4OSW7Yu-;bCyYKHFUk}<*<(@TH?YZPHr~~Iy%9@GR2Yd}J2!N9K&CN7Eq{Ka!jdu; zQNB*Y;i(7)OxZK%IHGt#Rt?z`I|A{q_BmoF!f^G}XVeTbe1Wnzh%1g>j}>DqFf;Rp zz7>xIs12@Ke0gr+4-!pmFP84vCIaTjqFNg{V`5}Rdt~xE^I;Bxp4)|cs8=f)1YwHz zqI`G~s2~qqDV+h02b`PQpUE#^^Aq8l%y2|ByQeXSADg5*qMprEAE3WFg0Q39`O+i1 z!J@iV!`Y~C$wJ!5Z+j5$i<1`+@)tBG$JL=!*uk=2k;T<@{|s1$YL079FvK%mPhyHV zP8^KGZnp`(hVMZ;s=n~3r2y;LTwcJwoBW-(ndU-$03{RD zh+Qn$ja_Z^OuMf3Ub|JTY74s&Am*(n{J3~@#OJNYuEVVJd9*H%)oFoRBkySGm`hx! zT3tG|+aAkXcx-2Apy)h^BkOyFTWQVeZ%e2@;*0DtlG9I3Et=PKaPt&K zw?WI7S;P)TWED7aSH$3hL@Qde?H#tzo^<(o_sv_2ci<7M?F$|oCFWc?7@KBj-;N$P zB;q!8@bW-WJY9do&y|6~mEruZAVe$!?{)N9rZZxD-|oltkhW9~nR8bLBGXw<632!l z*TYQn^NnUy%Ds}$f^=yQ+BM-a5X4^GHF=%PDrRfm_uqC zh{sKwIu|O0&jWb27;wzg4w5uA@TO_j(1X?8E>5Zfma|Ly7Bklq|s z9)H`zoAGY3n-+&JPrT!>u^qg9Evx4y@GI4$n-Uk_5wttU1_t?6><>}cZ-U+&+~JE) zPlDbO_j;MoxdLzMd~Ew|1o^a5q_1R*JZ=#XXMzg?6Zy!^hop}qoLQlJ{(%!KYt`MK z8umEN@Z4w!2=q_oe=;QttPCQy3Nm4F@x>@v4sz_jo{4m*0r%J(w1cSo;D_hQtJs7W z><$QrmG^+<$4{d2bgGo&3-FV}avg9zI|Rr(k{wTyl3!M1q+a zD9W{pCd%il*j&Ft z5H$nENf>>k$;SONGW`qo6`&qKs*T z2^RS)pXk9b@(_Fw1bkb)-oqK|v}r$L!W&aXA>IpcdNZ_vWE#XO8X`#Yp1+?RshVcd zknG%rPd*4ECEI0wD#@d+3NbHKxl}n^Sgkx==Iu%}HvNliOqVBqG?P2va zQ;kRJ$J6j;+wP9cS za#m;#GUT!qAV%+rdWolk+)6kkz4@Yh5LXP+LSvo9_T+MmiaP-eq6_k;)i6_@WSJ zlT@wK$zqHu<83U2V*yJ|XJU4farT#pAA&@qu)(PO^8PxEmPD4;Txpio+2)#!9 z>&=i7*#tc0`?!==vk>s7V+PL#S1;PwSY?NIXN2=Gu89x(cToFm))7L;< z+bhAbVD*bD=}iU`+PU+SBobTQ%S!=VL!>q$rfWsaaV}Smz>lO9JXT#`CcH_mRCSf4%YQAw`$^yY z3Y*^Nzk_g$xn7a_NO(2Eb*I=^;4f!Ra#Oo~LLjlcjke*k*o$~U#0ZXOQ5@HQ&T46l z7504MUgZkz2gNP1QFN8Y?nSEnEai^Rgyvl}xZfMUV6QrJcXp;jKGqB=D*tj{8(_pV zqyB*DK$2lgYGejmJUW)*s_Cv65sFf&pb(Yz8oWgDtQ0~k^0-wdF|tj}MOXaN@ydF8 zNr={U?=;&Z?wr^VC+`)S2xl}QFagy;$mG=TUs7Vi2wws5zEke4hTa2)>O0U?$WYsZ z<8bN2bB_N4AWd%+kncgknZ&}bM~eDtj#C5uRkp21hWW5gxWvc6b*4+dn<{c?w9Rmf zIVZKsPl{W2vQAlYO3yh}-{Os=YBnL8?uN5(RqfQ=-1cOiUnJu>KcLA*tQK3FU`_bM zM^T28w;nAj5EdAXFi&Kk1Nnl2)D!M{@+D-}bIEe+Lc4{s;YJc-{F#``iS2uk;2!Zp zF9#myUmO!wCeJIoi^A+T^e~20c+c2C}XltaR!|U-HfDA=^xF97ev}$l6#oY z&-&T{egB)&aV$3_aVA51XGiU07$s9vubh_kQG?F$FycvS6|IO!6q zq^>9|3U^*!X_C~SxX&pqUkUjz%!j=VlXDo$!2VLH!rKj@61mDpSr~7B2yy{>X~_nc zRI+7g2V&k zd**H++P9dg!-AOs3;GM`(g<+GRV$+&DdMVpUxY9I1@uK28$az=6oaa+PutlO9?6#? zf-OsgT>^@8KK>ggkUQRPPgC7zjKFR5spqQb3ojCHzj^(UH~v+!y*`Smv)VpVoPwa6 zWG18WJaPKMi*F6Zdk*kU^`i~NNTfn3BkJniC`yN98L-Awd)Z&mY? zprBW$!qL-OL7h@O#kvYnLsfff@kDIegt~?{-*5A7JrA;#TmTe?jICJqhub-G@e??D zqiV#g{)M!kW1-4SDel7TO{;@*h2=_76g3NUD@|c*WO#>MfYq6_YVUP+&8e4|%4T`w zXzhmVNziAHazWO2qXcaOu@R1MrPP{t)`N)}-1&~mq=ZH=w=;-E$IOk=y$dOls{6sRR`I5>|X zpq~XYW4sd;J^6OwOf**J>a7u$S>WTFPRkjY;BfVgQst)u4aMLR1|6%)CB^18XCz+r ztkYQ}G43j~Q&1em(_EkMv0|WEiKu;z2zhb(L%$F&xWwzOmk;VLBYAZ8lOCziNoPw1 zv2BOyXA`A8z^WH!nXhKXM`t0;6D*-uGds3TYGrm8SPnJJOQ^fJU#}@aIy@MYWz**H zvkp?7I5PE{$$|~{-ZaFxr6ZolP^nL##mHOErB^AqJqn^hFA=)HWj!m3WDaHW$C)i^ z9@6G$SzB=>jbe>4kqr#sF7#K}W*Cg-5y6kun3u&0L7BpXF9=#7IN8FOjWrWwUBZiU zT_se3ih-GBKx+Uw0N|CwP3D@-C=5(9T#BH@M`F2!Goiqx+Js5xC92|Sy0%WWWp={$(am!#l~f^W_oz78HX<0X#7 zp)p1u~M*o9W@O8P{0Qkg@Wa# z2{Heb&oX^CQSZWSFBXKOfE|tsAm#^U-WkDnU;IowZ`Ok4!mwHwH=s|AqZ^YD4!5!@ zPxJj+Bd-q6w_YG`z_+r;S86zwXb+EO&qogOq8h-Ect5(M2+>(O7n7)^dP*ws_3U6v zVsh)sk^@*c>)3EML|0<-YROho{lz@Nd4;R9gL{9|64xVL`n!m$-Jjrx?-Bacp!=^5 z1^T^eB{_)Y<9)y{-4Rz@9_>;_7h;5D+@QcbF4Wv7hu)s0&==&6u)33 zHRj+&Woq-vDvjwJCYES@$C4{$?f$Ibi4G()UeN11rgjF+^;YE^5nYprYoJNoudNj= zm1pXSeG64dcWHObUetodRn1Fw|1nI$D9z}dVEYT0lQnsf_E1x2vBLql7NrHH!n&Sq z6lc*mvU=WS6=v9Lrl}&zRiu_6u;6g%_DU{9b+R z#YHqX7`m9eydf?KlKu6Sb%j$%_jmydig`B*TN`cZL-g!R)iE?+Q5oOqBFKhx z%MW>BC^(F_JuG(ayE(MT{S3eI{cKiwOtPwLc0XO*{*|(JOx;uQOfq@lp_^cZo=FZj z4#}@e@dJ>Bn%2`2_WPeSN7si^{U#H=7N4o%Dq3NdGybrZgEU$oSm$hC)uNDC_M9xc zGzwh5Sg?mpBIE8lT2XsqTt3j3?We8}3bzLBTQd639vyg^$0#1epq8snlDJP2(BF)K zSx30RM+{f+b$g{9usIL8H!hCO117Xgv}ttPJm9wVRjPk;ePH@zxv%j9k5`TzdXLeT zFgFX`V7cYIcBls5WN0Pf6SMBN+;CrQ(|EsFd*xtwr#$R{Z9FP`OWtyNsq#mCgZ7+P z^Yn$haBJ)r96{ZJd8vlMl?IBxrgh=fdq_NF!1{jARCVz>jNdC)H^wfy?R94#MPdUjcYX>#wEx+LB#P-#4S-%YH>t-j+w zOFTI8gX$ard6fAh&g=u&56%3^-6E2tpk*wx3HSCQ+t7+*iOs zPk5ysqE}i*cQocFvA68xHfL|iX(C4h*67@3|5Qwle(8wT&!&{8*{f%0(5gH+m>$tq zp;AqrP7?XTEooYG1Dzfxc>W%*CyL16q|fQ0_jp%%Bk^k!i#Nbi(N9&T>#M{gez_Ws zYK=l}adalV(nH}I_!hNeb;tQFk3BHX7N}}R8%pek^E`X}%ou=cx8InPU1EE0|Hen- zyw8MoJqB5=)Z%JXlrdTXAE)eqLAdVE-=>wGHrkRet}>3Yu^lt$Kzu%$3#(ioY}@Gu zjk3BZuQH&~7H+C*uX^4}F*|P89JX;Hg2U!pt>rDi(n(Qe-c}tzb0#6_ItoR0->LSt zR~UT<-|@TO%O`M+_e_J4wx7^)5_%%u+J=yF_S#2Xd?C;Ss3N7KY^#-vx+|;bJX&8r zD?|MetfhdC;^2WG`7MCgs>TKKN=^=!x&Q~BzmQio_^l~LboTNT=I zC5pme^P@ER``p$2md9>4!K#vV-Fc1an7pl>_|&>aqP}+zqR?+~Z;f2^`a+-!Te%V? z;H2SbF>jP^GE(R1@%C==XQ@J=G9lKX+Z<@5}PO(EYkJh=GCv#)Nj{DkWJM2}F&oAZ6xu8&g7pn1ps2U5srwQ7CAK zN&*~@t{`31lUf`O;2w^)M3B@o)_mbRu{-`PrfNpF!R^q>yTR&ETS7^-b2*{-tZAZz zw@q5x9B5V8Qd7dZ!Ai$9hk%Q!wqbE1F1c96&zwBBaRW}(^axoPpN^4Aw}&a5dMe+*Gomky_l^54*rzXro$ z>LL)U5Ry>~FJi=*{JDc)_**c)-&faPz`6v`YU3HQa}pLtb5K)u%K+BOqXP0)rj5Au$zB zW1?vr?mDv7Fsxtsr+S6ucp2l#(4dnr9sD*v+@*>g#M4b|U?~s93>Pg{{a5|rm2xfI z`>E}?9S@|IoUX{Q1zjm5YJT|3S>&09D}|2~BiMo=z4YEjXlWh)V&qs;*C{`UMxp$9 zX)QB?G$fPD6z5_pNs>Jeh{^&U^)Wbr?2D6-q?)`*1k@!UvwQgl8eG$r+)NnFoT)L6 zg7lEh+E6J17krfYJCSjWzm67hEth24pomhz71|Qodn#oAILN)*Vwu2qpJirG)4Wnv}9GWOFrQg%Je+gNrPl8mw7ykE8{ z=|B4+uwC&bpp%eFcRU6{mxRV32VeH8XxX>v$du<$(DfinaaWxP<+Y97Z#n#U~V zVEu-GoPD=9$}P;xv+S~Ob#mmi$JQmE;Iz4(){y*9pFyW-jjgdk#oG$fl4o9E8bo|L zWjo4l%n51@Kz-n%zeSCD`uB?T%FVk+KBI}=ve zvlcS#wt`U6wrJo}6I6Rwb=1GzZfwE=I&Ne@p7*pH84XShXYJRgvK)UjQL%R9Zbm(m zxzTQsLTON$WO7vM)*vl%Pc0JH7WhP;$z@j=y#avW4X8iqy6mEYr@-}PW?H)xfP6fQ z&tI$F{NNct4rRMSHhaelo<5kTYq+(?pY)Ieh8*sa83EQfMrFupMM@nfEV@EmdHUv9 z35uzIrIuo4#WnF^_jcpC@uNNaYTQ~uZWOE6P@LFT^1@$o&q+9Qr8YR+ObBkpP9=F+$s5+B!mX2~T zAuQ6RenX?O{IlLMl1%)OK{S7oL}X%;!XUxU~xJN8xk z`xywS*naF(J#?vOpB(K=o~lE;m$zhgPWDB@=p#dQIW>xe_p1OLoWInJRKbEuoncf; zmS1!u-ycc1qWnDg5Nk2D)BY%jmOwCLC+Ny>`f&UxFowIsHnOXfR^S;&F(KXd{ODlm z$6#1ccqt-HIH9)|@fHnrKudu!6B$_R{fbCIkSIb#aUN|3RM>zuO>dpMbROZ`^hvS@ z$FU-;e4W}!ubzKrU@R*dW*($tFZ>}dd*4_mv)#O>X{U@zSzQt*83l9mI zI$8O<5AIDx`wo0}f2fsPC_l>ONx_`E7kdXu{YIZbp1$(^oBAH({T~&oQ&1{X951QW zmhHUxd)t%GQ9#ak5fTjk-cahWC;>^Rg7(`TVlvy0W@Y!Jc%QL3Ozu# zDPIqBCy&T2PWBj+d-JA-pxZlM=9ja2ce|3B(^VCF+a*MMp`(rH>Rt6W1$;r{n1(VK zLs>UtkT43LR2G$AOYHVailiqk7naz2yZGLo*xQs!T9VN5Q>eE(w zw$4&)&6xIV$IO^>1N-jrEUg>O8G4^@y+-hQv6@OmF@gy^nL_n1P1-Rtyy$Bl;|VcV zF=p*&41-qI5gG9UhKmmnjs932!6hceXa#-qfK;3d*a{)BrwNFeKU|ge?N!;zk+kB! zMD_uHJR#%b54c2tr~uGPLTRLg$`fupo}cRJeTwK;~}A>(Acy4k-Xk&Aa1&eWYS1ULWUj@fhBiWY$pdfy+F z@G{OG{*v*mYtH3OdUjwEr6%_ZPZ3P{@rfbNPQG!BZ7lRyC^xlMpWH`@YRar`tr}d> z#wz87t?#2FsH-jM6m{U=gp6WPrZ%*w0bFm(T#7m#v^;f%Z!kCeB5oiF`W33W5Srdt zdU?YeOdPG@98H7NpI{(uN{FJdu14r(URPH^F6tOpXuhU7T9a{3G3_#Ldfx_nT(Hec zo<1dyhsVsTw;ZkVcJ_0-h-T3G1W@q)_Q30LNv)W?FbMH+XJ* zy=$@39Op|kZv`Rt>X`zg&at(?PO^I=X8d9&myFEx#S`dYTg1W+iE?vt#b47QwoHI9 zNP+|3WjtXo{u}VG(lLUaW0&@yD|O?4TS4dfJI`HC-^q;M(b3r2;7|FONXphw-%7~* z&;2!X17|05+kZOpQ3~3!Nb>O94b&ZSs%p)TK)n3m=4eiblVtSx@KNFgBY_xV6ts;NF;GcGxMP8OKV^h6LmSb2E#Qnw ze!6Mnz7>lE9u{AgQ~8u2zM8CYD5US8dMDX-5iMlgpE9m*s+Lh~A#P1er*rF}GHV3h z=`STo?kIXw8I<`W0^*@mB1$}pj60R{aJ7>C2m=oghKyxMbFNq#EVLgP0cH3q7H z%0?L93-z6|+jiN|@v>ix?tRBU(v-4RV`}cQH*fp|)vd3)8i9hJ3hkuh^8dz{F5-~_ zUUr1T3cP%cCaTooM8dj|4*M=e6flH0&8ve32Q)0dyisl))XkZ7Wg~N}6y`+Qi2l+e zUd#F!nJp{#KIjbQdI`%oZ`?h=5G^kZ_uN`<(`3;a!~EMsWV|j-o>c?x#;zR2ktiB! z);5rrHl?GPtr6-o!tYd|uK;Vbsp4P{v_4??=^a>>U4_aUXPWQ$FPLE4PK$T^3Gkf$ zHo&9$U&G`d(Os6xt1r?sg14n)G8HNyWa^q8#nf0lbr4A-Fi;q6t-`pAx1T*$eKM*$ z|CX|gDrk#&1}>5H+`EjV$9Bm)Njw&7-ZR{1!CJTaXuP!$Pcg69`{w5BRHysB$(tWUes@@6aM69kb|Lx$%BRY^-o6bjH#0!7b;5~{6J+jKxU!Kmi# zndh@+?}WKSRY2gZ?Q`{(Uj|kb1%VWmRryOH0T)f3cKtG4oIF=F7RaRnH0Rc_&372={_3lRNsr95%ZO{IX{p@YJ^EI%+gvvKes5cY+PE@unghjdY5#9A!G z70u6}?zmd?v+{`vCu-53_v5@z)X{oPC@P)iA3jK$`r zSA2a7&!^zmUiZ82R2=1cumBQwOJUPz5Ay`RLfY(EiwKkrx%@YN^^XuET;tE zmr-6~I7j!R!KrHu5CWGSChO6deaLWa*9LLJbcAJsFd%Dy>a!>J`N)Z&oiU4OEP-!Ti^_!p}O?7`}i7Lsf$-gBkuY*`Zb z7=!nTT;5z$_5$=J=Ko+Cp|Q0J=%oFr>hBgnL3!tvFoLNhf#D0O=X^h+x08iB;@8pXdRHxX}6R4k@i6%vmsQwu^5z zk1ip`#^N)^#Lg#HOW3sPI33xqFB4#bOPVnY%d6prwxf;Y-w9{ky4{O6&94Ra8VN@K zb-lY;&`HtxW@sF!doT5T$2&lIvJpbKGMuDAFM#!QPXW87>}=Q4J3JeXlwHys?!1^#37q_k?N@+u&Ns20pEoBeZC*np;i;M{2C0Z4_br2gsh6eL z#8`#sn41+$iD?^GL%5?cbRcaa-Nx0vE(D=*WY%rXy3B%gNz0l?#noGJGP728RMY#q z=2&aJf@DcR?QbMmN)ItUe+VM_U!ryqA@1VVt$^*xYt~-qvW!J4Tp<-3>jT=7Zow5M z8mSKp0v4b%a8bxFr>3MwZHSWD73D@+$5?nZAqGM#>H@`)mIeC#->B)P8T$zh-Pxnc z8)~Zx?TWF4(YfKuF3WN_ckpCe5;x4V4AA3(i$pm|78{%!q?|~*eH0f=?j6i)n~Hso zmTo>vqEtB)`%hP55INf7HM@taH)v`Fw40Ayc*R!T?O{ziUpYmP)AH`euTK!zg9*6Z z!>M=$3pd0!&TzU=hc_@@^Yd3eUQpX4-33}b{?~5t5lgW=ldJ@dUAH%`l5US1y_`40 zs(X`Qk}vvMDYYq+@Rm+~IyCX;iD~pMgq^KY)T*aBz@DYEB={PxA>)mI6tM*sx-DmGQHEaHwRrAmNjO!ZLHO4b;;5mf@zzlPhkP($JeZGE7 z?^XN}Gf_feGoG~BjUgVa*)O`>lX=$BSR2)uD<9 z>o^|nb1^oVDhQbfW>>!;8-7<}nL6L^V*4pB=>wwW+RXAeRvKED(n1;R`A6v$6gy0I(;Vf?!4;&sgn7F%LpM}6PQ?0%2Z@b{It<(G1CZ|>913E0nR2r^Pa*Bp z@tFGi*CQ~@Yc-?{cwu1 zsilf=k^+Qs>&WZG(3WDixisHpR>`+ihiRwkL(3T|=xsoNP*@XX3BU8hr57l3k;pni zI``=3Nl4xh4oDj<%>Q1zYXHr%Xg_xrK3Nq?vKX3|^Hb(Bj+lONTz>4yhU-UdXt2>j z<>S4NB&!iE+ao{0Tx^N*^|EZU;0kJkx@zh}S^P{ieQjGl468CbC`SWnwLRYYiStXm zOxt~Rb3D{dz=nHMcY)#r^kF8|q8KZHVb9FCX2m^X*(|L9FZg!5a7((!J8%MjT$#Fs)M1Pb zq6hBGp%O1A+&%2>l0mpaIzbo&jc^!oN^3zxap3V2dNj3x<=TwZ&0eKX5PIso9j1;e zwUg+C&}FJ`k(M|%%}p=6RPUq4sT3-Y;k-<68ciZ~_j|bt>&9ZLHNVrp#+pk}XvM{8 z`?k}o-!if>hVlCP9j%&WI2V`5SW)BCeR5>MQhF)po=p~AYN%cNa_BbV6EEh_kk^@a zD>4&>uCGCUmyA-c)%DIcF4R6!>?6T~Mj_m{Hpq`*(wj>foHL;;%;?(((YOxGt)Bhx zuS+K{{CUsaC++%}S6~CJ=|vr(iIs-je)e9uJEU8ZJAz)w166q)R^2XI?@E2vUQ!R% zn@dxS!JcOimXkWJBz8Y?2JKQr>`~SmE2F2SL38$SyR1^yqj8_mkBp)o$@+3BQ~Mid z9U$XVqxX3P=XCKj0*W>}L0~Em`(vG<>srF8+*kPrw z20{z(=^w+ybdGe~Oo_i|hYJ@kZl*(9sHw#Chi&OIc?w`nBODp?ia$uF%Hs(X>xm?j zqZQ`Ybf@g#wli`!-al~3GWiE$K+LCe=Ndi!#CVjzUZ z!sD2O*;d28zkl))m)YN7HDi^z5IuNo3^w(zy8 zszJG#mp#Cj)Q@E@r-=NP2FVxxEAeOI2e=|KshybNB6HgE^(r>HD{*}S}mO>LuRGJT{*tfTzw_#+er-0${}%YPe@CMJ1Ng#j#)i)SnY@ss3gL;g zg2D~#Kpdfu#G;q1qz_TwSz1VJT(b3zby$Vk&;Y#1(A)|xj`_?i5YQ;TR%jice5E;0 zYHg;`zS5{S*9xI6o^j>rE8Ua*XhIw{_-*&@(R|C(am8__>+Ws&Q^ymy*X4~hR2b5r zm^p3sw}yv=tdyncy_Ui7{BQS732et~Z_@{-IhHDXAV`(Wlay<#hb>%H%WDi+K$862nA@BDtM#UCKMu+kM`!JHyWSi?&)A7_ z3{cyNG%a~nnH_!+;g&JxEMAmh-Z}rC!o7>OVzW&PoMyTA_g{hqXG)SLraA^OP**<7 zjWbr7z!o2n3hnx7A=2O=WL;`@9N{vQIM@&|G-ljrPvIuJHYtss0Er0fT5cMXNUf1B z7FAwBDixt0X7C3S)mPe5g`YtME23wAnbU)+AtV}z+e8G;0BP=bI;?(#|Ep!vVfDbK zvx+|CKF>yt0hWQ3drchU#XBU+HiuG*V^snFAPUp-5<#R&BUAzoB!aZ+e*KIxa26V}s6?nBK(U-7REa573wg-jqCg>H8~>O{ z*C0JL-?X-k_y%hpUFL?I>0WV{oV`Nb)nZbJG01R~AG>flIJf)3O*oB2i8~;!P?Wo_ z0|QEB*fifiL6E6%>tlAYHm2cjTFE@*<);#>689Z6S#BySQ@VTMhf9vYQyLeDg1*F} zjq>i1*x>5|CGKN{l9br3kB0EHY|k4{%^t7-uhjd#NVipUZa=EUuE5kS1_~qYX?>hJ z$}!jc9$O$>J&wnu0SgfYods^z?J4X;X7c77Me0kS-dO_VUQ39T(Kv(Y#s}Qqz-0AH z^?WRL(4RzpkD+T5FG_0NyPq-a-B7A5LHOCqwObRJi&oRi(<;OuIN7SV5PeHU$<@Zh zPozEV`dYmu0Z&Tqd>t>8JVde9#Pt+l95iHe$4Xwfy1AhI zDM4XJ;bBTTvRFtW>E+GzkN)9k!hA5z;xUOL2 zq4}zn-DP{qc^i|Y%rvi|^5k-*8;JZ~9a;>-+q_EOX+p1Wz;>i7c}M6Nv`^NY&{J-> z`(mzDJDM}QPu5i44**2Qbo(XzZ-ZDu%6vm8w@DUarqXj41VqP~ zs&4Y8F^Waik3y1fQo`bVUH;b=!^QrWb)3Gl=QVKr+6sxc=ygauUG|cm?|X=;Q)kQ8 zM(xrICifa2p``I7>g2R~?a{hmw@{!NS5`VhH8+;cV(F>B94M*S;5#O`YzZH1Z%yD? zZ61w(M`#aS-*~Fj;x|J!KM|^o;MI#Xkh0ULJcA?o4u~f%Z^16ViA27FxU5GM*rKq( z7cS~MrZ=f>_OWx8j#-Q3%!aEU2hVuTu(7`TQk-Bi6*!<}0WQi;_FpO;fhpL4`DcWp zGOw9vx0N~6#}lz(r+dxIGZM3ah-8qrqMmeRh%{z@dbUD2w15*_4P?I~UZr^anP}DB zU9CCrNiy9I3~d#&!$DX9e?A});BjBtQ7oGAyoI$8YQrkLBIH@2;lt4E^)|d6Jwj}z z&2_E}Y;H#6I4<10d_&P0{4|EUacwFHauvrjAnAm6yeR#}f}Rk27CN)vhgRqEyPMMS7zvunj2?`f;%?alsJ+-K+IzjJx>h8 zu~m_y$!J5RWAh|C<6+uiCNsOKu)E72M3xKK(a9Okw3e_*O&}7llNV!=P87VM2DkAk zci!YXS2&=P0}Hx|wwSc9JP%m8dMJA*q&VFB0yMI@5vWoAGraygwn){R+Cj6B1a2Px z5)u(K5{+;z2n*_XD!+Auv#LJEM)(~Hx{$Yb^ldQmcYF2zNH1V30*)CN_|1$v2|`LnFUT$%-tO0Eg|c5$BB~yDfzS zcOXJ$wpzVK0MfTjBJ0b$r#_OvAJ3WRt+YOLlJPYMx~qp>^$$$h#bc|`g0pF-Ao43? z>*A+8lx>}L{p(Tni2Vvk)dtzg$hUKjSjXRagj)$h#8=KV>5s)J4vGtRn5kP|AXIz! zPgbbVxW{2o4s-UM;c#We8P&mPN|DW7_uLF!a|^0S=wr6Esx9Z$2|c1?GaupU6$tb| zY_KU`(_29O_%k(;>^|6*pZURH3`@%EuKS;Ns z1lujmf;r{qAN&Q0&m{wJSZ8MeE7RM5+Sq;ul_ z`+ADrd_Um+G37js6tKsArNB}n{p*zTUxQr>3@wA;{EUbjNjlNd6$Mx zg0|MyU)v`sa~tEY5$en7^PkC=S<2@!nEdG6L=h(vT__0F=S8Y&eM=hal#7eM(o^Lu z2?^;05&|CNliYrq6gUv;|i!(W{0N)LWd*@{2q*u)}u*> z7MQgk6t9OqqXMln?zoMAJcc zMKaof_Up})q#DzdF?w^%tTI7STI^@8=Wk#enR*)&%8yje>+tKvUYbW8UAPg55xb70 zEn5&Ba~NmOJlgI#iS8W3-@N%>V!#z-ZRwfPO1)dQdQkaHsiqG|~we2ALqG7Ruup(DqSOft2RFg_X%3w?6VqvV1uzX_@F(diNVp z4{I|}35=11u$;?|JFBEE*gb;T`dy+8gWJ9~pNsecrO`t#V9jW-6mnfO@ff9od}b(3s4>p0i30gbGIv~1@a^F2kl7YO;DxmF3? zWi-RoXhzRJV0&XE@ACc?+@6?)LQ2XNm4KfalMtsc%4!Fn0rl zpHTrHwR>t>7W?t!Yc{*-^xN%9P0cs0kr=`?bQ5T*oOo&VRRu+1chM!qj%2I!@+1XF z4GWJ=7ix9;Wa@xoZ0RP`NCWw0*8247Y4jIZ>GEW7zuoCFXl6xIvz$ezsWgKdVMBH> z{o!A7f;R-@eK9Vj7R40xx)T<2$?F2E<>Jy3F;;=Yt}WE59J!1WN367 zA^6pu_zLoZIf*x031CcwotS{L8bJE(<_F%j_KJ2P_IusaZXwN$&^t716W{M6X2r_~ zaiMwdISX7Y&Qi&Uh0upS3TyEIXNDICQlT5fHXC`aji-c{U(J@qh-mWl-uMN|T&435 z5)a1dvB|oe%b2mefc=Vpm0C%IUYYh7HI*;3UdgNIz}R##(#{(_>82|zB0L*1i4B5j-xi9O4x10rs_J6*gdRBX=@VJ+==sWb&_Qc6tSOowM{BX@(zawtjl zdU!F4OYw2@Tk1L^%~JCwb|e#3CC>srRHQ*(N%!7$Mu_sKh@|*XtR>)BmWw!;8-mq7 zBBnbjwx8Kyv|hd*`5}84flTHR1Y@@uqjG`UG+jN_YK&RYTt7DVwfEDXDW4U+iO{>K zw1hr{_XE*S*K9TzzUlJH2rh^hUm2v7_XjwTuYap|>zeEDY$HOq3X4Tz^X}E9z)x4F zs+T?Ed+Hj<#jY-`Va~fT2C$=qFT-5q$@p9~0{G&eeL~tiIAHXA!f6C(rAlS^)&k<- zXU|ZVs}XQ>s5iONo~t!XXZgtaP$Iau;JT%h)>}v54yut~pykaNye4axEK#5@?TSsQ zE;Jvf9I$GVb|S`7$pG)4vgo9NXsKr?u=F!GnA%VS2z$@Z(!MR9?EPcAqi5ft)Iz6sNl`%kj+_H-X`R<>BFrBW=fSlD|{`D%@Rcbu2?%>t7i34k?Ujb)2@J-`j#4 zLK<69qcUuniIan-$A1+fR=?@+thwDIXtF1Tks@Br-xY zfB+zblrR(ke`U;6U~-;p1Kg8Lh6v~LjW@9l2P6s+?$2!ZRPX`(ZkRGe7~q(4&gEi<$ch`5kQ?*1=GSqkeV z{SA1EaW_A!t{@^UY2D^YO0(H@+kFVzZaAh0_`A`f(}G~EP~?B|%gtxu&g%^x{EYSz zk+T;_c@d;+n@$<>V%P=nk36?L!}?*=vK4>nJSm+1%a}9UlmTJTrfX4{Lb7smNQn@T zw9p2%(Zjl^bWGo1;DuMHN(djsEm)P8mEC2sL@KyPjwD@d%QnZ$ zMJ3cnn!_!iP{MzWk%PI&D?m?C(y2d|2VChluN^yHya(b`h>~GkI1y;}O_E57zOs!{ zt2C@M$^PR2U#(dZmA-sNreB@z-yb0Bf7j*yONhZG=onhx>t4)RB`r6&TP$n zgmN*)eCqvgriBO-abHQ8ECN0bw?z5Bxpx z=jF@?zFdVn?@gD5egM4o$m`}lV(CWrOKKq(sv*`mNcHcvw&Xryfw<{ch{O&qc#WCTXX6=#{MV@q#iHYba!OUY+MGeNTjP%Fj!WgM&`&RlI^=AWTOqy-o zHo9YFt!gQ*p7{Fl86>#-JLZo(b^O`LdFK~OsZBRR@6P?ad^Ujbqm_j^XycM4ZHFyg ziUbIFW#2tj`65~#2V!4z7DM8Z;fG0|APaQ{a2VNYpNotB7eZ5kp+tPDz&Lqs0j%Y4tA*URpcfi z_M(FD=fRGdqf430j}1z`O0I=;tLu81bwJXdYiN7_&a-?ly|-j*+=--XGvCq#32Gh(=|qj5F?kmihk{%M&$}udW5)DHK zF_>}5R8&&API}o0osZJRL3n~>76nUZ&L&iy^s>PMnNcYZ|9*1$v-bzbT3rpWsJ+y{ zPrg>5Zlery96Um?lc6L|)}&{992{_$J&=4%nRp9BAC6!IB=A&=tF>r8S*O-=!G(_( zwXbX_rGZgeiK*&n5E;f=k{ktyA1(;x_kiMEt0*gpp_4&(twlS2e5C?NoD{n>X2AT# zY@Zp?#!b1zNq96MQqeO*M1MMBin5v#RH52&Xd~DO6-BZLnA6xO1$sou(YJ1Dlc{WF zVa%2DyYm`V#81jP@70IJ;DX@y*iUt$MLm)ByAD$eUuji|5{ptFYq(q)mE(5bOpxjM z^Q`AHWq44SG3`_LxC9fwR)XRVIp=B%<(-lOC3jI#bb@dK(*vjom!=t|#<@dZql%>O z15y^{4tQoeW9Lu%G&V$90x6F)xN6y_oIn;!Q zs)8jT$;&;u%Y>=T3hg34A-+Y*na=|glcStr5D;&5*t5*DmD~x;zQAV5{}Ya`?RRGa zT*t9@$a~!co;pD^!J5bo?lDOWFx%)Y=-fJ+PDGc0>;=q=s?P4aHForSB+)v0WY2JH z?*`O;RHum6j%#LG)Vu#ciO#+jRC3!>T(9fr+XE7T2B7Z|0nR5jw@WG)kDDzTJ=o4~ zUpeyt7}_nd`t}j9BKqryOha{34erm)RmST)_9Aw)@ zHbiyg5n&E{_CQR@h<}34d7WM{s{%5wdty1l+KX8*?+-YkNK2Be*6&jc>@{Fd;Ps|| z26LqdI3#9le?;}risDq$K5G3yoqK}C^@-8z^wj%tdgw-6@F#Ju{Sg7+y)L?)U$ez> zoOaP$UFZ?y5BiFycir*pnaAaY+|%1%8&|(@VB)zweR%?IidwJyK5J!STzw&2RFx zZV@qeaCB01Hu#U9|1#=Msc8Pgz5P*4Lrp!Q+~(G!OiNR{qa7|r^H?FC6gVhkk3y7=uW#Sh;&>78bZ}aK*C#NH$9rX@M3f{nckYI+5QG?Aj1DM)@~z_ zw!UAD@gedTlePB*%4+55naJ8ak_;))#S;4ji!LOqY5VRI){GMwHR~}6t4g>5C_#U# ztYC!tjKjrKvRy=GAsJVK++~$|+s!w9z3H4G^mACv=EErXNSmH7qN}%PKcN|8%9=i)qS5+$L zu&ya~HW%RMVJi4T^pv?>mw*Gf<)-7gf#Qj|e#w2|v4#t!%Jk{&xlf;$_?jW*n!Pyx zkG$<18kiLOAUPuFfyu-EfWX%4jYnjBYc~~*9JEz6oa)_R|8wjZA|RNrAp%}14L7fW zi7A5Wym*K+V8pkqqO-X#3ft{0qs?KVt^)?kS>AicmeO&q+~J~ zp0YJ_P~_a8j= zsAs~G=8F=M{4GZL{|B__UorX@MRNQLn?*_gym4aW(~+i13knnk1P=khoC-ViMZk+x zLW(l}oAg1H`dU+Fv**;qw|ANDSRs>cGqL!Yw^`; zv;{E&8CNJcc)GHzTYM}f&NPw<6j{C3gaeelU#y!M)w-utYEHOCCJo|Vgp7K6C_$14 zqIrLUB0bsgz^D%V%fbo2f9#yb#CntTX?55Xy|Kps&Xek*4_r=KDZ z+`TQuv|$l}MWLzA5Ay6Cvsa^7xvwXpy?`w(6vx4XJ zWuf1bVSb#U8{xlY4+wlZ$9jjPk)X_;NFMqdgq>m&W=!KtP+6NL57`AMljW+es zzqjUjgz;V*kktJI?!NOg^s_)ph45>4UDA!Vo0hn>KZ+h-3=?Y3*R=#!fOX zP$Y~+14$f66ix?UWB_6r#fMcC^~X4R-<&OD1CSDNuX~y^YwJ>sW0j`T<2+3F9>cLo z#!j57$ll2K9(%$4>eA7(>FJX5e)pR5&EZK!IMQzOfik#FU*o*LGz~7u(8}XzIQRy- z!U7AlMTIe|DgQFmc%cHy_9^{o`eD%ja_L>ckU6$O4*U**o5uR7`FzqkU8k4gxtI=o z^P^oGFPm5jwZMI{;nH}$?p@uV8FT4r=|#GziKXK07bHJLtK}X%I0TON$uj(iJ`SY^ zc$b2CoxCQ>7LH@nxcdW&_C#fMYBtTxcg46dL{vf%EFCZ~eErMvZq&Z%Lhumnkn^4A zsx$ay(FnN7kYah}tZ@0?-0Niroa~13`?hVi6`ndno`G+E8;$<6^gsE-K3)TxyoJ4M zb6pj5=I8^FD5H@`^V#Qb2^0cx7wUz&cruA5g>6>qR5)O^t1(-qqP&1g=qvY#s&{bx zq8Hc%LsbK1*%n|Y=FfojpE;w~)G0-X4i*K3{o|J7`krhIOd*c*$y{WIKz2n2*EXEH zT{oml3Th5k*vkswuFXdGDlcLj15Nec5pFfZ*0?XHaF_lVuiB%Pv&p7z)%38}%$Gup zVTa~C8=cw%6BKn_|4E?bPNW4PT7}jZQLhDJhvf4z;~L)506IE0 zX!tWXX(QOQPRj-p80QG79t8T2^az4Zp2hOHziQlvT!|H)jv{Ixodabzv6lBj)6WRB z{)Kg@$~~(7$-az?lw$4@L%I&DI0Lo)PEJJziWP33a3azb?jyXt1v0N>2kxwA6b%l> zZqRpAo)Npi&loWbjFWtEV)783BbeIAhqyuc+~>i7aQ8shIXt)bjCWT6$~ro^>99G} z2XfmT0(|l!)XJb^E!#3z4oEGIsL(xd; zYX1`1I(cG|u#4R4T&C|m*9KB1`UzKvho5R@1eYtUL9B72{i(ir&ls8g!pD ztR|25xGaF!4z5M+U@@lQf(12?xGy`!|3E}7pI$k`jOIFjiDr{tqf0va&3pOn6Pu)% z@xtG2zjYuJXrV)DUrIF*y<1O1<$#54kZ#2;=X51J^F#0nZ0(;S$OZDt_U2bx{RZ=Q zMMdd$fH|!s{ zXq#l;{`xfV`gp&C>A`WrQU?d{!Ey5(1u*VLJt>i27aZ-^&2IIk=zP5p+{$q(K?2(b z8?9h)kvj9SF!Dr zoyF}?V|9;6abHxWk2cEvGs$-}Pg}D+ZzgkaN&$Snp%;5m%zh1E#?Wac-}x?BYlGN#U#Mek*}kek#I9XaHt?mz3*fDrRTQ#&#~xyeqJk1QJ~E$7qsw6 z?sV;|?*=-{M<1+hXoj?@-$y+(^BJ1H~wQ9G8C0#^aEAyhDduNX@haoa=PuPp zYsGv8UBfQaRHgBgLjmP^eh>fLMeh{8ic)?xz?#3kX-D#Z{;W#cd_`9OMFIaJg-=t`_3*!YDgtNQ2+QUEAJB9M{~AvT$H`E)IKmCR21H532+ata8_i_MR@ z2Xj<3w<`isF~Ah$W{|9;51ub*f4#9ziKrOR&jM{x7I_7()O@`F*5o$KtZ?fxU~g`t zUovNEVKYn$U~VX8eR)qb`7;D8pn*Pp$(otYTqL)5KH$lUS-jf}PGBjy$weoceAcPp z&5ZYB$r&P$MN{0H0AxCe4Qmd3T%M*5d4i%#!nmBCN-WU-4m4Tjxn-%j3HagwTxCZ9 z)j5vO-C7%s%D!&UfO>bi2oXiCw<-w{vVTK^rVbv#W=WjdADJy8$khnU!`ZWCIU`># zyjc^1W~pcu>@lDZ{zr6gv%)2X4n27~Ve+cQqcND%0?IFSP4sH#yIaXXYAq^z3|cg` z`I3$m%jra>e2W-=DiD@84T!cb%||k)nPmEE09NC%@PS_OLhkrX*U!cgD*;;&gIaA(DyVT4QD+q_xu z>r`tg{hiGY&DvD-)B*h+YEd+Zn)WylQl}<4>(_NlsKXCRV;a)Rcw!wtelM2_rWX`j zTh5A|i6=2BA(iMCnj_fob@*eA;V?oa4Z1kRBGaU07O70fb6-qmA$Hg$ps@^ka1=RO zTbE_2#)1bndC3VuK@e!Sftxq4=Uux}fDxXE#Q5_x=E1h>T5`DPHz zbH<_OjWx$wy7=%0!mo*qH*7N4tySm+R0~(rbus`7;+wGh;C0O%x~fEMkt!eV>U$`i z5>Q(o z=t$gPjgGh0&I7KY#k50V7DJRX<%^X z>6+ebc9efB3@eE2Tr){;?_w`vhgF>`-GDY(YkR{9RH(MiCnyRtd!LxXJ75z+?2 zGi@m^+2hKJ5sB1@Xi@s_@p_Kwbc<*LQ_`mr^Y%j}(sV_$`J(?_FWP)4NW*BIL~sR>t6 zM;qTJZ~GoY36&{h-Pf}L#y2UtR}>ZaI%A6VkU>vG4~}9^i$5WP2Tj?Cc}5oQxe2=q z8BeLa$hwCg_psjZyC2+?yX4*hJ58Wu^w9}}7X*+i5Rjqu5^@GzXiw#SUir1G1`jY% zOL=GE_ENYxhcyUrEt9XlMNP6kx6h&%6^u3@zB8KUCAa18T(R2J`%JjWZ z!{7cXaEW+Qu*iJPu+m>QqW}Lo$4Z+!I)0JNzZ&_M%=|B1yejFRM04bGAvu{=lNPd+ zJRI^DRQ(?FcVUD+bgEcAi@o(msqys9RTCG#)TjI!9~3-dc`>gW;HSJuQvH~d`MQs86R$|SKXHh zqS9Qy)u;T`>>a!$LuaE2keJV%;8g)tr&Nnc;EkvA-RanHXsy)D@XN0a>h}z2j81R; zsUNJf&g&rKpuD0WD@=dDrPHdBoK42WoBU|nMo17o(5^;M|dB4?|FsAGVrSyWcI`+FVw^vTVC`y}f(BwJl zrw3Sp151^9=}B})6@H*i4-dIN_o^br+BkcLa^H56|^2XsT0dESw2 zMX>(KqNl=x2K5=zIKg}2JpGAZu{I_IO}0$EQ5P{4zol**PCt3F4`GX}2@vr8#Y)~J zKb)gJeHcFnR@4SSh%b;c%J`l=W*40UPjF#q{<}ywv-=vHRFmDjv)NtmC zQx9qm)d%0zH&qG7AFa3VAU1S^(n8VFTC~Hb+HjYMjX8r#&_0MzlNR*mnLH5hi}`@{ zK$8qiDDvS_(L9_2vHgzEQ${DYSE;DqB!g*jhJghE&=LTnbgl&Xepo<*uRtV{2wDHN z)l;Kg$TA>Y|K8Lc&LjWGj<+bp4Hiye_@BfU(y#nF{fpR&|Ltbye?e^j0}8JC4#xi% zv29ZR%8%hk=3ZDvO-@1u8KmQ@6p%E|dlHuy#H1&MiC<*$YdLkHmR#F3ae;bKd;@*i z2_VfELG=B}JMLCO-6UQy^>RDE%K4b>c%9ki`f~Z2Qu8hO7C#t%Aeg8E%+}6P7Twtg z-)dj(w}_zFK&86KR@q9MHicUAucLVshUdmz_2@32(V`y3`&Kf8Q2I)+!n0mR=rrDU zXvv^$ho;yh*kNqJ#r1}b0|i|xRUF6;lhx$M*uG3SNLUTC@|htC z-=fsw^F%$qqz4%QdjBrS+ov}Qv!z00E+JWas>p?z@=t!WWU3K*?Z(0meTuTOC7OTx zU|kFLE0bLZ+WGcL$u4E}5dB0g`h|uwv3=H6f+{5z9oLv-=Q45+n~V4WwgO=CabjM% zBAN+RjM65(-}>Q2V#i1Na@a0`08g&y;W#@sBiX6Tpy8r}*+{RnyGUT`?XeHSqo#|J z^ww~c;ou|iyzpErDtlVU=`8N7JSu>4M z_pr9=tX0edVn9B}YFO2y(88j#S{w%E8vVOpAboK*27a7e4Ekjt0)hIX99*1oE;vex z7#%jhY=bPijA=Ce@9rRO(Vl_vnd00!^TAc<+wVvRM9{;hP*rqEL_(RzfK$er_^SN; z)1a8vo8~Dr5?;0X0J62Cusw$A*c^Sx1)dom`-)Pl7hsW4i(r*^Mw`z5K>!2ixB_mu z*Ddqjh}zceRFdmuX1akM1$3>G=#~|y?eYv(e-`Qy?bRHIq=fMaN~fB zUa6I8Rt=)jnplP>yuS+P&PxeWpJ#1$F`iqRl|jF$WL_aZFZl@kLo&d$VJtu&w?Q0O zzuXK>6gmygq(yXJy0C1SL}T8AplK|AGNUOhzlGeK_oo|haD@)5PxF}rV+5`-w{Aag zus45t=FU*{LguJ11Sr-28EZkq;!mJO7AQGih1L4rEyUmp>B!%X0YemsrV3QFvlgt* z5kwlPzaiJ+kZ^PMd-RRbl(Y?F*m`4*UIhIuf#8q>H_M=fM*L_Op-<_r zBZagV=4B|EW+KTja?srADTZXCd3Yv%^Chfpi)cg{ED${SI>InNpRj5!euKv?=Xn92 zsS&FH(*w`qLIy$doc>RE&A5R?u zzkl1sxX|{*fLpXvIW>9d<$ePROttn3oc6R!sN{&Y+>Jr@yeQN$sFR z;w6A<2-0%UA?c8Qf;sX7>>uKRBv3Ni)E9pI{uVzX|6Bb0U)`lhLE3hK58ivfRs1}d zNjlGK0hdq0qjV@q1qI%ZFMLgcpWSY~mB^LK)4GZ^h_@H+3?dAe_a~k*;9P_d7%NEFP6+ zgV(oGr*?W(ql?6SQ~`lUsjLb%MbfC4V$)1E0Y_b|OIYxz4?O|!kRb?BGrgiH5+(>s zoqM}v*;OBfg-D1l`M6T6{K`LG+0dJ1)!??G5g(2*vlNkm%Q(MPABT$r13q?|+kL4- zf)Mi5r$sn;u41aK(K#!m+goyd$c!KPl~-&-({j#D4^7hQkV3W|&>l_b!}!z?4($OA z5IrkfuT#F&S1(`?modY&I40%gtroig{YMvF{K{>5u^I51k8RriGd${z)=5k2tG zM|&Bp5kDTfb#vfuTTd?)a=>bX=lokw^y9+2LS?kwHQIWI~pYgy7 zb?A-RKVm_vM5!9?C%qYdfRAw& zAU7`up~%g=p@}pg#b7E)BFYx3g%(J36Nw(Dij!b>cMl@CSNbrW!DBDbTD4OXk!G4x zi}JBKc8HBYx$J~31PXH+4^x|UxK~(<@I;^3pWN$E=sYma@JP|8YL`L(zI6Y#c%Q{6 z*APf`DU$S4pr#_!60BH$FGViP14iJmbrzSrOkR;f3YZa{#E7Wpd@^4E-zH8EgPc-# zKWFPvh%WbqU_%ZEt`=Q?odKHc7@SUmY{GK`?40VuL~o)bS|is$Hn=<=KGHOsEC5tB zFb|q}gGlL97NUf$G$>^1b^3E18PZ~Pm9kX%*ftnolljiEt@2#F2R5ah$zbXd%V_Ev zyDd{1o_uuoBga$fB@Fw!V5F3jIr=a-ykqrK?WWZ#a(bglI_-8pq74RK*KfQ z0~Dzus7_l;pMJYf>Bk`)`S8gF!To-BdMnVw5M-pyu+aCiC5dwNH|6fgRsIKZcF&)g zr}1|?VOp}I3)IR@m1&HX1~#wsS!4iYqES zK}4J{Ei>;e3>LB#Oly>EZkW14^@YmpbgxCDi#0RgdM${&wxR+LiX}B+iRioOB0(pDKpVEI;ND?wNx>%e|m{RsqR_{(nmQ z3ZS}@t!p4a(BKx_-CYwrcyJ5u1TO9bcXti$8sy>xcLKqKCc#~UOZYD{llKTSFEjJ~ zyNWt>tLU}*>^`TvPxtP%F`ZJQw@W0^>x;!^@?k_)9#bF$j0)S3;mH-IR5y82l|%=F z2lR8zhP?XNP-ucZZ6A+o$xOyF!w;RaLHGh57GZ|TCXhJqY~GCh)aXEV$1O&$c}La1 zjuJxkY9SM4av^Hb;i7efiYaMwI%jGy`3NdY)+mcJhF(3XEiSlU3c|jMBi|;m-c?~T z+x0_@;SxcoY=(6xNgO$bBt~Pj8`-<1S|;Bsjrzw3@zSjt^JC3X3*$HI79i~!$RmTz zsblZsLYs7L$|=1CB$8qS!tXrWs!F@BVuh?kN(PvE5Av-*r^iYu+L^j^m9JG^#=m>@ z=1soa)H*w6KzoR$B8mBCXoU;f5^bVuwQ3~2LKg!yxomG1#XPmn(?YH@E~_ED+W6mxs%x{%Z<$pW`~ON1~2XjP5v(0{C{+6Dm$00tsd3w=f=ZENy zOgb-=f}|Hb*LQ$YdWg<(u7x3`PKF)B7ZfZ6;1FrNM63 z?O6tE%EiU@6%rVuwIQjvGtOofZBGZT1Sh(xLIYt9c4VI8`!=UJd2BfLjdRI#SbVAX ziT(f*RI^T!IL5Ac>ql7uduF#nuCRJ1)2bdvAyMxp-5^Ww5p#X{rb5)(X|fEhDHHW{ zw(Lfc$g;+Q`B0AiPGtmK%*aWfQQ$d!*U<|-@n2HZvCWSiw^I>#vh+LyC;aaVWGbmkENr z&kl*8o^_FW$T?rDYLO1Pyi%>@&kJKQoH2E0F`HjcN}Zlnx1ddoDA>G4Xu_jyp6vuT zPvC}pT&Owx+qB`zUeR|4G;OH(<<^_bzkjln0k40t`PQxc$7h(T8Ya~X+9gDc8Z9{Z z&y0RAU}#_kQGrM;__MK9vwIwK^aoqFhk~dK!ARf1zJqHMxF2?7-8|~yoO@_~Ed;_wvT%Vs{9RK$6uUQ|&@#6vyBsFK9eZW1Ft#D2)VpQRwpR(;x^ zdoTgMqfF9iBl%{`QDv7B0~8{8`8k`C4@cbZAXBu00v#kYl!#_Wug{)2PwD5cNp?K^ z9+|d-4z|gZ!L{57>!Ogfbzchm>J1)Y%?NThxIS8frAw@z>Zb9v%3_3~F@<=LG%r*U zaTov}{{^z~SeX!qgSYow`_5)ij*QtGp4lvF`aIGQ>@3ZTkDmsl#@^5*NGjOuu82}o zzLF~Q9SW+mP=>88%eSA1W4_W7-Q>rdq^?t=m6}^tDPaBRGFLg%ak93W!kOp#EO{6& zP%}Iff5HZQ9VW$~+9r=|Quj#z*=YwcnssS~9|ub2>v|u1JXP47vZ1&L1O%Z1DsOrDfSIMHU{VT>&>H=9}G3i@2rP+rx@eU@uE8rJNec zij~#FmuEBj03F1~ct@C@$>y)zB+tVyjV3*n`mtAhIM0$58vM9jOQC}JJOem|EpwqeMuYPxu3sv}oMS?S#o6GGK@8PN59)m&K4Dc&X% z(;XL_kKeYkafzS3Wn5DD>Yiw{LACy_#jY4op(>9q>>-*9@C0M+=b#bknAWZ37^(Ij zq>H%<@>o4a#6NydoF{_M4i4zB_KG)#PSye9bk0Ou8h%1Dtl7Q_y#7*n%g)?m>xF~( zjqvOwC;*qvN_3(*a+w2|ao0D?@okOvg8JskUw(l7n`0fncglavwKd?~l_ryKJ^Ky! zKCHkIC-o7%fFvPa$)YNh022lakMar^dgL=t#@XLyNHHw!b?%WlM)R@^!)I!smZL@k zBi=6wE5)2v&!UNV(&)oOYW(6Qa!nUjDKKBf-~Da=#^HE4(@mWk)LPvhyN3i4goB$3K8iV7uh zsv+a?#c4&NWeK(3AH;ETrMOIFgu{_@%XRwCZ;L=^8Ts)hix4Pf3yJRQ<8xb^CkdmC z?c_gB)XmRsk`9ch#tx4*hO=#qS7={~Vb4*tTf<5P%*-XMfUUYkI9T1cEF;ObfxxI-yNuA=I$dCtz3ey znVkctYD*`fUuZ(57+^B*R=Q}~{1z#2!ca?)+YsRQb+lt^LmEvZt_`=j^wqig+wz@n@ z`LIMQJT3bxMzuKg8EGBU+Q-6cs5(@5W?N>JpZL{$9VF)veF`L5%DSYTNQEypW%6$u zm_~}T{HeHj1bAlKl8ii92l9~$dm=UM21kLemA&b$;^!wB7#IKWGnF$TVq!!lBlG4 z{?Rjz?P(uvid+|i$VH?`-C&Gcb3{(~Vpg`w+O);Wk1|Mrjxrht0GfRUnZqz2MhrXa zqgVC9nemD5)H$to=~hp)c=l9?#~Z_7i~=U-`FZxb-|TR9@YCxx;Zjo-WpMNOn2)z) zFPGGVl%3N$f`gp$gPnWC+f4(rmts%fidpo^BJx72zAd7|*Xi{2VXmbOm)1`w^tm9% znM=0Fg4bDxH5PxPEm{P3#A(mxqlM7SIARP?|2&+c7qmU8kP&iApzL|F>Dz)Ixp_`O zP%xrP1M6@oYhgo$ZWwrAsYLa4 z|I;DAvJxno9HkQrhLPQk-8}=De{9U3U%)dJ$955?_AOms!9gia%)0E$Mp}$+0er@< zq7J&_SzvShM?e%V?_zUu{niL@gt5UFOjFJUJ}L?$f%eU%jUSoujr{^O=?=^{19`ON zlRIy8Uo_nqcPa6@yyz`CM?pMJ^^SN^Fqtt`GQ8Q#W4kE7`V9^LT}j#pMChl!j#g#J zr-=CCaV%xyFeQ9SK+mG(cTwW*)xa(eK;_Z(jy)woZp~> zA(4}-&VH+TEeLzPTqw&FOoK(ZjD~m{KW05fiGLe@E3Z2`rLukIDahE*`u!ubU)9`o zn^-lyht#E#-dt~S>}4y$-mSbR8{T@}22cn^refuQ08NjLOv?JiEWjyOnzk<^R5%gO zhUH_B{oz~u#IYwVnUg8?3P*#DqD8#X;%q%HY**=I>>-S|!X*-!x1{^l#OnR56O>iD zc;i;KS+t$koh)E3)w0OjWJl_aW2;xF=9D9Kr>)(5}4FqUbk# zI#$N8o0w;IChL49m9CJTzoC!|u{Ljd%ECgBOf$}&jA^$(V#P#~)`&g`H8E{uv52pp zwto`xUL-L&WTAVREEm$0g_gYPL(^vHq(*t1WCH_6alhkeW&GCZ3hL)|{O-jiFOBrF z!EW=Jej|dqQitT6!B-7&io2K)WIm~Q)v@yq%U|VpV+I?{y0@Yd%n8~-NuuM*pM~KA z85YB};IS~M(c<}4Hxx>qRK0cdl&e?t253N%vefkgds>Ubn8X}j6Vpgs>a#nFq$osY z1ZRwLqFv=+BTb=i%D2Wv>_yE0z}+niZ4?rE|*a3d7^kndWGwnFqt+iZ(7+aln<}jzbAQ(#Z2SS}3S$%Bd}^ zc9ghB%O)Z_mTZMRC&H#)I#fiLuIkGa^`4e~9oM5zKPx?zjkC&Xy0~r{;S?FS%c7w< zWbMpzc(xSw?9tGxG~_l}Acq}zjt5ClaB7-!vzqnlrX;}$#+PyQ9oU)_DfePh2E1<7 ztok6g6K^k^DuHR*iJ?jw?bs_whk|bx`dxu^nC6#e{1*m~z1eq7m}Cf$*^Eua(oi_I zAL+3opNhJteu&mWQ@kQWPucmiP)4|nFG`b2tpC;h{-PI@`+h?9v=9mn|0R-n8#t=+Z*FD(c5 zjj79Jxkgck*DV=wpFgRZuwr%}KTm+dx?RT@aUHJdaX-ODh~gByS?WGx&czAkvkg;x zrf92l8$Or_zOwJVwh>5rB`Q5_5}ef6DjS*$x30nZbuO3dijS*wvNEqTY5p1_A0gWr znH<(Qvb!os14|R)n2Ost>jS2;d1zyLHu`Svm|&dZD+PpP{Bh>U&`Md;gRl64q;>{8MJJM$?UNUd`aC>BiLe>*{ zJY15->yW+<3rLgYeTruFDtk1ovU<$(_y7#HgUq>)r0{^}Xbth}V#6?%5jeFYt;SG^ z3qF)=uWRU;Jj)Q}cpY8-H+l_n$2$6{ZR?&*IGr{>ek!69ZH0ZoJ*Ji+ezzlJ^%qL3 zO5a`6gwFw(moEzqxh=yJ9M1FTn!eo&qD#y5AZXErHs%22?A+JmS&GIolml!)rZTnUDM3YgzYfT#;OXn)`PWv3Ta z!-i|-Wojv*k&bC}_JJDjiAK(Ba|YZgUI{f}TdEOFT2+}nPmttytw7j%@bQZDV1vvj z^rp{gRkCDmYJHGrE1~e~AE!-&6B6`7UxVQuvRrfdFkGX8H~SNP_X4EodVd;lXd^>eV1jN+Tt4}Rsn)R0LxBz0c=NXU|pUe!MQQFkGBWbR3&(jLm z%RSLc#p}5_dO{GD=DEFr=Fc% z85CBF>*t!6ugI?soX(*JNxBp+-DdZ4X0LldiK}+WWGvXV(C(Ht|!3$psR=&c*HIM=BmX;pRIpz@Ale{9dhGe(U2|Giv;# zOc|;?p67J=Q(kamB*aus=|XP|m{jN^6@V*Bpm?ye56Njh#vyJqE=DweC;?Rv7faX~ zde03n^I~0B2vUmr;w^X37tVxUK?4}ifsSH5_kpKZIzpYu0;Kv}SBGfI2AKNp+VN#z`nI{UNDRbo-wqa4NEls zICRJpu)??cj^*WcZ^MAv+;bDbh~gpN$1Cor<{Y2oyIDws^JsfW^5AL$azE(T0p&pP z1Mv~6Q44R&RHoH95&OuGx2srIr<@zYJTOMKiVs;Bx3py89I87LOb@%mr`0)#;7_~Z zzcZj8?w=)>%5@HoCHE_&hnu(n_yQ-L(~VjpjjkbT7e)Dk5??fApg(d>vwLRJ-x{um z*Nt?DqTSxh_MIyogY!vf1mU1`Gld-&L)*43f6dilz`Q@HEz;+>MDDYv9u!s;WXeao zUq=TaL$P*IFgJzrGc>j1dDOd zed+=ZBo?w4mr$2)Ya}?vedDopomhW1`#P<%YOJ_j=WwClX0xJH-f@s?^tmzs_j7t!k zK@j^zS0Q|mM4tVP5Ram$VbS6|YDY&y?Q1r1joe9dj08#CM{RSMTU}(RCh`hp_Rkl- zGd|Cv~G@F{DLhCizAm9AN!^{rNs8hu!G@8RpnGx7e`-+K$ffN<0qjR zGq^$dj_Tv!n*?zOSyk5skI7JVKJ)3jysnjIu-@VSzQiP8r6MzudCU=~?v-U8yzo^7 zGf~SUTvEp+S*!X9uX!sq=o}lH;r{pzk~M*VA(uyQ`3C8!{C;)&6)95fv(cK!%Cuz$ z_Zal57H6kPN>25KNiI6z6F)jzEkh#%OqU#-__Xzy)KyH};81#N6OfX$$IXWzOn`Q& z4f$Z1t>)8&8PcYfEwY5UadU1yg+U*(1m2ZlHoC-!2?gB!!fLhmTl))D@dhvkx#+Yj z1O=LV{(T%{^IeCuFK>%QR!VZ4GnO5tK8a+thWE zg4VytZrwcS?7^ zuZfhYnB8dwd%VLO?DK7pV5Wi<(`~DYqOXn8#jUIL^)12*Dbhk4GmL_E2`WX&iT16o zk(t|hok(Y|v-wzn?4x34T)|+SfZP>fiq!><*%vnxGN~ypST-FtC+@TPv*vYv@iU!_ z@2gf|PrgQ?Ktf*9^CnJ(x*CtZVB8!OBfg0%!wL;Z8(tYYre0vcnPGlyCc$V(Ipl*P z_(J!a=o@vp^%Efme!K74(Ke7A>Y}|sxV+JL^aYa{~m%5#$$+R1? zGaQhZTTX!#s#=Xtpegqero$RNt&`4xn3g$)=y*;=N=Qai)}~`xtxI_N*#MMCIq#HFifT zz(-*m;pVH&+4bixL&Bbg)W5FN^bH87pAHp)zPkWNMfTFqS=l~AC$3FX3kQUSh_C?-ZftyClgM)o_D7cX$RGlEYblux0jv5 zTr|i-I3@ZPCGheCl~BGhImF)K4!9@?pC(gi3ozX=a!|r1)LFxy_8c&wY0<^{2cm|P zv6Y`QktY*;I)IUd5y3ne1CqpVanlY45z8hf4&$EUBnucDj16pDa4&GI&TArYhf*xh zdj>*%APH8(h~c>o@l#%T>R$e>rwVx_WUB|~V`p^JHsg*y12lzj&zF}w6W09HwB2yb z%Q~`es&(;7#*DUC_w-Dmt7|$*?TA_m;zB+-u{2;Bg{O}nV7G_@7~<)Bv8fH^G$XG8$(&{A zwXJK5LRK%M34(t$&NI~MHT{UQ9qN-V_yn|%PqC81EIiSzmMM=2zb`mIwiP_b)x+2M z7Gd`83h79j#SItpQ}luuf2uOU`my_rY5T{6P#BNlb%h%<#MZb=m@y5aW;#o1^2Z)SWo+b`y0gV^iRcZtz5!-05vF z7wNo=hc6h4hc&s@uL^jqRvD6thVYtbErDK9k!;+a0xoE0WL7zLixjn5;$fXvT=O3I zT6jI&^A7k6R{&5#lVjz#8%_RiAa2{di{`kx79K+j72$H(!ass|B%@l%KeeKchYLe_ z>!(JC2fxsv>XVen+Y42GeYPxMWqm`6F$(E<6^s|g(slNk!lL*6v^W2>f6hh^mE$s= z3D$)}{V5(Qm&A6bp%2Q}*GZ5Qrf}n7*Hr51?bJOyA-?B4vg6y_EX<*-e20h{=0Mxs zbuQGZ$fLyO5v$nQ&^kuH+mNq9O#MWSfThtH|0q1i!NrWj^S}_P;Q1OkYLW6U^?_7G zx2wg?CULj7))QU(n{$0JE%1t2dWrMi2g-Os{v|8^wK{@qlj%+1b^?NI z$}l2tjp0g>K3O+p%yK<9!XqmQ?E9>z&(|^Pi~aSRwI5x$jaA62GFz9%fmO3t3a>cq zK8Xbv=5Ps~4mKN5+Eqw12(!PEyedFXv~VLxMB~HwT1Vfo51pQ#D8e$e4pFZ{&RC2P z5gTIzl{3!&(tor^BwZfR8j4k{7Rq#`riKXP2O-Bh66#WWK2w=z;iD9GLl+3 zpHIaI4#lQ&S-xBK8PiQ%dwOh?%BO~DCo06pN7<^dnZCN@NzY{_Z1>rrB0U|nC&+!2 z2y!oBcTd2;@lzyk(B=TkyZ)zy0deK05*Q0zk+o$@nun`VI1Er7pjq>8V zNmlW{p7S^Btgb(TA}jL(uR>`0w8gHP^T~Sh5Tkip^spk4SBAhC{TZU}_Z)UJw-}zm zPq{KBm!k)?P{`-(9?LFt&YN4s%SIZ-9lJ!Ws~B%exHOeVFk3~}HewnnH(d)qkLQ_d z6h>O)pEE{vbOVw}E+jdYC^wM+AAhaI(YAibUc@B#_mDss0Ji&BK{WG`4 zOk>vSNq(Bq2IB@s>>Rxm6Wv?h;ZXkpb1l8u|+_qXWdC*jjcPCixq;!%BVPSp#hP zqo`%cNf&YoQXHC$D=D45RiT|5ngPlh?0T~?lUf*O)){K@*Kbh?3RW1j9-T?%lDk@y z4+~?wKI%Y!-=O|_IuKz|=)F;V7ps=5@g)RrE;;tvM$gUhG>jHcw2Hr@fS+k^Zr~>G z^JvPrZc}_&d_kEsqAEMTMJw!!CBw)u&ZVzmq+ZworuaE&TT>$pYsd9|g9O^0orAe8 z221?Va!l1|Y5X1Y?{G7rt1sX#qFA^?RLG^VjoxPf63;AS=_mVDfGJKg73L zsGdnTUD40y(>S##2l|W2Cy!H(@@5KBa(#gs`vlz}Y~$ot5VsqPQ{{YtjYFvIumZzt zA{CcxZLJR|4#{j7k~Tu*jkwz8QA|5G1$Cl895R`Zyp;irp1{KN){kB30O8P1W5;@bG znvX74roeMmQlUi=v9Y%(wl$ZC#9tKNFpvi3!C}f1m6Ct|l2g%psc{TJp)@yu)*e2> z((p0Fg*8gJ!|3WZke9;Z{8}&NRkv7iP=#_y-F}x^y?2m%-D_aj^)f04%mneyjo_;) z6qc_Zu$q37d~X``*eP~Q>I2gg%rrV8v=kDfpp$=%Vj}hF)^dsSWygoN(A$g*E=Do6FX?&(@F#7pbiJ`;c0c@Ul zDqW_90Wm#5f2L<(Lf3)3TeXtI7nhYwRm(F;*r_G6K@OPW4H(Y3O5SjUzBC}u3d|eQ8*8d@?;zUPE+i#QNMn=r(ap?2SH@vo*m z3HJ%XuG_S6;QbWy-l%qU;8x;>z>4pMW7>R}J%QLf%@1BY(4f_1iixd-6GlO7Vp*yU zp{VU^3?s?90i=!#>H`lxT!q8rk>W_$2~kbpz7eV{3wR|8E=8**5?qn8#n`*(bt1xRQrdGxyx2y%B$qmw#>ZV$c7%cO#%JM1lY$Y0q?Yuo> ze9KdJoiM)RH*SB%^;TAdX-zEjA7@%y=!0=Zg%iWK7jVI9b&Dk}0$Af&08KHo+ zOwDhFvA(E|ER%a^cdh@^wLUlmIv6?_3=BvX8jKk92L=Y}7Jf5OGMfh` zBdR1wFCi-i5@`9km{isRb0O%TX+f~)KNaEz{rXQa89`YIF;EN&gN)cigu6mNh>?Cm zAO&Im2flv6D{jwm+y<%WsPe4!89n~KN|7}Cb{Z;XweER73r}Qp2 zz}WP4j}U0&(uD&9yGy6`!+_v-S(yG*iytsTR#x_Rc>=6u^vnRDnf1gP{#2>`ffrAC% zTZ5WQ@hAK;P;>kX{D)mIXe4%a5p=LO1xXH@8T?mz7Q@d)$3pL{{B!2{-v70L*o1AO+|n5beiw~ zk@(>m?T3{2k2c;NWc^`4@P&Z?BjxXJ@;x1qhn)9Mn*IFdt_J-dIqx5#d`NfyfX~m( zIS~5)MfZ2Uy?_4W`47i}u0ZgPh<{D|w_d#;D}Q&U$Q-G}xM1A@1f{#%A$jh6Qp&0hQ<0bPOM z-{1Wm&p%%#eb_?x7i;bol EfAhh=DF6Tf literal 0 HcmV?d00001 diff --git a/hexagonaljava/.mvn/wrapper/maven-wrapper.properties b/hexagonaljava/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..642d572ce9 --- /dev/null +++ b/hexagonaljava/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/hexagonaljava/mvnw b/hexagonaljava/mvnw new file mode 100755 index 0000000000..a16b5431b4 --- /dev/null +++ b/hexagonaljava/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/hexagonaljava/mvnw.cmd b/hexagonaljava/mvnw.cmd new file mode 100644 index 0000000000..c8d43372c9 --- /dev/null +++ b/hexagonaljava/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/hexagonaljava/pom.xml b/hexagonaljava/pom.xml new file mode 100644 index 0000000000..d9ca173888 --- /dev/null +++ b/hexagonaljava/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.2.5.RELEASE + + + com.baeldung. + hexagonaljava + 0.0.1-SNAPSHOT + hexagonaljava + Demo project for Spring Boot + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + org.springframework.boot + spring-boot-starter-jdbc + + + + com.h2database + h2 + runtime + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java new file mode 100644 index 0000000000..603f8297d1 --- /dev/null +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.hexagonaljava; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HexagonaljavaApplication { + + public static void main(String[] args) { + SpringApplication.run(HexagonaljavaApplication.class, args); + } + +} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java new file mode 100644 index 0000000000..7db6117f83 --- /dev/null +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java @@ -0,0 +1,29 @@ +package com.baeldung.hexagonaljava.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.hexagonaljava.entity.Student; +import com.baeldung.hexagonaljava.service.StudentResultService; + +@RestController +public class StudentResultController { + + @Autowired + private StudentResultService studentResultService; + + @PostMapping(value = "/save") + public void saveStudent(@RequestBody Student student) { + studentResultService.save(student); + } + + @GetMapping(value = "/getTotalMarks/{id}") + public Double getTotalMarks(@PathVariable Integer id) { + return studentResultService.getTotalMarks(id); + } + +} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java new file mode 100644 index 0000000000..ef721e6eda --- /dev/null +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java @@ -0,0 +1,37 @@ +package com.baeldung.hexagonaljava.entity; + +import java.util.Map; + +public class Student { + + private Integer id; + + private String name; + + private Map marks; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Map getMarks() { + return marks; + } + + public void setMarks(Map marks) { + this.marks = marks; + } + +} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java new file mode 100644 index 0000000000..1d347346a2 --- /dev/null +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java @@ -0,0 +1,84 @@ +package com.baeldung.hexagonaljava.repository; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; +import org.springframework.jdbc.core.BatchPreparedStatementSetter; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowCallbackHandler; +import org.springframework.stereotype.Component; + +import com.baeldung.hexagonaljava.entity.Student; + +@Primary +@Component +public class StudentResultJdbcRepoImpl implements StudentResultRepo { + + @Autowired + JdbcTemplate jdbcTemplate; + + @Override + public void save(Student student) { + + jdbcTemplate.update("insert into student (id, name) " + "values(?, ?)", new Object[] { student.getId(), student.getName() }); + insertResult(student); + + } + + public void insertResult(Student student) { + + String insertQuery = "insert into " + "studentresult " + "(subject,marks,id) " + "values " + "(?,?,?)"; + + for (final Map.Entry entry : student.getMarks() + .entrySet()) { + + this.jdbcTemplate.batchUpdate(insertQuery, new BatchPreparedStatementSetter() { + + @Override + public void setValues(final PreparedStatement ps, final int i) throws SQLException { + + ps.setString(1, entry.getKey()); + ps.setDouble(2, entry.getValue()); + ps.setInt(3, student.getId()); + } + + public int getBatchSize() { + return student.getMarks() + .size(); + } + }); + } + + } + + @Override + public Student getStudent(Integer id) { + + String selectQuery = "select * from ( select * from student where id = ? ) s left join studentresult on s.id = studentresult.id"; + Student student = new Student(); + jdbcTemplate.query(selectQuery, new Object[] { id }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + while (rs.next()) { + + if (student.getId() == null) { + student.setId(rs.getInt("id")); + student.setName(rs.getString("name")); + student.setMarks(new HashMap()); + } + String subject = rs.getString("subject"); + Double marks = rs.getDouble("marks"); + student.getMarks() + .put(subject, marks); + + } + } + }); + return student; + } + +} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java new file mode 100644 index 0000000000..1ee4e2b9e5 --- /dev/null +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java @@ -0,0 +1,11 @@ +package com.baeldung.hexagonaljava.repository; + +import com.baeldung.hexagonaljava.entity.Student; + +public interface StudentResultRepo { + + void save(Student student); + + Student getStudent(Integer id); + +} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java new file mode 100644 index 0000000000..6c94aa0083 --- /dev/null +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java @@ -0,0 +1,26 @@ +package com.baeldung.hexagonaljava.repository; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.stereotype.Repository; + +import com.baeldung.hexagonaljava.entity.Student; + +@Repository +public class StudentResultRepoImpl implements StudentResultRepo { + + private Map studentsMap = new HashMap(); + + @Override + public void save(Student student) { + studentsMap.put(student.getId(), student); + + } + + @Override + public Student getStudent(Integer id) { + return studentsMap.get(id); + } + +} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java new file mode 100644 index 0000000000..d77ac5dca8 --- /dev/null +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java @@ -0,0 +1,11 @@ +package com.baeldung.hexagonaljava.service; + +import com.baeldung.hexagonaljava.entity.Student; + +public interface StudentResultService { + + public void save(Student student); + + public Double getTotalMarks(Integer id); + +} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java new file mode 100644 index 0000000000..d0b53e79f6 --- /dev/null +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java @@ -0,0 +1,32 @@ +package com.baeldung.hexagonaljava.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.baeldung.hexagonaljava.entity.Student; +import com.baeldung.hexagonaljava.repository.StudentResultRepo; + +@Component +public class StudentResultServiceImpl implements StudentResultService { + + @Autowired + private StudentResultRepo studentResultRepo; + + @Override + public void save(Student student) { + studentResultRepo.save(student); + + } + + @Override + public Double getTotalMarks(Integer id) { + Student student = studentResultRepo.getStudent(id); + double totalMarks = 0; + for (double marks : student.getMarks() + .values()) { + totalMarks += marks; + } + return totalMarks; + } + +} diff --git a/hexagonaljava/src/main/resources/application.properties b/hexagonaljava/src/main/resources/application.properties new file mode 100644 index 0000000000..5952b7eb01 --- /dev/null +++ b/hexagonaljava/src/main/resources/application.properties @@ -0,0 +1,5 @@ +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.h2.console.enabled=false diff --git a/hexagonaljava/src/main/resources/schema.sql b/hexagonaljava/src/main/resources/schema.sql new file mode 100644 index 0000000000..4dab9fbb1f --- /dev/null +++ b/hexagonaljava/src/main/resources/schema.sql @@ -0,0 +1,11 @@ +CREATE TABLE STUDENT ( + id INT PRIMARY KEY, + name VARCHAR(250) NOT NULL +); + +CREATE TABLE STUDENTRESULT( +subject VARCHAR(250) NOT NULL, +marks NUMERIC(8,2), +id VARCHAR(250), +FOREIGN KEY (id) references STUDENT(id) +); \ No newline at end of file diff --git a/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java b/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java new file mode 100644 index 0000000000..c61c51f7b2 --- /dev/null +++ b/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java @@ -0,0 +1,13 @@ +package com.baeldung.hexagonaljava; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class HexagonaljavaApplicationTests { + + @Test + void contextLoads() { + } + +} From 635e2ae55c1bdc3c1ec74960d76abf96f2729bca Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Fri, 27 Mar 2020 00:40:04 +0530 Subject: [PATCH 0004/1862] removing unnecessary maven files from pull request and spaces in code --- hexagonaljava/.gitignore | 31 -- .../.mvn/wrapper/MavenWrapperDownloader.java | 117 ------- hexagonaljava/.mvn/wrapper/maven-wrapper.jar | Bin 50710 -> 0 bytes .../.mvn/wrapper/maven-wrapper.properties | 2 - hexagonaljava/mvnw | 310 ------------------ hexagonaljava/mvnw.cmd | 182 ---------- .../HexagonaljavaApplication.java | 1 - .../controller/StudentResultController.java | 1 - .../hexagonaljava/entity/Student.java | 1 - .../repository/StudentResultJdbcRepoImpl.java | 17 +- .../repository/StudentResultRepo.java | 1 - .../repository/StudentResultRepoImpl.java | 2 - .../service/StudentResultService.java | 5 +- .../service/StudentResultServiceImpl.java | 4 +- hexagonaljava/src/main/resources/schema.sql | 2 +- 15 files changed, 7 insertions(+), 669 deletions(-) delete mode 100644 hexagonaljava/.gitignore delete mode 100644 hexagonaljava/.mvn/wrapper/MavenWrapperDownloader.java delete mode 100644 hexagonaljava/.mvn/wrapper/maven-wrapper.jar delete mode 100644 hexagonaljava/.mvn/wrapper/maven-wrapper.properties delete mode 100755 hexagonaljava/mvnw delete mode 100644 hexagonaljava/mvnw.cmd diff --git a/hexagonaljava/.gitignore b/hexagonaljava/.gitignore deleted file mode 100644 index a2a3040aa8..0000000000 --- a/hexagonaljava/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -HELP.md -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/** -!**/src/test/** - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ - -### VS Code ### -.vscode/ diff --git a/hexagonaljava/.mvn/wrapper/MavenWrapperDownloader.java b/hexagonaljava/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index e76d1f3241..0000000000 --- a/hexagonaljava/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2007-present the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import java.net.*; -import java.io.*; -import java.nio.channels.*; -import java.util.Properties; - -public class MavenWrapperDownloader { - - private static final String WRAPPER_VERSION = "0.5.6"; - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" - + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if(mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if(mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if(!outputFile.getParentFile().exists()) { - if(!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { - String username = System.getenv("MVNW_USERNAME"); - char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); - Authenticator.setDefault(new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(username, password); - } - }); - } - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/hexagonaljava/.mvn/wrapper/maven-wrapper.jar b/hexagonaljava/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50710 zcmbTd1CVCTmM+|7+wQV$+qP}n>auOywyU~q+qUhh+uxis_~*a##hm*_WW?9E7Pb7N%LRFiwbEGCJ0XP=%-6oeT$XZcYgtzC2~q zk(K08IQL8oTl}>>+hE5YRgXTB@fZ4TH9>7=79e`%%tw*SQUa9~$xKD5rS!;ZG@ocK zQdcH}JX?W|0_Afv?y`-NgLum62B&WSD$-w;O6G0Sm;SMX65z)l%m1e-g8Q$QTI;(Q z+x$xth4KFvH@Bs6(zn!iF#nenk^Y^ce;XIItAoCsow38eq?Y-Auh!1in#Rt-_D>H^ z=EjbclGGGa6VnaMGmMLj`x3NcwA43Jb(0gzl;RUIRAUDcR1~99l2SAPkVhoRMMtN} zXvC<tOmX83grD8GSo_Lo?%lNfhD#EBgPo z*nf@ppMC#B!T)Ae0RG$mlJWmGl7CkuU~B8-==5i;rS;8i6rJ=PoQxf446XDX9g|c> zU64ePyMlsI^V5Jq5A+BPe#e73+kpc_r1tv#B)~EZ;7^67F0*QiYfrk0uVW;Qb=NsG zN>gsuCwvb?s-KQIppEaeXtEMdc9dy6Dfduz-tMTms+i01{eD9JE&h?Kht*$eOl#&L zJdM_-vXs(V#$Ed;5wyNWJdPNh+Z$+;$|%qR(t`4W@kDhd*{(7-33BOS6L$UPDeE_53j${QfKN-0v-HG z(QfyvFNbwPK%^!eIo4ac1;b>c0vyf9}Xby@YY!lkz-UvNp zwj#Gg|4B~?n?G^{;(W;|{SNoJbHTMpQJ*Wq5b{l9c8(%?Kd^1?H1om1de0Da9M;Q=n zUfn{f87iVb^>Exl*nZ0hs(Yt>&V9$Pg`zX`AI%`+0SWQ4Zc(8lUDcTluS z5a_KerZWe}a-MF9#Cd^fi!y3%@RFmg&~YnYZ6<=L`UJ0v={zr)>$A;x#MCHZy1st7 ztT+N07NR+vOwSV2pvWuN1%lO!K#Pj0Fr>Q~R40{bwdL%u9i`DSM4RdtEH#cW)6}+I-eE< z&tZs+(Ogu(H_;$a$!7w`MH0r%h&@KM+<>gJL@O~2K2?VrSYUBbhCn#yy?P)uF3qWU z0o09mIik+kvzV6w>vEZy@&Mr)SgxPzUiDA&%07m17udz9usD82afQEps3$pe!7fUf z0eiidkJ)m3qhOjVHC_M(RYCBO%CZKZXFb8}s0-+}@CIn&EF(rRWUX2g^yZCvl0bI} zbP;1S)iXnRC&}5-Tl(hASKqdSnO?ASGJ*MIhOXIblmEudj(M|W!+I3eDc}7t`^mtg z)PKlaXe(OH+q-)qcQ8a@!llRrpGI8DsjhoKvw9T;TEH&?s=LH0w$EzI>%u;oD@x83 zJL7+ncjI9nn!TlS_KYu5vn%f*@qa5F;| zEFxY&B?g=IVlaF3XNm_03PA)=3|{n-UCgJoTr;|;1AU9|kPE_if8!Zvb}0q$5okF$ zHaJdmO&gg!9oN|M{!qGE=tb|3pVQ8PbL$}e;NgXz<6ZEggI}wO@aBP**2Wo=yN#ZC z4G$m^yaM9g=|&!^ft8jOLuzc3Psca*;7`;gnHm}tS0%f4{|VGEwu45KptfNmwxlE~ z^=r30gi@?cOm8kAz!EylA4G~7kbEiRlRIzwrb~{_2(x^$-?|#e6Bi_**(vyr_~9Of z!n>Gqf+Qwiu!xhi9f53=PM3`3tNF}pCOiPU|H4;pzjcsqbwg*{{kyrTxk<;mx~(;; z1NMrpaQ`57yn34>Jo3b|HROE(UNcQash!0p2-!Cz;{IRv#Vp5!3o$P8!%SgV~k&Hnqhp`5eLjTcy93cK!3Hm-$`@yGnaE=?;*2uSpiZTs_dDd51U%i z{|Zd9ou-;laGS_x=O}a+ zB||za<795A?_~Q=r=coQ+ZK@@ zId~hWQL<%)fI_WDIX#=(WNl!Dm$a&ROfLTd&B$vatq!M-2Jcs;N2vps$b6P1(N}=oI3<3luMTmC|0*{ zm1w8bt7vgX($!0@V0A}XIK)w!AzUn7vH=pZEp0RU0p?}ch2XC-7r#LK&vyc2=-#Q2 z^L%8)JbbcZ%g0Du;|8=q8B>X=mIQirpE=&Ox{TiuNDnOPd-FLI^KfEF729!!0x#Es z@>3ursjFSpu%C-8WL^Zw!7a0O-#cnf`HjI+AjVCFitK}GXO`ME&on|^=~Zc}^LBp9 zj=-vlN;Uc;IDjtK38l7}5xxQF&sRtfn4^TNtnzXv4M{r&ek*(eNbIu!u$>Ed%` z5x7+&)2P&4>0J`N&ZP8$vcR+@FS0126s6+Jx_{{`3ZrIMwaJo6jdrRwE$>IU_JTZ} z(||hyyQ)4Z1@wSlT94(-QKqkAatMmkT7pCycEB1U8KQbFX&?%|4$yyxCtm3=W`$4fiG0WU3yI@c zx{wfmkZAYE_5M%4{J-ygbpH|(|GD$2f$3o_Vti#&zfSGZMQ5_f3xt6~+{RX=$H8at z?GFG1Tmp}}lmm-R->ve*Iv+XJ@58p|1_jRvfEgz$XozU8#iJS})UM6VNI!3RUU!{5 zXB(+Eqd-E;cHQ>)`h0(HO_zLmzR3Tu-UGp;08YntWwMY-9i^w_u#wR?JxR2bky5j9 z3Sl-dQQU$xrO0xa&>vsiK`QN<$Yd%YXXM7*WOhnRdSFt5$aJux8QceC?lA0_if|s> ze{ad*opH_kb%M&~(~&UcX0nFGq^MqjxW?HJIP462v9XG>j(5Gat_)#SiNfahq2Mz2 zU`4uV8m$S~o9(W>mu*=h%Gs(Wz+%>h;R9Sg)jZ$q8vT1HxX3iQnh6&2rJ1u|j>^Qf`A76K%_ubL`Zu?h4`b=IyL>1!=*%!_K)=XC z6d}4R5L+sI50Q4P3upXQ3Z!~1ZXLlh!^UNcK6#QpYt-YC=^H=EPg3)z*wXo*024Q4b2sBCG4I# zlTFFY=kQ>xvR+LsuDUAk)q%5pEcqr(O_|^spjhtpb1#aC& zghXzGkGDC_XDa%t(X`E+kvKQ4zrQ*uuQoj>7@@ykWvF332)RO?%AA&Fsn&MNzmFa$ zWk&&^=NNjxLjrli_8ESU)}U|N{%j&TQmvY~lk!~Jh}*=^INA~&QB9em!in_X%Rl1&Kd~Z(u z9mra#<@vZQlOY+JYUwCrgoea4C8^(xv4ceCXcejq84TQ#sF~IU2V}LKc~Xlr_P=ry zl&Hh0exdCbVd^NPCqNNlxM3vA13EI8XvZ1H9#bT7y*U8Y{H8nwGpOR!e!!}*g;mJ#}T{ekSb}5zIPmye*If(}}_=PcuAW#yidAa^9-`<8Gr0 z)Fz=NiZ{)HAvw{Pl5uu)?)&i&Us$Cx4gE}cIJ}B4Xz~-q7)R_%owbP!z_V2=Aq%Rj z{V;7#kV1dNT9-6R+H}}(ED*_!F=~uz>&nR3gb^Ce%+0s#u|vWl<~JD3MvS0T9thdF zioIG3c#Sdsv;LdtRv3ml7%o$6LTVL>(H`^@TNg`2KPIk*8-IB}X!MT0`hN9Ddf7yN z?J=GxPL!uJ7lqwowsl?iRrh@#5C$%E&h~Z>XQcvFC*5%0RN-Opq|=IwX(dq(*sjs+ zqy99+v~m|6T#zR*e1AVxZ8djd5>eIeCi(b8sUk)OGjAsKSOg^-ugwl2WSL@d#?mdl zib0v*{u-?cq}dDGyZ%$XRY=UkQwt2oGu`zQneZh$=^! zj;!pCBWQNtvAcwcWIBM2y9!*W|8LmQy$H~5BEx)78J`4Z0(FJO2P^!YyQU{*Al+fs z){!4JvT1iLrJ8aU3k0t|P}{RN)_^v%$$r;+p0DY7N8CXzmS*HB*=?qaaF9D@#_$SN zSz{moAK<*RH->%r7xX~9gVW$l7?b|_SYI)gcjf0VAUJ%FcQP(TpBs; zg$25D!Ry_`8xpS_OJdeo$qh#7U+cepZ??TII7_%AXsT$B z=e)Bx#v%J0j``00Zk5hsvv6%T^*xGNx%KN-=pocSoqE5_R)OK%-Pbu^1MNzfds)mL zxz^F4lDKV9D&lEY;I+A)ui{TznB*CE$=9(wgE{m}`^<--OzV-5V4X2w9j(_!+jpTr zJvD*y6;39&T+==$F&tsRKM_lqa1HC}aGL0o`%c9mO=fts?36@8MGm7Vi{Y z^<7m$(EtdSr#22<(rm_(l_(`j!*Pu~Y>>xc>I9M#DJYDJNHO&4=HM%YLIp?;iR&$m z#_$ZWYLfGLt5FJZhr3jpYb`*%9S!zCG6ivNHYzNHcI%khtgHBliM^Ou}ZVD7ehU9 zS+W@AV=?Ro!=%AJ>Kcy9aU3%VX3|XM_K0A+ZaknKDyIS3S-Hw1C7&BSW5)sqj5Ye_ z4OSW7Yu-;bCyYKHFUk}<*<(@TH?YZPHr~~Iy%9@GR2Yd}J2!N9K&CN7Eq{Ka!jdu; zQNB*Y;i(7)OxZK%IHGt#Rt?z`I|A{q_BmoF!f^G}XVeTbe1Wnzh%1g>j}>DqFf;Rp zz7>xIs12@Ke0gr+4-!pmFP84vCIaTjqFNg{V`5}Rdt~xE^I;Bxp4)|cs8=f)1YwHz zqI`G~s2~qqDV+h02b`PQpUE#^^Aq8l%y2|ByQeXSADg5*qMprEAE3WFg0Q39`O+i1 z!J@iV!`Y~C$wJ!5Z+j5$i<1`+@)tBG$JL=!*uk=2k;T<@{|s1$YL079FvK%mPhyHV zP8^KGZnp`(hVMZ;s=n~3r2y;LTwcJwoBW-(ndU-$03{RD zh+Qn$ja_Z^OuMf3Ub|JTY74s&Am*(n{J3~@#OJNYuEVVJd9*H%)oFoRBkySGm`hx! zT3tG|+aAkXcx-2Apy)h^BkOyFTWQVeZ%e2@;*0DtlG9I3Et=PKaPt&K zw?WI7S;P)TWED7aSH$3hL@Qde?H#tzo^<(o_sv_2ci<7M?F$|oCFWc?7@KBj-;N$P zB;q!8@bW-WJY9do&y|6~mEruZAVe$!?{)N9rZZxD-|oltkhW9~nR8bLBGXw<632!l z*TYQn^NnUy%Ds}$f^=yQ+BM-a5X4^GHF=%PDrRfm_uqC zh{sKwIu|O0&jWb27;wzg4w5uA@TO_j(1X?8E>5Zfma|Ly7Bklq|s z9)H`zoAGY3n-+&JPrT!>u^qg9Evx4y@GI4$n-Uk_5wttU1_t?6><>}cZ-U+&+~JE) zPlDbO_j;MoxdLzMd~Ew|1o^a5q_1R*JZ=#XXMzg?6Zy!^hop}qoLQlJ{(%!KYt`MK z8umEN@Z4w!2=q_oe=;QttPCQy3Nm4F@x>@v4sz_jo{4m*0r%J(w1cSo;D_hQtJs7W z><$QrmG^+<$4{d2bgGo&3-FV}avg9zI|Rr(k{wTyl3!M1q+a zD9W{pCd%il*j&Ft z5H$nENf>>k$;SONGW`qo6`&qKs*T z2^RS)pXk9b@(_Fw1bkb)-oqK|v}r$L!W&aXA>IpcdNZ_vWE#XO8X`#Yp1+?RshVcd zknG%rPd*4ECEI0wD#@d+3NbHKxl}n^Sgkx==Iu%}HvNliOqVBqG?P2va zQ;kRJ$J6j;+wP9cS za#m;#GUT!qAV%+rdWolk+)6kkz4@Yh5LXP+LSvo9_T+MmiaP-eq6_k;)i6_@WSJ zlT@wK$zqHu<83U2V*yJ|XJU4farT#pAA&@qu)(PO^8PxEmPD4;Txpio+2)#!9 z>&=i7*#tc0`?!==vk>s7V+PL#S1;PwSY?NIXN2=Gu89x(cToFm))7L;< z+bhAbVD*bD=}iU`+PU+SBobTQ%S!=VL!>q$rfWsaaV}Smz>lO9JXT#`CcH_mRCSf4%YQAw`$^yY z3Y*^Nzk_g$xn7a_NO(2Eb*I=^;4f!Ra#Oo~LLjlcjke*k*o$~U#0ZXOQ5@HQ&T46l z7504MUgZkz2gNP1QFN8Y?nSEnEai^Rgyvl}xZfMUV6QrJcXp;jKGqB=D*tj{8(_pV zqyB*DK$2lgYGejmJUW)*s_Cv65sFf&pb(Yz8oWgDtQ0~k^0-wdF|tj}MOXaN@ydF8 zNr={U?=;&Z?wr^VC+`)S2xl}QFagy;$mG=TUs7Vi2wws5zEke4hTa2)>O0U?$WYsZ z<8bN2bB_N4AWd%+kncgknZ&}bM~eDtj#C5uRkp21hWW5gxWvc6b*4+dn<{c?w9Rmf zIVZKsPl{W2vQAlYO3yh}-{Os=YBnL8?uN5(RqfQ=-1cOiUnJu>KcLA*tQK3FU`_bM zM^T28w;nAj5EdAXFi&Kk1Nnl2)D!M{@+D-}bIEe+Lc4{s;YJc-{F#``iS2uk;2!Zp zF9#myUmO!wCeJIoi^A+T^e~20c+c2C}XltaR!|U-HfDA=^xF97ev}$l6#oY z&-&T{egB)&aV$3_aVA51XGiU07$s9vubh_kQG?F$FycvS6|IO!6q zq^>9|3U^*!X_C~SxX&pqUkUjz%!j=VlXDo$!2VLH!rKj@61mDpSr~7B2yy{>X~_nc zRI+7g2V&k zd**H++P9dg!-AOs3;GM`(g<+GRV$+&DdMVpUxY9I1@uK28$az=6oaa+PutlO9?6#? zf-OsgT>^@8KK>ggkUQRPPgC7zjKFR5spqQb3ojCHzj^(UH~v+!y*`Smv)VpVoPwa6 zWG18WJaPKMi*F6Zdk*kU^`i~NNTfn3BkJniC`yN98L-Awd)Z&mY? zprBW$!qL-OL7h@O#kvYnLsfff@kDIegt~?{-*5A7JrA;#TmTe?jICJqhub-G@e??D zqiV#g{)M!kW1-4SDel7TO{;@*h2=_76g3NUD@|c*WO#>MfYq6_YVUP+&8e4|%4T`w zXzhmVNziAHazWO2qXcaOu@R1MrPP{t)`N)}-1&~mq=ZH=w=;-E$IOk=y$dOls{6sRR`I5>|X zpq~XYW4sd;J^6OwOf**J>a7u$S>WTFPRkjY;BfVgQst)u4aMLR1|6%)CB^18XCz+r ztkYQ}G43j~Q&1em(_EkMv0|WEiKu;z2zhb(L%$F&xWwzOmk;VLBYAZ8lOCziNoPw1 zv2BOyXA`A8z^WH!nXhKXM`t0;6D*-uGds3TYGrm8SPnJJOQ^fJU#}@aIy@MYWz**H zvkp?7I5PE{$$|~{-ZaFxr6ZolP^nL##mHOErB^AqJqn^hFA=)HWj!m3WDaHW$C)i^ z9@6G$SzB=>jbe>4kqr#sF7#K}W*Cg-5y6kun3u&0L7BpXF9=#7IN8FOjWrWwUBZiU zT_se3ih-GBKx+Uw0N|CwP3D@-C=5(9T#BH@M`F2!Goiqx+Js5xC92|Sy0%WWWp={$(am!#l~f^W_oz78HX<0X#7 zp)p1u~M*o9W@O8P{0Qkg@Wa# z2{Heb&oX^CQSZWSFBXKOfE|tsAm#^U-WkDnU;IowZ`Ok4!mwHwH=s|AqZ^YD4!5!@ zPxJj+Bd-q6w_YG`z_+r;S86zwXb+EO&qogOq8h-Ect5(M2+>(O7n7)^dP*ws_3U6v zVsh)sk^@*c>)3EML|0<-YROho{lz@Nd4;R9gL{9|64xVL`n!m$-Jjrx?-Bacp!=^5 z1^T^eB{_)Y<9)y{-4Rz@9_>;_7h;5D+@QcbF4Wv7hu)s0&==&6u)33 zHRj+&Woq-vDvjwJCYES@$C4{$?f$Ibi4G()UeN11rgjF+^;YE^5nYprYoJNoudNj= zm1pXSeG64dcWHObUetodRn1Fw|1nI$D9z}dVEYT0lQnsf_E1x2vBLql7NrHH!n&Sq z6lc*mvU=WS6=v9Lrl}&zRiu_6u;6g%_DU{9b+R z#YHqX7`m9eydf?KlKu6Sb%j$%_jmydig`B*TN`cZL-g!R)iE?+Q5oOqBFKhx z%MW>BC^(F_JuG(ayE(MT{S3eI{cKiwOtPwLc0XO*{*|(JOx;uQOfq@lp_^cZo=FZj z4#}@e@dJ>Bn%2`2_WPeSN7si^{U#H=7N4o%Dq3NdGybrZgEU$oSm$hC)uNDC_M9xc zGzwh5Sg?mpBIE8lT2XsqTt3j3?We8}3bzLBTQd639vyg^$0#1epq8snlDJP2(BF)K zSx30RM+{f+b$g{9usIL8H!hCO117Xgv}ttPJm9wVRjPk;ePH@zxv%j9k5`TzdXLeT zFgFX`V7cYIcBls5WN0Pf6SMBN+;CrQ(|EsFd*xtwr#$R{Z9FP`OWtyNsq#mCgZ7+P z^Yn$haBJ)r96{ZJd8vlMl?IBxrgh=fdq_NF!1{jARCVz>jNdC)H^wfy?R94#MPdUjcYX>#wEx+LB#P-#4S-%YH>t-j+w zOFTI8gX$ard6fAh&g=u&56%3^-6E2tpk*wx3HSCQ+t7+*iOs zPk5ysqE}i*cQocFvA68xHfL|iX(C4h*67@3|5Qwle(8wT&!&{8*{f%0(5gH+m>$tq zp;AqrP7?XTEooYG1Dzfxc>W%*CyL16q|fQ0_jp%%Bk^k!i#Nbi(N9&T>#M{gez_Ws zYK=l}adalV(nH}I_!hNeb;tQFk3BHX7N}}R8%pek^E`X}%ou=cx8InPU1EE0|Hen- zyw8MoJqB5=)Z%JXlrdTXAE)eqLAdVE-=>wGHrkRet}>3Yu^lt$Kzu%$3#(ioY}@Gu zjk3BZuQH&~7H+C*uX^4}F*|P89JX;Hg2U!pt>rDi(n(Qe-c}tzb0#6_ItoR0->LSt zR~UT<-|@TO%O`M+_e_J4wx7^)5_%%u+J=yF_S#2Xd?C;Ss3N7KY^#-vx+|;bJX&8r zD?|MetfhdC;^2WG`7MCgs>TKKN=^=!x&Q~BzmQio_^l~LboTNT=I zC5pme^P@ER``p$2md9>4!K#vV-Fc1an7pl>_|&>aqP}+zqR?+~Z;f2^`a+-!Te%V? z;H2SbF>jP^GE(R1@%C==XQ@J=G9lKX+Z<@5}PO(EYkJh=GCv#)Nj{DkWJM2}F&oAZ6xu8&g7pn1ps2U5srwQ7CAK zN&*~@t{`31lUf`O;2w^)M3B@o)_mbRu{-`PrfNpF!R^q>yTR&ETS7^-b2*{-tZAZz zw@q5x9B5V8Qd7dZ!Ai$9hk%Q!wqbE1F1c96&zwBBaRW}(^axoPpN^4Aw}&a5dMe+*Gomky_l^54*rzXro$ z>LL)U5Ry>~FJi=*{JDc)_**c)-&faPz`6v`YU3HQa}pLtb5K)u%K+BOqXP0)rj5Au$zB zW1?vr?mDv7Fsxtsr+S6ucp2l#(4dnr9sD*v+@*>g#M4b|U?~s93>Pg{{a5|rm2xfI z`>E}?9S@|IoUX{Q1zjm5YJT|3S>&09D}|2~BiMo=z4YEjXlWh)V&qs;*C{`UMxp$9 zX)QB?G$fPD6z5_pNs>Jeh{^&U^)Wbr?2D6-q?)`*1k@!UvwQgl8eG$r+)NnFoT)L6 zg7lEh+E6J17krfYJCSjWzm67hEth24pomhz71|Qodn#oAILN)*Vwu2qpJirG)4Wnv}9GWOFrQg%Je+gNrPl8mw7ykE8{ z=|B4+uwC&bpp%eFcRU6{mxRV32VeH8XxX>v$du<$(DfinaaWxP<+Y97Z#n#U~V zVEu-GoPD=9$}P;xv+S~Ob#mmi$JQmE;Iz4(){y*9pFyW-jjgdk#oG$fl4o9E8bo|L zWjo4l%n51@Kz-n%zeSCD`uB?T%FVk+KBI}=ve zvlcS#wt`U6wrJo}6I6Rwb=1GzZfwE=I&Ne@p7*pH84XShXYJRgvK)UjQL%R9Zbm(m zxzTQsLTON$WO7vM)*vl%Pc0JH7WhP;$z@j=y#avW4X8iqy6mEYr@-}PW?H)xfP6fQ z&tI$F{NNct4rRMSHhaelo<5kTYq+(?pY)Ieh8*sa83EQfMrFupMM@nfEV@EmdHUv9 z35uzIrIuo4#WnF^_jcpC@uNNaYTQ~uZWOE6P@LFT^1@$o&q+9Qr8YR+ObBkpP9=F+$s5+B!mX2~T zAuQ6RenX?O{IlLMl1%)OK{S7oL}X%;!XUxU~xJN8xk z`xywS*naF(J#?vOpB(K=o~lE;m$zhgPWDB@=p#dQIW>xe_p1OLoWInJRKbEuoncf; zmS1!u-ycc1qWnDg5Nk2D)BY%jmOwCLC+Ny>`f&UxFowIsHnOXfR^S;&F(KXd{ODlm z$6#1ccqt-HIH9)|@fHnrKudu!6B$_R{fbCIkSIb#aUN|3RM>zuO>dpMbROZ`^hvS@ z$FU-;e4W}!ubzKrU@R*dW*($tFZ>}dd*4_mv)#O>X{U@zSzQt*83l9mI zI$8O<5AIDx`wo0}f2fsPC_l>ONx_`E7kdXu{YIZbp1$(^oBAH({T~&oQ&1{X951QW zmhHUxd)t%GQ9#ak5fTjk-cahWC;>^Rg7(`TVlvy0W@Y!Jc%QL3Ozu# zDPIqBCy&T2PWBj+d-JA-pxZlM=9ja2ce|3B(^VCF+a*MMp`(rH>Rt6W1$;r{n1(VK zLs>UtkT43LR2G$AOYHVailiqk7naz2yZGLo*xQs!T9VN5Q>eE(w zw$4&)&6xIV$IO^>1N-jrEUg>O8G4^@y+-hQv6@OmF@gy^nL_n1P1-Rtyy$Bl;|VcV zF=p*&41-qI5gG9UhKmmnjs932!6hceXa#-qfK;3d*a{)BrwNFeKU|ge?N!;zk+kB! zMD_uHJR#%b54c2tr~uGPLTRLg$`fupo}cRJeTwK;~}A>(Acy4k-Xk&Aa1&eWYS1ULWUj@fhBiWY$pdfy+F z@G{OG{*v*mYtH3OdUjwEr6%_ZPZ3P{@rfbNPQG!BZ7lRyC^xlMpWH`@YRar`tr}d> z#wz87t?#2FsH-jM6m{U=gp6WPrZ%*w0bFm(T#7m#v^;f%Z!kCeB5oiF`W33W5Srdt zdU?YeOdPG@98H7NpI{(uN{FJdu14r(URPH^F6tOpXuhU7T9a{3G3_#Ldfx_nT(Hec zo<1dyhsVsTw;ZkVcJ_0-h-T3G1W@q)_Q30LNv)W?FbMH+XJ* zy=$@39Op|kZv`Rt>X`zg&at(?PO^I=X8d9&myFEx#S`dYTg1W+iE?vt#b47QwoHI9 zNP+|3WjtXo{u}VG(lLUaW0&@yD|O?4TS4dfJI`HC-^q;M(b3r2;7|FONXphw-%7~* z&;2!X17|05+kZOpQ3~3!Nb>O94b&ZSs%p)TK)n3m=4eiblVtSx@KNFgBY_xV6ts;NF;GcGxMP8OKV^h6LmSb2E#Qnw ze!6Mnz7>lE9u{AgQ~8u2zM8CYD5US8dMDX-5iMlgpE9m*s+Lh~A#P1er*rF}GHV3h z=`STo?kIXw8I<`W0^*@mB1$}pj60R{aJ7>C2m=oghKyxMbFNq#EVLgP0cH3q7H z%0?L93-z6|+jiN|@v>ix?tRBU(v-4RV`}cQH*fp|)vd3)8i9hJ3hkuh^8dz{F5-~_ zUUr1T3cP%cCaTooM8dj|4*M=e6flH0&8ve32Q)0dyisl))XkZ7Wg~N}6y`+Qi2l+e zUd#F!nJp{#KIjbQdI`%oZ`?h=5G^kZ_uN`<(`3;a!~EMsWV|j-o>c?x#;zR2ktiB! z);5rrHl?GPtr6-o!tYd|uK;Vbsp4P{v_4??=^a>>U4_aUXPWQ$FPLE4PK$T^3Gkf$ zHo&9$U&G`d(Os6xt1r?sg14n)G8HNyWa^q8#nf0lbr4A-Fi;q6t-`pAx1T*$eKM*$ z|CX|gDrk#&1}>5H+`EjV$9Bm)Njw&7-ZR{1!CJTaXuP!$Pcg69`{w5BRHysB$(tWUes@@6aM69kb|Lx$%BRY^-o6bjH#0!7b;5~{6J+jKxU!Kmi# zndh@+?}WKSRY2gZ?Q`{(Uj|kb1%VWmRryOH0T)f3cKtG4oIF=F7RaRnH0Rc_&372={_3lRNsr95%ZO{IX{p@YJ^EI%+gvvKes5cY+PE@unghjdY5#9A!G z70u6}?zmd?v+{`vCu-53_v5@z)X{oPC@P)iA3jK$`r zSA2a7&!^zmUiZ82R2=1cumBQwOJUPz5Ay`RLfY(EiwKkrx%@YN^^XuET;tE zmr-6~I7j!R!KrHu5CWGSChO6deaLWa*9LLJbcAJsFd%Dy>a!>J`N)Z&oiU4OEP-!Ti^_!p}O?7`}i7Lsf$-gBkuY*`Zb z7=!nTT;5z$_5$=J=Ko+Cp|Q0J=%oFr>hBgnL3!tvFoLNhf#D0O=X^h+x08iB;@8pXdRHxX}6R4k@i6%vmsQwu^5z zk1ip`#^N)^#Lg#HOW3sPI33xqFB4#bOPVnY%d6prwxf;Y-w9{ky4{O6&94Ra8VN@K zb-lY;&`HtxW@sF!doT5T$2&lIvJpbKGMuDAFM#!QPXW87>}=Q4J3JeXlwHys?!1^#37q_k?N@+u&Ns20pEoBeZC*np;i;M{2C0Z4_br2gsh6eL z#8`#sn41+$iD?^GL%5?cbRcaa-Nx0vE(D=*WY%rXy3B%gNz0l?#noGJGP728RMY#q z=2&aJf@DcR?QbMmN)ItUe+VM_U!ryqA@1VVt$^*xYt~-qvW!J4Tp<-3>jT=7Zow5M z8mSKp0v4b%a8bxFr>3MwZHSWD73D@+$5?nZAqGM#>H@`)mIeC#->B)P8T$zh-Pxnc z8)~Zx?TWF4(YfKuF3WN_ckpCe5;x4V4AA3(i$pm|78{%!q?|~*eH0f=?j6i)n~Hso zmTo>vqEtB)`%hP55INf7HM@taH)v`Fw40Ayc*R!T?O{ziUpYmP)AH`euTK!zg9*6Z z!>M=$3pd0!&TzU=hc_@@^Yd3eUQpX4-33}b{?~5t5lgW=ldJ@dUAH%`l5US1y_`40 zs(X`Qk}vvMDYYq+@Rm+~IyCX;iD~pMgq^KY)T*aBz@DYEB={PxA>)mI6tM*sx-DmGQHEaHwRrAmNjO!ZLHO4b;;5mf@zzlPhkP($JeZGE7 z?^XN}Gf_feGoG~BjUgVa*)O`>lX=$BSR2)uD<9 z>o^|nb1^oVDhQbfW>>!;8-7<}nL6L^V*4pB=>wwW+RXAeRvKED(n1;R`A6v$6gy0I(;Vf?!4;&sgn7F%LpM}6PQ?0%2Z@b{It<(G1CZ|>913E0nR2r^Pa*Bp z@tFGi*CQ~@Yc-?{cwu1 zsilf=k^+Qs>&WZG(3WDixisHpR>`+ihiRwkL(3T|=xsoNP*@XX3BU8hr57l3k;pni zI``=3Nl4xh4oDj<%>Q1zYXHr%Xg_xrK3Nq?vKX3|^Hb(Bj+lONTz>4yhU-UdXt2>j z<>S4NB&!iE+ao{0Tx^N*^|EZU;0kJkx@zh}S^P{ieQjGl468CbC`SWnwLRYYiStXm zOxt~Rb3D{dz=nHMcY)#r^kF8|q8KZHVb9FCX2m^X*(|L9FZg!5a7((!J8%MjT$#Fs)M1Pb zq6hBGp%O1A+&%2>l0mpaIzbo&jc^!oN^3zxap3V2dNj3x<=TwZ&0eKX5PIso9j1;e zwUg+C&}FJ`k(M|%%}p=6RPUq4sT3-Y;k-<68ciZ~_j|bt>&9ZLHNVrp#+pk}XvM{8 z`?k}o-!if>hVlCP9j%&WI2V`5SW)BCeR5>MQhF)po=p~AYN%cNa_BbV6EEh_kk^@a zD>4&>uCGCUmyA-c)%DIcF4R6!>?6T~Mj_m{Hpq`*(wj>foHL;;%;?(((YOxGt)Bhx zuS+K{{CUsaC++%}S6~CJ=|vr(iIs-je)e9uJEU8ZJAz)w166q)R^2XI?@E2vUQ!R% zn@dxS!JcOimXkWJBz8Y?2JKQr>`~SmE2F2SL38$SyR1^yqj8_mkBp)o$@+3BQ~Mid z9U$XVqxX3P=XCKj0*W>}L0~Em`(vG<>srF8+*kPrw z20{z(=^w+ybdGe~Oo_i|hYJ@kZl*(9sHw#Chi&OIc?w`nBODp?ia$uF%Hs(X>xm?j zqZQ`Ybf@g#wli`!-al~3GWiE$K+LCe=Ndi!#CVjzUZ z!sD2O*;d28zkl))m)YN7HDi^z5IuNo3^w(zy8 zszJG#mp#Cj)Q@E@r-=NP2FVxxEAeOI2e=|KshybNB6HgE^(r>HD{*}S}mO>LuRGJT{*tfTzw_#+er-0${}%YPe@CMJ1Ng#j#)i)SnY@ss3gL;g zg2D~#Kpdfu#G;q1qz_TwSz1VJT(b3zby$Vk&;Y#1(A)|xj`_?i5YQ;TR%jice5E;0 zYHg;`zS5{S*9xI6o^j>rE8Ua*XhIw{_-*&@(R|C(am8__>+Ws&Q^ymy*X4~hR2b5r zm^p3sw}yv=tdyncy_Ui7{BQS732et~Z_@{-IhHDXAV`(Wlay<#hb>%H%WDi+K$862nA@BDtM#UCKMu+kM`!JHyWSi?&)A7_ z3{cyNG%a~nnH_!+;g&JxEMAmh-Z}rC!o7>OVzW&PoMyTA_g{hqXG)SLraA^OP**<7 zjWbr7z!o2n3hnx7A=2O=WL;`@9N{vQIM@&|G-ljrPvIuJHYtss0Er0fT5cMXNUf1B z7FAwBDixt0X7C3S)mPe5g`YtME23wAnbU)+AtV}z+e8G;0BP=bI;?(#|Ep!vVfDbK zvx+|CKF>yt0hWQ3drchU#XBU+HiuG*V^snFAPUp-5<#R&BUAzoB!aZ+e*KIxa26V}s6?nBK(U-7REa573wg-jqCg>H8~>O{ z*C0JL-?X-k_y%hpUFL?I>0WV{oV`Nb)nZbJG01R~AG>flIJf)3O*oB2i8~;!P?Wo_ z0|QEB*fifiL6E6%>tlAYHm2cjTFE@*<);#>689Z6S#BySQ@VTMhf9vYQyLeDg1*F} zjq>i1*x>5|CGKN{l9br3kB0EHY|k4{%^t7-uhjd#NVipUZa=EUuE5kS1_~qYX?>hJ z$}!jc9$O$>J&wnu0SgfYods^z?J4X;X7c77Me0kS-dO_VUQ39T(Kv(Y#s}Qqz-0AH z^?WRL(4RzpkD+T5FG_0NyPq-a-B7A5LHOCqwObRJi&oRi(<;OuIN7SV5PeHU$<@Zh zPozEV`dYmu0Z&Tqd>t>8JVde9#Pt+l95iHe$4Xwfy1AhI zDM4XJ;bBTTvRFtW>E+GzkN)9k!hA5z;xUOL2 zq4}zn-DP{qc^i|Y%rvi|^5k-*8;JZ~9a;>-+q_EOX+p1Wz;>i7c}M6Nv`^NY&{J-> z`(mzDJDM}QPu5i44**2Qbo(XzZ-ZDu%6vm8w@DUarqXj41VqP~ zs&4Y8F^Waik3y1fQo`bVUH;b=!^QrWb)3Gl=QVKr+6sxc=ygauUG|cm?|X=;Q)kQ8 zM(xrICifa2p``I7>g2R~?a{hmw@{!NS5`VhH8+;cV(F>B94M*S;5#O`YzZH1Z%yD? zZ61w(M`#aS-*~Fj;x|J!KM|^o;MI#Xkh0ULJcA?o4u~f%Z^16ViA27FxU5GM*rKq( z7cS~MrZ=f>_OWx8j#-Q3%!aEU2hVuTu(7`TQk-Bi6*!<}0WQi;_FpO;fhpL4`DcWp zGOw9vx0N~6#}lz(r+dxIGZM3ah-8qrqMmeRh%{z@dbUD2w15*_4P?I~UZr^anP}DB zU9CCrNiy9I3~d#&!$DX9e?A});BjBtQ7oGAyoI$8YQrkLBIH@2;lt4E^)|d6Jwj}z z&2_E}Y;H#6I4<10d_&P0{4|EUacwFHauvrjAnAm6yeR#}f}Rk27CN)vhgRqEyPMMS7zvunj2?`f;%?alsJ+-K+IzjJx>h8 zu~m_y$!J5RWAh|C<6+uiCNsOKu)E72M3xKK(a9Okw3e_*O&}7llNV!=P87VM2DkAk zci!YXS2&=P0}Hx|wwSc9JP%m8dMJA*q&VFB0yMI@5vWoAGraygwn){R+Cj6B1a2Px z5)u(K5{+;z2n*_XD!+Auv#LJEM)(~Hx{$Yb^ldQmcYF2zNH1V30*)CN_|1$v2|`LnFUT$%-tO0Eg|c5$BB~yDfzS zcOXJ$wpzVK0MfTjBJ0b$r#_OvAJ3WRt+YOLlJPYMx~qp>^$$$h#bc|`g0pF-Ao43? z>*A+8lx>}L{p(Tni2Vvk)dtzg$hUKjSjXRagj)$h#8=KV>5s)J4vGtRn5kP|AXIz! zPgbbVxW{2o4s-UM;c#We8P&mPN|DW7_uLF!a|^0S=wr6Esx9Z$2|c1?GaupU6$tb| zY_KU`(_29O_%k(;>^|6*pZURH3`@%EuKS;Ns z1lujmf;r{qAN&Q0&m{wJSZ8MeE7RM5+Sq;ul_ z`+ADrd_Um+G37js6tKsArNB}n{p*zTUxQr>3@wA;{EUbjNjlNd6$Mx zg0|MyU)v`sa~tEY5$en7^PkC=S<2@!nEdG6L=h(vT__0F=S8Y&eM=hal#7eM(o^Lu z2?^;05&|CNliYrq6gUv;|i!(W{0N)LWd*@{2q*u)}u*> z7MQgk6t9OqqXMln?zoMAJcc zMKaof_Up})q#DzdF?w^%tTI7STI^@8=Wk#enR*)&%8yje>+tKvUYbW8UAPg55xb70 zEn5&Ba~NmOJlgI#iS8W3-@N%>V!#z-ZRwfPO1)dQdQkaHsiqG|~we2ALqG7Ruup(DqSOft2RFg_X%3w?6VqvV1uzX_@F(diNVp z4{I|}35=11u$;?|JFBEE*gb;T`dy+8gWJ9~pNsecrO`t#V9jW-6mnfO@ff9od}b(3s4>p0i30gbGIv~1@a^F2kl7YO;DxmF3? zWi-RoXhzRJV0&XE@ACc?+@6?)LQ2XNm4KfalMtsc%4!Fn0rl zpHTrHwR>t>7W?t!Yc{*-^xN%9P0cs0kr=`?bQ5T*oOo&VRRu+1chM!qj%2I!@+1XF z4GWJ=7ix9;Wa@xoZ0RP`NCWw0*8247Y4jIZ>GEW7zuoCFXl6xIvz$ezsWgKdVMBH> z{o!A7f;R-@eK9Vj7R40xx)T<2$?F2E<>Jy3F;;=Yt}WE59J!1WN367 zA^6pu_zLoZIf*x031CcwotS{L8bJE(<_F%j_KJ2P_IusaZXwN$&^t716W{M6X2r_~ zaiMwdISX7Y&Qi&Uh0upS3TyEIXNDICQlT5fHXC`aji-c{U(J@qh-mWl-uMN|T&435 z5)a1dvB|oe%b2mefc=Vpm0C%IUYYh7HI*;3UdgNIz}R##(#{(_>82|zB0L*1i4B5j-xi9O4x10rs_J6*gdRBX=@VJ+==sWb&_Qc6tSOowM{BX@(zawtjl zdU!F4OYw2@Tk1L^%~JCwb|e#3CC>srRHQ*(N%!7$Mu_sKh@|*XtR>)BmWw!;8-mq7 zBBnbjwx8Kyv|hd*`5}84flTHR1Y@@uqjG`UG+jN_YK&RYTt7DVwfEDXDW4U+iO{>K zw1hr{_XE*S*K9TzzUlJH2rh^hUm2v7_XjwTuYap|>zeEDY$HOq3X4Tz^X}E9z)x4F zs+T?Ed+Hj<#jY-`Va~fT2C$=qFT-5q$@p9~0{G&eeL~tiIAHXA!f6C(rAlS^)&k<- zXU|ZVs}XQ>s5iONo~t!XXZgtaP$Iau;JT%h)>}v54yut~pykaNye4axEK#5@?TSsQ zE;Jvf9I$GVb|S`7$pG)4vgo9NXsKr?u=F!GnA%VS2z$@Z(!MR9?EPcAqi5ft)Iz6sNl`%kj+_H-X`R<>BFrBW=fSlD|{`D%@Rcbu2?%>t7i34k?Ujb)2@J-`j#4 zLK<69qcUuniIan-$A1+fR=?@+thwDIXtF1Tks@Br-xY zfB+zblrR(ke`U;6U~-;p1Kg8Lh6v~LjW@9l2P6s+?$2!ZRPX`(ZkRGe7~q(4&gEi<$ch`5kQ?*1=GSqkeV z{SA1EaW_A!t{@^UY2D^YO0(H@+kFVzZaAh0_`A`f(}G~EP~?B|%gtxu&g%^x{EYSz zk+T;_c@d;+n@$<>V%P=nk36?L!}?*=vK4>nJSm+1%a}9UlmTJTrfX4{Lb7smNQn@T zw9p2%(Zjl^bWGo1;DuMHN(djsEm)P8mEC2sL@KyPjwD@d%QnZ$ zMJ3cnn!_!iP{MzWk%PI&D?m?C(y2d|2VChluN^yHya(b`h>~GkI1y;}O_E57zOs!{ zt2C@M$^PR2U#(dZmA-sNreB@z-yb0Bf7j*yONhZG=onhx>t4)RB`r6&TP$n zgmN*)eCqvgriBO-abHQ8ECN0bw?z5Bxpx z=jF@?zFdVn?@gD5egM4o$m`}lV(CWrOKKq(sv*`mNcHcvw&Xryfw<{ch{O&qc#WCTXX6=#{MV@q#iHYba!OUY+MGeNTjP%Fj!WgM&`&RlI^=AWTOqy-o zHo9YFt!gQ*p7{Fl86>#-JLZo(b^O`LdFK~OsZBRR@6P?ad^Ujbqm_j^XycM4ZHFyg ziUbIFW#2tj`65~#2V!4z7DM8Z;fG0|APaQ{a2VNYpNotB7eZ5kp+tPDz&Lqs0j%Y4tA*URpcfi z_M(FD=fRGdqf430j}1z`O0I=;tLu81bwJXdYiN7_&a-?ly|-j*+=--XGvCq#32Gh(=|qj5F?kmihk{%M&$}udW5)DHK zF_>}5R8&&API}o0osZJRL3n~>76nUZ&L&iy^s>PMnNcYZ|9*1$v-bzbT3rpWsJ+y{ zPrg>5Zlery96Um?lc6L|)}&{992{_$J&=4%nRp9BAC6!IB=A&=tF>r8S*O-=!G(_( zwXbX_rGZgeiK*&n5E;f=k{ktyA1(;x_kiMEt0*gpp_4&(twlS2e5C?NoD{n>X2AT# zY@Zp?#!b1zNq96MQqeO*M1MMBin5v#RH52&Xd~DO6-BZLnA6xO1$sou(YJ1Dlc{WF zVa%2DyYm`V#81jP@70IJ;DX@y*iUt$MLm)ByAD$eUuji|5{ptFYq(q)mE(5bOpxjM z^Q`AHWq44SG3`_LxC9fwR)XRVIp=B%<(-lOC3jI#bb@dK(*vjom!=t|#<@dZql%>O z15y^{4tQoeW9Lu%G&V$90x6F)xN6y_oIn;!Q zs)8jT$;&;u%Y>=T3hg34A-+Y*na=|glcStr5D;&5*t5*DmD~x;zQAV5{}Ya`?RRGa zT*t9@$a~!co;pD^!J5bo?lDOWFx%)Y=-fJ+PDGc0>;=q=s?P4aHForSB+)v0WY2JH z?*`O;RHum6j%#LG)Vu#ciO#+jRC3!>T(9fr+XE7T2B7Z|0nR5jw@WG)kDDzTJ=o4~ zUpeyt7}_nd`t}j9BKqryOha{34erm)RmST)_9Aw)@ zHbiyg5n&E{_CQR@h<}34d7WM{s{%5wdty1l+KX8*?+-YkNK2Be*6&jc>@{Fd;Ps|| z26LqdI3#9le?;}risDq$K5G3yoqK}C^@-8z^wj%tdgw-6@F#Ju{Sg7+y)L?)U$ez> zoOaP$UFZ?y5BiFycir*pnaAaY+|%1%8&|(@VB)zweR%?IidwJyK5J!STzw&2RFx zZV@qeaCB01Hu#U9|1#=Msc8Pgz5P*4Lrp!Q+~(G!OiNR{qa7|r^H?FC6gVhkk3y7=uW#Sh;&>78bZ}aK*C#NH$9rX@M3f{nckYI+5QG?Aj1DM)@~z_ zw!UAD@gedTlePB*%4+55naJ8ak_;))#S;4ji!LOqY5VRI){GMwHR~}6t4g>5C_#U# ztYC!tjKjrKvRy=GAsJVK++~$|+s!w9z3H4G^mACv=EErXNSmH7qN}%PKcN|8%9=i)qS5+$L zu&ya~HW%RMVJi4T^pv?>mw*Gf<)-7gf#Qj|e#w2|v4#t!%Jk{&xlf;$_?jW*n!Pyx zkG$<18kiLOAUPuFfyu-EfWX%4jYnjBYc~~*9JEz6oa)_R|8wjZA|RNrAp%}14L7fW zi7A5Wym*K+V8pkqqO-X#3ft{0qs?KVt^)?kS>AicmeO&q+~J~ zp0YJ_P~_a8j= zsAs~G=8F=M{4GZL{|B__UorX@MRNQLn?*_gym4aW(~+i13knnk1P=khoC-ViMZk+x zLW(l}oAg1H`dU+Fv**;qw|ANDSRs>cGqL!Yw^`; zv;{E&8CNJcc)GHzTYM}f&NPw<6j{C3gaeelU#y!M)w-utYEHOCCJo|Vgp7K6C_$14 zqIrLUB0bsgz^D%V%fbo2f9#yb#CntTX?55Xy|Kps&Xek*4_r=KDZ z+`TQuv|$l}MWLzA5Ay6Cvsa^7xvwXpy?`w(6vx4XJ zWuf1bVSb#U8{xlY4+wlZ$9jjPk)X_;NFMqdgq>m&W=!KtP+6NL57`AMljW+es zzqjUjgz;V*kktJI?!NOg^s_)ph45>4UDA!Vo0hn>KZ+h-3=?Y3*R=#!fOX zP$Y~+14$f66ix?UWB_6r#fMcC^~X4R-<&OD1CSDNuX~y^YwJ>sW0j`T<2+3F9>cLo z#!j57$ll2K9(%$4>eA7(>FJX5e)pR5&EZK!IMQzOfik#FU*o*LGz~7u(8}XzIQRy- z!U7AlMTIe|DgQFmc%cHy_9^{o`eD%ja_L>ckU6$O4*U**o5uR7`FzqkU8k4gxtI=o z^P^oGFPm5jwZMI{;nH}$?p@uV8FT4r=|#GziKXK07bHJLtK}X%I0TON$uj(iJ`SY^ zc$b2CoxCQ>7LH@nxcdW&_C#fMYBtTxcg46dL{vf%EFCZ~eErMvZq&Z%Lhumnkn^4A zsx$ay(FnN7kYah}tZ@0?-0Niroa~13`?hVi6`ndno`G+E8;$<6^gsE-K3)TxyoJ4M zb6pj5=I8^FD5H@`^V#Qb2^0cx7wUz&cruA5g>6>qR5)O^t1(-qqP&1g=qvY#s&{bx zq8Hc%LsbK1*%n|Y=FfojpE;w~)G0-X4i*K3{o|J7`krhIOd*c*$y{WIKz2n2*EXEH zT{oml3Th5k*vkswuFXdGDlcLj15Nec5pFfZ*0?XHaF_lVuiB%Pv&p7z)%38}%$Gup zVTa~C8=cw%6BKn_|4E?bPNW4PT7}jZQLhDJhvf4z;~L)506IE0 zX!tWXX(QOQPRj-p80QG79t8T2^az4Zp2hOHziQlvT!|H)jv{Ixodabzv6lBj)6WRB z{)Kg@$~~(7$-az?lw$4@L%I&DI0Lo)PEJJziWP33a3azb?jyXt1v0N>2kxwA6b%l> zZqRpAo)Npi&loWbjFWtEV)783BbeIAhqyuc+~>i7aQ8shIXt)bjCWT6$~ro^>99G} z2XfmT0(|l!)XJb^E!#3z4oEGIsL(xd; zYX1`1I(cG|u#4R4T&C|m*9KB1`UzKvho5R@1eYtUL9B72{i(ir&ls8g!pD ztR|25xGaF!4z5M+U@@lQf(12?xGy`!|3E}7pI$k`jOIFjiDr{tqf0va&3pOn6Pu)% z@xtG2zjYuJXrV)DUrIF*y<1O1<$#54kZ#2;=X51J^F#0nZ0(;S$OZDt_U2bx{RZ=Q zMMdd$fH|!s{ zXq#l;{`xfV`gp&C>A`WrQU?d{!Ey5(1u*VLJt>i27aZ-^&2IIk=zP5p+{$q(K?2(b z8?9h)kvj9SF!Dr zoyF}?V|9;6abHxWk2cEvGs$-}Pg}D+ZzgkaN&$Snp%;5m%zh1E#?Wac-}x?BYlGN#U#Mek*}kek#I9XaHt?mz3*fDrRTQ#&#~xyeqJk1QJ~E$7qsw6 z?sV;|?*=-{M<1+hXoj?@-$y+(^BJ1H~wQ9G8C0#^aEAyhDduNX@haoa=PuPp zYsGv8UBfQaRHgBgLjmP^eh>fLMeh{8ic)?xz?#3kX-D#Z{;W#cd_`9OMFIaJg-=t`_3*!YDgtNQ2+QUEAJB9M{~AvT$H`E)IKmCR21H532+ata8_i_MR@ z2Xj<3w<`isF~Ah$W{|9;51ub*f4#9ziKrOR&jM{x7I_7()O@`F*5o$KtZ?fxU~g`t zUovNEVKYn$U~VX8eR)qb`7;D8pn*Pp$(otYTqL)5KH$lUS-jf}PGBjy$weoceAcPp z&5ZYB$r&P$MN{0H0AxCe4Qmd3T%M*5d4i%#!nmBCN-WU-4m4Tjxn-%j3HagwTxCZ9 z)j5vO-C7%s%D!&UfO>bi2oXiCw<-w{vVTK^rVbv#W=WjdADJy8$khnU!`ZWCIU`># zyjc^1W~pcu>@lDZ{zr6gv%)2X4n27~Ve+cQqcND%0?IFSP4sH#yIaXXYAq^z3|cg` z`I3$m%jra>e2W-=DiD@84T!cb%||k)nPmEE09NC%@PS_OLhkrX*U!cgD*;;&gIaA(DyVT4QD+q_xu z>r`tg{hiGY&DvD-)B*h+YEd+Zn)WylQl}<4>(_NlsKXCRV;a)Rcw!wtelM2_rWX`j zTh5A|i6=2BA(iMCnj_fob@*eA;V?oa4Z1kRBGaU07O70fb6-qmA$Hg$ps@^ka1=RO zTbE_2#)1bndC3VuK@e!Sftxq4=Uux}fDxXE#Q5_x=E1h>T5`DPHz zbH<_OjWx$wy7=%0!mo*qH*7N4tySm+R0~(rbus`7;+wGh;C0O%x~fEMkt!eV>U$`i z5>Q(o z=t$gPjgGh0&I7KY#k50V7DJRX<%^X z>6+ebc9efB3@eE2Tr){;?_w`vhgF>`-GDY(YkR{9RH(MiCnyRtd!LxXJ75z+?2 zGi@m^+2hKJ5sB1@Xi@s_@p_Kwbc<*LQ_`mr^Y%j}(sV_$`J(?_FWP)4NW*BIL~sR>t6 zM;qTJZ~GoY36&{h-Pf}L#y2UtR}>ZaI%A6VkU>vG4~}9^i$5WP2Tj?Cc}5oQxe2=q z8BeLa$hwCg_psjZyC2+?yX4*hJ58Wu^w9}}7X*+i5Rjqu5^@GzXiw#SUir1G1`jY% zOL=GE_ENYxhcyUrEt9XlMNP6kx6h&%6^u3@zB8KUCAa18T(R2J`%JjWZ z!{7cXaEW+Qu*iJPu+m>QqW}Lo$4Z+!I)0JNzZ&_M%=|B1yejFRM04bGAvu{=lNPd+ zJRI^DRQ(?FcVUD+bgEcAi@o(msqys9RTCG#)TjI!9~3-dc`>gW;HSJuQvH~d`MQs86R$|SKXHh zqS9Qy)u;T`>>a!$LuaE2keJV%;8g)tr&Nnc;EkvA-RanHXsy)D@XN0a>h}z2j81R; zsUNJf&g&rKpuD0WD@=dDrPHdBoK42WoBU|nMo17o(5^;M|dB4?|FsAGVrSyWcI`+FVw^vTVC`y}f(BwJl zrw3Sp151^9=}B})6@H*i4-dIN_o^br+BkcLa^H56|^2XsT0dESw2 zMX>(KqNl=x2K5=zIKg}2JpGAZu{I_IO}0$EQ5P{4zol**PCt3F4`GX}2@vr8#Y)~J zKb)gJeHcFnR@4SSh%b;c%J`l=W*40UPjF#q{<}ywv-=vHRFmDjv)NtmC zQx9qm)d%0zH&qG7AFa3VAU1S^(n8VFTC~Hb+HjYMjX8r#&_0MzlNR*mnLH5hi}`@{ zK$8qiDDvS_(L9_2vHgzEQ${DYSE;DqB!g*jhJghE&=LTnbgl&Xepo<*uRtV{2wDHN z)l;Kg$TA>Y|K8Lc&LjWGj<+bp4Hiye_@BfU(y#nF{fpR&|Ltbye?e^j0}8JC4#xi% zv29ZR%8%hk=3ZDvO-@1u8KmQ@6p%E|dlHuy#H1&MiC<*$YdLkHmR#F3ae;bKd;@*i z2_VfELG=B}JMLCO-6UQy^>RDE%K4b>c%9ki`f~Z2Qu8hO7C#t%Aeg8E%+}6P7Twtg z-)dj(w}_zFK&86KR@q9MHicUAucLVshUdmz_2@32(V`y3`&Kf8Q2I)+!n0mR=rrDU zXvv^$ho;yh*kNqJ#r1}b0|i|xRUF6;lhx$M*uG3SNLUTC@|htC z-=fsw^F%$qqz4%QdjBrS+ov}Qv!z00E+JWas>p?z@=t!WWU3K*?Z(0meTuTOC7OTx zU|kFLE0bLZ+WGcL$u4E}5dB0g`h|uwv3=H6f+{5z9oLv-=Q45+n~V4WwgO=CabjM% zBAN+RjM65(-}>Q2V#i1Na@a0`08g&y;W#@sBiX6Tpy8r}*+{RnyGUT`?XeHSqo#|J z^ww~c;ou|iyzpErDtlVU=`8N7JSu>4M z_pr9=tX0edVn9B}YFO2y(88j#S{w%E8vVOpAboK*27a7e4Ekjt0)hIX99*1oE;vex z7#%jhY=bPijA=Ce@9rRO(Vl_vnd00!^TAc<+wVvRM9{;hP*rqEL_(RzfK$er_^SN; z)1a8vo8~Dr5?;0X0J62Cusw$A*c^Sx1)dom`-)Pl7hsW4i(r*^Mw`z5K>!2ixB_mu z*Ddqjh}zceRFdmuX1akM1$3>G=#~|y?eYv(e-`Qy?bRHIq=fMaN~fB zUa6I8Rt=)jnplP>yuS+P&PxeWpJ#1$F`iqRl|jF$WL_aZFZl@kLo&d$VJtu&w?Q0O zzuXK>6gmygq(yXJy0C1SL}T8AplK|AGNUOhzlGeK_oo|haD@)5PxF}rV+5`-w{Aag zus45t=FU*{LguJ11Sr-28EZkq;!mJO7AQGih1L4rEyUmp>B!%X0YemsrV3QFvlgt* z5kwlPzaiJ+kZ^PMd-RRbl(Y?F*m`4*UIhIuf#8q>H_M=fM*L_Op-<_r zBZagV=4B|EW+KTja?srADTZXCd3Yv%^Chfpi)cg{ED${SI>InNpRj5!euKv?=Xn92 zsS&FH(*w`qLIy$doc>RE&A5R?u zzkl1sxX|{*fLpXvIW>9d<$ePROttn3oc6R!sN{&Y+>Jr@yeQN$sFR z;w6A<2-0%UA?c8Qf;sX7>>uKRBv3Ni)E9pI{uVzX|6Bb0U)`lhLE3hK58ivfRs1}d zNjlGK0hdq0qjV@q1qI%ZFMLgcpWSY~mB^LK)4GZ^h_@H+3?dAe_a~k*;9P_d7%NEFP6+ zgV(oGr*?W(ql?6SQ~`lUsjLb%MbfC4V$)1E0Y_b|OIYxz4?O|!kRb?BGrgiH5+(>s zoqM}v*;OBfg-D1l`M6T6{K`LG+0dJ1)!??G5g(2*vlNkm%Q(MPABT$r13q?|+kL4- zf)Mi5r$sn;u41aK(K#!m+goyd$c!KPl~-&-({j#D4^7hQkV3W|&>l_b!}!z?4($OA z5IrkfuT#F&S1(`?modY&I40%gtroig{YMvF{K{>5u^I51k8RriGd${z)=5k2tG zM|&Bp5kDTfb#vfuTTd?)a=>bX=lokw^y9+2LS?kwHQIWI~pYgy7 zb?A-RKVm_vM5!9?C%qYdfRAw& zAU7`up~%g=p@}pg#b7E)BFYx3g%(J36Nw(Dij!b>cMl@CSNbrW!DBDbTD4OXk!G4x zi}JBKc8HBYx$J~31PXH+4^x|UxK~(<@I;^3pWN$E=sYma@JP|8YL`L(zI6Y#c%Q{6 z*APf`DU$S4pr#_!60BH$FGViP14iJmbrzSrOkR;f3YZa{#E7Wpd@^4E-zH8EgPc-# zKWFPvh%WbqU_%ZEt`=Q?odKHc7@SUmY{GK`?40VuL~o)bS|is$Hn=<=KGHOsEC5tB zFb|q}gGlL97NUf$G$>^1b^3E18PZ~Pm9kX%*ftnolljiEt@2#F2R5ah$zbXd%V_Ev zyDd{1o_uuoBga$fB@Fw!V5F3jIr=a-ykqrK?WWZ#a(bglI_-8pq74RK*KfQ z0~Dzus7_l;pMJYf>Bk`)`S8gF!To-BdMnVw5M-pyu+aCiC5dwNH|6fgRsIKZcF&)g zr}1|?VOp}I3)IR@m1&HX1~#wsS!4iYqES zK}4J{Ei>;e3>LB#Oly>EZkW14^@YmpbgxCDi#0RgdM${&wxR+LiX}B+iRioOB0(pDKpVEI;ND?wNx>%e|m{RsqR_{(nmQ z3ZS}@t!p4a(BKx_-CYwrcyJ5u1TO9bcXti$8sy>xcLKqKCc#~UOZYD{llKTSFEjJ~ zyNWt>tLU}*>^`TvPxtP%F`ZJQw@W0^>x;!^@?k_)9#bF$j0)S3;mH-IR5y82l|%=F z2lR8zhP?XNP-ucZZ6A+o$xOyF!w;RaLHGh57GZ|TCXhJqY~GCh)aXEV$1O&$c}La1 zjuJxkY9SM4av^Hb;i7efiYaMwI%jGy`3NdY)+mcJhF(3XEiSlU3c|jMBi|;m-c?~T z+x0_@;SxcoY=(6xNgO$bBt~Pj8`-<1S|;Bsjrzw3@zSjt^JC3X3*$HI79i~!$RmTz zsblZsLYs7L$|=1CB$8qS!tXrWs!F@BVuh?kN(PvE5Av-*r^iYu+L^j^m9JG^#=m>@ z=1soa)H*w6KzoR$B8mBCXoU;f5^bVuwQ3~2LKg!yxomG1#XPmn(?YH@E~_ED+W6mxs%x{%Z<$pW`~ON1~2XjP5v(0{C{+6Dm$00tsd3w=f=ZENy zOgb-=f}|Hb*LQ$YdWg<(u7x3`PKF)B7ZfZ6;1FrNM63 z?O6tE%EiU@6%rVuwIQjvGtOofZBGZT1Sh(xLIYt9c4VI8`!=UJd2BfLjdRI#SbVAX ziT(f*RI^T!IL5Ac>ql7uduF#nuCRJ1)2bdvAyMxp-5^Ww5p#X{rb5)(X|fEhDHHW{ zw(Lfc$g;+Q`B0AiPGtmK%*aWfQQ$d!*U<|-@n2HZvCWSiw^I>#vh+LyC;aaVWGbmkENr z&kl*8o^_FW$T?rDYLO1Pyi%>@&kJKQoH2E0F`HjcN}Zlnx1ddoDA>G4Xu_jyp6vuT zPvC}pT&Owx+qB`zUeR|4G;OH(<<^_bzkjln0k40t`PQxc$7h(T8Ya~X+9gDc8Z9{Z z&y0RAU}#_kQGrM;__MK9vwIwK^aoqFhk~dK!ARf1zJqHMxF2?7-8|~yoO@_~Ed;_wvT%Vs{9RK$6uUQ|&@#6vyBsFK9eZW1Ft#D2)VpQRwpR(;x^ zdoTgMqfF9iBl%{`QDv7B0~8{8`8k`C4@cbZAXBu00v#kYl!#_Wug{)2PwD5cNp?K^ z9+|d-4z|gZ!L{57>!Ogfbzchm>J1)Y%?NThxIS8frAw@z>Zb9v%3_3~F@<=LG%r*U zaTov}{{^z~SeX!qgSYow`_5)ij*QtGp4lvF`aIGQ>@3ZTkDmsl#@^5*NGjOuu82}o zzLF~Q9SW+mP=>88%eSA1W4_W7-Q>rdq^?t=m6}^tDPaBRGFLg%ak93W!kOp#EO{6& zP%}Iff5HZQ9VW$~+9r=|Quj#z*=YwcnssS~9|ub2>v|u1JXP47vZ1&L1O%Z1DsOrDfSIMHU{VT>&>H=9}G3i@2rP+rx@eU@uE8rJNec zij~#FmuEBj03F1~ct@C@$>y)zB+tVyjV3*n`mtAhIM0$58vM9jOQC}JJOem|EpwqeMuYPxu3sv}oMS?S#o6GGK@8PN59)m&K4Dc&X% z(;XL_kKeYkafzS3Wn5DD>Yiw{LACy_#jY4op(>9q>>-*9@C0M+=b#bknAWZ37^(Ij zq>H%<@>o4a#6NydoF{_M4i4zB_KG)#PSye9bk0Ou8h%1Dtl7Q_y#7*n%g)?m>xF~( zjqvOwC;*qvN_3(*a+w2|ao0D?@okOvg8JskUw(l7n`0fncglavwKd?~l_ryKJ^Ky! zKCHkIC-o7%fFvPa$)YNh022lakMar^dgL=t#@XLyNHHw!b?%WlM)R@^!)I!smZL@k zBi=6wE5)2v&!UNV(&)oOYW(6Qa!nUjDKKBf-~Da=#^HE4(@mWk)LPvhyN3i4goB$3K8iV7uh zsv+a?#c4&NWeK(3AH;ETrMOIFgu{_@%XRwCZ;L=^8Ts)hix4Pf3yJRQ<8xb^CkdmC z?c_gB)XmRsk`9ch#tx4*hO=#qS7={~Vb4*tTf<5P%*-XMfUUYkI9T1cEF;ObfxxI-yNuA=I$dCtz3ey znVkctYD*`fUuZ(57+^B*R=Q}~{1z#2!ca?)+YsRQb+lt^LmEvZt_`=j^wqig+wz@n@ z`LIMQJT3bxMzuKg8EGBU+Q-6cs5(@5W?N>JpZL{$9VF)veF`L5%DSYTNQEypW%6$u zm_~}T{HeHj1bAlKl8ii92l9~$dm=UM21kLemA&b$;^!wB7#IKWGnF$TVq!!lBlG4 z{?Rjz?P(uvid+|i$VH?`-C&Gcb3{(~Vpg`w+O);Wk1|Mrjxrht0GfRUnZqz2MhrXa zqgVC9nemD5)H$to=~hp)c=l9?#~Z_7i~=U-`FZxb-|TR9@YCxx;Zjo-WpMNOn2)z) zFPGGVl%3N$f`gp$gPnWC+f4(rmts%fidpo^BJx72zAd7|*Xi{2VXmbOm)1`w^tm9% znM=0Fg4bDxH5PxPEm{P3#A(mxqlM7SIARP?|2&+c7qmU8kP&iApzL|F>Dz)Ixp_`O zP%xrP1M6@oYhgo$ZWwrAsYLa4 z|I;DAvJxno9HkQrhLPQk-8}=De{9U3U%)dJ$955?_AOms!9gia%)0E$Mp}$+0er@< zq7J&_SzvShM?e%V?_zUu{niL@gt5UFOjFJUJ}L?$f%eU%jUSoujr{^O=?=^{19`ON zlRIy8Uo_nqcPa6@yyz`CM?pMJ^^SN^Fqtt`GQ8Q#W4kE7`V9^LT}j#pMChl!j#g#J zr-=CCaV%xyFeQ9SK+mG(cTwW*)xa(eK;_Z(jy)woZp~> zA(4}-&VH+TEeLzPTqw&FOoK(ZjD~m{KW05fiGLe@E3Z2`rLukIDahE*`u!ubU)9`o zn^-lyht#E#-dt~S>}4y$-mSbR8{T@}22cn^refuQ08NjLOv?JiEWjyOnzk<^R5%gO zhUH_B{oz~u#IYwVnUg8?3P*#DqD8#X;%q%HY**=I>>-S|!X*-!x1{^l#OnR56O>iD zc;i;KS+t$koh)E3)w0OjWJl_aW2;xF=9D9Kr>)(5}4FqUbk# zI#$N8o0w;IChL49m9CJTzoC!|u{Ljd%ECgBOf$}&jA^$(V#P#~)`&g`H8E{uv52pp zwto`xUL-L&WTAVREEm$0g_gYPL(^vHq(*t1WCH_6alhkeW&GCZ3hL)|{O-jiFOBrF z!EW=Jej|dqQitT6!B-7&io2K)WIm~Q)v@yq%U|VpV+I?{y0@Yd%n8~-NuuM*pM~KA z85YB};IS~M(c<}4Hxx>qRK0cdl&e?t253N%vefkgds>Ubn8X}j6Vpgs>a#nFq$osY z1ZRwLqFv=+BTb=i%D2Wv>_yE0z}+niZ4?rE|*a3d7^kndWGwnFqt+iZ(7+aln<}jzbAQ(#Z2SS}3S$%Bd}^ zc9ghB%O)Z_mTZMRC&H#)I#fiLuIkGa^`4e~9oM5zKPx?zjkC&Xy0~r{;S?FS%c7w< zWbMpzc(xSw?9tGxG~_l}Acq}zjt5ClaB7-!vzqnlrX;}$#+PyQ9oU)_DfePh2E1<7 ztok6g6K^k^DuHR*iJ?jw?bs_whk|bx`dxu^nC6#e{1*m~z1eq7m}Cf$*^Eua(oi_I zAL+3opNhJteu&mWQ@kQWPucmiP)4|nFG`b2tpC;h{-PI@`+h?9v=9mn|0R-n8#t=+Z*FD(c5 zjj79Jxkgck*DV=wpFgRZuwr%}KTm+dx?RT@aUHJdaX-ODh~gByS?WGx&czAkvkg;x zrf92l8$Or_zOwJVwh>5rB`Q5_5}ef6DjS*$x30nZbuO3dijS*wvNEqTY5p1_A0gWr znH<(Qvb!os14|R)n2Ost>jS2;d1zyLHu`Svm|&dZD+PpP{Bh>U&`Md;gRl64q;>{8MJJM$?UNUd`aC>BiLe>*{ zJY15->yW+<3rLgYeTruFDtk1ovU<$(_y7#HgUq>)r0{^}Xbth}V#6?%5jeFYt;SG^ z3qF)=uWRU;Jj)Q}cpY8-H+l_n$2$6{ZR?&*IGr{>ek!69ZH0ZoJ*Ji+ezzlJ^%qL3 zO5a`6gwFw(moEzqxh=yJ9M1FTn!eo&qD#y5AZXErHs%22?A+JmS&GIolml!)rZTnUDM3YgzYfT#;OXn)`PWv3Ta z!-i|-Wojv*k&bC}_JJDjiAK(Ba|YZgUI{f}TdEOFT2+}nPmttytw7j%@bQZDV1vvj z^rp{gRkCDmYJHGrE1~e~AE!-&6B6`7UxVQuvRrfdFkGX8H~SNP_X4EodVd;lXd^>eV1jN+Tt4}Rsn)R0LxBz0c=NXU|pUe!MQQFkGBWbR3&(jLm z%RSLc#p}5_dO{GD=DEFr=Fc% z85CBF>*t!6ugI?soX(*JNxBp+-DdZ4X0LldiK}+WWGvXV(C(Ht|!3$psR=&c*HIM=BmX;pRIpz@Ale{9dhGe(U2|Giv;# zOc|;?p67J=Q(kamB*aus=|XP|m{jN^6@V*Bpm?ye56Njh#vyJqE=DweC;?Rv7faX~ zde03n^I~0B2vUmr;w^X37tVxUK?4}ifsSH5_kpKZIzpYu0;Kv}SBGfI2AKNp+VN#z`nI{UNDRbo-wqa4NEls zICRJpu)??cj^*WcZ^MAv+;bDbh~gpN$1Cor<{Y2oyIDws^JsfW^5AL$azE(T0p&pP z1Mv~6Q44R&RHoH95&OuGx2srIr<@zYJTOMKiVs;Bx3py89I87LOb@%mr`0)#;7_~Z zzcZj8?w=)>%5@HoCHE_&hnu(n_yQ-L(~VjpjjkbT7e)Dk5??fApg(d>vwLRJ-x{um z*Nt?DqTSxh_MIyogY!vf1mU1`Gld-&L)*43f6dilz`Q@HEz;+>MDDYv9u!s;WXeao zUq=TaL$P*IFgJzrGc>j1dDOd zed+=ZBo?w4mr$2)Ya}?vedDopomhW1`#P<%YOJ_j=WwClX0xJH-f@s?^tmzs_j7t!k zK@j^zS0Q|mM4tVP5Ram$VbS6|YDY&y?Q1r1joe9dj08#CM{RSMTU}(RCh`hp_Rkl- zGd|Cv~G@F{DLhCizAm9AN!^{rNs8hu!G@8RpnGx7e`-+K$ffN<0qjR zGq^$dj_Tv!n*?zOSyk5skI7JVKJ)3jysnjIu-@VSzQiP8r6MzudCU=~?v-U8yzo^7 zGf~SUTvEp+S*!X9uX!sq=o}lH;r{pzk~M*VA(uyQ`3C8!{C;)&6)95fv(cK!%Cuz$ z_Zal57H6kPN>25KNiI6z6F)jzEkh#%OqU#-__Xzy)KyH};81#N6OfX$$IXWzOn`Q& z4f$Z1t>)8&8PcYfEwY5UadU1yg+U*(1m2ZlHoC-!2?gB!!fLhmTl))D@dhvkx#+Yj z1O=LV{(T%{^IeCuFK>%QR!VZ4GnO5tK8a+thWE zg4VytZrwcS?7^ zuZfhYnB8dwd%VLO?DK7pV5Wi<(`~DYqOXn8#jUIL^)12*Dbhk4GmL_E2`WX&iT16o zk(t|hok(Y|v-wzn?4x34T)|+SfZP>fiq!><*%vnxGN~ypST-FtC+@TPv*vYv@iU!_ z@2gf|PrgQ?Ktf*9^CnJ(x*CtZVB8!OBfg0%!wL;Z8(tYYre0vcnPGlyCc$V(Ipl*P z_(J!a=o@vp^%Efme!K74(Ke7A>Y}|sxV+JL^aYa{~m%5#$$+R1? zGaQhZTTX!#s#=Xtpegqero$RNt&`4xn3g$)=y*;=N=Qai)}~`xtxI_N*#MMCIq#HFifT zz(-*m;pVH&+4bixL&Bbg)W5FN^bH87pAHp)zPkWNMfTFqS=l~AC$3FX3kQUSh_C?-ZftyClgM)o_D7cX$RGlEYblux0jv5 zTr|i-I3@ZPCGheCl~BGhImF)K4!9@?pC(gi3ozX=a!|r1)LFxy_8c&wY0<^{2cm|P zv6Y`QktY*;I)IUd5y3ne1CqpVanlY45z8hf4&$EUBnucDj16pDa4&GI&TArYhf*xh zdj>*%APH8(h~c>o@l#%T>R$e>rwVx_WUB|~V`p^JHsg*y12lzj&zF}w6W09HwB2yb z%Q~`es&(;7#*DUC_w-Dmt7|$*?TA_m;zB+-u{2;Bg{O}nV7G_@7~<)Bv8fH^G$XG8$(&{A zwXJK5LRK%M34(t$&NI~MHT{UQ9qN-V_yn|%PqC81EIiSzmMM=2zb`mIwiP_b)x+2M z7Gd`83h79j#SItpQ}luuf2uOU`my_rY5T{6P#BNlb%h%<#MZb=m@y5aW;#o1^2Z)SWo+b`y0gV^iRcZtz5!-05vF z7wNo=hc6h4hc&s@uL^jqRvD6thVYtbErDK9k!;+a0xoE0WL7zLixjn5;$fXvT=O3I zT6jI&^A7k6R{&5#lVjz#8%_RiAa2{di{`kx79K+j72$H(!ass|B%@l%KeeKchYLe_ z>!(JC2fxsv>XVen+Y42GeYPxMWqm`6F$(E<6^s|g(slNk!lL*6v^W2>f6hh^mE$s= z3D$)}{V5(Qm&A6bp%2Q}*GZ5Qrf}n7*Hr51?bJOyA-?B4vg6y_EX<*-e20h{=0Mxs zbuQGZ$fLyO5v$nQ&^kuH+mNq9O#MWSfThtH|0q1i!NrWj^S}_P;Q1OkYLW6U^?_7G zx2wg?CULj7))QU(n{$0JE%1t2dWrMi2g-Os{v|8^wK{@qlj%+1b^?NI z$}l2tjp0g>K3O+p%yK<9!XqmQ?E9>z&(|^Pi~aSRwI5x$jaA62GFz9%fmO3t3a>cq zK8Xbv=5Ps~4mKN5+Eqw12(!PEyedFXv~VLxMB~HwT1Vfo51pQ#D8e$e4pFZ{&RC2P z5gTIzl{3!&(tor^BwZfR8j4k{7Rq#`riKXP2O-Bh66#WWK2w=z;iD9GLl+3 zpHIaI4#lQ&S-xBK8PiQ%dwOh?%BO~DCo06pN7<^dnZCN@NzY{_Z1>rrB0U|nC&+!2 z2y!oBcTd2;@lzyk(B=TkyZ)zy0deK05*Q0zk+o$@nun`VI1Er7pjq>8V zNmlW{p7S^Btgb(TA}jL(uR>`0w8gHP^T~Sh5Tkip^spk4SBAhC{TZU}_Z)UJw-}zm zPq{KBm!k)?P{`-(9?LFt&YN4s%SIZ-9lJ!Ws~B%exHOeVFk3~}HewnnH(d)qkLQ_d z6h>O)pEE{vbOVw}E+jdYC^wM+AAhaI(YAibUc@B#_mDss0Ji&BK{WG`4 zOk>vSNq(Bq2IB@s>>Rxm6Wv?h;ZXkpb1l8u|+_qXWdC*jjcPCixq;!%BVPSp#hP zqo`%cNf&YoQXHC$D=D45RiT|5ngPlh?0T~?lUf*O)){K@*Kbh?3RW1j9-T?%lDk@y z4+~?wKI%Y!-=O|_IuKz|=)F;V7ps=5@g)RrE;;tvM$gUhG>jHcw2Hr@fS+k^Zr~>G z^JvPrZc}_&d_kEsqAEMTMJw!!CBw)u&ZVzmq+ZworuaE&TT>$pYsd9|g9O^0orAe8 z221?Va!l1|Y5X1Y?{G7rt1sX#qFA^?RLG^VjoxPf63;AS=_mVDfGJKg73L zsGdnTUD40y(>S##2l|W2Cy!H(@@5KBa(#gs`vlz}Y~$ot5VsqPQ{{YtjYFvIumZzt zA{CcxZLJR|4#{j7k~Tu*jkwz8QA|5G1$Cl895R`Zyp;irp1{KN){kB30O8P1W5;@bG znvX74roeMmQlUi=v9Y%(wl$ZC#9tKNFpvi3!C}f1m6Ct|l2g%psc{TJp)@yu)*e2> z((p0Fg*8gJ!|3WZke9;Z{8}&NRkv7iP=#_y-F}x^y?2m%-D_aj^)f04%mneyjo_;) z6qc_Zu$q37d~X``*eP~Q>I2gg%rrV8v=kDfpp$=%Vj}hF)^dsSWygoN(A$g*E=Do6FX?&(@F#7pbiJ`;c0c@Ul zDqW_90Wm#5f2L<(Lf3)3TeXtI7nhYwRm(F;*r_G6K@OPW4H(Y3O5SjUzBC}u3d|eQ8*8d@?;zUPE+i#QNMn=r(ap?2SH@vo*m z3HJ%XuG_S6;QbWy-l%qU;8x;>z>4pMW7>R}J%QLf%@1BY(4f_1iixd-6GlO7Vp*yU zp{VU^3?s?90i=!#>H`lxT!q8rk>W_$2~kbpz7eV{3wR|8E=8**5?qn8#n`*(bt1xRQrdGxyx2y%B$qmw#>ZV$c7%cO#%JM1lY$Y0q?Yuo> ze9KdJoiM)RH*SB%^;TAdX-zEjA7@%y=!0=Zg%iWK7jVI9b&Dk}0$Af&08KHo+ zOwDhFvA(E|ER%a^cdh@^wLUlmIv6?_3=BvX8jKk92L=Y}7Jf5OGMfh` zBdR1wFCi-i5@`9km{isRb0O%TX+f~)KNaEz{rXQa89`YIF;EN&gN)cigu6mNh>?Cm zAO&Im2flv6D{jwm+y<%WsPe4!89n~KN|7}Cb{Z;XweER73r}Qp2 zz}WP4j}U0&(uD&9yGy6`!+_v-S(yG*iytsTR#x_Rc>=6u^vnRDnf1gP{#2>`ffrAC% zTZ5WQ@hAK;P;>kX{D)mIXe4%a5p=LO1xXH@8T?mz7Q@d)$3pL{{B!2{-v70L*o1AO+|n5beiw~ zk@(>m?T3{2k2c;NWc^`4@P&Z?BjxXJ@;x1qhn)9Mn*IFdt_J-dIqx5#d`NfyfX~m( zIS~5)MfZ2Uy?_4W`47i}u0ZgPh<{D|w_d#;D}Q&U$Q-G}xM1A@1f{#%A$jh6Qp&0hQ<0bPOM z-{1Wm&p%%#eb_?x7i;bol EfAhh=DF6Tf diff --git a/hexagonaljava/.mvn/wrapper/maven-wrapper.properties b/hexagonaljava/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index 642d572ce9..0000000000 --- a/hexagonaljava/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1,2 +0,0 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/hexagonaljava/mvnw b/hexagonaljava/mvnw deleted file mode 100755 index a16b5431b4..0000000000 --- a/hexagonaljava/mvnw +++ /dev/null @@ -1,310 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi - - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/hexagonaljava/mvnw.cmd b/hexagonaljava/mvnw.cmd deleted file mode 100644 index c8d43372c9..0000000000 --- a/hexagonaljava/mvnw.cmd +++ /dev/null @@ -1,182 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java index 603f8297d1..89bcfb6510 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java @@ -9,5 +9,4 @@ public class HexagonaljavaApplication { public static void main(String[] args) { SpringApplication.run(HexagonaljavaApplication.class, args); } - } diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java index 7db6117f83..7a5ba70c51 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java @@ -25,5 +25,4 @@ public class StudentResultController { public Double getTotalMarks(@PathVariable Integer id) { return studentResultService.getTotalMarks(id); } - } diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java index ef721e6eda..040faa03a7 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java @@ -33,5 +33,4 @@ public class Student { public void setMarks(Map marks) { this.marks = marks; } - } diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java index 1d347346a2..541c70d757 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java @@ -24,21 +24,15 @@ public class StudentResultJdbcRepoImpl implements StudentResultRepo { @Override public void save(Student student) { - jdbcTemplate.update("insert into student (id, name) " + "values(?, ?)", new Object[] { student.getId(), student.getName() }); insertResult(student); - } public void insertResult(Student student) { - String insertQuery = "insert into " + "studentresult " + "(subject,marks,id) " + "values " + "(?,?,?)"; - for (final Map.Entry entry : student.getMarks() - .entrySet()) { - + .entrySet()) { this.jdbcTemplate.batchUpdate(insertQuery, new BatchPreparedStatementSetter() { - @Override public void setValues(final PreparedStatement ps, final int i) throws SQLException { @@ -49,22 +43,19 @@ public class StudentResultJdbcRepoImpl implements StudentResultRepo { public int getBatchSize() { return student.getMarks() - .size(); + .size(); } }); } - } @Override public Student getStudent(Integer id) { - String selectQuery = "select * from ( select * from student where id = ? ) s left join studentresult on s.id = studentresult.id"; Student student = new Student(); jdbcTemplate.query(selectQuery, new Object[] { id }, new RowCallbackHandler() { public void processRow(ResultSet rs) throws SQLException { while (rs.next()) { - if (student.getId() == null) { student.setId(rs.getInt("id")); student.setName(rs.getString("name")); @@ -73,12 +64,10 @@ public class StudentResultJdbcRepoImpl implements StudentResultRepo { String subject = rs.getString("subject"); Double marks = rs.getDouble("marks"); student.getMarks() - .put(subject, marks); - + .put(subject, marks); } } }); return student; } - } diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java index 1ee4e2b9e5..96cf105600 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java @@ -7,5 +7,4 @@ public interface StudentResultRepo { void save(Student student); Student getStudent(Integer id); - } diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java index 6c94aa0083..46fd37a5f2 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java @@ -15,12 +15,10 @@ public class StudentResultRepoImpl implements StudentResultRepo { @Override public void save(Student student) { studentsMap.put(student.getId(), student); - } @Override public Student getStudent(Integer id) { return studentsMap.get(id); } - } diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java index d77ac5dca8..91a25f3809 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java @@ -4,8 +4,7 @@ import com.baeldung.hexagonaljava.entity.Student; public interface StudentResultService { - public void save(Student student); - - public Double getTotalMarks(Integer id); + void save(Student student); + Double getTotalMarks(Integer id); } diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java index d0b53e79f6..f8c163fdf4 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java @@ -15,7 +15,6 @@ public class StudentResultServiceImpl implements StudentResultService { @Override public void save(Student student) { studentResultRepo.save(student); - } @Override @@ -23,10 +22,9 @@ public class StudentResultServiceImpl implements StudentResultService { Student student = studentResultRepo.getStudent(id); double totalMarks = 0; for (double marks : student.getMarks() - .values()) { + .values()) { totalMarks += marks; } return totalMarks; } - } diff --git a/hexagonaljava/src/main/resources/schema.sql b/hexagonaljava/src/main/resources/schema.sql index 4dab9fbb1f..40ba01ec02 100644 --- a/hexagonaljava/src/main/resources/schema.sql +++ b/hexagonaljava/src/main/resources/schema.sql @@ -8,4 +8,4 @@ subject VARCHAR(250) NOT NULL, marks NUMERIC(8,2), id VARCHAR(250), FOREIGN KEY (id) references STUDENT(id) -); \ No newline at end of file +); From 8e7655f0b8ebabfaf7e4ddba28ef9c5da611c9e9 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Fri, 27 Mar 2020 00:43:33 +0530 Subject: [PATCH 0005/1862] Removing unnecessary lines --- .../hexagonaljava/repository/StudentResultJdbcRepoImpl.java | 1 - .../baeldung/hexagonaljava/HexagonaljavaApplicationTests.java | 1 - 2 files changed, 2 deletions(-) diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java index 541c70d757..7b970462e3 100644 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java +++ b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java @@ -35,7 +35,6 @@ public class StudentResultJdbcRepoImpl implements StudentResultRepo { this.jdbcTemplate.batchUpdate(insertQuery, new BatchPreparedStatementSetter() { @Override public void setValues(final PreparedStatement ps, final int i) throws SQLException { - ps.setString(1, entry.getKey()); ps.setDouble(2, entry.getValue()); ps.setInt(3, student.getId()); diff --git a/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java b/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java index c61c51f7b2..eed2f7e6a3 100644 --- a/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java +++ b/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java @@ -9,5 +9,4 @@ class HexagonaljavaApplicationTests { @Test void contextLoads() { } - } From a9ab80c75ebcc997e93119a4e95626eb5e33a31a Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Fri, 10 Apr 2020 03:57:55 +0530 Subject: [PATCH 0006/1862] Example code for using Multiple Cache Manager in SpringBoot --- .../HexagonaljavaApplication.java | 12 ---- .../controller/StudentResultController.java | 28 -------- .../hexagonaljava/entity/Student.java | 36 ---------- .../repository/StudentResultJdbcRepoImpl.java | 72 ------------------- .../repository/StudentResultRepo.java | 10 --- .../repository/StudentResultRepoImpl.java | 24 ------- .../service/StudentResultService.java | 10 --- .../service/StudentResultServiceImpl.java | 30 -------- hexagonaljava/src/main/resources/schema.sql | 11 --- .../pom.xml | 41 ++++++----- .../MultiplecachemanagerApplication.java | 45 ++++++++++++ .../bo/CustomerDetailBO.java | 28 ++++++++ .../bo/OrderDetailBO.java | 25 +++++++ .../config/MultipleCacheResolver.java | 38 ++++++++++ .../MultipleCacheManagerController.java | 43 +++++++++++ .../multiplecachemanager/entity/Customer.java | 24 +++++++ .../multiplecachemanager/entity/Item.java | 34 +++++++++ .../multiplecachemanager/entity/Order.java | 44 ++++++++++++ .../repository/CustomerDetailRepository.java | 49 +++++++++++++ .../repository/OrderDetailRepository.java | 53 ++++++++++++++ .../src/main/resources/application.properties | 7 +- .../src/main/resources/data.sql | 7 ++ .../src/main/resources/schema.sql | 19 +++++ .../MultiplecachemanagerApplicationTests.java | 5 +- 24 files changed, 443 insertions(+), 252 deletions(-) delete mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java delete mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java delete mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java delete mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java delete mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java delete mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java delete mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java delete mode 100644 hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java delete mode 100644 hexagonaljava/src/main/resources/schema.sql rename {hexagonaljava => multiplecachemanager}/pom.xml (64%) create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplication.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java create mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java rename {hexagonaljava => multiplecachemanager}/src/main/resources/application.properties (56%) create mode 100644 multiplecachemanager/src/main/resources/data.sql create mode 100644 multiplecachemanager/src/main/resources/schema.sql rename hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java => multiplecachemanager/src/test/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplicationTests.java (62%) diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java deleted file mode 100644 index 89bcfb6510..0000000000 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/HexagonaljavaApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.hexagonaljava; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class HexagonaljavaApplication { - - public static void main(String[] args) { - SpringApplication.run(HexagonaljavaApplication.class, args); - } -} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java deleted file mode 100644 index 7a5ba70c51..0000000000 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/controller/StudentResultController.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.hexagonaljava.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.hexagonaljava.entity.Student; -import com.baeldung.hexagonaljava.service.StudentResultService; - -@RestController -public class StudentResultController { - - @Autowired - private StudentResultService studentResultService; - - @PostMapping(value = "/save") - public void saveStudent(@RequestBody Student student) { - studentResultService.save(student); - } - - @GetMapping(value = "/getTotalMarks/{id}") - public Double getTotalMarks(@PathVariable Integer id) { - return studentResultService.getTotalMarks(id); - } -} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java deleted file mode 100644 index 040faa03a7..0000000000 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/entity/Student.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.hexagonaljava.entity; - -import java.util.Map; - -public class Student { - - private Integer id; - - private String name; - - private Map marks; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Map getMarks() { - return marks; - } - - public void setMarks(Map marks) { - this.marks = marks; - } -} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java deleted file mode 100644 index 7b970462e3..0000000000 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultJdbcRepoImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baeldung.hexagonaljava.repository; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Primary; -import org.springframework.jdbc.core.BatchPreparedStatementSetter; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowCallbackHandler; -import org.springframework.stereotype.Component; - -import com.baeldung.hexagonaljava.entity.Student; - -@Primary -@Component -public class StudentResultJdbcRepoImpl implements StudentResultRepo { - - @Autowired - JdbcTemplate jdbcTemplate; - - @Override - public void save(Student student) { - jdbcTemplate.update("insert into student (id, name) " + "values(?, ?)", new Object[] { student.getId(), student.getName() }); - insertResult(student); - } - - public void insertResult(Student student) { - String insertQuery = "insert into " + "studentresult " + "(subject,marks,id) " + "values " + "(?,?,?)"; - for (final Map.Entry entry : student.getMarks() - .entrySet()) { - this.jdbcTemplate.batchUpdate(insertQuery, new BatchPreparedStatementSetter() { - @Override - public void setValues(final PreparedStatement ps, final int i) throws SQLException { - ps.setString(1, entry.getKey()); - ps.setDouble(2, entry.getValue()); - ps.setInt(3, student.getId()); - } - - public int getBatchSize() { - return student.getMarks() - .size(); - } - }); - } - } - - @Override - public Student getStudent(Integer id) { - String selectQuery = "select * from ( select * from student where id = ? ) s left join studentresult on s.id = studentresult.id"; - Student student = new Student(); - jdbcTemplate.query(selectQuery, new Object[] { id }, new RowCallbackHandler() { - public void processRow(ResultSet rs) throws SQLException { - while (rs.next()) { - if (student.getId() == null) { - student.setId(rs.getInt("id")); - student.setName(rs.getString("name")); - student.setMarks(new HashMap()); - } - String subject = rs.getString("subject"); - Double marks = rs.getDouble("marks"); - student.getMarks() - .put(subject, marks); - } - } - }); - return student; - } -} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java deleted file mode 100644 index 96cf105600..0000000000 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepo.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.hexagonaljava.repository; - -import com.baeldung.hexagonaljava.entity.Student; - -public interface StudentResultRepo { - - void save(Student student); - - Student getStudent(Integer id); -} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java deleted file mode 100644 index 46fd37a5f2..0000000000 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/repository/StudentResultRepoImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.hexagonaljava.repository; - -import java.util.HashMap; -import java.util.Map; - -import org.springframework.stereotype.Repository; - -import com.baeldung.hexagonaljava.entity.Student; - -@Repository -public class StudentResultRepoImpl implements StudentResultRepo { - - private Map studentsMap = new HashMap(); - - @Override - public void save(Student student) { - studentsMap.put(student.getId(), student); - } - - @Override - public Student getStudent(Integer id) { - return studentsMap.get(id); - } -} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java deleted file mode 100644 index 91a25f3809..0000000000 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultService.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.hexagonaljava.service; - -import com.baeldung.hexagonaljava.entity.Student; - -public interface StudentResultService { - - void save(Student student); - - Double getTotalMarks(Integer id); -} diff --git a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java b/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java deleted file mode 100644 index f8c163fdf4..0000000000 --- a/hexagonaljava/src/main/java/com/baeldung/hexagonaljava/service/StudentResultServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.hexagonaljava.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.baeldung.hexagonaljava.entity.Student; -import com.baeldung.hexagonaljava.repository.StudentResultRepo; - -@Component -public class StudentResultServiceImpl implements StudentResultService { - - @Autowired - private StudentResultRepo studentResultRepo; - - @Override - public void save(Student student) { - studentResultRepo.save(student); - } - - @Override - public Double getTotalMarks(Integer id) { - Student student = studentResultRepo.getStudent(id); - double totalMarks = 0; - for (double marks : student.getMarks() - .values()) { - totalMarks += marks; - } - return totalMarks; - } -} diff --git a/hexagonaljava/src/main/resources/schema.sql b/hexagonaljava/src/main/resources/schema.sql deleted file mode 100644 index 40ba01ec02..0000000000 --- a/hexagonaljava/src/main/resources/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE STUDENT ( - id INT PRIMARY KEY, - name VARCHAR(250) NOT NULL -); - -CREATE TABLE STUDENTRESULT( -subject VARCHAR(250) NOT NULL, -marks NUMERIC(8,2), -id VARCHAR(250), -FOREIGN KEY (id) references STUDENT(id) -); diff --git a/hexagonaljava/pom.xml b/multiplecachemanager/pom.xml similarity index 64% rename from hexagonaljava/pom.xml rename to multiplecachemanager/pom.xml index d9ca173888..22daf6e87d 100644 --- a/hexagonaljava/pom.xml +++ b/multiplecachemanager/pom.xml @@ -5,25 +5,45 @@ org.springframework.boot spring-boot-starter-parent - 2.2.5.RELEASE + 2.2.6.RELEASE - com.baeldung. - hexagonaljava + com.baeldung + multiplecachemanager 0.0.1-SNAPSHOT - hexagonaljava - Demo project for Spring Boot + multiplecachemanager + sample project for configuring multiple cache managers 1.8 + + org.springframework.boot + spring-boot-starter-jdbc + org.springframework.boot spring-boot-starter-web + + com.h2database + h2 + runtime + + + + org.springframework.boot + spring-boot-starter-cache + + + + com.github.ben-manes.caffeine + caffeine + + org.springframework.boot spring-boot-starter-test @@ -35,17 +55,6 @@ - - - org.springframework.boot - spring-boot-starter-jdbc - - - - com.h2database - h2 - runtime - diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplication.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplication.java new file mode 100644 index 0000000000..4c7efc98bd --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplication.java @@ -0,0 +1,45 @@ +package com.baeldung.multiplecachemanager; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.caffeine.CaffeineCacheManager; +import org.springframework.cache.concurrent.ConcurrentMapCacheManager; +import org.springframework.cache.interceptor.CacheResolver; +import org.springframework.context.annotation.Bean; + +import com.baeldung.multiplecachemanager.config.MultipleCacheResolver; +import com.github.benmanes.caffeine.cache.Caffeine; + +@SpringBootApplication +@EnableCaching +public class MultiplecachemanagerApplication extends CachingConfigurerSupport { + + public static void main(String[] args) { + SpringApplication.run(MultiplecachemanagerApplication.class, args); + } + + @Bean + // @Primary + public CacheManager cacheManager() { + CaffeineCacheManager cacheManager = new CaffeineCacheManager("customers", "orders"); + cacheManager.setCaffeine(Caffeine.newBuilder() + .initialCapacity(200) + .maximumSize(500) + .weakKeys() + .recordStats()); + return cacheManager; + } + + @Bean + public CacheManager alternateCacheManager() { + return new ConcurrentMapCacheManager("customerOrders", "orderprice"); + } + + @Bean + public CacheResolver cacheResolver() { + return new MultipleCacheResolver(alternateCacheManager(), cacheManager()); + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java new file mode 100644 index 0000000000..3da4c23e28 --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java @@ -0,0 +1,28 @@ +package com.baeldung.multiplecachemanager.bo; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Component; + +import com.baeldung.multiplecachemanager.entity.Customer; +import com.baeldung.multiplecachemanager.entity.Order; +import com.baeldung.multiplecachemanager.repository.CustomerDetailRepository; + +@Component +public class CustomerDetailBO { + + @Autowired + private CustomerDetailRepository customerDetailRepository; + + @Cacheable(cacheNames = "customers") + public Customer getCustomerDetail(Integer customerId) { + return customerDetailRepository.getCustomerDetail(customerId); + } + + @Cacheable(cacheNames = "customerOrders", cacheManager = "alternateCacheManager") + public List getCustomerOrders(Integer customerId) { + return customerDetailRepository.getCustomerOrders(customerId); + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java new file mode 100644 index 0000000000..cb9e301fcb --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java @@ -0,0 +1,25 @@ +package com.baeldung.multiplecachemanager.bo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Component; + +import com.baeldung.multiplecachemanager.entity.Order; +import com.baeldung.multiplecachemanager.repository.OrderDetailRepository; + +@Component +public class OrderDetailBO { + + @Autowired + private OrderDetailRepository orderDetailRepository; + + @Cacheable(cacheNames = "orders", cacheResolver = "cacheResolver") + public Order getOrderDetail(Integer orderId) { + return orderDetailRepository.getOrderDetail(orderId); + } + + @Cacheable(cacheNames = "orderprice", cacheResolver = "cacheResolver") + public double getOrderPrice(Integer orderId) { + return orderDetailRepository.getOrderPrice(orderId); + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java new file mode 100644 index 0000000000..1bd869d98e --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java @@ -0,0 +1,38 @@ +package com.baeldung.multiplecachemanager.config; + +import java.util.ArrayList; +import java.util.Collection; + +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.interceptor.CacheOperationInvocationContext; +import org.springframework.cache.interceptor.CacheResolver; + +public class MultipleCacheResolver implements CacheResolver { + + private final CacheManager simpleCacheManager; + + private final CacheManager caffeineCacheManager; + + private static final String ORDER_CACHE = "orders"; + + private static final String ORDER_PRICE_CACHE = "orderprice"; + + public MultipleCacheResolver(CacheManager simpleCacheManager, CacheManager caffeineCacheManager) { + this.simpleCacheManager = simpleCacheManager; + this.caffeineCacheManager = caffeineCacheManager; + + } + + @Override + public Collection resolveCaches(CacheOperationInvocationContext context) { + Collection caches = new ArrayList(); + if ("getOrderDetail".equals(context.getMethod() + .getName())) { + caches.add(caffeineCacheManager.getCache(ORDER_CACHE)); + } else { + caches.add(simpleCacheManager.getCache(ORDER_PRICE_CACHE)); + } + return caches; + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java new file mode 100644 index 0000000000..17a73bb27a --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java @@ -0,0 +1,43 @@ +package com.baeldung.multiplecachemanager.controller; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.multiplecachemanager.bo.CustomerDetailBO; +import com.baeldung.multiplecachemanager.bo.OrderDetailBO; +import com.baeldung.multiplecachemanager.entity.Customer; +import com.baeldung.multiplecachemanager.entity.Order; + +@RestController +public class MultipleCacheManagerController { + + @Autowired + private CustomerDetailBO customerDetailBO; + + @Autowired + private OrderDetailBO orderDetailBO; + + @GetMapping(value = "/getCustomer/{customerid}") + public Customer getCustomer(@PathVariable Integer customerid) { + return customerDetailBO.getCustomerDetail(customerid); + } + + @GetMapping(value = "/getCustomerOrders/{customerid}") + public List getCustomerOrders(@PathVariable Integer customerid) { + return customerDetailBO.getCustomerOrders(customerid); + } + + @GetMapping(value = "/getOrder/{orderid}") + public Order getOrder(@PathVariable Integer orderid) { + return orderDetailBO.getOrderDetail(orderid); + } + + @GetMapping(value = "/getOrderPrice/{orderid}") + public double getOrderPrice(@PathVariable Integer orderid) { + return orderDetailBO.getOrderPrice(orderid); + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java new file mode 100644 index 0000000000..cfae15f4e9 --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java @@ -0,0 +1,24 @@ +package com.baeldung.multiplecachemanager.entity; + +public class Customer { + + private int customerId; + + private String customerName; + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java new file mode 100644 index 0000000000..4131464981 --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java @@ -0,0 +1,34 @@ +package com.baeldung.multiplecachemanager.entity; + +public class Item { + + private int itemId; + + private String itemDesc; + + private double itemPrice; + + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } + + public String getItemDesc() { + return itemDesc; + } + + public void setItemDesc(String itemDesc) { + this.itemDesc = itemDesc; + } + + public double getItemPrice() { + return itemPrice; + } + + public void setItemPrice(double itemPrice) { + this.itemPrice = itemPrice; + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java new file mode 100644 index 0000000000..15da60d6ea --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java @@ -0,0 +1,44 @@ +package com.baeldung.multiplecachemanager.entity; + +public class Order { + + private int orderId; + + private int itemId; + + private int quantity; + + private int customerId; + + public int getOrderId() { + return orderId; + } + + public void setOrderId(int orderId) { + this.orderId = orderId; + } + + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java new file mode 100644 index 0000000000..aab011427d --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java @@ -0,0 +1,49 @@ +package com.baeldung.multiplecachemanager.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowCallbackHandler; +import org.springframework.stereotype.Repository; + +import com.baeldung.multiplecachemanager.entity.Customer; +import com.baeldung.multiplecachemanager.entity.Order; + +@Repository +public class CustomerDetailRepository { + + @Autowired + private JdbcTemplate jdbcTemplate; + + public Customer getCustomerDetail(Integer customerId) { + String customerQuery = "select * from customer where customerid = ? "; + Customer customer = new Customer(); + jdbcTemplate.query(customerQuery, new Object[] { customerId }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + customer.setCustomerId(rs.getInt("customerid")); + customer.setCustomerName(rs.getString("customername")); + } + }); + return customer; + } + + public List getCustomerOrders(Integer customerId) { + String customerOrderQuery = "select * from orderdetail where customerid = ? "; + List orders = new ArrayList(); + jdbcTemplate.query(customerOrderQuery, new Object[] { customerId }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + Order order = new Order(); + order.setCustomerId(rs.getInt("customerid")); + order.setItemId(rs.getInt("orderid")); + order.setOrderId(rs.getInt("orderid")); + order.setQuantity(rs.getInt("quantity")); + orders.add(order); + } + }); + return orders; + } +} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java new file mode 100644 index 0000000000..58c0968e48 --- /dev/null +++ b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java @@ -0,0 +1,53 @@ +package com.baeldung.multiplecachemanager.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowCallbackHandler; +import org.springframework.stereotype.Repository; + +import com.baeldung.multiplecachemanager.entity.Item; +import com.baeldung.multiplecachemanager.entity.Order; + +@Repository +public class OrderDetailRepository { + + @Autowired + private JdbcTemplate jdbcTemplate; + + public Order getOrderDetail(Integer orderId) { + String orderDetailQuery = "select * from orderdetail where orderid = ? "; + Order order = new Order(); + jdbcTemplate.query(orderDetailQuery, new Object[] { orderId }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + order.setCustomerId(rs.getInt("customerid")); + order.setOrderId(rs.getInt("orderid")); + order.setItemId(rs.getInt("itemid")); + order.setQuantity(rs.getInt("quantity")); + } + }); + return order; + } + + public double getOrderPrice(Integer orderId) { + + String orderItemJoinQuery = "select * from ( select * from orderdetail where orderid = ? ) o left join item on o.itemid = ITEM.itemid"; + Order order = new Order(); + Item item = new Item(); + + jdbcTemplate.query(orderItemJoinQuery, new Object[] { orderId }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + order.setCustomerId(rs.getInt("customerid")); + order.setOrderId(rs.getInt("orderid")); + order.setItemId(rs.getInt("itemid")); + order.setQuantity(rs.getInt("quantity")); + item.setItemDesc("itemdesc"); + item.setItemId(rs.getInt("itemid")); + item.setItemPrice(rs.getDouble("price")); + } + }); + return order.getQuantity() * item.getItemPrice(); + } +} diff --git a/hexagonaljava/src/main/resources/application.properties b/multiplecachemanager/src/main/resources/application.properties similarity index 56% rename from hexagonaljava/src/main/resources/application.properties rename to multiplecachemanager/src/main/resources/application.properties index 5952b7eb01..53a3ac93b4 100644 --- a/hexagonaljava/src/main/resources/application.properties +++ b/multiplecachemanager/src/main/resources/application.properties @@ -2,4 +2,9 @@ spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= -spring.h2.console.enabled=false +#spring.h2.console.enabled=false + + +# Enabling H2 Console +spring.h2.console.enabled=true +spring.h2.console.path=/h2 diff --git a/multiplecachemanager/src/main/resources/data.sql b/multiplecachemanager/src/main/resources/data.sql new file mode 100644 index 0000000000..e4165ae71f --- /dev/null +++ b/multiplecachemanager/src/main/resources/data.sql @@ -0,0 +1,7 @@ +INSERT INTO CUSTOMER VALUES(1001,'BAELDUNG'); + +INSERT INTO ITEM VALUES(10001,'ITEM1',50.0); +INSERT INTO ITEM VALUES(10002,'ITEM2',100.0); + +INSERT INTO ORDERDETAIL VALUES(300001,1001,10001,2); +INSERT INTO ORDERDETAIL VALUES(300002,1001,10002,5); \ No newline at end of file diff --git a/multiplecachemanager/src/main/resources/schema.sql b/multiplecachemanager/src/main/resources/schema.sql new file mode 100644 index 0000000000..5862499bc0 --- /dev/null +++ b/multiplecachemanager/src/main/resources/schema.sql @@ -0,0 +1,19 @@ +CREATE TABLE CUSTOMER( + CUSTOMERID INT PRIMARY KEY, + CUSTOMERNAME VARCHAR(250) NOT NULL +); + +CREATE TABLE ITEM( +ITEMID INT PRIMARY KEY, +ITEMDESC VARCHAR(250), +PRICE DOUBLE +); + +CREATE TABLE ORDERDETAIL( +ORDERID INT PRIMARY KEY, +CUSTOMERID INT NOT NULL, +ITEMID INT NOT NULL, +QUANTITY INT, +FOREIGN KEY (customerid) references CUSTOMER(customerid), +FOREIGN KEY (itemid) references ITEM(itemid) +); \ No newline at end of file diff --git a/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java b/multiplecachemanager/src/test/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplicationTests.java similarity index 62% rename from hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java rename to multiplecachemanager/src/test/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplicationTests.java index eed2f7e6a3..adf69309f2 100644 --- a/hexagonaljava/src/test/java/com/baeldung/hexagonaljava/HexagonaljavaApplicationTests.java +++ b/multiplecachemanager/src/test/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplicationTests.java @@ -1,12 +1,13 @@ -package com.baeldung.hexagonaljava; +package com.baeldung.multiplecachemanager; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest -class HexagonaljavaApplicationTests { +class MultiplecachemanagerApplicationTests { @Test void contextLoads() { } + } From a00e511eb3b0eb13244894f1a622782d273fe049 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sat, 18 Apr 2020 03:47:11 +0530 Subject: [PATCH 0007/1862] BAEL-3963:Using multiple cache managers in Spring --- spring-caching/pom.xml | 17 +++++ .../caching/boot/CacheApplication.java | 4 ++ .../bo/CustomerDetailBO.java | 28 ++++++++ .../bo/OrderDetailBO.java | 25 ++++++++ .../config/MultipleCacheManagerConfig.java | 40 ++++++++++++ .../config/MultipleCacheResolver.java | 38 +++++++++++ .../MultipleCacheManagerController.java | 43 +++++++++++++ .../multiplecachemanager/entity/Customer.java | 24 +++++++ .../multiplecachemanager/entity/Item.java | 34 ++++++++++ .../multiplecachemanager/entity/Order.java | 44 +++++++++++++ .../repository/CustomerDetailRepository.java | 49 ++++++++++++++ .../repository/OrderDetailRepository.java | 53 +++++++++++++++ .../src/main/resources/application.properties | 10 +++ spring-caching/src/main/resources/data.sql | 7 ++ spring-caching/src/main/resources/schema.sql | 19 ++++++ ...ltipleCacheManagerIntegrationUnitTest.java | 64 +++++++++++++++++++ 16 files changed, 499 insertions(+) create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheManagerConfig.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java create mode 100644 spring-caching/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java create mode 100644 spring-caching/src/main/resources/application.properties create mode 100644 spring-caching/src/main/resources/data.sql create mode 100644 spring-caching/src/main/resources/schema.sql create mode 100644 spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java diff --git a/spring-caching/pom.xml b/spring-caching/pom.xml index d33f24de1f..11dd9a8873 100644 --- a/spring-caching/pom.xml +++ b/spring-caching/pom.xml @@ -15,6 +15,10 @@ + + org.springframework.boot + spring-boot-starter-web + org.springframework spring-context @@ -40,6 +44,19 @@ spring-test test + + com.github.ben-manes.caffeine + caffeine + + + com.h2database + h2 + runtime + + + org.springframework.boot + spring-boot-starter-jdbc + diff --git a/spring-caching/src/main/java/com/baeldung/caching/boot/CacheApplication.java b/spring-caching/src/main/java/com/baeldung/caching/boot/CacheApplication.java index 714dc443e0..afa1d0ec99 100644 --- a/spring-caching/src/main/java/com/baeldung/caching/boot/CacheApplication.java +++ b/spring-caching/src/main/java/com/baeldung/caching/boot/CacheApplication.java @@ -3,9 +3,13 @@ package com.baeldung.caching.boot; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; +//import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @EnableCaching +//to run any module like ehcache,caching or multiplecachemanager in local machine +//add it's package for ComponentScan like below +//@ComponentScan("com.baeldung.multiplecachemanager") public class CacheApplication { public static void main(String[] args) { diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java new file mode 100644 index 0000000000..3da4c23e28 --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java @@ -0,0 +1,28 @@ +package com.baeldung.multiplecachemanager.bo; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Component; + +import com.baeldung.multiplecachemanager.entity.Customer; +import com.baeldung.multiplecachemanager.entity.Order; +import com.baeldung.multiplecachemanager.repository.CustomerDetailRepository; + +@Component +public class CustomerDetailBO { + + @Autowired + private CustomerDetailRepository customerDetailRepository; + + @Cacheable(cacheNames = "customers") + public Customer getCustomerDetail(Integer customerId) { + return customerDetailRepository.getCustomerDetail(customerId); + } + + @Cacheable(cacheNames = "customerOrders", cacheManager = "alternateCacheManager") + public List getCustomerOrders(Integer customerId) { + return customerDetailRepository.getCustomerOrders(customerId); + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java new file mode 100644 index 0000000000..390881167f --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java @@ -0,0 +1,25 @@ +package com.baeldung.multiplecachemanager.bo; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Component; + +import com.baeldung.multiplecachemanager.entity.Order; +import com.baeldung.multiplecachemanager.repository.OrderDetailRepository; + +@Component +public class OrderDetailBO { + + @Autowired + private OrderDetailRepository orderDetailRepository; + + @Cacheable(cacheNames = "orders", cacheResolver = "cacheResolver") + public Order getOrderDetail(Integer orderId) { + return orderDetailRepository.getOrderDetail(orderId); + } + + @Cacheable(cacheNames = "orderprice", cacheResolver = "cacheResolver") + public double getOrderPrice(Integer orderId) { + return orderDetailRepository.getOrderPrice(orderId); + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheManagerConfig.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheManagerConfig.java new file mode 100644 index 0000000000..247a9b596b --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheManagerConfig.java @@ -0,0 +1,40 @@ +package com.baeldung.multiplecachemanager.config; + +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.caffeine.CaffeineCacheManager; +import org.springframework.cache.concurrent.ConcurrentMapCacheManager; +import org.springframework.cache.interceptor.CacheResolver; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +//import org.springframework.context.annotation.Primary; + +import com.github.benmanes.caffeine.cache.Caffeine; + +@Configuration +@EnableCaching +public class MultipleCacheManagerConfig extends CachingConfigurerSupport { + + @Bean + //@Primary + public CacheManager cacheManager() { + CaffeineCacheManager cacheManager = new CaffeineCacheManager("customers", "orders"); + cacheManager.setCaffeine(Caffeine.newBuilder() + .initialCapacity(200) + .maximumSize(500) + .weakKeys() + .recordStats()); + return cacheManager; + } + + @Bean + public CacheManager alternateCacheManager() { + return new ConcurrentMapCacheManager("customerOrders", "orderprice"); + } + + @Bean + public CacheResolver cacheResolver() { + return new MultipleCacheResolver(alternateCacheManager(), cacheManager()); + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java new file mode 100644 index 0000000000..1bd869d98e --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java @@ -0,0 +1,38 @@ +package com.baeldung.multiplecachemanager.config; + +import java.util.ArrayList; +import java.util.Collection; + +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.interceptor.CacheOperationInvocationContext; +import org.springframework.cache.interceptor.CacheResolver; + +public class MultipleCacheResolver implements CacheResolver { + + private final CacheManager simpleCacheManager; + + private final CacheManager caffeineCacheManager; + + private static final String ORDER_CACHE = "orders"; + + private static final String ORDER_PRICE_CACHE = "orderprice"; + + public MultipleCacheResolver(CacheManager simpleCacheManager, CacheManager caffeineCacheManager) { + this.simpleCacheManager = simpleCacheManager; + this.caffeineCacheManager = caffeineCacheManager; + + } + + @Override + public Collection resolveCaches(CacheOperationInvocationContext context) { + Collection caches = new ArrayList(); + if ("getOrderDetail".equals(context.getMethod() + .getName())) { + caches.add(caffeineCacheManager.getCache(ORDER_CACHE)); + } else { + caches.add(simpleCacheManager.getCache(ORDER_PRICE_CACHE)); + } + return caches; + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java new file mode 100644 index 0000000000..17a73bb27a --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java @@ -0,0 +1,43 @@ +package com.baeldung.multiplecachemanager.controller; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.multiplecachemanager.bo.CustomerDetailBO; +import com.baeldung.multiplecachemanager.bo.OrderDetailBO; +import com.baeldung.multiplecachemanager.entity.Customer; +import com.baeldung.multiplecachemanager.entity.Order; + +@RestController +public class MultipleCacheManagerController { + + @Autowired + private CustomerDetailBO customerDetailBO; + + @Autowired + private OrderDetailBO orderDetailBO; + + @GetMapping(value = "/getCustomer/{customerid}") + public Customer getCustomer(@PathVariable Integer customerid) { + return customerDetailBO.getCustomerDetail(customerid); + } + + @GetMapping(value = "/getCustomerOrders/{customerid}") + public List getCustomerOrders(@PathVariable Integer customerid) { + return customerDetailBO.getCustomerOrders(customerid); + } + + @GetMapping(value = "/getOrder/{orderid}") + public Order getOrder(@PathVariable Integer orderid) { + return orderDetailBO.getOrderDetail(orderid); + } + + @GetMapping(value = "/getOrderPrice/{orderid}") + public double getOrderPrice(@PathVariable Integer orderid) { + return orderDetailBO.getOrderPrice(orderid); + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java new file mode 100644 index 0000000000..cfae15f4e9 --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java @@ -0,0 +1,24 @@ +package com.baeldung.multiplecachemanager.entity; + +public class Customer { + + private int customerId; + + private String customerName; + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java new file mode 100644 index 0000000000..4131464981 --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java @@ -0,0 +1,34 @@ +package com.baeldung.multiplecachemanager.entity; + +public class Item { + + private int itemId; + + private String itemDesc; + + private double itemPrice; + + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } + + public String getItemDesc() { + return itemDesc; + } + + public void setItemDesc(String itemDesc) { + this.itemDesc = itemDesc; + } + + public double getItemPrice() { + return itemPrice; + } + + public void setItemPrice(double itemPrice) { + this.itemPrice = itemPrice; + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java new file mode 100644 index 0000000000..15da60d6ea --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java @@ -0,0 +1,44 @@ +package com.baeldung.multiplecachemanager.entity; + +public class Order { + + private int orderId; + + private int itemId; + + private int quantity; + + private int customerId; + + public int getOrderId() { + return orderId; + } + + public void setOrderId(int orderId) { + this.orderId = orderId; + } + + public int getItemId() { + return itemId; + } + + public void setItemId(int itemId) { + this.itemId = itemId; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java new file mode 100644 index 0000000000..aab011427d --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java @@ -0,0 +1,49 @@ +package com.baeldung.multiplecachemanager.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowCallbackHandler; +import org.springframework.stereotype.Repository; + +import com.baeldung.multiplecachemanager.entity.Customer; +import com.baeldung.multiplecachemanager.entity.Order; + +@Repository +public class CustomerDetailRepository { + + @Autowired + private JdbcTemplate jdbcTemplate; + + public Customer getCustomerDetail(Integer customerId) { + String customerQuery = "select * from customer where customerid = ? "; + Customer customer = new Customer(); + jdbcTemplate.query(customerQuery, new Object[] { customerId }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + customer.setCustomerId(rs.getInt("customerid")); + customer.setCustomerName(rs.getString("customername")); + } + }); + return customer; + } + + public List getCustomerOrders(Integer customerId) { + String customerOrderQuery = "select * from orderdetail where customerid = ? "; + List orders = new ArrayList(); + jdbcTemplate.query(customerOrderQuery, new Object[] { customerId }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + Order order = new Order(); + order.setCustomerId(rs.getInt("customerid")); + order.setItemId(rs.getInt("orderid")); + order.setOrderId(rs.getInt("orderid")); + order.setQuantity(rs.getInt("quantity")); + orders.add(order); + } + }); + return orders; + } +} diff --git a/spring-caching/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java new file mode 100644 index 0000000000..58c0968e48 --- /dev/null +++ b/spring-caching/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java @@ -0,0 +1,53 @@ +package com.baeldung.multiplecachemanager.repository; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.RowCallbackHandler; +import org.springframework.stereotype.Repository; + +import com.baeldung.multiplecachemanager.entity.Item; +import com.baeldung.multiplecachemanager.entity.Order; + +@Repository +public class OrderDetailRepository { + + @Autowired + private JdbcTemplate jdbcTemplate; + + public Order getOrderDetail(Integer orderId) { + String orderDetailQuery = "select * from orderdetail where orderid = ? "; + Order order = new Order(); + jdbcTemplate.query(orderDetailQuery, new Object[] { orderId }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + order.setCustomerId(rs.getInt("customerid")); + order.setOrderId(rs.getInt("orderid")); + order.setItemId(rs.getInt("itemid")); + order.setQuantity(rs.getInt("quantity")); + } + }); + return order; + } + + public double getOrderPrice(Integer orderId) { + + String orderItemJoinQuery = "select * from ( select * from orderdetail where orderid = ? ) o left join item on o.itemid = ITEM.itemid"; + Order order = new Order(); + Item item = new Item(); + + jdbcTemplate.query(orderItemJoinQuery, new Object[] { orderId }, new RowCallbackHandler() { + public void processRow(ResultSet rs) throws SQLException { + order.setCustomerId(rs.getInt("customerid")); + order.setOrderId(rs.getInt("orderid")); + order.setItemId(rs.getInt("itemid")); + order.setQuantity(rs.getInt("quantity")); + item.setItemDesc("itemdesc"); + item.setItemId(rs.getInt("itemid")); + item.setItemPrice(rs.getDouble("price")); + } + }); + return order.getQuantity() * item.getItemPrice(); + } +} diff --git a/spring-caching/src/main/resources/application.properties b/spring-caching/src/main/resources/application.properties new file mode 100644 index 0000000000..53a3ac93b4 --- /dev/null +++ b/spring-caching/src/main/resources/application.properties @@ -0,0 +1,10 @@ +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +#spring.h2.console.enabled=false + + +# Enabling H2 Console +spring.h2.console.enabled=true +spring.h2.console.path=/h2 diff --git a/spring-caching/src/main/resources/data.sql b/spring-caching/src/main/resources/data.sql new file mode 100644 index 0000000000..e4165ae71f --- /dev/null +++ b/spring-caching/src/main/resources/data.sql @@ -0,0 +1,7 @@ +INSERT INTO CUSTOMER VALUES(1001,'BAELDUNG'); + +INSERT INTO ITEM VALUES(10001,'ITEM1',50.0); +INSERT INTO ITEM VALUES(10002,'ITEM2',100.0); + +INSERT INTO ORDERDETAIL VALUES(300001,1001,10001,2); +INSERT INTO ORDERDETAIL VALUES(300002,1001,10002,5); \ No newline at end of file diff --git a/spring-caching/src/main/resources/schema.sql b/spring-caching/src/main/resources/schema.sql new file mode 100644 index 0000000000..5862499bc0 --- /dev/null +++ b/spring-caching/src/main/resources/schema.sql @@ -0,0 +1,19 @@ +CREATE TABLE CUSTOMER( + CUSTOMERID INT PRIMARY KEY, + CUSTOMERNAME VARCHAR(250) NOT NULL +); + +CREATE TABLE ITEM( +ITEMID INT PRIMARY KEY, +ITEMDESC VARCHAR(250), +PRICE DOUBLE +); + +CREATE TABLE ORDERDETAIL( +ORDERID INT PRIMARY KEY, +CUSTOMERID INT NOT NULL, +ITEMID INT NOT NULL, +QUANTITY INT, +FOREIGN KEY (customerid) references CUSTOMER(customerid), +FOREIGN KEY (itemid) references ITEM(itemid) +); \ No newline at end of file diff --git a/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java b/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java new file mode 100644 index 0000000000..4bcbdb4d68 --- /dev/null +++ b/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java @@ -0,0 +1,64 @@ +package com.baeldung.multiplecachemanager; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.caffeine.CaffeineCache; +import org.springframework.util.Assert; + +import com.baeldung.multiplecachemanager.bo.OrderDetailBO; +import com.baeldung.multiplecachemanager.entity.Order; +import com.baeldung.multiplecachemanager.repository.OrderDetailRepository; + +@SpringBootApplication +@SpringBootTest +public class MultipleCacheManagerIntegrationUnitTest { + + @MockBean + private OrderDetailRepository orderDetailRepository; + + @Autowired + private OrderDetailBO orderDetailBO; + + @Autowired + private CacheManager cacheManager; + + @Autowired + private CacheManager alternateCacheManager; + + @Test + public void whenCallGetOrderDetail_thenDataShouldBeInCaffieneCacheManager() { + Integer key = 30001; + cacheManager.getCache("orders") + .evict(key); + Order order = new Order(); + order.setCustomerId(1001); + order.setItemId(10001); + order.setOrderId(30001); + order.setQuantity(2); + Mockito.when(orderDetailRepository.getOrderDetail(key)) + .thenReturn(order); + orderDetailBO.getOrderDetail(key); + org.springframework.cache.caffeine.CaffeineCache cache = (CaffeineCache) cacheManager.getCache("orders"); + Assert.notNull(cache.get(key) + .get(), "caffieneCache should have had the data"); + } + + @Test + public void whenCallGetOrderPrice_thenDataShouldBeInAlternateCacheManager() { + Integer key = 30001; + alternateCacheManager.getCache("orderprice") + .evict(key); + Mockito.when(orderDetailRepository.getOrderPrice(key)) + .thenReturn(500.0); + orderDetailBO.getOrderPrice(key); + Cache cache = alternateCacheManager.getCache("orderprice"); + Assert.notNull(cache.get(key) + .get(), "alternateCache should have had the data"); + } +} From a6dc19343777ab7b6b2ecb6496b1ee7b1f027b19 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sat, 18 Apr 2020 03:52:29 +0530 Subject: [PATCH 0008/1862] removing new module created in last pull request --- multiplecachemanager/pom.xml | 69 ------------------- .../MultiplecachemanagerApplication.java | 45 ------------ .../bo/CustomerDetailBO.java | 28 -------- .../bo/OrderDetailBO.java | 25 ------- .../config/MultipleCacheResolver.java | 38 ---------- .../MultipleCacheManagerController.java | 43 ------------ .../multiplecachemanager/entity/Customer.java | 24 ------- .../multiplecachemanager/entity/Item.java | 34 --------- .../multiplecachemanager/entity/Order.java | 44 ------------ .../repository/CustomerDetailRepository.java | 49 ------------- .../repository/OrderDetailRepository.java | 53 -------------- .../src/main/resources/application.properties | 10 --- .../src/main/resources/data.sql | 7 -- .../src/main/resources/schema.sql | 19 ----- .../MultiplecachemanagerApplicationTests.java | 13 ---- 15 files changed, 501 deletions(-) delete mode 100644 multiplecachemanager/pom.xml delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplication.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java delete mode 100644 multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java delete mode 100644 multiplecachemanager/src/main/resources/application.properties delete mode 100644 multiplecachemanager/src/main/resources/data.sql delete mode 100644 multiplecachemanager/src/main/resources/schema.sql delete mode 100644 multiplecachemanager/src/test/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplicationTests.java diff --git a/multiplecachemanager/pom.xml b/multiplecachemanager/pom.xml deleted file mode 100644 index 22daf6e87d..0000000000 --- a/multiplecachemanager/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.2.6.RELEASE - - - com.baeldung - multiplecachemanager - 0.0.1-SNAPSHOT - multiplecachemanager - sample project for configuring multiple cache managers - - - 1.8 - - - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework.boot - spring-boot-starter-web - - - - com.h2database - h2 - runtime - - - - org.springframework.boot - spring-boot-starter-cache - - - - com.github.ben-manes.caffeine - caffeine - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplication.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplication.java deleted file mode 100644 index 4c7efc98bd..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplication.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baeldung.multiplecachemanager; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cache.CacheManager; -import org.springframework.cache.annotation.CachingConfigurerSupport; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.cache.caffeine.CaffeineCacheManager; -import org.springframework.cache.concurrent.ConcurrentMapCacheManager; -import org.springframework.cache.interceptor.CacheResolver; -import org.springframework.context.annotation.Bean; - -import com.baeldung.multiplecachemanager.config.MultipleCacheResolver; -import com.github.benmanes.caffeine.cache.Caffeine; - -@SpringBootApplication -@EnableCaching -public class MultiplecachemanagerApplication extends CachingConfigurerSupport { - - public static void main(String[] args) { - SpringApplication.run(MultiplecachemanagerApplication.class, args); - } - - @Bean - // @Primary - public CacheManager cacheManager() { - CaffeineCacheManager cacheManager = new CaffeineCacheManager("customers", "orders"); - cacheManager.setCaffeine(Caffeine.newBuilder() - .initialCapacity(200) - .maximumSize(500) - .weakKeys() - .recordStats()); - return cacheManager; - } - - @Bean - public CacheManager alternateCacheManager() { - return new ConcurrentMapCacheManager("customerOrders", "orderprice"); - } - - @Bean - public CacheResolver cacheResolver() { - return new MultipleCacheResolver(alternateCacheManager(), cacheManager()); - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java deleted file mode 100644 index 3da4c23e28..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/CustomerDetailBO.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.multiplecachemanager.bo; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Component; - -import com.baeldung.multiplecachemanager.entity.Customer; -import com.baeldung.multiplecachemanager.entity.Order; -import com.baeldung.multiplecachemanager.repository.CustomerDetailRepository; - -@Component -public class CustomerDetailBO { - - @Autowired - private CustomerDetailRepository customerDetailRepository; - - @Cacheable(cacheNames = "customers") - public Customer getCustomerDetail(Integer customerId) { - return customerDetailRepository.getCustomerDetail(customerId); - } - - @Cacheable(cacheNames = "customerOrders", cacheManager = "alternateCacheManager") - public List getCustomerOrders(Integer customerId) { - return customerDetailRepository.getCustomerOrders(customerId); - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java deleted file mode 100644 index cb9e301fcb..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/bo/OrderDetailBO.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.multiplecachemanager.bo; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Component; - -import com.baeldung.multiplecachemanager.entity.Order; -import com.baeldung.multiplecachemanager.repository.OrderDetailRepository; - -@Component -public class OrderDetailBO { - - @Autowired - private OrderDetailRepository orderDetailRepository; - - @Cacheable(cacheNames = "orders", cacheResolver = "cacheResolver") - public Order getOrderDetail(Integer orderId) { - return orderDetailRepository.getOrderDetail(orderId); - } - - @Cacheable(cacheNames = "orderprice", cacheResolver = "cacheResolver") - public double getOrderPrice(Integer orderId) { - return orderDetailRepository.getOrderPrice(orderId); - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java deleted file mode 100644 index 1bd869d98e..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/config/MultipleCacheResolver.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.multiplecachemanager.config; - -import java.util.ArrayList; -import java.util.Collection; - -import org.springframework.cache.Cache; -import org.springframework.cache.CacheManager; -import org.springframework.cache.interceptor.CacheOperationInvocationContext; -import org.springframework.cache.interceptor.CacheResolver; - -public class MultipleCacheResolver implements CacheResolver { - - private final CacheManager simpleCacheManager; - - private final CacheManager caffeineCacheManager; - - private static final String ORDER_CACHE = "orders"; - - private static final String ORDER_PRICE_CACHE = "orderprice"; - - public MultipleCacheResolver(CacheManager simpleCacheManager, CacheManager caffeineCacheManager) { - this.simpleCacheManager = simpleCacheManager; - this.caffeineCacheManager = caffeineCacheManager; - - } - - @Override - public Collection resolveCaches(CacheOperationInvocationContext context) { - Collection caches = new ArrayList(); - if ("getOrderDetail".equals(context.getMethod() - .getName())) { - caches.add(caffeineCacheManager.getCache(ORDER_CACHE)); - } else { - caches.add(simpleCacheManager.getCache(ORDER_PRICE_CACHE)); - } - return caches; - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java deleted file mode 100644 index 17a73bb27a..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/controller/MultipleCacheManagerController.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.baeldung.multiplecachemanager.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.multiplecachemanager.bo.CustomerDetailBO; -import com.baeldung.multiplecachemanager.bo.OrderDetailBO; -import com.baeldung.multiplecachemanager.entity.Customer; -import com.baeldung.multiplecachemanager.entity.Order; - -@RestController -public class MultipleCacheManagerController { - - @Autowired - private CustomerDetailBO customerDetailBO; - - @Autowired - private OrderDetailBO orderDetailBO; - - @GetMapping(value = "/getCustomer/{customerid}") - public Customer getCustomer(@PathVariable Integer customerid) { - return customerDetailBO.getCustomerDetail(customerid); - } - - @GetMapping(value = "/getCustomerOrders/{customerid}") - public List getCustomerOrders(@PathVariable Integer customerid) { - return customerDetailBO.getCustomerOrders(customerid); - } - - @GetMapping(value = "/getOrder/{orderid}") - public Order getOrder(@PathVariable Integer orderid) { - return orderDetailBO.getOrderDetail(orderid); - } - - @GetMapping(value = "/getOrderPrice/{orderid}") - public double getOrderPrice(@PathVariable Integer orderid) { - return orderDetailBO.getOrderPrice(orderid); - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java deleted file mode 100644 index cfae15f4e9..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Customer.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.multiplecachemanager.entity; - -public class Customer { - - private int customerId; - - private String customerName; - - public int getCustomerId() { - return customerId; - } - - public void setCustomerId(int customerId) { - this.customerId = customerId; - } - - public String getCustomerName() { - return customerName; - } - - public void setCustomerName(String customerName) { - this.customerName = customerName; - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java deleted file mode 100644 index 4131464981..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Item.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.multiplecachemanager.entity; - -public class Item { - - private int itemId; - - private String itemDesc; - - private double itemPrice; - - public int getItemId() { - return itemId; - } - - public void setItemId(int itemId) { - this.itemId = itemId; - } - - public String getItemDesc() { - return itemDesc; - } - - public void setItemDesc(String itemDesc) { - this.itemDesc = itemDesc; - } - - public double getItemPrice() { - return itemPrice; - } - - public void setItemPrice(double itemPrice) { - this.itemPrice = itemPrice; - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java deleted file mode 100644 index 15da60d6ea..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/entity/Order.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.multiplecachemanager.entity; - -public class Order { - - private int orderId; - - private int itemId; - - private int quantity; - - private int customerId; - - public int getOrderId() { - return orderId; - } - - public void setOrderId(int orderId) { - this.orderId = orderId; - } - - public int getItemId() { - return itemId; - } - - public void setItemId(int itemId) { - this.itemId = itemId; - } - - public int getQuantity() { - return quantity; - } - - public void setQuantity(int quantity) { - this.quantity = quantity; - } - - public int getCustomerId() { - return customerId; - } - - public void setCustomerId(int customerId) { - this.customerId = customerId; - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java deleted file mode 100644 index aab011427d..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/CustomerDetailRepository.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baeldung.multiplecachemanager.repository; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowCallbackHandler; -import org.springframework.stereotype.Repository; - -import com.baeldung.multiplecachemanager.entity.Customer; -import com.baeldung.multiplecachemanager.entity.Order; - -@Repository -public class CustomerDetailRepository { - - @Autowired - private JdbcTemplate jdbcTemplate; - - public Customer getCustomerDetail(Integer customerId) { - String customerQuery = "select * from customer where customerid = ? "; - Customer customer = new Customer(); - jdbcTemplate.query(customerQuery, new Object[] { customerId }, new RowCallbackHandler() { - public void processRow(ResultSet rs) throws SQLException { - customer.setCustomerId(rs.getInt("customerid")); - customer.setCustomerName(rs.getString("customername")); - } - }); - return customer; - } - - public List getCustomerOrders(Integer customerId) { - String customerOrderQuery = "select * from orderdetail where customerid = ? "; - List orders = new ArrayList(); - jdbcTemplate.query(customerOrderQuery, new Object[] { customerId }, new RowCallbackHandler() { - public void processRow(ResultSet rs) throws SQLException { - Order order = new Order(); - order.setCustomerId(rs.getInt("customerid")); - order.setItemId(rs.getInt("orderid")); - order.setOrderId(rs.getInt("orderid")); - order.setQuantity(rs.getInt("quantity")); - orders.add(order); - } - }); - return orders; - } -} diff --git a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java b/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java deleted file mode 100644 index 58c0968e48..0000000000 --- a/multiplecachemanager/src/main/java/com/baeldung/multiplecachemanager/repository/OrderDetailRepository.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.baeldung.multiplecachemanager.repository; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowCallbackHandler; -import org.springframework.stereotype.Repository; - -import com.baeldung.multiplecachemanager.entity.Item; -import com.baeldung.multiplecachemanager.entity.Order; - -@Repository -public class OrderDetailRepository { - - @Autowired - private JdbcTemplate jdbcTemplate; - - public Order getOrderDetail(Integer orderId) { - String orderDetailQuery = "select * from orderdetail where orderid = ? "; - Order order = new Order(); - jdbcTemplate.query(orderDetailQuery, new Object[] { orderId }, new RowCallbackHandler() { - public void processRow(ResultSet rs) throws SQLException { - order.setCustomerId(rs.getInt("customerid")); - order.setOrderId(rs.getInt("orderid")); - order.setItemId(rs.getInt("itemid")); - order.setQuantity(rs.getInt("quantity")); - } - }); - return order; - } - - public double getOrderPrice(Integer orderId) { - - String orderItemJoinQuery = "select * from ( select * from orderdetail where orderid = ? ) o left join item on o.itemid = ITEM.itemid"; - Order order = new Order(); - Item item = new Item(); - - jdbcTemplate.query(orderItemJoinQuery, new Object[] { orderId }, new RowCallbackHandler() { - public void processRow(ResultSet rs) throws SQLException { - order.setCustomerId(rs.getInt("customerid")); - order.setOrderId(rs.getInt("orderid")); - order.setItemId(rs.getInt("itemid")); - order.setQuantity(rs.getInt("quantity")); - item.setItemDesc("itemdesc"); - item.setItemId(rs.getInt("itemid")); - item.setItemPrice(rs.getDouble("price")); - } - }); - return order.getQuantity() * item.getItemPrice(); - } -} diff --git a/multiplecachemanager/src/main/resources/application.properties b/multiplecachemanager/src/main/resources/application.properties deleted file mode 100644 index 53a3ac93b4..0000000000 --- a/multiplecachemanager/src/main/resources/application.properties +++ /dev/null @@ -1,10 +0,0 @@ -spring.datasource.url=jdbc:h2:mem:testdb -spring.datasource.driverClassName=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password= -#spring.h2.console.enabled=false - - -# Enabling H2 Console -spring.h2.console.enabled=true -spring.h2.console.path=/h2 diff --git a/multiplecachemanager/src/main/resources/data.sql b/multiplecachemanager/src/main/resources/data.sql deleted file mode 100644 index e4165ae71f..0000000000 --- a/multiplecachemanager/src/main/resources/data.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO CUSTOMER VALUES(1001,'BAELDUNG'); - -INSERT INTO ITEM VALUES(10001,'ITEM1',50.0); -INSERT INTO ITEM VALUES(10002,'ITEM2',100.0); - -INSERT INTO ORDERDETAIL VALUES(300001,1001,10001,2); -INSERT INTO ORDERDETAIL VALUES(300002,1001,10002,5); \ No newline at end of file diff --git a/multiplecachemanager/src/main/resources/schema.sql b/multiplecachemanager/src/main/resources/schema.sql deleted file mode 100644 index 5862499bc0..0000000000 --- a/multiplecachemanager/src/main/resources/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE CUSTOMER( - CUSTOMERID INT PRIMARY KEY, - CUSTOMERNAME VARCHAR(250) NOT NULL -); - -CREATE TABLE ITEM( -ITEMID INT PRIMARY KEY, -ITEMDESC VARCHAR(250), -PRICE DOUBLE -); - -CREATE TABLE ORDERDETAIL( -ORDERID INT PRIMARY KEY, -CUSTOMERID INT NOT NULL, -ITEMID INT NOT NULL, -QUANTITY INT, -FOREIGN KEY (customerid) references CUSTOMER(customerid), -FOREIGN KEY (itemid) references ITEM(itemid) -); \ No newline at end of file diff --git a/multiplecachemanager/src/test/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplicationTests.java b/multiplecachemanager/src/test/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplicationTests.java deleted file mode 100644 index adf69309f2..0000000000 --- a/multiplecachemanager/src/test/java/com/baeldung/multiplecachemanager/MultiplecachemanagerApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.multiplecachemanager; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class MultiplecachemanagerApplicationTests { - - @Test - void contextLoads() { - } - -} From d7ee1a96991f4f2854ed388861797f1a8f4765be Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sat, 18 Apr 2020 15:52:19 +0530 Subject: [PATCH 0009/1862] Fixes as per editor Suggestions --- spring-caching/pom.xml | 101 +++++++++--------- .../src/main/resources/application.properties | 2 - ...ltipleCacheManagerIntegrationUnitTest.java | 4 +- 3 files changed, 53 insertions(+), 54 deletions(-) diff --git a/spring-caching/pom.xml b/spring-caching/pom.xml index 11dd9a8873..f56d3cf328 100644 --- a/spring-caching/pom.xml +++ b/spring-caching/pom.xml @@ -1,54 +1,55 @@ - - 4.0.0 - spring-caching - 0.1-SNAPSHOT - spring-caching - war + + 4.0.0 + spring-caching + 0.1-SNAPSHOT + spring-caching + war - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../parent-boot-2 - + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + - - + + org.springframework.boot spring-boot-starter-web - - org.springframework - spring-context - - - org.springframework.boot - spring-boot-starter-cache - - - org.springframework - spring-web - - - org.springframework - spring-webmvc - - - org.ehcache - ehcache - - - org.springframework - spring-test - test - - - com.github.ben-manes.caffeine - caffeine - - + + org.springframework + spring-context + + + org.springframework.boot + spring-boot-starter-cache + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + + + org.ehcache + ehcache + + + org.springframework + spring-test + test + + + com.github.ben-manes.caffeine + caffeine + + com.h2database h2 runtime @@ -57,10 +58,10 @@ org.springframework.boot spring-boot-starter-jdbc - + + + + 3.5.2 + - - 3.5.2 - - \ No newline at end of file diff --git a/spring-caching/src/main/resources/application.properties b/spring-caching/src/main/resources/application.properties index 53a3ac93b4..ee7b5e62c0 100644 --- a/spring-caching/src/main/resources/application.properties +++ b/spring-caching/src/main/resources/application.properties @@ -2,8 +2,6 @@ spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= -#spring.h2.console.enabled=false - # Enabling H2 Console spring.h2.console.enabled=true diff --git a/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java b/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java index 4bcbdb4d68..e02e5da246 100644 --- a/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java +++ b/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java @@ -32,7 +32,7 @@ public class MultipleCacheManagerIntegrationUnitTest { private CacheManager alternateCacheManager; @Test - public void whenCallGetOrderDetail_thenDataShouldBeInCaffieneCacheManager() { + public void givenCacheResolverIsConfigured_whenCallGetOrderDetail_thenDataShouldBeInCaffieneCacheManager() { Integer key = 30001; cacheManager.getCache("orders") .evict(key); @@ -50,7 +50,7 @@ public class MultipleCacheManagerIntegrationUnitTest { } @Test - public void whenCallGetOrderPrice_thenDataShouldBeInAlternateCacheManager() { + public void givenCacheResolverIsConfigured_whenCallGetOrderPrice_thenDataShouldBeInAlternateCacheManager() { Integer key = 30001; alternateCacheManager.getCache("orderprice") .evict(key); From 5d04769c759824fb6d39eff874eda44339337830 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Mon, 27 Apr 2020 01:54:51 +0530 Subject: [PATCH 0010/1862] fixing spacing issue in pom.xml --- spring-caching/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-caching/pom.xml b/spring-caching/pom.xml index f56d3cf328..e62ebd501b 100644 --- a/spring-caching/pom.xml +++ b/spring-caching/pom.xml @@ -63,5 +63,4 @@ 3.5.2 - - \ No newline at end of file + From 4103e9a75c991125c2f919925a0c4c77dc036b32 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Mon, 27 Apr 2020 02:10:04 +0530 Subject: [PATCH 0011/1862] Fixing spacing issue in pom.xml --- spring-caching/pom.xml | 116 ++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/spring-caching/pom.xml b/spring-caching/pom.xml index e62ebd501b..3c594ee8ab 100644 --- a/spring-caching/pom.xml +++ b/spring-caching/pom.xml @@ -2,65 +2,65 @@ - 4.0.0 - spring-caching - 0.1-SNAPSHOT - spring-caching - war + 4.0.0 + spring-caching + 0.1-SNAPSHOT + spring-caching + war - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../parent-boot-2 - + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-context - - - org.springframework.boot - spring-boot-starter-cache - - - org.springframework - spring-web - - - org.springframework - spring-webmvc - - - org.ehcache - ehcache - - - org.springframework - spring-test - test - - - com.github.ben-manes.caffeine - caffeine - - - com.h2database - h2 - runtime - - - org.springframework.boot - spring-boot-starter-jdbc - - + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context + + + org.springframework.boot + spring-boot-starter-cache + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + + + org.ehcache + ehcache + + + org.springframework + spring-test + test + + + com.github.ben-manes.caffeine + caffeine + + + com.h2database + h2 + runtime + + + org.springframework.boot + spring-boot-starter-jdbc + + - - 3.5.2 - + + 3.5.2 + From f9a771d6952cf968f597f4bc4beb7c3575ef2d21 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Mon, 27 Apr 2020 02:51:43 +0530 Subject: [PATCH 0012/1862] Fixing spacing issue 2 --- spring-caching/pom.xml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/spring-caching/pom.xml b/spring-caching/pom.xml index 3c594ee8ab..f443919b42 100644 --- a/spring-caching/pom.xml +++ b/spring-caching/pom.xml @@ -2,20 +2,20 @@ - 4.0.0 - spring-caching - 0.1-SNAPSHOT - spring-caching - war + 4.0.0 + spring-caching + 0.1-SNAPSHOT + spring-caching + war - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../parent-boot-2 - + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + - + org.springframework.boot spring-boot-starter-web @@ -58,9 +58,9 @@ org.springframework.boot spring-boot-starter-jdbc - + - - 3.5.2 - + + 3.5.2 + From cdc79108444d58fed34227222e9cf1a79e63a675 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Mon, 27 Apr 2020 03:30:41 +0530 Subject: [PATCH 0013/1862] Formatting space issues in pom.xml --- spring-caching/pom.xml | 93 +++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/spring-caching/pom.xml b/spring-caching/pom.xml index f443919b42..80644f8a5f 100644 --- a/spring-caching/pom.xml +++ b/spring-caching/pom.xml @@ -9,58 +9,57 @@ war - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../parent-boot-2 + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 - - org.springframework.boot - spring-boot-starter-web - - - org.springframework - spring-context - - - org.springframework.boot - spring-boot-starter-cache - - - org.springframework - spring-web + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context + + + org.springframework.boot + spring-boot-starter-cache + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + + + org.ehcache + ehcache + + + org.springframework + spring-test + test + + + com.github.ben-manes.caffeine + caffeine + + + com.h2database + h2 + runtime + + + org.springframework.boot + spring-boot-starter-jdbc - - org.springframework - spring-webmvc - - - org.ehcache - ehcache - - - org.springframework - spring-test - test - - - com.github.ben-manes.caffeine - caffeine - - - com.h2database - h2 - runtime - - - org.springframework.boot - spring-boot-starter-jdbc - - - 3.5.2 + 3.5.2 From 388f03ae9a1ecc3a81ebd15ad589b16f61611d59 Mon Sep 17 00:00:00 2001 From: Michael Angstadt Date: Tue, 26 May 2020 15:46:28 -0400 Subject: [PATCH 0014/1862] Use ServiceLoader class to obtain service instance In the "main-app" module, the `HelloInterface` service instance, `HelloModules`, was just being treated like an ordinary class that was exported from the "hello.modules" module. The code was not treating the class as a service class. This is not a good example of how services are used. This commit makes use of the `ServiceLoader` class, which provides access to the `HelloInterface` instance as defined in the "hello.modules" module. This serves as a better example for how services are used. --- .../main.app/com/baeldung/modules/main/MainApp.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core-java-modules/core-java-9-jigsaw/src/simple-modules/main.app/com/baeldung/modules/main/MainApp.java b/core-java-modules/core-java-9-jigsaw/src/simple-modules/main.app/com/baeldung/modules/main/MainApp.java index eb32cafa31..270bf66c81 100644 --- a/core-java-modules/core-java-9-jigsaw/src/simple-modules/main.app/com/baeldung/modules/main/MainApp.java +++ b/core-java-modules/core-java-9-jigsaw/src/simple-modules/main.app/com/baeldung/modules/main/MainApp.java @@ -1,12 +1,15 @@ package com.baeldung.modules.main; +import com.baeldung.modules.hello.HelloInterface; import com.baeldung.modules.hello.HelloModules; +import java.util.ServiceLoader; public class MainApp { public static void main(String[] args) { HelloModules.doSomething(); - - HelloModules module = new HelloModules(); - module.sayHello(); + + Iterable services = ServiceLoader.load(HelloInterface.class); + HelloInterface service = services.iterator().next(); + service.sayHello(); } } From a11b2d812be30138e980285d2ebc76fdaa864e87 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Tue, 1 Oct 2019 12:56:55 -0400 Subject: [PATCH 0015/1862] Add architecture module with Hexagonal example --- architecture/README.md | 3 ++ architecture/pom.xml | 33 ++++++++++++ .../HexagonalArchitectureTaskApplication.java | 12 +++++ .../application/task/AddNewDailyTask.java | 29 ++++++++++ .../application/task/AddNewTask.java | 22 ++++++++ .../application/task/GetTasks.java | 22 ++++++++ .../commands/task/CreateTask.java | 7 +++ .../commands/task/GetAllTasks.java | 7 +++ .../architecture/domain/task/Task.java | 53 +++++++++++++++++++ .../domain/task/TaskRepository.java | 7 +++ .../architecture/domain/task/TaskService.java | 22 ++++++++ .../framework/cli/StartupRunner.java | 25 +++++++++ .../http/task/TaskApiController.java | 42 +++++++++++++++ .../framework/http/task/TaskRequest.java | 29 ++++++++++ 14 files changed, 313 insertions(+) create mode 100644 architecture/README.md create mode 100644 architecture/pom.xml create mode 100644 architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/domain/task/Task.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/domain/task/TaskRepository.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java create mode 100644 architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java diff --git a/architecture/README.md b/architecture/README.md new file mode 100644 index 0000000000..be093f25ed --- /dev/null +++ b/architecture/README.md @@ -0,0 +1,3 @@ +### Relevant articles + +- [A Quick and Practical Example of Hexagonal Architecture in Java](https://www.baeldung.com/a-quick-and-practical-example-of-hexagonal-architecture-in-java-3/) diff --git a/architecture/pom.xml b/architecture/pom.xml new file mode 100644 index 0000000000..4ad104293e --- /dev/null +++ b/architecture/pom.xml @@ -0,0 +1,33 @@ + + 4.0.0 + com.baeldung.architecture + architecture + 0.0.1-SNAPSHOT + architecture + jar + A Quick and Practical Example of Hexagonal Architecture in Java + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + runtime + + + org.springframework.boot + spring-boot-starter-web + + + diff --git a/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java b/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java new file mode 100644 index 0000000000..83e4fc4c0b --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.architecture; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HexagonalArchitectureTaskApplication { + public static void main(String[] args) { + SpringApplication.run(HexagonalArchitectureTaskApplication.class, args); + } + +} diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java new file mode 100644 index 0000000000..208d1bfcc9 --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java @@ -0,0 +1,29 @@ +package com.baeldung.architecture.application.task; + +import java.time.Instant; +import java.time.temporal.ChronoUnit; + +import com.baeldung.architecture.commands.task.CreateTask; +import com.baeldung.architecture.domain.task.Task; + +import org.springframework.stereotype.Component; + +@Component +public class AddNewDailyTask implements CreateTask { + + private AddNewTask addNewTask; + + public AddNewDailyTask(AddNewTask addNewTask) { + this.addNewTask = addNewTask; + } + + @Override + public void create(Task newTask) { + Instant initialDueDate = newTask.getDueDate(); + String description = newTask.getDescription(); + for (int i = 1; i <= 5; i++) { + Task task = new Task(initialDueDate.plus(i, ChronoUnit.DAYS), description); + addNewTask.create(task); + } + } +}; diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java new file mode 100644 index 0000000000..2e5aff4a53 --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java @@ -0,0 +1,22 @@ +package com.baeldung.architecture.application.task; + +import com.baeldung.architecture.domain.task.Task; +import com.baeldung.architecture.domain.task.TaskService; +import com.baeldung.architecture.commands.task.*; + +import org.springframework.stereotype.Component; + +@Component +public class AddNewTask implements CreateTask { + + private TaskService taskService; + + public AddNewTask(TaskService taskService) { + this.taskService = taskService; + } + + @Override + public void create(Task newTask) { + taskService.createTask(newTask); + } +}; diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java b/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java new file mode 100644 index 0000000000..54539290ba --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java @@ -0,0 +1,22 @@ +package com.baeldung.architecture.application.task; + +import com.baeldung.architecture.domain.task.Task; +import com.baeldung.architecture.domain.task.TaskService; +import com.baeldung.architecture.commands.task.*; + +import org.springframework.stereotype.Component; + +@Component +public class GetTasks implements GetAllTasks { + + private TaskService taskService; + + public GetTasks(TaskService taskService) { + this.taskService = taskService; + } + + @Override + public Iterable getAll() { + return taskService.getAllTasks(); + } +}; diff --git a/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java b/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java new file mode 100644 index 0000000000..26e6da10e2 --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java @@ -0,0 +1,7 @@ +package com.baeldung.architecture.commands.task; + +import com.baeldung.architecture.domain.task.Task; + +public interface CreateTask { + public void create(Task newTask); +}; diff --git a/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java b/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java new file mode 100644 index 0000000000..d3c40db92f --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java @@ -0,0 +1,7 @@ +package com.baeldung.architecture.commands.task; + +import com.baeldung.architecture.domain.task.Task; + +public interface GetAllTasks { + public Iterable getAll(); +}; diff --git a/architecture/src/main/java/com/baeldung/architecture/domain/task/Task.java b/architecture/src/main/java/com/baeldung/architecture/domain/task/Task.java new file mode 100644 index 0000000000..240dc33571 --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/domain/task/Task.java @@ -0,0 +1,53 @@ +package com.baeldung.architecture.domain.task; + +import java.time.Instant; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Task { + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + private Long id; + private Instant dueDate = Instant.now(); + private String description; + + public Task() {} + + public Task(Instant dueDate, String description) { + this.dueDate = dueDate; + this.description = description; + } + + public Task(Long id, Instant dueDate, String description) { + this(dueDate, description); + this.id = id; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Instant getDueDate() { + return dueDate; + } + + public void setDueDate(Instant dueDate) { + this.dueDate = dueDate; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskRepository.java b/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskRepository.java new file mode 100644 index 0000000000..d896212714 --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.architecture.domain.task; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface TaskRepository extends CrudRepository {}; diff --git a/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java b/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java new file mode 100644 index 0000000000..cace0614ad --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java @@ -0,0 +1,22 @@ +package com.baeldung.architecture.domain.task; + +import org.springframework.stereotype.Service; + +@Service +public class TaskService { + + private TaskRepository taskRepository; + + public TaskService(TaskRepository taskRepository) { + this.taskRepository = taskRepository; + } + + public void createTask(Task task) { + taskRepository.save(task); + } + + public Iterable getAllTasks() { + return taskRepository.findAll(); + } + +}; diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java b/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java new file mode 100644 index 0000000000..260c033b71 --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java @@ -0,0 +1,25 @@ +package com.baeldung.architecture.framework.cli; + +import com.baeldung.architecture.application.task.AddNewDailyTask; +import com.baeldung.architecture.domain.task.Task; + +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +@Component +public class StartupRunner implements ApplicationRunner { + + AddNewDailyTask addNewDailyTask; + + public StartupRunner(AddNewDailyTask addNewDailyTask) { + this.addNewDailyTask = addNewDailyTask; + } + @Override + public void run(ApplicationArguments args) throws Exception { + System.out.println("Adding daily tasks"); + Task task = new Task(); + task.setDescription("Startup Task"); + addNewDailyTask.create(task); + } +} \ No newline at end of file diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java new file mode 100644 index 0000000000..c6f7bff2dd --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java @@ -0,0 +1,42 @@ +package com.baeldung.architecture.framework.http.task; + +import java.time.Instant; + +import com.baeldung.architecture.application.task.AddNewTask; +import com.baeldung.architecture.application.task.GetTasks; +import com.baeldung.architecture.domain.task.Task; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("task") +public class TaskApiController { + + private AddNewTask addNewTask; + private GetTasks getTasks; + + public TaskApiController( + AddNewTask addNewTask, + GetTasks getTasks + ) { + this.addNewTask = addNewTask; + this.getTasks = getTasks; + } + + @GetMapping + Iterable listTasks() { + return getTasks.getAll(); + } + + @PostMapping(consumes = "application/json", produces = "application/json") + void createTask(@RequestBody TaskRequest taskRequest) { + Task task = new Task(); + task.setDescription(taskRequest.getDescription()); + task.setDueDate(Instant.parse(taskRequest.getDueDate())); + addNewTask.create(task); + } +} \ No newline at end of file diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java new file mode 100644 index 0000000000..2e353b079a --- /dev/null +++ b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java @@ -0,0 +1,29 @@ +package com.baeldung.architecture.framework.http.task; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +public class TaskRequest { + @JsonInclude(Include.NON_NULL) + private String description; + + @JsonInclude(Include.NON_NULL) + private String dueDate; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getDueDate() { + return dueDate; + } + + public void setDueDate(String dueDate) { + this.dueDate = dueDate; + } + +} \ No newline at end of file From 8ed374c4b073fe83d326401bee41dca828d7d1e7 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Tue, 1 Oct 2019 20:15:39 -0400 Subject: [PATCH 0016/1862] Fixup styling --- .../architecture/HexagonalArchitectureTaskApplication.java | 6 +++--- .../baeldung/architecture/application/task/AddNewTask.java | 2 +- .../baeldung/architecture/application/task/GetTasks.java | 2 +- .../baeldung/architecture/framework/cli/StartupRunner.java | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java b/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java index 83e4fc4c0b..69c6f4b276 100644 --- a/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java +++ b/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java @@ -5,8 +5,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class HexagonalArchitectureTaskApplication { - public static void main(String[] args) { - SpringApplication.run(HexagonalArchitectureTaskApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(HexagonalArchitectureTaskApplication.class, args); + } } diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java index 2e5aff4a53..70638378f9 100644 --- a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java +++ b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java @@ -19,4 +19,4 @@ public class AddNewTask implements CreateTask { public void create(Task newTask) { taskService.createTask(newTask); } -}; +} diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java b/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java index 54539290ba..c876f7de85 100644 --- a/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java +++ b/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java @@ -19,4 +19,4 @@ public class GetTasks implements GetAllTasks { public Iterable getAll() { return taskService.getAllTasks(); } -}; +} diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java b/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java index 260c033b71..cf38e5ee5e 100644 --- a/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java +++ b/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java @@ -17,7 +17,6 @@ public class StartupRunner implements ApplicationRunner { } @Override public void run(ApplicationArguments args) throws Exception { - System.out.println("Adding daily tasks"); Task task = new Task(); task.setDescription("Startup Task"); addNewDailyTask.create(task); From f830524b20cf2dde5a8667779c39ac07ad84e095 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Tue, 1 Oct 2019 20:15:39 -0400 Subject: [PATCH 0017/1862] Fixup styling --- .../architecture/application/task/AddNewDailyTask.java | 2 +- .../com/baeldung/architecture/commands/task/CreateTask.java | 2 +- .../com/baeldung/architecture/commands/task/GetAllTasks.java | 2 +- .../com/baeldung/architecture/domain/task/TaskService.java | 2 +- .../com/baeldung/architecture/framework/cli/StartupRunner.java | 2 +- .../architecture/framework/http/task/TaskApiController.java | 2 +- .../baeldung/architecture/framework/http/task/TaskRequest.java | 3 +-- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java index 208d1bfcc9..f9ee97542c 100644 --- a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java +++ b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java @@ -26,4 +26,4 @@ public class AddNewDailyTask implements CreateTask { addNewTask.create(task); } } -}; +} diff --git a/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java b/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java index 26e6da10e2..ec60868a22 100644 --- a/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java +++ b/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java @@ -4,4 +4,4 @@ import com.baeldung.architecture.domain.task.Task; public interface CreateTask { public void create(Task newTask); -}; +} diff --git a/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java b/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java index d3c40db92f..c9aa1be5f8 100644 --- a/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java +++ b/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java @@ -4,4 +4,4 @@ import com.baeldung.architecture.domain.task.Task; public interface GetAllTasks { public Iterable getAll(); -}; +} diff --git a/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java b/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java index cace0614ad..11ef0f3e19 100644 --- a/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java +++ b/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java @@ -19,4 +19,4 @@ public class TaskService { return taskRepository.findAll(); } -}; +} diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java b/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java index cf38e5ee5e..449bc9386e 100644 --- a/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java +++ b/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java @@ -21,4 +21,4 @@ public class StartupRunner implements ApplicationRunner { task.setDescription("Startup Task"); addNewDailyTask.create(task); } -} \ No newline at end of file +} diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java index c6f7bff2dd..87a8f5fe4b 100644 --- a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java +++ b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java @@ -39,4 +39,4 @@ public class TaskApiController { task.setDueDate(Instant.parse(taskRequest.getDueDate())); addNewTask.create(task); } -} \ No newline at end of file +} diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java index 2e353b079a..70b98a32f9 100644 --- a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java +++ b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java @@ -25,5 +25,4 @@ public class TaskRequest { public void setDueDate(String dueDate) { this.dueDate = dueDate; } - -} \ No newline at end of file +} From b4be5f28a1da02c3501d43c56b8c508daf900b59 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sun, 31 May 2020 03:00:18 +0530 Subject: [PATCH 0018/1862] Changing the Test class name from IntegrationUnitTest to IntegrationTest --- ...onUnitTest.java => MultipleCacheManagerIntegrationTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-caching/src/test/java/com/baeldung/multiplecachemanager/{MultipleCacheManagerIntegrationUnitTest.java => MultipleCacheManagerIntegrationTest.java} (97%) diff --git a/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java b/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationTest.java similarity index 97% rename from spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java rename to spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationTest.java index e02e5da246..c83d4f9e96 100644 --- a/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationUnitTest.java +++ b/spring-caching/src/test/java/com/baeldung/multiplecachemanager/MultipleCacheManagerIntegrationTest.java @@ -17,7 +17,7 @@ import com.baeldung.multiplecachemanager.repository.OrderDetailRepository; @SpringBootApplication @SpringBootTest -public class MultipleCacheManagerIntegrationUnitTest { +public class MultipleCacheManagerIntegrationTest { @MockBean private OrderDetailRepository orderDetailRepository; From 566d7957592c40fcb28bd98484e6c8eec759382c Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Fri, 5 Jun 2020 23:56:54 +0530 Subject: [PATCH 0019/1862] Added code to access private properties of a class --- .../AccessPrivateProperties.java | 27 ++++++++++++ .../access/privatefields/Person.java | 18 ++++++++ .../AccessPrivateFieldsUnitTest.java | 36 ++++++++++++++++ .../AccessPrivateMethodsUnitTest.java | 43 +++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100755 core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/AccessPrivateProperties.java create mode 100755 core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java create mode 100644 core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java create mode 100644 core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/AccessPrivateProperties.java b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/AccessPrivateProperties.java new file mode 100755 index 0000000000..938f5fd4a2 --- /dev/null +++ b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/AccessPrivateProperties.java @@ -0,0 +1,27 @@ +package com.baeldung.reflection.access.privatefields; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +public class AccessPrivateProperties { + + public void accessPrivateFields(String declaredField, Object declaredFieldValue, boolean accessible) throws NoSuchFieldException, NullPointerException, IllegalArgumentException, IllegalAccessException { + Person person = new Person(); + Field field = person.getClass() + .getDeclaredField(declaredField); + field.setAccessible(accessible); + field.set(person, declaredFieldValue); + System.out.println(person.getName()); + } + + public void accessPrivateMethods(String declaredMethod, Class parameterType, Object name, boolean accessible) throws NoSuchMethodException, IllegalAccessException, NullPointerException, IllegalArgumentException, InvocationTargetException { + Person person = new Person(); + Method method = person.getClass() + .getDeclaredMethod(declaredMethod, parameterType); + method.setAccessible(accessible); + String greetMessage = (String) method.invoke(person, name); + System.out.println(greetMessage); + } + +} diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java new file mode 100755 index 0000000000..e59ff3bea8 --- /dev/null +++ b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java @@ -0,0 +1,18 @@ +package com.baeldung.reflection.access.privatefields; + +public class Person { + + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + private String greet(String number) { + return "Hi " + Integer.parseInt(number); + } +} diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java new file mode 100644 index 0000000000..8faea06f78 --- /dev/null +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.reflection.access.privatefields; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +public class AccessPrivateFieldsUnitTest { + + private static AccessPrivateProperties accessPrivateProperties; + + @BeforeAll + public static void beforeAll() { + accessPrivateProperties = new AccessPrivateProperties(); + } + + @Test + public void testForNoSuchFieldException() { + Assertions.assertThrows(NoSuchFieldException.class, () -> accessPrivateProperties.accessPrivateFields("firstName", "John", true)); + } + + @Test + public void testForIllegalAccessException() { + Assertions.assertThrows(IllegalAccessException.class, () -> accessPrivateProperties.accessPrivateFields("name", "John", false)); + } + + @Test + public void testForIllegalArgumentException() { + Assertions.assertThrows(IllegalArgumentException.class, () -> accessPrivateProperties.accessPrivateFields("name", 25, true)); + } + + @Test + public void testForNullPointerException() { + Assertions.assertThrows(NullPointerException.class, () -> accessPrivateProperties.accessPrivateFields(null, "John", true)); + } + +} diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java new file mode 100644 index 0000000000..a2e0f3fe28 --- /dev/null +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java @@ -0,0 +1,43 @@ +package com.baeldung.reflection.access.privatefields; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +public class AccessPrivateMethodsUnitTest { + + private static AccessPrivateProperties accessPrivateProperties; + + @BeforeAll + public static void beforeAll() { + accessPrivateProperties = new AccessPrivateProperties(); + } + + @Test + public void testForNoSuchMethodException() { + Assertions.assertThrows(NoSuchMethodException.class, () -> accessPrivateProperties.accessPrivateMethods("greeting", String.class, "5", true)); + } + + @Test + public void testForIllegalAccessException() { + Assertions.assertThrows(IllegalAccessException.class, () -> accessPrivateProperties.accessPrivateMethods("greet", String.class, "5", false)); + } + + @Test + public void testForIllegalArgumentException() { + Assertions.assertThrows(IllegalArgumentException.class, () -> accessPrivateProperties.accessPrivateMethods("greet", String.class, 5, true)); + } + + @Test + public void testForNullPointerException() { + Assertions.assertThrows(NullPointerException.class, () -> accessPrivateProperties.accessPrivateMethods(null, String.class, "5", true)); + } + + @Test + public void testForInvocationTargetException() { + Assertions.assertThrows(InvocationTargetException.class, () -> accessPrivateProperties.accessPrivateMethods("greet", String.class, "John", true)); + } + +} From ba3bd78a108fae20e98049aa2a015a95c26119ce Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Wed, 10 Jun 2020 23:23:29 +0530 Subject: [PATCH 0020/1862] Removed abstractions to increase simplicity. --- .../AccessPrivateProperties.java | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100755 core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/AccessPrivateProperties.java diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/AccessPrivateProperties.java b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/AccessPrivateProperties.java deleted file mode 100755 index 938f5fd4a2..0000000000 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/AccessPrivateProperties.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.reflection.access.privatefields; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -public class AccessPrivateProperties { - - public void accessPrivateFields(String declaredField, Object declaredFieldValue, boolean accessible) throws NoSuchFieldException, NullPointerException, IllegalArgumentException, IllegalAccessException { - Person person = new Person(); - Field field = person.getClass() - .getDeclaredField(declaredField); - field.setAccessible(accessible); - field.set(person, declaredFieldValue); - System.out.println(person.getName()); - } - - public void accessPrivateMethods(String declaredMethod, Class parameterType, Object name, boolean accessible) throws NoSuchMethodException, IllegalAccessException, NullPointerException, IllegalArgumentException, InvocationTargetException { - Person person = new Person(); - Method method = person.getClass() - .getDeclaredMethod(declaredMethod, parameterType); - method.setAccessible(accessible); - String greetMessage = (String) method.invoke(person, name); - System.out.println(greetMessage); - } - -} From 8e2725a64e604c7add45ca58203626a7238f9618 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Wed, 10 Jun 2020 23:27:42 +0530 Subject: [PATCH 0021/1862] Added unit test cases in givenX_whenY_thenZ format. --- .../access/privatefields/Person.java | 11 ++-- .../AccessPrivateFieldsUnitTest.java | 43 +++++++++------- .../AccessPrivateMethodsUnitTest.java | 51 ++++++++++++------- 3 files changed, 65 insertions(+), 40 deletions(-) diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java index e59ff3bea8..199d2429a7 100755 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java +++ b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java @@ -1,7 +1,7 @@ package com.baeldung.reflection.access.privatefields; public class Person { - + private String name; public String getName() { @@ -12,7 +12,12 @@ public class Person { this.name = name; } - private String greet(String number) { - return "Hi " + Integer.parseInt(number); + private String greet(String name) { + return "Hello " + name; } + + private int divideByZeroExample() { + return 1 / 0; + } + } diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java index 8faea06f78..200ccea9e3 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java @@ -1,36 +1,43 @@ package com.baeldung.reflection.access.privatefields; +import java.lang.reflect.Field; + import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; public class AccessPrivateFieldsUnitTest { - private static AccessPrivateProperties accessPrivateProperties; + @Test + public void whenGetField_thenSuccess() throws NoSuchFieldException, NullPointerException, IllegalArgumentException, IllegalAccessException { + Person person = new Person(); + person.setName("John"); - @BeforeAll - public static void beforeAll() { - accessPrivateProperties = new AccessPrivateProperties(); + Field field = person.getClass() + .getDeclaredField("name"); + field.setAccessible(true); + + String name = (String) field.get(person); + + Assertions.assertEquals("John", name); } @Test - public void testForNoSuchFieldException() { - Assertions.assertThrows(NoSuchFieldException.class, () -> accessPrivateProperties.accessPrivateFields("firstName", "John", true)); + public void givenInt_whenSetStringField_thenIllegalArgumentException() throws NoSuchFieldException, NullPointerException, IllegalArgumentException, IllegalAccessException { + Person person = new Person(); + Field field = person.getClass() + .getDeclaredField("name"); + field.setAccessible(true); + + Assertions.assertThrows(IllegalArgumentException.class, () -> field.setInt(person, 25)); } @Test - public void testForIllegalAccessException() { - Assertions.assertThrows(IllegalAccessException.class, () -> accessPrivateProperties.accessPrivateFields("name", "John", false)); - } + public void whenFieldNotSetAccessible_thenIllegalAccessException() throws NoSuchFieldException, NullPointerException, IllegalArgumentException, IllegalAccessException { + Person person = new Person(); + Field field = person.getClass() + .getDeclaredField("name"); - @Test - public void testForIllegalArgumentException() { - Assertions.assertThrows(IllegalArgumentException.class, () -> accessPrivateProperties.accessPrivateFields("name", 25, true)); - } - - @Test - public void testForNullPointerException() { - Assertions.assertThrows(NullPointerException.class, () -> accessPrivateProperties.accessPrivateFields(null, "John", true)); + Assertions.assertThrows(IllegalAccessException.class, () -> field.set(person, "John")); } } diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java index a2e0f3fe28..b44731c7ef 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java @@ -1,43 +1,56 @@ package com.baeldung.reflection.access.privatefields; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; public class AccessPrivateMethodsUnitTest { - private static AccessPrivateProperties accessPrivateProperties; + @Test + public void whenGetMethod_thenSuccess() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + Person person = new Person(); - @BeforeAll - public static void beforeAll() { - accessPrivateProperties = new AccessPrivateProperties(); + Method method = person.getClass() + .getDeclaredMethod("greet", String.class); + method.setAccessible(true); + + String greetMessage = (String) method.invoke(person, "John"); + + Assertions.assertEquals("Hello John", greetMessage); } @Test - public void testForNoSuchMethodException() { - Assertions.assertThrows(NoSuchMethodException.class, () -> accessPrivateProperties.accessPrivateMethods("greeting", String.class, "5", true)); + public void givenInt_whenInvokeMethod_thenIllegalArgumentException() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + Person person = new Person(); + + Method method = person.getClass() + .getDeclaredMethod("greet", String.class); + method.setAccessible(true); + + Assertions.assertThrows(IllegalArgumentException.class, () -> method.invoke(person, 25)); } @Test - public void testForIllegalAccessException() { - Assertions.assertThrows(IllegalAccessException.class, () -> accessPrivateProperties.accessPrivateMethods("greet", String.class, "5", false)); + public void whenMethodNotSetAccessible_thenIllegalAccessException() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + Person person = new Person(); + + Method method = person.getClass() + .getDeclaredMethod("greet", String.class); + + Assertions.assertThrows(IllegalAccessException.class, () -> method.invoke(person, "John")); } @Test - public void testForIllegalArgumentException() { - Assertions.assertThrows(IllegalArgumentException.class, () -> accessPrivateProperties.accessPrivateMethods("greet", String.class, 5, true)); - } + public void whenCallingMethodThrowsException_thenInvocationTargetException() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + Person person = new Person(); - @Test - public void testForNullPointerException() { - Assertions.assertThrows(NullPointerException.class, () -> accessPrivateProperties.accessPrivateMethods(null, String.class, "5", true)); - } + Method method = person.getClass() + .getDeclaredMethod("divideByZeroExample"); + method.setAccessible(true); - @Test - public void testForInvocationTargetException() { - Assertions.assertThrows(InvocationTargetException.class, () -> accessPrivateProperties.accessPrivateMethods("greet", String.class, "John", true)); + Assertions.assertThrows(InvocationTargetException.class, () -> method.invoke(person)); } } From f72691730627f9b54bf3ef38a516bff5643a250b Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Mon, 15 Jun 2020 23:32:09 +0530 Subject: [PATCH 0022/1862] Included test cases for NoSuchFieldException, NoSuchMethodException and NullPointerException. --- .../access/privatefields/Person.java | 12 ++++- .../AccessPrivateFieldsUnitTest.java | 46 ++++++++++++++----- .../AccessPrivateMethodsUnitTest.java | 32 +++++++++---- 3 files changed, 68 insertions(+), 22 deletions(-) diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java index 199d2429a7..2ec263f6ae 100755 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java +++ b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java @@ -2,7 +2,9 @@ package com.baeldung.reflection.access.privatefields; public class Person { - private String name; + private String name = "John"; + + private int age = 30; public String getName() { return name; @@ -12,6 +14,14 @@ public class Person { this.name = name; } + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + private String greet(String name) { return "Hello " + name; } diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java index 200ccea9e3..b885e3b669 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java @@ -8,36 +8,58 @@ import org.junit.jupiter.api.Test; public class AccessPrivateFieldsUnitTest { @Test - public void whenGetField_thenSuccess() throws NoSuchFieldException, NullPointerException, IllegalArgumentException, IllegalAccessException { + public void whenGetFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); - person.setName("John"); - Field field = person.getClass() + Field fieldName = person.getClass() .getDeclaredField("name"); - field.setAccessible(true); + fieldName.setAccessible(true); - String name = (String) field.get(person); + String name = (String) fieldName.get(person); + + Field fieldAge = person.getClass() + .getDeclaredField("age"); + fieldAge.setAccessible(true); + + int age = fieldAge.getInt(person); Assertions.assertEquals("John", name); + Assertions.assertEquals(30, age); } @Test - public void givenInt_whenSetStringField_thenIllegalArgumentException() throws NoSuchFieldException, NullPointerException, IllegalArgumentException, IllegalAccessException { + public void givenInt_whenSetStringField_thenIllegalArgumentException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); - Field field = person.getClass() + Field fieldName = person.getClass() .getDeclaredField("name"); - field.setAccessible(true); + fieldName.setAccessible(true); - Assertions.assertThrows(IllegalArgumentException.class, () -> field.setInt(person, 25)); + Assertions.assertThrows(IllegalArgumentException.class, () -> fieldName.setInt(person, 25)); } @Test - public void whenFieldNotSetAccessible_thenIllegalAccessException() throws NoSuchFieldException, NullPointerException, IllegalArgumentException, IllegalAccessException { + public void whenFieldNotSetAccessible_thenIllegalAccessException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); - Field field = person.getClass() + Field fieldName = person.getClass() .getDeclaredField("name"); - Assertions.assertThrows(IllegalAccessException.class, () -> field.set(person, "John")); + Assertions.assertThrows(IllegalAccessException.class, () -> fieldName.get(person)); + } + + @Test + public void whenAccessingWrongProperty_thenNoSuchFieldException() throws NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Assertions.assertThrows(NoSuchFieldException.class, () -> person.getClass() + .getDeclaredField("genders")); + } + + @Test + public void whenAccessingNullProperty_thenNullPointerException() throws NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Assertions.assertThrows(NullPointerException.class, () -> person.getClass() + .getDeclaredField(null)); } } diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java index b44731c7ef..10c953f4af 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java @@ -9,20 +9,20 @@ import org.junit.jupiter.api.Test; public class AccessPrivateMethodsUnitTest { @Test - public void whenGetMethod_thenSuccess() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + public void whenGetMethod_thenSuccess() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NullPointerException { Person person = new Person(); Method method = person.getClass() .getDeclaredMethod("greet", String.class); method.setAccessible(true); - String greetMessage = (String) method.invoke(person, "John"); + String greetMessage = (String) method.invoke(person, "Jane"); - Assertions.assertEquals("Hello John", greetMessage); + Assertions.assertEquals("Hello Jane", greetMessage); } @Test - public void givenInt_whenInvokeMethod_thenIllegalArgumentException() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + public void givenInt_whenInvokeMethod_thenIllegalArgumentException() throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, NullPointerException { Person person = new Person(); Method method = person.getClass() @@ -33,24 +33,38 @@ public class AccessPrivateMethodsUnitTest { } @Test - public void whenMethodNotSetAccessible_thenIllegalAccessException() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + public void whenMethodNotSetAccessible_thenIllegalAccessException() throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, NullPointerException { Person person = new Person(); Method method = person.getClass() .getDeclaredMethod("greet", String.class); - Assertions.assertThrows(IllegalAccessException.class, () -> method.invoke(person, "John")); + Assertions.assertThrows(IllegalAccessException.class, () -> method.invoke(person, "Jane")); } @Test - public void whenCallingMethodThrowsException_thenInvocationTargetException() throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { + public void whenCallingMethodThrowsException_thenInvocationTargetException() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NullPointerException { Person person = new Person(); - Method method = person.getClass() .getDeclaredMethod("divideByZeroExample"); method.setAccessible(true); - Assertions.assertThrows(InvocationTargetException.class, () -> method.invoke(person)); } + @Test + public void whenAccessingWrongProperty_thenNoSuchMethodException() throws NoSuchMethodException, NullPointerException { + Person person = new Person(); + + Assertions.assertThrows(NoSuchMethodException.class, () -> person.getClass() + .getDeclaredMethod("greeting", String.class)); + } + + @Test + public void whenAccessingNullMethod_thenNullPointerException() throws NoSuchMethodException, NullPointerException { + Person person = new Person(); + + Assertions.assertThrows(NullPointerException.class, () -> person.getClass() + .getDeclaredMethod(null, String.class)); + } + } From 333dad149fcaec6fe36f64d0375d4b00f9029828 Mon Sep 17 00:00:00 2001 From: marcodenisi Date: Thu, 18 Jun 2020 17:49:10 +0200 Subject: [PATCH 0023/1862] BAEL-4083 - sample spring boot app with xml config and properties --- spring-boot-modules/pom.xml | 1 + spring-boot-modules/spring-boot-xml/pom.xml | 32 +++++++++++++++++++ .../java/com/baeldung/springbootxml/Pojo.java | 17 ++++++++++ .../SpringBootXmlApplication.java | 25 +++++++++++++++ .../SpringBootXmlWithConfigApplication.java | 23 +++++++++++++ .../src/main/resources/application.properties | 1 + .../src/main/resources/beans.xml | 13 ++++++++ .../src/main/resources/beansconf.xml | 15 +++++++++ 8 files changed, 127 insertions(+) create mode 100644 spring-boot-modules/spring-boot-xml/pom.xml create mode 100644 spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/Pojo.java create mode 100644 spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java create mode 100644 spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlWithConfigApplication.java create mode 100644 spring-boot-modules/spring-boot-xml/src/main/resources/application.properties create mode 100644 spring-boot-modules/spring-boot-xml/src/main/resources/beans.xml create mode 100644 spring-boot-modules/spring-boot-xml/src/main/resources/beansconf.xml diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index 7992c0ce12..8ef3d34056 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -57,6 +57,7 @@ spring-boot-springdoc spring-boot-testing spring-boot-vue + spring-boot-xml diff --git a/spring-boot-modules/spring-boot-xml/pom.xml b/spring-boot-modules/spring-boot-xml/pom.xml new file mode 100644 index 0000000000..dd575ff414 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/pom.xml @@ -0,0 +1,32 @@ + + + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + 4.0.0 + + spring-boot-xml + + + + org.springframework.boot + spring-boot-starter + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/Pojo.java b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/Pojo.java new file mode 100644 index 0000000000..8c8b47ed40 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/Pojo.java @@ -0,0 +1,17 @@ +package com.baeldung.springbootxml; + +public class Pojo { + + private String field; + + public Pojo() { + } + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } +} diff --git a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java new file mode 100644 index 0000000000..1a0350fd26 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java @@ -0,0 +1,25 @@ +package com.baeldung.springbootxml; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportResource; + +@Configuration +@EnableAutoConfiguration +@ImportResource("classpath:beans.xml") +public class SpringBootXmlApplication implements CommandLineRunner { + + @Autowired private Pojo pojo; + + public static void main(String[] args) { + SpringApplication.run(SpringBootXmlApplication.class, args); + } + + public void run(String... args) { + System.out.println(pojo.getField()); + } + +} diff --git a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlWithConfigApplication.java b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlWithConfigApplication.java new file mode 100644 index 0000000000..7c36ac7905 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlWithConfigApplication.java @@ -0,0 +1,23 @@ +package com.baeldung.springbootxml; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportResource; + +@Configuration +@ImportResource("classpath:beansconf.xml") +public class SpringBootXmlWithConfigApplication implements CommandLineRunner { + + @Autowired private Pojo pojo; + + public static void main(String[] args) { + SpringApplication.run(SpringBootXmlWithConfigApplication.class, args); + } + + @Override + public void run(String... args) throws Exception { + System.out.println(pojo.getField()); + } +} diff --git a/spring-boot-modules/spring-boot-xml/src/main/resources/application.properties b/spring-boot-modules/spring-boot-xml/src/main/resources/application.properties new file mode 100644 index 0000000000..ab9de92c82 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/src/main/resources/application.properties @@ -0,0 +1 @@ +sample=string loaded from properties! \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-xml/src/main/resources/beans.xml b/spring-boot-modules/spring-boot-xml/src/main/resources/beans.xml new file mode 100644 index 0000000000..9dac0d9e65 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/src/main/resources/beans.xml @@ -0,0 +1,13 @@ + + + + + + + \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-xml/src/main/resources/beansconf.xml b/spring-boot-modules/spring-boot-xml/src/main/resources/beansconf.xml new file mode 100644 index 0000000000..7f328370a8 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/src/main/resources/beansconf.xml @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file From 3cb402ced71073a70875cc770e2abc47b0e9ef5e Mon Sep 17 00:00:00 2001 From: marcodenisi Date: Thu, 18 Jun 2020 17:58:25 +0200 Subject: [PATCH 0024/1862] BAEL-4083 - removed sample with xml context-config --- .../SpringBootXmlApplication.java | 6 ++--- .../SpringBootXmlWithConfigApplication.java | 23 ------------------- .../src/main/resources/beansconf.xml | 15 ------------ 3 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlWithConfigApplication.java delete mode 100644 spring-boot-modules/spring-boot-xml/src/main/resources/beansconf.xml diff --git a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java index 1a0350fd26..bd75a95d7d 100644 --- a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java +++ b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java @@ -3,12 +3,10 @@ package com.baeldung.springbootxml; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.Configuration; +import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ImportResource; -@Configuration -@EnableAutoConfiguration +@SpringBootApplication @ImportResource("classpath:beans.xml") public class SpringBootXmlApplication implements CommandLineRunner { diff --git a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlWithConfigApplication.java b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlWithConfigApplication.java deleted file mode 100644 index 7c36ac7905..0000000000 --- a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlWithConfigApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.springbootxml; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; - -@Configuration -@ImportResource("classpath:beansconf.xml") -public class SpringBootXmlWithConfigApplication implements CommandLineRunner { - - @Autowired private Pojo pojo; - - public static void main(String[] args) { - SpringApplication.run(SpringBootXmlWithConfigApplication.class, args); - } - - @Override - public void run(String... args) throws Exception { - System.out.println(pojo.getField()); - } -} diff --git a/spring-boot-modules/spring-boot-xml/src/main/resources/beansconf.xml b/spring-boot-modules/spring-boot-xml/src/main/resources/beansconf.xml deleted file mode 100644 index 7f328370a8..0000000000 --- a/spring-boot-modules/spring-boot-xml/src/main/resources/beansconf.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - \ No newline at end of file From eaf59355892d58c92d04354d4a77c28d91b45a9f Mon Sep 17 00:00:00 2001 From: marcodenisi Date: Thu, 18 Jun 2020 22:41:36 +0200 Subject: [PATCH 0025/1862] add slfj logger --- .../springbootxml/SpringBootXmlApplication.java | 12 +++++++++--- .../spring-boot-xml/src/main/resources/beans.xml | 12 +++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java index bd75a95d7d..addf24c427 100644 --- a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java +++ b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplication.java @@ -1,15 +1,21 @@ package com.baeldung.springbootxml; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; -@SpringBootApplication +@Configuration +@EnableAutoConfiguration @ImportResource("classpath:beans.xml") public class SpringBootXmlApplication implements CommandLineRunner { + private static final Logger logger = LoggerFactory.getLogger(SpringBootXmlApplication.class); + @Autowired private Pojo pojo; public static void main(String[] args) { @@ -17,7 +23,7 @@ public class SpringBootXmlApplication implements CommandLineRunner { } public void run(String... args) { - System.out.println(pojo.getField()); + logger.info(pojo.getField()); } } diff --git a/spring-boot-modules/spring-boot-xml/src/main/resources/beans.xml b/spring-boot-modules/spring-boot-xml/src/main/resources/beans.xml index 9dac0d9e65..200afecbc9 100644 --- a/spring-boot-modules/spring-boot-xml/src/main/resources/beans.xml +++ b/spring-boot-modules/spring-boot-xml/src/main/resources/beans.xml @@ -1,11 +1,9 @@ - + From 1c61ba62abf38bd6c3962dc2a4a293baf4523a18 Mon Sep 17 00:00:00 2001 From: joe zhang Date: Fri, 19 Jun 2020 11:06:53 +0800 Subject: [PATCH 0026/1862] Leasy Zhang/shiwangzhihe@gmail.com --- .../convertlisttomap/ListToMapUnitTest.java | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java b/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java new file mode 100644 index 0000000000..e2340a5a9a --- /dev/null +++ b/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java @@ -0,0 +1,102 @@ +package com.baeldung.convertlisttomap; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import org.junit.Test; + +public class ListToMapUnitTest { + + @Test + public void givenAList_whenConvertWithJava8GroupBy_thenReturnMap() { + List strings = Arrays.asList("List", "Map", "Set", "Tree"); + + Map> convertedMap = new HashMap<>(); + + Supplier> listSupplier = () -> { + return new ArrayList<>(); + }; + + Supplier>> mapFactory = () -> { + return new HashMap<>(); + }; + convertedMap = strings.stream() + .collect(Collectors.groupingBy(String::length, mapFactory, Collectors.toCollection(listSupplier))); + + assertEquals(2, convertedMap.size()); + assertTrue(convertedMap.get(3) + .contains("Map")); + } + + @Test + public void givenAList_whenConvertWithJava8Collect_thenReturnMap() { + List strings = Arrays.asList("List", "Map", "Set", "Tree"); + + Map> convertedMap = new HashMap<>(); + + Supplier>> mapFactory = () -> { + return new HashMap<>(); + }; + + Supplier> listSupplier = () -> { + return new ArrayList<>(); + }; + + BiConsumer>, String> accumulator = (response, element) -> { + Integer key = element.length(); + List values = response.getOrDefault(key, listSupplier.get()); + values.add(element); + response.put(key, values); + }; + + BiConsumer>, Map>> combiner = (res1, res2) -> { + res1.putAll(res2); + }; + + convertedMap = strings.stream() + .collect(mapFactory, accumulator, combiner); + + assertEquals(2, convertedMap.size()); + assertTrue(convertedMap.get(3) + .contains("Map")); + } + + @Test + public void givenAList_whenConvertWithCollectorToMap_thenReturnMap() { + List strings = Arrays.asList("List", "Map", "Set", "Tree"); + + Map> convertedMap = new HashMap<>(); + + Supplier>> mapFactory = () -> { + return new HashMap<>(); + }; + + Supplier> listSupplier = () -> { + return new ArrayList<>(); + }; + + convertedMap = strings.stream() + .collect(Collectors.toMap(String::length, (p) -> { + List strs = listSupplier.get(); + strs.add(p); + return strs; + }, (existing, replacement) -> { + existing.addAll(replacement); + return existing; + }, mapFactory)); + + assertEquals(2, convertedMap.size()); + assertTrue(convertedMap.get(3) + .contains("Map")); + } + +} From efa72998e56e9bcbae6ab9b442dfa9cc463c58b0 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Fri, 19 Jun 2020 22:20:57 +0530 Subject: [PATCH 0027/1862] Added new test case for IllegalArgumentException --- .../privatefields/AccessPrivateFieldsUnitTest.java | 4 ++-- .../privatefields/AccessPrivateMethodsUnitTest.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java index b885e3b669..c74af1fe90 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java @@ -28,13 +28,13 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void givenInt_whenSetStringField_thenIllegalArgumentException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void givenInt_whenGetStringField_thenIllegalArgumentException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); Field fieldName = person.getClass() .getDeclaredField("name"); fieldName.setAccessible(true); - Assertions.assertThrows(IllegalArgumentException.class, () -> fieldName.setInt(person, 25)); + Assertions.assertThrows(IllegalArgumentException.class, () -> fieldName.getInt(person)); } @Test diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java index 10c953f4af..df745897d2 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java @@ -31,6 +31,17 @@ public class AccessPrivateMethodsUnitTest { Assertions.assertThrows(IllegalArgumentException.class, () -> method.invoke(person, 25)); } + + @Test + public void givenMultipleParameters_whenInvokeMethod_thenIllegalArgumentException() throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, NullPointerException { + Person person = new Person(); + + Method method = person.getClass() + .getDeclaredMethod("greet", String.class); + method.setAccessible(true); + + Assertions.assertThrows(IllegalArgumentException.class, () -> method.invoke(person, "John", "Jane")); + } @Test public void whenMethodNotSetAccessible_thenIllegalAccessException() throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, NullPointerException { From e8d8dd085f0b215f5680b20ab9b3a77547c23960 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sun, 21 Jun 2020 02:13:35 +0530 Subject: [PATCH 0028/1862] Fixing UT failure in build --- spring-caching/src/main/resources/schema.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-caching/src/main/resources/schema.sql b/spring-caching/src/main/resources/schema.sql index 5862499bc0..7d5cb36d66 100644 --- a/spring-caching/src/main/resources/schema.sql +++ b/spring-caching/src/main/resources/schema.sql @@ -1,3 +1,6 @@ +DROP TABLE ORDERDETAIL IF EXISTS; +DROP TABLE ITEM IF EXISTS; +DROP TABLE CUSTOMER IF EXISTS; CREATE TABLE CUSTOMER( CUSTOMERID INT PRIMARY KEY, CUSTOMERNAME VARCHAR(250) NOT NULL From 57dcc48b92144a6810453d754fa0f19f81090566 Mon Sep 17 00:00:00 2001 From: mdhtr Date: Mon, 22 Jun 2020 16:26:42 +0200 Subject: [PATCH 0029/1862] Examples for the first version of the article --- json-2/pom.xml | 60 +++++++++++++++++++ .../JacksonDeserializationExample.java | 40 +++++++++++++ .../jackson/JacksonExamplePerson.java | 19 ++++++ .../hydrajsonld/HydraJsonldExamplePerson.java | 15 +++++ .../HydraJsonldSerializationExample.java | 52 ++++++++++++++++ .../JacksonJsonLdSerializationExample.java | 25 ++++++++ .../JacksonJsonldExamplePerson.java | 17 ++++++ 7 files changed, 228 insertions(+) create mode 100644 json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationExample.java create mode 100644 json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonExamplePerson.java create mode 100644 json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldExamplePerson.java create mode 100644 json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationExample.java create mode 100644 json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationExample.java create mode 100644 json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonldExamplePerson.java diff --git a/json-2/pom.xml b/json-2/pom.xml index e0295af59b..73c26e8259 100644 --- a/json-2/pom.xml +++ b/json-2/pom.xml @@ -49,6 +49,66 @@ commons-lang3 3.9 + + + com.fasterxml.jackson.core + jackson-annotations + 2.11.0 + + + com.fasterxml.jackson.core + jackson-databind + 2.11.0 + + + com.io-informatics.oss + jackson-jsonld + 0.1.1 + + + jackson-databind + com.fasterxml.jackson.core + + + jackson-annotations + com.fasterxml.jackson.core + + + jackson-core + com.fasterxml.jackson.core + + + jsonld-java + com.github.jsonld-java + + + + + de.escalon.hypermedia + hydra-jsonld + 0.4.2 + + + jackson-databind + com.fasterxml.jackson.core + + + + + com.github.jsonld-java + jsonld-java + 0.13.0 + + + jackson-core + com.fasterxml.jackson.core + + + jackson-databind + com.fasterxml.jackson.core + + + 0.9.23 diff --git a/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationExample.java b/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationExample.java new file mode 100644 index 0000000000..b80769b408 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationExample.java @@ -0,0 +1,40 @@ +package com.baeldung.jsonld.deserialization.jsonldjava.jackson; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.jsonldjava.core.JsonLdOptions; +import com.github.jsonldjava.core.JsonLdProcessor; +import com.github.jsonldjava.utils.JsonUtils; + +public class JacksonDeserializationExample { + public static void main(String[] args) throws IOException { + String exampleJsonld ="{" + + " \"@context\": {" + + " \"@vocab\": \"http://schema.org/\"," + + " \"knows\": {" + + " \"@type\": \"@id\"" + + " }" + + " }," + + " \"@type\": \"Person\"," + + " \"@id\": \"http://example.com/person/1234\"," + + " \"name\": \"Example Name\"," + + " \"knows\": \"http://example.com/person/2345\"" + + "}"; + + Object jsonObject = JsonUtils.fromString(exampleJsonld); + Object compact = JsonLdProcessor.compact(jsonObject, new HashMap(), new JsonLdOptions()); + String compactContent = JsonUtils.toString(compact); + + System.out.println(JsonUtils.toPrettyString(compact)); + + ObjectMapper objectMapper = new ObjectMapper(); + JacksonExamplePerson person = objectMapper.readValue(compactContent, JacksonExamplePerson.class); + + System.out.println(person.id); + System.out.println(person.name); + System.out.println(person.knows.id); + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonExamplePerson.java b/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonExamplePerson.java new file mode 100644 index 0000000000..2e9f38e665 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonExamplePerson.java @@ -0,0 +1,19 @@ +package com.baeldung.jsonld.deserialization.jsonldjava.jackson; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class JacksonExamplePerson { + @JsonProperty("@id") + public String id; + @JsonProperty("http://schema.org/name") + public String name; + @JsonProperty("http://schema.org/knows") + public Link knows; + + public class Link { + @JsonProperty("@id") + public String id; + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldExamplePerson.java b/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldExamplePerson.java new file mode 100644 index 0000000000..16b2199a73 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldExamplePerson.java @@ -0,0 +1,15 @@ +package com.baeldung.jsonld.serialization.hydrajsonld; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import de.escalon.hypermedia.hydra.mapping.Expose; +import de.escalon.hypermedia.hydra.mapping.Vocab; + +@Vocab("http://example.com/vocab/") +@Expose("person") +public class HydraJsonldExamplePerson { + @JsonProperty("@id") + public String id; + @Expose("fullName") + public String name; +} diff --git a/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationExample.java b/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationExample.java new file mode 100644 index 0000000000..3d3531b0b5 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationExample.java @@ -0,0 +1,52 @@ +package com.baeldung.jsonld.serialization.hydrajsonld; + +import java.io.IOException; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.BeanDescription; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationConfig; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.BeanSerializerModifier; +import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; + +import de.escalon.hypermedia.hydra.serialize.JacksonHydraSerializer; + +public class HydraJsonldSerializationExample { + public static void main(String[] args) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.registerModule(getJacksonHydraSerializerModule()); + + HydraJsonldExamplePerson person = new HydraJsonldExamplePerson(); + person.id = "http://example.com/person/1234"; + person.name = "Example Name"; + + System.out.println(mapper.writerWithDefaultPrettyPrinter() + .writeValueAsString(person)); + } + + public static SimpleModule getJacksonHydraSerializerModule() { + return new SimpleModule() { + + @Override + public void setupModule(SetupContext context) { + super.setupModule(context); + + context.addBeanSerializerModifier(new BeanSerializerModifier() { + + @Override + public JsonSerializer modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer serializer) { + + if (serializer instanceof BeanSerializerBase) { + return new JacksonHydraSerializer((BeanSerializerBase) serializer); + } else { + return serializer; + } + } + }); + } + }; + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationExample.java b/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationExample.java new file mode 100644 index 0000000000..6a1acee1b8 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationExample.java @@ -0,0 +1,25 @@ +package com.baeldung.jsonld.serialization.jacksonjsonld; + +import java.io.IOException; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import ioinformarics.oss.jackson.module.jsonld.HydraCollection; +import ioinformarics.oss.jackson.module.jsonld.JsonldGraph; +import ioinformarics.oss.jackson.module.jsonld.JsonldModule; +import ioinformarics.oss.jackson.module.jsonld.JsonldResource; + +public class JacksonJsonLdSerializationExample { + public static void main(String[] args) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JsonldModule()); + + JacksonJsonldExamplePerson person = new JacksonJsonldExamplePerson(); + + JsonldResource jsonldResource = JsonldResource.Builder.create() + .build(person); + + System.out.println(objectMapper.writerWithDefaultPrettyPrinter() + .writeValueAsString(jsonldResource)); + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonldExamplePerson.java b/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonldExamplePerson.java new file mode 100644 index 0000000000..a3161ba1d3 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonldExamplePerson.java @@ -0,0 +1,17 @@ +package com.baeldung.jsonld.serialization.jacksonjsonld; + +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldId; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldLink; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldNamespace; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldProperty; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldType; + +@JsonldNamespace(name = "s", uri = "http://schema.org/") +@JsonldLink(rel = "s:knows", name = "knows", href = "http://example.com/person/2345") +@JsonldType("s:Person") +class JacksonJsonldExamplePerson { + @JsonldId + public String id = "http://example.com/person/1234"; + @JsonldProperty("s:name") + public String name = "Example Name"; +} From a951d80b419ef562f688a1afaae492098eb3e66e Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Tue, 23 Jun 2020 21:48:01 +0530 Subject: [PATCH 0030/1862] Removed test cases for getting private methods --- .../AccessPrivateMethodsUnitTest.java | 81 ------------------- 1 file changed, 81 deletions(-) delete mode 100644 core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java deleted file mode 100644 index df745897d2..0000000000 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateMethodsUnitTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.baeldung.reflection.access.privatefields; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public class AccessPrivateMethodsUnitTest { - - @Test - public void whenGetMethod_thenSuccess() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NullPointerException { - Person person = new Person(); - - Method method = person.getClass() - .getDeclaredMethod("greet", String.class); - method.setAccessible(true); - - String greetMessage = (String) method.invoke(person, "Jane"); - - Assertions.assertEquals("Hello Jane", greetMessage); - } - - @Test - public void givenInt_whenInvokeMethod_thenIllegalArgumentException() throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, NullPointerException { - Person person = new Person(); - - Method method = person.getClass() - .getDeclaredMethod("greet", String.class); - method.setAccessible(true); - - Assertions.assertThrows(IllegalArgumentException.class, () -> method.invoke(person, 25)); - } - - @Test - public void givenMultipleParameters_whenInvokeMethod_thenIllegalArgumentException() throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, NullPointerException { - Person person = new Person(); - - Method method = person.getClass() - .getDeclaredMethod("greet", String.class); - method.setAccessible(true); - - Assertions.assertThrows(IllegalArgumentException.class, () -> method.invoke(person, "John", "Jane")); - } - - @Test - public void whenMethodNotSetAccessible_thenIllegalAccessException() throws IllegalArgumentException, IllegalAccessException, NoSuchMethodException, NullPointerException { - Person person = new Person(); - - Method method = person.getClass() - .getDeclaredMethod("greet", String.class); - - Assertions.assertThrows(IllegalAccessException.class, () -> method.invoke(person, "Jane")); - } - - @Test - public void whenCallingMethodThrowsException_thenInvocationTargetException() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NullPointerException { - Person person = new Person(); - Method method = person.getClass() - .getDeclaredMethod("divideByZeroExample"); - method.setAccessible(true); - Assertions.assertThrows(InvocationTargetException.class, () -> method.invoke(person)); - } - - @Test - public void whenAccessingWrongProperty_thenNoSuchMethodException() throws NoSuchMethodException, NullPointerException { - Person person = new Person(); - - Assertions.assertThrows(NoSuchMethodException.class, () -> person.getClass() - .getDeclaredMethod("greeting", String.class)); - } - - @Test - public void whenAccessingNullMethod_thenNullPointerException() throws NoSuchMethodException, NullPointerException { - Person person = new Person(); - - Assertions.assertThrows(NullPointerException.class, () -> person.getClass() - .getDeclaredMethod(null, String.class)); - } - -} From 885278e502f896f232b712038613bb7c8b01ec62 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Tue, 23 Jun 2020 21:49:35 +0530 Subject: [PATCH 0031/1862] Added test cases for accessing all data types. --- .../access/privatefields/Person.java | 76 +++++++++++++-- .../AccessPrivateFieldsUnitTest.java | 95 ++++++++++++++++--- 2 files changed, 153 insertions(+), 18 deletions(-) diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java index 2ec263f6ae..433dc7636d 100755 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java +++ b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java @@ -4,7 +4,21 @@ public class Person { private String name = "John"; - private int age = 30; + private byte age = 30; + + private short uidNumber = 5555; + + private int pinCode = 452002; + + private long contactNumber = 123456789L; + + private float height = 6.1242f; + + private double weight = 75.2564; + + private char gender = 'M'; + + private boolean active = true; public String getName() { return name; @@ -14,20 +28,68 @@ public class Person { this.name = name; } - public int getAge() { + public byte getAge() { return age; } - public void setAge(int age) { + public void setAge(byte age) { this.age = age; } - private String greet(String name) { - return "Hello " + name; + public short getUidNumber() { + return uidNumber; } - private int divideByZeroExample() { - return 1 / 0; + public void setUidNumber(short uidNumber) { + this.uidNumber = uidNumber; + } + + public int getPinCode() { + return pinCode; + } + + public void setPinCode(int pinCode) { + this.pinCode = pinCode; + } + + public long getContactNumber() { + return contactNumber; + } + + public void setContactNumber(long contactNumber) { + this.contactNumber = contactNumber; + } + + public float getHeight() { + return height; + } + + public void setHeight(float height) { + this.height = height; + } + + public double getWeight() { + return weight; + } + + public void setWeight(double weight) { + this.weight = weight; + } + + public char getGender() { + return gender; + } + + public void setGender(char gender) { + this.gender = gender; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; } } diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java index c74af1fe90..69f3eebe71 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java @@ -11,39 +11,112 @@ public class AccessPrivateFieldsUnitTest { public void whenGetFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); - Field fieldName = person.getClass() + Field nameField = person.getClass() .getDeclaredField("name"); - fieldName.setAccessible(true); + nameField.setAccessible(true); - String name = (String) fieldName.get(person); + String name = (String) nameField.get(person); - Field fieldAge = person.getClass() + Field ageField = person.getClass() .getDeclaredField("age"); - fieldAge.setAccessible(true); + ageField.setAccessible(true); - int age = fieldAge.getInt(person); + byte age = ageField.getByte(person); Assertions.assertEquals("John", name); Assertions.assertEquals(30, age); } + @Test + public void whenGetIntegerFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Field uidNumberField = person.getClass() + .getDeclaredField("uidNumber"); + uidNumberField.setAccessible(true); + + short uidNumber = uidNumberField.getShort(person); + + Field pinCodeField = person.getClass() + .getDeclaredField("pinCode"); + pinCodeField.setAccessible(true); + + int pinCode = pinCodeField.getInt(person); + + Field contactNumberField = person.getClass() + .getDeclaredField("contactNumber"); + contactNumberField.setAccessible(true); + + long contactNumber = contactNumberField.getLong(person); + + Assertions.assertEquals(5555, uidNumber); + Assertions.assertEquals(452002, pinCode); + Assertions.assertEquals(123456789L, contactNumber); + } + + @Test + public void whenGetFloatingTypeFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Field heightField = person.getClass() + .getDeclaredField("height"); + heightField.setAccessible(true); + + float height = heightField.getFloat(person); + + Field weightField = person.getClass() + .getDeclaredField("weight"); + weightField.setAccessible(true); + + double weight = weightField.getDouble(person); + + Assertions.assertEquals(6.1242f, height); + Assertions.assertEquals(75.2564, weight); + } + + @Test + public void whenGetCharacterFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Field genderField = person.getClass() + .getDeclaredField("gender"); + genderField.setAccessible(true); + + char gender = genderField.getChar(person); + + Assertions.assertEquals('M', gender); + } + + @Test + public void whenGetBooleanFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Field activeField = person.getClass() + .getDeclaredField("active"); + activeField.setAccessible(true); + + boolean active = activeField.getBoolean(person); + + Assertions.assertTrue(active); + } + @Test public void givenInt_whenGetStringField_thenIllegalArgumentException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); - Field fieldName = person.getClass() + Field nameField = person.getClass() .getDeclaredField("name"); - fieldName.setAccessible(true); + nameField.setAccessible(true); - Assertions.assertThrows(IllegalArgumentException.class, () -> fieldName.getInt(person)); + Assertions.assertThrows(IllegalArgumentException.class, () -> nameField.getInt(person)); } @Test public void whenFieldNotSetAccessible_thenIllegalAccessException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); - Field fieldName = person.getClass() + Field nameField = person.getClass() .getDeclaredField("name"); - Assertions.assertThrows(IllegalAccessException.class, () -> fieldName.get(person)); + Assertions.assertThrows(IllegalAccessException.class, () -> nameField.get(person)); } @Test From 0e528b11d2fd5d832b2d040bdf5c65214c60bdaf Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sat, 27 Jun 2020 16:33:20 +0530 Subject: [PATCH 0032/1862] Segregated test cases for primitive and object types. Added test case for Autoboxing. --- .../AccessPrivateFieldsUnitTest.java | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java index 69f3eebe71..bf9e4ea591 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java @@ -8,50 +8,49 @@ import org.junit.jupiter.api.Test; public class AccessPrivateFieldsUnitTest { @Test - public void whenGetFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenGetIntegerFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); - Field nameField = person.getClass() - .getDeclaredField("name"); - nameField.setAccessible(true); - - String name = (String) nameField.get(person); - Field ageField = person.getClass() .getDeclaredField("age"); ageField.setAccessible(true); byte age = ageField.getByte(person); - - Assertions.assertEquals("John", name); Assertions.assertEquals(30, age); - } - - @Test - public void whenGetIntegerFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { - Person person = new Person(); Field uidNumberField = person.getClass() .getDeclaredField("uidNumber"); uidNumberField.setAccessible(true); short uidNumber = uidNumberField.getShort(person); + Assertions.assertEquals(5555, uidNumber); Field pinCodeField = person.getClass() .getDeclaredField("pinCode"); pinCodeField.setAccessible(true); int pinCode = pinCodeField.getInt(person); + Assertions.assertEquals(452002, pinCode); Field contactNumberField = person.getClass() .getDeclaredField("contactNumber"); contactNumberField.setAccessible(true); long contactNumber = contactNumberField.getLong(person); - - Assertions.assertEquals(5555, uidNumber); - Assertions.assertEquals(452002, pinCode); Assertions.assertEquals(123456789L, contactNumber); + + } + + @Test + public void whenDoAutoboxing_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Field pinCodeField = person.getClass() + .getDeclaredField("pinCode"); + pinCodeField.setAccessible(true); + + Integer pinCode = pinCodeField.getInt(person); + Assertions.assertEquals(452002, pinCode); } @Test @@ -63,14 +62,13 @@ public class AccessPrivateFieldsUnitTest { heightField.setAccessible(true); float height = heightField.getFloat(person); + Assertions.assertEquals(6.1242f, height); Field weightField = person.getClass() .getDeclaredField("weight"); weightField.setAccessible(true); double weight = weightField.getDouble(person); - - Assertions.assertEquals(6.1242f, height); Assertions.assertEquals(75.2564, weight); } @@ -83,7 +81,6 @@ public class AccessPrivateFieldsUnitTest { genderField.setAccessible(true); char gender = genderField.getChar(person); - Assertions.assertEquals('M', gender); } @@ -96,10 +93,21 @@ public class AccessPrivateFieldsUnitTest { activeField.setAccessible(true); boolean active = activeField.getBoolean(person); - Assertions.assertTrue(active); } + @Test + public void whenGetObjectFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Field nameField = person.getClass() + .getDeclaredField("name"); + nameField.setAccessible(true); + + String name = (String) nameField.get(person); + Assertions.assertEquals("John", name); + } + @Test public void givenInt_whenGetStringField_thenIllegalArgumentException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); From 5236d6ceddda702cde8c06e9ffef7975e871756a Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sat, 27 Jun 2020 16:39:16 +0530 Subject: [PATCH 0033/1862] Condensed fields by removing extra space. --- .../baeldung/reflection/access/privatefields/Person.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java index 433dc7636d..4e2f0fc0cc 100755 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java +++ b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java @@ -3,21 +3,13 @@ package com.baeldung.reflection.access.privatefields; public class Person { private String name = "John"; - private byte age = 30; - private short uidNumber = 5555; - private int pinCode = 452002; - private long contactNumber = 123456789L; - private float height = 6.1242f; - private double weight = 75.2564; - private char gender = 'M'; - private boolean active = true; public String getName() { From c5f8489f1d347ea83939cba014dc3f857810a5b1 Mon Sep 17 00:00:00 2001 From: Marco Denisi Date: Sun, 28 Jun 2020 10:15:48 +0200 Subject: [PATCH 0034/1862] BAEL-4083 - add app integration test --- spring-boot-modules/spring-boot-xml/pom.xml | 8 ++++++ ...ringBootXmlApplicationIntegrationTest.java | 26 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplicationIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-xml/pom.xml b/spring-boot-modules/spring-boot-xml/pom.xml index dd575ff414..e1ddd8f437 100644 --- a/spring-boot-modules/spring-boot-xml/pom.xml +++ b/spring-boot-modules/spring-boot-xml/pom.xml @@ -18,6 +18,14 @@ org.springframework.boot spring-boot-starter + + org.springframework.boot + spring-boot-starter-test + + + junit + junit + diff --git a/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplicationIntegrationTest.java b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplicationIntegrationTest.java new file mode 100644 index 0000000000..2c3993d0d8 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/src/main/java/com/baeldung/springbootxml/SpringBootXmlApplicationIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.springbootxml; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootXmlApplication.class) +public class SpringBootXmlApplicationIntegrationTest { + + @Autowired private Pojo pojo; + @Value("${sample}") private String sample; + + @Test + public void whenCallingGetter_thenPrintingProperty() { + assertThat(pojo.getField()) + .isNotBlank() + .isEqualTo(sample); + } + +} \ No newline at end of file From 211d1c98869a976f85caee93e06a83d94f4fdf0c Mon Sep 17 00:00:00 2001 From: akeshri Date: Sun, 28 Jun 2020 22:31:13 +0530 Subject: [PATCH 0035/1862] Create pom.xml --- hexagonal-architecture/pom.xml | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 hexagonal-architecture/pom.xml diff --git a/hexagonal-architecture/pom.xml b/hexagonal-architecture/pom.xml new file mode 100644 index 0000000000..87e599318c --- /dev/null +++ b/hexagonal-architecture/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + + com.article + hexagonal-architecture + 0.0.1-SNAPSHOT + jar + + org.springframework.boot + spring-boot-starter-parent + 1.3.1.RELEASE + + + hexagonal-architecture + http://maven.apache.org + + + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + org.springframework.boot + spring-boot-starter-test + test + + + com.fasterxml.jackson.dataformat + jackson-dataformat-csv + + + From 8b8554eb84e9d02e73affde7b302b0a87ccbf1b5 Mon Sep 17 00:00:00 2001 From: akeshri Date: Sun, 28 Jun 2020 22:32:39 +0530 Subject: [PATCH 0036/1862] Add files via upload --- .../baeldung/hexagonal/architecture/App.java | 18 ++++ .../hexagonal/architecture/ConsoleApp.java | 48 ++++++++++ .../controller/ProductController.java | 52 +++++++++++ .../architecture/dtos/ProductDto.java | 71 +++++++++++++++ .../hexagonal/architecture/model/Product.java | 87 +++++++++++++++++++ .../repository/ProductRepository.java | 14 +++ .../architecture/service/ProductService.java | 21 +++++ .../service/ProductServiceImpl.java | 44 ++++++++++ .../resources/application-batch.properties | 9 ++ .../resources/application-test.properties | 8 ++ .../src/main/resources/application.properties | 8 ++ .../src/main/resources/db/PRODUCT.sql | 9 ++ .../service/ProductServiceTest.java | 43 +++++++++ 13 files changed, 432 insertions(+) create mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java create mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java create mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java create mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java create mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java create mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java create mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java create mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java create mode 100644 hexagonal-architecture/src/main/resources/application-batch.properties create mode 100644 hexagonal-architecture/src/main/resources/application-test.properties create mode 100644 hexagonal-architecture/src/main/resources/application.properties create mode 100644 hexagonal-architecture/src/main/resources/db/PRODUCT.sql create mode 100644 hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java new file mode 100644 index 0000000000..3563e3a0ec --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java @@ -0,0 +1,18 @@ +package com.baeldung.hexagonal.architecture; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author AshwiniKeshri + * + */ + +@SpringBootApplication +public class App +{ + public static void main( String[] args ) + { + SpringApplication.run(App.class, args); + } +} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java new file mode 100644 index 0000000000..70edb8f9ed --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java @@ -0,0 +1,48 @@ +package com.baeldung.hexagonal.architecture; + +import java.io.File; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; + +import com.baeldung.hexagonal.architecture.model.Product; +import com.baeldung.hexagonal.architecture.service.ProductService; +import com.fasterxml.jackson.dataformat.csv.CsvMapper; +import com.fasterxml.jackson.dataformat.csv.CsvSchema; + +/** + * @author AshwiniKeshri + * + */ + +@SpringBootApplication(exclude = {EmbeddedServletContainerAutoConfiguration.class,WebMvcAutoConfiguration.class}) +public class ConsoleApp implements CommandLineRunner { + @Autowired + private ProductService productService; + + public static void main(String[] args) { + SpringApplication.run(ConsoleApp.class, args); + } + + @Override + public void run(String... args) throws Exception { + String filePath = ""; + if (args != null && args.length == 2 && "Product".equalsIgnoreCase(args[0]) + && (filePath = args[1]).length() > 0) { + File sourceFile = new File(filePath); + if (sourceFile.exists()) { + CsvMapper mapper = new CsvMapper(); + List products = mapper.readerFor(Product.class).with(CsvSchema.emptySchema().withHeader()) + .readValues(sourceFile).readAll(); + productService.saveAll(products); + } + + } + + } +} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java new file mode 100644 index 0000000000..6645c379c2 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java @@ -0,0 +1,52 @@ +package com.baeldung.hexagonal.architecture.controller; + +import java.util.List; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.hexagonal.architecture.dtos.ProductDto; +import com.baeldung.hexagonal.architecture.model.Product; +import com.baeldung.hexagonal.architecture.service.ProductService; + +/** + * @author AshwiniKeshri + * + */ + +@RestController +@RequestMapping("api/v1/product") +public class ProductController { + + @Autowired + private ProductService productService; + + @RequestMapping(value = "/all", method = RequestMethod.GET) + public List list() { + return productService.findAll().stream().map(p -> new ProductDto(p)).collect(Collectors.toList()); + } + + @RequestMapping(value = "/{productId}", method = RequestMethod.GET) + public ProductDto get(@PathVariable long productId) { + Product p = productService.findById(productId); + return p != null ? new ProductDto(p) : null; + } + + @RequestMapping(value = "/add", method = RequestMethod.POST) + public ProductDto create(@RequestBody ProductDto product) { + Product p = new Product(); + p.setDescription(product.getDescription()); + p.setName(product.getName()); + p.setPrice(product.getPrice()); + p.setQuantity(product.getQuantity()); + Long id = productService.create(p); + product.setId(id); + return product; + } + +} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java new file mode 100644 index 0000000000..336631fb10 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java @@ -0,0 +1,71 @@ +package com.baeldung.hexagonal.architecture.dtos; + +import com.baeldung.hexagonal.architecture.model.Product; +/** + * @author AshwiniKeshri + * + */ +public class ProductDto { + + private Long id; + + private String name; + + private Long quantity; + + private Double price; + + private String description; + + public ProductDto() {} + + public ProductDto(Product product) { + this.description = product.getDescription(); + this.id = product.getId(); + this.name = product.getName(); + this.price = product.getPrice(); + this.quantity = product.getQuantity(); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Long getQuantity() { + return quantity; + } + + public void setQuantity(Long quantity) { + this.quantity = quantity; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + +} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java new file mode 100644 index 0000000000..dec4548283 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java @@ -0,0 +1,87 @@ +/** + * + */ +package com.baeldung.hexagonal.architecture.model; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * @author AshwiniKeshri + * + */ + +@Entity +@Table(name = "PRODUCT") +public class Product implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 4000353732860709995L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @Column(name="NAME") + private String name; + + @Column(name = "QUANTITY") + private Long quantity; + + @Column(name = "PRICE") + private Double price; + + @Column(name = "DESCRIPTION") + private String description; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Long getQuantity() { + return quantity; + } + + public void setQuantity(Long quantity) { + this.quantity = quantity > 0 ? quantity : 0; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price == null ? 0.0 : price; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + +} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java new file mode 100644 index 0000000000..76c888ab59 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java @@ -0,0 +1,14 @@ +package com.baeldung.hexagonal.architecture.repository; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.baeldung.hexagonal.architecture.model.Product; + +/** + * @author AshwiniKeshri + * + */ + +public interface ProductRepository extends JpaRepository{ + +} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java new file mode 100644 index 0000000000..b1d05a7db4 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java @@ -0,0 +1,21 @@ +package com.baeldung.hexagonal.architecture.service; + +import java.util.List; + +import com.baeldung.hexagonal.architecture.model.Product; + +/** + * @author AshwiniKeshri + * + */ + +public interface ProductService { + + List findAll(); + + Product findById(long id); + + Long create(Product product); + + void saveAll(List products); +} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java new file mode 100644 index 0000000000..1005b5753d --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java @@ -0,0 +1,44 @@ +package com.baeldung.hexagonal.architecture.service; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baeldung.hexagonal.architecture.model.Product; +import com.baeldung.hexagonal.architecture.repository.ProductRepository; + +/** + * @author AshwiniKeshri + * + */ + +@Service +public class ProductServiceImpl implements ProductService { + + private Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class); + + @Autowired + private ProductRepository productRepository; + + public List findAll() { + return productRepository.findAll(); + } + + public Product findById(long id) { + return productRepository.findOne(id); + } + + public Long create(Product product) { + product = productRepository.saveAndFlush(product); + return product.getId(); + } + + @Override + public void saveAll(List products) { + productRepository.save(products); + } + +} diff --git a/hexagonal-architecture/src/main/resources/application-batch.properties b/hexagonal-architecture/src/main/resources/application-batch.properties new file mode 100644 index 0000000000..8c83d19f74 --- /dev/null +++ b/hexagonal-architecture/src/main/resources/application-batch.properties @@ -0,0 +1,9 @@ +spring.main.web-environment=false +spring.jpa.hibernate.ddl-auto=false; +spring.h2.console.enabled=true +spring.h2.console.path=/h2 + +spring.datasource.url=jdbc:h2:file:~/hexagonal +spring.datasource.username=sa +spring.datasource.password= +spring.datasource.driver-class-name=org.h2.Driver \ No newline at end of file diff --git a/hexagonal-architecture/src/main/resources/application-test.properties b/hexagonal-architecture/src/main/resources/application-test.properties new file mode 100644 index 0000000000..701313a878 --- /dev/null +++ b/hexagonal-architecture/src/main/resources/application-test.properties @@ -0,0 +1,8 @@ +spring.jpa.hibernate.ddl-auto=false; +spring.h2.console.enabled=true +spring.h2.console.path=/h2 + +spring.datasource.url=jdbc:h2:file:~/hexagonal_test +spring.datasource.username=sa +spring.datasource.password= +spring.datasource.driver-class-name=org.h2.Driver \ No newline at end of file diff --git a/hexagonal-architecture/src/main/resources/application.properties b/hexagonal-architecture/src/main/resources/application.properties new file mode 100644 index 0000000000..14c80a1af4 --- /dev/null +++ b/hexagonal-architecture/src/main/resources/application.properties @@ -0,0 +1,8 @@ +spring.jpa.hibernate.ddl-auto=false; +spring.h2.console.enabled=true +spring.h2.console.path=/h2 + +spring.datasource.url=jdbc:h2:file:~/hexagonal +spring.datasource.username=sa +spring.datasource.password= +spring.datasource.driver-class-name=org.h2.Driver \ No newline at end of file diff --git a/hexagonal-architecture/src/main/resources/db/PRODUCT.sql b/hexagonal-architecture/src/main/resources/db/PRODUCT.sql new file mode 100644 index 0000000000..a0fef3a710 --- /dev/null +++ b/hexagonal-architecture/src/main/resources/db/PRODUCT.sql @@ -0,0 +1,9 @@ +CREATE TABLE PRODUCT( + ID INT AUTO_INCREMENT, + NAME VARCHAR(255), + QUANTITY INTEGER, + PRICE DOUBLE, + DESCRIPTION VARCHAR(1000), +); + +INSERT INTO PRODUCT(NAME,QUANTITY,PRICE,DESCRIPTION) VALUES ('iPhone 11 Pro',10,300,'First triple camera system'); \ No newline at end of file diff --git a/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java b/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java new file mode 100644 index 0000000000..021fdf1289 --- /dev/null +++ b/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java @@ -0,0 +1,43 @@ +/** + * + */ +package com.baeldung.hexagonal.architecture.service; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.PropertySources; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.hexagonal.architecture.App; +import com.baeldung.hexagonal.architecture.model.Product; +import com.baeldung.hexagonal.architecture.service.ProductService; + +/** + * @author AshwiniKeshri + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(App.class) +@ActiveProfiles(value = "test") +public class ProductServiceTest { + + @Autowired + private ProductService productService; + + @Test + public void testCreateProduct() { + Product product = new Product(); + product.setDescription("test product"); + product.setName("Product1"); + product.setPrice(10.0); + product.setQuantity(100l); + Long id = productService.create(product); + Assert.assertTrue(id >0); + } + +} From 6a1e528bfd049506a31125476268f47ea74f67be Mon Sep 17 00:00:00 2001 From: akeshri Date: Sun, 28 Jun 2020 22:51:35 +0530 Subject: [PATCH 0037/1862] Create README.md Read me changes --- hexagonal-architecture/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 hexagonal-architecture/README.md diff --git a/hexagonal-architecture/README.md b/hexagonal-architecture/README.md new file mode 100644 index 0000000000..4dd10368e0 --- /dev/null +++ b/hexagonal-architecture/README.md @@ -0,0 +1,17 @@ +# Hexagonal Architecture +A quick and practical example of Hexagonal Architecture using Spring boot. + +This application is using h2 database,which can be accessible http:/localhost:8080/h2 + +Main Application schema : hexagonal + +Test Application Schema : hexagonal_test + +1. Rest Api : execute [App](https://github.com/akeshri/tutorials/blob/master/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java) + - Get All products : http://localhost:8080/api/v1/product/all + - Get product by id : http://localhost:8080/api/v1/product/{productId} + - Add a product : http://localhost:8080/api/v1/product/add + For more detail refer [ProductController](https://github.com/akeshri/tutorials/blob/master/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java) + +2. Batch processing : We need to configure active profile as batch i.e. -Dspring.profiles.active=batch and execute [ConsoleApp](https://github.com/akeshri/tutorials/blob/master/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java) +3. Test case : [ProductServiceTest](https://github.com/akeshri/tutorials/blob/master/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java) From 67e9dc8187222f9746889f090cef492425ab1fce Mon Sep 17 00:00:00 2001 From: STS Date: Sun, 28 Jun 2020 20:33:10 +0200 Subject: [PATCH 0038/1862] add excel formula --- excelformula/.gitignore | 34 +++++++++++ excelformula/pom.xml | 57 +++++++++++++++++++ .../poi/excelformula/ExcelFormula.java | 36 ++++++++++++ .../excelformula/ExcelformulaApplication.java | 13 +++++ .../src/main/resources/application.properties | 1 + .../ExcelformulaApplicationTests.java | 38 +++++++++++++ 6 files changed, 179 insertions(+) create mode 100644 excelformula/.gitignore create mode 100644 excelformula/pom.xml create mode 100644 excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java create mode 100644 excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java create mode 100644 excelformula/src/main/resources/application.properties create mode 100644 excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java diff --git a/excelformula/.gitignore b/excelformula/.gitignore new file mode 100644 index 0000000000..719e322c1d --- /dev/null +++ b/excelformula/.gitignore @@ -0,0 +1,34 @@ +HELP.md +mvnw +mvnw.cmd +.mvn +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ diff --git a/excelformula/pom.xml b/excelformula/pom.xml new file mode 100644 index 0000000000..4ea65b5e57 --- /dev/null +++ b/excelformula/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + com.bealdung.poi + excelformula + 0.0.1-SNAPSHOT + excelformula + Demo project for Spring Boot + + 11 + 4.1.2 + 4.13 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.apache.poi + poi-ooxml + ${poi-ooxml.version} + + + junit + junit + ${junit.version} + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java b/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java new file mode 100644 index 0000000000..1e2fa5acfe --- /dev/null +++ b/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java @@ -0,0 +1,36 @@ +package com.bealdung.poi.excelformula; + +import org.apache.poi.ss.usermodel.CellValue; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.List; + +@Component +public class ExcelFormula { + XSSFWorkbook excel; + public XSSFSheet inserData(List dataList) { + excel = new XSSFWorkbook(); + XSSFSheet sheet = excel.createSheet(); + int rowNum =0 ; + for (Integer data : dataList){ + sheet.createRow(rowNum++).createCell(0).setCellValue(data); + } + return sheet; + } + public double setFormula(String formula) throws IOException { + XSSFSheet sheet = excel.getSheetAt(0); + int lastCellNum = sheet.getRow(0).getLastCellNum(); + XSSFCell formulaCell = sheet.getRow(0).createCell(lastCellNum + 1); + formulaCell.setCellFormula(formula); + XSSFFormulaEvaluator formulaEvaluator = excel.getCreationHelper().createFormulaEvaluator(); + CellValue evaluate = formulaEvaluator.evaluate(formulaCell); + if(excel != null) + excel.close(); + return evaluate.getNumberValue(); + } +} diff --git a/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java b/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java new file mode 100644 index 0000000000..b857bd4266 --- /dev/null +++ b/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java @@ -0,0 +1,13 @@ +package com.bealdung.poi.excelformula; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ExcelformulaApplication { + + public static void main(String[] args) { + SpringApplication.run(ExcelformulaApplication.class, args); + } + +} diff --git a/excelformula/src/main/resources/application.properties b/excelformula/src/main/resources/application.properties new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/excelformula/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java b/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java new file mode 100644 index 0000000000..c2385911d0 --- /dev/null +++ b/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java @@ -0,0 +1,38 @@ +package com.bealdung.poi.excelformula; + +import org.apache.poi.ss.util.CellReference; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.junit.Assert; +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +@RunWith(SpringRunner.class) +@SpringBootTest +class ExcelformulaApplicationTests { + @Autowired + private ExcelFormula excelFormula; + + @Test + void givenExcelData_whenSetAndEvaluateFormula() throws IOException { + List data = Arrays.asList(2, 5, 10, 15, 7, 9); + XSSFSheet sheet = excelFormula.inserData(data); + int result = 0; + for (int row = 0; row <= sheet.getLastRowNum(); row++) { + result += sheet.getRow(row).getCell(0).getNumericCellValue(); + } + String colName = CellReference.convertNumToColString(0); + String startCell = colName + 1; + String stopCell = colName + (sheet.getLastRowNum() + 1); + String sumFormula = String.format("SUM(%s:%s)", startCell, stopCell); + int resultValue = (int) excelFormula.setFormula(sumFormula); + Assert.assertEquals("The results are the same!", resultValue , result); + } + +} From ecde6b58a83eb964a66e3cf5e9ebef7428018e05 Mon Sep 17 00:00:00 2001 From: STS Date: Sun, 28 Jun 2020 21:12:09 +0200 Subject: [PATCH 0039/1862] create README.md file --- excelformula/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 excelformula/README.md diff --git a/excelformula/README.md b/excelformula/README.md new file mode 100644 index 0000000000..86ddaba413 --- /dev/null +++ b/excelformula/README.md @@ -0,0 +1,8 @@ +## Apache POI + +This module contains articles about Apache POI + +### Relevant Articles: +- [Working with Microsoft Excel in Java](https://www.baeldung.com/java-microsoft-excel) +- [Read Excel Cell Value Rather Than Formula With Apache POI](https://www.baeldung.com/apache-poi-read-cell-value-formula) +- [Upload and Display Excel Files with Spring MVC](https://www.baeldung.com/spring-mvc-excel-files) From 875ecfc12b68418841a0edb1ab150f994374dc3b Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Mon, 29 Jun 2020 10:23:20 +0300 Subject: [PATCH 0040/1862] BAEL-4175 - comparing version strings in java --- .../core-java-string-operations-2/pom.xml | 26 ++++ .../versioncomparison/VersionCompare.java | 25 ++++ .../VersionComparisonUnitTest.java | 135 ++++++++++++++++++ 3 files changed, 186 insertions(+) create mode 100644 core-java-modules/core-java-string-operations-2/src/main/java/com/baeldung/versioncomparison/VersionCompare.java create mode 100644 core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java diff --git a/core-java-modules/core-java-string-operations-2/pom.xml b/core-java-modules/core-java-string-operations-2/pom.xml index db32bf97a1..cbf5564206 100644 --- a/core-java-modules/core-java-string-operations-2/pom.xml +++ b/core-java-modules/core-java-string-operations-2/pom.xml @@ -75,6 +75,26 @@ ${assertj.version} test + + org.apache.maven + maven-artifact + 3.6.3 + + + org.gradle + gradle-core + 6.1.1 + + + com.fasterxml.jackson.core + jackson-core + 2.11.1 + + + com.vdurmont + semver4j + 3.1.0 + @@ -120,4 +140,10 @@ 1.14 + + + gradle-repo + https://repo.gradle.org/gradle/libs-releases-local/ + + diff --git a/core-java-modules/core-java-string-operations-2/src/main/java/com/baeldung/versioncomparison/VersionCompare.java b/core-java-modules/core-java-string-operations-2/src/main/java/com/baeldung/versioncomparison/VersionCompare.java new file mode 100644 index 0000000000..5a1663e50d --- /dev/null +++ b/core-java-modules/core-java-string-operations-2/src/main/java/com/baeldung/versioncomparison/VersionCompare.java @@ -0,0 +1,25 @@ +package com.baeldung.versioncomparison; + +public class VersionCompare { + + public static int compareVersions(String version1, String version2) { + int comparisonResult = 0; + + String[] version1Splits = version1.split("\\."); + String[] version2Splits = version2.split("\\."); + + int maxLengthOfVersionSplits = Math.max(version1Splits.length, version2Splits.length); + for (int i = 0; i < maxLengthOfVersionSplits; i++){ + Integer v1 = i < version1Splits.length ? Integer.parseInt(version1Splits[i]) : 0; + Integer v2 = i < version2Splits.length ? Integer.parseInt(version2Splits[i]) : 0; + int compare = v1.compareTo(v2); + if (compare != 0) { + comparisonResult = compare; + break; + } + } + + return comparisonResult; + } + +} diff --git a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java new file mode 100644 index 0000000000..7221cdf6ec --- /dev/null +++ b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java @@ -0,0 +1,135 @@ +package com.baeldung.versioncomparison; + +import org.junit.Test; + +import com.fasterxml.jackson.core.Version; +import com.vdurmont.semver4j.Semver; +import com.vdurmont.semver4j.Semver.VersionDiff; + +import org.apache.maven.artifact.versioning.ComparableVersion; +import org.gradle.util.VersionNumber; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class VersionComparisonUnitTest { + + @Test + public void givenVersionStrings_whenUsingMavenArtifact_thenCompareVersions() { + ComparableVersion version1_1 = new ComparableVersion("1.1"); + ComparableVersion version1_2 = new ComparableVersion("1.2"); + ComparableVersion version1_3 = new ComparableVersion("1.3"); + + assertTrue(version1_1.compareTo(version1_2) < 0); + assertTrue(version1_3.compareTo(version1_2) > 0); + + ComparableVersion version1_1_0 = new ComparableVersion("1.1.0"); + assertEquals(version1_1.compareTo(version1_1_0), 0); + + ComparableVersion version1_1_alpha = new ComparableVersion("1.1-alpha"); + assertTrue(version1_1.compareTo(version1_1_alpha) > 0); + + ComparableVersion version1_1_beta = new ComparableVersion("1.1-beta"); + ComparableVersion version1_1_milestone = new ComparableVersion("1.1-milestone"); + ComparableVersion version1_1_rc = new ComparableVersion("1.1-rc"); + ComparableVersion version1_1_snapshot = new ComparableVersion("1.1-snapshot"); + + assertTrue(version1_1_alpha.compareTo(version1_1_beta) < 0); + assertTrue(version1_1_beta.compareTo(version1_1_milestone) < 0); + assertTrue(version1_1_rc.compareTo(version1_1_snapshot) < 0); + assertTrue(version1_1_snapshot.compareTo(version1_1) < 0); + + ComparableVersion version1_1_c = new ComparableVersion("1.1-c"); + ComparableVersion version1_1_z = new ComparableVersion("1.1-z"); + ComparableVersion version1_1_1 = new ComparableVersion("1.1.1"); + + assertTrue(version1_1_c.compareTo(version1_1_z) < 0); + assertTrue(version1_1_z.compareTo(version1_1_1) < 0); + } + + @Test + public void givenVersionStrings_whenUsingGradle_thenCompareVersions() { + VersionNumber version1_1 = VersionNumber.parse("1.1"); + VersionNumber version1_2 = VersionNumber.parse("1.2"); + VersionNumber version1_3 = VersionNumber.parse("1.3"); + + assertTrue(version1_1.compareTo(version1_2) < 0); + assertTrue(version1_3.compareTo(version1_2) > 0); + + VersionNumber version1_1_0 = VersionNumber.parse("1.1.0"); + assertEquals(version1_1.compareTo(version1_1_0), 0); + + VersionNumber version1_1_1_1_alpha = VersionNumber.parse("1.1.1.1-alpha"); + assertTrue(version1_1.compareTo(version1_1_1_1_alpha) < 0); + + VersionNumber version1_1_beta = VersionNumber.parse("1.1.0.0-beta"); + assertTrue(version1_1_beta.compareTo(version1_1_1_1_alpha) < 0); + + VersionNumber version1_1_1_snapshot = VersionNumber.parse("1.1.1-snapshot"); + assertTrue(version1_1_1_1_alpha.compareTo(version1_1_1_snapshot) < 0); + } + + @Test + public void givenVersionStrings_whenUsingJackson_thenCompareVersions() { + Version version1_1 = new Version(1, 1, 0, null, null, null); + Version version1_2 = new Version(1, 2, 0, null, null, null); + Version version1_3 = new Version(1, 3, 0, null, null, null); + + assertTrue(version1_1.compareTo(version1_2) < 0); + assertTrue(version1_3.compareTo(version1_2) > 0); + + Version version1_1_1 = new Version(1, 1, 1, null, null, null); + assertTrue(version1_1.compareTo(version1_1_1) < 0); + + Version version1_1_maven = new Version(1, 1, 0, null, "org.apache.maven", null); + Version version1_1_gradle = new Version(1, 1, 0, null, "org.gradle", null); + assertTrue(version1_1_maven.compareTo(version1_1_gradle) < 0); + + Version version1_1_snapshot = new Version(1, 1, 0, "snapshot", null, null); + assertEquals(version1_1.compareTo(version1_1_snapshot), 0); + + assertEquals(version1_1_snapshot.isSnapshot(), true); + } + + @Test + public void givenVersionStrings_whenUsingSemver_thenCompareVersions() { + Semver version1_1 = new Semver("1.1.0"); + Semver version1_2 = new Semver("1.2.0"); + Semver version1_3 = new Semver("1.3.0"); + + assertTrue(version1_1.compareTo(version1_2) < 0); + assertTrue(version1_3.compareTo(version1_2) > 0); + + Semver version1_1_alpha = new Semver("1.1.0-alpha"); + assertTrue(version1_1.isGreaterThan(version1_1_alpha)); + + Semver version1_1_beta = new Semver("1.1.0-beta"); + Semver version1_1_milestone = new Semver("1.1.0-milestone"); + Semver version1_1_rc = new Semver("1.1.0-rc"); + Semver version1_1_snapshot = new Semver("1.1.0-snapshot"); + + assertTrue(version1_1_alpha.isLowerThan(version1_1_beta)); + assertTrue(version1_1_beta.compareTo(version1_1_milestone) < 0); + assertTrue(version1_1_rc.compareTo(version1_1_snapshot) < 0); + assertTrue(version1_1_snapshot.compareTo(version1_1) < 0); + + assertTrue(version1_1.isEqualTo("1.1.0")); + + assertEquals(version1_1.diff("2.1.0"), VersionDiff.MAJOR); + assertEquals(version1_1.diff("1.2.3"), VersionDiff.MINOR); + assertEquals(version1_1.diff("1.1.1"), VersionDiff.PATCH); + + assertTrue(version1_1.isStable()); + assertEquals(version1_1_alpha.isStable(), false); + } + + @Test + public void givenVersionStrings_whenUsingCustomVersionCompare_thenCompareVersions() { + assertTrue(VersionCompare.compareVersions("1.0.1", "1.1.2") < 0); + assertTrue(VersionCompare.compareVersions("1.0.1", "1.10") < 0); + assertTrue(VersionCompare.compareVersions("1.1.2", "1.0.1") > 0); + assertTrue(VersionCompare.compareVersions("1.1.2", "1.2") < 0); + assertEquals(VersionCompare.compareVersions("1.3.0", "1.3"), 0); + } + +} From 2d37d4ce87d6c279d6a5ec0f662efa04df82161f Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Mon, 29 Jun 2020 12:05:57 +0200 Subject: [PATCH 0041/1862] BAEL-4198 - Fix Selenium Live Tests --- testing-modules/selenium-junit-testng/pom.xml | 37 +++++-------- .../baeldung/selenium/SeleniumExample.java | 53 +++++++++++-------- .../selenium/config/SeleniumConfig.java | 22 ++++---- .../selenium/models/BaeldungAbout.java | 6 +-- .../selenium/pages/BaeldungAboutPage.java | 2 +- .../selenium/pages/BaeldungHomePage.java | 6 +-- .../selenium/pages/StartHerePage.java | 4 +- ...a => SeleniumJavaScriptClickLiveTest.java} | 22 ++++---- .../SeleniumCookiesJUnitLiveTest.java | 32 ++++++++--- .../junit/SeleniumWithJUnitLiveTest.java | 25 +++++---- .../SeleniumPageObjectLiveTest.java | 10 ++-- .../testng/SeleniumWithTestNGLiveTest.java | 13 +++-- 12 files changed, 129 insertions(+), 103 deletions(-) rename testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/{SeleniumJavaScriptClickTest.java => SeleniumJavaScriptClickLiveTest.java} (74%) rename testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/{junit => cookies}/SeleniumCookiesJUnitLiveTest.java (80%) rename testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/{junit => pages}/SeleniumPageObjectLiveTest.java (79%) diff --git a/testing-modules/selenium-junit-testng/pom.xml b/testing-modules/selenium-junit-testng/pom.xml index 3734bf72c9..44af047bdd 100644 --- a/testing-modules/selenium-junit-testng/pom.xml +++ b/testing-modules/selenium-junit-testng/pom.xml @@ -1,6 +1,7 @@ - + 4.0.0 selenium-junit-testng 0.0.1-SNAPSHOT @@ -43,32 +44,22 @@ - src + + + src/main/resources + true + + + src/test/resources + true + + - - - live - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - **/*LiveTest.java - - - - - - - - 6.10 3.4.0 + 1.5.4 diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java index c5ad5182ff..b32e51d250 100644 --- a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java @@ -1,14 +1,12 @@ -package main.java.com.baeldung.selenium; - -import main.java.com.baeldung.selenium.config.SeleniumConfig; -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.firefox.FirefoxDriver; -import org.openqa.selenium.interactions.Actions; +package com.baeldung.selenium; import java.util.List; -import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +import com.baeldung.selenium.config.SeleniumConfig; public class SeleniumExample { @@ -17,15 +15,18 @@ public class SeleniumExample { public SeleniumExample() { config = new SeleniumConfig(); - config.getDriver().get(url); + config.getDriver() + .get(url); } public void closeWindow() { - this.config.getDriver().close(); + this.config.getDriver() + .close(); } public String getTitle() { - return this.config.getDriver().getTitle(); + return this.config.getDriver() + .getTitle(); } public void getAboutBaeldungPage() { @@ -35,29 +36,35 @@ public class SeleniumExample { } private void closeOverlay() { - List webElementList = this.config.getDriver().findElements(By.tagName("a")); + List webElementList = this.config.getDriver() + .findElements(By.tagName("a")); if (webElementList != null) { webElementList.stream() - .filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title"))) - .filter(WebElement::isDisplayed) - .findAny() - .ifPresent(WebElement::click); + .filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title"))) + .filter(WebElement::isDisplayed) + .findAny() + .ifPresent(WebElement::click); } } private void clickAboutLink() { - this.config.getDriver().findElement(By.partialLinkText("About")).click(); + Actions actions = new Actions(config.getDriver()); + WebElement aboutElement = this.config.getDriver() + .findElement(By.id("menu-item-6138")); + + actions.moveToElement(aboutElement).perform(); } private void clickAboutUsLink() { - Actions builder = new Actions(config.getDriver()); - WebElement element = this.config.getDriver().findElement(By.partialLinkText("About Baeldung.")); - builder.moveToElement(element).build().perform(); + WebElement element = this.config.getDriver() + .findElement(By.partialLinkText("About Baeldung.")); + element.click(); } public boolean isAuthorInformationAvailable() { return this.config.getDriver() - .findElement(By.cssSelector("article > .row > div")) - .isDisplayed(); + .getPageSource() + .contains("Hey ! I'm Eugen"); } + } diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/config/SeleniumConfig.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/config/SeleniumConfig.java index c84283b76b..b1b7754648 100644 --- a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/config/SeleniumConfig.java +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/config/SeleniumConfig.java @@ -1,17 +1,14 @@ -package main.java.com.baeldung.selenium.config; +package com.baeldung.selenium.config; + +import java.io.File; +import java.util.concurrent.TimeUnit; import org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.DesiredCapabilities; -import java.io.File; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - public class SeleniumConfig { private WebDriver driver; @@ -19,15 +16,17 @@ public class SeleniumConfig { public SeleniumConfig() { Capabilities capabilities = DesiredCapabilities.firefox(); driver = new FirefoxDriver(capabilities); - driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); + driver.manage() + .timeouts() + .implicitlyWait(5, TimeUnit.SECONDS); } static { System.setProperty("webdriver.gecko.driver", findFile("geckodriver.mac")); } - static private String findFile(String filename) { - String paths[] = {"", "bin/", "target/classes"}; // if you have chromedriver somewhere else on the path, then put it here. + private static String findFile(String filename) { + String[] paths = { "", "bin/", "target/classes" }; // if you have chromedriver somewhere else on the path, then put it here. for (String path : paths) { if (new File(path + filename).exists()) return path + filename; @@ -40,7 +39,8 @@ public class SeleniumConfig { } public void navigateTo(String url) { - driver.navigate().to(url); + driver.navigate() + .to(url); } public void clickElement(WebElement element) { diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/models/BaeldungAbout.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/models/BaeldungAbout.java index 838beb5326..580cbd1f2b 100644 --- a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/models/BaeldungAbout.java +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/models/BaeldungAbout.java @@ -1,7 +1,7 @@ -package main.java.com.baeldung.selenium.models; +package com.baeldung.selenium.models; -import main.java.com.baeldung.selenium.config.SeleniumConfig; -import main.java.com.baeldung.selenium.pages.BaeldungAboutPage; +import com.baeldung.selenium.config.SeleniumConfig; +import com.baeldung.selenium.pages.BaeldungAboutPage; import org.openqa.selenium.support.PageFactory; public class BaeldungAbout { diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/BaeldungAboutPage.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/BaeldungAboutPage.java index d33cb76398..064462fc10 100644 --- a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/BaeldungAboutPage.java +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/BaeldungAboutPage.java @@ -1,4 +1,4 @@ -package main.java.com.baeldung.selenium.pages; +package com.baeldung.selenium.pages; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/BaeldungHomePage.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/BaeldungHomePage.java index 55a8044375..d901bf3c34 100644 --- a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/BaeldungHomePage.java +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/BaeldungHomePage.java @@ -1,6 +1,6 @@ -package main.java.com.baeldung.selenium.pages; +package com.baeldung.selenium.pages; -import main.java.com.baeldung.selenium.config.SeleniumConfig; +import com.baeldung.selenium.config.SeleniumConfig; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; @@ -8,7 +8,7 @@ import org.openqa.selenium.support.PageFactory; public class BaeldungHomePage { private SeleniumConfig config; - @FindBy(css=".header--menu > a") + @FindBy(css = ".nav--logo_mobile") private WebElement title; @FindBy(css = ".menu-start-here > a") private WebElement startHere; diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/StartHerePage.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/StartHerePage.java index 4f0ee9edcd..ccc166c351 100644 --- a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/StartHerePage.java +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/pages/StartHerePage.java @@ -1,6 +1,6 @@ -package main.java.com.baeldung.selenium.pages; +package com.baeldung.selenium.pages; -import main.java.com.baeldung.selenium.config.SeleniumConfig; +import com.baeldung.selenium.config.SeleniumConfig; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickLiveTest.java similarity index 74% rename from testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickTest.java rename to testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickLiveTest.java index 6d2ab8ef1f..de519a44fc 100644 --- a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickTest.java +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/clickusingjavascript/SeleniumJavaScriptClickLiveTest.java @@ -1,4 +1,4 @@ -package java.com.baeldung.selenium.clickusingjavascript; +package com.baeldung.selenium.clickusingjavascript; import org.junit.After; import org.junit.Before; @@ -14,16 +14,18 @@ import org.openqa.selenium.support.ui.WebDriverWait; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -public class SeleniumJavaScriptClickTest { +import java.io.File; + +public class SeleniumJavaScriptClickLiveTest { private WebDriver driver; private WebDriverWait wait; @Before public void setUp() { - System.setProperty("webdriver.chrome.driver", "chromedriver.exe"); + System.setProperty("webdriver.chrome.driver", new File("src/main/resources/chromedriver.mac").getAbsolutePath()); driver = new ChromeDriver(); - wait = new WebDriverWait(driver, 5000); + wait = new WebDriverWait(driver, 20); } @After @@ -37,19 +39,21 @@ public class SeleniumJavaScriptClickTest { String title = driver.getTitle(); assertEquals("Baeldung | Java, Spring and Web Development tutorials", title); - wait.until(ExpectedConditions.elementToBeClickable(By.className("menu-search"))); - WebElement searchButton = driver.findElement(By.className("menu-search")); + wait.until(ExpectedConditions.elementToBeClickable(By.className("nav--menu_item_anchor"))); + WebElement searchButton = driver.findElement(By.className("nav--menu_item_anchor")); clickElement(searchButton); wait.until(ExpectedConditions.elementToBeClickable(By.id("search"))); WebElement searchInput = driver.findElement(By.id("search")); searchInput.sendKeys("Selenium"); - wait.until(ExpectedConditions.elementToBeClickable(By.className("btn-search"))); - WebElement seeSearchResultsButton = driver.findElement(By.className("btn-search")); + wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(".btn-search"))); + WebElement seeSearchResultsButton = driver.findElement(By.cssSelector(".btn-search")); clickElement(seeSearchResultsButton); - int seleniumPostsCount = driver.findElements(By.className("post")).size(); + wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.className("post"))); + int seleniumPostsCount = driver.findElements(By.className("post")) + .size(); assertTrue(seleniumPostsCount > 0); } diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumCookiesJUnitLiveTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/cookies/SeleniumCookiesJUnitLiveTest.java similarity index 80% rename from testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumCookiesJUnitLiveTest.java rename to testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/cookies/SeleniumCookiesJUnitLiveTest.java index 0cbbf52454..337e3b85fb 100644 --- a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumCookiesJUnitLiveTest.java +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/cookies/SeleniumCookiesJUnitLiveTest.java @@ -1,4 +1,16 @@ -package test.java.com.baeldung.selenium.junit; +package com.baeldung.selenium.cookies; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; + +import java.io.File; +import java.util.Set; +import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Before; @@ -9,12 +21,6 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.DesiredCapabilities; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; - public class SeleniumCookiesJUnitLiveTest { private WebDriver driver; @@ -22,11 +28,21 @@ public class SeleniumCookiesJUnitLiveTest { @Before public void setUp() { + System.setProperty("webdriver.gecko.driver", findFile("geckodriver.mac")); + Capabilities capabilities = DesiredCapabilities.firefox(); driver = new FirefoxDriver(capabilities); navUrl = "https://baeldung.com"; driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); - System.setProperty("webdriver.gecko.driver", "geckodriver.exe"); + } + + private static String findFile(String filename) { + String[] paths = { "", "bin/", "target/classes" }; // if you have chromedriver somewhere else on the path, then put it here. + for (String path : paths) { + if (new File(path + filename).exists()) + return path + filename; + } + return ""; } @After diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumWithJUnitLiveTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumWithJUnitLiveTest.java index b1a4149358..1b1035cc6c 100644 --- a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumWithJUnitLiveTest.java +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumWithJUnitLiveTest.java @@ -1,16 +1,21 @@ -package test.java.com.baeldung.selenium.junit; +package com.baeldung.selenium.junit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; -import main.java.com.baeldung.selenium.SeleniumExample; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import static org.testng.Assert.*; +import com.baeldung.selenium.SeleniumExample; public class SeleniumWithJUnitLiveTest { private static SeleniumExample seleniumExample; - private String expectedTitle = "Baeldung | Java, Spring and Web Development tutorials"; + private String expectedTitle = "About Baeldung | Baeldung"; @BeforeClass public static void setUp() { @@ -18,17 +23,17 @@ public class SeleniumWithJUnitLiveTest { } @AfterClass - public static void tearDown() { + public static void tearDown() throws IOException { seleniumExample.closeWindow(); } @Test public void whenAboutBaeldungIsLoaded_thenAboutEugenIsMentionedOnPage() { - seleniumExample.getAboutBaeldungPage(); - String actualTitle = seleniumExample.getTitle(); - assertNotNull(actualTitle); - assertEquals(expectedTitle, actualTitle); - assertTrue(seleniumExample.isAuthorInformationAvailable()); + seleniumExample.getAboutBaeldungPage(); + String actualTitle = seleniumExample.getTitle(); + assertNotNull(actualTitle); + assertEquals(expectedTitle, actualTitle); + assertTrue(seleniumExample.isAuthorInformationAvailable()); } } diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumPageObjectLiveTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/pages/SeleniumPageObjectLiveTest.java similarity index 79% rename from testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumPageObjectLiveTest.java rename to testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/pages/SeleniumPageObjectLiveTest.java index 8493122414..96772821a9 100644 --- a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/junit/SeleniumPageObjectLiveTest.java +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/pages/SeleniumPageObjectLiveTest.java @@ -1,9 +1,9 @@ -package test.java.com.baeldung.selenium.junit; +package com.baeldung.selenium.pages; -import main.java.com.baeldung.selenium.config.SeleniumConfig; -import main.java.com.baeldung.selenium.models.BaeldungAbout; -import main.java.com.baeldung.selenium.pages.BaeldungHomePage; -import main.java.com.baeldung.selenium.pages.StartHerePage; +import com.baeldung.selenium.config.SeleniumConfig; +import com.baeldung.selenium.models.BaeldungAbout; +import com.baeldung.selenium.pages.BaeldungHomePage; +import com.baeldung.selenium.pages.StartHerePage; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/testng/SeleniumWithTestNGLiveTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/testng/SeleniumWithTestNGLiveTest.java index 94426edc6d..85fa00c0ab 100644 --- a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/testng/SeleniumWithTestNGLiveTest.java +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/testng/SeleniumWithTestNGLiveTest.java @@ -1,16 +1,19 @@ -package test.java.com.baeldung.selenium.testng; +package com.baeldung.selenium.testng; + +import com.baeldung.selenium.SeleniumExample; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; -import main.java.com.baeldung.selenium.SeleniumExample; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; -import static org.testng.Assert.*; - public class SeleniumWithTestNGLiveTest { private SeleniumExample seleniumExample; - private String expectedTitle = "Baeldung | Java, Spring and Web Development tutorials"; + private String expectedTitle = "About Baeldung | Baeldung"; @BeforeSuite public void setUp() { From 12eb8523493e790d2cb232f902035e290fc0a097 Mon Sep 17 00:00:00 2001 From: STS Date: Mon, 29 Jun 2020 14:07:18 +0200 Subject: [PATCH 0042/1862] remove and add file --- {excelformula => apache-poi/excelformula}/.gitignore | 0 {excelformula => apache-poi/excelformula}/pom.xml | 0 .../src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java | 0 .../com/bealdung/poi/excelformula/ExcelformulaApplication.java | 0 .../excelformula}/src/main/resources/application.properties | 0 .../bealdung/poi/excelformula/ExcelformulaApplicationTests.java | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {excelformula => apache-poi/excelformula}/.gitignore (100%) rename {excelformula => apache-poi/excelformula}/pom.xml (100%) rename {excelformula => apache-poi/excelformula}/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java (100%) rename {excelformula => apache-poi/excelformula}/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java (100%) rename {excelformula => apache-poi/excelformula}/src/main/resources/application.properties (100%) rename {excelformula => apache-poi/excelformula}/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java (100%) diff --git a/excelformula/.gitignore b/apache-poi/excelformula/.gitignore similarity index 100% rename from excelformula/.gitignore rename to apache-poi/excelformula/.gitignore diff --git a/excelformula/pom.xml b/apache-poi/excelformula/pom.xml similarity index 100% rename from excelformula/pom.xml rename to apache-poi/excelformula/pom.xml diff --git a/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java b/apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java similarity index 100% rename from excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java rename to apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java diff --git a/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java b/apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java similarity index 100% rename from excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java rename to apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java diff --git a/excelformula/src/main/resources/application.properties b/apache-poi/excelformula/src/main/resources/application.properties similarity index 100% rename from excelformula/src/main/resources/application.properties rename to apache-poi/excelformula/src/main/resources/application.properties diff --git a/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java b/apache-poi/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java similarity index 100% rename from excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java rename to apache-poi/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java From 35e88cd1c57be5eb25da73f48e9c7e1b6f1cef36 Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Mon, 29 Jun 2020 15:56:23 +0200 Subject: [PATCH 0043/1862] BAEL-4198 --- testing-modules/selenium-junit-testng/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/testing-modules/selenium-junit-testng/pom.xml b/testing-modules/selenium-junit-testng/pom.xml index 44af047bdd..210c2051da 100644 --- a/testing-modules/selenium-junit-testng/pom.xml +++ b/testing-modules/selenium-junit-testng/pom.xml @@ -59,7 +59,6 @@ 6.10 3.4.0 - 1.5.4 From 672ffdbe9f9fe6de186e38a4a7d28aa6e95378ee Mon Sep 17 00:00:00 2001 From: joe zhang Date: Mon, 29 Jun 2020 22:34:19 +0800 Subject: [PATCH 0044/1862] update unit test for collectors.toMap method --- .../convertlisttomap/ListToMapUnitTest.java | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java b/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java index e2340a5a9a..5a875a904e 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java +++ b/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java @@ -9,6 +9,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.BiConsumer; +import java.util.function.BinaryOperator; +import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -84,15 +86,23 @@ public class ListToMapUnitTest { return new ArrayList<>(); }; + Function keyMapper = (element) -> { + return element.length(); + }; + + Function> valueMapper = (element) -> { + List collection = listSupplier.get(); + collection.add(element); + return collection; + }; + + BinaryOperator> mergeFunction = (existing, replacement) -> { + existing.addAll(replacement); + return existing; + }; + convertedMap = strings.stream() - .collect(Collectors.toMap(String::length, (p) -> { - List strs = listSupplier.get(); - strs.add(p); - return strs; - }, (existing, replacement) -> { - existing.addAll(replacement); - return existing; - }, mapFactory)); + .collect(Collectors.toMap(keyMapper, valueMapper, mergeFunction, mapFactory)); assertEquals(2, convertedMap.size()); assertTrue(convertedMap.get(3) From 0549f755b08b7f1c5b529d4cec42483d46a072f2 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Mon, 29 Jun 2020 22:27:35 +0530 Subject: [PATCH 0045/1862] Added test case for widening. --- .../AccessPrivateFieldsUnitTest.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java index bf9e4ea591..5a2a33fa8f 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java @@ -53,6 +53,18 @@ public class AccessPrivateFieldsUnitTest { Assertions.assertEquals(452002, pinCode); } + @Test + public void whenDoWidening_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + Person person = new Person(); + + Field pinCodeField = person.getClass() + .getDeclaredField("pinCode"); + pinCodeField.setAccessible(true); + + Long pinCode = pinCodeField.getLong(person); + Assertions.assertEquals(452002L, pinCode); + } + @Test public void whenGetFloatingTypeFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); @@ -118,6 +130,16 @@ public class AccessPrivateFieldsUnitTest { Assertions.assertThrows(IllegalArgumentException.class, () -> nameField.getInt(person)); } + @Test + public void givenInt_whenGetLongField_thenIllegalArgumentException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + Person person = new Person(); + Field contactNumberField = person.getClass() + .getDeclaredField("contactNumber"); + contactNumberField.setAccessible(true); + + Assertions.assertThrows(IllegalArgumentException.class, () -> contactNumberField.getInt(person)); + } + @Test public void whenFieldNotSetAccessible_thenIllegalAccessException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { Person person = new Person(); @@ -132,7 +154,7 @@ public class AccessPrivateFieldsUnitTest { Person person = new Person(); Assertions.assertThrows(NoSuchFieldException.class, () -> person.getClass() - .getDeclaredField("genders")); + .getDeclaredField("firstName")); } @Test From a97a87735a6a95f98bb4b88dc750a577447a2e73 Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Tue, 30 Jun 2020 15:24:38 +0200 Subject: [PATCH 0046/1862] BAEL-4024 - Taking Screenshots with Selenium WebDriver --- testing-modules/selenium-junit-testng/pom.xml | 6 ++ .../TakeScreenShotSeleniumLiveTest.java | 85 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/screenshot/TakeScreenShotSeleniumLiveTest.java diff --git a/testing-modules/selenium-junit-testng/pom.xml b/testing-modules/selenium-junit-testng/pom.xml index 210c2051da..8d661997f8 100644 --- a/testing-modules/selenium-junit-testng/pom.xml +++ b/testing-modules/selenium-junit-testng/pom.xml @@ -41,6 +41,11 @@ hamcrest-all ${hamcrest-all.version} + + ru.yandex.qatools.ashot + ashot + ${ashot.version} + @@ -59,6 +64,7 @@ 6.10 3.4.0 + 1.5.4 diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/screenshot/TakeScreenShotSeleniumLiveTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/screenshot/TakeScreenShotSeleniumLiveTest.java new file mode 100644 index 0000000000..cf705bb81f --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/screenshot/TakeScreenShotSeleniumLiveTest.java @@ -0,0 +1,85 @@ +package com.baeldung.selenium.screenshot; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import javax.imageio.ImageIO; + +import org.apache.commons.io.FileUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Capabilities; +import org.openqa.selenium.OutputType; +import org.openqa.selenium.TakesScreenshot; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.remote.DesiredCapabilities; + +import ru.yandex.qatools.ashot.AShot; +import ru.yandex.qatools.ashot.Screenshot; +import ru.yandex.qatools.ashot.coordinates.WebDriverCoordsProvider; +import ru.yandex.qatools.ashot.shooting.ShootingStrategies; + +public class TakeScreenShotSeleniumLiveTest { + + private static ChromeDriver driver; + + @BeforeClass + public static void setUp() { + System.setProperty("webdriver.chrome.driver", resolveResourcePath("chromedriver.mac")); + + Capabilities capabilities = DesiredCapabilities.chrome(); + driver = new ChromeDriver(capabilities); + driver.manage() + .timeouts() + .implicitlyWait(5, TimeUnit.SECONDS); + + driver.get("http://www.google.com/"); + } + + @AfterClass + public static void tearDown() throws IOException { + driver.close(); + + System.clearProperty("webdriver.chrome.driver"); + } + + @Test + public void whenGoogleIsLoaded_thenCaptureScreenshot() throws IOException { + takeScreenshot(resolveTestResourcePath("google-home.png")); + + assertTrue(new File(resolveTestResourcePath("google-home.png")).exists()); + } + + @Test + public void whenGoogleIsLoaded_thenCaptureLogo() throws IOException { + WebElement logo = driver.findElement(By.id("hplogo")); + + Screenshot screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)) + .coordsProvider(new WebDriverCoordsProvider()) + .takeScreenshot(driver, logo); + + ImageIO.write(screenshot.getImage(), "jpg", new File(resolveTestResourcePath("google-logo.png"))); + assertTrue(new File(resolveTestResourcePath("google-logo.png")).exists()); + } + + public void takeScreenshot(String pathname) throws IOException { + File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); + FileUtils.copyFile(src, new File(pathname)); + } + + private static String resolveResourcePath(String filename) { + File file = new File("src/main/resources/" + filename); + return file.getAbsolutePath(); + } + + private static String resolveTestResourcePath(String filename) { + File file = new File("src/test/resources/" + filename); + return file.getAbsolutePath(); + } +} From d1a9ff7480f8f21543c02d61992d0dd20fa4e56d Mon Sep 17 00:00:00 2001 From: Joao Esperancinha Date: Tue, 30 Jun 2020 15:52:17 +0200 Subject: [PATCH 0047/1862] [BAEL-4281] Examples of array comparisons --- java-collections/README.md | 8 +++ java-collections/pom.xml | 49 +++++++++++++++++++ .../com/baeldung/comparingarrays/Plane.java | 39 +++++++++++++++ .../src/main/resources/logback.xml | 13 +++++ .../baeldung/DeepEqualsCompareUnitTest.java | 34 +++++++++++++ .../com/baeldung/EqualsCompareUnitTest.java | 29 +++++++++++ .../com/baeldung/LengthsCompareUnitTest.java | 22 +++++++++ .../com/baeldung/OrderCompareUnitTest.java | 34 +++++++++++++ .../baeldung/ReferenceCompareUnitTest.java | 34 +++++++++++++ 9 files changed, 262 insertions(+) create mode 100644 java-collections/README.md create mode 100644 java-collections/pom.xml create mode 100644 java-collections/src/main/java/com/baeldung/comparingarrays/Plane.java create mode 100644 java-collections/src/main/resources/logback.xml create mode 100644 java-collections/src/test/java/com/baeldung/DeepEqualsCompareUnitTest.java create mode 100644 java-collections/src/test/java/com/baeldung/EqualsCompareUnitTest.java create mode 100644 java-collections/src/test/java/com/baeldung/LengthsCompareUnitTest.java create mode 100644 java-collections/src/test/java/com/baeldung/OrderCompareUnitTest.java create mode 100644 java-collections/src/test/java/com/baeldung/ReferenceCompareUnitTest.java diff --git a/java-collections/README.md b/java-collections/README.md new file mode 100644 index 0000000000..480b7f257a --- /dev/null +++ b/java-collections/README.md @@ -0,0 +1,8 @@ +## Java Collections Examples + +This module support code for articles about handling java collections and arrays. + +### Relevant Articles: +- [Comparing two integer arrays in Java](https://stackoverflow.com/questions/14897366/comparing-two-integer-arrays-in-java) +- [Compare two arrays with not the same order](https://stackoverflow.com/questions/54711228/compare-two-arrays-with-not-the-same-order) +- More articles: [[next -->]](../java-collections-conversions-2) \ No newline at end of file diff --git a/java-collections/pom.xml b/java-collections/pom.xml new file mode 100644 index 0000000000..5e0ee42244 --- /dev/null +++ b/java-collections/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + java-collections + 0.1.0-SNAPSHOT + java-collections + jar + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.hamcrest + hamcrest-all + ${hamcrest-all.version} + test + + + + + java-collections + + + src/main/resources + true + + + + + + 4.1 + + diff --git a/java-collections/src/main/java/com/baeldung/comparingarrays/Plane.java b/java-collections/src/main/java/com/baeldung/comparingarrays/Plane.java new file mode 100644 index 0000000000..db61807878 --- /dev/null +++ b/java-collections/src/main/java/com/baeldung/comparingarrays/Plane.java @@ -0,0 +1,39 @@ +package com.baeldung.comparingarrays; + +import java.util.Objects; + +public class Plane { + + private final String name; + + private final String model; + + public Plane(String name, String model) { + + this.name = name; + this.model = model; + } + + public String getName() { + return name; + } + + public String getModel() { + return model; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Plane plane = (Plane) o; + return Objects.equals(name, plane.name) && Objects.equals(model, plane.model); + } + + @Override + public int hashCode() { + return Objects.hash(name, model); + } +} diff --git a/java-collections/src/main/resources/logback.xml b/java-collections/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/java-collections/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/java-collections/src/test/java/com/baeldung/DeepEqualsCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/DeepEqualsCompareUnitTest.java new file mode 100644 index 0000000000..f311d0e5c9 --- /dev/null +++ b/java-collections/src/test/java/com/baeldung/DeepEqualsCompareUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung; + +import com.baeldung.comparingarrays.Plane; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class DeepEqualsCompareUnitTest { + + @Test + public void givenArray1andArray2_whenSameContent_thenDeepEquals() { + final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, + new Plane[] { new Plane("Plane 2", "B738") } }; + final Plane[][] planes2 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, + new Plane[] { new Plane("Plane 2", "B738") } }; + + boolean result = Arrays.deepEquals(planes1, planes2); + assertTrue("Result is not true", result); + } + + @Test + public void givenArray1andArray2_whenNotSameContent_thenNotDeepEquals() { + final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, + new Plane[] { new Plane("Plane 2", "B738") } }; + final Plane[][] planes2 = new Plane[][] { new Plane[] { new Plane("Plane 2", "B738") }, + new Plane[] { new Plane("Plane 1", "A320") } }; + + boolean result = Arrays.deepEquals(planes1, planes2); + assertFalse("Result is true", result); + } +} diff --git a/java-collections/src/test/java/com/baeldung/EqualsCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/EqualsCompareUnitTest.java new file mode 100644 index 0000000000..b56395a848 --- /dev/null +++ b/java-collections/src/test/java/com/baeldung/EqualsCompareUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class EqualsCompareUnitTest { + + @Test + public void givenArray1andArray2_whenSameContent_thenEquals() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final String[] planes2 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + + boolean result = Arrays.equals(planes1, planes2); + assertTrue("Result is not true", result); + } + + @Test + public void givenArray1andArray2_whenSameContentOtherSort_thenNotEquals() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final String[] planes2 = new String[] { "B738", "A320", "A321", "A319", "B77W", "B737", "A333", "A332" }; + + boolean result = Arrays.equals(planes1, planes2); + assertFalse("Result is true", result); + } +} diff --git a/java-collections/src/test/java/com/baeldung/LengthsCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/LengthsCompareUnitTest.java new file mode 100644 index 0000000000..8b3c90c427 --- /dev/null +++ b/java-collections/src/test/java/com/baeldung/LengthsCompareUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.is; +import static org.hamcrest.collection.IsArrayWithSize.arrayWithSize; +import static org.junit.Assert.assertThat; + +public class LengthsCompareUnitTest { + + @Test + public void givenArray1andArray2_whenSameSizes_thenSizeEqualsOk() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final Integer[] quantities = new Integer[] { 10, 12, 34, 45, 12, 43, 5, 2 }; + + assertThat(planes1, arrayWithSize(8)); + assertThat(quantities, arrayWithSize(8)); + assertThat(planes1.length, is(8)); + assertThat(quantities.length, is(8)); + } +} + diff --git a/java-collections/src/test/java/com/baeldung/OrderCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/OrderCompareUnitTest.java new file mode 100644 index 0000000000..8be7251c05 --- /dev/null +++ b/java-collections/src/test/java/com/baeldung/OrderCompareUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung; + +import com.baeldung.comparingarrays.Plane; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Comparator; + +import static org.junit.Assert.assertTrue; + +public class OrderCompareUnitTest { + @Test + public void givenArray1andArray2_whenNotSameContent_thenNotDeepEquals() { + final Plane[][] planes1 = new Plane[][] { + new Plane[] { new Plane("Plane 1", "A320"), new Plane("Plane 2", "B738") } }; + final Plane[][] planes2 = new Plane[][] { + new Plane[] { new Plane("Plane 2", "B738"), new Plane("Plane 1", "A320") } }; + + Comparator planeComparator = (o1, o2) -> { + if (o1.getName() + .equals(o2.getName())) { + return o2.getModel() + .compareTo(o1.getModel()); + } + return o2.getName() + .compareTo(o1.getName()); + }; + Arrays.sort(planes1[0], planeComparator); + Arrays.sort(planes2[0], planeComparator); + + boolean result = Arrays.deepEquals(planes1, planes2); + assertTrue("Result is false", result); + } +} diff --git a/java-collections/src/test/java/com/baeldung/ReferenceCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/ReferenceCompareUnitTest.java new file mode 100644 index 0000000000..9716a34607 --- /dev/null +++ b/java-collections/src/test/java/com/baeldung/ReferenceCompareUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung; + +import org.junit.jupiter.api.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; + +public class ReferenceCompareUnitTest { + + @Test + public void givenArray1andArray2_whenEquals_thenEqual() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final String[] planes2 = planes1; + + assertSame("Objects are not equal!", planes1, planes2); + + planes2[0] = "747"; + + assertSame("Objects are not same!", planes1, planes2); + assertEquals("Objects are not equal!", "747", planes2[0]); + assertEquals("Objects are not equal!", "747", planes1[0]); + } + + @Test + public void givenArray1andArray2_whenDifferentValues_thenNotEqual() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final String[] planes2 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + + assertNotSame("Objects are the same!", planes1, planes2); + assertNotEquals("Objects are equal!", planes1, planes2); + } +} From 48cdcb20fb46d3a8d48ad94e598851ff7ce9f556 Mon Sep 17 00:00:00 2001 From: luvarqpp Date: Wed, 1 Jul 2020 15:39:19 +0200 Subject: [PATCH 0048/1862] Fix exception when receiving POISON_PILL POISON_PILL is causing writing to closed client due to logic in code. --- .../src/main/java/com/baeldung/selector/EchoServer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core-java-modules/core-java-nio-2/src/main/java/com/baeldung/selector/EchoServer.java b/core-java-modules/core-java-nio-2/src/main/java/com/baeldung/selector/EchoServer.java index 8cf2e941fe..9e9edcd0ba 100644 --- a/core-java-modules/core-java-nio-2/src/main/java/com/baeldung/selector/EchoServer.java +++ b/core-java-modules/core-java-nio-2/src/main/java/com/baeldung/selector/EchoServer.java @@ -49,11 +49,11 @@ public class EchoServer { if (new String(buffer.array()).trim().equals(POISON_PILL)) { client.close(); System.out.println("Not accepting client messages anymore"); + } else { + buffer.flip(); + client.write(buffer); + buffer.clear(); } - - buffer.flip(); - client.write(buffer); - buffer.clear(); } private static void register(Selector selector, ServerSocketChannel serverSocket) throws IOException { From 1b7edfdfad9f2eb12e15a808974b8679c40c33db Mon Sep 17 00:00:00 2001 From: Donato Rimenti Date: Thu, 2 Jul 2020 20:21:57 +0200 Subject: [PATCH 0049/1862] [BAEL-4074] Accessing Maven properties in Java --- maven-all/maven-2/.gitignore | 2 + maven-all/maven-2/README.md | 6 +++ maven-all/maven-2/pom.xml | 51 +++++++++++++++++++ .../maven/properties/PropertiesReader.java | 41 +++++++++++++++ .../properties/PropertiesReaderUnitTest.java | 27 ++++++++++ 5 files changed, 127 insertions(+) create mode 100644 maven-all/maven-2/.gitignore create mode 100644 maven-all/maven-2/README.md create mode 100644 maven-all/maven-2/pom.xml create mode 100644 maven-all/maven-2/src/main/java/com/baeldung/maven/properties/PropertiesReader.java create mode 100644 maven-all/maven-2/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java diff --git a/maven-all/maven-2/.gitignore b/maven-all/maven-2/.gitignore new file mode 100644 index 0000000000..bae0b0d7ce --- /dev/null +++ b/maven-all/maven-2/.gitignore @@ -0,0 +1,2 @@ +/output-resources +/.idea/ diff --git a/maven-all/maven-2/README.md b/maven-all/maven-2/README.md new file mode 100644 index 0000000000..5878a4f732 --- /dev/null +++ b/maven-all/maven-2/README.md @@ -0,0 +1,6 @@ +## Apache Maven + +This module contains articles about core Apache Maven. Articles about other Maven plugins (such as the Maven WAR Plugin) +have their own dedicated modules. + +### Relevant Articles diff --git a/maven-all/maven-2/pom.xml b/maven-all/maven-2/pom.xml new file mode 100644 index 0000000000..629da573b5 --- /dev/null +++ b/maven-all/maven-2/pom.xml @@ -0,0 +1,51 @@ + + + 4.0.0 + maven-2 + 0.0.1-SNAPSHOT + maven-2 + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../.. + + + + + junit + junit + 4.13 + + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + generate-resources + + write-project-properties + + + ${project.build.outputDirectory}/properties-from-pom.properties + + + + + + + + + ${project.name} + property-from-pom + + + \ No newline at end of file diff --git a/maven-all/maven-2/src/main/java/com/baeldung/maven/properties/PropertiesReader.java b/maven-all/maven-2/src/main/java/com/baeldung/maven/properties/PropertiesReader.java new file mode 100644 index 0000000000..e7000ec2ce --- /dev/null +++ b/maven-all/maven-2/src/main/java/com/baeldung/maven/properties/PropertiesReader.java @@ -0,0 +1,41 @@ +package com.baeldung.maven.properties; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * Reads properties from one file. + * + * @author Donato Rimenti + */ +public class PropertiesReader { + + /** + * Properties managed by this reader. + */ + private Properties properties; + + /** + * Reads the property file with the given name. + * + * @param propertyFileName the name of the property file to read + * @throws IOException if the file is not found or there's a problem reading it + */ + public PropertiesReader(String propertyFileName) throws IOException { + InputStream is = getClass().getClassLoader() + .getResourceAsStream(propertyFileName); + this.properties = new Properties(); + this.properties.load(is); + } + + /** + * Gets the property with the given name from the property file. + * @param propertyName the name of the property to read + * @return the property with the given name + */ + public String getProperty(String propertyName) { + return this.properties.getProperty(propertyName); + } + +} \ No newline at end of file diff --git a/maven-all/maven-2/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java b/maven-all/maven-2/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java new file mode 100644 index 0000000000..a1d6e66047 --- /dev/null +++ b/maven-all/maven-2/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.maven.properties; + +import java.io.IOException; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Test for {@link PropertiesReader}. + * + * @author Donato Rimenti + */ +public class PropertiesReaderUnitTest { + + /** + * Reads a property and checks that's the one expected. + * + * @throws IOException if anything goes wrong + */ + @Test + public void givenPomProperties_whenPropertyRead_thenPropertyReturned() throws IOException { + PropertiesReader reader = new PropertiesReader("properties-from-pom.properties"); + String property = reader.getProperty("my.awesome.property"); + Assert.assertEquals("property-from-pom", property); + } + +} \ No newline at end of file From 6182cdf09f56fc11a852a784371427a2b9705eea Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 3 Jul 2020 17:18:39 +0530 Subject: [PATCH 0050/1862] gupta.aashishrules@gmail.com - Hexagonal gupta.aashishrules@gmail.com - Hexagonal --- bookstore/pom.xml | 23 +++++++++++ .../src/main/java/com/hexagonal/MainApp.java | 13 +++++++ .../hexagonal/controller/BookController.java | 37 ++++++++++++++++++ .../main/java/com/hexagonal/domain/Book.java | 38 +++++++++++++++++++ .../hexagonal/repository/BookRepository.java | 15 ++++++++ .../repository/BookRepositoryImpl.java | 35 +++++++++++++++++ .../com/hexagonal/service/BookService.java | 15 ++++++++ .../hexagonal/service/BookServiceImpl.java | 35 +++++++++++++++++ 8 files changed, 211 insertions(+) create mode 100644 bookstore/pom.xml create mode 100644 bookstore/src/main/java/com/hexagonal/MainApp.java create mode 100644 bookstore/src/main/java/com/hexagonal/controller/BookController.java create mode 100644 bookstore/src/main/java/com/hexagonal/domain/Book.java create mode 100644 bookstore/src/main/java/com/hexagonal/repository/BookRepository.java create mode 100644 bookstore/src/main/java/com/hexagonal/repository/BookRepositoryImpl.java create mode 100644 bookstore/src/main/java/com/hexagonal/service/BookService.java create mode 100644 bookstore/src/main/java/com/hexagonal/service/BookServiceImpl.java diff --git a/bookstore/pom.xml b/bookstore/pom.xml new file mode 100644 index 0000000000..68286076e5 --- /dev/null +++ b/bookstore/pom.xml @@ -0,0 +1,23 @@ + + 4.0.0 + com.hexagonal + bookstore + 0.0.1-SNAPSHOT + + + 1.8 + + + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + + + org.springframework.boot + spring-boot-starter-web + + + \ No newline at end of file diff --git a/bookstore/src/main/java/com/hexagonal/MainApp.java b/bookstore/src/main/java/com/hexagonal/MainApp.java new file mode 100644 index 0000000000..0d6ef861b3 --- /dev/null +++ b/bookstore/src/main/java/com/hexagonal/MainApp.java @@ -0,0 +1,13 @@ +package com.hexagonal; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; + +@SpringBootApplication +public class MainApp { + public static void main(String[] args) { + SpringApplication.run(MainApp.class, args); + } + +} \ No newline at end of file diff --git a/bookstore/src/main/java/com/hexagonal/controller/BookController.java b/bookstore/src/main/java/com/hexagonal/controller/BookController.java new file mode 100644 index 0000000000..7e525deaa1 --- /dev/null +++ b/bookstore/src/main/java/com/hexagonal/controller/BookController.java @@ -0,0 +1,37 @@ +package com.hexagonal.controller; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.hexagonal.domain.Book; +import com.hexagonal.service.BookService; + +@RestController +public class BookController { + + @Autowired + private BookService bookService; + + @RequestMapping("/book/add") + @PostMapping(produces = { MediaType.TEXT_PLAIN_VALUE }) + public void addBook(@RequestBody Book book) { + bookService.addBook(book); + } + + public Book buyBook(@PathVariable String isbn) { + return bookService.buyBook(isbn); + } + + public List listBooks() { + return bookService.listBooks(); + } + +} diff --git a/bookstore/src/main/java/com/hexagonal/domain/Book.java b/bookstore/src/main/java/com/hexagonal/domain/Book.java new file mode 100644 index 0000000000..84125391cc --- /dev/null +++ b/bookstore/src/main/java/com/hexagonal/domain/Book.java @@ -0,0 +1,38 @@ +package com.hexagonal.domain; + +public class Book { + + private String name; + private String isbn; + private String author; + + @Override + public String toString() { + return "Book [name=" + name + ", ISBN=" + isbn + ", author=" + author + "]"; + } + + public String getIsbn() { + return isbn; + } + + public void setIsbn(String isbn) { + this.isbn = isbn; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + +} diff --git a/bookstore/src/main/java/com/hexagonal/repository/BookRepository.java b/bookstore/src/main/java/com/hexagonal/repository/BookRepository.java new file mode 100644 index 0000000000..1e64a2d21b --- /dev/null +++ b/bookstore/src/main/java/com/hexagonal/repository/BookRepository.java @@ -0,0 +1,15 @@ +package com.hexagonal.repository; + +import java.util.List; + +import com.hexagonal.domain.Book; + +public interface BookRepository { + + public void add(Book book); + + public Book buy(String isbn); + + public List list(); + +} diff --git a/bookstore/src/main/java/com/hexagonal/repository/BookRepositoryImpl.java b/bookstore/src/main/java/com/hexagonal/repository/BookRepositoryImpl.java new file mode 100644 index 0000000000..f4f99583dd --- /dev/null +++ b/bookstore/src/main/java/com/hexagonal/repository/BookRepositoryImpl.java @@ -0,0 +1,35 @@ +package com.hexagonal.repository; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Repository; + +import com.hexagonal.domain.Book; + +@Repository +public class BookRepositoryImpl implements BookRepository { + + private Map bookMap = new HashMap<>(); + + @Override + public void add(Book book) { + bookMap.put(book.getIsbn(), book); + System.out.println("Book Added " + book); + } + + @Override + public Book buy(String isbn) { + return bookMap.get(isbn); + } + + @Override + public List list() { + return bookMap.values() + .stream() + .collect(Collectors.toList()); + } + +} diff --git a/bookstore/src/main/java/com/hexagonal/service/BookService.java b/bookstore/src/main/java/com/hexagonal/service/BookService.java new file mode 100644 index 0000000000..cb5e1a930e --- /dev/null +++ b/bookstore/src/main/java/com/hexagonal/service/BookService.java @@ -0,0 +1,15 @@ +package com.hexagonal.service; + +import java.util.List; + +import com.hexagonal.domain.Book; + +public interface BookService { + + public void addBook(Book book); + + public Book buyBook(String isbn); + + public List listBooks(); + +} diff --git a/bookstore/src/main/java/com/hexagonal/service/BookServiceImpl.java b/bookstore/src/main/java/com/hexagonal/service/BookServiceImpl.java new file mode 100644 index 0000000000..c7e660ea36 --- /dev/null +++ b/bookstore/src/main/java/com/hexagonal/service/BookServiceImpl.java @@ -0,0 +1,35 @@ +package com.hexagonal.service; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.hexagonal.domain.Book; +import com.hexagonal.repository.BookRepository; + +@Service +public class BookServiceImpl implements BookService { + + @Autowired + private BookRepository bookRepository; + + @Override + public void addBook(Book book) { + bookRepository.add(book); + + } + + @Override + public Book buyBook(String isbn) { + + return bookRepository.buy(isbn); + } + + @Override + public List listBooks() { + + return bookRepository.list(); + } + +} From 36d37894420227c3e56ff244822b239c268b6db0 Mon Sep 17 00:00:00 2001 From: akeshri Date: Fri, 3 Jul 2020 22:32:44 +0530 Subject: [PATCH 0051/1862] 1.fixed code format 2. resolved build issue --- hexagonal-architecture/pom.xml | 2 + .../article/hexagonal/architecture/App.java | 16 ++++ .../hexagonal/architecture/ConsoleApp.java | 50 +++++++++++ .../controller/ProductController.java | 54 ++++++++++++ .../architecture/dtos/ProductDto.java | 72 ++++++++++++++++ .../hexagonal/architecture/model/Product.java | 85 +++++++++++++++++++ .../repository/ProductRepository.java | 14 +++ .../architecture/service/ProductService.java | 21 +++++ .../service/ProductServiceImpl.java | 44 ++++++++++ .../service/ProductServiceTest.java | 43 ++++++++++ 10 files changed, 401 insertions(+) create mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/App.java create mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/ConsoleApp.java create mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/controller/ProductController.java create mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/dtos/ProductDto.java create mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/model/Product.java create mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/repository/ProductRepository.java create mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductService.java create mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductServiceImpl.java create mode 100644 hexagonal-architecture/src/test/java/com/article/hexagonal/architecture/service/ProductServiceTest.java diff --git a/hexagonal-architecture/pom.xml b/hexagonal-architecture/pom.xml index 87e599318c..d014617639 100644 --- a/hexagonal-architecture/pom.xml +++ b/hexagonal-architecture/pom.xml @@ -18,6 +18,8 @@ UTF-8 + 1.8 + 1.8 diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/App.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/App.java new file mode 100644 index 0000000000..ebc661bfdb --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/App.java @@ -0,0 +1,16 @@ +package com.article.hexagonal.architecture; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author AshwiniKeshri + * + */ + +@SpringBootApplication +public class App { + public static void main(String[] args) { + SpringApplication.run(App.class, args); + } +} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/ConsoleApp.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/ConsoleApp.java new file mode 100644 index 0000000000..0024438737 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/ConsoleApp.java @@ -0,0 +1,50 @@ +package com.article.hexagonal.architecture; + +import java.io.File; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; +import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; + +import com.article.hexagonal.architecture.model.Product; +import com.article.hexagonal.architecture.service.ProductService; +import com.fasterxml.jackson.dataformat.csv.CsvMapper; +import com.fasterxml.jackson.dataformat.csv.CsvSchema; + +/** + * @author AshwiniKeshri + * + */ + +@SpringBootApplication(exclude = { EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class }) +public class ConsoleApp implements CommandLineRunner { + @Autowired + private ProductService productService; + + public static void main(String[] args) { + SpringApplication.run(ConsoleApp.class, args); + } + + @Override + public void run(String... args) throws Exception { + String filePath = ""; + if (args != null && args.length == 2 && "Product".equalsIgnoreCase(args[0]) && (filePath = args[1]).length() > 0) { + File sourceFile = new File(filePath); + if (sourceFile.exists()) { + CsvMapper mapper = new CsvMapper(); + List products = mapper.readerFor(Product.class) + .with(CsvSchema.emptySchema() + .withHeader()) + . readValues(sourceFile) + .readAll(); + productService.saveAll(products); + } + + } + + } +} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/controller/ProductController.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/controller/ProductController.java new file mode 100644 index 0000000000..66372980d0 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/controller/ProductController.java @@ -0,0 +1,54 @@ +package com.article.hexagonal.architecture.controller; + +import java.util.List; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.article.hexagonal.architecture.dtos.ProductDto; +import com.article.hexagonal.architecture.model.Product; +import com.article.hexagonal.architecture.service.ProductService; + +/** + * @author AshwiniKeshri + * + */ + +@RestController +@RequestMapping("api/v1/product") +public class ProductController { + + @Autowired + private ProductService productService; + + @RequestMapping(value = "/all", method = RequestMethod.GET) + public List list() { + productService.findAll().stream().map(x->x.getDescription()) + return null; + //return productService.findAll().stream().map(p -> new ProductDto(p)).collect(Collectors.toList()); + } + + @RequestMapping(value = "/{productId}", method = RequestMethod.GET) + public ProductDto get(@PathVariable long productId) { + Product p = productService.findById(productId); + return p != null ? new ProductDto(p) : null; + } + + @RequestMapping(value = "/add", method = RequestMethod.POST) + public ProductDto create(@RequestBody ProductDto product) { + Product p = new Product(); + p.setDescription(product.getDescription()); + p.setName(product.getName()); + p.setPrice(product.getPrice()); + p.setQuantity(product.getQuantity()); + Long id = productService.create(p); + product.setId(id); + return product; + } + +} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/dtos/ProductDto.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/dtos/ProductDto.java new file mode 100644 index 0000000000..209ae69b0a --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/dtos/ProductDto.java @@ -0,0 +1,72 @@ +package com.article.hexagonal.architecture.dtos; + +import com.article.hexagonal.architecture.model.Product; + +/** + * @author AshwiniKeshri + * + */ +public class ProductDto { + + private Long id; + + private String name; + + private Long quantity; + + private Double price; + + private String description; + + public ProductDto() { + } + + public ProductDto(Product product) { + this.description = product.getDescription(); + this.id = product.getId(); + this.name = product.getName(); + this.price = product.getPrice(); + this.quantity = product.getQuantity(); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Long getQuantity() { + return quantity; + } + + public void setQuantity(Long quantity) { + this.quantity = quantity; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/model/Product.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/model/Product.java new file mode 100644 index 0000000000..f0f95d4d11 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/model/Product.java @@ -0,0 +1,85 @@ +/** + * + */ +package com.article.hexagonal.architecture.model; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * @author AshwiniKeshri + * + */ + +@Entity +@Table(name = "PRODUCT") +public class Product implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 4000353732860709995L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @Column(name = "NAME") + private String name; + + @Column(name = "QUANTITY") + private Long quantity; + + @Column(name = "PRICE") + private Double price; + + @Column(name = "DESCRIPTION") + private String description; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Long getQuantity() { + return quantity; + } + + public void setQuantity(Long quantity) { + this.quantity = quantity > 0 ? quantity : 0; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price == null ? 0.0 : price; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + +} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/repository/ProductRepository.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/repository/ProductRepository.java new file mode 100644 index 0000000000..fec151780c --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/repository/ProductRepository.java @@ -0,0 +1,14 @@ +package com.article.hexagonal.architecture.repository; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.article.hexagonal.architecture.model.Product; + +/** + * @author AshwiniKeshri + * + */ + +public interface ProductRepository extends JpaRepository { + +} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductService.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductService.java new file mode 100644 index 0000000000..5ed1e7de96 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductService.java @@ -0,0 +1,21 @@ +package com.article.hexagonal.architecture.service; + +import java.util.List; + +import com.article.hexagonal.architecture.model.Product; + +/** + * @author AshwiniKeshri + * + */ + +public interface ProductService { + + List findAll(); + + Product findById(long id); + + Long create(Product product); + + void saveAll(List products); +} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductServiceImpl.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductServiceImpl.java new file mode 100644 index 0000000000..ccd1599392 --- /dev/null +++ b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductServiceImpl.java @@ -0,0 +1,44 @@ +package com.article.hexagonal.architecture.service; + +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.article.hexagonal.architecture.model.Product; +import com.article.hexagonal.architecture.repository.ProductRepository; + +/** + * @author AshwiniKeshri + * + */ + +@Service +public class ProductServiceImpl implements ProductService { + + private Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class); + + @Autowired + private ProductRepository productRepository; + + public List findAll() { + return productRepository.findAll(); + } + + public Product findById(long id) { + return productRepository.findOne(id); + } + + public Long create(Product product) { + product = productRepository.saveAndFlush(product); + return product.getId(); + } + + @Override + public void saveAll(List products) { + productRepository.save(products); + } + +} diff --git a/hexagonal-architecture/src/test/java/com/article/hexagonal/architecture/service/ProductServiceTest.java b/hexagonal-architecture/src/test/java/com/article/hexagonal/architecture/service/ProductServiceTest.java new file mode 100644 index 0000000000..6635fef2da --- /dev/null +++ b/hexagonal-architecture/src/test/java/com/article/hexagonal/architecture/service/ProductServiceTest.java @@ -0,0 +1,43 @@ +/** + * + */ +package com.article.hexagonal.architecture.service; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.PropertySources; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.article.hexagonal.architecture.App; +import com.article.hexagonal.architecture.model.Product; +import com.article.hexagonal.architecture.service.ProductService; + +/** + * @author AshwiniKeshri + * + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(App.class) +@ActiveProfiles(value = "test") +public class ProductServiceTest { + + @Autowired + private ProductService productService; + + @Test + public void testCreateProduct() { + Product product = new Product(); + product.setDescription("test product"); + product.setName("Product1"); + product.setPrice(10.0); + product.setQuantity(100l); + Long id = productService.create(product); + Assert.assertTrue(id > 0); + } + +} From 18894f5c03049ea18703dda029140227f95e45aa Mon Sep 17 00:00:00 2001 From: akeshri Date: Sat, 4 Jul 2020 00:10:07 +0530 Subject: [PATCH 0052/1862] remove duplicate code --- .../article/hexagonal/architecture/App.java | 16 ---- .../hexagonal/architecture/ConsoleApp.java | 50 ----------- .../controller/ProductController.java | 54 ------------ .../architecture/dtos/ProductDto.java | 72 ---------------- .../hexagonal/architecture/model/Product.java | 85 ------------------- .../repository/ProductRepository.java | 14 --- .../architecture/service/ProductService.java | 21 ----- .../service/ProductServiceImpl.java | 44 ---------- .../service/ProductServiceTest.java | 43 ---------- 9 files changed, 399 deletions(-) delete mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/App.java delete mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/ConsoleApp.java delete mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/controller/ProductController.java delete mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/dtos/ProductDto.java delete mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/model/Product.java delete mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/repository/ProductRepository.java delete mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductService.java delete mode 100644 hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductServiceImpl.java delete mode 100644 hexagonal-architecture/src/test/java/com/article/hexagonal/architecture/service/ProductServiceTest.java diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/App.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/App.java deleted file mode 100644 index ebc661bfdb..0000000000 --- a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/App.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.article.hexagonal.architecture; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * @author AshwiniKeshri - * - */ - -@SpringBootApplication -public class App { - public static void main(String[] args) { - SpringApplication.run(App.class, args); - } -} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/ConsoleApp.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/ConsoleApp.java deleted file mode 100644 index 0024438737..0000000000 --- a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/ConsoleApp.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.article.hexagonal.architecture; - -import java.io.File; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; -import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; - -import com.article.hexagonal.architecture.model.Product; -import com.article.hexagonal.architecture.service.ProductService; -import com.fasterxml.jackson.dataformat.csv.CsvMapper; -import com.fasterxml.jackson.dataformat.csv.CsvSchema; - -/** - * @author AshwiniKeshri - * - */ - -@SpringBootApplication(exclude = { EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class }) -public class ConsoleApp implements CommandLineRunner { - @Autowired - private ProductService productService; - - public static void main(String[] args) { - SpringApplication.run(ConsoleApp.class, args); - } - - @Override - public void run(String... args) throws Exception { - String filePath = ""; - if (args != null && args.length == 2 && "Product".equalsIgnoreCase(args[0]) && (filePath = args[1]).length() > 0) { - File sourceFile = new File(filePath); - if (sourceFile.exists()) { - CsvMapper mapper = new CsvMapper(); - List products = mapper.readerFor(Product.class) - .with(CsvSchema.emptySchema() - .withHeader()) - . readValues(sourceFile) - .readAll(); - productService.saveAll(products); - } - - } - - } -} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/controller/ProductController.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/controller/ProductController.java deleted file mode 100644 index 66372980d0..0000000000 --- a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/controller/ProductController.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.article.hexagonal.architecture.controller; - -import java.util.List; -import java.util.stream.Collectors; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.article.hexagonal.architecture.dtos.ProductDto; -import com.article.hexagonal.architecture.model.Product; -import com.article.hexagonal.architecture.service.ProductService; - -/** - * @author AshwiniKeshri - * - */ - -@RestController -@RequestMapping("api/v1/product") -public class ProductController { - - @Autowired - private ProductService productService; - - @RequestMapping(value = "/all", method = RequestMethod.GET) - public List list() { - productService.findAll().stream().map(x->x.getDescription()) - return null; - //return productService.findAll().stream().map(p -> new ProductDto(p)).collect(Collectors.toList()); - } - - @RequestMapping(value = "/{productId}", method = RequestMethod.GET) - public ProductDto get(@PathVariable long productId) { - Product p = productService.findById(productId); - return p != null ? new ProductDto(p) : null; - } - - @RequestMapping(value = "/add", method = RequestMethod.POST) - public ProductDto create(@RequestBody ProductDto product) { - Product p = new Product(); - p.setDescription(product.getDescription()); - p.setName(product.getName()); - p.setPrice(product.getPrice()); - p.setQuantity(product.getQuantity()); - Long id = productService.create(p); - product.setId(id); - return product; - } - -} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/dtos/ProductDto.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/dtos/ProductDto.java deleted file mode 100644 index 209ae69b0a..0000000000 --- a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/dtos/ProductDto.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.article.hexagonal.architecture.dtos; - -import com.article.hexagonal.architecture.model.Product; - -/** - * @author AshwiniKeshri - * - */ -public class ProductDto { - - private Long id; - - private String name; - - private Long quantity; - - private Double price; - - private String description; - - public ProductDto() { - } - - public ProductDto(Product product) { - this.description = product.getDescription(); - this.id = product.getId(); - this.name = product.getName(); - this.price = product.getPrice(); - this.quantity = product.getQuantity(); - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Long getQuantity() { - return quantity; - } - - public void setQuantity(Long quantity) { - this.quantity = quantity; - } - - public Double getPrice() { - return price; - } - - public void setPrice(Double price) { - this.price = price; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - -} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/model/Product.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/model/Product.java deleted file mode 100644 index f0f95d4d11..0000000000 --- a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/model/Product.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * - */ -package com.article.hexagonal.architecture.model; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author AshwiniKeshri - * - */ - -@Entity -@Table(name = "PRODUCT") -public class Product implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 4000353732860709995L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long id; - - @Column(name = "NAME") - private String name; - - @Column(name = "QUANTITY") - private Long quantity; - - @Column(name = "PRICE") - private Double price; - - @Column(name = "DESCRIPTION") - private String description; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Long getQuantity() { - return quantity; - } - - public void setQuantity(Long quantity) { - this.quantity = quantity > 0 ? quantity : 0; - } - - public Double getPrice() { - return price; - } - - public void setPrice(Double price) { - this.price = price == null ? 0.0 : price; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - -} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/repository/ProductRepository.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/repository/ProductRepository.java deleted file mode 100644 index fec151780c..0000000000 --- a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/repository/ProductRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.article.hexagonal.architecture.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.article.hexagonal.architecture.model.Product; - -/** - * @author AshwiniKeshri - * - */ - -public interface ProductRepository extends JpaRepository { - -} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductService.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductService.java deleted file mode 100644 index 5ed1e7de96..0000000000 --- a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.article.hexagonal.architecture.service; - -import java.util.List; - -import com.article.hexagonal.architecture.model.Product; - -/** - * @author AshwiniKeshri - * - */ - -public interface ProductService { - - List findAll(); - - Product findById(long id); - - Long create(Product product); - - void saveAll(List products); -} diff --git a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductServiceImpl.java b/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductServiceImpl.java deleted file mode 100644 index ccd1599392..0000000000 --- a/hexagonal-architecture/src/main/java/com/article/hexagonal/architecture/service/ProductServiceImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.article.hexagonal.architecture.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.article.hexagonal.architecture.model.Product; -import com.article.hexagonal.architecture.repository.ProductRepository; - -/** - * @author AshwiniKeshri - * - */ - -@Service -public class ProductServiceImpl implements ProductService { - - private Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class); - - @Autowired - private ProductRepository productRepository; - - public List findAll() { - return productRepository.findAll(); - } - - public Product findById(long id) { - return productRepository.findOne(id); - } - - public Long create(Product product) { - product = productRepository.saveAndFlush(product); - return product.getId(); - } - - @Override - public void saveAll(List products) { - productRepository.save(products); - } - -} diff --git a/hexagonal-architecture/src/test/java/com/article/hexagonal/architecture/service/ProductServiceTest.java b/hexagonal-architecture/src/test/java/com/article/hexagonal/architecture/service/ProductServiceTest.java deleted file mode 100644 index 6635fef2da..0000000000 --- a/hexagonal-architecture/src/test/java/com/article/hexagonal/architecture/service/ProductServiceTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package com.article.hexagonal.architecture.service; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.SpringApplicationConfiguration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.context.annotation.PropertySources; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.article.hexagonal.architecture.App; -import com.article.hexagonal.architecture.model.Product; -import com.article.hexagonal.architecture.service.ProductService; - -/** - * @author AshwiniKeshri - * - */ -@RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(App.class) -@ActiveProfiles(value = "test") -public class ProductServiceTest { - - @Autowired - private ProductService productService; - - @Test - public void testCreateProduct() { - Product product = new Product(); - product.setDescription("test product"); - product.setName("Product1"); - product.setPrice(10.0); - product.setQuantity(100l); - Long id = productService.create(product); - Assert.assertTrue(id > 0); - } - -} From 8f22ea5d36d35cd990d3fdf7b561b77add9278c5 Mon Sep 17 00:00:00 2001 From: STS Date: Fri, 3 Jul 2020 23:56:52 +0200 Subject: [PATCH 0053/1862] change files location --- apache-poi/excelformula/.gitignore | 34 ----------- apache-poi/excelformula/pom.xml | 57 ------------------- .../excelformula/ExcelformulaApplication.java | 13 ----- .../src/main/resources/application.properties | 1 - .../poi/excel/setFormula}/ExcelFormula.java | 4 +- .../setFormula/ExcelFormulaUnitTest.java} | 15 +---- 6 files changed, 4 insertions(+), 120 deletions(-) delete mode 100644 apache-poi/excelformula/.gitignore delete mode 100644 apache-poi/excelformula/pom.xml delete mode 100644 apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java delete mode 100644 apache-poi/excelformula/src/main/resources/application.properties rename apache-poi/{excelformula/src/main/java/com/bealdung/poi/excelformula => src/main/java/com/baeldung/poi/excel/setFormula}/ExcelFormula.java (90%) rename apache-poi/{excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java => src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java} (71%) diff --git a/apache-poi/excelformula/.gitignore b/apache-poi/excelformula/.gitignore deleted file mode 100644 index 719e322c1d..0000000000 --- a/apache-poi/excelformula/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -HELP.md -mvnw -mvnw.cmd -.mvn -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/** -!**/src/test/** - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ - -### VS Code ### -.vscode/ diff --git a/apache-poi/excelformula/pom.xml b/apache-poi/excelformula/pom.xml deleted file mode 100644 index 4ea65b5e57..0000000000 --- a/apache-poi/excelformula/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.RELEASE - - - com.bealdung.poi - excelformula - 0.0.1-SNAPSHOT - excelformula - Demo project for Spring Boot - - 11 - 4.1.2 - 4.13 - - - - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - org.apache.poi - poi-ooxml - ${poi-ooxml.version} - - - junit - junit - ${junit.version} - test - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java b/apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java deleted file mode 100644 index b857bd4266..0000000000 --- a/apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelformulaApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.bealdung.poi.excelformula; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class ExcelformulaApplication { - - public static void main(String[] args) { - SpringApplication.run(ExcelformulaApplication.class, args); - } - -} diff --git a/apache-poi/excelformula/src/main/resources/application.properties b/apache-poi/excelformula/src/main/resources/application.properties deleted file mode 100644 index 8b13789179..0000000000 --- a/apache-poi/excelformula/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java b/apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java similarity index 90% rename from apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java rename to apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java index 1e2fa5acfe..7bd8d8a035 100644 --- a/apache-poi/excelformula/src/main/java/com/bealdung/poi/excelformula/ExcelFormula.java +++ b/apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java @@ -1,16 +1,14 @@ -package com.bealdung.poi.excelformula; +package com.baeldung.poi.excel.setFormula; import org.apache.poi.ss.usermodel.CellValue; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.springframework.stereotype.Component; import java.io.IOException; import java.util.List; -@Component public class ExcelFormula { XSSFWorkbook excel; public XSSFSheet inserData(List dataList) { diff --git a/apache-poi/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java b/apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java similarity index 71% rename from apache-poi/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java rename to apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java index c2385911d0..8daf311149 100644 --- a/apache-poi/excelformula/src/test/java/com/bealdung/poi/excelformula/ExcelformulaApplicationTests.java +++ b/apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java @@ -1,26 +1,18 @@ -package com.bealdung.poi.excelformula; +package com.baeldung.poi.excel.setFormula; import org.apache.poi.ss.util.CellReference; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.junit.Assert; import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; import java.io.IOException; import java.util.Arrays; import java.util.List; -@RunWith(SpringRunner.class) -@SpringBootTest -class ExcelformulaApplicationTests { - @Autowired - private ExcelFormula excelFormula; - +class ExcelFormulaUnitTest { @Test void givenExcelData_whenSetAndEvaluateFormula() throws IOException { + ExcelFormula excelFormula = new ExcelFormula(); List data = Arrays.asList(2, 5, 10, 15, 7, 9); XSSFSheet sheet = excelFormula.inserData(data); int result = 0; @@ -34,5 +26,4 @@ class ExcelformulaApplicationTests { int resultValue = (int) excelFormula.setFormula(sumFormula); Assert.assertEquals("The results are the same!", resultValue , result); } - } From 5e63ab27a1f0a60271fd77828da003350db98876 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sat, 4 Jul 2020 21:53:43 +0530 Subject: [PATCH 0054/1862] Refactored test cases to throw generic Exception --- .../AccessPrivateFieldsUnitTest.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java index 5a2a33fa8f..49e1b917b1 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java +++ b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java @@ -8,7 +8,7 @@ import org.junit.jupiter.api.Test; public class AccessPrivateFieldsUnitTest { @Test - public void whenGetIntegerFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenGetIntegerFields_thenSuccess() throws Exception { Person person = new Person(); Field ageField = person.getClass() @@ -42,7 +42,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenDoAutoboxing_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenDoAutoboxing_thenSuccess() throws Exception { Person person = new Person(); Field pinCodeField = person.getClass() @@ -54,7 +54,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenDoWidening_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenDoWidening_thenSuccess() throws Exception { Person person = new Person(); Field pinCodeField = person.getClass() @@ -66,7 +66,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenGetFloatingTypeFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenGetFloatingTypeFields_thenSuccess() throws Exception { Person person = new Person(); Field heightField = person.getClass() @@ -85,7 +85,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenGetCharacterFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenGetCharacterFields_thenSuccess() throws Exception { Person person = new Person(); Field genderField = person.getClass() @@ -97,7 +97,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenGetBooleanFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenGetBooleanFields_thenSuccess() throws Exception { Person person = new Person(); Field activeField = person.getClass() @@ -109,7 +109,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenGetObjectFields_thenSuccess() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenGetObjectFields_thenSuccess() throws Exception { Person person = new Person(); Field nameField = person.getClass() @@ -121,7 +121,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void givenInt_whenGetStringField_thenIllegalArgumentException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void givenInt_whenGetStringField_thenIllegalArgumentException() throws Exception { Person person = new Person(); Field nameField = person.getClass() .getDeclaredField("name"); @@ -131,7 +131,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void givenInt_whenGetLongField_thenIllegalArgumentException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void givenInt_whenGetLongField_thenIllegalArgumentException() throws Exception { Person person = new Person(); Field contactNumberField = person.getClass() .getDeclaredField("contactNumber"); @@ -141,7 +141,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenFieldNotSetAccessible_thenIllegalAccessException() throws IllegalAccessException, IllegalArgumentException, NoSuchFieldException, NullPointerException { + public void whenFieldNotSetAccessible_thenIllegalAccessException() throws Exception { Person person = new Person(); Field nameField = person.getClass() .getDeclaredField("name"); @@ -150,7 +150,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenAccessingWrongProperty_thenNoSuchFieldException() throws NoSuchFieldException, NullPointerException { + public void whenAccessingWrongProperty_thenNoSuchFieldException() throws Exception { Person person = new Person(); Assertions.assertThrows(NoSuchFieldException.class, () -> person.getClass() @@ -158,7 +158,7 @@ public class AccessPrivateFieldsUnitTest { } @Test - public void whenAccessingNullProperty_thenNullPointerException() throws NoSuchFieldException, NullPointerException { + public void whenAccessingNullProperty_thenNullPointerException() throws Exception { Person person = new Person(); Assertions.assertThrows(NullPointerException.class, () -> person.getClass() From b59f4d32b4456d3496be6c80e5d66fdaa15eab12 Mon Sep 17 00:00:00 2001 From: akeshri Date: Sun, 5 Jul 2020 21:33:50 +0530 Subject: [PATCH 0055/1862] fixed code formatting issue --- .../baeldung/hexagonal/architecture/App.java | 6 +- .../hexagonal/architecture/ConsoleApp.java | 42 +++---- .../controller/ProductController.java | 47 ++++---- .../architecture/dtos/ProductDto.java | 103 ++++++++--------- .../hexagonal/architecture/model/Product.java | 104 +++++++++--------- .../repository/ProductRepository.java | 2 +- .../architecture/service/ProductService.java | 14 +-- .../service/ProductServiceImpl.java | 38 +++---- .../service/ProductServiceTest.java | 28 ++--- 9 files changed, 193 insertions(+), 191 deletions(-) diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java index 3563e3a0ec..29dbec470f 100644 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java @@ -9,10 +9,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; */ @SpringBootApplication -public class App -{ - public static void main( String[] args ) - { +public class App { + public static void main(String[] args) { SpringApplication.run(App.class, args); } } diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java index 70edb8f9ed..6aef791893 100644 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java @@ -20,29 +20,31 @@ import com.fasterxml.jackson.dataformat.csv.CsvSchema; * */ -@SpringBootApplication(exclude = {EmbeddedServletContainerAutoConfiguration.class,WebMvcAutoConfiguration.class}) +@SpringBootApplication(exclude = { EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class }) public class ConsoleApp implements CommandLineRunner { - @Autowired - private ProductService productService; + @Autowired + private ProductService productService; - public static void main(String[] args) { - SpringApplication.run(ConsoleApp.class, args); - } + public static void main(String[] args) { + SpringApplication.run(ConsoleApp.class, args); + } - @Override - public void run(String... args) throws Exception { - String filePath = ""; - if (args != null && args.length == 2 && "Product".equalsIgnoreCase(args[0]) - && (filePath = args[1]).length() > 0) { - File sourceFile = new File(filePath); - if (sourceFile.exists()) { - CsvMapper mapper = new CsvMapper(); - List products = mapper.readerFor(Product.class).with(CsvSchema.emptySchema().withHeader()) - .readValues(sourceFile).readAll(); - productService.saveAll(products); - } + @Override + public void run(String... args) throws Exception { + String filePath = ""; + if (args != null && args.length == 2 && "Product".equalsIgnoreCase(args[0]) && (filePath = args[1]).length() > 0) { + File sourceFile = new File(filePath); + if (sourceFile.exists()) { + CsvMapper mapper = new CsvMapper(); + List products = mapper.readerFor(Product.class) + .with(CsvSchema.emptySchema() + .withHeader()) + . readValues(sourceFile) + .readAll(); + productService.saveAll(products); + } - } + } - } + } } diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java index 6645c379c2..f54d3268df 100644 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java @@ -23,30 +23,33 @@ import com.baeldung.hexagonal.architecture.service.ProductService; @RequestMapping("api/v1/product") public class ProductController { - @Autowired - private ProductService productService; + @Autowired + private ProductService productService; - @RequestMapping(value = "/all", method = RequestMethod.GET) - public List list() { - return productService.findAll().stream().map(p -> new ProductDto(p)).collect(Collectors.toList()); - } + @RequestMapping(value = "/all", method = RequestMethod.GET) + public List list() { + return productService.findAll() + .stream() + .map(p -> new ProductDto(p)) + .collect(Collectors.toList()); + } - @RequestMapping(value = "/{productId}", method = RequestMethod.GET) - public ProductDto get(@PathVariable long productId) { - Product p = productService.findById(productId); - return p != null ? new ProductDto(p) : null; - } + @RequestMapping(value = "/{productId}", method = RequestMethod.GET) + public ProductDto get(@PathVariable long productId) { + Product p = productService.findById(productId); + return p != null ? new ProductDto(p) : null; + } - @RequestMapping(value = "/add", method = RequestMethod.POST) - public ProductDto create(@RequestBody ProductDto product) { - Product p = new Product(); - p.setDescription(product.getDescription()); - p.setName(product.getName()); - p.setPrice(product.getPrice()); - p.setQuantity(product.getQuantity()); - Long id = productService.create(p); - product.setId(id); - return product; - } + @RequestMapping(value = "/add", method = RequestMethod.POST) + public ProductDto create(@RequestBody ProductDto product) { + Product p = new Product(); + p.setDescription(product.getDescription()); + p.setName(product.getName()); + p.setPrice(product.getPrice()); + p.setQuantity(product.getQuantity()); + Long id = productService.create(p); + product.setId(id); + return product; + } } diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java index 336631fb10..51692f56aa 100644 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java @@ -1,71 +1,72 @@ package com.baeldung.hexagonal.architecture.dtos; import com.baeldung.hexagonal.architecture.model.Product; + /** * @author AshwiniKeshri * */ public class ProductDto { - private Long id; - - private String name; - - private Long quantity; - - private Double price; - - private String description; - - public ProductDto() {} - - public ProductDto(Product product) { - this.description = product.getDescription(); - this.id = product.getId(); - this.name = product.getName(); - this.price = product.getPrice(); - this.quantity = product.getQuantity(); - } + private Long id; - public Long getId() { - return id; - } + private String name; - public void setId(Long id) { - this.id = id; - } + private Long quantity; - public String getName() { - return name; - } + private Double price; - public void setName(String name) { - this.name = name; - } + private String description; - public Long getQuantity() { - return quantity; - } + public ProductDto() { + } - public void setQuantity(Long quantity) { - this.quantity = quantity; - } + public ProductDto(Product product) { + this.description = product.getDescription(); + this.id = product.getId(); + this.name = product.getName(); + this.price = product.getPrice(); + this.quantity = product.getQuantity(); + } - public Double getPrice() { - return price; - } + public Long getId() { + return id; + } - public void setPrice(Double price) { - this.price = price; - } + public void setId(Long id) { + this.id = id; + } - public String getDescription() { - return description; - } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Long getQuantity() { + return quantity; + } + + public void setQuantity(Long quantity) { + this.quantity = quantity; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } - public void setDescription(String description) { - this.description = description; - } - - } diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java index dec4548283..697ff68b50 100644 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java @@ -19,69 +19,67 @@ import javax.persistence.Table; @Entity @Table(name = "PRODUCT") -public class Product implements Serializable{ +public class Product implements Serializable { - /** - * - */ - private static final long serialVersionUID = 4000353732860709995L; + /** + * + */ + private static final long serialVersionUID = 4000353732860709995L; - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long id; - - @Column(name="NAME") - private String name; - - @Column(name = "QUANTITY") - private Long quantity; - - @Column(name = "PRICE") - private Double price; - - @Column(name = "DESCRIPTION") - private String description; + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; - public Long getId() { - return id; - } + @Column(name = "NAME") + private String name; - public void setId(Long id) { - this.id = id; - } + @Column(name = "QUANTITY") + private Long quantity; - public String getName() { - return name; - } + @Column(name = "PRICE") + private Double price; - public void setName(String name) { - this.name = name; - } + @Column(name = "DESCRIPTION") + private String description; - public Long getQuantity() { - return quantity; - } + public Long getId() { + return id; + } - public void setQuantity(Long quantity) { - this.quantity = quantity > 0 ? quantity : 0; - } + public void setId(Long id) { + this.id = id; + } - public Double getPrice() { - return price; - } + public String getName() { + return name; + } - public void setPrice(Double price) { - this.price = price == null ? 0.0 : price; - } + public void setName(String name) { + this.name = name; + } - public String getDescription() { - return description; - } + public Long getQuantity() { + return quantity; + } + + public void setQuantity(Long quantity) { + this.quantity = quantity > 0 ? quantity : 0; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price == null ? 0.0 : price; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } - public void setDescription(String description) { - this.description = description; - } - - - } diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java index 76c888ab59..ec50e86dc3 100644 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java @@ -9,6 +9,6 @@ import com.baeldung.hexagonal.architecture.model.Product; * */ -public interface ProductRepository extends JpaRepository{ +public interface ProductRepository extends JpaRepository { } diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java index b1d05a7db4..4844723140 100644 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java @@ -11,11 +11,11 @@ import com.baeldung.hexagonal.architecture.model.Product; public interface ProductService { - List findAll(); - - Product findById(long id); - - Long create(Product product); - - void saveAll(List products); + List findAll(); + + Product findById(long id); + + Long create(Product product); + + void saveAll(List products); } diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java index 1005b5753d..e2d182a954 100644 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java +++ b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java @@ -18,27 +18,27 @@ import com.baeldung.hexagonal.architecture.repository.ProductRepository; @Service public class ProductServiceImpl implements ProductService { - private Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class); - - @Autowired - private ProductRepository productRepository; - - public List findAll() { - return productRepository.findAll(); - } + private Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class); - public Product findById(long id) { - return productRepository.findOne(id); - } + @Autowired + private ProductRepository productRepository; - public Long create(Product product) { - product = productRepository.saveAndFlush(product); - return product.getId(); - } + public List findAll() { + return productRepository.findAll(); + } - @Override - public void saveAll(List products) { - productRepository.save(products); - } + public Product findById(long id) { + return productRepository.findOne(id); + } + + public Long create(Product product) { + product = productRepository.saveAndFlush(product); + return product.getId(); + } + + @Override + public void saveAll(List products) { + productRepository.save(products); + } } diff --git a/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java b/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java index 021fdf1289..748df3c0d0 100644 --- a/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java +++ b/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java @@ -25,19 +25,19 @@ import com.baeldung.hexagonal.architecture.service.ProductService; @SpringApplicationConfiguration(App.class) @ActiveProfiles(value = "test") public class ProductServiceTest { - - @Autowired - private ProductService productService; - @Test - public void testCreateProduct() { - Product product = new Product(); - product.setDescription("test product"); - product.setName("Product1"); - product.setPrice(10.0); - product.setQuantity(100l); - Long id = productService.create(product); - Assert.assertTrue(id >0); - } - + @Autowired + private ProductService productService; + + @Test + public void testCreateProduct() { + Product product = new Product(); + product.setDescription("test product"); + product.setName("Product1"); + product.setPrice(10.0); + product.setQuantity(100l); + Long id = productService.create(product); + Assert.assertTrue(id > 0); + } + } From 15f10601bca6d5760869a6b1a1389b4d9f423a35 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Mon, 6 Jul 2020 12:06:26 +0430 Subject: [PATCH 0056/1862] Memory Address of Objects in Java --- .../memaddress/MemoryAddressUnitTest.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 core-java-modules/core-java-jvm-2/src/test/java/com/baeldung/memaddress/MemoryAddressUnitTest.java diff --git a/core-java-modules/core-java-jvm-2/src/test/java/com/baeldung/memaddress/MemoryAddressUnitTest.java b/core-java-modules/core-java-jvm-2/src/test/java/com/baeldung/memaddress/MemoryAddressUnitTest.java new file mode 100644 index 0000000000..5d4ba0a129 --- /dev/null +++ b/core-java-modules/core-java-jvm-2/src/test/java/com/baeldung/memaddress/MemoryAddressUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.memaddress; + +import org.junit.Test; +import org.openjdk.jol.vm.VM; + +public class MemoryAddressUnitTest { + + @Test + public void printTheMemoryAddress() { + String answer = "42"; + + System.out.println("The memory address is " + VM.current().addressOf(answer)); + } + + @Test + public void identityHashCodeAndMemoryAddress() { + Object obj = new Object(); + + System.out.println("Memory address: " + VM.current().addressOf(obj)); + System.out.println("hashCode: " + obj.hashCode()); + System.out.println("hashCode: " + System.identityHashCode(obj)); + System.out.println("toString: " + obj); + } +} From e955c836adb16087392f1f29aa0b6c2d8a7ad5d6 Mon Sep 17 00:00:00 2001 From: Daniel Garrett Date: Mon, 6 Jul 2020 11:07:36 +0100 Subject: [PATCH 0057/1862] feat: add class to conditionally ignore unit tests --- .../ConditionallyIgnoreTestsUnitTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java diff --git a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java new file mode 100644 index 0000000000..af571eb808 --- /dev/null +++ b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.assume; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assume.assumeThat; +import static org.junit.Assume.assumeTrue; + +import org.junit.Test; + +public class ConditionallyIgnoreTestsUnitTest { + + + @Test + public void whenAssumeThatCodeVersionIsNot1_thenIgnore() { + final int codeVersion = 1; + assumeThat(codeVersion, is(2)); + + assertEquals("hello", "HELLO".toLowerCase()); + } + + @Test + public void whenAssumeTrueOnCondition_thenIgnore() { + final int codeVersion = 1; + assumeTrue(isCodeVersion2(codeVersion)); + + assertEquals("hello", "HELLO".toLowerCase()); + } + + private boolean isCodeVersion2(final int codeVersion) { + return codeVersion == 2; + } +} From 278b5f8efa6d1ba238ba9761079529a12fcf56bc Mon Sep 17 00:00:00 2001 From: Daniel Garrett Date: Mon, 6 Jul 2020 11:15:35 +0100 Subject: [PATCH 0058/1862] fix: rename test --- .../com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java index af571eb808..0a95ed4522 100644 --- a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java @@ -11,7 +11,7 @@ public class ConditionallyIgnoreTestsUnitTest { @Test - public void whenAssumeThatCodeVersionIsNot1_thenIgnore() { + public void whenAssumeThatCodeVersionIsNot2_thenIgnore() { final int codeVersion = 1; assumeThat(codeVersion, is(2)); From 4f6c33f935dfbbedbc693a76ac65130a1cd7ab8f Mon Sep 17 00:00:00 2001 From: helga_sh Date: Mon, 6 Jul 2020 17:39:18 +0300 Subject: [PATCH 0059/1862] Top k elements in an array --- .../BruteForceTopKElementsFinder.java | 26 ++++++++++ .../MaxHeapTopKElementsFinder.java | 26 ++++++++++ .../topnelements/TopKElementsFinder.java | 7 +++ .../TreeSetTopKElementsFinder.java | 17 +++++++ .../TopKElementsFinderUnitTest.java | 50 +++++++++++++++++++ 5 files changed, 126 insertions(+) create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/BruteForceTopKElementsFinder.java create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/MaxHeapTopKElementsFinder.java create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TopKElementsFinder.java create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TreeSetTopKElementsFinder.java create mode 100644 algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/topkelements/TopKElementsFinderUnitTest.java diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/BruteForceTopKElementsFinder.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/BruteForceTopKElementsFinder.java new file mode 100644 index 0000000000..d2a3acce16 --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/BruteForceTopKElementsFinder.java @@ -0,0 +1,26 @@ +package com.baeldung.algorithms.topnelements; + +import java.util.ArrayList; +import java.util.List; + +public class BruteForceTopKElementsFinder implements TopKElementsFinder { + + public List findTopK(List input, int k) { + List array = new ArrayList<>(input); + List topKList = new ArrayList<>(); + + for (int i = 0; i < k; i++) { + int maxIndex = 0; + + for (int j = 1; j < array.size(); j++) { + if (array.get(j) > array.get(maxIndex)) { + maxIndex = j; + } + } + + topKList.add(array.remove(maxIndex)); + } + + return topKList; + } +} diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/MaxHeapTopKElementsFinder.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/MaxHeapTopKElementsFinder.java new file mode 100644 index 0000000000..e39eb7ccb2 --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/MaxHeapTopKElementsFinder.java @@ -0,0 +1,26 @@ +package com.baeldung.algorithms.topnelements; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.PriorityQueue; + +public class MaxHeapTopKElementsFinder implements TopKElementsFinder { + + public List findTopK(List input, int k) { + PriorityQueue maxHeap = new PriorityQueue<>(); + + input.forEach(number -> { + maxHeap.add(number); + + if (maxHeap.size() > k) { + maxHeap.poll(); + } + }); + + List topKList = new ArrayList<>(maxHeap); + Collections.reverse(topKList); + + return topKList; + } +} diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TopKElementsFinder.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TopKElementsFinder.java new file mode 100644 index 0000000000..d1bd48efa5 --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TopKElementsFinder.java @@ -0,0 +1,7 @@ +package com.baeldung.algorithms.topnelements; + +import java.util.List; + +public interface TopKElementsFinder> { + List findTopK(List input, int k); +} diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TreeSetTopKElementsFinder.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TreeSetTopKElementsFinder.java new file mode 100644 index 0000000000..c1fc8914d0 --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TreeSetTopKElementsFinder.java @@ -0,0 +1,17 @@ +package com.baeldung.algorithms.topnelements; + +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.stream.Collectors; + +public class TreeSetTopKElementsFinder implements TopKElementsFinder { + + public List findTopK(List input, int k) { + Set sortedSet = new TreeSet<>(Comparator.reverseOrder()); + sortedSet.addAll(input); + + return sortedSet.stream().limit(k).collect(Collectors.toList()); + } +} diff --git a/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/topkelements/TopKElementsFinderUnitTest.java b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/topkelements/TopKElementsFinderUnitTest.java new file mode 100644 index 0000000000..5c02cefe23 --- /dev/null +++ b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/topkelements/TopKElementsFinderUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.algorithms.topkelements; + +import com.baeldung.algorithms.topnelements.BruteForceTopKElementsFinder; +import com.baeldung.algorithms.topnelements.MaxHeapTopKElementsFinder; +import com.baeldung.algorithms.topnelements.TopKElementsFinder; +import com.baeldung.algorithms.topnelements.TreeSetTopKElementsFinder; +import org.junit.Test; + +import java.util.Arrays; +import java.util.List; + +import static org.assertj.core.api.Java6Assertions.assertThat; + +public class TopKElementsFinderUnitTest { + private final TopKElementsFinder bruteForceFinder = new BruteForceTopKElementsFinder(); + private final TopKElementsFinder maxHeapFinder = new MaxHeapTopKElementsFinder(); + private final TopKElementsFinder treeSetFinder = new TreeSetTopKElementsFinder(); + + private final int k = 4; + private final List distinctIntegers = Arrays.asList(1, 2, 3, 9, 7, 6, 12); + private final List distinctIntegersTopK = Arrays.asList(9, 7, 6, 12); + private final List nonDistinctIntegers = Arrays.asList(1, 2, 3, 3, 9, 9, 7, 6, 12); + private final List nonDistinctIntegersTopK = Arrays.asList(9, 9, 7, 12); + + + @Test + public void givenArrayDistinctIntegers_whenBruteForceFindTopK_thenReturnKLargest() { + assertThat(bruteForceFinder.findTopK(distinctIntegers, k)).containsOnlyElementsOf(distinctIntegersTopK); + } + + @Test + public void givenArrayDistinctIntegers_whenMaxHeapFindTopK_thenReturnKLargest() { + assertThat(maxHeapFinder.findTopK(distinctIntegers, k)).containsOnlyElementsOf(distinctIntegersTopK); + } + + @Test + public void givenArrayDistinctIntegers_whenTreeSetFindTopK_thenReturnKLargest() { + assertThat(treeSetFinder.findTopK(distinctIntegers, k)).containsOnlyElementsOf(distinctIntegersTopK); + } + + @Test + public void givenArrayNonDistinctIntegers_whenBruteForceFindTopK_thenReturnKLargest() { + assertThat(bruteForceFinder.findTopK(nonDistinctIntegers, k)).containsOnlyElementsOf(nonDistinctIntegersTopK); + } + + @Test + public void givenArrayNonDistinctIntegers_whenMaxHeapFindTopK_thenReturnKLargest() { + assertThat(maxHeapFinder.findTopK(nonDistinctIntegers, k)).containsOnlyElementsOf(nonDistinctIntegersTopK); + } +} From 53ffdd9f3d3e5008455ac1d9634610c2b94b494e Mon Sep 17 00:00:00 2001 From: helga_sh Date: Mon, 6 Jul 2020 17:49:10 +0300 Subject: [PATCH 0060/1862] Rename folder --- .../BruteForceTopKElementsFinder.java | 2 +- .../MaxHeapTopKElementsFinder.java | 2 +- .../{topnelements => topkelements}/TopKElementsFinder.java | 2 +- .../TreeSetTopKElementsFinder.java | 2 +- .../algorithms/topkelements/TopKElementsFinderUnitTest.java | 4 ---- 5 files changed, 4 insertions(+), 8 deletions(-) rename algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/{topnelements => topkelements}/BruteForceTopKElementsFinder.java (93%) rename algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/{topnelements => topkelements}/MaxHeapTopKElementsFinder.java (93%) rename algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/{topnelements => topkelements}/TopKElementsFinder.java (74%) rename algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/{topnelements => topkelements}/TreeSetTopKElementsFinder.java (91%) diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/BruteForceTopKElementsFinder.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/BruteForceTopKElementsFinder.java similarity index 93% rename from algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/BruteForceTopKElementsFinder.java rename to algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/BruteForceTopKElementsFinder.java index d2a3acce16..c0962c7079 100644 --- a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/BruteForceTopKElementsFinder.java +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/BruteForceTopKElementsFinder.java @@ -1,4 +1,4 @@ -package com.baeldung.algorithms.topnelements; +package com.baeldung.algorithms.topkelements; import java.util.ArrayList; import java.util.List; diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/MaxHeapTopKElementsFinder.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/MaxHeapTopKElementsFinder.java similarity index 93% rename from algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/MaxHeapTopKElementsFinder.java rename to algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/MaxHeapTopKElementsFinder.java index e39eb7ccb2..16ae7f1254 100644 --- a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/MaxHeapTopKElementsFinder.java +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/MaxHeapTopKElementsFinder.java @@ -1,4 +1,4 @@ -package com.baeldung.algorithms.topnelements; +package com.baeldung.algorithms.topkelements; import java.util.ArrayList; import java.util.Collections; diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TopKElementsFinder.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/TopKElementsFinder.java similarity index 74% rename from algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TopKElementsFinder.java rename to algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/TopKElementsFinder.java index d1bd48efa5..a9c7881408 100644 --- a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TopKElementsFinder.java +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/TopKElementsFinder.java @@ -1,4 +1,4 @@ -package com.baeldung.algorithms.topnelements; +package com.baeldung.algorithms.topkelements; import java.util.List; diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TreeSetTopKElementsFinder.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/TreeSetTopKElementsFinder.java similarity index 91% rename from algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TreeSetTopKElementsFinder.java rename to algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/TreeSetTopKElementsFinder.java index c1fc8914d0..0b898df21d 100644 --- a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topnelements/TreeSetTopKElementsFinder.java +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/topkelements/TreeSetTopKElementsFinder.java @@ -1,4 +1,4 @@ -package com.baeldung.algorithms.topnelements; +package com.baeldung.algorithms.topkelements; import java.util.Comparator; import java.util.List; diff --git a/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/topkelements/TopKElementsFinderUnitTest.java b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/topkelements/TopKElementsFinderUnitTest.java index 5c02cefe23..41fa5e067e 100644 --- a/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/topkelements/TopKElementsFinderUnitTest.java +++ b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/topkelements/TopKElementsFinderUnitTest.java @@ -1,9 +1,5 @@ package com.baeldung.algorithms.topkelements; -import com.baeldung.algorithms.topnelements.BruteForceTopKElementsFinder; -import com.baeldung.algorithms.topnelements.MaxHeapTopKElementsFinder; -import com.baeldung.algorithms.topnelements.TopKElementsFinder; -import com.baeldung.algorithms.topnelements.TreeSetTopKElementsFinder; import org.junit.Test; import java.util.Arrays; From b2a0fcd76bcf6eaa70c99d530b383c6711239ec6 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 6 Jul 2020 16:10:46 +0000 Subject: [PATCH 0061/1862] BAEL-4302 : How can I list all classes loaded in a specific class loader --- .../loadedclasslisting/ClassLoaderType.java | 6 +++ .../baeldung/loadedclasslisting/Launcher.java | 51 +++++++++++++++++++ .../ListLoadedClassesAgent.java | 46 +++++++++++++++++ .../baeldung/loadedclasslisting/MANIFEST.MF | 1 + .../customLoader/ClassLoaderInfo.java | 12 +++++ .../customLoader/CustomClassLoader.java | 32 ++++++++++++ 6 files changed, 148 insertions(+) create mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java create mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java create mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java create mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/MANIFEST.MF create mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java create mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java new file mode 100644 index 0000000000..1111fc21fe --- /dev/null +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java @@ -0,0 +1,6 @@ +package com.baeldung.loadedclasslisting; + +public enum ClassLoaderType { + + SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM +} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java new file mode 100644 index 0000000000..19c42dfd8d --- /dev/null +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java @@ -0,0 +1,51 @@ +package com.baeldung.loadedclasslisting; + +import java.lang.reflect.Method; +import java.util.Arrays; + +import com.baeldung.loadedclasslisting.customLoader.ClassLoaderInfo; +import com.baeldung.loadedclasslisting.customLoader.CustomClassLoader; + +public class Launcher { + + private static ClassLoader customClassLoader; + + public static void main(String[] args) { + + printClassesLoadedBy(ClassLoaderType.BOOTSTRAP); + + printClassesLoadedBy(ClassLoaderType.SYSTEM); + + printClassesLoadedBy(ClassLoaderType.EXTENSION); + + printClassesLoadedBy(ClassLoaderType.CUSTOM); + } + + private static void printClassesLoadedBy(ClassLoaderType classLoaderType) { + Class[] classes; + if (classLoaderType.equals(ClassLoaderType.CUSTOM)) { + customClassLoader = customClassLoading(); + classes = ListLoadedClassesAgent.listLoadedClasses(customClassLoader); + } else { + classes = ListLoadedClassesAgent.listLoadedClasses(classLoaderType); + } + Arrays.asList(classes) + .forEach(clazz -> System.out.println( + classLoaderType + " ClassLoader : " + clazz.getCanonicalName())); + } + + private static CustomClassLoader customClassLoading() { + CustomClassLoader customClassLoader = new CustomClassLoader(); + Class c; + try { + c = customClassLoader.findClass(ClassLoaderInfo.class.getName()); + Object ob = c.getDeclaredConstructor() + .newInstance(); + Method md = c.getMethod("printClassLoaders"); + md.invoke(ob); + } catch (Exception e) { + e.printStackTrace(); + } + return customClassLoader; + } +} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java new file mode 100644 index 0000000000..03907f8b04 --- /dev/null +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java @@ -0,0 +1,46 @@ +package com.baeldung.loadedclasslisting; + +import java.lang.instrument.Instrumentation; + +public class ListLoadedClassesAgent { + + private static Instrumentation instrumentation; + + public static void premain(String agentArgs, Instrumentation instrumentation) { + ListLoadedClassesAgent.instrumentation = instrumentation; + } + + public static Class[] listLoadedClasses(ClassLoaderType classLoaderType) { + if (instrumentation == null) { + throw new IllegalStateException( + "ListLoadedClassesAgent is not initialized."); + } + return instrumentation.getInitiatedClasses( + getClassLoader(classLoaderType)); + } + + public static Class[] listLoadedClasses(ClassLoader classLoader) { + if (instrumentation == null) { + throw new IllegalStateException( + "ListLoadedClassesAgent is not initialized."); + } + return instrumentation.getInitiatedClasses(classLoader); + } + + private static ClassLoader getClassLoader(ClassLoaderType classLoaderType) { + ClassLoader classLoader = null; + switch (classLoaderType) { + case SYSTEM: + classLoader = ClassLoader.getSystemClassLoader(); + break; + case EXTENSION: + classLoader = ClassLoader.getSystemClassLoader().getParent(); + break; + case BOOTSTRAP: + break; + default: + break; + } + return classLoader; + } +} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/MANIFEST.MF b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/MANIFEST.MF new file mode 100644 index 0000000000..4a60bda0b7 --- /dev/null +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/MANIFEST.MF @@ -0,0 +1 @@ +Premain-Class: com.baeldung.loadedclasslisting.ListLoadedClassesAgent \ No newline at end of file diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java new file mode 100644 index 0000000000..a787b062d5 --- /dev/null +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java @@ -0,0 +1,12 @@ +package com.baeldung.loadedclasslisting.customLoader; + +import java.util.ArrayList; + +public class ClassLoaderInfo { + + public void printClassLoaders() throws ClassNotFoundException { + + System.out.println("Classloader of this class:" + ClassLoaderInfo.class.getClassLoader()); + System.out.println("Classloader of ArrayList:" + ArrayList.class.getClassLoader()); + } +} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java new file mode 100644 index 0000000000..a5f293f605 --- /dev/null +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java @@ -0,0 +1,32 @@ +package com.baeldung.loadedclasslisting.customLoader; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + +public class CustomClassLoader extends ClassLoader { + + @Override + public Class findClass(String name) throws ClassNotFoundException { + byte[] b = loadClassFromFile(name); + return defineClass(name, b, 0, b.length); + } + + private byte[] loadClassFromFile(String fileName) { + InputStream inputStream = getClass().getClassLoader() + .getResourceAsStream(fileName.replace('.', File.separatorChar) + ".class"); + byte[] buffer; + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + int nextValue = 0; + try { + while ((nextValue = inputStream.read()) != -1) { + byteStream.write(nextValue); + } + } catch (IOException e) { + e.printStackTrace(); + } + buffer = byteStream.toByteArray(); + return buffer; + } +} From 4f987c9198d52a4068454f7f9d3e61266e1ac08e Mon Sep 17 00:00:00 2001 From: joe zhang Date: Tue, 7 Jul 2020 13:20:06 +0800 Subject: [PATCH 0062/1862] update labmda function --- .../convertlisttomap/ListToMapUnitTest.java | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java b/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java index 5a875a904e..4ca5671e29 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java +++ b/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java @@ -24,13 +24,9 @@ public class ListToMapUnitTest { Map> convertedMap = new HashMap<>(); - Supplier> listSupplier = () -> { - return new ArrayList<>(); - }; + Supplier> listSupplier = ArrayList::new; - Supplier>> mapFactory = () -> { - return new HashMap<>(); - }; + Supplier>> mapFactory = HashMap::new; convertedMap = strings.stream() .collect(Collectors.groupingBy(String::length, mapFactory, Collectors.toCollection(listSupplier))); @@ -45,13 +41,9 @@ public class ListToMapUnitTest { Map> convertedMap = new HashMap<>(); - Supplier>> mapFactory = () -> { - return new HashMap<>(); - }; + Supplier>> mapFactory = HashMap::new; - Supplier> listSupplier = () -> { - return new ArrayList<>(); - }; + Supplier> listSupplier = ArrayList::new; BiConsumer>, String> accumulator = (response, element) -> { Integer key = element.length(); @@ -78,17 +70,11 @@ public class ListToMapUnitTest { Map> convertedMap = new HashMap<>(); - Supplier>> mapFactory = () -> { - return new HashMap<>(); - }; + Supplier>> mapFactory = HashMap::new; - Supplier> listSupplier = () -> { - return new ArrayList<>(); - }; + Supplier> listSupplier = ArrayList::new; - Function keyMapper = (element) -> { - return element.length(); - }; + Function keyMapper = String::length; Function> valueMapper = (element) -> { List collection = listSupplier.get(); From ecff38abf64bf603db9564f0640e705d847cd2d7 Mon Sep 17 00:00:00 2001 From: Daniel Garrett Date: Tue, 7 Jul 2020 16:14:30 +0100 Subject: [PATCH 0063/1862] feat: add test for assumeFalse --- .../assume/ConditionallyIgnoreTestsUnitTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java index 0a95ed4522..b5cc82d79d 100644 --- a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java @@ -2,8 +2,7 @@ package com.baeldung.assume; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; -import static org.junit.Assume.assumeThat; -import static org.junit.Assume.assumeTrue; +import static org.junit.Assume.*; import org.junit.Test; @@ -26,6 +25,14 @@ public class ConditionallyIgnoreTestsUnitTest { assertEquals("hello", "HELLO".toLowerCase()); } + @Test + public void whenAssumeFalseOnCondition_thenIgnore() { + final int codeVersion = 2; + assumeFalse(isCodeVersion2(codeVersion)); + + assertEquals("hello", "HELLO".toLowerCase()); + } + private boolean isCodeVersion2(final int codeVersion) { return codeVersion == 2; } From 0865321f82538eaa0e1b26a7731d1d4f7532bc2c Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Tue, 7 Jul 2020 19:01:50 +0200 Subject: [PATCH 0064/1862] JAVA-1645: Get rid of the overriden spring-boot.version property --- persistence-modules/spring-data-redis/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/persistence-modules/spring-data-redis/pom.xml b/persistence-modules/spring-data-redis/pom.xml index d2bf074d03..d271df31c7 100644 --- a/persistence-modules/spring-data-redis/pom.xml +++ b/persistence-modules/spring-data-redis/pom.xml @@ -98,7 +98,6 @@ 3.2.4 0.10.0 0.6 - 2.1.9.RELEASE From 749b832ef8ba3db73745b262fa580d8f610a29db Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Tue, 7 Jul 2020 19:02:09 +0200 Subject: [PATCH 0065/1862] JAVA-1645: Use ReactiveStringRedisTemplate --- .../spring/data/reactive/redis/config/RedisConfig.java | 5 ----- .../template/RedisTemplateListOpsIntegrationTest.java | 9 ++++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/config/RedisConfig.java b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/config/RedisConfig.java index d23d0092eb..de8e447ef8 100644 --- a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/config/RedisConfig.java +++ b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/reactive/redis/config/RedisConfig.java @@ -31,11 +31,6 @@ public class RedisConfig { return new ReactiveRedisTemplate<>(factory, context); } - @Bean - public ReactiveRedisTemplate reactiveRedisTemplateString(ReactiveRedisConnectionFactory connectionFactory) { - return new ReactiveRedisTemplate<>(connectionFactory, RedisSerializationContext.string()); - } - @Bean public ReactiveKeyCommands keyCommands(final ReactiveRedisConnectionFactory reactiveRedisConnectionFactory) { return reactiveRedisConnectionFactory.getReactiveConnection() diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateListOpsIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateListOpsIntegrationTest.java index 58846d7c27..cd5994c854 100644 --- a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateListOpsIntegrationTest.java +++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/reactive/redis/template/RedisTemplateListOpsIntegrationTest.java @@ -2,9 +2,6 @@ package com.baeldung.spring.data.reactive.redis.template; import com.baeldung.spring.data.reactive.redis.SpringRedisReactiveApplication; - -import java.io.IOException; - import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -13,7 +10,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.redis.core.ReactiveListOperations; -import org.springframework.data.redis.core.ReactiveRedisTemplate; +import org.springframework.data.redis.core.ReactiveStringRedisTemplate; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.junit4.SpringRunner; @@ -21,6 +18,8 @@ import reactor.core.publisher.Mono; import reactor.test.StepVerifier; import redis.embedded.RedisServerBuilder; +import java.io.IOException; + @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisReactiveApplication.class) @DirtiesContext(classMode = ClassMode.BEFORE_CLASS) @@ -30,7 +29,7 @@ public class RedisTemplateListOpsIntegrationTest { private static redis.embedded.RedisServer redisServer; @Autowired - private ReactiveRedisTemplate redisTemplate; + private ReactiveStringRedisTemplate redisTemplate; private ReactiveListOperations reactiveListOps; From 4b669dc6880a9cfb9dce1712ecf6d9637ac73259 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Wed, 8 Jul 2020 04:29:31 +0530 Subject: [PATCH 0066/1862] Hexagonal architecture in Java --- hexagonal-architecture-java/README.md | 3 ++ hexagonal-architecture-java/pom.xml | 19 ++++++++++++ .../java/com/baeldung/hexagonal/Main.java | 21 ++++++++++++++ .../hexagonal/adapters/FileWriterAdapter.java | 21 ++++++++++++++ .../adapters/InMemorySportsDataAdapter.java | 27 +++++++++++++++++ .../adapters/UserRequestAdapter.java | 21 ++++++++++++++ .../baeldung/hexagonal/core/SportsApp.java | 21 ++++++++++++++ .../hexagonal/model/SportRevenue.java | 29 +++++++++++++++++++ .../hexagonal/ports/FetchSportsRevenue.java | 7 +++++ .../baeldung/hexagonal/ports/UserRequest.java | 5 ++++ .../hexagonal/ports/WriteSportsRevenue.java | 7 +++++ pom.xml | 1 + 12 files changed, 182 insertions(+) create mode 100644 hexagonal-architecture-java/README.md create mode 100644 hexagonal-architecture-java/pom.xml create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/Main.java create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/FileWriterAdapter.java create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/InMemorySportsDataAdapter.java create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/UserRequestAdapter.java create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/core/SportsApp.java create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/model/SportRevenue.java create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/FetchSportsRevenue.java create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/UserRequest.java create mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/WriteSportsRevenue.java diff --git a/hexagonal-architecture-java/README.md b/hexagonal-architecture-java/README.md new file mode 100644 index 0000000000..35fe97a6ef --- /dev/null +++ b/hexagonal-architecture-java/README.md @@ -0,0 +1,3 @@ +## Hexagonal Architecture + +This module contains article about Hexagonal Architecture \ No newline at end of file diff --git a/hexagonal-architecture-java/pom.xml b/hexagonal-architecture-java/pom.xml new file mode 100644 index 0000000000..24a198279d --- /dev/null +++ b/hexagonal-architecture-java/pom.xml @@ -0,0 +1,19 @@ + + 4.0.0 + hcom.baeldung + hexagonal-architecture-java + 0.0.1-SNAPSHOT + + src + + + maven-compiler-plugin + 3.8.0 + + 1.8 + 1.8 + + + + + \ No newline at end of file diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/Main.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/Main.java new file mode 100644 index 0000000000..9feb12e37c --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/Main.java @@ -0,0 +1,21 @@ +package com.baeldung.hexagonal; + +import com.baeldung.hexagonal.adapters.FileWriterAdapter; +import com.baeldung.hexagonal.adapters.InMemorySportsDataAdapter; +import com.baeldung.hexagonal.adapters.UserRequestAdapter; +import com.baeldung.hexagonal.ports.FetchSportsRevenue; +import com.baeldung.hexagonal.ports.UserRequest; +import com.baeldung.hexagonal.ports.WriteSportsRevenue; + +public class Main { + + public static void main(String[] args) { + FetchSportsRevenue sportsRevenue = new InMemorySportsDataAdapter(); + WriteSportsRevenue writeSportsRevenue = new FileWriterAdapter(); + UserRequest userReq = new UserRequestAdapter(sportsRevenue, writeSportsRevenue); + + userReq.processRequest("Football"); + userReq.processRequest("Cricket"); + } + +} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/FileWriterAdapter.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/FileWriterAdapter.java new file mode 100644 index 0000000000..879cf18bc2 --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/FileWriterAdapter.java @@ -0,0 +1,21 @@ +package com.baeldung.hexagonal.adapters; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import com.baeldung.hexagonal.model.SportRevenue; +import com.baeldung.hexagonal.ports.WriteSportsRevenue; + +public class FileWriterAdapter implements WriteSportsRevenue { + + @Override + public void writeSportsReveue(SportRevenue sportRevenue) { + try (FileWriter fw = new FileWriter(new File("revenue.txt"),true)) { + fw.write(sportRevenue.toString()); + fw.write(System.lineSeparator()); + } catch (IOException e) { + + } + } +} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/InMemorySportsDataAdapter.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/InMemorySportsDataAdapter.java new file mode 100644 index 0000000000..1d0c8c4611 --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/InMemorySportsDataAdapter.java @@ -0,0 +1,27 @@ +package com.baeldung.hexagonal.adapters; + +import java.util.Arrays; +import java.util.List; + +import com.baeldung.hexagonal.model.SportRevenue; +import com.baeldung.hexagonal.ports.FetchSportsRevenue; + +public class InMemorySportsDataAdapter implements FetchSportsRevenue { + + List data; + + public InMemorySportsDataAdapter() { + data = Arrays.asList( + new SportRevenue("Football",2200000), + new SportRevenue("Cricket", 1700000), + new SportRevenue("Baseball",1567000)); + } + + @Override + public SportRevenue retrieveSportRevenue(String sportName) { + return data.stream() + .filter(category -> sportName.equals(category.getName())) + .findAny().orElse(null); + } + +} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/UserRequestAdapter.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/UserRequestAdapter.java new file mode 100644 index 0000000000..0158b52576 --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/UserRequestAdapter.java @@ -0,0 +1,21 @@ +package com.baeldung.hexagonal.adapters; + +import com.baeldung.hexagonal.core.SportsApp; +import com.baeldung.hexagonal.ports.FetchSportsRevenue; +import com.baeldung.hexagonal.ports.UserRequest; +import com.baeldung.hexagonal.ports.WriteSportsRevenue; + +public class UserRequestAdapter implements UserRequest { + + private SportsApp sportsApp; + + public UserRequestAdapter(FetchSportsRevenue sportsRevenue, WriteSportsRevenue writeSportsRevenue) { + sportsApp = new SportsApp(sportsRevenue, writeSportsRevenue); + } + + @Override + public void processRequest(String sportName) { + sportsApp.fetchAndWrite(sportName); + } + +} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/core/SportsApp.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/core/SportsApp.java new file mode 100644 index 0000000000..fc7591aee9 --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/core/SportsApp.java @@ -0,0 +1,21 @@ +package com.baeldung.hexagonal.core; + +import com.baeldung.hexagonal.model.SportRevenue; +import com.baeldung.hexagonal.ports.FetchSportsRevenue; +import com.baeldung.hexagonal.ports.WriteSportsRevenue; + +public class SportsApp { + + private FetchSportsRevenue sportsRevenue; + private WriteSportsRevenue writeSportsRevenue; + + public SportsApp(FetchSportsRevenue sportsCategories, WriteSportsRevenue writeSportsRevenue) { + this.sportsRevenue = sportsCategories; + this.writeSportsRevenue = writeSportsRevenue; + } + + public void fetchAndWrite(String sportName) { + SportRevenue sportRevenue = sportsRevenue.retrieveSportRevenue(sportName); + writeSportsRevenue.writeSportsReveue(sportRevenue); + } +} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/model/SportRevenue.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/model/SportRevenue.java new file mode 100644 index 0000000000..62a09a738c --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/model/SportRevenue.java @@ -0,0 +1,29 @@ +package com.baeldung.hexagonal.model; + +public class SportRevenue { + private String name; + private double revenue; + + public SportRevenue(String name, double revenue) { + this.name = name; + this.revenue = revenue; + } + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public double getRevenue() { + return revenue; + } + public void setRevenue(double revenue) { + this.revenue = revenue; + } + @Override + public String toString() { + return "SportRevenue [name=" + name + ", revenue=" + revenue + "]"; + } + +} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/FetchSportsRevenue.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/FetchSportsRevenue.java new file mode 100644 index 0000000000..ede4f2420d --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/FetchSportsRevenue.java @@ -0,0 +1,7 @@ +package com.baeldung.hexagonal.ports; + +import com.baeldung.hexagonal.model.SportRevenue; + +public interface FetchSportsRevenue { + public SportRevenue retrieveSportRevenue(String sportName); +} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/UserRequest.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/UserRequest.java new file mode 100644 index 0000000000..1ff7d4d1c6 --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/UserRequest.java @@ -0,0 +1,5 @@ +package com.baeldung.hexagonal.ports; + +public interface UserRequest { + public void processRequest(String sportName); +} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/WriteSportsRevenue.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/WriteSportsRevenue.java new file mode 100644 index 0000000000..2aa48d6a92 --- /dev/null +++ b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/WriteSportsRevenue.java @@ -0,0 +1,7 @@ +package com.baeldung.hexagonal.ports; + +import com.baeldung.hexagonal.model.SportRevenue; + +public interface WriteSportsRevenue { + public void writeSportsReveue(SportRevenue sportRevenue); +} diff --git a/pom.xml b/pom.xml index 1db715147a..44dd9f2467 100644 --- a/pom.xml +++ b/pom.xml @@ -558,6 +558,7 @@ rxjava-operators atomikos + hexagonal-architecture-java From d7f9bec70b353e64c30dd147f4fe50cbcd8d23d0 Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Thu, 9 Jul 2020 09:59:50 +0300 Subject: [PATCH 0067/1862] Update core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java Co-authored-by: KevinGilmore --- .../baeldung/versioncomparison/VersionComparisonUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java index 7221cdf6ec..a8e2e53853 100644 --- a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java +++ b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java @@ -88,7 +88,7 @@ public class VersionComparisonUnitTest { Version version1_1_snapshot = new Version(1, 1, 0, "snapshot", null, null); assertEquals(version1_1.compareTo(version1_1_snapshot), 0); - assertEquals(version1_1_snapshot.isSnapshot(), true); + assertTrue(version1_1_snapshot.isSnapshot()); } @Test From 0c612f78e839989b80a5fbcca4c3f7c315995829 Mon Sep 17 00:00:00 2001 From: Anshul Bansal Date: Thu, 9 Jul 2020 10:01:20 +0300 Subject: [PATCH 0068/1862] used assertFalse in place of assertEquals --- .../baeldung/versioncomparison/VersionComparisonUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java index a8e2e53853..859d54599c 100644 --- a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java +++ b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java @@ -120,7 +120,7 @@ public class VersionComparisonUnitTest { assertEquals(version1_1.diff("1.1.1"), VersionDiff.PATCH); assertTrue(version1_1.isStable()); - assertEquals(version1_1_alpha.isStable(), false); + assertFalse(version1_1_alpha.isStable()); } @Test From 2e66a84425802f28ebd0c7bcdcf15352aeaba970 Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Thu, 9 Jul 2020 10:02:05 +0300 Subject: [PATCH 0069/1862] correct import --- .../baeldung/versioncomparison/VersionComparisonUnitTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java index 859d54599c..be8dca0d10 100644 --- a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java +++ b/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java @@ -10,6 +10,7 @@ import org.apache.maven.artifact.versioning.ComparableVersion; import org.gradle.util.VersionNumber; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; public class VersionComparisonUnitTest { From 7f16e3e80e071025c2b3dffb0f066a4355fb9ca9 Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Thu, 9 Jul 2020 10:13:30 +0300 Subject: [PATCH 0070/1862] BAEL-4175 - moved code to a new module - core-java-string-operations-3 --- .../core-java-string-operations-2/pom.xml | 26 ------ .../core-java-string-operations-3/pom.xml | 89 +++++++++++++++++++ .../versioncomparison/VersionCompare.java | 0 .../VersionComparisonUnitTest.java | 0 core-java-modules/pom.xml | 1 + 5 files changed, 90 insertions(+), 26 deletions(-) create mode 100644 core-java-modules/core-java-string-operations-3/pom.xml rename core-java-modules/{core-java-string-operations-2 => core-java-string-operations-3}/src/main/java/com/baeldung/versioncomparison/VersionCompare.java (100%) rename core-java-modules/{core-java-string-operations-2 => core-java-string-operations-3}/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java (100%) diff --git a/core-java-modules/core-java-string-operations-2/pom.xml b/core-java-modules/core-java-string-operations-2/pom.xml index cbf5564206..db32bf97a1 100644 --- a/core-java-modules/core-java-string-operations-2/pom.xml +++ b/core-java-modules/core-java-string-operations-2/pom.xml @@ -75,26 +75,6 @@ ${assertj.version} test - - org.apache.maven - maven-artifact - 3.6.3 - - - org.gradle - gradle-core - 6.1.1 - - - com.fasterxml.jackson.core - jackson-core - 2.11.1 - - - com.vdurmont - semver4j - 3.1.0 - @@ -140,10 +120,4 @@ 1.14 - - - gradle-repo - https://repo.gradle.org/gradle/libs-releases-local/ - - diff --git a/core-java-modules/core-java-string-operations-3/pom.xml b/core-java-modules/core-java-string-operations-3/pom.xml new file mode 100644 index 0000000000..210c31b29a --- /dev/null +++ b/core-java-modules/core-java-string-operations-3/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + core-java-string-operations-3 + 0.1.0-SNAPSHOT + core-java-string-operations-3 + jar + + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../ + + + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.apache.maven + maven-artifact + 3.6.3 + + + org.gradle + gradle-core + 6.1.1 + + + com.fasterxml.jackson.core + jackson-core + 2.11.1 + + + com.vdurmont + semver4j + 3.1.0 + + + + + core-java-string-operations-3 + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.0 + + + package + + shade + + + + + org.openjdk.jmh.Main + + + + + + + + + + src/main/resources + true + + + + + + 3.6.1 + + + + + gradle-repo + https://repo.gradle.org/gradle/libs-releases-local/ + + + diff --git a/core-java-modules/core-java-string-operations-2/src/main/java/com/baeldung/versioncomparison/VersionCompare.java b/core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/versioncomparison/VersionCompare.java similarity index 100% rename from core-java-modules/core-java-string-operations-2/src/main/java/com/baeldung/versioncomparison/VersionCompare.java rename to core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/versioncomparison/VersionCompare.java diff --git a/core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java similarity index 100% rename from core-java-modules/core-java-string-operations-2/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java rename to core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 26c374b51d..f55f1231f9 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -123,6 +123,7 @@ core-java-string-conversions-2 core-java-string-operations core-java-string-operations-2 + core-java-string-operations-3 core-java-strings core-java-sun From a027dc8833c7fc2f552d64f424e7b365b94c93e0 Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Thu, 9 Jul 2020 10:19:08 +0300 Subject: [PATCH 0071/1862] POM fixes --- .../core-java-string-operations-3/pom.xml | 44 ++++--------------- 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/core-java-modules/core-java-string-operations-3/pom.xml b/core-java-modules/core-java-string-operations-3/pom.xml index 210c31b29a..5edff0e090 100644 --- a/core-java-modules/core-java-string-operations-3/pom.xml +++ b/core-java-modules/core-java-string-operations-3/pom.xml @@ -25,59 +25,31 @@ org.apache.maven maven-artifact - 3.6.3 + ${maven-artifact.version} org.gradle gradle-core - 6.1.1 + ${gradle-core.version} com.fasterxml.jackson.core jackson-core - 2.11.1 + ${jackson-core.version} com.vdurmont semver4j - 3.1.0 + ${semver4j.version} - - core-java-string-operations-3 - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.0 - - - package - - shade - - - - - org.openjdk.jmh.Main - - - - - - - - - - src/main/resources - true - - - - 3.6.1 + 3.6.3 + 6.1.1 + 2.11.1 + 3.1.0 From 06dcb4ea6d3ad93a624fa103000d3d4ee8946abc Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Fri, 10 Jul 2020 20:06:12 +0530 Subject: [PATCH 0072/1862] Created new module core-java-reflection-2 --- .../core-java-reflection-2/pom.xml | 45 +++ .../access/privatefields/Person.java | 0 .../AccessPrivateFieldsUnitTest.java | 0 core-java-modules/pom.xml | 291 +++++++++--------- 4 files changed, 191 insertions(+), 145 deletions(-) create mode 100644 core-java-modules/core-java-reflection-2/pom.xml rename core-java-modules/{core-java-reflection => core-java-reflection-2}/src/main/java/com/baeldung/reflection/access/privatefields/Person.java (100%) rename core-java-modules/{core-java-reflection => core-java-reflection-2}/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java (100%) diff --git a/core-java-modules/core-java-reflection-2/pom.xml b/core-java-modules/core-java-reflection-2/pom.xml new file mode 100644 index 0000000000..d711dabd1a --- /dev/null +++ b/core-java-modules/core-java-reflection-2/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + core-java-reflection-2 + 0.1.0-SNAPSHOT + core-java-reflection-2 + jar + + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../ + + + + core-java-reflection-2 + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${source.version} + ${target.version} + -parameters + + + + + + + 3.8.0 + 1.8 + 1.8 + + diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/access/privatefields/Person.java similarity index 100% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java rename to core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/access/privatefields/Person.java diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java similarity index 100% rename from core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java rename to core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 26c374b51d..272da94f5d 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -1,169 +1,170 @@ - - 4.0.0 - com.baeldung.core-java-modules - core-java-modules - core-java-modules - pom + + 4.0.0 + com.baeldung.core-java-modules + core-java-modules + core-java-modules + pom - - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../parent-java - + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + - - core-java - - - - - core-java-8 - core-java-8-2 + + core-java + + + + + core-java-8 + core-java-8-2 - - - - - + + + + + - core-java-annotations + core-java-annotations - core-java-arrays-sorting - core-java-arrays-guides - core-java-arrays-multidimensional - core-java-arrays-convert - core-java-arrays-operations-basic - core-java-arrays-operations-advanced - - core-java-collections - core-java-collections-2 - core-java-collections-3 - core-java-collections-array-list - core-java-collections-list - core-java-collections-list-2 - core-java-collections-list-3 - core-java-collections-maps - core-java-collections-maps-2 - core-java-collections-maps-3 - + core-java-arrays-sorting + core-java-arrays-guides + core-java-arrays-multidimensional + core-java-arrays-convert + core-java-arrays-operations-basic + core-java-arrays-operations-advanced - core-java-concurrency-2 - core-java-concurrency-advanced - core-java-concurrency-advanced-2 - core-java-concurrency-advanced-3 - core-java-concurrency-basic - core-java-concurrency-basic-2 - core-java-concurrency-collections + core-java-collections + core-java-collections-2 + core-java-collections-3 + core-java-collections-array-list + core-java-collections-list + core-java-collections-list-2 + core-java-collections-list-3 + core-java-collections-maps + core-java-collections-maps-2 + core-java-collections-maps-3 + - - core-java-date-operations-2 - - + core-java-concurrency-2 + core-java-concurrency-advanced + core-java-concurrency-advanced-2 + core-java-concurrency-advanced-3 + core-java-concurrency-basic + core-java-concurrency-basic-2 + core-java-concurrency-collections - core-java-exceptions - core-java-exceptions-2 + + core-java-date-operations-2 + + - core-java-function + core-java-exceptions + core-java-exceptions-2 - core-java-io - core-java-io-2 - core-java-io-apis - core-java-io-conversions - core-java-io-conversions-2 + core-java-function - core-java-jar - core-java-jndi - - core-java-jvm + core-java-io + core-java-io-2 + core-java-io-apis + core-java-io-conversions + core-java-io-conversions-2 - core-java-lambdas - core-java-lang - core-java-lang-2 - core-java-lang-math - core-java-lang-math-2 - core-java-lang-oop-constructors - core-java-lang-oop-patterns - core-java-lang-oop-generics - core-java-lang-oop-modifiers - core-java-lang-oop-types - core-java-lang-oop-inheritance - core-java-lang-oop-methods - core-java-lang-oop-others - core-java-lang-operators - core-java-lang-syntax - core-java-lang-syntax-2 + core-java-jar + core-java-jndi + + core-java-jvm - core-java-networking - core-java-networking-2 - core-java-nio - core-java-nio-2 + core-java-lambdas + core-java-lang + core-java-lang-2 + core-java-lang-math + core-java-lang-math-2 + core-java-lang-oop-constructors + core-java-lang-oop-patterns + core-java-lang-oop-generics + core-java-lang-oop-modifiers + core-java-lang-oop-types + core-java-lang-oop-inheritance + core-java-lang-oop-methods + core-java-lang-oop-others + core-java-lang-operators + core-java-lang-syntax + core-java-lang-syntax-2 - core-java-optional - + core-java-networking + core-java-networking-2 + core-java-nio + core-java-nio-2 - core-java-perf + core-java-optional + - core-java-reflection + core-java-perf - core-java-security - core-java-security-2 - core-java-streams - core-java-streams-2 - core-java-streams-3 - core-java-string-algorithms - core-java-string-algorithms-2 - core-java-string-algorithms-3 - core-java-string-apis - core-java-string-conversions - core-java-string-conversions-2 - core-java-string-operations - core-java-string-operations-2 - core-java-strings - core-java-sun + core-java-reflection + core-java-reflection-2 - core-java-regex - + core-java-security + core-java-security-2 + core-java-streams + core-java-streams-2 + core-java-streams-3 + core-java-string-algorithms + core-java-string-algorithms-2 + core-java-string-algorithms-3 + core-java-string-apis + core-java-string-conversions + core-java-string-conversions-2 + core-java-string-operations + core-java-string-operations-2 + core-java-strings + core-java-sun - - pre-jpms - + core-java-regex + - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - - + + pre-jpms + - - - - org.junit.jupiter - junit-jupiter - ${junit-jupiter.version} - test - - - org.junit.vintage - junit-vintage-engine - ${junit-jupiter.version} - test - - - + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + - - 2.22.2 - 5.6.2 - + + + + org.junit.jupiter + junit-jupiter + ${junit-jupiter.version} + test + + + org.junit.vintage + junit-vintage-engine + ${junit-jupiter.version} + test + + + + + + 2.22.2 + 5.6.2 + From a86a226237ce6fb412d555700c1820750a23c84d Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Fri, 10 Jul 2020 20:27:38 +0530 Subject: [PATCH 0073/1862] Revert "Created new module core-java-reflection-2" This reverts commit 06dcb4ea6d3ad93a624fa103000d3d4ee8946abc. --- .../core-java-reflection-2/pom.xml | 45 --- .../access/privatefields/Person.java | 0 .../AccessPrivateFieldsUnitTest.java | 0 core-java-modules/pom.xml | 291 +++++++++--------- 4 files changed, 145 insertions(+), 191 deletions(-) delete mode 100644 core-java-modules/core-java-reflection-2/pom.xml rename core-java-modules/{core-java-reflection-2 => core-java-reflection}/src/main/java/com/baeldung/reflection/access/privatefields/Person.java (100%) rename core-java-modules/{core-java-reflection-2 => core-java-reflection}/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java (100%) diff --git a/core-java-modules/core-java-reflection-2/pom.xml b/core-java-modules/core-java-reflection-2/pom.xml deleted file mode 100644 index d711dabd1a..0000000000 --- a/core-java-modules/core-java-reflection-2/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - 4.0.0 - core-java-reflection-2 - 0.1.0-SNAPSHOT - core-java-reflection-2 - jar - - com.baeldung.core-java-modules - core-java-modules - 0.0.1-SNAPSHOT - ../ - - - - core-java-reflection-2 - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${source.version} - ${target.version} - -parameters - - - - - - - 3.8.0 - 1.8 - 1.8 - - diff --git a/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/access/privatefields/Person.java b/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java similarity index 100% rename from core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/access/privatefields/Person.java rename to core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java diff --git a/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java similarity index 100% rename from core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java rename to core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 272da94f5d..26c374b51d 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -1,170 +1,169 @@ - - 4.0.0 - com.baeldung.core-java-modules - core-java-modules - core-java-modules - pom + + 4.0.0 + com.baeldung.core-java-modules + core-java-modules + core-java-modules + pom - - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../parent-java - + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + - - core-java - - - - - core-java-8 - core-java-8-2 + + core-java + + + + + core-java-8 + core-java-8-2 - - - - - + + + + + - core-java-annotations + core-java-annotations - core-java-arrays-sorting - core-java-arrays-guides - core-java-arrays-multidimensional - core-java-arrays-convert - core-java-arrays-operations-basic - core-java-arrays-operations-advanced + core-java-arrays-sorting + core-java-arrays-guides + core-java-arrays-multidimensional + core-java-arrays-convert + core-java-arrays-operations-basic + core-java-arrays-operations-advanced + + core-java-collections + core-java-collections-2 + core-java-collections-3 + core-java-collections-array-list + core-java-collections-list + core-java-collections-list-2 + core-java-collections-list-3 + core-java-collections-maps + core-java-collections-maps-2 + core-java-collections-maps-3 + - core-java-collections - core-java-collections-2 - core-java-collections-3 - core-java-collections-array-list - core-java-collections-list - core-java-collections-list-2 - core-java-collections-list-3 - core-java-collections-maps - core-java-collections-maps-2 - core-java-collections-maps-3 - + core-java-concurrency-2 + core-java-concurrency-advanced + core-java-concurrency-advanced-2 + core-java-concurrency-advanced-3 + core-java-concurrency-basic + core-java-concurrency-basic-2 + core-java-concurrency-collections - core-java-concurrency-2 - core-java-concurrency-advanced - core-java-concurrency-advanced-2 - core-java-concurrency-advanced-3 - core-java-concurrency-basic - core-java-concurrency-basic-2 - core-java-concurrency-collections + + core-java-date-operations-2 + + - - core-java-date-operations-2 - - + core-java-exceptions + core-java-exceptions-2 - core-java-exceptions - core-java-exceptions-2 + core-java-function - core-java-function + core-java-io + core-java-io-2 + core-java-io-apis + core-java-io-conversions + core-java-io-conversions-2 - core-java-io - core-java-io-2 - core-java-io-apis - core-java-io-conversions - core-java-io-conversions-2 + core-java-jar + core-java-jndi + + core-java-jvm - core-java-jar - core-java-jndi - - core-java-jvm + core-java-lambdas + core-java-lang + core-java-lang-2 + core-java-lang-math + core-java-lang-math-2 + core-java-lang-oop-constructors + core-java-lang-oop-patterns + core-java-lang-oop-generics + core-java-lang-oop-modifiers + core-java-lang-oop-types + core-java-lang-oop-inheritance + core-java-lang-oop-methods + core-java-lang-oop-others + core-java-lang-operators + core-java-lang-syntax + core-java-lang-syntax-2 - core-java-lambdas - core-java-lang - core-java-lang-2 - core-java-lang-math - core-java-lang-math-2 - core-java-lang-oop-constructors - core-java-lang-oop-patterns - core-java-lang-oop-generics - core-java-lang-oop-modifiers - core-java-lang-oop-types - core-java-lang-oop-inheritance - core-java-lang-oop-methods - core-java-lang-oop-others - core-java-lang-operators - core-java-lang-syntax - core-java-lang-syntax-2 + core-java-networking + core-java-networking-2 + core-java-nio + core-java-nio-2 - core-java-networking - core-java-networking-2 - core-java-nio - core-java-nio-2 + core-java-optional + - core-java-optional - + core-java-perf - core-java-perf + core-java-reflection - core-java-reflection - core-java-reflection-2 + core-java-security + core-java-security-2 + core-java-streams + core-java-streams-2 + core-java-streams-3 + core-java-string-algorithms + core-java-string-algorithms-2 + core-java-string-algorithms-3 + core-java-string-apis + core-java-string-conversions + core-java-string-conversions-2 + core-java-string-operations + core-java-string-operations-2 + core-java-strings + core-java-sun - core-java-security - core-java-security-2 - core-java-streams - core-java-streams-2 - core-java-streams-3 - core-java-string-algorithms - core-java-string-algorithms-2 - core-java-string-algorithms-3 - core-java-string-apis - core-java-string-conversions - core-java-string-conversions-2 - core-java-string-operations - core-java-string-operations-2 - core-java-strings - core-java-sun + core-java-regex + - core-java-regex - + + pre-jpms + - - pre-jpms - + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin.version} - - - - + + + + org.junit.jupiter + junit-jupiter + ${junit-jupiter.version} + test + + + org.junit.vintage + junit-vintage-engine + ${junit-jupiter.version} + test + + + - - - - org.junit.jupiter - junit-jupiter - ${junit-jupiter.version} - test - - - org.junit.vintage - junit-vintage-engine - ${junit-jupiter.version} - test - - - - - - 2.22.2 - 5.6.2 - + + 2.22.2 + 5.6.2 + From 2fa700d339d9a9d2ab499c26875559dffdd24c4c Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Fri, 10 Jul 2020 20:47:46 +0530 Subject: [PATCH 0074/1862] Added new module core-java-reflection-2 --- .../core-java-reflection-2/README.MD | 3 ++ .../core-java-reflection-2/pom.xml | 44 +++++++++++++++++++ .../access/privatefields/Person.java | 0 .../AccessPrivateFieldsUnitTest.java | 0 core-java-modules/pom.xml | 1 + 5 files changed, 48 insertions(+) create mode 100644 core-java-modules/core-java-reflection-2/README.MD create mode 100644 core-java-modules/core-java-reflection-2/pom.xml rename core-java-modules/{core-java-reflection => core-java-reflection-2}/src/main/java/com/baeldung/reflection/access/privatefields/Person.java (100%) rename core-java-modules/{core-java-reflection => core-java-reflection-2}/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java (100%) diff --git a/core-java-modules/core-java-reflection-2/README.MD b/core-java-modules/core-java-reflection-2/README.MD new file mode 100644 index 0000000000..7658851a4d --- /dev/null +++ b/core-java-modules/core-java-reflection-2/README.MD @@ -0,0 +1,3 @@ +## Relevant Articles + +- [Reading the Value of 'private' Fields from a Different Class in Java](https://www.baeldung.com/) \ No newline at end of file diff --git a/core-java-modules/core-java-reflection-2/pom.xml b/core-java-modules/core-java-reflection-2/pom.xml new file mode 100644 index 0000000000..17cad52271 --- /dev/null +++ b/core-java-modules/core-java-reflection-2/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + core-java-reflection-2 + 0.1.0-SNAPSHOT + core-java-reflection-2 + jar + + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../ + + + + core-java-reflection-2 + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${source.version} + ${target.version} + -parameters + + + + + + + 3.8.0 + 1.8 + 1.8 + + \ No newline at end of file diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/access/privatefields/Person.java similarity index 100% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/access/privatefields/Person.java rename to core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/access/privatefields/Person.java diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java similarity index 100% rename from core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java rename to core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/access/privatefields/AccessPrivateFieldsUnitTest.java diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index d01a7cc792..4f26c194ee 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -110,6 +110,7 @@ core-java-perf core-java-reflection + core-java-reflection-2 core-java-security core-java-security-2 From 3e31cb49b16682206ba189db0233d1e5bc0b43fd Mon Sep 17 00:00:00 2001 From: STS Date: Sat, 11 Jul 2020 10:31:02 +0200 Subject: [PATCH 0075/1862] changes after adding excel file --- .../poi/excel/setFormula/ExcelFormula.java | 32 +++++------- .../src/main/resources/SetFormulaTest.xlsx | Bin 0 -> 8014 bytes .../setFormula/ExcelFormulaUnitTest.java | 46 +++++++++++++----- 3 files changed, 45 insertions(+), 33 deletions(-) create mode 100644 apache-poi/src/main/resources/SetFormulaTest.xlsx diff --git a/apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java b/apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java index 7bd8d8a035..8b1ca5a89a 100644 --- a/apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java +++ b/apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java @@ -1,34 +1,26 @@ package com.baeldung.poi.excel.setFormula; -import org.apache.poi.ss.usermodel.CellValue; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; -import java.util.List; public class ExcelFormula { - XSSFWorkbook excel; - public XSSFSheet inserData(List dataList) { - excel = new XSSFWorkbook(); - XSSFSheet sheet = excel.createSheet(); - int rowNum =0 ; - for (Integer data : dataList){ - sheet.createRow(rowNum++).createCell(0).setCellValue(data); - } - return sheet; - } - public double setFormula(String formula) throws IOException { - XSSFSheet sheet = excel.getSheetAt(0); + public double setFormula(String fileLocation, XSSFWorkbook wb, String formula) throws IOException { + XSSFSheet sheet = wb.getSheetAt(0); int lastCellNum = sheet.getRow(0).getLastCellNum(); - XSSFCell formulaCell = sheet.getRow(0).createCell(lastCellNum + 1); + XSSFCell formulaCell = sheet.getRow(0).createCell(lastCellNum); formulaCell.setCellFormula(formula); - XSSFFormulaEvaluator formulaEvaluator = excel.getCreationHelper().createFormulaEvaluator(); - CellValue evaluate = formulaEvaluator.evaluate(formulaCell); - if(excel != null) - excel.close(); - return evaluate.getNumberValue(); + XSSFFormulaEvaluator formulaEvaluator = wb.getCreationHelper().createFormulaEvaluator(); + formulaEvaluator.evaluateFormulaCell(formulaCell); + FileOutputStream fileOut = new FileOutputStream(new File(fileLocation)); + wb.write(fileOut); + wb.close(); + fileOut.close(); + return formulaCell.getNumericCellValue(); } } diff --git a/apache-poi/src/main/resources/SetFormulaTest.xlsx b/apache-poi/src/main/resources/SetFormulaTest.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..a0fe73f0ebe74ad3ca9020e685c4a6f0564687e5 GIT binary patch literal 8014 zcmeHM1zS|x8XiEpX6O`YknWc5PHB)35u{;gq`Nz%YmhEMN?J;gM!F>=grT|Px%XVp z@tpe$?pgbJ_L|wV-|yM8_WOPBTJKU*M0kJ)Kmwou002rrp=R%x3LF4{@&Ew91)#ti zNZQ-ESlYRmXn8nTIvcUNzp{Ol{{WsL7XS~t|DX1MJOUMoLn__uKxwGljpPPP#A2-& z3eQ16KTZn+h3T5S*%X_{mx((OTxgA09{x+d8ndx4&LUhn!@SdYHesc0klD0YUAW3~ zh1N#1H<3*z@%U+lniKBG_zUp0bKlRO*Uln!2Go-4R46hEqx!od>rg@A$g;Vg=%?@S zHBt?DG8zD(1>=FGZHg-z>7JOp+3&@upVHx1kTK#fT~@(^!L2R!F{HUPPjPUWTITbyR1I*9 z^(hG|ZV_1sfk?W)exI`5lG#Ni+?0go!P}7PCcfOSiDQ|5GbzQpn4)0tMM(p5NfM2{w*bmmik_69=Lyq(CaVF9 zVsgB5D3wTy&NQ#UqU*UTc<-PplJT3l19~RV%Bdr5AK|tDGmc8$KycwRst}{gi|X6L zE;+#-BMRLjf_@Ug_@j`4#)5H&ErfU6*4|{%g+vAzeGiosn+Hz`qwa-rh4-|s^(DW| zjOCUy(wrRFEpxXOf$d|d1>U_DOR<(CR7(zL2@mPWqLu9&x)>2TPRI$?xgv8kjVL@$;H<7$(4n_lKY#1 zmK{6?LznthBPct2T>lQInP9l`n|I|x%p+b2G$?-nXVvE1nT|CAsk|jczKaYUl-Px- zd0c1aFf2EKanR~a<{400bFjCT0OuS1yvR-q^b=N-+?IT`oe^rN_NdB>GU&xZ$ZqS9 zv7BIZ0u7d)+D+10pF95aCq=L<)$kEs+QWWFVJQuD!ihZfl_LcvS+YCRdy`9&nko|I zukKA3?+B5~7?I{9Xnp*xs%!XGNUHcatsoWqQFlRKk}JXUC~=KJSfyS!Dv=W;##kfj zI8ld~vIb99DRLsO3DE!)r6^&MjLU=fiK%7+F3`5lw%gvL>hDF<2M z_yUt{oCrb(iL+I`?A2{aQ|o%El>1xXh{c|YJ&l^yG^g+;dQOwyMY@0Xi04#^Zh&J( zo11F5!!a()g<_Z}tHMP(6>2TmEwE$wP*nQ?zaL&r@GHVENPnIb^S2|4!!w;J4WLwxfKKx=E%Wu}pqa61Nz&ewB@y%ll-VqE zXCzECO9ou41BZRY(|SZcDB$@aP=)#0l2)nZQ>GjcS)I>5dqxv6WyF$9CxoSiy&8o_ zzd!1Z$flc@te)Hk;5X66XWFqzQS{qI&`8lz&<{kLQb5;-s~@WNO!}HRyvVk_Ur^g4 zTtNS!3)f6k5v?~_h9C*fEL#>w{5p*E!<-5ip$@3)q6REGIvy_2gNjrnQ1ZNH+^1LZZfq8Pbi!*G{a_ucBOm?vuV{vTlYPvZK}@y;{wdpe}(uM<+|v zl4QjEj47`s{i#lHNd;nZU7BDb7fm>3H=U{6j*-8z)xTlavHBd$1{@aWHz3A>nqc>0(b|o*%&fpuH=eBIeNM5#93;T4GdxaaN4VJOB8S%t}tsInU3Fdif z87anSZD(rpNH{yRw>FK+)|vwypXf(sso!qeW!ODp(d*_cxcvTow~cQ(k(-chF}ln- zNK-|3!VN;g+z{Ru_n`8yG7?8Xny*Ni&8*h3X$Sq`| zu(geQsl*`@g_Tr>doi`RW?b@Ff2el&3i`u|NdbxagAe@XZo)m_;61e-MBx{$_-ETG zO>8OSI!oaZm_7}@2xqC#A)zR2o0r2bp4B9ir`~Kk75hv8{Jm!10*dc}$s&ki1)yQ> z_56kJt#9qd#%f3yTI**Ic|6a`{b%-PX86J0mt03^NpsNYqd;*KV{X{zRi8*zl7>$| zF0Tgico$6UdSD_{iGgSbS4mpdkk1?h7Vs@T?8M+NowSJ;q>!?y#bHAB6C{;%sdzW_ zqYkTG007iNxwsxsBymnI$igvD1ICwl_ZaCv&*ln|1y4*f}}E7rPs)-HFJe&l{s+gc#Dl zlACy6&%H76+rK&9$RvzyuU>x_bAJ}9>U(+VECi%8a9_PljrH@oy10D$=I(Bh8vT7@ zJ_7j@8jh_|ZSVarrX0h{9$gkO*b{!!=0ucc-^D<)jcJFG0{~;AM=!fwYj)ooFrq|Z zx_kKcue4AUIg2w>n}nMoH1`u7)J}eV&E&*9(%tRB*?^rh>iPvUD8|-2lz~HH;mw$s zUigRw(X+rU*9aW{V*aiV@nf@;eJOK`bUjCV4~dJS>cSoDa7!Y?rf4OdOldU6twVc& zslm~Yg65A#mRL%LN?%Qjcw11d28&Hf_=c6O_6@yYRkP(1km8skZ;zC+pnlgOCo5Pv zhA8D3!RUNtKK$)=n1-8Zla4cvDXYHYGAGlyE7yA!e$2S=@}4~wI?KOMqXTgQXM`im z=D(=AfVj=R3d11hjxd`2_qGTaECA$ zs1_3p`BYR#Srr?ehSiHpDDou+rG$V;)`f-63KCDFTp=iB;;JoXm%Mn~BqMwv8%C;< zdVjhWjZZxScCF%zp`U9&84Zi5`!}ncIpT*7?+&G1(E6>Y@f^6Z{~-(CkYsa zs}v(~fcRY*!WSyD?jDoA$mf=FgiMP8m-L-j;*y)9$sR0XaONl-$?ZIw(Jw5iGf=xw zVyaNphRz@l<=A4aF2(lskHTe_@Bs_cmP-|oV^Bj8a$jzZaQNenB*)=jg3H-AYatYj zY3iVPKmT?DUMm^>rE<2YFkXz zNA6}aosdBC!$>MPcXbw!j9(bpl)1*0PCs^(neqt^$W>=T;wqKz+v8;B5whng%U%x< zJC&;LvWJj7JL}og@!bIn+F1JQRx)X?K~yQOW>DQ6kb4S{w>zC5H>1&dd&z;AuWA!F zlz3P0-!Yx=P#FrGCe<%`;diVD^N2EQXZUt(OtmSL?Sj7+#eAEA_;l#+y4pbVs>2v6 zujZ^$;j(1MrSFcV8>)O>ho{Qg5y~*La-I1XRfIvX*{9~Wu-UQT#@`W6BE9v5kS6J$ zjplBgwTx&mVYCz(19?3Ijd%DA0)1@C|tHpCNX|HeN2-5 ze0lH7SSknmsnQcClhVz_H9_4hAb3P27^mkH;nN&J~gB)NmR%MXWMgA5c*<{7%8su-e5D$%$^EF- zBB+voj<;SrFg%w>C$6JHmtM9h2dqPA&R|VwQgNTnWTM0MF_JA9}A(oQFn{z zdtl;ttDiufJrT(8L}Si$8zVfYO282ZIqRg}v>M*XP4N?_WbD$(;Avc9iI4vsdrN9x zUD44M{aZ%$`qw@ZDV6sbr(hQE;10v;q&6`Fv;5hZC!bqJKXH|AESu9| zxZ|-@KI#^bW66no=B=a4<*NlP(EcjY;lb80t7~a-O`mCvwsy^4TV=a#hNT@z{}L!u z(!jGGK4&V69=-jj!CfL?)B1CUTnqkjKT6u+;mUcm8-RZi{Mebbf+7441MA4O)nt2zHDy$2ySw^S`kT!gSK9cSp~hH!#nyDnOTA&2TsJM=-iPJI8cnTh zugfJIK9X0P8aAZpr}fdZJv8)}m1ynBxU7!4UXlZXLrs>PMVwkmM98FY0>|6?VhaTgr^M$L$(u>TJIsDIZ|*skkq+1$09drCvi-!@t;f)-w59>Me;A z%tgSc2SNYnMg0CuY~%Q(wby*~hL`)5l)Mpzpvm{R@m{s?&3rt>2c$NH=gG~>x6K!i z(P(gAuA9GBAcN~|xVsR4<)joh2uDB$s>Wea*Ow1(3?5wx*z8omb+!syc%NEhofVw< z;*B5*4cpL3WDtUQX0(hlv&GLVd?Y?zfrn#f;en3_L#+8zoWH$ydvoT*?ciuf22Teh7zKf2 zgjcGbn{&2FzR$vq#lZa*R7ZYM%(d;ko_tyObZ&2!7B_}DtNabC@S4wjFRA3w`_a?9 z`9?a)5jF>XsCBNLN8%hd<=%9V$mCc~(}$xA?9bRULlEi9vJG(dNRs#E(ACe<2?x&t z_+NXUzrU~F`@h)aSJb}sW71@t({{n|4 B-9P{U literal 0 HcmV?d00001 diff --git a/apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java b/apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java index 8daf311149..990b93fcbb 100644 --- a/apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java +++ b/apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java @@ -2,28 +2,48 @@ package com.baeldung.poi.excel.setFormula; import org.apache.poi.ss.util.CellReference; import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.junit.Assert; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; -import java.util.Arrays; -import java.util.List; +import java.net.URISyntaxException; +import java.nio.file.Paths; class ExcelFormulaUnitTest { + private static String FILE_NAME = "SetFormulaTest.xlsx"; + private String fileLocation; + private ExcelFormula excelFormula; + + @BeforeEach + public void setup() throws URISyntaxException { + fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString(); + excelFormula = new ExcelFormula(); + } + @Test void givenExcelData_whenSetAndEvaluateFormula() throws IOException { - ExcelFormula excelFormula = new ExcelFormula(); - List data = Arrays.asList(2, 5, 10, 15, 7, 9); - XSSFSheet sheet = excelFormula.inserData(data); - int result = 0; + FileInputStream inputStream = new FileInputStream(new File(fileLocation)); + XSSFWorkbook wb = new XSSFWorkbook(inputStream); + XSSFSheet sheet = wb.getSheetAt(0); + double resultColumnA = 0; + double resultColumnB = 0; for (int row = 0; row <= sheet.getLastRowNum(); row++) { - result += sheet.getRow(row).getCell(0).getNumericCellValue(); + resultColumnA += sheet.getRow(row).getCell(0).getNumericCellValue(); + resultColumnB += sheet.getRow(row).getCell(1).getNumericCellValue(); } - String colName = CellReference.convertNumToColString(0); - String startCell = colName + 1; - String stopCell = colName + (sheet.getLastRowNum() + 1); - String sumFormula = String.format("SUM(%s:%s)", startCell, stopCell); - int resultValue = (int) excelFormula.setFormula(sumFormula); - Assert.assertEquals("The results are the same!", resultValue , result); + String colNameA = CellReference.convertNumToColString(0); + String colNameB = CellReference.convertNumToColString(1); + String startCellA = colNameA + 1; + String stopCellA = colNameA + (sheet.getLastRowNum() + 1); + String sumFormulaForColumnA = String.format("SUM(%s:%s)", startCellA, stopCellA); + String startCellB = colNameB + 1; + String stopCellB = colNameB + (sheet.getLastRowNum() + 1); + String sumFormulaForColumnB = String.format("SUM(%s:%s)", startCellB, stopCellB); + double resultValue = excelFormula.setFormula(fileLocation, wb, sumFormulaForColumnA + "-" + sumFormulaForColumnB); + Assert.assertEquals(resultValue, resultColumnA - resultColumnB, 0d); } } From a909a79f718c0129ee56b66910ba0b058aa3464b Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Sat, 11 Jul 2020 20:34:36 -0600 Subject: [PATCH 0076/1862] BAEL-4148: Demo app for spring boot and Docker --- docker/docker-spring-boot/mvnw | 310 ++++++++++++++++++ docker/docker-spring-boot/mvnw.cmd | 182 ++++++++++ docker/docker-spring-boot/pom.xml | 54 +++ .../src/main/docker/Dockerfile | 15 + .../com/baeldung/docker/DemoApplication.java | 13 + .../com/baeldung/docker/HelloController.java | 16 + .../src/main/resources/application.properties | 1 + 7 files changed, 591 insertions(+) create mode 100755 docker/docker-spring-boot/mvnw create mode 100644 docker/docker-spring-boot/mvnw.cmd create mode 100644 docker/docker-spring-boot/pom.xml create mode 100644 docker/docker-spring-boot/src/main/docker/Dockerfile create mode 100644 docker/docker-spring-boot/src/main/java/com/baeldung/docker/DemoApplication.java create mode 100644 docker/docker-spring-boot/src/main/java/com/baeldung/docker/HelloController.java create mode 100644 docker/docker-spring-boot/src/main/resources/application.properties diff --git a/docker/docker-spring-boot/mvnw b/docker/docker-spring-boot/mvnw new file mode 100755 index 0000000000..a16b5431b4 --- /dev/null +++ b/docker/docker-spring-boot/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/docker/docker-spring-boot/mvnw.cmd b/docker/docker-spring-boot/mvnw.cmd new file mode 100644 index 0000000000..c8d43372c9 --- /dev/null +++ b/docker/docker-spring-boot/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/docker/docker-spring-boot/pom.xml b/docker/docker-spring-boot/pom.xml new file mode 100644 index 0000000000..b9c80bc43a --- /dev/null +++ b/docker/docker-spring-boot/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + com.baeldung.docker + spring-boot-docker + 0.0.1-SNAPSHOT + spring-boot-docker + Demo project showing Spring Boot and Docker + + + 8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + true + + + + + + + diff --git a/docker/docker-spring-boot/src/main/docker/Dockerfile b/docker/docker-spring-boot/src/main/docker/Dockerfile new file mode 100644 index 0000000000..fa147dd69b --- /dev/null +++ b/docker/docker-spring-boot/src/main/docker/Dockerfile @@ -0,0 +1,15 @@ +# To build, run the following command from the top level project directory: +# +# docker build -f src/main/docker/Dockerfile . + +FROM adoptopenjdk:11-jre-hotspot as builder +ARG JAR_FILE=target/*.jar +COPY ${JAR_FILE} application.jar +RUN java -Djarmode=layertools -jar application.jar extract + +FROM adoptopenjdk:11-jre-hotspot +COPY --from=builder dependencies/ ./ +COPY --from=builder snapshot-dependencies/ ./ +COPY --from=builder spring-boot-loader/ ./ +COPY --from=builder application/ ./ +ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] \ No newline at end of file diff --git a/docker/docker-spring-boot/src/main/java/com/baeldung/docker/DemoApplication.java b/docker/docker-spring-boot/src/main/java/com/baeldung/docker/DemoApplication.java new file mode 100644 index 0000000000..e0c1d57e89 --- /dev/null +++ b/docker/docker-spring-boot/src/main/java/com/baeldung/docker/DemoApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.docker; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DemoApplication { + + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } + +} diff --git a/docker/docker-spring-boot/src/main/java/com/baeldung/docker/HelloController.java b/docker/docker-spring-boot/src/main/java/com/baeldung/docker/HelloController.java new file mode 100644 index 0000000000..b463bb557f --- /dev/null +++ b/docker/docker-spring-boot/src/main/java/com/baeldung/docker/HelloController.java @@ -0,0 +1,16 @@ +package com.baeldung.docker; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HelloController { + + @GetMapping("/hello") + public ResponseEntity hello() + { + return ResponseEntity.ok("hello2 "); + } + +} diff --git a/docker/docker-spring-boot/src/main/resources/application.properties b/docker/docker-spring-boot/src/main/resources/application.properties new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/docker/docker-spring-boot/src/main/resources/application.properties @@ -0,0 +1 @@ + From 9e82ccd8957cf9d51d6d2ee266a7ad7ae3f49798 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 12 Jul 2020 08:56:13 +0530 Subject: [PATCH 0077/1862] JAVA-619: Split or move core-java-modules/core-java-io-apis module --- core-java-modules/core-java-io-apis/README.md | 1 - libraries-apache-commons/README.md | 1 + libraries-apache-commons/pom.xml | 6 ++++++ .../baeldung/dirmonitoring/DirectoryMonitoringExample.java | 0 4 files changed, 7 insertions(+), 1 deletion(-) rename {core-java-modules/core-java-io-apis => libraries-apache-commons}/src/main/java/com/baeldung/dirmonitoring/DirectoryMonitoringExample.java (100%) diff --git a/core-java-modules/core-java-io-apis/README.md b/core-java-modules/core-java-io-apis/README.md index 4d2bb0afb1..9399443ebd 100644 --- a/core-java-modules/core-java-io-apis/README.md +++ b/core-java-modules/core-java-io-apis/README.md @@ -7,7 +7,6 @@ This module contains articles about core Java input/output(IO) APIs. - [A Guide to the Java FileReader Class](https://www.baeldung.com/java-filereader) - [The Java File Class](https://www.baeldung.com/java-io-file) - [Java FileWriter](https://www.baeldung.com/java-filewriter) -- [Differences Between the Java WatchService API and the Apache Commons IO Monitor Library](https://www.baeldung.com/java-watchservice-vs-apache-commons-io-monitor-library) - [Comparing getPath(), getAbsolutePath(), and getCanonicalPath() in Java](https://www.baeldung.com/java-path) - [Quick Use of FilenameFilter](https://www.baeldung.com/java-filename-filter) - [Guide to BufferedReader](https://www.baeldung.com/java-buffered-reader) diff --git a/libraries-apache-commons/README.md b/libraries-apache-commons/README.md index 439587266b..aceea3282a 100644 --- a/libraries-apache-commons/README.md +++ b/libraries-apache-commons/README.md @@ -13,3 +13,4 @@ This module contains articles about Apache Commons libraries. - [Apache Commons BeanUtils](https://www.baeldung.com/apache-commons-beanutils) - [Histograms with Apache Commons Frequency](https://www.baeldung.com/apache-commons-frequency) - [An Introduction to Apache Commons Lang 3](https://www.baeldung.com/java-commons-lang-3) +- [Differences Between the Java WatchService API and the Apache Commons IO Monitor Library](https://www.baeldung.com/java-watchservice-vs-apache-commons-io-monitor-library) \ No newline at end of file diff --git a/libraries-apache-commons/pom.xml b/libraries-apache-commons/pom.xml index 688a500c4a..74adddabcf 100644 --- a/libraries-apache-commons/pom.xml +++ b/libraries-apache-commons/pom.xml @@ -57,6 +57,11 @@ xchart ${xchart-version} + + commons-io + commons-io + ${common-io.version} + @@ -68,6 +73,7 @@ 1.6 3.5.2 3.6.1 + 2.5 diff --git a/core-java-modules/core-java-io-apis/src/main/java/com/baeldung/dirmonitoring/DirectoryMonitoringExample.java b/libraries-apache-commons/src/main/java/com/baeldung/dirmonitoring/DirectoryMonitoringExample.java similarity index 100% rename from core-java-modules/core-java-io-apis/src/main/java/com/baeldung/dirmonitoring/DirectoryMonitoringExample.java rename to libraries-apache-commons/src/main/java/com/baeldung/dirmonitoring/DirectoryMonitoringExample.java From 748c9cf1e450e81e80b67180cde7167de379b953 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sun, 12 Jul 2020 12:28:38 +0530 Subject: [PATCH 0078/1862] Removed README.MD --- .../core-java-reflection-2/README.MD | 3 - .../core-java-reflection-2/pom.xml | 80 +++++++++---------- 2 files changed, 40 insertions(+), 43 deletions(-) delete mode 100644 core-java-modules/core-java-reflection-2/README.MD diff --git a/core-java-modules/core-java-reflection-2/README.MD b/core-java-modules/core-java-reflection-2/README.MD deleted file mode 100644 index 7658851a4d..0000000000 --- a/core-java-modules/core-java-reflection-2/README.MD +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant Articles - -- [Reading the Value of 'private' Fields from a Different Class in Java](https://www.baeldung.com/) \ No newline at end of file diff --git a/core-java-modules/core-java-reflection-2/pom.xml b/core-java-modules/core-java-reflection-2/pom.xml index 17cad52271..ea76ee8c98 100644 --- a/core-java-modules/core-java-reflection-2/pom.xml +++ b/core-java-modules/core-java-reflection-2/pom.xml @@ -1,44 +1,44 @@ - 4.0.0 - core-java-reflection-2 - 0.1.0-SNAPSHOT - core-java-reflection-2 - jar - - com.baeldung.core-java-modules - core-java-modules - 0.0.1-SNAPSHOT - ../ - + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + core-java-reflection-2 + 0.1.0-SNAPSHOT + core-java-reflection-2 + jar + + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../ + + + + core-java-reflection-2 + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${source.version} + ${target.version} + -parameters + + + + - - core-java-reflection-2 - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${source.version} - ${target.version} - -parameters - - - - - - - 3.8.0 - 1.8 - 1.8 - + + 3.8.0 + 1.8 + 1.8 + \ No newline at end of file From 7cbb0833d40610344c1d11da0cf7597ca24e52ad Mon Sep 17 00:00:00 2001 From: joe zhang Date: Sun, 12 Jul 2020 16:19:08 +0800 Subject: [PATCH 0079/1862] refactor unit test into utility class --- .../convertlisttomap/ListToMapConverter.java | 70 +++++++++++++++++ .../convertlisttomap/ListToMapUnitTest.java | 78 ++++--------------- 2 files changed, 83 insertions(+), 65 deletions(-) create mode 100644 java-collections-conversions-2/src/main/java/com/baeldung/convertlisttomap/ListToMapConverter.java diff --git a/java-collections-conversions-2/src/main/java/com/baeldung/convertlisttomap/ListToMapConverter.java b/java-collections-conversions-2/src/main/java/com/baeldung/convertlisttomap/ListToMapConverter.java new file mode 100644 index 0000000000..8450f54f9d --- /dev/null +++ b/java-collections-conversions-2/src/main/java/com/baeldung/convertlisttomap/ListToMapConverter.java @@ -0,0 +1,70 @@ +package com.baeldung.convertlisttomap; + +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.BinaryOperator; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +/** + * Convert a string list to a map whose key is the string's length and value is the collection with same length. + * Give a list {"Baeldung", "is", "very", "cool"}. + * After conversion we'll get a map like: + * {8 : ["Baeldung"], 2 : ["is"], 4 : ["very", "cool"]}. + * + * @author leasy.zhang + * + */ +public class ListToMapConverter { + + public Map> groupingByStringLength(List source, + Supplier>> mapSupplier, + Supplier> listSupplier) { + + return source.stream() + .collect(Collectors.groupingBy(String::length, mapSupplier, Collectors.toCollection(listSupplier))); + } + + public Map> streamCollectByStringLength(List source, + Supplier>> mapSupplier, + Supplier> listSupplier) { + + BiConsumer>, String> accumulator = (response, element) -> { + Integer key = element.length(); + List values = response.getOrDefault(key, listSupplier.get()); + values.add(element); + response.put(key, values); + }; + + BiConsumer>, Map>> combiner = (res1, res2) -> { + res1.putAll(res2); + }; + + return source.stream() + .collect(mapSupplier, accumulator, combiner); + } + + public Map> collectorToMapByStringLength(List source, + Supplier>> mapSupplier, + Supplier> listSupplier) { + + Function keyMapper = String::length; + + Function> valueMapper = (element) -> { + List collection = listSupplier.get(); + collection.add(element); + return collection; + }; + + BinaryOperator> mergeFunction = (existing, replacement) -> { + existing.addAll(replacement); + return existing; + }; + + return source.stream() + .collect(Collectors.toMap(keyMapper, valueMapper, mergeFunction, mapSupplier)); + } + +} diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java b/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java index 4ca5671e29..2b43813822 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java +++ b/java-collections-conversions-2/src/test/java/com/baeldung/convertlisttomap/ListToMapUnitTest.java @@ -1,6 +1,5 @@ package com.baeldung.convertlisttomap; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.ArrayList; @@ -8,89 +7,38 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.BiConsumer; -import java.util.function.BinaryOperator; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collectors; +import org.junit.Before; import org.junit.Test; public class ListToMapUnitTest { + private ListToMapConverter converter; + private List source; + + @Before + public void setUp() { + converter = new ListToMapConverter(); + source = Arrays.asList("List", "Map", "Set", "Tree"); + } + @Test public void givenAList_whenConvertWithJava8GroupBy_thenReturnMap() { - List strings = Arrays.asList("List", "Map", "Set", "Tree"); - - Map> convertedMap = new HashMap<>(); - - Supplier> listSupplier = ArrayList::new; - - Supplier>> mapFactory = HashMap::new; - convertedMap = strings.stream() - .collect(Collectors.groupingBy(String::length, mapFactory, Collectors.toCollection(listSupplier))); - - assertEquals(2, convertedMap.size()); + Map> convertedMap = converter.groupingByStringLength(source, HashMap::new, ArrayList::new); assertTrue(convertedMap.get(3) .contains("Map")); } @Test public void givenAList_whenConvertWithJava8Collect_thenReturnMap() { - List strings = Arrays.asList("List", "Map", "Set", "Tree"); - - Map> convertedMap = new HashMap<>(); - - Supplier>> mapFactory = HashMap::new; - - Supplier> listSupplier = ArrayList::new; - - BiConsumer>, String> accumulator = (response, element) -> { - Integer key = element.length(); - List values = response.getOrDefault(key, listSupplier.get()); - values.add(element); - response.put(key, values); - }; - - BiConsumer>, Map>> combiner = (res1, res2) -> { - res1.putAll(res2); - }; - - convertedMap = strings.stream() - .collect(mapFactory, accumulator, combiner); - - assertEquals(2, convertedMap.size()); + Map> convertedMap = converter.streamCollectByStringLength(source, HashMap::new, ArrayList::new); assertTrue(convertedMap.get(3) .contains("Map")); } @Test public void givenAList_whenConvertWithCollectorToMap_thenReturnMap() { - List strings = Arrays.asList("List", "Map", "Set", "Tree"); - - Map> convertedMap = new HashMap<>(); - - Supplier>> mapFactory = HashMap::new; - - Supplier> listSupplier = ArrayList::new; - - Function keyMapper = String::length; - - Function> valueMapper = (element) -> { - List collection = listSupplier.get(); - collection.add(element); - return collection; - }; - - BinaryOperator> mergeFunction = (existing, replacement) -> { - existing.addAll(replacement); - return existing; - }; - - convertedMap = strings.stream() - .collect(Collectors.toMap(keyMapper, valueMapper, mergeFunction, mapFactory)); - - assertEquals(2, convertedMap.size()); + Map> convertedMap = converter.collectorToMapByStringLength(source, HashMap::new, ArrayList::new); assertTrue(convertedMap.get(3) .contains("Map")); } From c1740e57ec42404c72d0b41dad06bd6c47a9542d Mon Sep 17 00:00:00 2001 From: Donato Rimenti Date: Sun, 12 Jul 2020 11:38:22 +0200 Subject: [PATCH 0080/1862] Fixed formatting. --- maven-all/maven-2/pom.xml | 86 +++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/maven-all/maven-2/pom.xml b/maven-all/maven-2/pom.xml index 629da573b5..74bae61f03 100644 --- a/maven-all/maven-2/pom.xml +++ b/maven-all/maven-2/pom.xml @@ -1,51 +1,51 @@ - 4.0.0 - maven-2 - 0.0.1-SNAPSHOT - maven-2 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + maven-2 + 0.0.1-SNAPSHOT + maven-2 - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../.. - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../.. + - - - junit - junit - 4.13 - - + + + junit + junit + 4.13 + + - - - - org.codehaus.mojo - properties-maven-plugin - 1.0.0 - - - generate-resources - - write-project-properties - - - ${project.build.outputDirectory}/properties-from-pom.properties - - - - - - + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + generate-resources + + write-project-properties + + + ${project.build.outputDirectory}/properties-from-pom.properties + + + + + + - - ${project.name} - property-from-pom - + + ${project.name} + property-from-pom + \ No newline at end of file From 637f81023d7c74156e2473543a322e3195e683f9 Mon Sep 17 00:00:00 2001 From: Donato Rimenti Date: Sun, 12 Jul 2020 11:45:26 +0200 Subject: [PATCH 0081/1862] Moved and renamed maven-all/maven-2 to maven-modules/maven-properties --- maven-modules/maven-properties/.gitignore | 2 + maven-modules/maven-properties/README.md | 8 +++ maven-modules/maven-properties/pom.xml | 51 +++++++++++++++++++ .../maven/properties/PropertiesReader.java | 41 +++++++++++++++ .../properties/PropertiesReaderUnitTest.java | 27 ++++++++++ maven-modules/pom.xml | 1 + 6 files changed, 130 insertions(+) create mode 100644 maven-modules/maven-properties/.gitignore create mode 100644 maven-modules/maven-properties/README.md create mode 100644 maven-modules/maven-properties/pom.xml create mode 100644 maven-modules/maven-properties/src/main/java/com/baeldung/maven/properties/PropertiesReader.java create mode 100644 maven-modules/maven-properties/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java diff --git a/maven-modules/maven-properties/.gitignore b/maven-modules/maven-properties/.gitignore new file mode 100644 index 0000000000..bae0b0d7ce --- /dev/null +++ b/maven-modules/maven-properties/.gitignore @@ -0,0 +1,2 @@ +/output-resources +/.idea/ diff --git a/maven-modules/maven-properties/README.md b/maven-modules/maven-properties/README.md new file mode 100644 index 0000000000..65d976189c --- /dev/null +++ b/maven-modules/maven-properties/README.md @@ -0,0 +1,8 @@ +## Apache Maven + +This module contains articles about core Apache Maven. Articles about other Maven plugins (such as the Maven WAR Plugin) +have their own dedicated modules. + +### Relevant Articles + +- [Accessing Maven Properties in Java] \ No newline at end of file diff --git a/maven-modules/maven-properties/pom.xml b/maven-modules/maven-properties/pom.xml new file mode 100644 index 0000000000..2cd92da42f --- /dev/null +++ b/maven-modules/maven-properties/pom.xml @@ -0,0 +1,51 @@ + + + 4.0.0 + maven-properties + 0.0.1-SNAPSHOT + maven-properties + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../.. + + + + + junit + junit + 4.13 + + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + generate-resources + + write-project-properties + + + ${project.build.outputDirectory}/properties-from-pom.properties + + + + + + + + + ${project.name} + property-from-pom + + + \ No newline at end of file diff --git a/maven-modules/maven-properties/src/main/java/com/baeldung/maven/properties/PropertiesReader.java b/maven-modules/maven-properties/src/main/java/com/baeldung/maven/properties/PropertiesReader.java new file mode 100644 index 0000000000..e7000ec2ce --- /dev/null +++ b/maven-modules/maven-properties/src/main/java/com/baeldung/maven/properties/PropertiesReader.java @@ -0,0 +1,41 @@ +package com.baeldung.maven.properties; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * Reads properties from one file. + * + * @author Donato Rimenti + */ +public class PropertiesReader { + + /** + * Properties managed by this reader. + */ + private Properties properties; + + /** + * Reads the property file with the given name. + * + * @param propertyFileName the name of the property file to read + * @throws IOException if the file is not found or there's a problem reading it + */ + public PropertiesReader(String propertyFileName) throws IOException { + InputStream is = getClass().getClassLoader() + .getResourceAsStream(propertyFileName); + this.properties = new Properties(); + this.properties.load(is); + } + + /** + * Gets the property with the given name from the property file. + * @param propertyName the name of the property to read + * @return the property with the given name + */ + public String getProperty(String propertyName) { + return this.properties.getProperty(propertyName); + } + +} \ No newline at end of file diff --git a/maven-modules/maven-properties/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java b/maven-modules/maven-properties/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java new file mode 100644 index 0000000000..a1d6e66047 --- /dev/null +++ b/maven-modules/maven-properties/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.maven.properties; + +import java.io.IOException; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Test for {@link PropertiesReader}. + * + * @author Donato Rimenti + */ +public class PropertiesReaderUnitTest { + + /** + * Reads a property and checks that's the one expected. + * + * @throws IOException if anything goes wrong + */ + @Test + public void givenPomProperties_whenPropertyRead_thenPropertyReturned() throws IOException { + PropertiesReader reader = new PropertiesReader("properties-from-pom.properties"); + String property = reader.getProperty("my.awesome.property"); + Assert.assertEquals("property-from-pom", property); + } + +} \ No newline at end of file diff --git a/maven-modules/pom.xml b/maven-modules/pom.xml index c4d8c253df..2de8560244 100644 --- a/maven-modules/pom.xml +++ b/maven-modules/pom.xml @@ -24,6 +24,7 @@ maven-profiles versions-maven-plugin version-collision + maven-properties From 6bd023a04d02eb2304d974fcf0701d75c3b15b9b Mon Sep 17 00:00:00 2001 From: Donato Rimenti Date: Sun, 12 Jul 2020 11:47:27 +0200 Subject: [PATCH 0082/1862] Fixed pom formatting. --- maven-modules/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-modules/pom.xml b/maven-modules/pom.xml index 2de8560244..d990ed16c1 100644 --- a/maven-modules/pom.xml +++ b/maven-modules/pom.xml @@ -24,7 +24,7 @@ maven-profiles versions-maven-plugin version-collision - maven-properties + maven-properties From 480775b0c43b81e0f515a58abd70b454f331d8c7 Mon Sep 17 00:00:00 2001 From: Donato Rimenti Date: Sun, 12 Jul 2020 18:01:22 +0200 Subject: [PATCH 0083/1862] Removed maven-all project since it was moved to maven-modules. --- maven-all/maven-2/.gitignore | 2 - maven-all/maven-2/README.md | 6 --- maven-all/maven-2/pom.xml | 51 ------------------- .../maven/properties/PropertiesReader.java | 41 --------------- .../properties/PropertiesReaderUnitTest.java | 27 ---------- 5 files changed, 127 deletions(-) delete mode 100644 maven-all/maven-2/.gitignore delete mode 100644 maven-all/maven-2/README.md delete mode 100644 maven-all/maven-2/pom.xml delete mode 100644 maven-all/maven-2/src/main/java/com/baeldung/maven/properties/PropertiesReader.java delete mode 100644 maven-all/maven-2/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java diff --git a/maven-all/maven-2/.gitignore b/maven-all/maven-2/.gitignore deleted file mode 100644 index bae0b0d7ce..0000000000 --- a/maven-all/maven-2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/output-resources -/.idea/ diff --git a/maven-all/maven-2/README.md b/maven-all/maven-2/README.md deleted file mode 100644 index 5878a4f732..0000000000 --- a/maven-all/maven-2/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## Apache Maven - -This module contains articles about core Apache Maven. Articles about other Maven plugins (such as the Maven WAR Plugin) -have their own dedicated modules. - -### Relevant Articles diff --git a/maven-all/maven-2/pom.xml b/maven-all/maven-2/pom.xml deleted file mode 100644 index 74bae61f03..0000000000 --- a/maven-all/maven-2/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - 4.0.0 - maven-2 - 0.0.1-SNAPSHOT - maven-2 - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../.. - - - - - junit - junit - 4.13 - - - - - - - org.codehaus.mojo - properties-maven-plugin - 1.0.0 - - - generate-resources - - write-project-properties - - - ${project.build.outputDirectory}/properties-from-pom.properties - - - - - - - - - ${project.name} - property-from-pom - - - \ No newline at end of file diff --git a/maven-all/maven-2/src/main/java/com/baeldung/maven/properties/PropertiesReader.java b/maven-all/maven-2/src/main/java/com/baeldung/maven/properties/PropertiesReader.java deleted file mode 100644 index e7000ec2ce..0000000000 --- a/maven-all/maven-2/src/main/java/com/baeldung/maven/properties/PropertiesReader.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.maven.properties; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -/** - * Reads properties from one file. - * - * @author Donato Rimenti - */ -public class PropertiesReader { - - /** - * Properties managed by this reader. - */ - private Properties properties; - - /** - * Reads the property file with the given name. - * - * @param propertyFileName the name of the property file to read - * @throws IOException if the file is not found or there's a problem reading it - */ - public PropertiesReader(String propertyFileName) throws IOException { - InputStream is = getClass().getClassLoader() - .getResourceAsStream(propertyFileName); - this.properties = new Properties(); - this.properties.load(is); - } - - /** - * Gets the property with the given name from the property file. - * @param propertyName the name of the property to read - * @return the property with the given name - */ - public String getProperty(String propertyName) { - return this.properties.getProperty(propertyName); - } - -} \ No newline at end of file diff --git a/maven-all/maven-2/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java b/maven-all/maven-2/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java deleted file mode 100644 index a1d6e66047..0000000000 --- a/maven-all/maven-2/src/test/java/com/baeldung/maven/properties/PropertiesReaderUnitTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.maven.properties; - -import java.io.IOException; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Test for {@link PropertiesReader}. - * - * @author Donato Rimenti - */ -public class PropertiesReaderUnitTest { - - /** - * Reads a property and checks that's the one expected. - * - * @throws IOException if anything goes wrong - */ - @Test - public void givenPomProperties_whenPropertyRead_thenPropertyReturned() throws IOException { - PropertiesReader reader = new PropertiesReader("properties-from-pom.properties"); - String property = reader.getProperty("my.awesome.property"); - Assert.assertEquals("property-from-pom", property); - } - -} \ No newline at end of file From c6b1b43bdde33f0f02178c2c477d49f1e3e3300a Mon Sep 17 00:00:00 2001 From: Ali Ben Messaoud Date: Mon, 6 Jul 2020 01:01:19 +0200 Subject: [PATCH 0084/1862] BAEL-4350: Difference between Statement and PreparedStatement Signed-off-by: Ali Ben Messaoud --- .../DatasourceFactory.java | 23 +++++ .../PersonEntity.java | 42 ++++++++ .../PreparedStatementPersonDao.java | 88 +++++++++++++++++ .../StatementPersonDao.java | 75 +++++++++++++++ .../DatasourceFactoryUnitTest.java | 22 +++++ .../PreparedStatementPersonDaoUnitTest.java | 94 ++++++++++++++++++ .../StatementPersonDaoUnitTest.java | 96 +++++++++++++++++++ 7 files changed, 440 insertions(+) create mode 100644 persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/DatasourceFactory.java create mode 100644 persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/PersonEntity.java create mode 100644 persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/PreparedStatementPersonDao.java create mode 100644 persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/StatementPersonDao.java create mode 100644 persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/DatasourceFactoryUnitTest.java create mode 100644 persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/PreparedStatementPersonDaoUnitTest.java create mode 100644 persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/StatementPersonDaoUnitTest.java diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/DatasourceFactory.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/DatasourceFactory.java new file mode 100644 index 0000000000..adbdc66030 --- /dev/null +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/DatasourceFactory.java @@ -0,0 +1,23 @@ +package com.baeldung.statmentVsPreparedstatment; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class DatasourceFactory { + + private Connection connection; + + public Connection getConnection() throws ClassNotFoundException, SQLException { + Class.forName("org.h2.Driver"); + connection = DriverManager.getConnection("jdbc:h2:mem:db_basic", "SA", ""); + connection.setAutoCommit(false); + return connection; + } + + public boolean createTables() throws SQLException { + String query = "create table if not exists PERSONS (ID INT, NAME VARCHAR(45))"; + return connection.createStatement().executeUpdate(query) == 0; + } + +} diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/PersonEntity.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/PersonEntity.java new file mode 100644 index 0000000000..72fc0c1e24 --- /dev/null +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/PersonEntity.java @@ -0,0 +1,42 @@ +package com.baeldung.statmentVsPreparedstatment; + +import java.util.Objects; + +public class PersonEntity { + private int id; + private String name; + + public PersonEntity(int id, String name) { + this.id = id; + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + PersonEntity that = (PersonEntity) o; + return id == that.id && Objects.equals(name, that.name); + } + + @Override public int hashCode() { + return Objects.hash(id, name); + } +} diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/PreparedStatementPersonDao.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/PreparedStatementPersonDao.java new file mode 100644 index 0000000000..47124d9139 --- /dev/null +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/PreparedStatementPersonDao.java @@ -0,0 +1,88 @@ +package com.baeldung.statmentVsPreparedstatment; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class PreparedStatementPersonDao { + + private final Connection connection; + + public PreparedStatementPersonDao(Connection connection) { + this.connection = connection; + } + + public Optional getById(int id) throws SQLException { + String query = "SELECT id, name FROM persons WHERE id = ?"; + + PreparedStatement preparedStatement = connection.prepareStatement(query); + preparedStatement.setInt(1, id); + ResultSet resultSet = preparedStatement.executeQuery(); + + if (resultSet.first()) { + + PersonEntity result = new PersonEntity(resultSet.getInt("id"), + resultSet.getString("name")); + + return Optional.of(result); + } else { + return Optional.empty(); + } + + } + + public void insert(PersonEntity personEntity) throws SQLException { + + String query = "INSERT INTO persons(id, name) VALUES( ?, ?)"; + + PreparedStatement preparedStatement = connection.prepareStatement(query); + preparedStatement.setInt(1, personEntity.getId()); + preparedStatement.setString(2, personEntity.getName()); + preparedStatement.executeUpdate(); + + } + + public void insert(List personEntities) throws SQLException { + String query = "INSERT INTO persons(id, name) VALUES( ?, ?)"; + + PreparedStatement preparedStatement = connection.prepareStatement(query); + for (PersonEntity personEntity : personEntities) { + preparedStatement.setInt(1, personEntity.getId()); + preparedStatement.setString(2, personEntity.getName()); + preparedStatement.addBatch(); + } + preparedStatement.executeBatch(); + + } + + public void update(PersonEntity personEntity) throws SQLException { + String query = "UPDATE persons SET name = ? WHERE id = ?"; + PreparedStatement preparedStatement = connection.prepareStatement(query); + preparedStatement.setString(1, personEntity.getName()); + preparedStatement.setInt(2, personEntity.getId()); + preparedStatement.executeUpdate(); + } + + public void deleteById(int id) throws SQLException { + String query = "DELETE FROM persons WHERE id = ?"; + PreparedStatement preparedStatement = connection.prepareStatement(query); + preparedStatement.setInt(1, id); + preparedStatement.executeUpdate(); + } + + public List getAll() throws SQLException { + String query = "SELECT id, name FROM persons"; + + PreparedStatement preparedStatement = connection.prepareStatement(query); + ResultSet resultSet = preparedStatement.executeQuery(); + List result = new ArrayList<>(); + while (resultSet.next()) { + result.add(new PersonEntity(resultSet.getInt("id"), resultSet.getString("name"))); + } + return result; + } +} diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/StatementPersonDao.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/StatementPersonDao.java new file mode 100644 index 0000000000..935ba8efa2 --- /dev/null +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/statmentVsPreparedstatment/StatementPersonDao.java @@ -0,0 +1,75 @@ +package com.baeldung.statmentVsPreparedstatment; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +public class StatementPersonDao { + + private final Connection connection; + + public StatementPersonDao(Connection connection) { + this.connection = connection; + } + + public Optional getById(int id) throws SQLException { + String query = "SELECT id, name, FROM persons WHERE id = '" + id + "'"; + + Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery(query); + + if (resultSet.first()) { + PersonEntity result = new PersonEntity(resultSet.getInt("id"), + resultSet.getString("name")); + return Optional.of(result); + } else { + return Optional.empty(); + } + } + + public void insert(PersonEntity personEntity) throws SQLException { + String query = "INSERT INTO persons(id, name) VALUES(" + personEntity.getId() + ", '" + + personEntity.getName() + "')"; + + Statement statement = connection.createStatement(); + statement.executeUpdate(query); + } + + public void insert(List personEntities) throws SQLException { + for (PersonEntity personEntity : personEntities) { + insert(personEntity); + } + } + + public void update(PersonEntity personEntity) throws SQLException { + + String query = "UPDATE persons SET name = '" + personEntity.getName() + "' WHERE id = " + + personEntity.getId(); + + Statement statement = connection.createStatement(); + statement.executeUpdate(query); + + } + + public void deleteById(int id) throws SQLException { + String query = "DELETE FROM persons WHERE id = " + id; + Statement statement = connection.createStatement(); + statement.executeUpdate(query); + } + + public List getAll() throws SQLException { + String query = "SELECT id, name, FROM persons"; + + Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery(query); + List result = new ArrayList<>(); + while (resultSet.next()) { + result.add(new PersonEntity(resultSet.getInt("id"), resultSet.getString("name"))); + } + return result; + } +} diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/DatasourceFactoryUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/DatasourceFactoryUnitTest.java new file mode 100644 index 0000000000..5d3b151d5d --- /dev/null +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/DatasourceFactoryUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.statmentVsPreparedstatment; + +import org.junit.jupiter.api.Test; + +import java.sql.Connection; +import java.sql.SQLException; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class DatasourceFactoryUnitTest { + + @Test + void whenCreateConnectionAndTables_thenConnectionIsOpenAndTableIsCreated() + throws SQLException, ClassNotFoundException { + DatasourceFactory factory = new DatasourceFactory(); + Connection connection = factory.getConnection(); + + assertFalse(connection.isClosed()); + assertTrue(factory.createTables()); + } +} \ No newline at end of file diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/PreparedStatementPersonDaoUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/PreparedStatementPersonDaoUnitTest.java new file mode 100644 index 0000000000..ce79f47802 --- /dev/null +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/PreparedStatementPersonDaoUnitTest.java @@ -0,0 +1,94 @@ +package com.baeldung.statmentVsPreparedstatment; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.*; + +class PreparedStatementPersonDaoUnitTest { + private PreparedStatementPersonDao dao; + + @BeforeEach + void setup() throws SQLException, ClassNotFoundException { + DatasourceFactory datasourceFactory = new DatasourceFactory(); + Connection connection = datasourceFactory.getConnection(); + datasourceFactory.createTables(); + dao = new PreparedStatementPersonDao(connection); + } + + @Test + void whenInsertAPerson_thenItNeverThrowsAnException() { + assertDoesNotThrow(() -> dao.insert(new PersonEntity(1, "john"))); + } + + @Test + void whenInsertAPersonWithQuoteInText_thenItNeverThrowsAnException() { + assertDoesNotThrow(() -> dao.insert(new PersonEntity(1, "O'Brien"))); + } + + @Test + void whenGetAPersonById_thenItReturnThePersonInDatabase() throws SQLException { + dao.insert(new PersonEntity(1, "john")); + + Optional maybeEmployee = dao.getById(1); + assertTrue(maybeEmployee.isPresent()); + + PersonEntity personEntity = maybeEmployee.get(); + + assertEquals(1, personEntity.getId()); + assertEquals("john", personEntity.getName()); + } + + @Test + void whenInsertAndGetMultiplePersons_thenItNeverThrowsAnException() throws SQLException { + assertDoesNotThrow(() -> dao.insert( + Arrays.asList(new PersonEntity(1, "john"), new PersonEntity(2, "skit")))); + + List result = dao.getAll(); + + assertEquals(Arrays.asList(new PersonEntity(1, "john"), new PersonEntity(2, "skit")), + result); + } + + @Test + void whenUpdateAnExistentPerson_thenItReturnsTheUpdatedPerson() throws SQLException { + dao.insert(new PersonEntity(1, "john")); + dao.update(new PersonEntity(1, "johnny")); + + Optional maybePerson = dao.getById(1); + + assertTrue(maybePerson.isPresent()); + + PersonEntity personEntity = maybePerson.get(); + + assertEquals(1, personEntity.getId()); + assertEquals("johnny", personEntity.getName()); + } + + @Test + void whenDeleteAPersonById_thenItWillBeAbsentInDatabase() throws SQLException { + dao.insert(new PersonEntity(1, "john")); + dao.deleteById(1); + + Optional maybePerson = dao.getById(1); + + assertFalse(maybePerson.isPresent()); + } + + @Test + void whenAHackerUpdateAPerson_thenItUpdatesTheTargetPerson() throws SQLException { + dao.insert(Arrays.asList(new PersonEntity(1, "john"), new PersonEntity(2, "skeet"))); + dao.update(new PersonEntity(1, "hacker' --")); + + List result = dao.getAll(); + + assertEquals(Arrays.asList(new PersonEntity(1, "hacker' --"), new PersonEntity(2, "skeet")), + result); + } +} \ No newline at end of file diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/StatementPersonDaoUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/StatementPersonDaoUnitTest.java new file mode 100644 index 0000000000..b31bdcc296 --- /dev/null +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/statmentVsPreparedstatment/StatementPersonDaoUnitTest.java @@ -0,0 +1,96 @@ +package com.baeldung.statmentVsPreparedstatment; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.*; + +class StatementPersonDaoUnitTest { + + private StatementPersonDao dao; + + @BeforeEach + void setup() throws SQLException, ClassNotFoundException { + DatasourceFactory datasourceFactory = new DatasourceFactory(); + Connection connection = datasourceFactory.getConnection(); + datasourceFactory.createTables(); + dao = new StatementPersonDao(connection); + } + + @Test + void whenInsertAPerson_thenItNeverThrowsAnException() { + assertDoesNotThrow(() -> dao.insert(new PersonEntity(1, "john"))); + } + + @Test + void whenInsertAPersonWithQuoteInText_thenItWillThrowAnException() { + assertThrows(SQLException.class, () -> dao.insert(new PersonEntity(1, "O'Brien"))); + } + + @Test + void whenGetAPersonById_thenItReturnThePersonInDatabase() throws SQLException { + dao.insert(new PersonEntity(1, "john")); + + Optional maybeEmployee = dao.getById(1); + + assertTrue(maybeEmployee.isPresent()); + + PersonEntity personEntity = maybeEmployee.get(); + + assertEquals(1, personEntity.getId()); + assertEquals("john", personEntity.getName()); + } + + @Test + void whenInsertAndGetMultiplePersons_thenItNeverThrowsAnException() throws SQLException { + assertDoesNotThrow(() -> dao.insert( + Arrays.asList(new PersonEntity(1, "john"), new PersonEntity(2, "skeet")))); + + List result = dao.getAll(); + + assertEquals(Arrays.asList(new PersonEntity(1, "john"), new PersonEntity(2, "skeet")), + result); + } + + @Test + void whenUpdateAnExistentPerson_thenItReturnsTheUpdatedPerson() throws SQLException { + dao.insert(new PersonEntity(1, "john")); + dao.update(new PersonEntity(1, "johnny")); + + Optional maybePerson = dao.getById(1); + + assertTrue(maybePerson.isPresent()); + + PersonEntity personEntity = maybePerson.get(); + + assertEquals(1, personEntity.getId()); + assertEquals("johnny", personEntity.getName()); + } + + @Test + void whenDeleteAPersonById_thenItWillBeAbsentInDatabase() throws SQLException { + dao.insert(new PersonEntity(1, "john")); + dao.deleteById(1); + + Optional maybePerson = dao.getById(1); + + assertFalse(maybePerson.isPresent()); + } + + @Test + void whenAHackerUpdateAPerson_thenItAllPersonsAreUpdated() throws SQLException { + dao.insert(Arrays.asList(new PersonEntity(1, "john"), new PersonEntity(2, "skeet"))); + dao.update(new PersonEntity(1, "hacker' --")); + + List result = dao.getAll(); + + assertEquals(Arrays.asList(new PersonEntity(1, "hacker"), new PersonEntity(2, "hacker")), + result); + } +} \ No newline at end of file From 64dc02f18fdbde9e728083aef09cf7318f9145cf Mon Sep 17 00:00:00 2001 From: mdhtr Date: Sun, 12 Jul 2020 23:29:55 +0200 Subject: [PATCH 0085/1862] Examples for the second version of the article --- .../JacksonDeserializationExample.java | 40 ------------------ .../hydrajsonld/HydraJsonldExamplePerson.java | 15 ------- .../JacksonJsonLdSerializationExample.java | 25 ----------- .../JacksonJsonldExamplePerson.java | 17 -------- .../JacksonDeserializationUnitTest.java | 41 ++++++++++++++++++ .../jsonldjava/jackson/Person.java} | 4 +- .../HydraJsonldSerializationUnitTest.java} | 37 +++++++++++----- .../JacksonJsonLdSerializationUnitTest.java | 42 +++++++++++++++++++ 8 files changed, 112 insertions(+), 109 deletions(-) delete mode 100644 json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationExample.java delete mode 100644 json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldExamplePerson.java delete mode 100644 json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationExample.java delete mode 100644 json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonldExamplePerson.java create mode 100644 json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java rename json-2/src/{main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonExamplePerson.java => test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java} (88%) rename json-2/src/{main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationExample.java => test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java} (52%) create mode 100644 json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java diff --git a/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationExample.java b/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationExample.java deleted file mode 100644 index b80769b408..0000000000 --- a/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationExample.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.jsonld.deserialization.jsonldjava.jackson; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.jsonldjava.core.JsonLdOptions; -import com.github.jsonldjava.core.JsonLdProcessor; -import com.github.jsonldjava.utils.JsonUtils; - -public class JacksonDeserializationExample { - public static void main(String[] args) throws IOException { - String exampleJsonld ="{" + - " \"@context\": {" + - " \"@vocab\": \"http://schema.org/\"," + - " \"knows\": {" + - " \"@type\": \"@id\"" + - " }" + - " }," + - " \"@type\": \"Person\"," + - " \"@id\": \"http://example.com/person/1234\"," + - " \"name\": \"Example Name\"," + - " \"knows\": \"http://example.com/person/2345\"" + - "}"; - - Object jsonObject = JsonUtils.fromString(exampleJsonld); - Object compact = JsonLdProcessor.compact(jsonObject, new HashMap(), new JsonLdOptions()); - String compactContent = JsonUtils.toString(compact); - - System.out.println(JsonUtils.toPrettyString(compact)); - - ObjectMapper objectMapper = new ObjectMapper(); - JacksonExamplePerson person = objectMapper.readValue(compactContent, JacksonExamplePerson.class); - - System.out.println(person.id); - System.out.println(person.name); - System.out.println(person.knows.id); - } -} diff --git a/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldExamplePerson.java b/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldExamplePerson.java deleted file mode 100644 index 16b2199a73..0000000000 --- a/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldExamplePerson.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.jsonld.serialization.hydrajsonld; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import de.escalon.hypermedia.hydra.mapping.Expose; -import de.escalon.hypermedia.hydra.mapping.Vocab; - -@Vocab("http://example.com/vocab/") -@Expose("person") -public class HydraJsonldExamplePerson { - @JsonProperty("@id") - public String id; - @Expose("fullName") - public String name; -} diff --git a/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationExample.java b/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationExample.java deleted file mode 100644 index 6a1acee1b8..0000000000 --- a/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationExample.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.jsonld.serialization.jacksonjsonld; - -import java.io.IOException; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import ioinformarics.oss.jackson.module.jsonld.HydraCollection; -import ioinformarics.oss.jackson.module.jsonld.JsonldGraph; -import ioinformarics.oss.jackson.module.jsonld.JsonldModule; -import ioinformarics.oss.jackson.module.jsonld.JsonldResource; - -public class JacksonJsonLdSerializationExample { - public static void main(String[] args) throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.registerModule(new JsonldModule()); - - JacksonJsonldExamplePerson person = new JacksonJsonldExamplePerson(); - - JsonldResource jsonldResource = JsonldResource.Builder.create() - .build(person); - - System.out.println(objectMapper.writerWithDefaultPrettyPrinter() - .writeValueAsString(jsonldResource)); - } -} diff --git a/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonldExamplePerson.java b/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonldExamplePerson.java deleted file mode 100644 index a3161ba1d3..0000000000 --- a/json-2/src/main/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonldExamplePerson.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.jsonld.serialization.jacksonjsonld; - -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldId; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldLink; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldNamespace; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldProperty; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldType; - -@JsonldNamespace(name = "s", uri = "http://schema.org/") -@JsonldLink(rel = "s:knows", name = "knows", href = "http://example.com/person/2345") -@JsonldType("s:Person") -class JacksonJsonldExamplePerson { - @JsonldId - public String id = "http://example.com/person/1234"; - @JsonldProperty("s:name") - public String name = "Example Name"; -} diff --git a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java new file mode 100644 index 0000000000..35a2613957 --- /dev/null +++ b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java @@ -0,0 +1,41 @@ +package com.baeldung.jsonld.deserialization.jsonldjava.jackson; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.IOException; +import java.util.HashMap; + +import org.junit.jupiter.api.Test; + +import com.baeldung.jsonld.deserialization.jsonldjava.jackson.Person.Link; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.jsonldjava.core.JsonLdOptions; +import com.github.jsonldjava.core.JsonLdProcessor; +import com.github.jsonldjava.utils.JsonUtils; + +public class JacksonDeserializationUnitTest { + + @Test + void givenAJsonLdObject_whenCompactIsUsedWithEmptyContext_thenItCanBeDeserializedIntoAJacksonAnnotatedJavaObject() throws IOException { + String inputJsonLd = "{\"@context\":{\"@vocab\":\"http://schema.org/\",\"knows\":{\"@type\":\"@id\"}},\"@type\":\"Person\",\"@id\":\"http://example.com/person/1234\",\"name\":\"Example Name\",\"knows\":\"http://example.com/person/2345\"}"; + + Object jsonObject = JsonUtils.fromString(inputJsonLd); + Object compact = JsonLdProcessor.compact(jsonObject, new HashMap(), new JsonLdOptions()); + String compactContent = JsonUtils.toString(compact); + + assertEquals("{\"@id\":\"http://example.com/person/1234\",\"@type\":\"http://schema.org/Person\",\"http://schema.org/knows\":{\"@id\":\"http://example.com/person/2345\"},\"http://schema.org/name\":\"Example Name\"}", compactContent); + + ObjectMapper objectMapper = new ObjectMapper(); + Person person = objectMapper.readValue(compactContent, Person.class); + + Person expectedPerson = new Person(); + expectedPerson.id = "http://example.com/person/1234"; + expectedPerson.name = "Example Name"; + expectedPerson.knows = new Link(); + expectedPerson.knows.id = "http://example.com/person/2345"; + + assertEquals(expectedPerson.id, person.id); + assertEquals(expectedPerson.name, person.name); + assertEquals(expectedPerson.knows.id, person.knows.id); + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonExamplePerson.java b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java similarity index 88% rename from json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonExamplePerson.java rename to json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java index 2e9f38e665..0cb6d43336 100644 --- a/json-2/src/main/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonExamplePerson.java +++ b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) -public class JacksonExamplePerson { +public class Person { @JsonProperty("@id") public String id; @JsonProperty("http://schema.org/name") @@ -12,7 +12,7 @@ public class JacksonExamplePerson { @JsonProperty("http://schema.org/knows") public Link knows; - public class Link { + public static class Link { @JsonProperty("@id") public String id; } diff --git a/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationExample.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java similarity index 52% rename from json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationExample.java rename to json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java index 3d3531b0b5..e5d1e35236 100644 --- a/json-2/src/main/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationExample.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java @@ -1,8 +1,12 @@ package com.baeldung.jsonld.serialization.hydrajsonld; -import java.io.IOException; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.ObjectMapper; @@ -11,23 +15,36 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.ser.BeanSerializerModifier; import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; +import de.escalon.hypermedia.hydra.mapping.Expose; +import de.escalon.hypermedia.hydra.mapping.Vocab; import de.escalon.hypermedia.hydra.serialize.JacksonHydraSerializer; -public class HydraJsonldSerializationExample { - public static void main(String[] args) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - mapper.registerModule(getJacksonHydraSerializerModule()); +public class HydraJsonldSerializationUnitTest { + @Vocab("http://example.com/vocab/") + @Expose("person") + static class Person { + @JsonProperty("@id") + public String id; + @Expose("fullName") + public String name; + } - HydraJsonldExamplePerson person = new HydraJsonldExamplePerson(); + @Test + void givenAHydraJsonldAnnotatedObject_whenJacksonHydraSerializerIsUsed_thenAJsonLdDocumentIsGenerated() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(getJacksonHydraSerializerModule()); + objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + + Person person = new Person(); person.id = "http://example.com/person/1234"; person.name = "Example Name"; - System.out.println(mapper.writerWithDefaultPrettyPrinter() - .writeValueAsString(person)); + String personJsonLd = objectMapper.writeValueAsString(person); + + assertEquals("{\"@context\":{\"@vocab\":\"http://example.com/vocab/\",\"name\":\"fullName\"},\"@type\":\"person\",\"name\":\"Example Name\",\"@id\":\"http://example.com/person/1234\"}", personJsonLd); } - public static SimpleModule getJacksonHydraSerializerModule() { + static SimpleModule getJacksonHydraSerializerModule() { return new SimpleModule() { @Override diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java new file mode 100644 index 0000000000..b539c73608 --- /dev/null +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java @@ -0,0 +1,42 @@ +package com.baeldung.jsonld.serialization.jacksonjsonld; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import ioinformarics.oss.jackson.module.jsonld.JsonldModule; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldId; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldLink; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldNamespace; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldProperty; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldResource; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldType; + +public class JacksonJsonLdSerializationUnitTest { + @JsonldResource + @JsonldNamespace(name = "s", uri = "http://schema.org/") + @JsonldType("s:Person") + @JsonldLink(rel = "s:knows", name = "knows", href = "http://example.com/person/2345") + static class Person { + @JsonldId + public String id = "http://example.com/person/1234"; + @JsonldProperty("s:name") + public String name = "Example Name"; + } + + @Test + void givenAJacksonJsonldAnnotatedObject_whenJsonldModuleIsUsed_thenAJsonLdDocumentIsGenerated() throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JsonldModule()); + + Person person = new Person(); + String personJsonLd = objectMapper.writeValueAsString(person); + + assertEquals( + "{\"@type\":\"s:Person\",\"@context\":{\"s\":\"http://schema.org/\",\"name\":\"s:name\",\"knows\":{\"@id\":\"s:knows\",\"@type\":\"@id\"}},\"name\":\"Example Name\",\"@id\":\"http://example.com/person/1234\",\"knows\":\"http://example.com/person/2345\"}", + personJsonLd); + } +} From 793db9f42b2e8cb3fde61072ee8f9a99d633745e Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Mon, 13 Jul 2020 02:19:13 +0200 Subject: [PATCH 0086/1862] Added exception handling examples --- .../exceptionhandling/ExceptionHandling.kt | 83 +++++++++++++++++++ .../ExceptionHandlingUnitTest.kt | 46 ++++++++++ 2 files changed, 129 insertions(+) create mode 100644 core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt create mode 100644 core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt diff --git a/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt b/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt new file mode 100644 index 0000000000..137a303edb --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt @@ -0,0 +1,83 @@ +package com.baeldung.exceptionhandling + +import java.io.IOException + +class ExceptionHandling { + + fun tryCatchBlock(): Int? { + try { + val message = "Welcome to Kotlin Tutorials" + return message.toInt() + } catch (exception: NumberFormatException) { + println("NumberFormatException in the code") + return null + } + } + + fun tryCatchExpression(): Int? { + val number = try { + val message = "Welcome to Kotlin Tutorials" + message.toInt() + } catch (exception: NumberFormatException) { + println("NumberFormatException in the code") + null + } + return number + } + + fun multipleCatchBlock(): Int? { + return try { + val result = 25 / 0 + return result + } catch (exception: NumberFormatException) { + println("NumberFormatException in the code") + null + } catch (exception: ArithmeticException) { + println("ArithmeticException in the code") + null + } catch (exception: Exception) { + println("Exception in the code") + null + } + } + + fun nestedTryCatchBlock(): Int? { + return try { + val firstNumber = 50 / 2 * 0 + try { + val secondNumber = 100 / firstNumber + secondNumber + } catch (exception: ArithmeticException) { + println("ArithmeticException in the code") + null + } + } catch (exception: NumberFormatException) { + println("NumberFormatException in the code") + null + } + } + + fun finallyBlock(): Int? { + return try { + val message = "Welcome to Kotlin Tutorials" + message.toInt() + } catch (exception: NumberFormatException) { + println("NumberFormatException in the code") + null + } finally { + println("In the Finally block") + } + } + + fun throwKeyword() { + val message = "Welcome to Kotlin Tutorials" + if (message.length > 10) throw IllegalArgumentException("String is invalid") + else println("String is valid") + } + + @Throws(IOException::class) + fun throwsAnnotation(): String?{ + val filePath = null + return filePath ?: throw IOException("File path is invalid") + } +} diff --git a/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt new file mode 100644 index 0000000000..49ad3c38e0 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt @@ -0,0 +1,46 @@ +package com.baeldung.exceptionhandling + +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows +import java.io.IOException +import kotlin.test.assertNull + +class ExceptionHandlingUnitTest { + + private val classUnderTest: ExceptionHandling = ExceptionHandling() + + @Test + fun givenInvalidConversion_whenTryCatchUsed_thenReturnsCatchBlockValue(){ + assertNull(classUnderTest.tryCatchBlock()) + } + + @Test + fun givenInvalidConversion_whenTryCatchExpressionUsed_thenReturnsCatchBlockValue(){ + assertNull(classUnderTest.tryCatchExpression()) + } + + @Test + fun givenDivisionByZero_whenMultipleCatchUsed_thenReturnsCatchBlockValue(){ + assertNull(classUnderTest.multipleCatchBlock()) + } + + @Test + fun givenDivisionByZero_whenNestedTryCatchUsed_thenReturnsNestedCatchBlockValue(){ + assertNull(classUnderTest.nestedTryCatchBlock()) + } + + @Test + fun givenInvalidConversion_whenTryCatchFinallyUsed_thenReturnsCatchAndFinallyBlock(){ + assertNull(classUnderTest.finallyBlock()) + } + + @Test + fun givenIllegalArgument_whenThrowKeywordUsed_thenThrowsException(){ + assertThrows { classUnderTest.throwKeyword() } + } + + @Test + fun whenAnnotationUsed_thenThrowsException(){ + assertThrows { classUnderTest.throwsAnnotation() } + } +} From f43b2141dd1dae4f7776898f5ab533c95246aff8 Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Mon, 13 Jul 2020 06:11:58 +0300 Subject: [PATCH 0087/1862] BAEL-4175 - swapped argument order for assertEquals --- .../VersionComparisonUnitTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java index be8dca0d10..145e9788e4 100644 --- a/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java +++ b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/versioncomparison/VersionComparisonUnitTest.java @@ -25,7 +25,7 @@ public class VersionComparisonUnitTest { assertTrue(version1_3.compareTo(version1_2) > 0); ComparableVersion version1_1_0 = new ComparableVersion("1.1.0"); - assertEquals(version1_1.compareTo(version1_1_0), 0); + assertEquals(0, version1_1.compareTo(version1_1_0)); ComparableVersion version1_1_alpha = new ComparableVersion("1.1-alpha"); assertTrue(version1_1.compareTo(version1_1_alpha) > 0); @@ -58,7 +58,7 @@ public class VersionComparisonUnitTest { assertTrue(version1_3.compareTo(version1_2) > 0); VersionNumber version1_1_0 = VersionNumber.parse("1.1.0"); - assertEquals(version1_1.compareTo(version1_1_0), 0); + assertEquals(0, version1_1.compareTo(version1_1_0)); VersionNumber version1_1_1_1_alpha = VersionNumber.parse("1.1.1.1-alpha"); assertTrue(version1_1.compareTo(version1_1_1_1_alpha) < 0); @@ -87,7 +87,7 @@ public class VersionComparisonUnitTest { assertTrue(version1_1_maven.compareTo(version1_1_gradle) < 0); Version version1_1_snapshot = new Version(1, 1, 0, "snapshot", null, null); - assertEquals(version1_1.compareTo(version1_1_snapshot), 0); + assertEquals(0, version1_1.compareTo(version1_1_snapshot)); assertTrue(version1_1_snapshot.isSnapshot()); } @@ -116,9 +116,9 @@ public class VersionComparisonUnitTest { assertTrue(version1_1.isEqualTo("1.1.0")); - assertEquals(version1_1.diff("2.1.0"), VersionDiff.MAJOR); - assertEquals(version1_1.diff("1.2.3"), VersionDiff.MINOR); - assertEquals(version1_1.diff("1.1.1"), VersionDiff.PATCH); + assertEquals(VersionDiff.MAJOR, version1_1.diff("2.1.0")); + assertEquals(VersionDiff.MINOR, version1_1.diff("1.2.3")); + assertEquals(VersionDiff.PATCH, version1_1.diff("1.1.1")); assertTrue(version1_1.isStable()); assertFalse(version1_1_alpha.isStable()); @@ -130,7 +130,7 @@ public class VersionComparisonUnitTest { assertTrue(VersionCompare.compareVersions("1.0.1", "1.10") < 0); assertTrue(VersionCompare.compareVersions("1.1.2", "1.0.1") > 0); assertTrue(VersionCompare.compareVersions("1.1.2", "1.2") < 0); - assertEquals(VersionCompare.compareVersions("1.3.0", "1.3"), 0); + assertEquals(0, VersionCompare.compareVersions("1.3.0", "1.3")); } } From 1145918e228134b8cece158b4d24edc47eb586f7 Mon Sep 17 00:00:00 2001 From: Daniel Garrett Date: Mon, 13 Jul 2020 10:07:50 +0100 Subject: [PATCH 0088/1862] fix: replace * imports with single imports: --- .../com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java index b5cc82d79d..0aa184f2e1 100644 --- a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java @@ -2,7 +2,9 @@ package com.baeldung.assume; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; -import static org.junit.Assume.*; +import static org.junit.Assume.assumeFalse; +import static org.junit.Assume.assumeThat; +import static org.junit.Assume.assumeTrue; import org.junit.Test; From 23dbbb579dd55ed73b47f15ea8bc8d45b9c386ba Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Mon, 13 Jul 2020 15:02:13 +0200 Subject: [PATCH 0089/1862] BAEL-4341 - JUnit test for System.out.println() --- testing-modules/testing-libraries/pom.xml | 15 +++++- .../systemout/SystemOutPrintlnUnitTest.java | 49 +++++++++++++++++++ .../SystemOutPrintlnWithRuleUnitTest.java | 27 ++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java create mode 100644 testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnWithRuleUnitTest.java diff --git a/testing-modules/testing-libraries/pom.xml b/testing-modules/testing-libraries/pom.xml index 53b58cee17..aa22a5253e 100644 --- a/testing-modules/testing-libraries/pom.xml +++ b/testing-modules/testing-libraries/pom.xml @@ -42,7 +42,18 @@ spring-boot-starter-web 2.2.0.RELEASE - + + com.github.stefanbirkner + system-rules + ${system-rules.version} + test + + + com.github.stefanbirkner + system-lambda + ${system-lambda.version} + test + @@ -90,6 +101,8 @@ 0.4 4.8.0 3.0.0 + 1.19.0 + 1.0.0 diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java new file mode 100644 index 0000000000..3ffc508fa5 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java @@ -0,0 +1,49 @@ +package com.baeldung.systemout; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import org.junit.Assert; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.tapSystemOut; + +class SystemOutPrintlnUnitTest { + + private final ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream(); + private final PrintStream standardOut = System.out; + + @BeforeEach + public void setUp() { + System.setOut(new PrintStream(outputStreamCaptor)); + } + + @BeforeEach + public void tearDown() { + System.setOut(standardOut); + } + + @Test + void givenSystemOutRedirection_whenInvokePrintln_thenOutputCaptorSuccess() { + print("Hello Baeldung Readers!!"); + + Assert.assertEquals("Hello Baeldung Readers!!", outputStreamCaptor.toString() + .trim()); + } + + @Test + void givenTapSystemOut_whenInvokePrintln_thenOutputIsReturnedSuccessfully() throws Exception { + + String text = tapSystemOut(() -> { + print("Hello Baeldung Readers!!"); + }); + + Assert.assertEquals("Hello Baeldung Readers!!", text.trim()); + } + + private void print(String output) { + System.out.println(output); + } + +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnWithRuleUnitTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnWithRuleUnitTest.java new file mode 100644 index 0000000000..f15b71999e --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnWithRuleUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.systemout; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.SystemOutRule; + +public class SystemOutPrintlnWithRuleUnitTest { + + @Rule + public final SystemOutRule systemOutRule = new SystemOutRule().enableLog(); + + @Test + public void givenSystemOutRule_whenInvokePrintln_thenLogSuccess() { + print("Hello Baeldung Readers!!"); + + Assert.assertEquals("Hello Baeldung Readers!!", systemOutRule.getLog() + .trim()); + + Assert.assertEquals("Hello Baeldung Readers!!\n", systemOutRule.getLogWithNormalizedLineSeparator()); + } + + private void print(String output) { + System.out.println(output); + } + +} From 26d9b363353b7f7f2198e1f18c144b3912a923ee Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Mon, 13 Jul 2020 15:51:15 +0200 Subject: [PATCH 0090/1862] JAVA-2140: Remove Initializing Arrays in Kotlin from the core-kotlin-lang-2 --- .../core-kotlin-lang-2/README.md | 1 - .../ArrayInitializationTest.kt | 49 ------------------- 2 files changed, 50 deletions(-) delete mode 100644 core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/arrayinitialization/ArrayInitializationTest.kt diff --git a/core-kotlin-modules/core-kotlin-lang-2/README.md b/core-kotlin-modules/core-kotlin-lang-2/README.md index e2b282258b..e7f232856b 100644 --- a/core-kotlin-modules/core-kotlin-lang-2/README.md +++ b/core-kotlin-modules/core-kotlin-lang-2/README.md @@ -7,7 +7,6 @@ This module contains articles about core features in the Kotlin language. - [Infix Functions in Kotlin](https://www.baeldung.com/kotlin-infix-functions) - [Lambda Expressions in Kotlin](https://www.baeldung.com/kotlin-lambda-expressions) - [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final) -- [Initializing Arrays in Kotlin](https://www.baeldung.com/kotlin-initialize-array) - [Lazy Initialization in Kotlin](https://www.baeldung.com/kotlin-lazy-initialization) - [Comprehensive Guide to Null Safety in Kotlin](https://www.baeldung.com/kotlin-null-safety) - [Kotlin Scope Functions](https://www.baeldung.com/kotlin-scope-functions) diff --git a/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/arrayinitialization/ArrayInitializationTest.kt b/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/arrayinitialization/ArrayInitializationTest.kt deleted file mode 100644 index d4b9d607fb..0000000000 --- a/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/arrayinitialization/ArrayInitializationTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -package com.baeldung.arrayinitialization - -import org.junit.Test -import kotlin.test.assertEquals - -class ArrayInitializationTest { - - @Test - fun givenArrayOfStrings_thenValuesPopulated() { - val strings = arrayOf("January", "February", "March") - - assertEquals(3, strings.size) - assertEquals("March", strings[2]) - } - - @Test - fun givenArrayOfIntegers_thenValuesPopulated() { - val integers = intArrayOf(1, 2, 3, 4) - - assertEquals(4, integers.size) - assertEquals(1, integers[0]) - } - - @Test - fun givenArrayOfNulls_whenPopulated_thenValuesPresent() { - val array = arrayOfNulls(5) - - for (i in array.indices) { - array[i] = i * i - } - - assertEquals(16, array[4]) - } - - @Test - fun whenGeneratorUsed_thenValuesPresent() { - val generatedArray = IntArray(10) { i -> i * i } - - assertEquals(81, generatedArray[9]) - } - - @Test - fun whenStringGenerated_thenValuesPresent() { - val generatedStringArray = Array(10) { i -> "Number of index: $i" } - - assertEquals("Number of index: 0", generatedStringArray[0]) - } - -} \ No newline at end of file From fc6dc42152f55b8284dfbe792e28b39338757fe3 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Mon, 13 Jul 2020 20:44:30 +0430 Subject: [PATCH 0091/1862] Run a Java Main Method in Maven (#9636) --- maven-modules/maven-exec-plugin/README.md | 5 ++ maven-modules/maven-exec-plugin/pom.xml | 53 +++++++++++++++++++ .../src/main/java/com/baeldung/main/Exec.java | 18 +++++++ maven-modules/pom.xml | 1 + 4 files changed, 77 insertions(+) create mode 100644 maven-modules/maven-exec-plugin/README.md create mode 100644 maven-modules/maven-exec-plugin/pom.xml create mode 100644 maven-modules/maven-exec-plugin/src/main/java/com/baeldung/main/Exec.java diff --git a/maven-modules/maven-exec-plugin/README.md b/maven-modules/maven-exec-plugin/README.md new file mode 100644 index 0000000000..411639aae1 --- /dev/null +++ b/maven-modules/maven-exec-plugin/README.md @@ -0,0 +1,5 @@ +## Maven WAR Plugin + +This module contains articles about the Maven Exec Plugin. + +### Relevant Articles diff --git a/maven-modules/maven-exec-plugin/pom.xml b/maven-modules/maven-exec-plugin/pom.xml new file mode 100644 index 0000000000..6c12971e29 --- /dev/null +++ b/maven-modules/maven-exec-plugin/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.baeldung + maven-exec-plugin + 0.0.1-SNAPSHOT + maven-exec-plugin + + + 3.8.1 + 1.8 + 1.2.3 + + + + + ch.qos.logback + logback-classic + ${logback-classic.version} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + com.baeldung.main.Exec + + First + Second + Third + + + + + + + diff --git a/maven-modules/maven-exec-plugin/src/main/java/com/baeldung/main/Exec.java b/maven-modules/maven-exec-plugin/src/main/java/com/baeldung/main/Exec.java new file mode 100644 index 0000000000..5a1494cf4a --- /dev/null +++ b/maven-modules/maven-exec-plugin/src/main/java/com/baeldung/main/Exec.java @@ -0,0 +1,18 @@ +package com.baeldung.main; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; + +public class Exec { + + private static final Logger LOGGER = LoggerFactory.getLogger(Exec.class); + + public static void main(String[] args) { + LOGGER.info("Running the main method"); + if (args.length > 0) { + LOGGER.info("List of arguments: {}", Arrays.toString(args)); + } + } +} diff --git a/maven-modules/pom.xml b/maven-modules/pom.xml index c4d8c253df..b00da22519 100644 --- a/maven-modules/pom.xml +++ b/maven-modules/pom.xml @@ -16,6 +16,7 @@ maven-custom-plugin + maven-exec-plugin maven-integration-test maven-multi-source maven-plugins From d2e386881d0b6b280479996fae1936fb16eb3c9e Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 13 Jul 2020 20:58:32 +0200 Subject: [PATCH 0092/1862] JAVA-1636: Get rid of the overriden spring-boot.version property --- spring-cloud/spring-cloud-functions/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml index 4654d70dd7..7e6f5dfbdc 100644 --- a/spring-cloud/spring-cloud-functions/pom.xml +++ b/spring-cloud/spring-cloud-functions/pom.xml @@ -85,7 +85,6 @@ 1.0.1.RELEASE 2.0.2 1.1.0 - 2.0.4.RELEASE 1.0.10.RELEASE From 845a8968c79bccc9fca2be73e381414dac032afe Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 13 Jul 2020 21:17:54 +0200 Subject: [PATCH 0093/1862] JAVA-2105: Move articles out of core-java-io module --- .../core-java-io-conversions-2/README.md | 2 ++ .../core-java-io-conversions-2/pom.xml | 7 +++++++ .../com/baeldung/csv/WriteCsvFileExample.java | 0 .../com/baeldung/csv/ReadCSVInArrayUnitTest.java | 15 +++------------ .../baeldung/csv/WriteCsvFileExampleUnitTest.java | 12 ++++++------ .../src/test/resources/book.csv | 0 core-java-modules/core-java-io/README.md | 2 -- core-java-modules/core-java-io/pom.xml | 8 -------- 8 files changed, 18 insertions(+), 28 deletions(-) rename core-java-modules/{core-java-io => core-java-io-conversions-2}/src/main/java/com/baeldung/csv/WriteCsvFileExample.java (100%) rename core-java-modules/{core-java-io => core-java-io-conversions-2}/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java (92%) rename core-java-modules/{core-java-io => core-java-io-conversions-2}/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java (100%) rename core-java-modules/{core-java-io => core-java-io-conversions-2}/src/test/resources/book.csv (100%) diff --git a/core-java-modules/core-java-io-conversions-2/README.md b/core-java-modules/core-java-io-conversions-2/README.md index 9ce36e7437..b2153b3669 100644 --- a/core-java-modules/core-java-io-conversions-2/README.md +++ b/core-java-modules/core-java-io-conversions-2/README.md @@ -6,4 +6,6 @@ This module contains articles about core Java input/output(IO) conversions. - [Java InputStream to String](https://www.baeldung.com/convert-input-stream-to-string) - [Java – Write an InputStream to a File](https://www.baeldung.com/convert-input-stream-to-a-file) - [Converting a BufferedReader to a JSONObject](https://www.baeldung.com/java-bufferedreader-to-jsonobject) +- [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array) +- [How to Write to a CSV File in Java](https://www.baeldung.com/java-csv) - More articles: [[<-- prev]](/core-java-modules/core-java-io-conversions) diff --git a/core-java-modules/core-java-io-conversions-2/pom.xml b/core-java-modules/core-java-io-conversions-2/pom.xml index e9cf3f55d1..b8b5074c7c 100644 --- a/core-java-modules/core-java-io-conversions-2/pom.xml +++ b/core-java-modules/core-java-io-conversions-2/pom.xml @@ -26,6 +26,12 @@ json ${json.version} + + com.opencsv + opencsv + ${opencsv.version} + test + @@ -40,6 +46,7 @@ 20200518 + 4.1 \ No newline at end of file diff --git a/core-java-modules/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java b/core-java-modules/core-java-io-conversions-2/src/main/java/com/baeldung/csv/WriteCsvFileExample.java similarity index 100% rename from core-java-modules/core-java-io/src/main/java/com/baeldung/csv/WriteCsvFileExample.java rename to core-java-modules/core-java-io-conversions-2/src/main/java/com/baeldung/csv/WriteCsvFileExample.java diff --git a/core-java-modules/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java similarity index 92% rename from core-java-modules/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java rename to core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java index 2593eee82b..7e4c1a127f 100644 --- a/core-java-modules/core-java-io/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java +++ b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/ReadCSVInArrayUnitTest.java @@ -1,20 +1,11 @@ package com.baeldung.csv; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Scanner; - +import com.opencsv.CSVReader; import org.junit.Assert; import org.junit.Test; -import com.opencsv.CSVReader; +import java.io.*; +import java.util.*; public class ReadCSVInArrayUnitTest { public static final String COMMA_DELIMITER = ","; diff --git a/core-java-modules/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java similarity index 100% rename from core-java-modules/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java rename to core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java index 5f4827bc21..fa76472685 100644 --- a/core-java-modules/core-java-io/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java +++ b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/csv/WriteCsvFileExampleUnitTest.java @@ -1,7 +1,9 @@ package com.baeldung.csv; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileNotFoundException; @@ -10,10 +12,8 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class WriteCsvFileExampleUnitTest { private static final Logger LOG = LoggerFactory.getLogger(WriteCsvFileExampleUnitTest.class); diff --git a/core-java-modules/core-java-io/src/test/resources/book.csv b/core-java-modules/core-java-io-conversions-2/src/test/resources/book.csv similarity index 100% rename from core-java-modules/core-java-io/src/test/resources/book.csv rename to core-java-modules/core-java-io-conversions-2/src/test/resources/book.csv diff --git a/core-java-modules/core-java-io/README.md b/core-java-modules/core-java-io/README.md index 2c6c3363cb..dd0f4f58c3 100644 --- a/core-java-modules/core-java-io/README.md +++ b/core-java-modules/core-java-io/README.md @@ -8,10 +8,8 @@ This module contains articles about core Java input and output (IO) - [Java – Directory Size](https://www.baeldung.com/java-folder-size) - [File Size in Java](https://www.baeldung.com/java-file-size) - [Zipping and Unzipping in Java](https://www.baeldung.com/java-compress-and-uncompress) -- [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array) - [How to Get the File Extension of a File in Java](https://www.baeldung.com/java-file-extension) - [Getting a File’s Mime Type in Java](https://www.baeldung.com/java-file-mime-type) -- [How to Write to a CSV File in Java](https://www.baeldung.com/java-csv) - [How to Avoid the Java FileNotFoundException When Loading Resources](https://www.baeldung.com/java-classpath-resource-cannot-be-opened) - [Create a Directory in Java](https://www.baeldung.com/java-create-directory) - [[More -->]](/core-java-modules/core-java-io-2) diff --git a/core-java-modules/core-java-io/pom.xml b/core-java-modules/core-java-io/pom.xml index ccfb57e909..0968536e65 100644 --- a/core-java-modules/core-java-io/pom.xml +++ b/core-java-modules/core-java-io/pom.xml @@ -29,12 +29,6 @@ ${hsqldb.version} runtime - - com.opencsv - opencsv - ${opencsv.version} - test - org.apache.tika @@ -142,8 +136,6 @@ - - 4.1 3.6.1 From a8dac807526fbe790043145ab71925213c6c2a9a Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Tue, 14 Jul 2020 03:46:32 +0200 Subject: [PATCH 0094/1862] BAEL-4341 - JUnit test for System.out.println() (#9694) * BAEL-4198 - Fix Selenium Live Tests * BAEL-4198 * BAEL-4024 - Taking Screenshots with Selenium WebDriver * BAEL-4341 - JUnit test for System.out.println() Co-authored-by: Jonathan Cook --- testing-modules/testing-libraries/pom.xml | 15 +++++- .../systemout/SystemOutPrintlnUnitTest.java | 49 +++++++++++++++++++ .../SystemOutPrintlnWithRuleUnitTest.java | 27 ++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java create mode 100644 testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnWithRuleUnitTest.java diff --git a/testing-modules/testing-libraries/pom.xml b/testing-modules/testing-libraries/pom.xml index 53b58cee17..aa22a5253e 100644 --- a/testing-modules/testing-libraries/pom.xml +++ b/testing-modules/testing-libraries/pom.xml @@ -42,7 +42,18 @@ spring-boot-starter-web 2.2.0.RELEASE - + + com.github.stefanbirkner + system-rules + ${system-rules.version} + test + + + com.github.stefanbirkner + system-lambda + ${system-lambda.version} + test + @@ -90,6 +101,8 @@ 0.4 4.8.0 3.0.0 + 1.19.0 + 1.0.0 diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java new file mode 100644 index 0000000000..3ffc508fa5 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java @@ -0,0 +1,49 @@ +package com.baeldung.systemout; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import org.junit.Assert; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.tapSystemOut; + +class SystemOutPrintlnUnitTest { + + private final ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream(); + private final PrintStream standardOut = System.out; + + @BeforeEach + public void setUp() { + System.setOut(new PrintStream(outputStreamCaptor)); + } + + @BeforeEach + public void tearDown() { + System.setOut(standardOut); + } + + @Test + void givenSystemOutRedirection_whenInvokePrintln_thenOutputCaptorSuccess() { + print("Hello Baeldung Readers!!"); + + Assert.assertEquals("Hello Baeldung Readers!!", outputStreamCaptor.toString() + .trim()); + } + + @Test + void givenTapSystemOut_whenInvokePrintln_thenOutputIsReturnedSuccessfully() throws Exception { + + String text = tapSystemOut(() -> { + print("Hello Baeldung Readers!!"); + }); + + Assert.assertEquals("Hello Baeldung Readers!!", text.trim()); + } + + private void print(String output) { + System.out.println(output); + } + +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnWithRuleUnitTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnWithRuleUnitTest.java new file mode 100644 index 0000000000..f15b71999e --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnWithRuleUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.systemout; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.SystemOutRule; + +public class SystemOutPrintlnWithRuleUnitTest { + + @Rule + public final SystemOutRule systemOutRule = new SystemOutRule().enableLog(); + + @Test + public void givenSystemOutRule_whenInvokePrintln_thenLogSuccess() { + print("Hello Baeldung Readers!!"); + + Assert.assertEquals("Hello Baeldung Readers!!", systemOutRule.getLog() + .trim()); + + Assert.assertEquals("Hello Baeldung Readers!!\n", systemOutRule.getLogWithNormalizedLineSeparator()); + } + + private void print(String output) { + System.out.println(output); + } + +} From 096b15a11b549c8e58b38268b129a19a76136bf6 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 14 Jul 2020 16:08:39 +0530 Subject: [PATCH 0095/1862] JAVA-2107: Moved code for 1 article to spring-thymeleaf-3 --- .../baeldung/thymeleaf/option/Student.java | 60 +++++++++++++++++++ .../thymeleaf/option/StudentController.java | 24 ++++++++ .../templates/option/studentForm.html | 42 +++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/option/Student.java create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/option/StudentController.java create mode 100644 spring-thymeleaf-3/src/main/resources/templates/option/studentForm.html diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/option/Student.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/option/Student.java new file mode 100644 index 0000000000..3bb6576096 --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/option/Student.java @@ -0,0 +1,60 @@ +package com.baeldung.thymeleaf.option; + +import java.io.Serializable; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; + +/** + * + * Simple student POJO with few fields + * + */ +public class Student implements Serializable { + + private static final long serialVersionUID = -8582553475226281591L; + + @NotNull(message = "Student ID is required.") + @Min(value = 1000, message = "Student ID must be at least 4 digits.") + private Integer id; + + @NotNull(message = "Student name is required.") + private String name; + + @NotNull(message = "Student gender is required.") + private Character gender; + + private Float percentage; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Character getGender() { + return gender; + } + + public void setGender(Character gender) { + this.gender = gender; + } + + public Float getPercentage() { + return percentage; + } + + public void setPercentage(Float percentage) { + this.percentage = percentage; + } +} diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/option/StudentController.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/option/StudentController.java new file mode 100644 index 0000000000..ac75c8ff3a --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/option/StudentController.java @@ -0,0 +1,24 @@ +package com.baeldung.thymeleaf.option; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + + +/** + * Handles requests for the student model. + * + */ +@Controller +public class StudentController { + + + @RequestMapping(value = "/student", method = RequestMethod.GET) + public String addStudent(Model model) { + model.addAttribute("student", new Student()); + return "option/studentForm.html"; + } + + +} diff --git a/spring-thymeleaf-3/src/main/resources/templates/option/studentForm.html b/spring-thymeleaf-3/src/main/resources/templates/option/studentForm.html new file mode 100644 index 0000000000..050ac55fc1 --- /dev/null +++ b/spring-thymeleaf-3/src/main/resources/templates/option/studentForm.html @@ -0,0 +1,42 @@ + + + +Student Form + + +

Student Form

+
+
    +
  • +
  • +
  • +
  • +
+ + + + + + + + + + + + + + + + + +
+
+ + From 08d1df4513766b429472ee6349bcd491c104ae75 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 14 Jul 2020 16:09:28 +0530 Subject: [PATCH 0096/1862] JAVA-2107: Updated README files for article move --- spring-thymeleaf-3/README.md | 1 + spring-thymeleaf/README.md | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-thymeleaf-3/README.md b/spring-thymeleaf-3/README.md index de18771c1e..66e64e7094 100644 --- a/spring-thymeleaf-3/README.md +++ b/spring-thymeleaf-3/README.md @@ -5,3 +5,4 @@ This module contains articles about Spring with Thymeleaf ## Relevant Articles: - [Add CSS and JS to Thymeleaf](https://www.baeldung.com/spring-thymeleaf-css-js) - [Formatting Currencies in Spring Using Thymeleaf](https://www.baeldung.com/spring-thymeleaf-currencies) +- [Working with Select and Option in Thymeleaf](https://www.baeldung.com/thymeleaf-select-option) diff --git a/spring-thymeleaf/README.md b/spring-thymeleaf/README.md index a5c6791609..7c3d4cafa3 100644 --- a/spring-thymeleaf/README.md +++ b/spring-thymeleaf/README.md @@ -13,7 +13,6 @@ This module contains articles about Spring with Thymeleaf - [Conditionals in Thymeleaf](https://www.baeldung.com/spring-thymeleaf-conditionals) - [Iteration in Thymeleaf](https://www.baeldung.com/thymeleaf-iteration) - [Spring with Thymeleaf Pagination for a List](https://www.baeldung.com/spring-thymeleaf-pagination) -- [Working with Select and Option in Thymeleaf](https://www.baeldung.com/thymeleaf-select-option) - [[next -->]](/spring-thymeleaf-2) ### Build the Project From 9481177e6280d656b2200409a424afd3ff293a49 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Tue, 14 Jul 2020 13:24:41 +0200 Subject: [PATCH 0097/1862] JAVA-2109: Fix core-java-concurrency-collections-2 module configuration --- .../pom.xml | 24 +++++++------------ ...ava => ConcurrentLinkedQueueUnitTest.java} | 2 +- ....java => LinkedBlockingQueueUnitTest.java} | 2 +- 3 files changed, 11 insertions(+), 17 deletions(-) rename core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/{TestConcurrentLinkedQueue.java => ConcurrentLinkedQueueUnitTest.java} (98%) rename core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/{TestLinkedBlockingQueue.java => LinkedBlockingQueueUnitTest.java} (98%) diff --git a/core-java-modules/core-java-concurrency-collections-2/pom.xml b/core-java-modules/core-java-concurrency-collections-2/pom.xml index 7fdd348dc5..f9ee41f6d5 100644 --- a/core-java-modules/core-java-concurrency-collections-2/pom.xml +++ b/core-java-modules/core-java-concurrency-collections-2/pom.xml @@ -3,9 +3,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung.concurrent.lock core-java-concurrency-collections-2 - 0.0.1-SNAPSHOT + 0.1.0-SNAPSHOT + core-java-concurrency-collections-2 + jar + + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../ + @@ -30,19 +37,6 @@ test - - src - - - maven-compiler-plugin - 3.8.0 - - 1.8 - 1.8 - - - - 1.21 diff --git a/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/TestConcurrentLinkedQueue.java b/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/ConcurrentLinkedQueueUnitTest.java similarity index 98% rename from core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/TestConcurrentLinkedQueue.java rename to core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/ConcurrentLinkedQueueUnitTest.java index c61becc366..8821887a9e 100644 --- a/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/TestConcurrentLinkedQueue.java +++ b/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/ConcurrentLinkedQueueUnitTest.java @@ -19,7 +19,7 @@ import org.junit.FixMethodOrder; import org.junit.Test; @FixMethodOrder -public class TestConcurrentLinkedQueue { +public class ConcurrentLinkedQueueUnitTest { @Test public void givenThereIsExistingCollection_WhenAddedIntoQueue_ThenShouldContainElements() { diff --git a/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/TestLinkedBlockingQueue.java b/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/LinkedBlockingQueueUnitTest.java similarity index 98% rename from core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/TestLinkedBlockingQueue.java rename to core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/LinkedBlockingQueueUnitTest.java index 7a78bc7b3b..c1460c5196 100644 --- a/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/TestLinkedBlockingQueue.java +++ b/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/concurrent/queue/LinkedBlockingQueueUnitTest.java @@ -18,7 +18,7 @@ import org.junit.FixMethodOrder; import org.junit.Test; @FixMethodOrder -public class TestLinkedBlockingQueue { +public class LinkedBlockingQueueUnitTest { @Test public void givenThereIsExistingCollection_WhenAddedIntoQueue_ThenShouldContainElements() { From 81b412c6e706595ea2f14d23969ff34b139d4d3d Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Tue, 14 Jul 2020 13:30:03 +0200 Subject: [PATCH 0098/1862] JAVA-2109: Move Guide to the Java TransferQueue to the core-java-concurrency-collections-2 --- .../core-java-concurrency-collections-2/README.md | 2 ++ .../src/main/java/com/baeldung/transferqueue/Consumer.java | 0 .../src/main/java/com/baeldung/transferqueue/Producer.java | 0 .../transferqueue/TransferQueueIntegrationTest.java | 6 +++++- .../core-java-concurrency-collections/README.md | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) rename core-java-modules/{core-java-concurrency-collections => core-java-concurrency-collections-2}/src/main/java/com/baeldung/transferqueue/Consumer.java (100%) rename core-java-modules/{core-java-concurrency-collections => core-java-concurrency-collections-2}/src/main/java/com/baeldung/transferqueue/Producer.java (100%) rename core-java-modules/{core-java-concurrency-collections => core-java-concurrency-collections-2}/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java (92%) diff --git a/core-java-modules/core-java-concurrency-collections-2/README.md b/core-java-modules/core-java-concurrency-collections-2/README.md index 91da6c623c..6ad6529efc 100644 --- a/core-java-modules/core-java-concurrency-collections-2/README.md +++ b/core-java-modules/core-java-concurrency-collections-2/README.md @@ -1,3 +1,5 @@ ### Relevant Articles: - [Introduction to Lock Striping](https://www.baeldung.com/java-lock-stripping) +- [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue) +- [[<-- Prev]](/core-java-modules/core-java-concurrency-collections) diff --git a/core-java-modules/core-java-concurrency-collections/src/main/java/com/baeldung/transferqueue/Consumer.java b/core-java-modules/core-java-concurrency-collections-2/src/main/java/com/baeldung/transferqueue/Consumer.java similarity index 100% rename from core-java-modules/core-java-concurrency-collections/src/main/java/com/baeldung/transferqueue/Consumer.java rename to core-java-modules/core-java-concurrency-collections-2/src/main/java/com/baeldung/transferqueue/Consumer.java diff --git a/core-java-modules/core-java-concurrency-collections/src/main/java/com/baeldung/transferqueue/Producer.java b/core-java-modules/core-java-concurrency-collections-2/src/main/java/com/baeldung/transferqueue/Producer.java similarity index 100% rename from core-java-modules/core-java-concurrency-collections/src/main/java/com/baeldung/transferqueue/Producer.java rename to core-java-modules/core-java-concurrency-collections-2/src/main/java/com/baeldung/transferqueue/Producer.java diff --git a/core-java-modules/core-java-concurrency-collections/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java b/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java similarity index 92% rename from core-java-modules/core-java-concurrency-collections/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java rename to core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java index e49738e983..928597f81e 100644 --- a/core-java-modules/core-java-concurrency-collections/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java +++ b/core-java-modules/core-java-concurrency-collections-2/src/test/java/com/baeldung/transferqueue/TransferQueueIntegrationTest.java @@ -4,7 +4,11 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; -import java.util.concurrent.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedTransferQueue; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TransferQueue; import static junit.framework.TestCase.assertEquals; diff --git a/core-java-modules/core-java-concurrency-collections/README.md b/core-java-modules/core-java-concurrency-collections/README.md index af6e7a8b59..94f93d1bfd 100644 --- a/core-java-modules/core-java-concurrency-collections/README.md +++ b/core-java-modules/core-java-concurrency-collections/README.md @@ -10,7 +10,7 @@ This module contains articles about concurrent Java collections - [Custom Thread Pools In Java 8 Parallel Streams](http://www.baeldung.com/java-8-parallel-streams-custom-threadpool) - [Guide to DelayQueue](http://www.baeldung.com/java-delay-queue) - [A Guide to Java SynchronousQueue](http://www.baeldung.com/java-synchronous-queue) -- [Guide to the Java TransferQueue](http://www.baeldung.com/java-transfer-queue) - [Guide to the ConcurrentSkipListMap](http://www.baeldung.com/java-concurrent-skip-list-map) - [Guide to CopyOnWriteArrayList](http://www.baeldung.com/java-copy-on-write-arraylist) - [LinkedBlockingQueue vs ConcurrentLinkedQueue](https://www.baeldung.com/java-queue-linkedblocking-concurrentlinked) +- [[Next -->]](/core-java-modules/core-java-concurrency-collections-2) From 31d314f7b5de22db089068de2923d9eddb5d7ef2 Mon Sep 17 00:00:00 2001 From: mikr Date: Tue, 14 Jul 2020 14:11:12 +0200 Subject: [PATCH 0099/1862] JAVA-2097 Update "Rename File" article --- core-java-modules/core-java-io/README.md | 1 + .../baeldung/rename/RenameFileUnitTest.java | 64 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 core-java-modules/core-java-io/src/test/java/com/baeldung/rename/RenameFileUnitTest.java diff --git a/core-java-modules/core-java-io/README.md b/core-java-modules/core-java-io/README.md index dd0f4f58c3..c8a189ac81 100644 --- a/core-java-modules/core-java-io/README.md +++ b/core-java-modules/core-java-io/README.md @@ -12,4 +12,5 @@ This module contains articles about core Java input and output (IO) - [Getting a File’s Mime Type in Java](https://www.baeldung.com/java-file-mime-type) - [How to Avoid the Java FileNotFoundException When Loading Resources](https://www.baeldung.com/java-classpath-resource-cannot-be-opened) - [Create a Directory in Java](https://www.baeldung.com/java-create-directory) +- [Java – Rename or Move a File](https://www.baeldung.com/java-how-to-rename-or-move-a-file) - [[More -->]](/core-java-modules/core-java-io-2) diff --git a/core-java-modules/core-java-io/src/test/java/com/baeldung/rename/RenameFileUnitTest.java b/core-java-modules/core-java-io/src/test/java/com/baeldung/rename/RenameFileUnitTest.java new file mode 100644 index 0000000000..f4c4e99dac --- /dev/null +++ b/core-java-modules/core-java-io/src/test/java/com/baeldung/rename/RenameFileUnitTest.java @@ -0,0 +1,64 @@ +package com.baeldung.rename; + +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.io.IOException; +import java.nio.file.FileSystemException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class RenameFileUnitTest { + + private final String FILE_TO_MOVE = "src/test/resources/originalFileToMove.txt"; + private final String TARGET_FILE = "src/test/resources/targetFileToMove.txt"; + + @BeforeEach + public void createFileToMove() throws IOException { + File fileToMove = new File(FILE_TO_MOVE); + fileToMove.createNewFile(); + } + + @AfterEach + public void cleanUpFiles() { + File targetFile = new File(TARGET_FILE); + targetFile.delete(); + } + + @Test + public void givenUsingNio_whenMovingFile_thenCorrect() throws IOException { + Path fileToMovePath = Paths.get(FILE_TO_MOVE); + Path targetPath = Paths.get(TARGET_FILE); + Files.move(fileToMovePath, targetPath); + } + + @Test + public void givenUsingFileClass_whenMovingFile_thenCorrect() throws IOException { + File fileToMove = new File(FILE_TO_MOVE); + boolean isMoved = fileToMove.renameTo(new File(TARGET_FILE)); + if (!isMoved) { + throw new FileSystemException(TARGET_FILE); + } + } + + @Test + public void givenUsingGuava_whenMovingFile_thenCorrect() + throws IOException { + File fileToMove = new File(FILE_TO_MOVE); + File targetFile = new File(TARGET_FILE); + + com.google.common.io.Files.move(fileToMove, targetFile); + } + + @Test + public void givenUsingApache_whenMovingFile_thenCorrect() throws IOException { + FileUtils.moveFile( + FileUtils.getFile(FILE_TO_MOVE), + FileUtils.getFile(TARGET_FILE)); + } + +} From 9f09a0b30d79404a32671ab66cb46a5b317f1351 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Tue, 14 Jul 2020 20:19:17 +0430 Subject: [PATCH 0100/1862] A Guide to @Contended & False Sharing --- .../main/java/com/baeldung/FalseSharing.java | 22 + jmh/src/main/java/com/baeldung/LongAdder.java | 235 +++++++++++ jmh/src/main/java/com/baeldung/Striped64.java | 393 ++++++++++++++++++ 3 files changed, 650 insertions(+) create mode 100644 jmh/src/main/java/com/baeldung/FalseSharing.java create mode 100644 jmh/src/main/java/com/baeldung/LongAdder.java create mode 100644 jmh/src/main/java/com/baeldung/Striped64.java diff --git a/jmh/src/main/java/com/baeldung/FalseSharing.java b/jmh/src/main/java/com/baeldung/FalseSharing.java new file mode 100644 index 0000000000..24ba0c0b6b --- /dev/null +++ b/jmh/src/main/java/com/baeldung/FalseSharing.java @@ -0,0 +1,22 @@ +package com.baeldung; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; + +@State(Scope.Benchmark) +public class FalseSharing { + + private java.util.concurrent.atomic.LongAdder builtin = new java.util.concurrent.atomic.LongAdder(); + private LongAdder custom = new LongAdder(); + + @Benchmark + public void builtin() { + builtin.increment(); + } + + @Benchmark + public void custom() { + custom.increment(); + } +} diff --git a/jmh/src/main/java/com/baeldung/LongAdder.java b/jmh/src/main/java/com/baeldung/LongAdder.java new file mode 100644 index 0000000000..8fd2b85c4f --- /dev/null +++ b/jmh/src/main/java/com/baeldung/LongAdder.java @@ -0,0 +1,235 @@ +package com.baeldung; + +import java.io.Serializable; +import java.util.concurrent.atomic.AtomicLong; + +/** + * One or more variables that together maintain an initially zero + * {@code long} sum. When updates (method {@link #add}) are contended + * across threads, the set of variables may grow dynamically to reduce + * contention. Method {@link #sum} (or, equivalently, {@link + * #longValue}) returns the current total combined across the + * variables maintaining the sum. + * + *

This class is usually preferable to {@link AtomicLong} when + * multiple threads update a common sum that is used for purposes such + * as collecting statistics, not for fine-grained synchronization + * control. Under low update contention, the two classes have similar + * characteristics. But under high contention, expected throughput of + * this class is significantly higher, at the expense of higher space + * consumption. + * + *

LongAdders can be used with a {@link + * java.util.concurrent.ConcurrentHashMap} to maintain a scalable + * frequency map (a form of histogram or multiset). For example, to + * add a count to a {@code ConcurrentHashMap freqs}, + * initializing if not already present, you can use {@code + * freqs.computeIfAbsent(k -> new LongAdder()).increment();} + * + *

This class extends {@link Number}, but does not define + * methods such as {@code equals}, {@code hashCode} and {@code + * compareTo} because instances are expected to be mutated, and so are + * not useful as collection keys. + * + * @since 1.8 + * @author Doug Lea + */ +public class LongAdder extends Striped64 implements Serializable { + private static final long serialVersionUID = 7249069246863182397L; + + /** + * Creates a new adder with initial sum of zero. + */ + public LongAdder() { + } + + /** + * Adds the given value. + * + * @param x the value to add + */ + public void add(long x) { + Cell[] as; long b, v; int m; Cell a; + if ((as = cells) != null || !casBase(b = base, b + x)) { + boolean uncontended = true; + if (as == null || (m = as.length - 1) < 0 || + (a = as[getProbe() & m]) == null || + !(uncontended = a.cas(v = a.value, v + x))) + longAccumulate(x, null, uncontended); + } + } + + /** + * Equivalent to {@code add(1)}. + */ + public void increment() { + add(1L); + } + + /** + * Equivalent to {@code add(-1)}. + */ + public void decrement() { + add(-1L); + } + + /** + * Returns the current sum. The returned value is NOT an + * atomic snapshot; invocation in the absence of concurrent + * updates returns an accurate result, but concurrent updates that + * occur while the sum is being calculated might not be + * incorporated. + * + * @return the sum + */ + public long sum() { + Cell[] as = cells; Cell a; + long sum = base; + if (as != null) { + for (int i = 0; i < as.length; ++i) { + if ((a = as[i]) != null) + sum += a.value; + } + } + return sum; + } + + /** + * Resets variables maintaining the sum to zero. This method may + * be a useful alternative to creating a new adder, but is only + * effective if there are no concurrent updates. Because this + * method is intrinsically racy, it should only be used when it is + * known that no threads are concurrently updating. + */ + public void reset() { + Cell[] as = cells; Cell a; + base = 0L; + if (as != null) { + for (int i = 0; i < as.length; ++i) { + if ((a = as[i]) != null) + a.value = 0L; + } + } + } + + /** + * Equivalent in effect to {@link #sum} followed by {@link + * #reset}. This method may apply for example during quiescent + * points between multithreaded computations. If there are + * updates concurrent with this method, the returned value is + * not guaranteed to be the final value occurring before + * the reset. + * + * @return the sum + */ + public long sumThenReset() { + Cell[] as = cells; Cell a; + long sum = base; + base = 0L; + if (as != null) { + for (int i = 0; i < as.length; ++i) { + if ((a = as[i]) != null) { + sum += a.value; + a.value = 0L; + } + } + } + return sum; + } + + /** + * Returns the String representation of the {@link #sum}. + * @return the String representation of the {@link #sum} + */ + public String toString() { + return Long.toString(sum()); + } + + /** + * Equivalent to {@link #sum}. + * + * @return the sum + */ + public long longValue() { + return sum(); + } + + /** + * Returns the {@link #sum} as an {@code int} after a narrowing + * primitive conversion. + */ + public int intValue() { + return (int)sum(); + } + + /** + * Returns the {@link #sum} as a {@code float} + * after a widening primitive conversion. + */ + public float floatValue() { + return (float)sum(); + } + + /** + * Returns the {@link #sum} as a {@code double} after a widening + * primitive conversion. + */ + public double doubleValue() { + return (double)sum(); + } + + /** + * Serialization proxy, used to avoid reference to the non-public + * Striped64 superclass in serialized forms. + * @serial include + */ + private static class SerializationProxy implements Serializable { + private static final long serialVersionUID = 7249069246863182397L; + + /** + * The current value returned by sum(). + * @serial + */ + private final long value; + + SerializationProxy(LongAdder a) { + value = a.sum(); + } + + /** + * Return a {@code LongAdder} object with initial state + * held by this proxy. + * + * @return a {@code LongAdder} object with initial state + * held by this proxy. + */ + private Object readResolve() { + LongAdder a = new LongAdder(); + a.base = value; + return a; + } + } + + /** + * Returns a + * + * SerializationProxy + * representing the state of this instance. + * + * @return a {@link SerializationProxy} + * representing the state of this instance + */ + private Object writeReplace() { + return new SerializationProxy(this); + } + + /** + * @param s the stream + * @throws java.io.InvalidObjectException always + */ + private void readObject(java.io.ObjectInputStream s) + throws java.io.InvalidObjectException { + throw new java.io.InvalidObjectException("Proxy required"); + } + +} diff --git a/jmh/src/main/java/com/baeldung/Striped64.java b/jmh/src/main/java/com/baeldung/Striped64.java new file mode 100644 index 0000000000..d305c334e0 --- /dev/null +++ b/jmh/src/main/java/com/baeldung/Striped64.java @@ -0,0 +1,393 @@ +package com.baeldung; + +import sun.misc.Unsafe; + +import java.lang.reflect.Field; +import java.util.function.LongBinaryOperator; +import java.util.function.DoubleBinaryOperator; +import java.util.concurrent.ThreadLocalRandom; + +/** + * A package-local class holding common representation and mechanics + * for classes supporting dynamic striping on 64bit values. The class + * extends Number so that concrete subclasses must publicly do so. + */ +@SuppressWarnings("serial") +abstract class Striped64 extends Number { + /* + * This class maintains a lazily-initialized table of atomically + * updated variables, plus an extra "base" field. The table size + * is a power of two. Indexing uses masked per-thread hash codes. + * Nearly all declarations in this class are package-private, + * accessed directly by subclasses. + * + * Table entries are of class Cell; a variant of AtomicLong padded + * (via @sun.misc.Contended) to reduce cache contention. Padding + * is overkill for most Atomics because they are usually + * irregularly scattered in memory and thus don't interfere much + * with each other. But Atomic objects residing in arrays will + * tend to be placed adjacent to each other, and so will most + * often share cache lines (with a huge negative performance + * impact) without this precaution. + * + * In part because Cells are relatively large, we avoid creating + * them until they are needed. When there is no contention, all + * updates are made to the base field. Upon first contention (a + * failed CAS on base update), the table is initialized to size 2. + * The table size is doubled upon further contention until + * reaching the nearest power of two greater than or equal to the + * number of CPUS. Table slots remain empty (null) until they are + * needed. + * + * A single spinlock ("cellsBusy") is used for initializing and + * resizing the table, as well as populating slots with new Cells. + * There is no need for a blocking lock; when the lock is not + * available, threads try other slots (or the base). During these + * retries, there is increased contention and reduced locality, + * which is still better than alternatives. + * + * The Thread probe fields maintained via ThreadLocalRandom serve + * as per-thread hash codes. We let them remain uninitialized as + * zero (if they come in this way) until they contend at slot + * 0. They are then initialized to values that typically do not + * often conflict with others. Contention and/or table collisions + * are indicated by failed CASes when performing an update + * operation. Upon a collision, if the table size is less than + * the capacity, it is doubled in size unless some other thread + * holds the lock. If a hashed slot is empty, and lock is + * available, a new Cell is created. Otherwise, if the slot + * exists, a CAS is tried. Retries proceed by "double hashing", + * using a secondary hash (Marsaglia XorShift) to try to find a + * free slot. + * + * The table size is capped because, when there are more threads + * than CPUs, supposing that each thread were bound to a CPU, + * there would exist a perfect hash function mapping threads to + * slots that eliminates collisions. When we reach capacity, we + * search for this mapping by randomly varying the hash codes of + * colliding threads. Because search is random, and collisions + * only become known via CAS failures, convergence can be slow, + * and because threads are typically not bound to CPUS forever, + * may not occur at all. However, despite these limitations, + * observed contention rates are typically low in these cases. + * + * It is possible for a Cell to become unused when threads that + * once hashed to it terminate, as well as in the case where + * doubling the table causes no thread to hash to it under + * expanded mask. We do not try to detect or remove such cells, + * under the assumption that for long-running instances, observed + * contention levels will recur, so the cells will eventually be + * needed again; and for short-lived ones, it does not matter. + */ + + /** + * Padded variant of AtomicLong supporting only raw accesses plus CAS. + * + * JVM intrinsics note: It would be possible to use a release-only + * form of CAS here, if it were provided. + */ + @sun.misc.Contended static final class Cell { + volatile long value; + Cell(long x) { value = x; } + final boolean cas(long cmp, long val) { + return UNSAFE.compareAndSwapLong(this, valueOffset, cmp, val); + } + + // Unsafe mechanics + private static final sun.misc.Unsafe UNSAFE; + private static final long valueOffset; + static { + try { + UNSAFE = getUnsafe(); + Class ak = Striped64.Cell.class; + valueOffset = UNSAFE.objectFieldOffset + (ak.getDeclaredField("value")); + } catch (Exception e) { + throw new Error(e); + } + } + } + + /** Number of CPUS, to place bound on table size */ + static final int NCPU = Runtime.getRuntime().availableProcessors(); + + /** + * Table of cells. When non-null, size is a power of 2. + */ + transient volatile Striped64.Cell[] cells; + + /** + * Base value, used mainly when there is no contention, but also as + * a fallback during table initialization races. Updated via CAS. + */ + transient volatile long base; + + /** + * Spinlock (locked via CAS) used when resizing and/or creating Cells. + */ + transient volatile int cellsBusy; + + /** + * Package-private default constructor + */ + Striped64() { + } + + /** + * CASes the base field. + */ + final boolean casBase(long cmp, long val) { + return UNSAFE.compareAndSwapLong(this, BASE, cmp, val); + } + + /** + * CASes the cellsBusy field from 0 to 1 to acquire lock. + */ + final boolean casCellsBusy() { + return UNSAFE.compareAndSwapInt(this, CELLSBUSY, 0, 1); + } + + /** + * Returns the probe value for the current thread. + * Duplicated from ThreadLocalRandom because of packaging restrictions. + */ + static final int getProbe() { + return UNSAFE.getInt(Thread.currentThread(), PROBE); + } + + /** + * Pseudo-randomly advances and records the given probe value for the + * given thread. + * Duplicated from ThreadLocalRandom because of packaging restrictions. + */ + static final int advanceProbe(int probe) { + probe ^= probe << 13; // xorshift + probe ^= probe >>> 17; + probe ^= probe << 5; + UNSAFE.putInt(Thread.currentThread(), PROBE, probe); + return probe; + } + + /** + * Handles cases of updates involving initialization, resizing, + * creating new Cells, and/or contention. See above for + * explanation. This method suffers the usual non-modularity + * problems of optimistic retry code, relying on rechecked sets of + * reads. + * + * @param x the value + * @param fn the update function, or null for add (this convention + * avoids the need for an extra field or function in LongAdder). + * @param wasUncontended false if CAS failed before call + */ + final void longAccumulate(long x, LongBinaryOperator fn, + boolean wasUncontended) { + int h; + if ((h = getProbe()) == 0) { + ThreadLocalRandom.current(); // force initialization + h = getProbe(); + wasUncontended = true; + } + boolean collide = false; // True if last slot nonempty + for (;;) { + Striped64.Cell[] as; Striped64.Cell a; int n; long v; + if ((as = cells) != null && (n = as.length) > 0) { + if ((a = as[(n - 1) & h]) == null) { + if (cellsBusy == 0) { // Try to attach new Cell + Striped64.Cell r = new Striped64.Cell(x); // Optimistically create + if (cellsBusy == 0 && casCellsBusy()) { + boolean created = false; + try { // Recheck under lock + Striped64.Cell[] rs; int m, j; + if ((rs = cells) != null && + (m = rs.length) > 0 && + rs[j = (m - 1) & h] == null) { + rs[j] = r; + created = true; + } + } finally { + cellsBusy = 0; + } + if (created) + break; + continue; // Slot is now non-empty + } + } + collide = false; + } + else if (!wasUncontended) // CAS already known to fail + wasUncontended = true; // Continue after rehash + else if (a.cas(v = a.value, ((fn == null) ? v + x : + fn.applyAsLong(v, x)))) + break; + else if (n >= NCPU || cells != as) + collide = false; // At max size or stale + else if (!collide) + collide = true; + else if (cellsBusy == 0 && casCellsBusy()) { + try { + if (cells == as) { // Expand table unless stale + Striped64.Cell[] rs = new Striped64.Cell[n << 1]; + for (int i = 0; i < n; ++i) + rs[i] = as[i]; + cells = rs; + } + } finally { + cellsBusy = 0; + } + collide = false; + continue; // Retry with expanded table + } + h = advanceProbe(h); + } + else if (cellsBusy == 0 && cells == as && casCellsBusy()) { + boolean init = false; + try { // Initialize table + if (cells == as) { + Striped64.Cell[] rs = new Striped64.Cell[2]; + rs[h & 1] = new Striped64.Cell(x); + cells = rs; + init = true; + } + } finally { + cellsBusy = 0; + } + if (init) + break; + } + else if (casBase(v = base, ((fn == null) ? v + x : + fn.applyAsLong(v, x)))) + break; // Fall back on using base + } + } + + /** + * Same as longAccumulate, but injecting long/double conversions + * in too many places to sensibly merge with long version, given + * the low-overhead requirements of this class. So must instead be + * maintained by copy/paste/adapt. + */ + final void doubleAccumulate(double x, DoubleBinaryOperator fn, + boolean wasUncontended) { + int h; + if ((h = getProbe()) == 0) { + ThreadLocalRandom.current(); // force initialization + h = getProbe(); + wasUncontended = true; + } + boolean collide = false; // True if last slot nonempty + for (;;) { + Striped64.Cell[] as; Striped64.Cell a; int n; long v; + if ((as = cells) != null && (n = as.length) > 0) { + if ((a = as[(n - 1) & h]) == null) { + if (cellsBusy == 0) { // Try to attach new Cell + Striped64.Cell r = new Striped64.Cell(Double.doubleToRawLongBits(x)); + if (cellsBusy == 0 && casCellsBusy()) { + boolean created = false; + try { // Recheck under lock + Striped64.Cell[] rs; int m, j; + if ((rs = cells) != null && + (m = rs.length) > 0 && + rs[j = (m - 1) & h] == null) { + rs[j] = r; + created = true; + } + } finally { + cellsBusy = 0; + } + if (created) + break; + continue; // Slot is now non-empty + } + } + collide = false; + } + else if (!wasUncontended) // CAS already known to fail + wasUncontended = true; // Continue after rehash + else if (a.cas(v = a.value, + ((fn == null) ? + Double.doubleToRawLongBits + (Double.longBitsToDouble(v) + x) : + Double.doubleToRawLongBits + (fn.applyAsDouble + (Double.longBitsToDouble(v), x))))) + break; + else if (n >= NCPU || cells != as) + collide = false; // At max size or stale + else if (!collide) + collide = true; + else if (cellsBusy == 0 && casCellsBusy()) { + try { + if (cells == as) { // Expand table unless stale + Striped64.Cell[] rs = new Striped64.Cell[n << 1]; + for (int i = 0; i < n; ++i) + rs[i] = as[i]; + cells = rs; + } + } finally { + cellsBusy = 0; + } + collide = false; + continue; // Retry with expanded table + } + h = advanceProbe(h); + } + else if (cellsBusy == 0 && cells == as && casCellsBusy()) { + boolean init = false; + try { // Initialize table + if (cells == as) { + Striped64.Cell[] rs = new Striped64.Cell[2]; + rs[h & 1] = new Striped64.Cell(Double.doubleToRawLongBits(x)); + cells = rs; + init = true; + } + } finally { + cellsBusy = 0; + } + if (init) + break; + } + else if (casBase(v = base, + ((fn == null) ? + Double.doubleToRawLongBits + (Double.longBitsToDouble(v) + x) : + Double.doubleToRawLongBits + (fn.applyAsDouble + (Double.longBitsToDouble(v), x))))) + break; // Fall back on using base + } + } + + // Unsafe mechanics + private static final sun.misc.Unsafe UNSAFE; + private static final long BASE; + private static final long CELLSBUSY; + private static final long PROBE; + static { + try { + UNSAFE = getUnsafe(); + Class sk = Striped64.class; + BASE = UNSAFE.objectFieldOffset + (sk.getDeclaredField("base")); + CELLSBUSY = UNSAFE.objectFieldOffset + (sk.getDeclaredField("cellsBusy")); + Class tk = Thread.class; + PROBE = UNSAFE.objectFieldOffset + (tk.getDeclaredField("threadLocalRandomProbe")); + } catch (Exception e) { + throw new Error(e); + } + } + + private static Unsafe getUnsafe() { + try { + Field field = Unsafe.class.getDeclaredField("theUnsafe"); + field.setAccessible(true); + + return (Unsafe) field.get(null); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +} \ No newline at end of file From 7c344b57c3a6b90e65b178e70604e2c48215ed28 Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Tue, 14 Jul 2020 21:25:54 +0530 Subject: [PATCH 0101/1862] Adding source code for article tracked under BAEL-4080. (#9552) Co-authored-by: CHANDRAKANT Kumar --- pom.xml | 2 + reactive-systems/README.md | 7 + reactive-systems/frontend/Dockerfile | 4 + reactive-systems/frontend/README.md | 27 + reactive-systems/frontend/angular.json | 125 + reactive-systems/frontend/browserslist | 12 + .../frontend/e2e/protractor.conf.js | 32 + .../frontend/e2e/src/app.e2e-spec.ts | 23 + reactive-systems/frontend/e2e/src/app.po.ts | 11 + reactive-systems/frontend/e2e/tsconfig.json | 13 + reactive-systems/frontend/karma.conf.js | 32 + reactive-systems/frontend/nginx.conf | 25 + reactive-systems/frontend/package-lock.json | 13341 ++++++++++++++++ reactive-systems/frontend/package.json | 47 + .../frontend/src/app/app.component.css | 0 .../frontend/src/app/app.component.html | 1 + .../frontend/src/app/app.component.spec.ts | 31 + .../frontend/src/app/app.component.ts | 10 + .../frontend/src/app/app.module.ts | 29 + .../src/app/orders/orders-blocking.service.ts | 16 + .../src/app/orders/orders-reactive.service.ts | 42 + .../src/app/orders/orders.component.css | 0 .../src/app/orders/orders.component.html | 60 + .../src/app/orders/orders.component.spec.ts | 25 + .../src/app/orders/orders.component.ts | 104 + reactive-systems/frontend/src/assets/.gitkeep | 0 .../src/environments/environment.prod.ts | 3 + .../frontend/src/environments/environment.ts | 16 + reactive-systems/frontend/src/favicon.ico | Bin 0 -> 948 bytes reactive-systems/frontend/src/index.html | 13 + reactive-systems/frontend/src/main.ts | 12 + reactive-systems/frontend/src/polyfills.ts | 63 + reactive-systems/frontend/src/styles.css | 1 + reactive-systems/frontend/src/test.ts | 25 + reactive-systems/frontend/tsconfig.app.json | 14 + reactive-systems/frontend/tsconfig.json | 23 + reactive-systems/frontend/tsconfig.spec.json | 18 + reactive-systems/frontend/tslint.json | 148 + .../.mvn/wrapper/MavenWrapperDownloader.java | 117 + .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 50710 bytes .../.mvn/wrapper/maven-wrapper.properties | 2 + reactive-systems/inventory-service/Dockerfile | 3 + reactive-systems/inventory-service/HELP.md | 11 + reactive-systems/inventory-service/mvnw | 310 + reactive-systems/inventory-service/mvnw.cmd | 182 + reactive-systems/inventory-service/pom.xml | 72 + .../java/com/baeldung/AsyncApplication.java | 46 + .../async/consumer/OrderConsumer.java | 57 + .../async/producer/OrderProducer.java | 23 + .../com/baeldung/constants/OrderStatus.java | 7 + .../java/com/baeldung/domain/LineItem.java | 29 + .../main/java/com/baeldung/domain/Order.java | 40 + .../java/com/baeldung/domain/Product.java | 21 + .../controller/ProductController.java | 30 + .../repository/ProductRepository.java | 10 + .../reactive/service/ProductService.java | 72 + .../baeldung/serdeser/ObjectIdSerializer.java | 20 + .../resources/application-docker.properties | 7 + .../src/main/resources/application.properties | 7 + .../src/main/resources/data.json | 16 + .../.mvn/wrapper/MavenWrapperDownloader.java | 117 + .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 50710 bytes .../.mvn/wrapper/maven-wrapper.properties | 2 + reactive-systems/order-service/Dockerfile | 3 + reactive-systems/order-service/HELP.md | 11 + reactive-systems/order-service/mvnw | 310 + reactive-systems/order-service/mvnw.cmd | 182 + reactive-systems/order-service/pom.xml | 73 + .../java/com/baeldung/AsyncApplication.java | 25 + .../async/consumer/OrderConsumer.java | 66 + .../async/producer/OrderProducer.java | 23 + .../com/baeldung/constants/OrderStatus.java | 7 + .../java/com/baeldung/domain/Address.java | 14 + .../java/com/baeldung/domain/LineItem.java | 29 + .../main/java/com/baeldung/domain/Order.java | 52 + .../reactive/controller/OrderController.java | 47 + .../reactive/repository/OrderRepository.java | 10 + .../reactive/service/OrderService.java | 52 + .../baeldung/serdeser/ObjectIdSerializer.java | 20 + .../resources/application-docker.properties | 7 + .../src/main/resources/application.properties | 7 + reactive-systems/pom.xml | 22 + .../.mvn/wrapper/MavenWrapperDownloader.java | 117 + .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 50710 bytes .../.mvn/wrapper/maven-wrapper.properties | 2 + reactive-systems/shipping-service/Dockerfile | 3 + reactive-systems/shipping-service/HELP.md | 11 + reactive-systems/shipping-service/mvnw | 310 + reactive-systems/shipping-service/mvnw.cmd | 182 + reactive-systems/shipping-service/pom.xml | 74 + .../java/com/baeldung/AsyncApplication.java | 13 + .../async/consumer/OrderConsumer.java | 45 + .../async/producer/OrderProducer.java | 23 + .../com/baeldung/constants/OrderStatus.java | 7 + .../java/com/baeldung/domain/Address.java | 14 + .../main/java/com/baeldung/domain/Order.java | 45 + .../java/com/baeldung/domain/Shipment.java | 28 + .../repository/ShipmentRepository.java | 10 + .../reactive/service/ShippingService.java | 45 + .../baeldung/serdeser/ObjectIdSerializer.java | 20 + .../resources/application-docker.properties | 7 + .../src/main/resources/application.properties | 7 + 102 files changed, 17479 insertions(+) create mode 100644 reactive-systems/README.md create mode 100644 reactive-systems/frontend/Dockerfile create mode 100644 reactive-systems/frontend/README.md create mode 100644 reactive-systems/frontend/angular.json create mode 100644 reactive-systems/frontend/browserslist create mode 100644 reactive-systems/frontend/e2e/protractor.conf.js create mode 100644 reactive-systems/frontend/e2e/src/app.e2e-spec.ts create mode 100644 reactive-systems/frontend/e2e/src/app.po.ts create mode 100644 reactive-systems/frontend/e2e/tsconfig.json create mode 100644 reactive-systems/frontend/karma.conf.js create mode 100644 reactive-systems/frontend/nginx.conf create mode 100644 reactive-systems/frontend/package-lock.json create mode 100644 reactive-systems/frontend/package.json create mode 100644 reactive-systems/frontend/src/app/app.component.css create mode 100644 reactive-systems/frontend/src/app/app.component.html create mode 100644 reactive-systems/frontend/src/app/app.component.spec.ts create mode 100644 reactive-systems/frontend/src/app/app.component.ts create mode 100644 reactive-systems/frontend/src/app/app.module.ts create mode 100644 reactive-systems/frontend/src/app/orders/orders-blocking.service.ts create mode 100644 reactive-systems/frontend/src/app/orders/orders-reactive.service.ts create mode 100644 reactive-systems/frontend/src/app/orders/orders.component.css create mode 100644 reactive-systems/frontend/src/app/orders/orders.component.html create mode 100644 reactive-systems/frontend/src/app/orders/orders.component.spec.ts create mode 100644 reactive-systems/frontend/src/app/orders/orders.component.ts create mode 100644 reactive-systems/frontend/src/assets/.gitkeep create mode 100644 reactive-systems/frontend/src/environments/environment.prod.ts create mode 100644 reactive-systems/frontend/src/environments/environment.ts create mode 100644 reactive-systems/frontend/src/favicon.ico create mode 100644 reactive-systems/frontend/src/index.html create mode 100644 reactive-systems/frontend/src/main.ts create mode 100644 reactive-systems/frontend/src/polyfills.ts create mode 100644 reactive-systems/frontend/src/styles.css create mode 100644 reactive-systems/frontend/src/test.ts create mode 100644 reactive-systems/frontend/tsconfig.app.json create mode 100644 reactive-systems/frontend/tsconfig.json create mode 100644 reactive-systems/frontend/tsconfig.spec.json create mode 100644 reactive-systems/frontend/tslint.json create mode 100644 reactive-systems/inventory-service/.mvn/wrapper/MavenWrapperDownloader.java create mode 100644 reactive-systems/inventory-service/.mvn/wrapper/maven-wrapper.jar create mode 100644 reactive-systems/inventory-service/.mvn/wrapper/maven-wrapper.properties create mode 100644 reactive-systems/inventory-service/Dockerfile create mode 100644 reactive-systems/inventory-service/HELP.md create mode 100644 reactive-systems/inventory-service/mvnw create mode 100644 reactive-systems/inventory-service/mvnw.cmd create mode 100644 reactive-systems/inventory-service/pom.xml create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/AsyncApplication.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/async/producer/OrderProducer.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/constants/OrderStatus.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/domain/LineItem.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/domain/Order.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/domain/Product.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/controller/ProductController.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/repository/ProductRepository.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/service/ProductService.java create mode 100644 reactive-systems/inventory-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java create mode 100644 reactive-systems/inventory-service/src/main/resources/application-docker.properties create mode 100644 reactive-systems/inventory-service/src/main/resources/application.properties create mode 100644 reactive-systems/inventory-service/src/main/resources/data.json create mode 100644 reactive-systems/order-service/.mvn/wrapper/MavenWrapperDownloader.java create mode 100644 reactive-systems/order-service/.mvn/wrapper/maven-wrapper.jar create mode 100644 reactive-systems/order-service/.mvn/wrapper/maven-wrapper.properties create mode 100644 reactive-systems/order-service/Dockerfile create mode 100644 reactive-systems/order-service/HELP.md create mode 100644 reactive-systems/order-service/mvnw create mode 100644 reactive-systems/order-service/mvnw.cmd create mode 100644 reactive-systems/order-service/pom.xml create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/AsyncApplication.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/async/producer/OrderProducer.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/constants/OrderStatus.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/domain/Address.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/domain/LineItem.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/domain/Order.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/reactive/controller/OrderController.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/reactive/repository/OrderRepository.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/reactive/service/OrderService.java create mode 100644 reactive-systems/order-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java create mode 100644 reactive-systems/order-service/src/main/resources/application-docker.properties create mode 100644 reactive-systems/order-service/src/main/resources/application.properties create mode 100644 reactive-systems/pom.xml create mode 100644 reactive-systems/shipping-service/.mvn/wrapper/MavenWrapperDownloader.java create mode 100644 reactive-systems/shipping-service/.mvn/wrapper/maven-wrapper.jar create mode 100644 reactive-systems/shipping-service/.mvn/wrapper/maven-wrapper.properties create mode 100644 reactive-systems/shipping-service/Dockerfile create mode 100644 reactive-systems/shipping-service/HELP.md create mode 100644 reactive-systems/shipping-service/mvnw create mode 100644 reactive-systems/shipping-service/mvnw.cmd create mode 100644 reactive-systems/shipping-service/pom.xml create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/AsyncApplication.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/async/producer/OrderProducer.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/constants/OrderStatus.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Address.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Order.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Shipment.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/reactive/repository/ShipmentRepository.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/reactive/service/ShippingService.java create mode 100644 reactive-systems/shipping-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java create mode 100644 reactive-systems/shipping-service/src/main/resources/application-docker.properties create mode 100644 reactive-systems/shipping-service/src/main/resources/application.properties diff --git a/pom.xml b/pom.xml index 1db715147a..f5409d60c4 100644 --- a/pom.xml +++ b/pom.xml @@ -558,6 +558,7 @@ rxjava-operators atomikos + reactive-systems @@ -1069,6 +1070,7 @@ rxjava-operators atomikos + reactive-systems diff --git a/reactive-systems/README.md b/reactive-systems/README.md new file mode 100644 index 0000000000..0558dd141e --- /dev/null +++ b/reactive-systems/README.md @@ -0,0 +1,7 @@ +## Reactive Systems in Java + +This module contains services for article about reactive systems in Java. Please note that these secrives comprise parts of a full stack application to demonstrate the capabilities of a reactive system. Unless there is an article which extends on this concept, this is probably not a suitable module to add other code. + +### Relevant Articles + +- [Reactive Systems in Java](https://www.baeldung.com/) diff --git a/reactive-systems/frontend/Dockerfile b/reactive-systems/frontend/Dockerfile new file mode 100644 index 0000000000..613126c436 --- /dev/null +++ b/reactive-systems/frontend/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:alpine +COPY nginx.conf /etc/nginx/nginx.conf +WORKDIR /usr/share/nginx/html +COPY dist/frontend . \ No newline at end of file diff --git a/reactive-systems/frontend/README.md b/reactive-systems/frontend/README.md new file mode 100644 index 0000000000..8b22673d92 --- /dev/null +++ b/reactive-systems/frontend/README.md @@ -0,0 +1,27 @@ +# Frontend + +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.6. + +## Development server + +Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. + +## Code scaffolding + +Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. + +## Build + +Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. + +## Running unit tests + +Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Running end-to-end tests + +Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). diff --git a/reactive-systems/frontend/angular.json b/reactive-systems/frontend/angular.json new file mode 100644 index 0000000000..1c80d77b7f --- /dev/null +++ b/reactive-systems/frontend/angular.json @@ -0,0 +1,125 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "frontend": { + "projectType": "application", + "schematics": {}, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/frontend", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "aot": true, + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "node_modules/bootstrap/dist/css/bootstrap.min.css", + "src/styles.css" + ], + "scripts": [] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "frontend:build" + }, + "configurations": { + "production": { + "browserTarget": "frontend:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "frontend:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "tsconfig.app.json", + "tsconfig.spec.json", + "e2e/tsconfig.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + }, + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "frontend:serve" + }, + "configurations": { + "production": { + "devServerTarget": "frontend:serve:production" + } + } + } + } + }}, + "defaultProject": "frontend" +} diff --git a/reactive-systems/frontend/browserslist b/reactive-systems/frontend/browserslist new file mode 100644 index 0000000000..80848532e4 --- /dev/null +++ b/reactive-systems/frontend/browserslist @@ -0,0 +1,12 @@ +# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries + +# You can see what browsers were selected by your queries by running: +# npx browserslist + +> 0.5% +last 2 versions +Firefox ESR +not dead +not IE 9-11 # For IE 9-11 support, remove 'not'. \ No newline at end of file diff --git a/reactive-systems/frontend/e2e/protractor.conf.js b/reactive-systems/frontend/e2e/protractor.conf.js new file mode 100644 index 0000000000..7c798cfff0 --- /dev/null +++ b/reactive-systems/frontend/e2e/protractor.conf.js @@ -0,0 +1,32 @@ +// @ts-check +// Protractor configuration file, see link for more information +// https://github.com/angular/protractor/blob/master/lib/config.ts + +const { SpecReporter } = require('jasmine-spec-reporter'); + +/** + * @type { import("protractor").Config } + */ +exports.config = { + allScriptsTimeout: 11000, + specs: [ + './src/**/*.e2e-spec.ts' + ], + capabilities: { + browserName: 'chrome' + }, + directConnect: true, + baseUrl: 'http://localhost:4200/', + framework: 'jasmine', + jasmineNodeOpts: { + showColors: true, + defaultTimeoutInterval: 30000, + print: function() {} + }, + onPrepare() { + require('ts-node').register({ + project: require('path').join(__dirname, './tsconfig.json') + }); + jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); + } +}; \ No newline at end of file diff --git a/reactive-systems/frontend/e2e/src/app.e2e-spec.ts b/reactive-systems/frontend/e2e/src/app.e2e-spec.ts new file mode 100644 index 0000000000..f8b8268fb2 --- /dev/null +++ b/reactive-systems/frontend/e2e/src/app.e2e-spec.ts @@ -0,0 +1,23 @@ +import { AppPage } from './app.po'; +import { browser, logging } from 'protractor'; + +describe('workspace-project App', () => { + let page: AppPage; + + beforeEach(() => { + page = new AppPage(); + }); + + it('should display welcome message', () => { + page.navigateTo(); + expect(page.getTitleText()).toEqual('frontend app is running!'); + }); + + afterEach(async () => { + // Assert that there are no errors emitted from the browser + const logs = await browser.manage().logs().get(logging.Type.BROWSER); + expect(logs).not.toContain(jasmine.objectContaining({ + level: logging.Level.SEVERE, + } as logging.Entry)); + }); +}); diff --git a/reactive-systems/frontend/e2e/src/app.po.ts b/reactive-systems/frontend/e2e/src/app.po.ts new file mode 100644 index 0000000000..b68475e0fc --- /dev/null +++ b/reactive-systems/frontend/e2e/src/app.po.ts @@ -0,0 +1,11 @@ +import { browser, by, element } from 'protractor'; + +export class AppPage { + navigateTo(): Promise { + return browser.get(browser.baseUrl) as Promise; + } + + getTitleText(): Promise { + return element(by.css('app-root .content span')).getText() as Promise; + } +} diff --git a/reactive-systems/frontend/e2e/tsconfig.json b/reactive-systems/frontend/e2e/tsconfig.json new file mode 100644 index 0000000000..39b800f789 --- /dev/null +++ b/reactive-systems/frontend/e2e/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "../out-tsc/e2e", + "module": "commonjs", + "target": "es5", + "types": [ + "jasmine", + "jasminewd2", + "node" + ] + } +} diff --git a/reactive-systems/frontend/karma.conf.js b/reactive-systems/frontend/karma.conf.js new file mode 100644 index 0000000000..d26663c10d --- /dev/null +++ b/reactive-systems/frontend/karma.conf.js @@ -0,0 +1,32 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, './coverage/frontend'), + reports: ['html', 'lcovonly', 'text-summary'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); +}; diff --git a/reactive-systems/frontend/nginx.conf b/reactive-systems/frontend/nginx.conf new file mode 100644 index 0000000000..7e3498c8bd --- /dev/null +++ b/reactive-systems/frontend/nginx.conf @@ -0,0 +1,25 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html index.htm; + include /etc/nginx/mime.types; + + gzip on; + gzip_min_length 1000; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + + location / { + try_files $uri $uri/ /index.html; + } + } +} \ No newline at end of file diff --git a/reactive-systems/frontend/package-lock.json b/reactive-systems/frontend/package-lock.json new file mode 100644 index 0000000000..ec8551d877 --- /dev/null +++ b/reactive-systems/frontend/package-lock.json @@ -0,0 +1,13341 @@ +{ + "name": "frontend", + "version": "0.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@angular-devkit/architect": { + "version": "0.901.7", + "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.901.7.tgz", + "integrity": "sha512-yW/PUEqle55QihOFbmeNXaVTodhfeXkteoFDUpz+YpX3xiQDXDtNbIJSzKOQTojtBKdSMKMvZkQLr+RAa7/1EA==", + "dev": true, + "requires": { + "@angular-devkit/core": "9.1.7", + "rxjs": "6.5.4" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } + } + }, + "@angular-devkit/build-angular": { + "version": "0.901.7", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-0.901.7.tgz", + "integrity": "sha512-NiBwapx/XJqYGzSmENff78i6Yif9PjYDJ9BB+59t2eDofkCZUcPFrhQmRgliO7rt6RATvT81lDP89+LBXCTQPw==", + "dev": true, + "requires": { + "@angular-devkit/architect": "0.901.7", + "@angular-devkit/build-optimizer": "0.901.7", + "@angular-devkit/build-webpack": "0.901.7", + "@angular-devkit/core": "9.1.7", + "@babel/core": "7.9.0", + "@babel/generator": "7.9.3", + "@babel/preset-env": "7.9.0", + "@babel/template": "7.8.6", + "@jsdevtools/coverage-istanbul-loader": "3.0.3", + "@ngtools/webpack": "9.1.7", + "ajv": "6.12.0", + "autoprefixer": "9.7.4", + "babel-loader": "8.0.6", + "browserslist": "^4.9.1", + "cacache": "15.0.0", + "caniuse-lite": "^1.0.30001032", + "circular-dependency-plugin": "5.2.0", + "copy-webpack-plugin": "5.1.1", + "core-js": "3.6.4", + "css-loader": "3.5.1", + "cssnano": "4.1.10", + "file-loader": "6.0.0", + "find-cache-dir": "3.3.1", + "glob": "7.1.6", + "jest-worker": "25.1.0", + "karma-source-map-support": "1.4.0", + "less": "3.11.1", + "less-loader": "5.0.0", + "license-webpack-plugin": "2.1.4", + "loader-utils": "2.0.0", + "mini-css-extract-plugin": "0.9.0", + "minimatch": "3.0.4", + "open": "7.0.3", + "parse5": "4.0.0", + "postcss": "7.0.27", + "postcss-import": "12.0.1", + "postcss-loader": "3.0.0", + "raw-loader": "4.0.0", + "regenerator-runtime": "0.13.5", + "rimraf": "3.0.2", + "rollup": "2.1.0", + "rxjs": "6.5.4", + "sass": "1.26.3", + "sass-loader": "8.0.2", + "semver": "7.1.3", + "source-map": "0.7.3", + "source-map-loader": "0.2.4", + "speed-measure-webpack-plugin": "1.3.1", + "style-loader": "1.1.3", + "stylus": "0.54.7", + "stylus-loader": "3.0.2", + "terser": "4.6.10", + "terser-webpack-plugin": "2.3.5", + "tree-kill": "1.2.2", + "webpack": "4.42.0", + "webpack-dev-middleware": "3.7.2", + "webpack-dev-server": "3.11.0", + "webpack-merge": "4.2.2", + "webpack-sources": "1.4.3", + "webpack-subresource-integrity": "1.4.0", + "worker-plugin": "4.0.3" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } + } + }, + "@angular-devkit/build-optimizer": { + "version": "0.901.7", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-optimizer/-/build-optimizer-0.901.7.tgz", + "integrity": "sha512-Xuce3StdxhcgLYb0BAaFGr3Bzj5EM2OsAqIT15PkikWY1k5cK50vPxoC/BkX4QDL9eXSHtqAfMBfA6h5N422vw==", + "dev": true, + "requires": { + "loader-utils": "2.0.0", + "source-map": "0.7.3", + "tslib": "1.11.1", + "typescript": "3.6.5", + "webpack-sources": "1.4.3" + }, + "dependencies": { + "tslib": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", + "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", + "dev": true + }, + "typescript": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.5.tgz", + "integrity": "sha512-BEjlc0Z06ORZKbtcxGrIvvwYs5hAnuo6TKdNFL55frVDlB+na3z5bsLhFaIxmT+dPWgBIjMo6aNnTOgHHmHgiQ==", + "dev": true + } + } + }, + "@angular-devkit/build-webpack": { + "version": "0.901.7", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.901.7.tgz", + "integrity": "sha512-pTLW5Eqy9cHgv78LKiH0e30lxqKzUPjh1djvNtFsEemOHsfKQdAfjLjikoaQvqMoBKVaUU7r2vmyyS17cH+1yw==", + "dev": true, + "requires": { + "@angular-devkit/architect": "0.901.7", + "@angular-devkit/core": "9.1.7", + "rxjs": "6.5.4" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } + } + }, + "@angular-devkit/core": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-9.1.7.tgz", + "integrity": "sha512-guvolu9Cl+qYMTtedLZD9wCqustJjdqzJ2psD2C1Sr1LrX9T0mprmDldR/YnhsitThveJEb6sM/0EvqWxoSvKw==", + "dev": true, + "requires": { + "ajv": "6.12.0", + "fast-json-stable-stringify": "2.1.0", + "magic-string": "0.25.7", + "rxjs": "6.5.4", + "source-map": "0.7.3" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } + } + }, + "@angular-devkit/schematics": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-9.1.7.tgz", + "integrity": "sha512-oeHPJePBcPp/bd94jHQeFUnft93PGF5iJiKV9szxqS8WWC5OMZ5eK7icRY0PwvLyfenspAZxdZcNaqJqPMul5A==", + "dev": true, + "requires": { + "@angular-devkit/core": "9.1.7", + "ora": "4.0.3", + "rxjs": "6.5.4" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } + } + }, + "@angular/animations": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-9.1.9.tgz", + "integrity": "sha512-qWVi0TxmU6HeXAgEsfpQvFFygh+a0kH2kGe6bWij4XvG6dWfV3xZjlaFwSIYGk+yK4yL0+9+PAXH+ENfxNw+Cw==" + }, + "@angular/cli": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-9.1.7.tgz", + "integrity": "sha512-NhsIa725S/U/n7nDxp6ForusdYHEXF4aSIvsFRdoK6vbQ889c5e1Rdj+T5EWXLmpQZxeprSKhLI2alNX0nVhhQ==", + "dev": true, + "requires": { + "@angular-devkit/architect": "0.901.7", + "@angular-devkit/core": "9.1.7", + "@angular-devkit/schematics": "9.1.7", + "@schematics/angular": "9.1.7", + "@schematics/update": "0.901.7", + "@yarnpkg/lockfile": "1.1.0", + "ansi-colors": "4.1.1", + "debug": "4.1.1", + "ini": "1.3.5", + "inquirer": "7.1.0", + "npm-package-arg": "8.0.1", + "npm-pick-manifest": "6.0.0", + "open": "7.0.3", + "pacote": "9.5.12", + "read-package-tree": "5.3.1", + "rimraf": "3.0.2", + "semver": "7.1.3", + "symbol-observable": "1.2.0", + "universal-analytics": "0.4.20", + "uuid": "7.0.2" + }, + "dependencies": { + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "uuid": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.2.tgz", + "integrity": "sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw==", + "dev": true + } + } + }, + "@angular/common": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/common/-/common-9.1.9.tgz", + "integrity": "sha512-y/tJtkuOJhV2kcaXZyrLZH84i4uQ1r+vaaEHvXj+JZYfYfcMMd/TDqMiPcIkUb3RxqghtZ+q0ZNW5D1Nlru3Pw==" + }, + "@angular/compiler": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-9.1.9.tgz", + "integrity": "sha512-kjFgaTB2ckr9lgmkS1dOGRT7kmzpQueydxsxXSHWgICNVE6F/u1PHyeSOyJRpxW0GnrkLq3QM2EUFnQGGga5bg==" + }, + "@angular/compiler-cli": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/compiler-cli/-/compiler-cli-9.1.9.tgz", + "integrity": "sha512-aLr2eaDlREN8XybgTbelvjtSZ8eAkxBPilnkddc700BgiC6ImyUSKaItOwa8bnjQwq4Wlz5eVG0ibsrX+5MXwg==", + "dev": true, + "requires": { + "canonical-path": "1.0.0", + "chokidar": "^3.0.0", + "convert-source-map": "^1.5.1", + "dependency-graph": "^0.7.2", + "fs-extra": "4.0.2", + "magic-string": "^0.25.0", + "minimist": "^1.2.0", + "reflect-metadata": "^0.1.2", + "semver": "^6.3.0", + "source-map": "^0.6.1", + "sourcemap-codec": "^1.4.8", + "yargs": "15.3.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "yargs": { + "version": "15.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.0.tgz", + "integrity": "sha512-g/QCnmjgOl1YJjGsnUg2SatC7NUYEiLXJqxNOQU9qSpjzGtGXda9b+OKccr1kLTy8BN9yqEyqfq5lxlwdc13TA==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.0" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "@angular/core": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/core/-/core-9.1.9.tgz", + "integrity": "sha512-q/DERgVU6vK2LtTcdVCGGBcoO424WsEfImh3Vcuy+P/ZVmthlDUC/+q+tSKt8MMf4hLpxFDQJE8vUSkktj7QEw==" + }, + "@angular/forms": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-9.1.9.tgz", + "integrity": "sha512-r675yImnb/0pY7K5W3V2ITa7YETu1I2AS+bRfII6UQ6gthyeFFOHb5noa7YneC2yqQiM6E4DQmF5ig3daPuFNg==" + }, + "@angular/platform-browser": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-9.1.9.tgz", + "integrity": "sha512-V861X3MxJp1AlMTnkUPldpBLIJbApXF3ka0A5Dq2nVJCyOFeteGkaRWSBgqe2jxmq+LVpJbzcNvtDFXw6mQ0jA==" + }, + "@angular/platform-browser-dynamic": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-9.1.9.tgz", + "integrity": "sha512-b9MG5MWne+IuL3uLm8jwPhlJzqYaGBGk/qibOqb17T24j1iyrlO7T5bZ8zO6pUy5iT/TahVfHPnPJC1qTK5OmA==" + }, + "@angular/router": { + "version": "9.1.9", + "resolved": "https://registry.npmjs.org/@angular/router/-/router-9.1.9.tgz", + "integrity": "sha512-4u+CWMPB4hCkAsFCEzC94YEWT0wVozqGkc/Dortt2hFaqvZpIegg6iJVZlDxuyDjzFYBPnnbTDdgiTTA8ckfuA==" + }, + "@babel/code-frame": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.1.tgz", + "integrity": "sha512-IGhtTmpjGbYzcEDOw7DcQtbQSXcG9ftmAXtWTu9V936vDye4xjjekktFAtgZsWpzTj/X01jocB46mTywm/4SZw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.1" + } + }, + "@babel/compat-data": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.10.1.tgz", + "integrity": "sha512-CHvCj7So7iCkGKPRFUfryXIkU2gSBw7VSZFYLsqVhrS47269VK2Hfi9S/YcublPMW8k1u2bQBlbDruoQEm4fgw==", + "dev": true, + "requires": { + "browserslist": "^4.12.0", + "invariant": "^2.2.4", + "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "@babel/core": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.9.0.tgz", + "integrity": "sha512-kWc7L0fw1xwvI0zi8OKVBuxRVefwGOrKSQMvrQ3dW+bIIavBY3/NpXmpjMy7bQnLgwgzWQZ8TlM57YHpHNHz4w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/generator": "^7.9.0", + "@babel/helper-module-transforms": "^7.9.0", + "@babel/helpers": "^7.9.0", + "@babel/parser": "^7.9.0", + "@babel/template": "^7.8.6", + "@babel/traverse": "^7.9.0", + "@babel/types": "^7.9.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.1", + "json5": "^2.1.2", + "lodash": "^4.17.13", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.9.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.3.tgz", + "integrity": "sha512-RpxM252EYsz9qLUIq6F7YJyK1sv0wWDBFuztfDGWaQKzHjqDHysxSiRUpA/X9jmfqo+WzkAVKFaUily5h+gDCQ==", + "dev": true, + "requires": { + "@babel/types": "^7.9.0", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.10.1.tgz", + "integrity": "sha512-ewp3rvJEwLaHgyWGe4wQssC2vjks3E80WiUe2BpMb0KhreTjMROCbxXcEovTrbeGVdQct5VjQfrv9EgC+xMzCw==", + "dev": true, + "requires": { + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.1.tgz", + "integrity": "sha512-cQpVq48EkYxUU0xozpGCLla3wlkdRRqLWu1ksFMXA9CM5KQmyyRpSEsYXbao7JUkOw/tAaYKCaYyZq6HOFYtyw==", + "dev": true, + "requires": { + "@babel/helper-explode-assignable-expression": "^7.10.1", + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.10.2.tgz", + "integrity": "sha512-hYgOhF4To2UTB4LTaZepN/4Pl9LD4gfbJx8A34mqoluT8TLbof1mhUlYuNWTEebONa8+UlCC4X0TEXu7AOUyGA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.10.1", + "browserslist": "^4.12.0", + "invariant": "^2.2.4", + "levenary": "^1.1.1", + "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "@babel/helper-create-regexp-features-plugin": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.10.1.tgz", + "integrity": "sha512-Rx4rHS0pVuJn5pJOqaqcZR4XSgeF9G/pO/79t+4r7380tXFJdzImFnxMU19f83wjSrmKHq6myrM10pFHTGzkUA==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.10.1", + "@babel/helper-regex": "^7.10.1", + "regexpu-core": "^4.7.0" + } + }, + "@babel/helper-define-map": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.1.tgz", + "integrity": "sha512-+5odWpX+OnvkD0Zmq7panrMuAGQBu6aPUgvMzuMGo4R+jUOvealEj2hiqI6WhxgKrTpFoFj0+VdsuA8KDxHBDg==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.10.1", + "@babel/types": "^7.10.1", + "lodash": "^4.17.13" + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.10.1.tgz", + "integrity": "sha512-vcUJ3cDjLjvkKzt6rHrl767FeE7pMEYfPanq5L16GRtrXIoznc0HykNW2aEYkcnP76P0isoqJ34dDMFZwzEpJg==", + "dev": true, + "requires": { + "@babel/traverse": "^7.10.1", + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-function-name": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.1.tgz", + "integrity": "sha512-fcpumwhs3YyZ/ttd5Rz0xn0TpIwVkN7X0V38B9TWNfVF42KEkhkAAuPCQ3oXmtTRtiPJrmZ0TrfS0GKF0eMaRQ==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.10.1", + "@babel/template": "^7.10.1", + "@babel/types": "^7.10.1" + }, + "dependencies": { + "@babel/template": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.1.tgz", + "integrity": "sha512-OQDg6SqvFSsc9A0ej6SKINWrpJiNonRIniYondK2ViKhB06i3c0s+76XUft71iqBEe9S1OKsHwPAjfHnuvnCig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.1", + "@babel/parser": "^7.10.1", + "@babel/types": "^7.10.1" + } + } + } + }, + "@babel/helper-get-function-arity": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.1.tgz", + "integrity": "sha512-F5qdXkYGOQUb0hpRaPoetF9AnsXknKjWMZ+wmsIRsp5ge5sFh4c3h1eH2pRTTuy9KKAA2+TTYomGXAtEL2fQEw==", + "dev": true, + "requires": { + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.10.1.tgz", + "integrity": "sha512-vLm5srkU8rI6X3+aQ1rQJyfjvCBLXP8cAGeuw04zeAM2ItKb1e7pmVmLyHb4sDaAYnLL13RHOZPLEtcGZ5xvjg==", + "dev": true, + "requires": { + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.1.tgz", + "integrity": "sha512-u7XLXeM2n50gb6PWJ9hoO5oO7JFPaZtrh35t8RqKLT1jFKj9IWeD1zrcrYp1q1qiZTdEarfDWfTIP8nGsu0h5g==", + "dev": true, + "requires": { + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-module-imports": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.10.1.tgz", + "integrity": "sha512-SFxgwYmZ3HZPyZwJRiVNLRHWuW2OgE5k2nrVs6D9Iv4PPnXVffuEHy83Sfx/l4SqF+5kyJXjAyUmrG7tNm+qVg==", + "dev": true, + "requires": { + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-module-transforms": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.10.1.tgz", + "integrity": "sha512-RLHRCAzyJe7Q7sF4oy2cB+kRnU4wDZY/H2xJFGof+M+SJEGhZsb+GFj5j1AD8NiSaVBJ+Pf0/WObiXu/zxWpFg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.10.1", + "@babel/helper-replace-supers": "^7.10.1", + "@babel/helper-simple-access": "^7.10.1", + "@babel/helper-split-export-declaration": "^7.10.1", + "@babel/template": "^7.10.1", + "@babel/types": "^7.10.1", + "lodash": "^4.17.13" + }, + "dependencies": { + "@babel/template": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.1.tgz", + "integrity": "sha512-OQDg6SqvFSsc9A0ej6SKINWrpJiNonRIniYondK2ViKhB06i3c0s+76XUft71iqBEe9S1OKsHwPAjfHnuvnCig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.1", + "@babel/parser": "^7.10.1", + "@babel/types": "^7.10.1" + } + } + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.1.tgz", + "integrity": "sha512-a0DjNS1prnBsoKx83dP2falChcs7p3i8VMzdrSbfLhuQra/2ENC4sbri34dz/rWmDADsmF1q5GbfaXydh0Jbjg==", + "dev": true, + "requires": { + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.1.tgz", + "integrity": "sha512-fvoGeXt0bJc7VMWZGCAEBEMo/HAjW2mP8apF5eXK0wSqwLAVHAISCWRoLMBMUs2kqeaG77jltVqu4Hn8Egl3nA==", + "dev": true + }, + "@babel/helper-regex": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.10.1.tgz", + "integrity": "sha512-7isHr19RsIJWWLLFn21ubFt223PjQyg1HY7CZEMRr820HttHPpVvrsIN3bUOo44DEfFV4kBXO7Abbn9KTUZV7g==", + "dev": true, + "requires": { + "lodash": "^4.17.13" + } + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.10.1.tgz", + "integrity": "sha512-RfX1P8HqsfgmJ6CwaXGKMAqbYdlleqglvVtht0HGPMSsy2V6MqLlOJVF/0Qyb/m2ZCi2z3q3+s6Pv7R/dQuZ6A==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.10.1", + "@babel/helper-wrap-function": "^7.10.1", + "@babel/template": "^7.10.1", + "@babel/traverse": "^7.10.1", + "@babel/types": "^7.10.1" + }, + "dependencies": { + "@babel/template": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.1.tgz", + "integrity": "sha512-OQDg6SqvFSsc9A0ej6SKINWrpJiNonRIniYondK2ViKhB06i3c0s+76XUft71iqBEe9S1OKsHwPAjfHnuvnCig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.1", + "@babel/parser": "^7.10.1", + "@babel/types": "^7.10.1" + } + } + } + }, + "@babel/helper-replace-supers": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.10.1.tgz", + "integrity": "sha512-SOwJzEfpuQwInzzQJGjGaiG578UYmyi2Xw668klPWV5n07B73S0a9btjLk/52Mlcxa+5AdIYqws1KyXRfMoB7A==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "^7.10.1", + "@babel/helper-optimise-call-expression": "^7.10.1", + "@babel/traverse": "^7.10.1", + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-simple-access": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.10.1.tgz", + "integrity": "sha512-VSWpWzRzn9VtgMJBIWTZ+GP107kZdQ4YplJlCmIrjoLVSi/0upixezHCDG8kpPVTBJpKfxTH01wDhh+jS2zKbw==", + "dev": true, + "requires": { + "@babel/template": "^7.10.1", + "@babel/types": "^7.10.1" + }, + "dependencies": { + "@babel/template": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.1.tgz", + "integrity": "sha512-OQDg6SqvFSsc9A0ej6SKINWrpJiNonRIniYondK2ViKhB06i3c0s+76XUft71iqBEe9S1OKsHwPAjfHnuvnCig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.1", + "@babel/parser": "^7.10.1", + "@babel/types": "^7.10.1" + } + } + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.1.tgz", + "integrity": "sha512-UQ1LVBPrYdbchNhLwj6fetj46BcFwfS4NllJo/1aJsT+1dLTEnXJL0qHqtY7gPzF8S2fXBJamf1biAXV3X077g==", + "dev": true, + "requires": { + "@babel/types": "^7.10.1" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.1.tgz", + "integrity": "sha512-5vW/JXLALhczRCWP0PnFDMCJAchlBvM7f4uk/jXritBnIa6E1KmqmtrS3yn1LAnxFBypQ3eneLuXjsnfQsgILw==", + "dev": true + }, + "@babel/helper-wrap-function": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.10.1.tgz", + "integrity": "sha512-C0MzRGteVDn+H32/ZgbAv5r56f2o1fZSA/rj/TYo8JEJNHg+9BdSmKBUND0shxWRztWhjlT2cvHYuynpPsVJwQ==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.10.1", + "@babel/template": "^7.10.1", + "@babel/traverse": "^7.10.1", + "@babel/types": "^7.10.1" + }, + "dependencies": { + "@babel/template": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.1.tgz", + "integrity": "sha512-OQDg6SqvFSsc9A0ej6SKINWrpJiNonRIniYondK2ViKhB06i3c0s+76XUft71iqBEe9S1OKsHwPAjfHnuvnCig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.1", + "@babel/parser": "^7.10.1", + "@babel/types": "^7.10.1" + } + } + } + }, + "@babel/helpers": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.10.1.tgz", + "integrity": "sha512-muQNHF+IdU6wGgkaJyhhEmI54MOZBKsFfsXFhboz1ybwJ1Kl7IHlbm2a++4jwrmY5UYsgitt5lfqo1wMFcHmyw==", + "dev": true, + "requires": { + "@babel/template": "^7.10.1", + "@babel/traverse": "^7.10.1", + "@babel/types": "^7.10.1" + }, + "dependencies": { + "@babel/template": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.10.1.tgz", + "integrity": "sha512-OQDg6SqvFSsc9A0ej6SKINWrpJiNonRIniYondK2ViKhB06i3c0s+76XUft71iqBEe9S1OKsHwPAjfHnuvnCig==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.1", + "@babel/parser": "^7.10.1", + "@babel/types": "^7.10.1" + } + } + } + }, + "@babel/highlight": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.1.tgz", + "integrity": "sha512-8rMof+gVP8mxYZApLF/JgNDAkdKa+aJt3ZYxF8z6+j/hpeXL7iMsKCPHa2jNMHu/qqBwzQF4OHNoYi8dMA/rYg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.1", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.2.tgz", + "integrity": "sha512-PApSXlNMJyB4JiGVhCOlzKIif+TKFTvu0aQAhnTvfP/z3vVSN6ZypH5bfUNwFXXjRQtUEBNFd2PtmCmG2Py3qQ==", + "dev": true + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.10.1.tgz", + "integrity": "sha512-vzZE12ZTdB336POZjmpblWfNNRpMSua45EYnRigE2XsZxcXcIyly2ixnTJasJE4Zq3U7t2d8rRF7XRUuzHxbOw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/helper-remap-async-to-generator": "^7.10.1", + "@babel/plugin-syntax-async-generators": "^7.8.0" + } + }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.10.1.tgz", + "integrity": "sha512-Cpc2yUVHTEGPlmiQzXj026kqwjEQAD9I4ZC16uzdbgWgitg/UHKHLffKNCQZ5+y8jpIZPJcKcwsr2HwPh+w3XA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/plugin-syntax-dynamic-import": "^7.8.0" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.10.1.tgz", + "integrity": "sha512-m8r5BmV+ZLpWPtMY2mOKN7wre6HIO4gfIiV+eOmsnZABNenrt/kzYBwrh+KOfgumSWpnlGs5F70J8afYMSJMBg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/plugin-syntax-json-strings": "^7.8.0" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.10.1.tgz", + "integrity": "sha512-56cI/uHYgL2C8HVuHOuvVowihhX0sxb3nnfVRzUeVHTWmRHTZrKuAh/OBIMggGU/S1g/1D2CRCXqP+3u7vX7iA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0" + } + }, + "@babel/plugin-proposal-numeric-separator": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.10.1.tgz", + "integrity": "sha512-jjfym4N9HtCiNfyyLAVD8WqPYeHUrw4ihxuAynWj6zzp2gf9Ey2f7ImhFm6ikB3CLf5Z/zmcJDri6B4+9j9RsA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/plugin-syntax-numeric-separator": "^7.10.1" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.10.1.tgz", + "integrity": "sha512-Z+Qri55KiQkHh7Fc4BW6o+QBuTagbOp9txE+4U1i79u9oWlf2npkiDx+Rf3iK3lbcHBuNy9UOkwuR5wOMH3LIQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0", + "@babel/plugin-transform-parameters": "^7.10.1" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.10.1.tgz", + "integrity": "sha512-VqExgeE62YBqI3ogkGoOJp1R6u12DFZjqwJhqtKc2o5m1YTUuUWnos7bZQFBhwkxIFpWYJ7uB75U7VAPPiKETA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.10.1.tgz", + "integrity": "sha512-dqQj475q8+/avvok72CF3AOSV/SGEcH29zT5hhohqqvvZ2+boQoOr7iGldBG5YXTO2qgCgc2B3WvVLUdbeMlGA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/plugin-syntax-optional-chaining": "^7.8.0" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.10.1.tgz", + "integrity": "sha512-JjfngYRvwmPwmnbRZyNiPFI8zxCZb8euzbCG/LxyKdeTb59tVciKo9GK9bi6JYKInk1H11Dq9j/zRqIH4KigfQ==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.1.tgz", + "integrity": "sha512-uTd0OsHrpe3tH5gRPTxG8Voh99/WCU78vIm5NMRYPAqC8lR4vajt6KkCAknCHrx24vkPdd/05yfdGSB4EIY2mg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.10.1.tgz", + "integrity": "sha512-hgA5RYkmZm8FTFT3yu2N9Bx7yVVOKYT6yEdXXo6j2JTm0wNxgqaGeQVaSHRjhfnQbX91DtjFB6McRFSlcJH3xQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.10.1.tgz", + "integrity": "sha512-6AZHgFJKP3DJX0eCNJj01RpytUa3SOGawIxweHkNX2L6PYikOZmoh5B0d7hIHaIgveMjX990IAa/xK7jRTN8OA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.10.1.tgz", + "integrity": "sha512-XCgYjJ8TY2slj6SReBUyamJn3k2JLUIiiR5b6t1mNCMSvv7yx+jJpaewakikp0uWFQSF7ChPPoe3dHmXLpISkg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/helper-remap-async-to-generator": "^7.10.1" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.10.1.tgz", + "integrity": "sha512-B7K15Xp8lv0sOJrdVAoukKlxP9N59HS48V1J3U/JGj+Ad+MHq+am6xJVs85AgXrQn4LV8vaYFOB+pr/yIuzW8Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.10.1.tgz", + "integrity": "sha512-8bpWG6TtF5akdhIm/uWTyjHqENpy13Fx8chg7pFH875aNLwX8JxIxqm08gmAT+Whe6AOmaTeLPe7dpLbXt+xUw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "lodash": "^4.17.13" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.10.1.tgz", + "integrity": "sha512-P9V0YIh+ln/B3RStPoXpEQ/CoAxQIhRSUn7aXqQ+FZJ2u8+oCtjIXR3+X0vsSD8zv+mb56K7wZW1XiDTDGiDRQ==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.10.1", + "@babel/helper-define-map": "^7.10.1", + "@babel/helper-function-name": "^7.10.1", + "@babel/helper-optimise-call-expression": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/helper-replace-supers": "^7.10.1", + "@babel/helper-split-export-declaration": "^7.10.1", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.10.1.tgz", + "integrity": "sha512-mqSrGjp3IefMsXIenBfGcPXxJxweQe2hEIwMQvjtiDQ9b1IBvDUjkAtV/HMXX47/vXf14qDNedXsIiNd1FmkaQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.10.1.tgz", + "integrity": "sha512-V/nUc4yGWG71OhaTH705pU8ZSdM6c1KmmLP8ys59oOYbT7RpMYAR3MsVOt6OHL0WzG7BlTU076va9fjJyYzJMA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.10.1.tgz", + "integrity": "sha512-19VIMsD1dp02RvduFUmfzj8uknaO3uiHHF0s3E1OHnVsNj8oge8EQ5RzHRbJjGSetRnkEuBYO7TG1M5kKjGLOA==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.10.1.tgz", + "integrity": "sha512-wIEpkX4QvX8Mo9W6XF3EdGttrIPZWozHfEaDTU0WJD/TDnXMvdDh30mzUl/9qWhnf7naicYartcEfUghTCSNpA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.10.1.tgz", + "integrity": "sha512-lr/przdAbpEA2BUzRvjXdEDLrArGRRPwbaF9rvayuHRvdQ7lUTTkZnhZrJ4LE2jvgMRFF4f0YuPQ20vhiPYxtA==", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.10.1.tgz", + "integrity": "sha512-US8KCuxfQcn0LwSCMWMma8M2R5mAjJGsmoCBVwlMygvmDUMkTCykc84IqN1M7t+agSfOmLYTInLCHJM+RUoz+w==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.10.1.tgz", + "integrity": "sha512-//bsKsKFBJfGd65qSNNh1exBy5Y9gD9ZN+DvrJ8f7HXr4avE5POW6zB7Rj6VnqHV33+0vXWUwJT0wSHubiAQkw==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.10.1.tgz", + "integrity": "sha512-qi0+5qgevz1NHLZroObRm5A+8JJtibb7vdcPQF1KQE12+Y/xxl8coJ+TpPW9iRq+Mhw/NKLjm+5SHtAHCC7lAw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.10.1.tgz", + "integrity": "sha512-UmaWhDokOFT2GcgU6MkHC11i0NQcL63iqeufXWfRy6pUOGYeCGEKhvfFO6Vz70UfYJYHwveg62GS83Rvpxn+NA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.10.1.tgz", + "integrity": "sha512-31+hnWSFRI4/ACFr1qkboBbrTxoBIzj7qA69qlq8HY8p7+YCzkCT6/TvQ1a4B0z27VeWtAeJd6pr5G04dc1iHw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.10.1.tgz", + "integrity": "sha512-AQG4fc3KOah0vdITwt7Gi6hD9BtQP/8bhem7OjbaMoRNCH5Djx42O2vYMfau7QnAzQCa+RJnhJBmFFMGpQEzrg==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/helper-simple-access": "^7.10.1", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.10.1.tgz", + "integrity": "sha512-ewNKcj1TQZDL3YnO85qh9zo1YF1CHgmSTlRQgHqe63oTrMI85cthKtZjAiZSsSNjPQ5NCaYo5QkbYqEw1ZBgZA==", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.10.1", + "@babel/helper-module-transforms": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.10.1.tgz", + "integrity": "sha512-EIuiRNMd6GB6ulcYlETnYYfgv4AxqrswghmBRQbWLHZxN4s7mupxzglnHqk9ZiUpDI4eRWewedJJNj67PWOXKA==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.8.3.tgz", + "integrity": "sha512-f+tF/8UVPU86TrCb06JoPWIdDpTNSGGcAtaD9mLP0aYGA0OS0j7j7DHJR0GTFrUZPUU6loZhbsVZgTh0N+Qdnw==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.8.3" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.10.1.tgz", + "integrity": "sha512-MBlzPc1nJvbmO9rPr1fQwXOM2iGut+JC92ku6PbiJMMK7SnQc1rytgpopveE3Evn47gzvGYeCdgfCDbZo0ecUw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.10.1.tgz", + "integrity": "sha512-WnnStUDN5GL+wGQrJylrnnVlFhFmeArINIR9gjhSeYyvroGhBrSAXYg/RHsnfzmsa+onJrTJrEClPzgNmmQ4Gw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/helper-replace-supers": "^7.10.1" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.10.1.tgz", + "integrity": "sha512-tJ1T0n6g4dXMsL45YsSzzSDZCxiHXAQp/qHrucOq5gEHncTA3xDxnd5+sZcoQp+N1ZbieAaB8r/VUCG0gqseOg==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.10.1.tgz", + "integrity": "sha512-Kr6+mgag8auNrgEpbfIWzdXYOvqDHZOF0+Bx2xh4H2EDNwcbRb9lY6nkZg8oSjsX+DH9Ebxm9hOqtKW+gRDeNA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.10.1.tgz", + "integrity": "sha512-B3+Y2prScgJ2Bh/2l9LJxKbb8C8kRfsG4AdPT+n7ixBHIxJaIG8bi8tgjxUMege1+WqSJ+7gu1YeoMVO3gPWzw==", + "dev": true, + "requires": { + "regenerator-transform": "^0.14.2" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.10.1.tgz", + "integrity": "sha512-qN1OMoE2nuqSPmpTqEM7OvJ1FkMEV+BjVeZZm9V9mq/x1JLKQ4pcv8riZJMNN3u2AUGl0ouOMjRr2siecvHqUQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.10.1.tgz", + "integrity": "sha512-AR0E/lZMfLstScFwztApGeyTHJ5u3JUKMjneqRItWeEqDdHWZwAOKycvQNCasCK/3r5YXsuNG25funcJDu7Y2g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.10.1.tgz", + "integrity": "sha512-8wTPym6edIrClW8FI2IoaePB91ETOtg36dOkj3bYcNe7aDMN2FXEoUa+WrmPc4xa1u2PQK46fUX2aCb+zo9rfw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.10.1.tgz", + "integrity": "sha512-j17ojftKjrL7ufX8ajKvwRilwqTok4q+BjkknmQw9VNHnItTyMP5anPFzxFJdCQs7clLcWpCV3ma+6qZWLnGMA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1", + "@babel/helper-regex": "^7.10.1" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.10.1.tgz", + "integrity": "sha512-t7B/3MQf5M1T9hPCRG28DNGZUuxAuDqLYS03rJrIk2prj/UV7Z6FOneijhQhnv/Xa039vidXeVbvjK2SK5f7Gg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.10.1.tgz", + "integrity": "sha512-qX8KZcmbvA23zDi+lk9s6hC1FM7jgLHYIjuLgULgc8QtYnmB3tAVIYkNoKRQ75qWBeyzcoMoK8ZQmogGtC/w0g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.10.1.tgz", + "integrity": "sha512-Y/2a2W299k0VIUdbqYm9X2qS6fE0CUBhhiPpimK6byy7OJ/kORLlIX+J6UrjgNu5awvs62k+6RSslxhcvVw2Tw==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.10.1", + "@babel/helper-plugin-utils": "^7.10.1" + } + }, + "@babel/preset-env": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.9.0.tgz", + "integrity": "sha512-712DeRXT6dyKAM/FMbQTV/FvRCms2hPCx+3weRjZ8iQVQWZejWWk1wwG6ViWMyqb/ouBbGOl5b6aCk0+j1NmsQ==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.9.0", + "@babel/helper-compilation-targets": "^7.8.7", + "@babel/helper-module-imports": "^7.8.3", + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-proposal-async-generator-functions": "^7.8.3", + "@babel/plugin-proposal-dynamic-import": "^7.8.3", + "@babel/plugin-proposal-json-strings": "^7.8.3", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-proposal-numeric-separator": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.9.0", + "@babel/plugin-proposal-optional-catch-binding": "^7.8.3", + "@babel/plugin-proposal-optional-chaining": "^7.9.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.8.3", + "@babel/plugin-syntax-async-generators": "^7.8.0", + "@babel/plugin-syntax-dynamic-import": "^7.8.0", + "@babel/plugin-syntax-json-strings": "^7.8.0", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.0", + "@babel/plugin-syntax-numeric-separator": "^7.8.0", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.0", + "@babel/plugin-syntax-top-level-await": "^7.8.3", + "@babel/plugin-transform-arrow-functions": "^7.8.3", + "@babel/plugin-transform-async-to-generator": "^7.8.3", + "@babel/plugin-transform-block-scoped-functions": "^7.8.3", + "@babel/plugin-transform-block-scoping": "^7.8.3", + "@babel/plugin-transform-classes": "^7.9.0", + "@babel/plugin-transform-computed-properties": "^7.8.3", + "@babel/plugin-transform-destructuring": "^7.8.3", + "@babel/plugin-transform-dotall-regex": "^7.8.3", + "@babel/plugin-transform-duplicate-keys": "^7.8.3", + "@babel/plugin-transform-exponentiation-operator": "^7.8.3", + "@babel/plugin-transform-for-of": "^7.9.0", + "@babel/plugin-transform-function-name": "^7.8.3", + "@babel/plugin-transform-literals": "^7.8.3", + "@babel/plugin-transform-member-expression-literals": "^7.8.3", + "@babel/plugin-transform-modules-amd": "^7.9.0", + "@babel/plugin-transform-modules-commonjs": "^7.9.0", + "@babel/plugin-transform-modules-systemjs": "^7.9.0", + "@babel/plugin-transform-modules-umd": "^7.9.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", + "@babel/plugin-transform-new-target": "^7.8.3", + "@babel/plugin-transform-object-super": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.8.7", + "@babel/plugin-transform-property-literals": "^7.8.3", + "@babel/plugin-transform-regenerator": "^7.8.7", + "@babel/plugin-transform-reserved-words": "^7.8.3", + "@babel/plugin-transform-shorthand-properties": "^7.8.3", + "@babel/plugin-transform-spread": "^7.8.3", + "@babel/plugin-transform-sticky-regex": "^7.8.3", + "@babel/plugin-transform-template-literals": "^7.8.3", + "@babel/plugin-transform-typeof-symbol": "^7.8.4", + "@babel/plugin-transform-unicode-regex": "^7.8.3", + "@babel/preset-modules": "^0.1.3", + "@babel/types": "^7.9.0", + "browserslist": "^4.9.1", + "core-js-compat": "^3.6.2", + "invariant": "^2.2.2", + "levenary": "^1.1.1", + "semver": "^5.5.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "@babel/preset-modules": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.3.tgz", + "integrity": "sha512-Ra3JXOHBq2xd56xSF7lMKXdjBn3T772Y1Wet3yWnkDly9zHvJki029tAFzvAAK5cf4YV3yoxuP61crYRol6SVg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + } + }, + "@babel/runtime": { + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.10.2.tgz", + "integrity": "sha512-6sF3uQw2ivImfVIl62RZ7MXhO2tap69WeWK57vAaimT6AZbE4FbqjdEJIN1UqoD6wI6B+1n9UiagafH1sxjOtg==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/template": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz", + "integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.8.3", + "@babel/parser": "^7.8.6", + "@babel/types": "^7.8.6" + } + }, + "@babel/traverse": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.10.1.tgz", + "integrity": "sha512-C/cTuXeKt85K+p08jN6vMDz8vSV0vZcI0wmQ36o6mjbuo++kPMdpOYw23W2XH04dbRt9/nMEfA4W3eR21CD+TQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.1", + "@babel/generator": "^7.10.1", + "@babel/helper-function-name": "^7.10.1", + "@babel/helper-split-export-declaration": "^7.10.1", + "@babel/parser": "^7.10.1", + "@babel/types": "^7.10.1", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.13" + }, + "dependencies": { + "@babel/generator": { + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.2.tgz", + "integrity": "sha512-AxfBNHNu99DTMvlUPlt1h2+Hn7knPpH5ayJ8OqDWSeLld+Fi2AYBTC/IejWDM9Edcii4UzZRCsbUt0WlSDsDsA==", + "dev": true, + "requires": { + "@babel/types": "^7.10.2", + "jsesc": "^2.5.1", + "lodash": "^4.17.13", + "source-map": "^0.5.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.1", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, + "@istanbuljs/schema": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz", + "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==", + "dev": true + }, + "@jsdevtools/coverage-istanbul-loader": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@jsdevtools/coverage-istanbul-loader/-/coverage-istanbul-loader-3.0.3.tgz", + "integrity": "sha512-TAdNkeGB5Fe4Og+ZkAr1Kvn9by2sfL44IAHFtxlh1BA1XJ5cLpO9iSNki5opWESv3l3vSHsZ9BNKuqFKbEbFaA==", + "dev": true, + "requires": { + "convert-source-map": "^1.7.0", + "istanbul-lib-instrument": "^4.0.1", + "loader-utils": "^1.4.0", + "merge-source-map": "^1.1.0", + "schema-utils": "^2.6.4" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "@ngtools/webpack": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-9.1.7.tgz", + "integrity": "sha512-A7VB2I42Kn+7jl0tDKzGNLAoZLWSqkKo9Hg1bmKpvAAIz+DSbq3uV+JWgGgTprM3tn0lfkVgmqk4H17HKwAOcg==", + "dev": true, + "requires": { + "@angular-devkit/core": "9.1.7", + "enhanced-resolve": "4.1.1", + "rxjs": "6.5.4", + "webpack-sources": "1.4.3" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } + } + }, + "@schematics/angular": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/@schematics/angular/-/angular-9.1.7.tgz", + "integrity": "sha512-ld3WcoMWvup04V3OWioQ+AFGQBzz7IDM4Fxc5+Qc3wILWkDJnNkrc4EmJAow96Ab4/T1+Wl1vof3tV4At0BTzA==", + "dev": true, + "requires": { + "@angular-devkit/core": "9.1.7", + "@angular-devkit/schematics": "9.1.7" + } + }, + "@schematics/update": { + "version": "0.901.7", + "resolved": "https://registry.npmjs.org/@schematics/update/-/update-0.901.7.tgz", + "integrity": "sha512-6IpQVFvbu47CrXfqqHAzv2vi7AOdfi1S+SiayXU6FWTeA2wV47H8R60VjxurL8JkDGoVhFgC4+lK6KG++g3dQw==", + "dev": true, + "requires": { + "@angular-devkit/core": "9.1.7", + "@angular-devkit/schematics": "9.1.7", + "@yarnpkg/lockfile": "1.1.0", + "ini": "1.3.5", + "npm-package-arg": "^8.0.0", + "pacote": "9.5.12", + "rxjs": "6.5.4", + "semver": "7.1.3", + "semver-intersect": "1.4.0" + }, + "dependencies": { + "rxjs": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", + "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + } + } + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "@types/glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-VgNIkxK+j7Nz5P7jvUZlRvhuPSmsEfS03b0alKcq5V/STUKAa3Plemsn5mrQUO7am6OErJ4rhGEGJbACclrtRA==", + "dev": true, + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/jasmine": { + "version": "3.5.10", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.5.10.tgz", + "integrity": "sha512-3F8qpwBAiVc5+HPJeXJpbrl+XjawGmciN5LgiO7Gv1pl1RHtjoMNqZpqEksaPJW05ViKe8snYInRs6xB25Xdew==", + "dev": true + }, + "@types/jasminewd2": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/@types/jasminewd2/-/jasminewd2-2.0.8.tgz", + "integrity": "sha512-d9p31r7Nxk0ZH0U39PTH0hiDlJ+qNVGjlt1ucOoTUptxb2v+Y5VMnsxfwN+i3hK4yQnqBi3FMmoMFcd1JHDxdg==", + "dev": true, + "requires": { + "@types/jasmine": "*" + } + }, + "@types/json-schema": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", + "dev": true + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/node": { + "version": "12.12.44", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.44.tgz", + "integrity": "sha512-jM6QVv0Sm5d3nW+nUD5jSzPcO6oPqboitSNcwgBay9hifVq/Rauq1PYnROnsmuw45JMBiTnsPAno0bKu2e2xrg==", + "dev": true + }, + "@types/q": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz", + "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==", + "dev": true + }, + "@types/selenium-webdriver": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-3.0.17.tgz", + "integrity": "sha512-tGomyEuzSC1H28y2zlW6XPCaDaXFaD6soTdb4GNdmte2qfHtrKqhy0ZFs4r/1hpazCfEZqeTSRLvSasmEx89uw==", + "dev": true + }, + "@types/source-list-map": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz", + "integrity": "sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA==", + "dev": true + }, + "@types/webpack-sources": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.8.tgz", + "integrity": "sha512-JHB2/xZlXOjzjBB6fMOpH1eQAfsrpqVVIbneE0Rok16WXwFaznaI5vfg75U5WgGJm7V9W1c4xeRQDjX/zwvghA==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "@webassemblyjs/ast": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", + "integrity": "sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ==", + "dev": true, + "requires": { + "@webassemblyjs/helper-module-context": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/wast-parser": "1.8.5" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz", + "integrity": "sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz", + "integrity": "sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz", + "integrity": "sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q==", + "dev": true + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz", + "integrity": "sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ==", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.8.5" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz", + "integrity": "sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow==", + "dev": true + }, + "@webassemblyjs/helper-module-context": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz", + "integrity": "sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "mamacro": "^0.0.3" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz", + "integrity": "sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz", + "integrity": "sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz", + "integrity": "sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g==", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.8.5.tgz", + "integrity": "sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.8.5.tgz", + "integrity": "sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz", + "integrity": "sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/helper-wasm-section": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5", + "@webassemblyjs/wasm-opt": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5", + "@webassemblyjs/wast-printer": "1.8.5" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz", + "integrity": "sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/ieee754": "1.8.5", + "@webassemblyjs/leb128": "1.8.5", + "@webassemblyjs/utf8": "1.8.5" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz", + "integrity": "sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-buffer": "1.8.5", + "@webassemblyjs/wasm-gen": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz", + "integrity": "sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-api-error": "1.8.5", + "@webassemblyjs/helper-wasm-bytecode": "1.8.5", + "@webassemblyjs/ieee754": "1.8.5", + "@webassemblyjs/leb128": "1.8.5", + "@webassemblyjs/utf8": "1.8.5" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz", + "integrity": "sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/floating-point-hex-parser": "1.8.5", + "@webassemblyjs/helper-api-error": "1.8.5", + "@webassemblyjs/helper-code-frame": "1.8.5", + "@webassemblyjs/helper-fsm": "1.8.5", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz", + "integrity": "sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/wast-parser": "1.8.5", + "@xtuc/long": "4.2.2" + } + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "@yarnpkg/lockfile": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz", + "integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==", + "dev": true + }, + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "accepts": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "dev": true, + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, + "acorn": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "dev": true + }, + "adm-zip": { + "version": "0.4.14", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.14.tgz", + "integrity": "sha512-/9aQCnQHF+0IiCl0qhXoK7qs//SwYE7zX8lsr/DNk1BRAHYxeLZPL4pguwK29gUEqasYQjqPtEpDRSWEkdHn9g==", + "dev": true + }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", + "dev": true + }, + "agent-base": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", + "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "agentkeepalive": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-3.5.2.tgz", + "integrity": "sha512-e0L/HNe6qkQ7H19kTlRRqUibEAwDK5AFk6y3PtMsuut2VAH6+Q4xZml1tNDJD7kSAyqmbG/K08K5WEJYtUrSlQ==", + "dev": true, + "requires": { + "humanize-ms": "^1.2.1" + } + }, + "aggregate-error": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz", + "integrity": "sha512-quoaXsZ9/BLNae5yiNoUz+Nhkwz83GhWwtYFglcjEQB2NDHCIpApbqXxIFnm4Pq/Nvhrsq5sYJFyohrrxnTGAA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ajv": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", + "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-errors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.1.tgz", + "integrity": "sha512-DCRfO/4nQ+89p/RK43i8Ezd41EqdGIU4ld7nGF8OQ14oc/we5rEntLCUa7+jrn3nn83BosfwZA0wb4pon2o8iQ==", + "dev": true + }, + "ajv-keywords": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz", + "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==", + "dev": true + }, + "alphanum-sort": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", + "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", + "dev": true + }, + "ansi-colors": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", + "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", + "dev": true + }, + "ansi-escapes": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, + "requires": { + "type-fest": "^0.11.0" + } + }, + "ansi-html": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz", + "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "app-root-path": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.2.1.tgz", + "integrity": "sha512-91IFKeKk7FjfmezPKkwtaRvSpnUc4gDwPAjA1YZ9Gn0q0PPeW+vbeUsZuyDwjI7+QTHhcLen2v25fi/AmhvbJA==", + "dev": true + }, + "append-transform": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-1.0.0.tgz", + "integrity": "sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw==", + "dev": true, + "requires": { + "default-require-extensions": "^2.0.0" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "aria-query": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-3.0.0.tgz", + "integrity": "sha1-ZbP8wcoRVajJrmTW7uKX8V1RM8w=", + "dev": true, + "requires": { + "ast-types-flow": "0.0.7", + "commander": "^2.11.0" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-flatten": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", + "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arraybuffer.slice": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", + "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", + "dev": true, + "requires": { + "object-assign": "^4.1.1", + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "ast-types-flow": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", + "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=", + "dev": true + }, + "async": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", + "dev": true, + "requires": { + "lodash": "^4.17.14" + } + }, + "async-each": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", + "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", + "dev": true + }, + "async-limiter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "autoprefixer": { + "version": "9.7.4", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.4.tgz", + "integrity": "sha512-g0Ya30YrMBAEZk60lp+qfX5YQllG+S5W3GYCFvyHTvhOki0AEQJLPEcIuGRsqVwLi8FvXPVtwTGhfr38hVpm0g==", + "dev": true, + "requires": { + "browserslist": "^4.8.3", + "caniuse-lite": "^1.0.30001020", + "chalk": "^2.4.2", + "normalize-range": "^0.1.2", + "num2fraction": "^1.2.2", + "postcss": "^7.0.26", + "postcss-value-parser": "^4.0.2" + } + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", + "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==", + "dev": true + }, + "axobject-query": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.2.tgz", + "integrity": "sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww==", + "dev": true, + "requires": { + "ast-types-flow": "0.0.7" + } + }, + "babel-loader": { + "version": "8.0.6", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.6.tgz", + "integrity": "sha512-4BmWKtBOBm13uoUwd08UwjZlaw3O9GWf456R9j+5YykFZ6LUIjIKLc0zEZf+hauxPOJs96C8k6FvYD09vWzhYw==", + "dev": true, + "requires": { + "find-cache-dir": "^2.0.0", + "loader-utils": "^1.0.2", + "mkdirp": "^0.5.1", + "pify": "^4.0.1" + }, + "dependencies": { + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", + "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", + "dev": true, + "requires": { + "object.assign": "^4.1.0" + } + }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=", + "dev": true + }, + "base64-js": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", + "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==", + "dev": true + }, + "base64id": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", + "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", + "dev": true + }, + "batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "dev": true, + "requires": { + "callsite": "1.0.0" + } + }, + "big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true + }, + "binary-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", + "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "dev": true + }, + "blob": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", + "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==", + "dev": true + }, + "blocking-proxy": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/blocking-proxy/-/blocking-proxy-1.0.1.tgz", + "integrity": "sha512-KE8NFMZr3mN2E0HcvCgRtX7DjhiIQrwle+nSVJVC/yqFb9+xznHl2ZcoBp2L9qzkI4t4cBFJ1efXF8Dwi132RA==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, + "bn.js": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.2.tgz", + "integrity": "sha512-40rZaf3bUNKTVYu9sIeeEGOg7g14Yvnj9kH7b50EiwX0Q7A6umbvfI5tvHaOERH0XigqKkfLkFQxzb4e6CIXnA==", + "dev": true + }, + "body-parser": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", + "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "dev": true, + "requires": { + "bytes": "3.1.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.7.0", + "raw-body": "2.4.0", + "type-is": "~1.6.17" + }, + "dependencies": { + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "dev": true + } + } + }, + "bonjour": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz", + "integrity": "sha1-jokKGD2O6aI5OzhExpGkK897yfU=", + "dev": true, + "requires": { + "array-flatten": "^2.1.0", + "deep-equal": "^1.0.1", + "dns-equal": "^1.0.0", + "dns-txt": "^2.0.2", + "multicast-dns": "^6.0.1", + "multicast-dns-service-types": "^1.1.0" + } + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "bootstrap": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.5.0.tgz", + "integrity": "sha512-Z93QoXvodoVslA+PWNdk23Hze4RBYIkpb5h8I2HY2Tu2h7A0LpAgLcyrhrSUyo2/Oxm2l1fRZPs1e5hnxnliXA==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "browserify-sign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.0.tgz", + "integrity": "sha512-hEZC1KEeYuoHRqhGhTy6gWrpJA3ZDjFWv0DE61643ZnOXAKJb3u7yWcrU0mMc9SwAqK1n7myPGndkp0dFG7NFA==", + "dev": true, + "requires": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.2", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "browserslist": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.12.0.tgz", + "integrity": "sha512-UH2GkcEDSI0k/lRkuDSzFl9ZZ87skSy9w2XAn1MsZnL+4c4rqbBd3e82UWHbYDpztABrPBhZsTEeuxVfHppqDg==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001043", + "electron-to-chromium": "^1.3.413", + "node-releases": "^1.1.53", + "pkg-up": "^2.0.0" + } + }, + "browserstack": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/browserstack/-/browserstack-1.6.0.tgz", + "integrity": "sha512-HJDJ0TSlmkwnt9RZ+v5gFpa1XZTBYTj0ywvLwJ3241J7vMw2jAsGNVhKHtmCOyg+VxeLZyaibO9UL71AsUeDIw==", + "dev": true, + "requires": { + "https-proxy-agent": "^2.2.1" + } + }, + "buffer": { + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", + "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "buffer-indexof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz", + "integrity": "sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, + "cacache": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.0.0.tgz", + "integrity": "sha512-L0JpXHhplbJSiDGzyJJnJCTL7er7NzbBgxzVqLswEb4bO91Zbv17OUMuUeu/q0ZwKn3V+1HM4wb9tO4eVE/K8g==", + "dev": true, + "requires": { + "chownr": "^1.1.2", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "infer-owner": "^1.0.4", + "lru-cache": "^5.1.1", + "minipass": "^3.1.1", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^1.0.3", + "move-concurrently": "^1.0.1", + "p-map": "^3.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^2.7.1", + "ssri": "^8.0.0", + "tar": "^6.0.1", + "unique-filename": "^1.1.1" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "dev": true, + "requires": { + "callsites": "^2.0.0" + } + }, + "caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "dev": true, + "requires": { + "caller-callsite": "^2.0.0" + } + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=", + "dev": true + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "caniuse-api": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", + "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "caniuse-lite": "^1.0.0", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + } + }, + "caniuse-lite": { + "version": "1.0.30001078", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001078.tgz", + "integrity": "sha512-sF12qXe9VMm32IEf/+NDvmTpwJaaU7N1igpiH2FdI4DyABJSsOqG3ZAcFvszLkoLoo1y6VJLMYivukUAxaMASw==", + "dev": true + }, + "canonical-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/canonical-path/-/canonical-path-1.0.0.tgz", + "integrity": "sha512-feylzsbDxi1gPZ1IjystzIQZagYYLvfKrSuygUCgf7z6x790VEzze5QEkdSV1U58RA7Hi0+v6fv4K54atOzATg==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "chokidar": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz", + "integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.4.0" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, + "chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.2.tgz", + "integrity": "sha512-9e/zx1jw7B4CO+c/RXoCsfg/x1AfUBioy4owYH0bJprEYAx5hRFLRhWBqHAG57D0ZM4H7vxbP7bPe0VwhQRYDQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "circular-dependency-plugin": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/circular-dependency-plugin/-/circular-dependency-plugin-5.2.0.tgz", + "integrity": "sha512-7p4Kn/gffhQaavNfyDFg7LS5S/UT1JAjyGd4UqR2+jzoYF02eDkj0Ec3+48TsIa4zghjLY87nQHIh/ecK9qLdw==", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "requires": { + "restore-cursor": "^3.1.0" + } + }, + "cli-spinners": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.3.0.tgz", + "integrity": "sha512-Xs2Hf2nzrvJMFKimOR7YR0QwZ8fc0u98kdtwN1eNAZzNQgH3vK2pXzff6GJtKh7S5hoJ87ECiAiZFS2fb5Ii2w==", + "dev": true + }, + "cli-width": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", + "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "dev": true + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "coa": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/coa/-/coa-2.0.2.tgz", + "integrity": "sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA==", + "dev": true, + "requires": { + "@types/q": "^1.5.1", + "chalk": "^2.4.1", + "q": "^1.1.2" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "codelyzer": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/codelyzer/-/codelyzer-5.2.2.tgz", + "integrity": "sha512-jB4FZ1Sx7kZhvZVdf+N2BaKTdrrNZOL0Bj10RRfrhHrb3zEvXjJvvq298JPMJAiyiCS/v4zs1QlGU0ip7xGqeA==", + "dev": true, + "requires": { + "app-root-path": "^2.2.1", + "aria-query": "^3.0.0", + "axobject-query": "2.0.2", + "css-selector-tokenizer": "^0.7.1", + "cssauron": "^1.4.0", + "damerau-levenshtein": "^1.0.4", + "semver-dsl": "^1.0.1", + "source-map": "^0.5.7", + "sprintf-js": "^1.1.2" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true + } + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/color/-/color-3.1.2.tgz", + "integrity": "sha512-vXTJhHebByxZn3lDvDJYw4lR5+uB3vuoHsuYA5AKuxRVn5wzzIfQKGLBmgdVRHKTJYeK5rvJcHnrd0Li49CFpg==", + "dev": true, + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "color-string": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "dev": true, + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", + "dev": true + }, + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "dev": true + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + "dev": true + }, + "compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "requires": { + "mime-db": ">= 1.43.0 < 2" + } + }, + "compression": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "dev": true, + "requires": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "connect": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", + "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", + "dev": true, + "requires": { + "debug": "2.6.9", + "finalhandler": "1.1.2", + "parseurl": "~1.3.3", + "utils-merge": "1.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "connect-history-api-fallback": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", + "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", + "dev": true + }, + "console-browserify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "content-disposition": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", + "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "dev": true + }, + "convert-source-map": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", + "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "cookie": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", + "dev": true + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", + "dev": true + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "copy-webpack-plugin": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz", + "integrity": "sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg==", + "dev": true, + "requires": { + "cacache": "^12.0.3", + "find-cache-dir": "^2.1.0", + "glob-parent": "^3.1.0", + "globby": "^7.1.1", + "is-glob": "^4.0.1", + "loader-utils": "^1.2.3", + "minimatch": "^3.0.4", + "normalize-path": "^3.0.0", + "p-limit": "^2.2.1", + "schema-utils": "^1.0.0", + "serialize-javascript": "^2.1.2", + "webpack-log": "^2.0.0" + }, + "dependencies": { + "cacache": { + "version": "12.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz", + "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + } + }, + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "ssri": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", + "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1" + } + } + } + }, + "core-js": { + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz", + "integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw==", + "dev": true + }, + "core-js-compat": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.6.5.tgz", + "integrity": "sha512-7ItTKOhOZbznhXAQ2g/slGg1PJV5zDO/WdkTwi7UEOJmkvsE32PWvx6mKtDjiMpjnR2CNf6BAD6sSxIlv7ptng==", + "dev": true, + "requires": { + "browserslist": "^4.8.5", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true + } + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cosmiconfig": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz", + "integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==", + "dev": true, + "requires": { + "import-fresh": "^2.0.0", + "is-directory": "^0.3.1", + "js-yaml": "^3.13.1", + "parse-json": "^4.0.0" + } + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "css": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/css/-/css-2.2.4.tgz", + "integrity": "sha512-oUnjmWpy0niI3x/mPL8dVEI1l7MnG3+HHyRPHf+YFSbK+svOhXpmSOcDURUh2aOCgl2grzrOPt1nHLuCVFULLw==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "source-map": "^0.6.1", + "source-map-resolve": "^0.5.2", + "urix": "^0.1.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "css-color-names": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", + "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=", + "dev": true + }, + "css-declaration-sorter": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-4.0.1.tgz", + "integrity": "sha512-BcxQSKTSEEQUftYpBVnsH4SF05NTuBokb19/sBt6asXGKZ/6VP7PLG1CBCkFDYOnhXhPh0jMhO6xZ71oYHXHBA==", + "dev": true, + "requires": { + "postcss": "^7.0.1", + "timsort": "^0.3.0" + } + }, + "css-loader": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-3.5.1.tgz", + "integrity": "sha512-0G4CbcZzQ9D1Q6ndOfjFuMDo8uLYMu5vc9Abs5ztyHcKvmil6GJrMiNjzzi3tQvUF+mVRuDg7bE6Oc0Prolgig==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "cssesc": "^3.0.0", + "icss-utils": "^4.1.1", + "loader-utils": "^1.2.3", + "normalize-path": "^3.0.0", + "postcss": "^7.0.27", + "postcss-modules-extract-imports": "^2.0.0", + "postcss-modules-local-by-default": "^3.0.2", + "postcss-modules-scope": "^2.2.0", + "postcss-modules-values": "^3.0.0", + "postcss-value-parser": "^4.0.3", + "schema-utils": "^2.6.5", + "semver": "^6.3.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "css-parse": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/css-parse/-/css-parse-2.0.0.tgz", + "integrity": "sha1-pGjuZnwW2BzPBcWMONKpfHgNv9Q=", + "dev": true, + "requires": { + "css": "^2.0.0" + } + }, + "css-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz", + "integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==", + "dev": true, + "requires": { + "boolbase": "^1.0.0", + "css-what": "^3.2.1", + "domutils": "^1.7.0", + "nth-check": "^1.0.2" + } + }, + "css-select-base-adapter": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz", + "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==", + "dev": true + }, + "css-selector-tokenizer": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.2.tgz", + "integrity": "sha512-yj856NGuAymN6r8bn8/Jl46pR+OC3eEvAhfGYDUe7YPtTPAYrSSw4oAniZ9Y8T5B92hjhwTBLUen0/vKPxf6pw==", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "fastparse": "^1.1.2", + "regexpu-core": "^4.6.0" + } + }, + "css-tree": { + "version": "1.0.0-alpha.37", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz", + "integrity": "sha512-DMxWJg0rnz7UgxKT0Q1HU/L9BeJI0M6ksor0OgqOnF+aRCDWg/N2641HmVyU9KVIu0OVVWOb2IpC9A+BJRnejg==", + "dev": true, + "requires": { + "mdn-data": "2.0.4", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "css-what": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.3.0.tgz", + "integrity": "sha512-pv9JPyatiPaQ6pf4OvD/dbfm0o5LviWmwxNWzblYf/1u9QZd0ihV+PMwy5jdQWQ3349kZmKEx9WXuSka2dM4cg==", + "dev": true + }, + "cssauron": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/cssauron/-/cssauron-1.4.0.tgz", + "integrity": "sha1-pmAt/34EqDBtwNuaVR6S6LVmKtg=", + "dev": true, + "requires": { + "through": "X.X.X" + } + }, + "cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true + }, + "cssnano": { + "version": "4.1.10", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz", + "integrity": "sha512-5wny+F6H4/8RgNlaqab4ktc3e0/blKutmq8yNlBFXA//nSFFAqAngjNVRzUvCgYROULmZZUoosL/KSoZo5aUaQ==", + "dev": true, + "requires": { + "cosmiconfig": "^5.0.0", + "cssnano-preset-default": "^4.0.7", + "is-resolvable": "^1.0.0", + "postcss": "^7.0.0" + } + }, + "cssnano-preset-default": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-4.0.7.tgz", + "integrity": "sha512-x0YHHx2h6p0fCl1zY9L9roD7rnlltugGu7zXSKQx6k2rYw0Hi3IqxcoAGF7u9Q5w1nt7vK0ulxV8Lo+EvllGsA==", + "dev": true, + "requires": { + "css-declaration-sorter": "^4.0.1", + "cssnano-util-raw-cache": "^4.0.1", + "postcss": "^7.0.0", + "postcss-calc": "^7.0.1", + "postcss-colormin": "^4.0.3", + "postcss-convert-values": "^4.0.1", + "postcss-discard-comments": "^4.0.2", + "postcss-discard-duplicates": "^4.0.2", + "postcss-discard-empty": "^4.0.1", + "postcss-discard-overridden": "^4.0.1", + "postcss-merge-longhand": "^4.0.11", + "postcss-merge-rules": "^4.0.3", + "postcss-minify-font-values": "^4.0.2", + "postcss-minify-gradients": "^4.0.2", + "postcss-minify-params": "^4.0.2", + "postcss-minify-selectors": "^4.0.2", + "postcss-normalize-charset": "^4.0.1", + "postcss-normalize-display-values": "^4.0.2", + "postcss-normalize-positions": "^4.0.2", + "postcss-normalize-repeat-style": "^4.0.2", + "postcss-normalize-string": "^4.0.2", + "postcss-normalize-timing-functions": "^4.0.2", + "postcss-normalize-unicode": "^4.0.1", + "postcss-normalize-url": "^4.0.1", + "postcss-normalize-whitespace": "^4.0.2", + "postcss-ordered-values": "^4.1.2", + "postcss-reduce-initial": "^4.0.3", + "postcss-reduce-transforms": "^4.0.2", + "postcss-svgo": "^4.0.2", + "postcss-unique-selectors": "^4.0.1" + } + }, + "cssnano-util-get-arguments": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz", + "integrity": "sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8=", + "dev": true + }, + "cssnano-util-get-match": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz", + "integrity": "sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0=", + "dev": true + }, + "cssnano-util-raw-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/cssnano-util-raw-cache/-/cssnano-util-raw-cache-4.0.1.tgz", + "integrity": "sha512-qLuYtWK2b2Dy55I8ZX3ky1Z16WYsx544Q0UWViebptpwn/xDBmog2TLg4f+DBMg1rJ6JDWtn96WHbOKDWt1WQA==", + "dev": true, + "requires": { + "postcss": "^7.0.0" + } + }, + "cssnano-util-same-parent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.1.tgz", + "integrity": "sha512-WcKx5OY+KoSIAxBW6UBBRay1U6vkYheCdjyVNDm85zt5K9mHoGOfsOsqIszfAqrQQFIIKgjh2+FDgIj/zsl21Q==", + "dev": true + }, + "csso": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/csso/-/csso-4.0.3.tgz", + "integrity": "sha512-NL3spysxUkcrOgnpsT4Xdl2aiEiBG6bXswAABQVHcMrfjjBisFOKwLDOmf4wf32aPdcJws1zds2B0Rg+jqMyHQ==", + "dev": true, + "requires": { + "css-tree": "1.0.0-alpha.39" + }, + "dependencies": { + "css-tree": { + "version": "1.0.0-alpha.39", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.39.tgz", + "integrity": "sha512-7UvkEYgBAHRG9Nt980lYxjsTrCyHFN53ky3wVsDkiMdVqylqRt+Zc+jm5qw7/qyOvN2dHSYtX0e4MbCCExSvnA==", + "dev": true, + "requires": { + "mdn-data": "2.0.6", + "source-map": "^0.6.1" + } + }, + "mdn-data": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.6.tgz", + "integrity": "sha512-rQvjv71olwNHgiTbfPZFkJtjNMciWgswYeciZhtvWLO8bmX3TnhyA62I6sTWOyZssWHJJjY6/KiWwqQsWWsqOA==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "custom-event": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", + "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=", + "dev": true + }, + "cyclist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", + "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=", + "dev": true + }, + "damerau-levenshtein": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.6.tgz", + "integrity": "sha512-JVrozIeElnj3QzfUIt8tB8YMluBJom4Vw9qTPpjGYQ9fYlB3D/rb6OordUxf3xeFB35LKWs0xqcO5U6ySvBtug==", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz", + "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==", + "dev": true + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "debuglog": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", + "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "deep-equal": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz", + "integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==", + "dev": true, + "requires": { + "is-arguments": "^1.0.4", + "is-date-object": "^1.0.1", + "is-regex": "^1.0.4", + "object-is": "^1.0.1", + "object-keys": "^1.1.1", + "regexp.prototype.flags": "^1.2.0" + } + }, + "default-gateway": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-4.2.0.tgz", + "integrity": "sha512-h6sMrVB1VMWVrW13mSc6ia/DwYYw5MN6+exNu1OaJeFac5aSAvwM7lZ0NVfTABuSkQelr4h5oebg3KB1XPdjgA==", + "dev": true, + "requires": { + "execa": "^1.0.0", + "ip-regex": "^2.1.0" + } + }, + "default-require-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-2.0.0.tgz", + "integrity": "sha1-9fj7sYp9bVCyH2QfZJ67Uiz+JPc=", + "dev": true, + "requires": { + "strip-bom": "^3.0.0" + } + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "^1.0.2" + }, + "dependencies": { + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + } + } + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "del": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", + "integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "globby": "^6.1.0", + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "pify": "^4.0.1", + "rimraf": "^2.6.3" + }, + "dependencies": { + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "dev": true + }, + "dependency-graph": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/dependency-graph/-/dependency-graph-0.7.2.tgz", + "integrity": "sha512-KqtH4/EZdtdfWX0p6MGP9jljvxSY6msy/pRUD4jgNwVpv3v1QmNLlsB3LDSSUg79BRVSn7jI1QPRtArGABovAQ==", + "dev": true + }, + "des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", + "dev": true + }, + "detect-node": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz", + "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==", + "dev": true + }, + "dezalgo": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.3.tgz", + "integrity": "sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=", + "dev": true, + "requires": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, + "di": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", + "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "dir-glob": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", + "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", + "dev": true, + "requires": { + "path-type": "^3.0.0" + } + }, + "dns-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", + "integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0=", + "dev": true + }, + "dns-packet": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz", + "integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==", + "dev": true, + "requires": { + "ip": "^1.1.0", + "safe-buffer": "^5.0.1" + } + }, + "dns-txt": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz", + "integrity": "sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY=", + "dev": true, + "requires": { + "buffer-indexof": "^1.0.0" + } + }, + "dom-serialize": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", + "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", + "dev": true, + "requires": { + "custom-event": "~1.0.0", + "ent": "~2.2.0", + "extend": "^3.0.0", + "void-elements": "^2.0.0" + } + }, + "dom-serializer": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", + "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "entities": "^2.0.0" + }, + "dependencies": { + "domelementtype": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.1.tgz", + "integrity": "sha512-5HOHUDsYZWV8FGWN0Njbr/Rn7f/eWSQi1v7+HsUVwXgn8nWWlL64zKDkS0n8ZmQ3mlWOMuXOnR+7Nx/5tMO5AQ==", + "dev": true + } + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", + "dev": true + }, + "domutils": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", + "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "dot-prop": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", + "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "duplexify": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", + "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", + "dev": true, + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.463", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.463.tgz", + "integrity": "sha512-mAqvpG0efJXV9BGXPVjFdBFiqmawGoIc+c8T2uXYEvbV1/261PaOT0EzZ9dKW4IdGiHXQGSKnnOU86QhJ+5JcA==", + "dev": true + }, + "elliptic": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", + "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", + "dev": true + }, + "encoding": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", + "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", + "dev": true, + "requires": { + "iconv-lite": "~0.4.13" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "engine.io": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.4.2.tgz", + "integrity": "sha512-b4Q85dFkGw+TqgytGPrGgACRUhsdKc9S9ErRAXpPGy/CXKs4tYoHDkvIRdsseAF7NjfVwjRFIn6KTnbw7LwJZg==", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "0.3.1", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "ws": "^7.1.2" + }, + "dependencies": { + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", + "dev": true + }, + "ws": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz", + "integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==", + "dev": true + } + } + }, + "engine.io-client": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.3.tgz", + "integrity": "sha512-0NGY+9hioejTEJCaSJZfWZLk4FPI9dN+1H1C4+wj2iuFba47UgZbJzfWs4aNFajnX/qAaYKbe2lLTfEEWzCmcw==", + "dev": true, + "requires": { + "component-emitter": "~1.3.0", + "component-inherit": "0.0.3", + "debug": "~4.1.0", + "engine.io-parser": "~2.2.0", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "ws": "~6.1.0", + "xmlhttprequest-ssl": "~1.5.4", + "yeast": "0.1.2" + }, + "dependencies": { + "ws": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz", + "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + } + } + }, + "engine.io-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.0.tgz", + "integrity": "sha512-6I3qD9iUxotsC5HEMuuGsKA0cXerGz+4uGcXQEkfBidgKf0amsjrrtwcbwK/nzpZBxclXlV7gGl9dgWvu4LF6w==", + "dev": true, + "requires": { + "after": "0.8.2", + "arraybuffer.slice": "~0.0.7", + "base64-arraybuffer": "0.1.5", + "blob": "0.0.5", + "has-binary2": "~1.0.2" + } + }, + "enhanced-resolve": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz", + "integrity": "sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.5.0", + "tapable": "^1.0.0" + } + }, + "ent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", + "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", + "dev": true + }, + "entities": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.3.tgz", + "integrity": "sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==", + "dev": true + }, + "err-code": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", + "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=", + "dev": true + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", + "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", + "dev": true, + "requires": { + "es6-promise": "^4.0.3" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint-scope": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "^4.1.0" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", + "dev": true + }, + "eventemitter3": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.4.tgz", + "integrity": "sha512-rlaVLnVxtxvoyLsQQFBx53YmXHDxRIzzTLbdfxqi4yocpSjAxXwkU0cScM5JgSKMqEhrZpnvQ2D9gjylR0AimQ==", + "dev": true + }, + "events": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", + "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==", + "dev": true + }, + "eventsource": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-1.0.7.tgz", + "integrity": "sha512-4Ln17+vVT0k8aWq+t/bF5arcS3EpT9gYtW66EPacdj/mAFevznsnyoHLPy2BA8gbIQeIHoPsvwmfBftfcG//BQ==", + "dev": true, + "requires": { + "original": "^1.0.0" + } + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", + "dev": true, + "requires": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.0", + "content-disposition": "0.5.3", + "content-type": "~1.0.4", + "cookie": "0.4.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.5", + "qs": "6.7.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.1.2", + "send": "0.17.1", + "serve-static": "1.14.1", + "setprototypeof": "1.1.1", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "qs": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", + "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", + "dev": true + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", + "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fastparse": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz", + "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==", + "dev": true + }, + "faye-websocket": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", + "integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=", + "dev": true, + "requires": { + "websocket-driver": ">=0.5.1" + } + }, + "figgy-pudding": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", + "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", + "dev": true + }, + "figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "file-loader": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.0.0.tgz", + "integrity": "sha512-/aMOAYEFXDdjG0wytpTL5YQLfZnnTmLNjn+AIrJ/6HVnTfDqLsVKUUwkDf4I4kgex36BvjuXEn/TX9B/1ESyqQ==", + "dev": true, + "requires": { + "loader-utils": "^2.0.0", + "schema-utils": "^2.6.5" + } + }, + "fileset": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fileset/-/fileset-2.0.3.tgz", + "integrity": "sha1-jnVIqW08wjJ+5eZ0FocjozO7oqA=", + "dev": true, + "requires": { + "glob": "^7.0.3", + "minimatch": "^3.0.3" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "finalhandler": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", + "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "dev": true, + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "find-cache-dir": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", + "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true + }, + "flush-write-stream": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz", + "integrity": "sha512-3Z4XhFZ3992uIq0XOqb9AreonueSYphE6oYbpt5+3u06JWklbsPkNv3ZKkP9Bz/r+1MWCaMoSQ28P85+1Yc77w==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^2.3.6" + } + }, + "follow-redirects": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.11.0.tgz", + "integrity": "sha512-KZm0V+ll8PfBrKwMzdo5D13b1bur9Iq9Zd/RMmAoQQcl2PxxFml8cxXPaaPYVbV0RjNjq1CU7zIzAOqtUPudmA==", + "dev": true, + "requires": { + "debug": "^3.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", + "dev": true + }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "fs-extra": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.2.tgz", + "integrity": "sha1-+RcExT0bRh+JNFKwwwfZmXZHq2s=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "genfun": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/genfun/-/genfun-5.0.0.tgz", + "integrity": "sha512-KGDOARWVga7+rnB3z9Sd2Letx515owfk0hSxHGuqjANb1M+x2bGZGqHLiozPsYMdM2OubeMni/Hpwmjq6qIUhA==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.1", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", + "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "globby": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz", + "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "dir-glob": "^2.0.0", + "glob": "^7.1.2", + "ignore": "^3.3.5", + "pify": "^3.0.0", + "slash": "^1.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true + }, + "handle-thing": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", + "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", + "dev": true + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "dev": true, + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-binary2": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", + "dev": true, + "requires": { + "isarray": "2.0.1" + }, + "dependencies": { + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true + } + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dev": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hex-color-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz", + "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hosted-git-info": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.4.tgz", + "integrity": "sha512-4oT62d2jwSDBbLLFLZE+1vPuQ1h8p9wjrJ8Mqx5TjsyWmBMV5B13eJqn8pvluqubLf3cJPTfiYCIwNwDNmzScQ==", + "dev": true, + "requires": { + "lru-cache": "^5.1.1" + } + }, + "hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "hsl-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hsl-regex/-/hsl-regex-1.0.0.tgz", + "integrity": "sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4=", + "dev": true + }, + "hsla-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hsla-regex/-/hsla-regex-1.0.0.tgz", + "integrity": "sha1-wc56MWjIxmFAM6S194d/OyJfnDg=", + "dev": true + }, + "html-comment-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.2.tgz", + "integrity": "sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ==", + "dev": true + }, + "html-entities": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.3.1.tgz", + "integrity": "sha512-rhE/4Z3hIhzHAUKbW8jVcCyuT5oJCXXqhN/6mXXVCpzTmvJnoH2HL/bt3EZ6p55jbFJBeAe1ZNpL5BugLujxNA==", + "dev": true + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "http-cache-semantics": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", + "dev": true + }, + "http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=", + "dev": true + }, + "http-errors": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", + "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.1", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } + }, + "http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "requires": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "http-proxy-agent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", + "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", + "dev": true, + "requires": { + "agent-base": "4", + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "http-proxy-middleware": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.19.1.tgz", + "integrity": "sha512-yHYTgWMQO8VvwNS22eLLloAkvungsKdKTLO8AJlftYIKNfJr3GK3zK0ZCfzDDGUBttdGc8xFy1mCitvNKQtC3Q==", + "dev": true, + "requires": { + "http-proxy": "^1.17.0", + "is-glob": "^4.0.0", + "lodash": "^4.17.11", + "micromatch": "^3.1.10" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "https-proxy-agent": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz", + "integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==", + "dev": true, + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", + "dev": true, + "requires": { + "ms": "^2.0.0" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "icss-utils": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-4.1.1.tgz", + "integrity": "sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA==", + "dev": true, + "requires": { + "postcss": "^7.0.14" + } + }, + "ieee754": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", + "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==", + "dev": true + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "dev": true + }, + "ignore-walk": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "dev": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "image-size": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", + "integrity": "sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w=", + "dev": true, + "optional": true + }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", + "dev": true + }, + "import-cwd": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", + "integrity": "sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk=", + "dev": true, + "requires": { + "import-from": "^2.1.0" + } + }, + "import-fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", + "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "dev": true, + "requires": { + "caller-path": "^2.0.0", + "resolve-from": "^3.0.0" + } + }, + "import-from": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-from/-/import-from-2.1.0.tgz", + "integrity": "sha1-M1238qev/VOqpHHUuAId7ja387E=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "dev": true, + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "indexes-of": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "infer-owner": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", + "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "inquirer": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", + "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "internal-ip": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-4.3.0.tgz", + "integrity": "sha512-S1zBo1D6zcsyuC6PMmY5+55YMILQ9av8lotMx447Bq6SAgo/sDK6y6uUKmuYhW7eacnIhFfsPmCNYdDzsnnDCg==", + "dev": true, + "requires": { + "default-gateway": "^4.2.0", + "ipaddr.js": "^1.9.0" + } + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true + }, + "ip-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", + "dev": true + }, + "ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true + }, + "is-absolute-url": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", + "integrity": "sha1-UFMN+4T8yap9vnhS6Do3uTufKqY=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-callable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", + "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", + "dev": true + }, + "is-color-stop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-color-stop/-/is-color-stop-1.1.0.tgz", + "integrity": "sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=", + "dev": true, + "requires": { + "css-color-names": "^0.0.4", + "hex-color-regex": "^1.1.0", + "hsl-regex": "^1.0.0", + "hsla-regex": "^1.0.0", + "rgb-regex": "^1.0.1", + "rgba-regex": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, + "is-docker": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.0.0.tgz", + "integrity": "sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ==", + "dev": true + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-interactive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "is-path-cwd": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", + "dev": true + }, + "is-path-in-cwd": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz", + "integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==", + "dev": true, + "requires": { + "is-path-inside": "^2.1.0" + } + }, + "is-path-inside": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz", + "integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==", + "dev": true, + "requires": { + "path-is-inside": "^1.0.2" + } + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", + "integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-svg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-3.0.0.tgz", + "integrity": "sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ==", + "dev": true, + "requires": { + "html-comment-regex": "^1.1.0" + } + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "requires": { + "is-docker": "^2.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isbinaryfile": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.6.tgz", + "integrity": "sha512-ORrEy+SNVqUhrCaal4hA4fBzhggQQ+BaLntyPOdoEiwlKZW9BZiJXjg3RMiruE4tPEI3pyVPpySHQF/dKWperg==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul-api": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-2.1.7.tgz", + "integrity": "sha512-LYTOa2UrYFyJ/aSczZi/6lBykVMjCCvUmT64gOe+jPZFy4w6FYfPGqFT2IiQ2BxVHHDOvCD7qrIXb0EOh4uGWw==", + "dev": true, + "requires": { + "async": "^2.6.2", + "compare-versions": "^3.4.0", + "fileset": "^2.0.3", + "istanbul-lib-coverage": "^2.0.5", + "istanbul-lib-hook": "^2.0.7", + "istanbul-lib-instrument": "^3.3.0", + "istanbul-lib-report": "^2.0.8", + "istanbul-lib-source-maps": "^3.0.6", + "istanbul-reports": "^2.2.5", + "js-yaml": "^3.13.1", + "make-dir": "^2.1.0", + "minimatch": "^3.0.4", + "once": "^1.4.0" + }, + "dependencies": { + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz", + "integrity": "sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA==", + "dev": true, + "requires": { + "@babel/generator": "^7.4.0", + "@babel/parser": "^7.4.3", + "@babel/template": "^7.4.0", + "@babel/traverse": "^7.4.3", + "@babel/types": "^7.4.0", + "istanbul-lib-coverage": "^2.0.5", + "semver": "^6.0.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "istanbul-lib-coverage": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz", + "integrity": "sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-2.0.7.tgz", + "integrity": "sha512-vrRztU9VRRFDyC+aklfLoeXyNdTfga2EI3udDGn4cZ6fpSXpHLV9X6CHvfoMCPtggg8zvDDmC4b9xfu0z6/llA==", + "dev": true, + "requires": { + "append-transform": "^1.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", + "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "dev": true, + "requires": { + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "istanbul-lib-report": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "supports-color": "^6.1.0" + }, + "dependencies": { + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "dev": true + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz", + "integrity": "sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "rimraf": "^2.6.3", + "source-map": "^0.6.1" + }, + "dependencies": { + "istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz", + "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0" + } + }, + "jasmine": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.8.0.tgz", + "integrity": "sha1-awicChFXax8W3xG4AUbZHU6Lij4=", + "dev": true, + "requires": { + "exit": "^0.1.2", + "glob": "^7.0.6", + "jasmine-core": "~2.8.0" + }, + "dependencies": { + "jasmine-core": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.8.0.tgz", + "integrity": "sha1-vMl5rh+f0FcB5F5S5l06XWPxok4=", + "dev": true + } + } + }, + "jasmine-core": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz", + "integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==", + "dev": true + }, + "jasmine-spec-reporter": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", + "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", + "dev": true, + "requires": { + "colors": "1.1.2" + } + }, + "jasminewd2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/jasminewd2/-/jasminewd2-2.2.0.tgz", + "integrity": "sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4=", + "dev": true + }, + "jest-worker": { + "version": "25.1.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.1.0.tgz", + "integrity": "sha512-ZHhHtlxOWSxCoNOKHGbiLzXnl42ga9CxDr27H36Qn+15pQZd3R/F24jrmjDelw9j/iHUIWMWs08/u2QN50HHOg==", + "dev": true, + "requires": { + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", + "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json3": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.3.tgz", + "integrity": "sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA==", + "dev": true + }, + "json5": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jszip": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.4.0.tgz", + "integrity": "sha512-gZAOYuPl4EhPTXT0GjhI3o+ZAz3su6EhLrKUoAivcKqyqC7laS5JEv4XWZND9BgcDcF83vI85yGbDmDR6UhrIg==", + "dev": true, + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "set-immediate-shim": "~1.0.1" + } + }, + "karma": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/karma/-/karma-5.0.9.tgz", + "integrity": "sha512-dUA5z7Lo7G4FRSe1ZAXqOINEEWxmCjDBbfRBmU/wYlSMwxUQJP/tEEP90yJt3Uqo03s9rCgVnxtlfq+uDhxSPg==", + "dev": true, + "requires": { + "body-parser": "^1.19.0", + "braces": "^3.0.2", + "chokidar": "^3.0.0", + "colors": "^1.4.0", + "connect": "^3.7.0", + "di": "^0.0.1", + "dom-serialize": "^2.2.1", + "flatted": "^2.0.2", + "glob": "^7.1.6", + "graceful-fs": "^4.2.4", + "http-proxy": "^1.18.1", + "isbinaryfile": "^4.0.6", + "lodash": "^4.17.15", + "log4js": "^6.2.1", + "mime": "^2.4.5", + "minimatch": "^3.0.4", + "qjobs": "^1.2.0", + "range-parser": "^1.2.1", + "rimraf": "^3.0.2", + "socket.io": "^2.3.0", + "source-map": "^0.6.1", + "tmp": "0.2.1", + "ua-parser-js": "0.7.21", + "yargs": "^15.3.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "mime": { + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", + "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==", + "dev": true + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "tmp": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", + "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "dev": true, + "requires": { + "rimraf": "^3.0.0" + } + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "yargs": { + "version": "15.3.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", + "integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.1" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "karma-chrome-launcher": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz", + "integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==", + "dev": true, + "requires": { + "which": "^1.2.1" + } + }, + "karma-coverage-istanbul-reporter": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-2.1.1.tgz", + "integrity": "sha512-CH8lTi8+kKXGvrhy94+EkEMldLCiUA0xMOiL31vvli9qK0T+qcXJAwWBRVJWnVWxYkTmyWar8lPz63dxX6/z1A==", + "dev": true, + "requires": { + "istanbul-api": "^2.1.6", + "minimatch": "^3.0.4" + } + }, + "karma-jasmine": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/karma-jasmine/-/karma-jasmine-3.0.3.tgz", + "integrity": "sha512-80iBR8/hLFY2Uw3S2GG6EndWtMCGMJjrCYNwYROWsJFVTjWrRSsLqcA2ye+U3ygW5sjOQo8f+78L8cGUxjC/+A==", + "dev": true, + "requires": { + "jasmine-core": "^3.5.0" + } + }, + "karma-jasmine-html-reporter": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-1.5.4.tgz", + "integrity": "sha512-PtilRLno5O6wH3lDihRnz0Ba8oSn0YUJqKjjux1peoYGwo0AQqrWRbdWk/RLzcGlb+onTyXAnHl6M+Hu3UxG/Q==", + "dev": true + }, + "karma-source-map-support": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz", + "integrity": "sha512-RsBECncGO17KAoJCYXjv+ckIz+Ii9NCi+9enk+rq6XC81ezYkb4/RHE6CTXdA7IOJqoF3wcaLfVG0CPmE5ca6A==", + "dev": true, + "requires": { + "source-map-support": "^0.5.5" + } + }, + "killable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", + "integrity": "sha512-LzqtLKlUwirEUyl/nicirVmNiPvYs7l5n8wOPP7fyJVpUPkvCnW/vuiXGpylGUlnPDnB7311rARzAt3Mhswpjg==", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, + "requires": { + "invert-kv": "^2.0.0" + } + }, + "less": { + "version": "3.11.1", + "resolved": "https://registry.npmjs.org/less/-/less-3.11.1.tgz", + "integrity": "sha512-tlWX341RECuTOvoDIvtFqXsKj072hm3+9ymRBe76/mD6O5ZZecnlAOVDlWAleF2+aohFrxNidXhv2773f6kY7g==", + "dev": true, + "requires": { + "clone": "^2.1.2", + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "image-size": "~0.5.0", + "mime": "^1.4.1", + "mkdirp": "^0.5.0", + "promise": "^7.1.1", + "request": "^2.83.0", + "source-map": "~0.6.0", + "tslib": "^1.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true + } + } + }, + "less-loader": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/less-loader/-/less-loader-5.0.0.tgz", + "integrity": "sha512-bquCU89mO/yWLaUq0Clk7qCsKhsF/TZpJUzETRvJa9KSVEL9SO3ovCvdEHISBhrC81OwC8QSVX7E0bzElZj9cg==", + "dev": true, + "requires": { + "clone": "^2.1.1", + "loader-utils": "^1.1.0", + "pify": "^4.0.1" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "levenary": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/levenary/-/levenary-1.1.1.tgz", + "integrity": "sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ==", + "dev": true, + "requires": { + "leven": "^3.1.0" + } + }, + "license-webpack-plugin": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/license-webpack-plugin/-/license-webpack-plugin-2.1.4.tgz", + "integrity": "sha512-1Xq72fmPbTg5KofXs+yI5L4QqPFjQ6mZxoeI6D7gfiEDOtaEIk6PGrdLaej90bpDqKNHNxlQ/MW4tMAL6xMPJQ==", + "dev": true, + "requires": { + "@types/webpack-sources": "^0.1.5", + "webpack-sources": "^1.2.0" + } + }, + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "requires": { + "immediate": "~3.0.5" + } + }, + "loader-runner": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz", + "integrity": "sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw==", + "dev": true + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", + "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", + "dev": true + }, + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2" + } + }, + "log4js": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz", + "integrity": "sha512-Mc8jNuSFImQUIateBFwdOQcmC6Q5maU0VVvdC2R6XMb66/VnT+7WS4D/0EeNMZu1YODmJe5NIn2XftCzEocUgw==", + "dev": true, + "requires": { + "date-format": "^3.0.0", + "debug": "^4.1.1", + "flatted": "^2.0.1", + "rfdc": "^1.1.4", + "streamroller": "^2.2.4" + } + }, + "loglevel": { + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.8.tgz", + "integrity": "sha512-bsU7+gc9AJ2SqpzxwU3+1fedl8zAntbtC5XYlt3s2j1hJcn2PsXSmgN8TaLG/J1/2mod4+cE/3vNL70/c1RNCA==", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + }, + "dependencies": { + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, + "magic-string": { + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.4" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "make-fetch-happen": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-5.0.2.tgz", + "integrity": "sha512-07JHC0r1ykIoruKO8ifMXu+xEU8qOXDFETylktdug6vJDACnP+HKevOu3PXyNPzFyTSlz8vrBYlBO1JZRe8Cag==", + "dev": true, + "requires": { + "agentkeepalive": "^3.4.1", + "cacache": "^12.0.0", + "http-cache-semantics": "^3.8.1", + "http-proxy-agent": "^2.1.0", + "https-proxy-agent": "^2.2.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "node-fetch-npm": "^2.0.2", + "promise-retry": "^1.1.1", + "socks-proxy-agent": "^4.0.0", + "ssri": "^6.0.0" + }, + "dependencies": { + "cacache": { + "version": "12.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz", + "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "ssri": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", + "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1" + } + } + } + }, + "mamacro": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", + "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==", + "dev": true + }, + "map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "requires": { + "p-defer": "^1.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "mdn-data": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz", + "integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==", + "dev": true + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", + "dev": true + }, + "mem": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz", + "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==", + "dev": true, + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } + }, + "memory-fs": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.5.0.tgz", + "integrity": "sha512-jA0rdU5KoQMC0e6ppoNRtpp6vjFq6+NY7r8hywnC7V+1Xj/MtHwGIbB1QaK/dunyjWteJzmkpd7ooeWg10T7GA==", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=", + "dev": true + }, + "merge-source-map": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz", + "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==", + "dev": true, + "requires": { + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "dependencies": { + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true + }, + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true + }, + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, + "requires": { + "mime-db": "1.44.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "mini-css-extract-plugin": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz", + "integrity": "sha512-lp3GeY7ygcgAmVIcRPBVhIkf8Us7FZjA+ILpal44qLdSu11wmjKQ3d9k15lfD7pO4esu9eUIAW7qiYIBppv40A==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "normalize-url": "1.9.1", + "schema-utils": "^1.0.0", + "webpack-sources": "^1.1.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "normalize-url": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz", + "integrity": "sha1-LMDWazHqIwNkWENuNiDYWVTGbDw=", + "dev": true, + "requires": { + "object-assign": "^4.0.1", + "prepend-http": "^1.0.0", + "query-string": "^4.1.0", + "sort-keys": "^1.0.0" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "minipass": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.3.tgz", + "integrity": "sha512-Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minipass-collect": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", + "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-flush": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minipass-pipeline": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.3.tgz", + "integrity": "sha512-cFOknTvng5vqnwOpDsZTWhNll6Jf8o2x+/diplafmxpuIymAjzoOolZG0VvQf3V2HgqzJNhnuKHYp2BqDgz8IQ==", + "dev": true, + "requires": { + "minipass": "^3.0.0" + } + }, + "minizlib": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.0.tgz", + "integrity": "sha512-EzTZN/fjSvifSX0SlqUERCN39o6T40AMarPbv0MrarSFtIITCBh7bi+dU8nxGFHuqs9jdIAeoYoKuQAAASsPPA==", + "dev": true, + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + } + }, + "mississippi": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", + "integrity": "sha512-x471SsVjUtBRtcvd4BzKE9kFC+/2TeWgKCgw0bZcw1b9l2X3QX5vCWgF+KaZaYm87Ss//rHnWryupDrgLvmSkA==", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^3.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "mixin-deep": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "multicast-dns": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz", + "integrity": "sha512-ji6J5enbMyGRHIAkAOu3WdV8nggqviKCEKtXcOqfphZZtQrmHKycfynJ2V7eVPUA4NhJ6V7Wf4TmGbTwKE9B6g==", + "dev": true, + "requires": { + "dns-packet": "^1.3.1", + "thunky": "^1.0.2" + } + }, + "multicast-dns-service-types": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", + "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", + "dev": true + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "negotiator": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "dev": true + }, + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-fetch-npm": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/node-fetch-npm/-/node-fetch-npm-2.0.4.tgz", + "integrity": "sha512-iOuIQDWDyjhv9qSDrj9aq/klt6F9z1p2otB3AV7v3zBDcL/x+OfGsvGQZZCcMZbUf4Ujw1xGNQkjvGnVT22cKg==", + "dev": true, + "requires": { + "encoding": "^0.1.11", + "json-parse-better-errors": "^1.0.0", + "safe-buffer": "^5.1.1" + } + }, + "node-forge": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", + "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==", + "dev": true + }, + "node-libs-browser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz", + "integrity": "sha512-h/zcD8H9kaDZ9ALUWwlBUDo6TKF8a7qBSCSEGfjTVIYeqsioSKaAX+BN7NgiMGp6iSIXZ3PxgCu8KS3b71YK5Q==", + "dev": true, + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^3.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.1", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.11.0", + "vm-browserify": "^1.0.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "node-releases": { + "version": "1.1.58", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.58.tgz", + "integrity": "sha512-NxBudgVKiRh/2aPWMgPR7bPTX0VPmGx5QBwCtdHitnqFE5/O8DeBXuIMH1nwNnw/aMo6AjOrpsHzfY3UbUJ7yg==", + "dev": true + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true + }, + "normalize-url": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz", + "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==", + "dev": true + }, + "npm-bundled": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", + "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", + "dev": true, + "requires": { + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-install-checks": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/npm-install-checks/-/npm-install-checks-4.0.0.tgz", + "integrity": "sha512-09OmyDkNLYwqKPOnbI8exiOZU2GVVmQp7tgez2BPi5OZC8M82elDAps7sxC4l//uSUtotWqoEIDwjRvWH4qz8w==", + "dev": true, + "requires": { + "semver": "^7.1.1" + } + }, + "npm-normalize-package-bin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", + "dev": true + }, + "npm-package-arg": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-8.0.1.tgz", + "integrity": "sha512-/h5Fm6a/exByzFSTm7jAyHbgOqErl9qSNJDQF32Si/ZzgwT2TERVxRxn3Jurw1wflgyVVAxnFR4fRHPM7y1ClQ==", + "dev": true, + "requires": { + "hosted-git-info": "^3.0.2", + "semver": "^7.0.0", + "validate-npm-package-name": "^3.0.0" + } + }, + "npm-packlist": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.8.tgz", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", + "dev": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1", + "npm-normalize-package-bin": "^1.0.1" + } + }, + "npm-pick-manifest": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-6.0.0.tgz", + "integrity": "sha512-PdJpXMvjqt4nftNEDpCgjBUF8yI3Q3MyuAmVB9nemnnCg32F4BPL/JFBfdj8DubgHCYUFQhtLWmBPvdsFtjWMg==", + "dev": true, + "requires": { + "npm-install-checks": "^4.0.0", + "npm-package-arg": "^8.0.0", + "semver": "^7.0.0" + } + }, + "npm-registry-fetch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-4.0.4.tgz", + "integrity": "sha512-6jb34hX/iYNQebqWUHtU8YF6Cjb1H6ouTFPClYsyiW6lpFkljTpdeftm53rRojtja1rKAvKNIIiTS5Sjpw4wsA==", + "dev": true, + "requires": { + "JSONStream": "^1.3.4", + "bluebird": "^3.5.1", + "figgy-pudding": "^3.4.1", + "lru-cache": "^5.1.1", + "make-fetch-happen": "^5.0.0", + "npm-package-arg": "^6.1.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, + "npm-package-arg": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", + "dev": true, + "requires": { + "hosted-git-info": "^2.7.1", + "osenv": "^0.1.5", + "semver": "^5.6.0", + "validate-npm-package-name": "^3.0.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "nth-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", + "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", + "dev": true, + "requires": { + "boolbase": "~1.0.0" + } + }, + "num2fraction": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", + "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-inspect": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "dev": true + }, + "object-is": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.2.tgz", + "integrity": "sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "object.values": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.1.tgz", + "integrity": "sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "has": "^1.0.3" + } + }, + "obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "dev": true, + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "open": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/open/-/open-7.0.3.tgz", + "integrity": "sha512-sP2ru2v0P290WFfv49Ap8MF6PkzGNnGlAwHweB4WR4mr5d2d0woiCluUeJ218w7/+PmoBy9JmYgD5A4mLcWOFA==", + "dev": true, + "requires": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + } + }, + "opn": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/opn/-/opn-5.5.0.tgz", + "integrity": "sha512-PqHpggC9bLV0VeWcdKhkpxY+3JTzetLSqTCWL/z/tFIbI6G8JCjondXklT1JinczLz2Xib62sSp0T/gKT4KksA==", + "dev": true, + "requires": { + "is-wsl": "^1.1.0" + }, + "dependencies": { + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + } + } + }, + "ora": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/ora/-/ora-4.0.3.tgz", + "integrity": "sha512-fnDebVFyz309A73cqCipVL1fBZewq4vwgSHfxh43vVy31mbyoQ8sCH3Oeaog/owYOs/lLlGVPCISQonTneg6Pg==", + "dev": true, + "requires": { + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.2.0", + "is-interactive": "^1.0.0", + "log-symbols": "^3.0.0", + "mute-stream": "0.0.8", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "original": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz", + "integrity": "sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg==", + "dev": true, + "requires": { + "url-parse": "^1.4.3" + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", + "integrity": "sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q==", + "dev": true, + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz", + "integrity": "sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg==", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-retry": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-3.0.1.tgz", + "integrity": "sha512-XE6G4+YTTkT2a0UWb2kjZe8xNwf8bIbnqpc/IS/idOBVhyves0mK5OJgeocjx7q5pvX/6m23xuzVPYT1uGM73w==", + "dev": true, + "requires": { + "retry": "^0.12.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "pacote": { + "version": "9.5.12", + "resolved": "https://registry.npmjs.org/pacote/-/pacote-9.5.12.tgz", + "integrity": "sha512-BUIj/4kKbwWg4RtnBncXPJd15piFSVNpTzY0rysSr3VnMowTYgkGKcaHrbReepAkjTr8lH2CVWRi58Spg2CicQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.3", + "cacache": "^12.0.2", + "chownr": "^1.1.2", + "figgy-pudding": "^3.5.1", + "get-stream": "^4.1.0", + "glob": "^7.1.3", + "infer-owner": "^1.0.4", + "lru-cache": "^5.1.1", + "make-fetch-happen": "^5.0.0", + "minimatch": "^3.0.4", + "minipass": "^2.3.5", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "normalize-package-data": "^2.4.0", + "npm-normalize-package-bin": "^1.0.0", + "npm-package-arg": "^6.1.0", + "npm-packlist": "^1.1.12", + "npm-pick-manifest": "^3.0.0", + "npm-registry-fetch": "^4.0.0", + "osenv": "^0.1.5", + "promise-inflight": "^1.0.1", + "promise-retry": "^1.1.1", + "protoduck": "^5.0.1", + "rimraf": "^2.6.2", + "safe-buffer": "^5.1.2", + "semver": "^5.6.0", + "ssri": "^6.0.1", + "tar": "^4.4.10", + "unique-filename": "^1.1.1", + "which": "^1.3.1" + }, + "dependencies": { + "cacache": { + "version": "12.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz", + "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + } + }, + "fs-minipass": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", + "dev": true, + "requires": { + "minipass": "^2.6.0" + } + }, + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, + "minipass": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", + "dev": true, + "requires": { + "minipass": "^2.9.0" + } + }, + "npm-package-arg": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", + "dev": true, + "requires": { + "hosted-git-info": "^2.7.1", + "osenv": "^0.1.5", + "semver": "^5.6.0", + "validate-npm-package-name": "^3.0.0" + } + }, + "npm-pick-manifest": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/npm-pick-manifest/-/npm-pick-manifest-3.0.2.tgz", + "integrity": "sha512-wNprTNg+X5nf+tDi+hbjdHhM4bX+mKqv6XmPh7B5eG+QY9VARfQPfCEH013H5GqfNj6ee8Ij2fg8yk0mzps1Vw==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1", + "npm-package-arg": "^6.0.0", + "semver": "^5.4.1" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "ssri": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", + "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1" + } + }, + "tar": { + "version": "4.4.13", + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", + "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", + "dev": true, + "requires": { + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.8.6", + "minizlib": "^1.2.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.3" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, + "parallel-transform": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz", + "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==", + "dev": true, + "requires": { + "cyclist": "^1.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + } + }, + "parse-asn1": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", + "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "dev": true, + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", + "dev": true + }, + "parseqs": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", + "integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseuri": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz", + "integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=", + "dev": true, + "requires": { + "better-assert": "~1.0.0" + } + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + } + } + }, + "pbkdf2": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", + "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + } + } + }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, + "portfinder": { + "version": "1.0.26", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.26.tgz", + "integrity": "sha512-Xi7mKxJHHMI3rIUrnm/jjUgwhbYMkp/XKEcZX3aG4BrumLpq3nmoQMX+ClYnDZnZ/New7IatC1no5RX0zo1vXQ==", + "dev": true, + "requires": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.1" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "postcss": { + "version": "7.0.27", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.27.tgz", + "integrity": "sha512-WuQETPMcW9Uf1/22HWUWP9lgsIC+KEHg2kozMflKjbeUtw9ujvFX6QmIfozaErDkmLWS9WEnEdEe6Uo9/BNTdQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-calc": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-7.0.2.tgz", + "integrity": "sha512-rofZFHUg6ZIrvRwPeFktv06GdbDYLcGqh9EwiMutZg+a0oePCCw1zHOEiji6LCpyRcjTREtPASuUqeAvYlEVvQ==", + "dev": true, + "requires": { + "postcss": "^7.0.27", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.0.2" + } + }, + "postcss-colormin": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-4.0.3.tgz", + "integrity": "sha512-WyQFAdDZpExQh32j0U0feWisZ0dmOtPl44qYmJKkq9xFWY3p+4qnRzCHeNrkeRhwPHz9bQ3mo0/yVkaply0MNw==", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "color": "^3.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-convert-values": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-4.0.1.tgz", + "integrity": "sha512-Kisdo1y77KUC0Jmn0OXU/COOJbzM8cImvw1ZFsBgBgMgb1iL23Zs/LXRe3r+EZqM3vGYKdQ2YJVQ5VkJI+zEJQ==", + "dev": true, + "requires": { + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-discard-comments": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-4.0.2.tgz", + "integrity": "sha512-RJutN259iuRf3IW7GZyLM5Sw4GLTOH8FmsXBnv8Ab/Tc2k4SR4qbV4DNbyyY4+Sjo362SyDmW2DQ7lBSChrpkg==", + "dev": true, + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-discard-duplicates": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.2.tgz", + "integrity": "sha512-ZNQfR1gPNAiXZhgENFfEglF93pciw0WxMkJeVmw8eF+JZBbMD7jp6C67GqJAXVZP2BWbOztKfbsdmMp/k8c6oQ==", + "dev": true, + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-discard-empty": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-4.0.1.tgz", + "integrity": "sha512-B9miTzbznhDjTfjvipfHoqbWKwd0Mj+/fL5s1QOz06wufguil+Xheo4XpOnc4NqKYBCNqqEzgPv2aPBIJLox0w==", + "dev": true, + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-discard-overridden": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-4.0.1.tgz", + "integrity": "sha512-IYY2bEDD7g1XM1IDEsUT4//iEYCxAmP5oDSFMVU/JVvT7gh+l4fmjciLqGgwjdWpQIdb0Che2VX00QObS5+cTg==", + "dev": true, + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-import": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-12.0.1.tgz", + "integrity": "sha512-3Gti33dmCjyKBgimqGxL3vcV8w9+bsHwO5UrBawp796+jdardbcFl4RP5w/76BwNL7aGzpKstIfF9I+kdE8pTw==", + "dev": true, + "requires": { + "postcss": "^7.0.1", + "postcss-value-parser": "^3.2.3", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-load-config": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-2.1.0.tgz", + "integrity": "sha512-4pV3JJVPLd5+RueiVVB+gFOAa7GWc25XQcMp86Zexzke69mKf6Nx9LRcQywdz7yZI9n1udOxmLuAwTBypypF8Q==", + "dev": true, + "requires": { + "cosmiconfig": "^5.0.0", + "import-cwd": "^2.0.0" + } + }, + "postcss-loader": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-loader/-/postcss-loader-3.0.0.tgz", + "integrity": "sha512-cLWoDEY5OwHcAjDnkyRQzAXfs2jrKjXpO/HQFcc5b5u/r7aa471wdmChmwfnv7x2u840iat/wi0lQ5nbRgSkUA==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "postcss": "^7.0.0", + "postcss-load-config": "^2.0.0", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "postcss-merge-longhand": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-4.0.11.tgz", + "integrity": "sha512-alx/zmoeXvJjp7L4mxEMjh8lxVlDFX1gqWHzaaQewwMZiVhLo42TEClKaeHbRf6J7j82ZOdTJ808RtN0ZOZwvw==", + "dev": true, + "requires": { + "css-color-names": "0.0.4", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0", + "stylehacks": "^4.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-merge-rules": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-4.0.3.tgz", + "integrity": "sha512-U7e3r1SbvYzO0Jr3UT/zKBVgYYyhAz0aitvGIYOYK5CPmkNih+WDSsS5tvPrJ8YMQYlEMvsZIiqmn7HdFUaeEQ==", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "caniuse-api": "^3.0.0", + "cssnano-util-same-parent": "^4.0.0", + "postcss": "^7.0.0", + "postcss-selector-parser": "^3.0.0", + "vendors": "^1.0.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz", + "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-minify-font-values": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-4.0.2.tgz", + "integrity": "sha512-j85oO6OnRU9zPf04+PZv1LYIYOprWm6IA6zkXkrJXyRveDEuQggG6tvoy8ir8ZwjLxLuGfNkCZEQG7zan+Hbtg==", + "dev": true, + "requires": { + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-minify-gradients": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-4.0.2.tgz", + "integrity": "sha512-qKPfwlONdcf/AndP1U8SJ/uzIJtowHlMaSioKzebAXSG4iJthlWC9iSWznQcX4f66gIWX44RSA841HTHj3wK+Q==", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "is-color-stop": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-minify-params": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-4.0.2.tgz", + "integrity": "sha512-G7eWyzEx0xL4/wiBBJxJOz48zAKV2WG3iZOqVhPet/9geefm/Px5uo1fzlHu+DOjT+m0Mmiz3jkQzVHe6wxAWg==", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.0", + "browserslist": "^4.0.0", + "cssnano-util-get-arguments": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0", + "uniqs": "^2.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-minify-selectors": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-4.0.2.tgz", + "integrity": "sha512-D5S1iViljXBj9kflQo4YutWnJmwm8VvIsU1GeXJGiG9j8CIg9zs4voPMdQDUmIxetUOh60VilsNzCiAFTOqu3g==", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-selector-parser": "^3.0.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz", + "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "postcss-modules-extract-imports": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-2.0.0.tgz", + "integrity": "sha512-LaYLDNS4SG8Q5WAWqIJgdHPJrDDr/Lv775rMBFUbgjTz6j34lUznACHcdRWroPvXANP2Vj7yNK57vp9eFqzLWQ==", + "dev": true, + "requires": { + "postcss": "^7.0.5" + } + }, + "postcss-modules-local-by-default": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.2.tgz", + "integrity": "sha512-jM/V8eqM4oJ/22j0gx4jrp63GSvDH6v86OqyTHHUvk4/k1vceipZsaymiZ5PvocqZOl5SFHiFJqjs3la0wnfIQ==", + "dev": true, + "requires": { + "icss-utils": "^4.1.1", + "postcss": "^7.0.16", + "postcss-selector-parser": "^6.0.2", + "postcss-value-parser": "^4.0.0" + } + }, + "postcss-modules-scope": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-2.2.0.tgz", + "integrity": "sha512-YyEgsTMRpNd+HmyC7H/mh3y+MeFWevy7V1evVhJWewmMbjDHIbZbOXICC2y+m1xI1UVfIT1HMW/O04Hxyu9oXQ==", + "dev": true, + "requires": { + "postcss": "^7.0.6", + "postcss-selector-parser": "^6.0.0" + } + }, + "postcss-modules-values": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz", + "integrity": "sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg==", + "dev": true, + "requires": { + "icss-utils": "^4.0.0", + "postcss": "^7.0.6" + } + }, + "postcss-normalize-charset": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-4.0.1.tgz", + "integrity": "sha512-gMXCrrlWh6G27U0hF3vNvR3w8I1s2wOBILvA87iNXaPvSNo5uZAMYsZG7XjCUf1eVxuPfyL4TJ7++SGZLc9A3g==", + "dev": true, + "requires": { + "postcss": "^7.0.0" + } + }, + "postcss-normalize-display-values": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.2.tgz", + "integrity": "sha512-3F2jcsaMW7+VtRMAqf/3m4cPFhPD3EFRgNs18u+k3lTJJlVe7d0YPO+bnwqo2xg8YiRpDXJI2u8A0wqJxMsQuQ==", + "dev": true, + "requires": { + "cssnano-util-get-match": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-normalize-positions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-4.0.2.tgz", + "integrity": "sha512-Dlf3/9AxpxE+NF1fJxYDeggi5WwV35MXGFnnoccP/9qDtFrTArZ0D0R+iKcg5WsUd8nUYMIl8yXDCtcrT8JrdA==", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-normalize-repeat-style": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.2.tgz", + "integrity": "sha512-qvigdYYMpSuoFs3Is/f5nHdRLJN/ITA7huIoCyqqENJe9PvPmLhNLMu7QTjPdtnVf6OcYYO5SHonx4+fbJE1+Q==", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "cssnano-util-get-match": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-normalize-string": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-4.0.2.tgz", + "integrity": "sha512-RrERod97Dnwqq49WNz8qo66ps0swYZDSb6rM57kN2J+aoyEAJfZ6bMx0sx/F9TIEX0xthPGCmeyiam/jXif0eA==", + "dev": true, + "requires": { + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-normalize-timing-functions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.2.tgz", + "integrity": "sha512-acwJY95edP762e++00Ehq9L4sZCEcOPyaHwoaFOhIwWCDfik6YvqsYNxckee65JHLKzuNSSmAdxwD2Cud1Z54A==", + "dev": true, + "requires": { + "cssnano-util-get-match": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-normalize-unicode": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.1.tgz", + "integrity": "sha512-od18Uq2wCYn+vZ/qCOeutvHjB5jm57ToxRaMeNuf0nWVHaP9Hua56QyMF6fs/4FSUnVIw0CBPsU0K4LnBPwYwg==", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-normalize-url": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-4.0.1.tgz", + "integrity": "sha512-p5oVaF4+IHwu7VpMan/SSpmpYxcJMtkGppYf0VbdH5B6hN8YNmVyJLuY9FmLQTzY3fag5ESUUHDqM+heid0UVA==", + "dev": true, + "requires": { + "is-absolute-url": "^2.0.0", + "normalize-url": "^3.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-normalize-whitespace": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.2.tgz", + "integrity": "sha512-tO8QIgrsI3p95r8fyqKV+ufKlSHh9hMJqACqbv2XknufqEDhDvbguXGBBqxw9nsQoXWf0qOqppziKJKHMD4GtA==", + "dev": true, + "requires": { + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-ordered-values": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-4.1.2.tgz", + "integrity": "sha512-2fCObh5UanxvSxeXrtLtlwVThBvHn6MQcu4ksNT2tsaV2Fg76R2CV98W7wNSlX+5/pFwEyaDwKLLoEV7uRybAw==", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "^4.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-reduce-initial": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-4.0.3.tgz", + "integrity": "sha512-gKWmR5aUulSjbzOfD9AlJiHCGH6AEVLaM0AV+aSioxUDd16qXP1PCh8d1/BGVvpdWn8k/HiK7n6TjeoXN1F7DA==", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "caniuse-api": "^3.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0" + } + }, + "postcss-reduce-transforms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.2.tgz", + "integrity": "sha512-EEVig1Q2QJ4ELpJXMZR8Vt5DQx8/mo+dGWSR7vWXqcob2gQLyQGsionYcGKATXvQzMPn6DSN1vTN7yFximdIAg==", + "dev": true, + "requires": { + "cssnano-util-get-match": "^4.0.0", + "has": "^1.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-selector-parser": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz", + "integrity": "sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg==", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + }, + "postcss-svgo": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-4.0.2.tgz", + "integrity": "sha512-C6wyjo3VwFm0QgBy+Fu7gCYOkCmgmClghO+pjcxvrcBKtiKt0uCF+hvbMO1fyv5BMImRK90SMb+dwUnfbGd+jw==", + "dev": true, + "requires": { + "is-svg": "^3.0.0", + "postcss": "^7.0.0", + "postcss-value-parser": "^3.0.0", + "svgo": "^1.0.0" + }, + "dependencies": { + "postcss-value-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz", + "integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==", + "dev": true + } + } + }, + "postcss-unique-selectors": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-4.0.1.tgz", + "integrity": "sha512-+JanVaryLo9QwZjKrmJgkI4Fn8SBgRO6WXQBJi7KiAVPlmxikB5Jzc4EvXMT2H0/m0RjrVVm9rGNhZddm/8Spg==", + "dev": true, + "requires": { + "alphanum-sort": "^1.0.0", + "postcss": "^7.0.0", + "uniqs": "^2.0.0" + } + }, + "postcss-value-parser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", + "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dev": true, + "optional": true, + "requires": { + "asap": "~2.0.3" + } + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "promise-retry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz", + "integrity": "sha1-ZznpaOMFHaIM5kl/srUPaRHfPW0=", + "dev": true, + "requires": { + "err-code": "^1.0.0", + "retry": "^0.10.0" + }, + "dependencies": { + "retry": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.10.1.tgz", + "integrity": "sha1-52OI0heZLCUnUCQdPTlW/tmNj/Q=", + "dev": true + } + } + }, + "protoduck": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/protoduck/-/protoduck-5.0.1.tgz", + "integrity": "sha512-WxoCeDCoCBY55BMvj4cAEjdVUFGRWed9ZxPlqTKYyw1nDDTQ4pqmnIMAGfJlg7Dx35uB/M+PHJPTmGOvaCaPTg==", + "dev": true, + "requires": { + "genfun": "^5.0.0" + } + }, + "protractor": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/protractor/-/protractor-5.4.4.tgz", + "integrity": "sha512-BaL4vePgu3Vfa/whvTUAlgaCAId4uNSGxIFSCXMgj7LMYENPWLp85h5RBi9pdpX/bWQ8SF6flP7afmi2TC4eHw==", + "dev": true, + "requires": { + "@types/q": "^0.0.32", + "@types/selenium-webdriver": "^3.0.0", + "blocking-proxy": "^1.0.0", + "browserstack": "^1.5.1", + "chalk": "^1.1.3", + "glob": "^7.0.3", + "jasmine": "2.8.0", + "jasminewd2": "^2.1.0", + "q": "1.4.1", + "saucelabs": "^1.5.0", + "selenium-webdriver": "3.6.0", + "source-map-support": "~0.4.0", + "webdriver-js-extender": "2.1.0", + "webdriver-manager": "^12.0.6", + "yargs": "^12.0.5" + }, + "dependencies": { + "@types/q": { + "version": "0.0.32", + "resolved": "https://registry.npmjs.org/@types/q/-/q-0.0.32.tgz", + "integrity": "sha1-vShOV8hPEyXacCur/IKlMoGQwMU=", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "^5.0.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "rimraf": "^2.2.8" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "dev": true, + "requires": { + "is-path-inside": "^1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "q": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "^0.5.6" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "webdriver-manager": { + "version": "12.1.7", + "resolved": "https://registry.npmjs.org/webdriver-manager/-/webdriver-manager-12.1.7.tgz", + "integrity": "sha512-XINj6b8CYuUYC93SG3xPkxlyUc3IJbD6Vvo75CVGuG9uzsefDzWQrhz0Lq8vbPxtb4d63CZdYophF8k8Or/YiA==", + "dev": true, + "requires": { + "adm-zip": "^0.4.9", + "chalk": "^1.1.1", + "del": "^2.2.0", + "glob": "^7.0.3", + "ini": "^1.3.4", + "minimist": "^1.2.0", + "q": "^1.4.1", + "request": "^2.87.0", + "rimraf": "^2.5.2", + "semver": "^5.3.0", + "xml2js": "^0.4.17" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } + } + }, + "yargs": { + "version": "12.0.5", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", + "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^1.0.1", + "os-locale": "^3.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^11.1.1" + } + }, + "yargs-parser": { + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz", + "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "proxy-addr": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", + "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", + "dev": true, + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.9.1" + } + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true + }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + }, + "dependencies": { + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + } + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", + "dev": true + }, + "qjobs": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", + "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", + "dev": true + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true + }, + "query-string": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz", + "integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=", + "dev": true, + "requires": { + "object-assign": "^4.1.0", + "strict-uri-encode": "^1.0.0" + } + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "querystringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", + "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true + }, + "raw-body": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", + "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", + "dev": true, + "requires": { + "bytes": "3.1.0", + "http-errors": "1.7.2", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "dependencies": { + "bytes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", + "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", + "dev": true + } + } + }, + "raw-loader": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-4.0.0.tgz", + "integrity": "sha512-iINUOYvl1cGEmfoaLjnZXt4bKfT2LJnZZib5N/LLyAphC+Dd11vNP9CNVb38j+SAJpFI1uo8j9frmih53ASy7Q==", + "dev": true, + "requires": { + "loader-utils": "^1.2.3", + "schema-utils": "^2.5.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha1-5mTvMRYRZsl1HNvo28+GtftY93Q=", + "dev": true, + "requires": { + "pify": "^2.3.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "read-package-json": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-2.1.1.tgz", + "integrity": "sha512-dAiqGtVc/q5doFz6096CcnXhpYk0ZN8dEKVkGLU0CsASt8SrgF6SF7OTKAYubfvFhWaqofl+Y8HK19GR8jwW+A==", + "dev": true, + "requires": { + "glob": "^7.1.1", + "graceful-fs": "^4.1.2", + "json-parse-better-errors": "^1.0.1", + "normalize-package-data": "^2.0.0", + "npm-normalize-package-bin": "^1.0.0" + } + }, + "read-package-tree": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/read-package-tree/-/read-package-tree-5.3.1.tgz", + "integrity": "sha512-mLUDsD5JVtlZxjSlPPx1RETkNjjvQYuweKwNVt1Sn8kP5Jh44pvYuUHCp6xSVDZWbNxVxG5lyZJ921aJH61sTw==", + "dev": true, + "requires": { + "read-package-json": "^2.0.0", + "readdir-scoped-modules": "^1.0.0", + "util-promisify": "^2.1.0" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "readdir-scoped-modules": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz", + "integrity": "sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw==", + "dev": true, + "requires": { + "debuglog": "^1.0.1", + "dezalgo": "^1.0.0", + "graceful-fs": "^4.1.2", + "once": "^1.3.0" + } + }, + "readdirp": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", + "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "reflect-metadata": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", + "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", + "dev": true + }, + "regenerate": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.1.tgz", + "integrity": "sha512-j2+C8+NtXQgEKWk49MMP5P/u2GhnahTtVkRIHr5R5lVRlbKvmQ+oS+A5aLKWp2ma5VkT8sh6v+v4hbH0YHR66A==", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", + "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", + "dev": true, + "requires": { + "regenerate": "^1.4.0" + } + }, + "regenerator-runtime": { + "version": "0.13.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", + "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", + "dev": true + }, + "regenerator-transform": { + "version": "0.14.4", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.4.tgz", + "integrity": "sha512-EaJaKPBI9GvKpvUz2mz4fhx7WPgvwRLY9v3hlNHWmAuJHI13T4nwKnNvm5RWJzEdnI5g5UwtOww+S8IdoUC2bw==", + "dev": true, + "requires": { + "@babel/runtime": "^7.8.4", + "private": "^0.1.8" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexp.prototype.flags": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", + "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" + } + }, + "regexpu-core": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.0.tgz", + "integrity": "sha512-TQ4KXRnIn6tz6tjnrXEkD/sshygKH/j5KzK86X8MkeHyZ8qst/LZ89j3X4/8HEIfHANTFIP/AbXakeRhWIl5YQ==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.2.0", + "regjsgen": "^0.5.1", + "regjsparser": "^0.6.4", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.2.0" + } + }, + "regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", + "dev": true + }, + "regjsparser": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.4.tgz", + "integrity": "sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "dev": true + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "requires": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", + "dev": true + }, + "rfdc": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.4.tgz", + "integrity": "sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==", + "dev": true + }, + "rgb-regex": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rgb-regex/-/rgb-regex-1.0.1.tgz", + "integrity": "sha1-wODWiC3w4jviVKR16O3UGRX+rrE=", + "dev": true + }, + "rgba-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rgba-regex/-/rgba-regex-1.0.0.tgz", + "integrity": "sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rollup": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.1.0.tgz", + "integrity": "sha512-gfE1455AEazVVTJoeQtcOq/U6GSxwoj4XPSWVsuWmgIxj7sBQNLDOSA82PbdMe+cP8ql8fR1jogPFe8Wg8g4SQ==", + "dev": true, + "requires": { + "fsevents": "~2.1.2" + } + }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true + }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, + "rxjs": { + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.5.tgz", + "integrity": "sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ==", + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "sass": { + "version": "1.26.3", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.26.3.tgz", + "integrity": "sha512-5NMHI1+YFYw4sN3yfKjpLuV9B5l7MqQ6FlkTcC4FT+oHbBRUZoSjHrrt/mE0nFXJyY2kQtU9ou9HxvFVjLFuuw==", + "dev": true, + "requires": { + "chokidar": ">=2.0.0 <4.0.0" + } + }, + "sass-loader": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-8.0.2.tgz", + "integrity": "sha512-7o4dbSK8/Ol2KflEmSco4jTjQoV988bM82P9CZdmo9hR3RLnvNc0ufMNdMrB0caq38JQ/FgF4/7RcbcfKzxoFQ==", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "loader-utils": "^1.2.3", + "neo-async": "^2.6.1", + "schema-utils": "^2.6.1", + "semver": "^6.3.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "saucelabs": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/saucelabs/-/saucelabs-1.5.0.tgz", + "integrity": "sha512-jlX3FGdWvYf4Q3LFfFWS1QvPg3IGCGWxIc8QBFdPTbpTJnt/v17FHXYVAn7C8sHf1yUXo2c7yIM0isDryfYtHQ==", + "dev": true, + "requires": { + "https-proxy-agent": "^2.2.1" + } + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "schema-utils": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz", + "integrity": "sha512-0ilKFI6QQF5nxDZLFn2dMjvc4hjg/Wkg7rHd3jK6/A4a1Hl9VFdQWvgB1UMGoU94pad1P/8N7fMcEnLnSiju8A==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.4", + "ajv": "^6.12.2", + "ajv-keywords": "^3.4.1" + }, + "dependencies": { + "ajv": { + "version": "6.12.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz", + "integrity": "sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + } + } + }, + "select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo=", + "dev": true + }, + "selenium-webdriver": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz", + "integrity": "sha512-WH7Aldse+2P5bbFBO4Gle/nuQOdVwpHMTL6raL3uuBj/vPG07k6uzt3aiahu352ONBr5xXh0hDlM3LhtXPOC4Q==", + "dev": true, + "requires": { + "jszip": "^3.1.3", + "rimraf": "^2.5.4", + "tmp": "0.0.30", + "xml2js": "^0.4.17" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "tmp": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz", + "integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.1" + } + } + } + }, + "selfsigned": { + "version": "1.10.7", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz", + "integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==", + "dev": true, + "requires": { + "node-forge": "0.9.0" + } + }, + "semver": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.1.3.tgz", + "integrity": "sha512-ekM0zfiA9SCBlsKa2X1hxyxiI4L3B6EbVJkkdgQXnSEEaHlGdvyodMruTiulSRWMMB4NeIuYNMC9rTKTz97GxA==", + "dev": true + }, + "semver-dsl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/semver-dsl/-/semver-dsl-1.0.1.tgz", + "integrity": "sha1-02eN5VVeimH2Ke7QJTZq5fJzQKA=", + "dev": true, + "requires": { + "semver": "^5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "semver-intersect": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/semver-intersect/-/semver-intersect-1.4.0.tgz", + "integrity": "sha512-d8fvGg5ycKAq0+I6nfWeCx6ffaWJCsBYU0H2Rq56+/zFePYfT8mXkB3tWBSjR5BerkHNZ5eTPIk1/LBYas35xQ==", + "dev": true, + "requires": { + "semver": "^5.0.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", + "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", + "dev": true, + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.7.2", + "mime": "1.6.0", + "ms": "2.1.1", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "serialize-javascript": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz", + "integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==", + "dev": true + }, + "serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + } + } + }, + "serve-static": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", + "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", + "dev": true, + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.1" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, + "set-value": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "setprototypeof": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", + "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "dev": true, + "requires": { + "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "dev": true + } + } + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "smart-buffer": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz", + "integrity": "sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw==", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "socket.io": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.3.0.tgz", + "integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==", + "dev": true, + "requires": { + "debug": "~4.1.0", + "engine.io": "~3.4.0", + "has-binary2": "~1.0.2", + "socket.io-adapter": "~1.1.0", + "socket.io-client": "2.3.0", + "socket.io-parser": "~3.4.0" + } + }, + "socket.io-adapter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz", + "integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g==", + "dev": true + }, + "socket.io-client": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz", + "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==", + "dev": true, + "requires": { + "backo2": "1.0.2", + "base64-arraybuffer": "0.1.5", + "component-bind": "1.0.0", + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "engine.io-client": "~3.4.0", + "has-binary2": "~1.0.2", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseqs": "0.0.5", + "parseuri": "0.0.5", + "socket.io-parser": "~3.3.0", + "to-array": "0.1.4" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "socket.io-parser": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz", + "integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "debug": "~3.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + } + } + }, + "socket.io-parser": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.4.1.tgz", + "integrity": "sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A==", + "dev": true, + "requires": { + "component-emitter": "1.2.1", + "debug": "~4.1.0", + "isarray": "2.0.1" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "isarray": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz", + "integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4=", + "dev": true + } + } + }, + "sockjs": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.20.tgz", + "integrity": "sha512-SpmVOVpdq0DJc0qArhF3E5xsxvaiqGNb73XfgBpK1y3UD5gs8DSo8aCTsuT5pX8rssdc2NDIzANwP9eCAiSdTA==", + "dev": true, + "requires": { + "faye-websocket": "^0.10.0", + "uuid": "^3.4.0", + "websocket-driver": "0.6.5" + } + }, + "sockjs-client": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.4.0.tgz", + "integrity": "sha512-5zaLyO8/nri5cua0VtOrFXBPK1jbL4+1cebT/mmKA1E1ZXOvJrII75bPu0l0k843G/+iAbhEqzyKr0w/eCCj7g==", + "dev": true, + "requires": { + "debug": "^3.2.5", + "eventsource": "^1.0.7", + "faye-websocket": "~0.11.1", + "inherits": "^2.0.3", + "json3": "^3.3.2", + "url-parse": "^1.4.3" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "faye-websocket": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.3.tgz", + "integrity": "sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA==", + "dev": true, + "requires": { + "websocket-driver": ">=0.5.1" + } + } + } + }, + "socks": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.3.3.tgz", + "integrity": "sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA==", + "dev": true, + "requires": { + "ip": "1.1.5", + "smart-buffer": "^4.1.0" + } + }, + "socks-proxy-agent": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-4.0.2.tgz", + "integrity": "sha512-NT6syHhI9LmuEMSK6Kd2V7gNv5KFZoLE7V5udWmn0de+3Mkj3UMA/AJPLyeNUVmElCurSHtUdM3ETpR3z770Wg==", + "dev": true, + "requires": { + "agent-base": "~4.2.1", + "socks": "~2.3.2" + }, + "dependencies": { + "agent-base": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz", + "integrity": "sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg==", + "dev": true, + "requires": { + "es6-promisify": "^5.0.0" + } + } + } + }, + "sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + }, + "source-list-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", + "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", + "dev": true + }, + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + }, + "source-map-loader": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-0.2.4.tgz", + "integrity": "sha512-OU6UJUty+i2JDpTItnizPrlpOIBLmQbWMuBg9q5bVtnHACqw1tn9nNwqJLbv0/00JjnJb/Ee5g5WS5vrRv7zIQ==", + "dev": true, + "requires": { + "async": "^2.5.0", + "loader-utils": "^1.1.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "source-map-resolve": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", + "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "dev": true, + "requires": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz", + "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", + "dev": true + }, + "spdy": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", + "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + } + }, + "spdy-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "dev": true, + "requires": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "speed-measure-webpack-plugin": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/speed-measure-webpack-plugin/-/speed-measure-webpack-plugin-1.3.1.tgz", + "integrity": "sha512-qVIkJvbtS9j/UeZumbdfz0vg+QfG/zxonAjzefZrqzkr7xOncLVXkeGbTpzd1gjCBM4PmVNkWlkeTVhgskAGSQ==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "ssri": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.0.tgz", + "integrity": "sha512-aq/pz989nxVYwn16Tsbj1TqFpD5LLrQxHf5zaHuieFV+R0Bbr4y8qUsOA45hXT/N4/9UNXTarBjnjVmjSOVaAA==", + "dev": true, + "requires": { + "minipass": "^3.1.1" + } + }, + "stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", + "dev": true + }, + "stream-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", + "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-each": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", + "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-shift": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", + "dev": true + }, + "streamroller": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz", + "integrity": "sha512-OG79qm3AujAM9ImoqgWEY1xG4HX+Lw+yY6qZj9R1K2mhF5bEmQ849wvrb+4vt4jLMLzwXttJlQbOdPOQVRv7DQ==", + "dev": true, + "requires": { + "date-format": "^2.1.0", + "debug": "^4.1.1", + "fs-extra": "^8.1.0" + }, + "dependencies": { + "date-format": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz", + "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==", + "dev": true + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + } + } + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "string.prototype.trimend": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", + "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string.prototype.trimleft": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.2.tgz", + "integrity": "sha512-gCA0tza1JBvqr3bfAIFJGqfdRTyPae82+KTnm3coDXkZN9wnuW3HjGgN386D7hfv5CHQYCI022/rJPVlqXyHSw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimstart": "^1.0.0" + } + }, + "string.prototype.trimright": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.2.tgz", + "integrity": "sha512-ZNRQ7sY3KroTaYjRS6EbNiiHrOkjihL9aQE/8gfQ4DtAC/aEBRHFJa44OmoWxGGqXuJlfKkZW4WcXErGr+9ZFg==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5", + "string.prototype.trimend": "^1.0.0" + } + }, + "string.prototype.trimstart": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", + "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "style-loader": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-1.1.3.tgz", + "integrity": "sha512-rlkH7X/22yuwFYK357fMN/BxYOorfnfq0eD7+vqlemSK4wEcejFF1dg4zxP0euBW8NrYx2WZzZ8PPFevr7D+Kw==", + "dev": true, + "requires": { + "loader-utils": "^1.2.3", + "schema-utils": "^2.6.4" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "stylehacks": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz", + "integrity": "sha512-7GlLk9JwlElY4Y6a/rmbH2MhVlTyVmiJd1PfTCqFaIBEGMYNsrO/v3SeGTdhBThLg4Z+NbOk/qFMwCa+J+3p/g==", + "dev": true, + "requires": { + "browserslist": "^4.0.0", + "postcss": "^7.0.0", + "postcss-selector-parser": "^3.0.0" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.2.tgz", + "integrity": "sha512-h7fJ/5uWuRVyOtkO45pnt1Ih40CEleeyCHzipqAZO2e5H20g25Y48uYnFUiShvY4rZWNJ/Bib/KVPmanaCtOhA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + } + } + }, + "stylus": { + "version": "0.54.7", + "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.54.7.tgz", + "integrity": "sha512-Yw3WMTzVwevT6ZTrLCYNHAFmanMxdylelL3hkWNgPMeTCpMwpV3nXjpOHuBXtFv7aiO2xRuQS6OoAdgkNcSNug==", + "dev": true, + "requires": { + "css-parse": "~2.0.0", + "debug": "~3.1.0", + "glob": "^7.1.3", + "mkdirp": "~0.5.x", + "safer-buffer": "^2.1.2", + "sax": "~1.2.4", + "semver": "^6.0.0", + "source-map": "^0.7.3" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "stylus-loader": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/stylus-loader/-/stylus-loader-3.0.2.tgz", + "integrity": "sha512-+VomPdZ6a0razP+zinir61yZgpw2NfljeSsdUF5kJuEzlo3khXhY19Fn6l8QQz1GRJGtMCo8nG5C04ePyV7SUA==", + "dev": true, + "requires": { + "loader-utils": "^1.0.2", + "lodash.clonedeep": "^4.5.0", + "when": "~3.6.x" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "svgo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.3.2.tgz", + "integrity": "sha512-yhy/sQYxR5BkC98CY7o31VGsg014AKLEPxdfhora76l36hD9Rdy5NZA/Ocn6yayNPgSamYdtX2rFJdcv07AYVw==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "coa": "^2.0.2", + "css-select": "^2.0.0", + "css-select-base-adapter": "^0.1.1", + "css-tree": "1.0.0-alpha.37", + "csso": "^4.0.2", + "js-yaml": "^3.13.1", + "mkdirp": "~0.5.1", + "object.values": "^1.1.0", + "sax": "~1.2.4", + "stable": "^0.1.8", + "unquote": "~1.1.1", + "util.promisify": "~1.0.0" + } + }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", + "dev": true + }, + "tapable": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", + "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", + "dev": true + }, + "tar": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.2.tgz", + "integrity": "sha512-Glo3jkRtPcvpDlAs/0+hozav78yoXKFr+c4wgw62NNMO3oo4AaJdCo21Uu7lcwr55h39W2XD1LMERc64wtbItg==", + "dev": true, + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.0", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "dependencies": { + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + } + } + }, + "terser": { + "version": "4.6.10", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.6.10.tgz", + "integrity": "sha512-qbF/3UOo11Hggsbsqm2hPa6+L4w7bkr+09FNseEe8xrcVD3APGLFqE+Oz1ZKAxjYnFsj80rLOfgAtJ0LNJjtTA==", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "terser-webpack-plugin": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.5.tgz", + "integrity": "sha512-WlWksUoq+E4+JlJ+h+U+QUzXpcsMSSNXkDy9lBVkSqDn1w23Gg29L/ary9GeJVYCGiNJJX7LnVc4bwL1N3/g1w==", + "dev": true, + "requires": { + "cacache": "^13.0.1", + "find-cache-dir": "^3.2.0", + "jest-worker": "^25.1.0", + "p-limit": "^2.2.2", + "schema-utils": "^2.6.4", + "serialize-javascript": "^2.1.2", + "source-map": "^0.6.1", + "terser": "^4.4.3", + "webpack-sources": "^1.4.3" + }, + "dependencies": { + "cacache": { + "version": "13.0.1", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", + "integrity": "sha512-5ZvAxd05HDDU+y9BVvcqYu2LLXmPnQ0hW62h32g4xBTgL/MppR4/04NHfj/ycM2y6lmTnbw6HVi+1eN0Psba6w==", + "dev": true, + "requires": { + "chownr": "^1.1.2", + "figgy-pudding": "^3.5.1", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "graceful-fs": "^4.2.2", + "infer-owner": "^1.0.4", + "lru-cache": "^5.1.1", + "minipass": "^3.0.0", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "p-map": "^3.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^2.7.1", + "ssri": "^7.0.0", + "unique-filename": "^1.1.1" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "ssri": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz", + "integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1", + "minipass": "^3.1.1" + } + } + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "thunky": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", + "dev": true + }, + "timers-browserify": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz", + "integrity": "sha512-60aV6sgJ5YEbzUdn9c8kYGIqOubPoUdqQCul3SBAsRCZ40s6Y5cMcrW4dt3/k/EsbLVJNl9n6Vz3fTc+k2GeKQ==", + "dev": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "timsort": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", + "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "dev": true + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", + "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "dev": true + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true + }, + "ts-node": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.3.0.tgz", + "integrity": "sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "^3.0.0" + } + }, + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==" + }, + "tslint": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.2.tgz", + "integrity": "sha512-UyNrLdK3E0fQG/xWNqAFAC5ugtFyPO4JJR1KyyfQAyzR8W0fTRrC91A8Wej4BntFzcvETdCSDa/4PnNYJQLYiA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.3", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.10.0", + "tsutils": "^2.29.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "tsutils": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "dev": true + }, + "ua-parser-js": { + "version": "0.7.21", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.21.tgz", + "integrity": "sha512-+O8/qh/Qj8CgC6eYBVBykMrNtp5Gebn4dlGD/kKXVkJNDwyrAwSIqwz8CDf+tsAIWVycKcku6gIXJ0qwx/ZXaQ==", + "dev": true + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", + "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", + "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", + "dev": true + }, + "union-value": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", + "dev": true + }, + "uniqs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", + "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=", + "dev": true + }, + "unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.2.tgz", + "integrity": "sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "universal-analytics": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/universal-analytics/-/universal-analytics-0.4.20.tgz", + "integrity": "sha512-gE91dtMvNkjO+kWsPstHRtSwHXz0l2axqptGYp5ceg4MsuurloM0PU3pdOfpb5zBXUvyjT4PwhWK2m39uczZuw==", + "dev": true, + "requires": { + "debug": "^3.0.0", + "request": "^2.88.0", + "uuid": "^3.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", + "dev": true + }, + "unquote": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", + "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "upath": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", + "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", + "dev": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-parse": { + "version": "1.4.7", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", + "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", + "dev": true, + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", + "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", + "dev": true, + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "util-promisify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/util-promisify/-/util-promisify-2.1.0.tgz", + "integrity": "sha1-PCI2R2xNMsX/PEcAKt18E7moKlM=", + "dev": true, + "requires": { + "object.getownpropertydescriptors": "^2.0.3" + } + }, + "util.promisify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", + "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.2", + "has-symbols": "^1.0.1", + "object.getownpropertydescriptors": "^2.1.0" + } + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", + "dev": true + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "requires": { + "builtins": "^1.0.3" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", + "dev": true + }, + "vendors": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.4.tgz", + "integrity": "sha512-/juG65kTL4Cy2su4P8HjtkTxk6VmJDiOPBufWniqQ6wknac6jNiXS9vU+hO3wgusiyqWlzTbVHi0dyJqRONg3w==", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vm-browserify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", + "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", + "dev": true + }, + "void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", + "dev": true + }, + "watchpack": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.2.tgz", + "integrity": "sha512-ymVbbQP40MFTp+cNMvpyBpBtygHnPzPkHqoIwRRj/0B8KhqQwV8LaKjtbaxF2lK4vl8zN9wCxS46IFCU5K4W0g==", + "dev": true, + "requires": { + "chokidar": "^3.4.0", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0", + "watchpack-chokidar2": "^2.0.0" + } + }, + "watchpack-chokidar2": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.0.tgz", + "integrity": "sha512-9TyfOyN/zLUbA288wZ8IsMZ+6cbzvsNyEzSBp6e/zkifi6xxbl8SmQ/CxQq32k8NNqrdVEVUVSEf56L4rQ/ZxA==", + "dev": true, + "optional": true, + "requires": { + "chokidar": "^2.1.8" + }, + "dependencies": { + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "optional": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "optional": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "dev": true, + "optional": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "optional": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + } + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "optional": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "optional": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "optional": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + } + }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, + "optional": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "optional": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "optional": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "requires": { + "minimalistic-assert": "^1.0.0" + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, + "webdriver-js-extender": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/webdriver-js-extender/-/webdriver-js-extender-2.1.0.tgz", + "integrity": "sha512-lcUKrjbBfCK6MNsh7xaY2UAUmZwe+/ib03AjVOpFobX4O7+83BUveSrLfU0Qsyb1DaKJdQRbuU+kM9aZ6QUhiQ==", + "dev": true, + "requires": { + "@types/selenium-webdriver": "^3.0.0", + "selenium-webdriver": "^3.0.1" + } + }, + "webpack": { + "version": "4.42.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.42.0.tgz", + "integrity": "sha512-EzJRHvwQyBiYrYqhyjW9AqM90dE4+s1/XtCfn7uWg6cS72zH+2VPFAlsnW0+W0cDi0XRjNKUMoJtpSi50+Ph6w==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.8.5", + "@webassemblyjs/helper-module-context": "1.8.5", + "@webassemblyjs/wasm-edit": "1.8.5", + "@webassemblyjs/wasm-parser": "1.8.5", + "acorn": "^6.2.1", + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^4.1.0", + "eslint-scope": "^4.0.3", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^2.4.0", + "loader-utils": "^1.2.3", + "memory-fs": "^0.4.1", + "micromatch": "^3.1.10", + "mkdirp": "^0.5.1", + "neo-async": "^2.6.1", + "node-libs-browser": "^2.2.1", + "schema-utils": "^1.0.0", + "tapable": "^1.1.3", + "terser-webpack-plugin": "^1.4.3", + "watchpack": "^1.6.0", + "webpack-sources": "^1.4.1" + }, + "dependencies": { + "cacache": { + "version": "12.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz", + "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + } + }, + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=", + "dev": true + }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "serialize-javascript": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.1.0.tgz", + "integrity": "sha512-JIJT1DGiWmIKhzRsG91aS6Ze4sFUrYbltlkg2onR5OrnNM02Kl/hnY/T4FN2omvyeBbQmMJv+K4cPOpGzOTFBg==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "ssri": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz", + "integrity": "sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA==", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1" + } + }, + "terser-webpack-plugin": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.4.tgz", + "integrity": "sha512-U4mACBHIegmfoEe5fdongHESNJWqsGU+W0S/9+BmYGVQDw1+c2Ow05TpMhxjPK1sRb7cuYq1BPl1e5YHJMTCqA==", + "dev": true, + "requires": { + "cacache": "^12.0.2", + "find-cache-dir": "^2.1.0", + "is-wsl": "^1.1.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^3.1.0", + "source-map": "^0.6.1", + "terser": "^4.1.2", + "webpack-sources": "^1.4.0", + "worker-farm": "^1.7.0" + } + } + } + }, + "webpack-dev-middleware": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-3.7.2.tgz", + "integrity": "sha512-1xC42LxbYoqLNAhV6YzTYacicgMZQTqRd27Sim9wn5hJrX3I5nxYy1SxSd4+gjUFsz1dQFj+yEe6zEVmSkeJjw==", + "dev": true, + "requires": { + "memory-fs": "^0.4.1", + "mime": "^2.4.4", + "mkdirp": "^0.5.1", + "range-parser": "^1.2.1", + "webpack-log": "^2.0.0" + }, + "dependencies": { + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "mime": { + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", + "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==", + "dev": true + } + } + }, + "webpack-dev-server": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.11.0.tgz", + "integrity": "sha512-PUxZ+oSTxogFQgkTtFndEtJIPNmml7ExwufBZ9L2/Xyyd5PnOL5UreWe5ZT7IU25DSdykL9p1MLQzmLh2ljSeg==", + "dev": true, + "requires": { + "ansi-html": "0.0.7", + "bonjour": "^3.5.0", + "chokidar": "^2.1.8", + "compression": "^1.7.4", + "connect-history-api-fallback": "^1.6.0", + "debug": "^4.1.1", + "del": "^4.1.1", + "express": "^4.17.1", + "html-entities": "^1.3.1", + "http-proxy-middleware": "0.19.1", + "import-local": "^2.0.0", + "internal-ip": "^4.3.0", + "ip": "^1.1.5", + "is-absolute-url": "^3.0.3", + "killable": "^1.0.1", + "loglevel": "^1.6.8", + "opn": "^5.5.0", + "p-retry": "^3.0.1", + "portfinder": "^1.0.26", + "schema-utils": "^1.0.0", + "selfsigned": "^1.10.7", + "semver": "^6.3.0", + "serve-index": "^1.9.1", + "sockjs": "0.3.20", + "sockjs-client": "1.4.0", + "spdy": "^4.0.2", + "strip-ansi": "^3.0.1", + "supports-color": "^6.1.0", + "url": "^0.11.0", + "webpack-dev-middleware": "^3.7.2", + "webpack-log": "^2.0.0", + "ws": "^6.2.1", + "yargs": "^13.3.2" + }, + "dependencies": { + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + } + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + } + }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, + "optional": true + }, + "is-absolute-url": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-3.0.3.tgz", + "integrity": "sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q==", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + } + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + } + } + }, + "webpack-log": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz", + "integrity": "sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg==", + "dev": true, + "requires": { + "ansi-colors": "^3.0.0", + "uuid": "^3.3.2" + } + }, + "webpack-merge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-4.2.2.tgz", + "integrity": "sha512-TUE1UGoTX2Cd42j3krGYqObZbOD+xF7u28WB7tfUordytSjbWTIjK/8V0amkBfTYN4/pB/GIDlJZZ657BGG19g==", + "dev": true, + "requires": { + "lodash": "^4.17.15" + } + }, + "webpack-sources": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", + "integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==", + "dev": true, + "requires": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "webpack-subresource-integrity": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/webpack-subresource-integrity/-/webpack-subresource-integrity-1.4.0.tgz", + "integrity": "sha512-GB1kB/LwAWC3CxwcedGhMkxGpNZxSheCe1q+KJP1bakuieAdX/rGHEcf5zsEzhKXpqsGqokgsDoD9dIkr61VDQ==", + "dev": true, + "requires": { + "webpack-sources": "^1.3.0" + } + }, + "websocket-driver": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.6.5.tgz", + "integrity": "sha1-XLJVbOuF9Dc8bYI4qmkchFThOjY=", + "dev": true, + "requires": { + "websocket-extensions": ">=0.1.1" + } + }, + "websocket-extensions": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", + "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", + "dev": true + }, + "when": { + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/when/-/when-3.6.4.tgz", + "integrity": "sha1-RztRfsFZ4rhQBUl6E5g/CVQS404=", + "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "worker-farm": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.7.0.tgz", + "integrity": "sha512-rvw3QTZc8lAxyVrqcSGVm5yP/IJ2UcB3U0graE3LCFoZ0Yn2x4EoVSqJKdB/T5M+FLcRPjz4TDacRf3OCfNUzw==", + "dev": true, + "requires": { + "errno": "~0.1.7" + } + }, + "worker-plugin": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/worker-plugin/-/worker-plugin-4.0.3.tgz", + "integrity": "sha512-7hFDYWiKcE3yHZvemsoM9lZis/PzurHAEX1ej8PLCu818Rt6QqUAiDdxHPCKZctzmhqzPpcFSgvMCiPbtooqAg==", + "dev": true, + "requires": { + "loader-utils": "^1.1.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + } + } + } + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "ws": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", + "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xml2js": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", + "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "dev": true, + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + } + }, + "xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "dev": true + }, + "xmlhttprequest-ssl": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz", + "integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4=", + "dev": true + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", + "dev": true + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, + "zone.js": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.10.3.tgz", + "integrity": "sha512-LXVLVEq0NNOqK/fLJo3d0kfzd4sxwn2/h67/02pjCjfKDxgx1i9QqpvtHD8CrBnSSwMw5+dy11O7FRX5mkO7Cg==" + } + } +} diff --git a/reactive-systems/frontend/package.json b/reactive-systems/frontend/package.json new file mode 100644 index 0000000000..e3c202f9c4 --- /dev/null +++ b/reactive-systems/frontend/package.json @@ -0,0 +1,47 @@ +{ + "name": "frontend", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "test": "ng test", + "lint": "ng lint", + "e2e": "ng e2e" + }, + "private": true, + "dependencies": { + "@angular/animations": "~9.1.7", + "@angular/common": "~9.1.7", + "@angular/compiler": "~9.1.7", + "@angular/core": "~9.1.7", + "@angular/forms": "~9.1.7", + "@angular/platform-browser": "~9.1.7", + "@angular/platform-browser-dynamic": "~9.1.7", + "@angular/router": "~9.1.7", + "bootstrap": "^4.5.0", + "rxjs": "~6.5.4", + "tslib": "^1.10.0", + "zone.js": "~0.10.2" + }, + "devDependencies": { + "@angular-devkit/build-angular": "~0.901.6", + "@angular/cli": "~9.1.6", + "@angular/compiler-cli": "~9.1.7", + "@types/node": "^12.11.1", + "@types/jasmine": "~3.5.0", + "@types/jasminewd2": "~2.0.3", + "codelyzer": "^5.1.2", + "jasmine-core": "~3.5.0", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~5.0.0", + "karma-chrome-launcher": "~3.1.0", + "karma-coverage-istanbul-reporter": "~2.1.0", + "karma-jasmine": "~3.0.1", + "karma-jasmine-html-reporter": "^1.4.2", + "protractor": "~5.4.3", + "ts-node": "~8.3.0", + "tslint": "~6.1.0", + "typescript": "~3.8.3" + } +} diff --git a/reactive-systems/frontend/src/app/app.component.css b/reactive-systems/frontend/src/app/app.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/reactive-systems/frontend/src/app/app.component.html b/reactive-systems/frontend/src/app/app.component.html new file mode 100644 index 0000000000..c7af16bbae --- /dev/null +++ b/reactive-systems/frontend/src/app/app.component.html @@ -0,0 +1 @@ + diff --git a/reactive-systems/frontend/src/app/app.component.spec.ts b/reactive-systems/frontend/src/app/app.component.spec.ts new file mode 100644 index 0000000000..34f86dc45a --- /dev/null +++ b/reactive-systems/frontend/src/app/app.component.spec.ts @@ -0,0 +1,31 @@ +import { TestBed, async } from '@angular/core/testing'; +import { AppComponent } from './app.component'; + +describe('AppComponent', () => { + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ + AppComponent + ], + }).compileComponents(); + })); + + it('should create the app', () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); + }); + + it(`should have as title 'frontend'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.componentInstance; + expect(app.title).toEqual('frontend'); + }); + + it('should render title', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement; + expect(compiled.querySelector('.content span').textContent).toContain('frontend app is running!'); + }); +}); diff --git a/reactive-systems/frontend/src/app/app.component.ts b/reactive-systems/frontend/src/app/app.component.ts new file mode 100644 index 0000000000..9d6b2f11d5 --- /dev/null +++ b/reactive-systems/frontend/src/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'] +}) +export class AppComponent { + title = 'frontend'; +} diff --git a/reactive-systems/frontend/src/app/app.module.ts b/reactive-systems/frontend/src/app/app.module.ts new file mode 100644 index 0000000000..7a8709583c --- /dev/null +++ b/reactive-systems/frontend/src/app/app.module.ts @@ -0,0 +1,29 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; + +import { AppComponent } from './app.component'; +import { OrdersComponent } from './orders/orders.component'; + +import { ReactiveFormsModule } from '@angular/forms'; +import { HttpClientModule } from '@angular/common/http'; + +import { OrdersBlockingService } from './orders/orders-blocking.service'; +import { OrdersReactiveService } from './orders/orders-reactive.service'; + +@NgModule({ + declarations: [ + AppComponent, + OrdersComponent + ], + imports: [ + BrowserModule, + ReactiveFormsModule, + HttpClientModule + ], + providers: [ + OrdersBlockingService, + OrdersReactiveService + ], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/reactive-systems/frontend/src/app/orders/orders-blocking.service.ts b/reactive-systems/frontend/src/app/orders/orders-blocking.service.ts new file mode 100644 index 0000000000..13ca2c936c --- /dev/null +++ b/reactive-systems/frontend/src/app/orders/orders-blocking.service.ts @@ -0,0 +1,16 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from "@angular/common/http"; +import { Observable } from 'rxjs'; + +@Injectable() +export class OrdersBlockingService { + + url: string = 'http://localhost:8080/api/orders' + + constructor(private http: HttpClient) {} + + getOrders() { + return this.http.get(this.url) + } + +} diff --git a/reactive-systems/frontend/src/app/orders/orders-reactive.service.ts b/reactive-systems/frontend/src/app/orders/orders-reactive.service.ts new file mode 100644 index 0000000000..85ef5b3348 --- /dev/null +++ b/reactive-systems/frontend/src/app/orders/orders-reactive.service.ts @@ -0,0 +1,42 @@ +import { Injectable, NgZone } from '@angular/core'; +import { Observable } from 'rxjs'; +const EventSource: any = window['EventSource']; + +@Injectable() +export class OrdersReactiveService { + + url: string = 'http://localhost:8080/api/orders' + + orders: string[] = [] + + constructor(private _zone: NgZone) {} + + getOrderStream() { + this.orders = [] + return Observable.create((observer) => { + let eventSource = new EventSource(this.url) + eventSource.onmessage = (event) => { + console.log('Received event: ', event) + let json = JSON.parse(event.data) + this.orders.push(json); + this._zone.run(() => { + observer.next(this.orders) + }) + } + eventSource.onerror = (error) => { + if(eventSource.readyState === 0) { + console.log('The stream has been closed by the server.') + eventSource.close() + this._zone.run(() => { + observer.complete() + }) + } else { + this._zone.run(() => { + observer.error('EventSource error: ' + error) + }) + } + } + }) + } + +} diff --git a/reactive-systems/frontend/src/app/orders/orders.component.css b/reactive-systems/frontend/src/app/orders/orders.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/reactive-systems/frontend/src/app/orders/orders.component.html b/reactive-systems/frontend/src/app/orders/orders.component.html new file mode 100644 index 0000000000..c1348da17a --- /dev/null +++ b/reactive-systems/frontend/src/app/orders/orders.component.html @@ -0,0 +1,60 @@ +

+

Please place a new Order!

+
+
+

Your order {{response.id}} was successfully placed, please check the status of order.

+
+
+

Your order could not be placed at the moment: {{error.message}}

+
+
+
+

Product Quantities:

+
+
  • + {{ form.controls.lineItems['controls'][i].controls.name.value }}: +

    Only {{ form.controls.lineItems['controls'][i].controls.stock.value }} left in the stock!

    +
  • +
    +   +
    +

    Payment Mode: + +

    +
    +   +
    +

    Address:

    + + + + + +
    +   +
    + +
    +
    +
    + +
    + +
    + +
    + +
    +
    +

    Your orders placed so far:

    +
      +
    • +

      Order ID: {{ order.id }}, Order Status: {{order.orderStatus}}, Order Message: {{order.responseMessage}}

      +
    • +
    +
    diff --git a/reactive-systems/frontend/src/app/orders/orders.component.spec.ts b/reactive-systems/frontend/src/app/orders/orders.component.spec.ts new file mode 100644 index 0000000000..b8efbb0f4e --- /dev/null +++ b/reactive-systems/frontend/src/app/orders/orders.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { OrdersComponent } from './orders.component'; + +describe('OrdersComponent', () => { + let component: OrdersComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ OrdersComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(OrdersComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/reactive-systems/frontend/src/app/orders/orders.component.ts b/reactive-systems/frontend/src/app/orders/orders.component.ts new file mode 100644 index 0000000000..d9cd6a7697 --- /dev/null +++ b/reactive-systems/frontend/src/app/orders/orders.component.ts @@ -0,0 +1,104 @@ +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, FormControl, FormArray } from "@angular/forms"; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { OrdersBlockingService } from './orders-blocking.service'; +import { OrdersReactiveService } from './orders-reactive.service'; + +@Component({ + selector: 'app-orders', + templateUrl: './orders.component.html', + styleUrls: ['./orders.component.css'] +}) + +export class OrdersComponent implements OnInit { + form: FormGroup + response: any + error: any + previousOrders: Observable + itemList: any + paymentModes: any + + constructor(public fb: FormBuilder, private http: HttpClient, + private ordersBlockingService: OrdersBlockingService, + private ordersReactiveService: OrdersReactiveService) { + this.paymentModes = this.fetchPaymentModes() + this.fetchProducts().then(data => this.form = this.createForm()); + } + + ngOnInit() { + this.response = null + this.error = null + this.previousOrders = null + } + + createForm() { + let fb = this.fb + let form = fb.group({ + userId: 'Bob Marley', + paymentMode: [this.paymentModes[0]], + lineItems: this.fb.array([]), + shippingAddress: this.fb.group({ + name: ['Bob Marley'], + house: ['24'], + street: ['Ashford Av.'], + city: ['New York'], + zip: ['11001'] + }) + }) + let items = this.itemList + items.forEach(function (value, index) { + (form.get('lineItems')).push(fb.group({ + 'productId':items[index].id, + 'name': items[index].name, + 'stock': items[index].stock, + 'quantity': 10} + )) + }); + return form + } + + async fetchProducts() { + let products = [ + {"id":"p001", "name": "Product A1", "stock": 101}, + {"id":"p002", "name": "Product A2", "stock": 102} + ] + let data = await this.http.get('http://localhost:8081/api/products').toPromise() + this.itemList = data + } + + fetchPaymentModes() { + let paymentModes = ["Cash on Delivery", "Card on Delivery"] + return paymentModes + } + + createOrder() { + let headers = new HttpHeaders({ + 'Content-Type': 'application/json' + }); + let options = { + headers: headers + } + this.http.post('http://localhost:8080/api/orders', this.form.value, options).subscribe( + (response) => { + console.log(response) + this.error = null + this.response = response + }, + (error) => { + console.log(error) + this.response = null + this.error = error + } + ) + } + + getOrders() { + this.previousOrders = this.ordersBlockingService.getOrders() + } + + getOrderStream() { + this.previousOrders = this.ordersReactiveService.getOrderStream() + } + +} diff --git a/reactive-systems/frontend/src/assets/.gitkeep b/reactive-systems/frontend/src/assets/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/reactive-systems/frontend/src/environments/environment.prod.ts b/reactive-systems/frontend/src/environments/environment.prod.ts new file mode 100644 index 0000000000..3612073bc3 --- /dev/null +++ b/reactive-systems/frontend/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/reactive-systems/frontend/src/environments/environment.ts b/reactive-systems/frontend/src/environments/environment.ts new file mode 100644 index 0000000000..7b4f817adb --- /dev/null +++ b/reactive-systems/frontend/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/reactive-systems/frontend/src/favicon.ico b/reactive-systems/frontend/src/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..997406ad22c29aae95893fb3d666c30258a09537 GIT binary patch literal 948 zcmV;l155mgP)CBYU7IjCFmI-B}4sMJt3^s9NVg!P0 z6hDQy(L`XWMkB@zOLgN$4KYz;j0zZxq9KKdpZE#5@k0crP^5f9KO};h)ZDQ%ybhht z%t9#h|nu0K(bJ ztIkhEr!*UyrZWQ1k2+YkGqDi8Z<|mIN&$kzpKl{cNP=OQzXHz>vn+c)F)zO|Bou>E z2|-d_=qY#Y+yOu1a}XI?cU}%04)zz%anD(XZC{#~WreV!a$7k2Ug`?&CUEc0EtrkZ zL49MB)h!_K{H(*l_93D5tO0;BUnvYlo+;yss%n^&qjt6fZOa+}+FDO(~2>G z2dx@=JZ?DHP^;b7*Y1as5^uphBsh*s*z&MBd?e@I>-9kU>63PjP&^#5YTOb&x^6Cf z?674rmSHB5Fk!{Gv7rv!?qX#ei_L(XtwVqLX3L}$MI|kJ*w(rhx~tc&L&xP#?cQow zX_|gx$wMr3pRZIIr_;;O|8fAjd;1`nOeu5K(pCu7>^3E&D2OBBq?sYa(%S?GwG&_0-s%_v$L@R!5H_fc)lOb9ZoOO#p`Nn`KU z3LTTBtjwo`7(HA6 z7gmO$yTR!5L>Bsg!X8616{JUngg_@&85%>W=mChTR;x4`P=?PJ~oPuy5 zU-L`C@_!34D21{fD~Y8NVnR3t;aqZI3fIhmgmx}$oc-dKDC6Ap$Gy>a!`A*x2L1v0 WcZ@i?LyX}70000 + + + + Frontend + + + + + + + + diff --git a/reactive-systems/frontend/src/main.ts b/reactive-systems/frontend/src/main.ts new file mode 100644 index 0000000000..c7b673cf44 --- /dev/null +++ b/reactive-systems/frontend/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.error(err)); diff --git a/reactive-systems/frontend/src/polyfills.ts b/reactive-systems/frontend/src/polyfills.ts new file mode 100644 index 0000000000..03711e5d92 --- /dev/null +++ b/reactive-systems/frontend/src/polyfills.ts @@ -0,0 +1,63 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/reactive-systems/frontend/src/styles.css b/reactive-systems/frontend/src/styles.css new file mode 100644 index 0000000000..90d4ee0072 --- /dev/null +++ b/reactive-systems/frontend/src/styles.css @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/reactive-systems/frontend/src/test.ts b/reactive-systems/frontend/src/test.ts new file mode 100644 index 0000000000..50193eb0f2 --- /dev/null +++ b/reactive-systems/frontend/src/test.ts @@ -0,0 +1,25 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + keys(): string[]; + (id: string): T; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/reactive-systems/frontend/tsconfig.app.json b/reactive-systems/frontend/tsconfig.app.json new file mode 100644 index 0000000000..f758d9820d --- /dev/null +++ b/reactive-systems/frontend/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.d.ts" + ] +} diff --git a/reactive-systems/frontend/tsconfig.json b/reactive-systems/frontend/tsconfig.json new file mode 100644 index 0000000000..8c4ef3bbae --- /dev/null +++ b/reactive-systems/frontend/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "module": "esnext", + "moduleResolution": "node", + "importHelpers": true, + "target": "es2015", + "lib": [ + "es2018", + "dom" + ] + }, + "angularCompilerOptions": { + "fullTemplateTypeCheck": true, + "strictInjectionParameters": true + } +} diff --git a/reactive-systems/frontend/tsconfig.spec.json b/reactive-systems/frontend/tsconfig.spec.json new file mode 100644 index 0000000000..6400fde7d5 --- /dev/null +++ b/reactive-systems/frontend/tsconfig.spec.json @@ -0,0 +1,18 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/spec", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "src/test.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/reactive-systems/frontend/tslint.json b/reactive-systems/frontend/tslint.json new file mode 100644 index 0000000000..d92ff5d1b1 --- /dev/null +++ b/reactive-systems/frontend/tslint.json @@ -0,0 +1,148 @@ +{ + "extends": "tslint:recommended", + "rules": { + "align": { + "options": [ + "parameters", + "statements" + ] + }, + "array-type": false, + "arrow-return-shorthand": true, + "curly": true, + "deprecation": { + "severity": "warning" + }, + "component-class-suffix": true, + "contextual-lifecycle": true, + "directive-class-suffix": true, + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ], + "eofline": true, + "import-blacklist": [ + true, + "rxjs/Rx" + ], + "import-spacing": true, + "indent": { + "options": [ + "spaces" + ] + }, + "max-classes-per-file": false, + "max-line-length": [ + true, + 140 + ], + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-empty": false, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-non-null-assertion": true, + "no-redundant-jsdoc": true, + "no-switch-case-fall-through": true, + "no-var-requires": false, + "object-literal-key-quotes": [ + true, + "as-needed" + ], + "quotemark": [ + true, + "single" + ], + "semicolon": { + "options": [ + "always" + ] + }, + "space-before-function-paren": { + "options": { + "anonymous": "never", + "asyncArrow": "always", + "constructor": "never", + "method": "never", + "named": "never" + } + }, + "typedef-whitespace": { + "options": [ + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + }, + { + "call-signature": "onespace", + "index-signature": "onespace", + "parameter": "onespace", + "property-declaration": "onespace", + "variable-declaration": "onespace" + } + ] + }, + "variable-name": { + "options": [ + "ban-keywords", + "check-format", + "allow-pascal-case" + ] + }, + "whitespace": { + "options": [ + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type", + "check-typecast" + ] + }, + "no-conflicting-lifecycle": true, + "no-host-metadata-property": true, + "no-input-rename": true, + "no-inputs-metadata-property": true, + "no-output-native": true, + "no-output-on-prefix": true, + "no-output-rename": true, + "no-outputs-metadata-property": true, + "template-banana-in-box": true, + "template-no-negated-async": true, + "use-lifecycle-interface": true, + "use-pipe-transform-interface": true + }, + "rulesDirectory": [ + "codelyzer" + ] +} \ No newline at end of file diff --git a/reactive-systems/inventory-service/.mvn/wrapper/MavenWrapperDownloader.java b/reactive-systems/inventory-service/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..e76d1f3241 --- /dev/null +++ b/reactive-systems/inventory-service/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/reactive-systems/inventory-service/.mvn/wrapper/maven-wrapper.jar b/reactive-systems/inventory-service/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054 GIT binary patch literal 50710 zcmbTd1CVCTmM+|7+wQV$+qP}n>auOywyU~q+qUhh+uxis_~*a##hm*_WW?9E7Pb7N%LRFiwbEGCJ0XP=%-6oeT$XZcYgtzC2~q zk(K08IQL8oTl}>>+hE5YRgXTB@fZ4TH9>7=79e`%%tw*SQUa9~$xKD5rS!;ZG@ocK zQdcH}JX?W|0_Afv?y`-NgLum62B&WSD$-w;O6G0Sm;SMX65z)l%m1e-g8Q$QTI;(Q z+x$xth4KFvH@Bs6(zn!iF#nenk^Y^ce;XIItAoCsow38eq?Y-Auh!1in#Rt-_D>H^ z=EjbclGGGa6VnaMGmMLj`x3NcwA43Jb(0gzl;RUIRAUDcR1~99l2SAPkVhoRMMtN} zXvC<tOmX83grD8GSo_Lo?%lNfhD#EBgPo z*nf@ppMC#B!T)Ae0RG$mlJWmGl7CkuU~B8-==5i;rS;8i6rJ=PoQxf446XDX9g|c> zU64ePyMlsI^V5Jq5A+BPe#e73+kpc_r1tv#B)~EZ;7^67F0*QiYfrk0uVW;Qb=NsG zN>gsuCwvb?s-KQIppEaeXtEMdc9dy6Dfduz-tMTms+i01{eD9JE&h?Kht*$eOl#&L zJdM_-vXs(V#$Ed;5wyNWJdPNh+Z$+;$|%qR(t`4W@kDhd*{(7-33BOS6L$UPDeE_53j${QfKN-0v-HG z(QfyvFNbwPK%^!eIo4ac1;b>c0vyf9}Xby@YY!lkz-UvNp zwj#Gg|4B~?n?G^{;(W;|{SNoJbHTMpQJ*Wq5b{l9c8(%?Kd^1?H1om1de0Da9M;Q=n zUfn{f87iVb^>Exl*nZ0hs(Yt>&V9$Pg`zX`AI%`+0SWQ4Zc(8lUDcTluS z5a_KerZWe}a-MF9#Cd^fi!y3%@RFmg&~YnYZ6<=L`UJ0v={zr)>$A;x#MCHZy1st7 ztT+N07NR+vOwSV2pvWuN1%lO!K#Pj0Fr>Q~R40{bwdL%u9i`DSM4RdtEH#cW)6}+I-eE< z&tZs+(Ogu(H_;$a$!7w`MH0r%h&@KM+<>gJL@O~2K2?VrSYUBbhCn#yy?P)uF3qWU z0o09mIik+kvzV6w>vEZy@&Mr)SgxPzUiDA&%07m17udz9usD82afQEps3$pe!7fUf z0eiidkJ)m3qhOjVHC_M(RYCBO%CZKZXFb8}s0-+}@CIn&EF(rRWUX2g^yZCvl0bI} zbP;1S)iXnRC&}5-Tl(hASKqdSnO?ASGJ*MIhOXIblmEudj(M|W!+I3eDc}7t`^mtg z)PKlaXe(OH+q-)qcQ8a@!llRrpGI8DsjhoKvw9T;TEH&?s=LH0w$EzI>%u;oD@x83 zJL7+ncjI9nn!TlS_KYu5vn%f*@qa5F;| zEFxY&B?g=IVlaF3XNm_03PA)=3|{n-UCgJoTr;|;1AU9|kPE_if8!Zvb}0q$5okF$ zHaJdmO&gg!9oN|M{!qGE=tb|3pVQ8PbL$}e;NgXz<6ZEggI}wO@aBP**2Wo=yN#ZC z4G$m^yaM9g=|&!^ft8jOLuzc3Psca*;7`;gnHm}tS0%f4{|VGEwu45KptfNmwxlE~ z^=r30gi@?cOm8kAz!EylA4G~7kbEiRlRIzwrb~{_2(x^$-?|#e6Bi_**(vyr_~9Of z!n>Gqf+Qwiu!xhi9f53=PM3`3tNF}pCOiPU|H4;pzjcsqbwg*{{kyrTxk<;mx~(;; z1NMrpaQ`57yn34>Jo3b|HROE(UNcQash!0p2-!Cz;{IRv#Vp5!3o$P8!%SgV~k&Hnqhp`5eLjTcy93cK!3Hm-$`@yGnaE=?;*2uSpiZTs_dDd51U%i z{|Zd9ou-;laGS_x=O}a+ zB||za<795A?_~Q=r=coQ+ZK@@ zId~hWQL<%)fI_WDIX#=(WNl!Dm$a&ROfLTd&B$vatq!M-2Jcs;N2vps$b6P1(N}=oI3<3luMTmC|0*{ zm1w8bt7vgX($!0@V0A}XIK)w!AzUn7vH=pZEp0RU0p?}ch2XC-7r#LK&vyc2=-#Q2 z^L%8)JbbcZ%g0Du;|8=q8B>X=mIQirpE=&Ox{TiuNDnOPd-FLI^KfEF729!!0x#Es z@>3ursjFSpu%C-8WL^Zw!7a0O-#cnf`HjI+AjVCFitK}GXO`ME&on|^=~Zc}^LBp9 zj=-vlN;Uc;IDjtK38l7}5xxQF&sRtfn4^TNtnzXv4M{r&ek*(eNbIu!u$>Ed%` z5x7+&)2P&4>0J`N&ZP8$vcR+@FS0126s6+Jx_{{`3ZrIMwaJo6jdrRwE$>IU_JTZ} z(||hyyQ)4Z1@wSlT94(-QKqkAatMmkT7pCycEB1U8KQbFX&?%|4$yyxCtm3=W`$4fiG0WU3yI@c zx{wfmkZAYE_5M%4{J-ygbpH|(|GD$2f$3o_Vti#&zfSGZMQ5_f3xt6~+{RX=$H8at z?GFG1Tmp}}lmm-R->ve*Iv+XJ@58p|1_jRvfEgz$XozU8#iJS})UM6VNI!3RUU!{5 zXB(+Eqd-E;cHQ>)`h0(HO_zLmzR3Tu-UGp;08YntWwMY-9i^w_u#wR?JxR2bky5j9 z3Sl-dQQU$xrO0xa&>vsiK`QN<$Yd%YXXM7*WOhnRdSFt5$aJux8QceC?lA0_if|s> ze{ad*opH_kb%M&~(~&UcX0nFGq^MqjxW?HJIP462v9XG>j(5Gat_)#SiNfahq2Mz2 zU`4uV8m$S~o9(W>mu*=h%Gs(Wz+%>h;R9Sg)jZ$q8vT1HxX3iQnh6&2rJ1u|j>^Qf`A76K%_ubL`Zu?h4`b=IyL>1!=*%!_K)=XC z6d}4R5L+sI50Q4P3upXQ3Z!~1ZXLlh!^UNcK6#QpYt-YC=^H=EPg3)z*wXo*024Q4b2sBCG4I# zlTFFY=kQ>xvR+LsuDUAk)q%5pEcqr(O_|^spjhtpb1#aC& zghXzGkGDC_XDa%t(X`E+kvKQ4zrQ*uuQoj>7@@ykWvF332)RO?%AA&Fsn&MNzmFa$ zWk&&^=NNjxLjrli_8ESU)}U|N{%j&TQmvY~lk!~Jh}*=^INA~&QB9em!in_X%Rl1&Kd~Z(u z9mra#<@vZQlOY+JYUwCrgoea4C8^(xv4ceCXcejq84TQ#sF~IU2V}LKc~Xlr_P=ry zl&Hh0exdCbVd^NPCqNNlxM3vA13EI8XvZ1H9#bT7y*U8Y{H8nwGpOR!e!!}*g;mJ#}T{ekSb}5zIPmye*If(}}_=PcuAW#yidAa^9-`<8Gr0 z)Fz=NiZ{)HAvw{Pl5uu)?)&i&Us$Cx4gE}cIJ}B4Xz~-q7)R_%owbP!z_V2=Aq%Rj z{V;7#kV1dNT9-6R+H}}(ED*_!F=~uz>&nR3gb^Ce%+0s#u|vWl<~JD3MvS0T9thdF zioIG3c#Sdsv;LdtRv3ml7%o$6LTVL>(H`^@TNg`2KPIk*8-IB}X!MT0`hN9Ddf7yN z?J=GxPL!uJ7lqwowsl?iRrh@#5C$%E&h~Z>XQcvFC*5%0RN-Opq|=IwX(dq(*sjs+ zqy99+v~m|6T#zR*e1AVxZ8djd5>eIeCi(b8sUk)OGjAsKSOg^-ugwl2WSL@d#?mdl zib0v*{u-?cq}dDGyZ%$XRY=UkQwt2oGu`zQneZh$=^! zj;!pCBWQNtvAcwcWIBM2y9!*W|8LmQy$H~5BEx)78J`4Z0(FJO2P^!YyQU{*Al+fs z){!4JvT1iLrJ8aU3k0t|P}{RN)_^v%$$r;+p0DY7N8CXzmS*HB*=?qaaF9D@#_$SN zSz{moAK<*RH->%r7xX~9gVW$l7?b|_SYI)gcjf0VAUJ%FcQP(TpBs; zg$25D!Ry_`8xpS_OJdeo$qh#7U+cepZ??TII7_%AXsT$B z=e)Bx#v%J0j``00Zk5hsvv6%T^*xGNx%KN-=pocSoqE5_R)OK%-Pbu^1MNzfds)mL zxz^F4lDKV9D&lEY;I+A)ui{TznB*CE$=9(wgE{m}`^<--OzV-5V4X2w9j(_!+jpTr zJvD*y6;39&T+==$F&tsRKM_lqa1HC}aGL0o`%c9mO=fts?36@8MGm7Vi{Y z^<7m$(EtdSr#22<(rm_(l_(`j!*Pu~Y>>xc>I9M#DJYDJNHO&4=HM%YLIp?;iR&$m z#_$ZWYLfGLt5FJZhr3jpYb`*%9S!zCG6ivNHYzNHcI%khtgHBliM^Ou}ZVD7ehU9 zS+W@AV=?Ro!=%AJ>Kcy9aU3%VX3|XM_K0A+ZaknKDyIS3S-Hw1C7&BSW5)sqj5Ye_ z4OSW7Yu-;bCyYKHFUk}<*<(@TH?YZPHr~~Iy%9@GR2Yd}J2!N9K&CN7Eq{Ka!jdu; zQNB*Y;i(7)OxZK%IHGt#Rt?z`I|A{q_BmoF!f^G}XVeTbe1Wnzh%1g>j}>DqFf;Rp zz7>xIs12@Ke0gr+4-!pmFP84vCIaTjqFNg{V`5}Rdt~xE^I;Bxp4)|cs8=f)1YwHz zqI`G~s2~qqDV+h02b`PQpUE#^^Aq8l%y2|ByQeXSADg5*qMprEAE3WFg0Q39`O+i1 z!J@iV!`Y~C$wJ!5Z+j5$i<1`+@)tBG$JL=!*uk=2k;T<@{|s1$YL079FvK%mPhyHV zP8^KGZnp`(hVMZ;s=n~3r2y;LTwcJwoBW-(ndU-$03{RD zh+Qn$ja_Z^OuMf3Ub|JTY74s&Am*(n{J3~@#OJNYuEVVJd9*H%)oFoRBkySGm`hx! zT3tG|+aAkXcx-2Apy)h^BkOyFTWQVeZ%e2@;*0DtlG9I3Et=PKaPt&K zw?WI7S;P)TWED7aSH$3hL@Qde?H#tzo^<(o_sv_2ci<7M?F$|oCFWc?7@KBj-;N$P zB;q!8@bW-WJY9do&y|6~mEruZAVe$!?{)N9rZZxD-|oltkhW9~nR8bLBGXw<632!l z*TYQn^NnUy%Ds}$f^=yQ+BM-a5X4^GHF=%PDrRfm_uqC zh{sKwIu|O0&jWb27;wzg4w5uA@TO_j(1X?8E>5Zfma|Ly7Bklq|s z9)H`zoAGY3n-+&JPrT!>u^qg9Evx4y@GI4$n-Uk_5wttU1_t?6><>}cZ-U+&+~JE) zPlDbO_j;MoxdLzMd~Ew|1o^a5q_1R*JZ=#XXMzg?6Zy!^hop}qoLQlJ{(%!KYt`MK z8umEN@Z4w!2=q_oe=;QttPCQy3Nm4F@x>@v4sz_jo{4m*0r%J(w1cSo;D_hQtJs7W z><$QrmG^+<$4{d2bgGo&3-FV}avg9zI|Rr(k{wTyl3!M1q+a zD9W{pCd%il*j&Ft z5H$nENf>>k$;SONGW`qo6`&qKs*T z2^RS)pXk9b@(_Fw1bkb)-oqK|v}r$L!W&aXA>IpcdNZ_vWE#XO8X`#Yp1+?RshVcd zknG%rPd*4ECEI0wD#@d+3NbHKxl}n^Sgkx==Iu%}HvNliOqVBqG?P2va zQ;kRJ$J6j;+wP9cS za#m;#GUT!qAV%+rdWolk+)6kkz4@Yh5LXP+LSvo9_T+MmiaP-eq6_k;)i6_@WSJ zlT@wK$zqHu<83U2V*yJ|XJU4farT#pAA&@qu)(PO^8PxEmPD4;Txpio+2)#!9 z>&=i7*#tc0`?!==vk>s7V+PL#S1;PwSY?NIXN2=Gu89x(cToFm))7L;< z+bhAbVD*bD=}iU`+PU+SBobTQ%S!=VL!>q$rfWsaaV}Smz>lO9JXT#`CcH_mRCSf4%YQAw`$^yY z3Y*^Nzk_g$xn7a_NO(2Eb*I=^;4f!Ra#Oo~LLjlcjke*k*o$~U#0ZXOQ5@HQ&T46l z7504MUgZkz2gNP1QFN8Y?nSEnEai^Rgyvl}xZfMUV6QrJcXp;jKGqB=D*tj{8(_pV zqyB*DK$2lgYGejmJUW)*s_Cv65sFf&pb(Yz8oWgDtQ0~k^0-wdF|tj}MOXaN@ydF8 zNr={U?=;&Z?wr^VC+`)S2xl}QFagy;$mG=TUs7Vi2wws5zEke4hTa2)>O0U?$WYsZ z<8bN2bB_N4AWd%+kncgknZ&}bM~eDtj#C5uRkp21hWW5gxWvc6b*4+dn<{c?w9Rmf zIVZKsPl{W2vQAlYO3yh}-{Os=YBnL8?uN5(RqfQ=-1cOiUnJu>KcLA*tQK3FU`_bM zM^T28w;nAj5EdAXFi&Kk1Nnl2)D!M{@+D-}bIEe+Lc4{s;YJc-{F#``iS2uk;2!Zp zF9#myUmO!wCeJIoi^A+T^e~20c+c2C}XltaR!|U-HfDA=^xF97ev}$l6#oY z&-&T{egB)&aV$3_aVA51XGiU07$s9vubh_kQG?F$FycvS6|IO!6q zq^>9|3U^*!X_C~SxX&pqUkUjz%!j=VlXDo$!2VLH!rKj@61mDpSr~7B2yy{>X~_nc zRI+7g2V&k zd**H++P9dg!-AOs3;GM`(g<+GRV$+&DdMVpUxY9I1@uK28$az=6oaa+PutlO9?6#? zf-OsgT>^@8KK>ggkUQRPPgC7zjKFR5spqQb3ojCHzj^(UH~v+!y*`Smv)VpVoPwa6 zWG18WJaPKMi*F6Zdk*kU^`i~NNTfn3BkJniC`yN98L-Awd)Z&mY? zprBW$!qL-OL7h@O#kvYnLsfff@kDIegt~?{-*5A7JrA;#TmTe?jICJqhub-G@e??D zqiV#g{)M!kW1-4SDel7TO{;@*h2=_76g3NUD@|c*WO#>MfYq6_YVUP+&8e4|%4T`w zXzhmVNziAHazWO2qXcaOu@R1MrPP{t)`N)}-1&~mq=ZH=w=;-E$IOk=y$dOls{6sRR`I5>|X zpq~XYW4sd;J^6OwOf**J>a7u$S>WTFPRkjY;BfVgQst)u4aMLR1|6%)CB^18XCz+r ztkYQ}G43j~Q&1em(_EkMv0|WEiKu;z2zhb(L%$F&xWwzOmk;VLBYAZ8lOCziNoPw1 zv2BOyXA`A8z^WH!nXhKXM`t0;6D*-uGds3TYGrm8SPnJJOQ^fJU#}@aIy@MYWz**H zvkp?7I5PE{$$|~{-ZaFxr6ZolP^nL##mHOErB^AqJqn^hFA=)HWj!m3WDaHW$C)i^ z9@6G$SzB=>jbe>4kqr#sF7#K}W*Cg-5y6kun3u&0L7BpXF9=#7IN8FOjWrWwUBZiU zT_se3ih-GBKx+Uw0N|CwP3D@-C=5(9T#BH@M`F2!Goiqx+Js5xC92|Sy0%WWWp={$(am!#l~f^W_oz78HX<0X#7 zp)p1u~M*o9W@O8P{0Qkg@Wa# z2{Heb&oX^CQSZWSFBXKOfE|tsAm#^U-WkDnU;IowZ`Ok4!mwHwH=s|AqZ^YD4!5!@ zPxJj+Bd-q6w_YG`z_+r;S86zwXb+EO&qogOq8h-Ect5(M2+>(O7n7)^dP*ws_3U6v zVsh)sk^@*c>)3EML|0<-YROho{lz@Nd4;R9gL{9|64xVL`n!m$-Jjrx?-Bacp!=^5 z1^T^eB{_)Y<9)y{-4Rz@9_>;_7h;5D+@QcbF4Wv7hu)s0&==&6u)33 zHRj+&Woq-vDvjwJCYES@$C4{$?f$Ibi4G()UeN11rgjF+^;YE^5nYprYoJNoudNj= zm1pXSeG64dcWHObUetodRn1Fw|1nI$D9z}dVEYT0lQnsf_E1x2vBLql7NrHH!n&Sq z6lc*mvU=WS6=v9Lrl}&zRiu_6u;6g%_DU{9b+R z#YHqX7`m9eydf?KlKu6Sb%j$%_jmydig`B*TN`cZL-g!R)iE?+Q5oOqBFKhx z%MW>BC^(F_JuG(ayE(MT{S3eI{cKiwOtPwLc0XO*{*|(JOx;uQOfq@lp_^cZo=FZj z4#}@e@dJ>Bn%2`2_WPeSN7si^{U#H=7N4o%Dq3NdGybrZgEU$oSm$hC)uNDC_M9xc zGzwh5Sg?mpBIE8lT2XsqTt3j3?We8}3bzLBTQd639vyg^$0#1epq8snlDJP2(BF)K zSx30RM+{f+b$g{9usIL8H!hCO117Xgv}ttPJm9wVRjPk;ePH@zxv%j9k5`TzdXLeT zFgFX`V7cYIcBls5WN0Pf6SMBN+;CrQ(|EsFd*xtwr#$R{Z9FP`OWtyNsq#mCgZ7+P z^Yn$haBJ)r96{ZJd8vlMl?IBxrgh=fdq_NF!1{jARCVz>jNdC)H^wfy?R94#MPdUjcYX>#wEx+LB#P-#4S-%YH>t-j+w zOFTI8gX$ard6fAh&g=u&56%3^-6E2tpk*wx3HSCQ+t7+*iOs zPk5ysqE}i*cQocFvA68xHfL|iX(C4h*67@3|5Qwle(8wT&!&{8*{f%0(5gH+m>$tq zp;AqrP7?XTEooYG1Dzfxc>W%*CyL16q|fQ0_jp%%Bk^k!i#Nbi(N9&T>#M{gez_Ws zYK=l}adalV(nH}I_!hNeb;tQFk3BHX7N}}R8%pek^E`X}%ou=cx8InPU1EE0|Hen- zyw8MoJqB5=)Z%JXlrdTXAE)eqLAdVE-=>wGHrkRet}>3Yu^lt$Kzu%$3#(ioY}@Gu zjk3BZuQH&~7H+C*uX^4}F*|P89JX;Hg2U!pt>rDi(n(Qe-c}tzb0#6_ItoR0->LSt zR~UT<-|@TO%O`M+_e_J4wx7^)5_%%u+J=yF_S#2Xd?C;Ss3N7KY^#-vx+|;bJX&8r zD?|MetfhdC;^2WG`7MCgs>TKKN=^=!x&Q~BzmQio_^l~LboTNT=I zC5pme^P@ER``p$2md9>4!K#vV-Fc1an7pl>_|&>aqP}+zqR?+~Z;f2^`a+-!Te%V? z;H2SbF>jP^GE(R1@%C==XQ@J=G9lKX+Z<@5}PO(EYkJh=GCv#)Nj{DkWJM2}F&oAZ6xu8&g7pn1ps2U5srwQ7CAK zN&*~@t{`31lUf`O;2w^)M3B@o)_mbRu{-`PrfNpF!R^q>yTR&ETS7^-b2*{-tZAZz zw@q5x9B5V8Qd7dZ!Ai$9hk%Q!wqbE1F1c96&zwBBaRW}(^axoPpN^4Aw}&a5dMe+*Gomky_l^54*rzXro$ z>LL)U5Ry>~FJi=*{JDc)_**c)-&faPz`6v`YU3HQa}pLtb5K)u%K+BOqXP0)rj5Au$zB zW1?vr?mDv7Fsxtsr+S6ucp2l#(4dnr9sD*v+@*>g#M4b|U?~s93>Pg{{a5|rm2xfI z`>E}?9S@|IoUX{Q1zjm5YJT|3S>&09D}|2~BiMo=z4YEjXlWh)V&qs;*C{`UMxp$9 zX)QB?G$fPD6z5_pNs>Jeh{^&U^)Wbr?2D6-q?)`*1k@!UvwQgl8eG$r+)NnFoT)L6 zg7lEh+E6J17krfYJCSjWzm67hEth24pomhz71|Qodn#oAILN)*Vwu2qpJirG)4Wnv}9GWOFrQg%Je+gNrPl8mw7ykE8{ z=|B4+uwC&bpp%eFcRU6{mxRV32VeH8XxX>v$du<$(DfinaaWxP<+Y97Z#n#U~V zVEu-GoPD=9$}P;xv+S~Ob#mmi$JQmE;Iz4(){y*9pFyW-jjgdk#oG$fl4o9E8bo|L zWjo4l%n51@Kz-n%zeSCD`uB?T%FVk+KBI}=ve zvlcS#wt`U6wrJo}6I6Rwb=1GzZfwE=I&Ne@p7*pH84XShXYJRgvK)UjQL%R9Zbm(m zxzTQsLTON$WO7vM)*vl%Pc0JH7WhP;$z@j=y#avW4X8iqy6mEYr@-}PW?H)xfP6fQ z&tI$F{NNct4rRMSHhaelo<5kTYq+(?pY)Ieh8*sa83EQfMrFupMM@nfEV@EmdHUv9 z35uzIrIuo4#WnF^_jcpC@uNNaYTQ~uZWOE6P@LFT^1@$o&q+9Qr8YR+ObBkpP9=F+$s5+B!mX2~T zAuQ6RenX?O{IlLMl1%)OK{S7oL}X%;!XUxU~xJN8xk z`xywS*naF(J#?vOpB(K=o~lE;m$zhgPWDB@=p#dQIW>xe_p1OLoWInJRKbEuoncf; zmS1!u-ycc1qWnDg5Nk2D)BY%jmOwCLC+Ny>`f&UxFowIsHnOXfR^S;&F(KXd{ODlm z$6#1ccqt-HIH9)|@fHnrKudu!6B$_R{fbCIkSIb#aUN|3RM>zuO>dpMbROZ`^hvS@ z$FU-;e4W}!ubzKrU@R*dW*($tFZ>}dd*4_mv)#O>X{U@zSzQt*83l9mI zI$8O<5AIDx`wo0}f2fsPC_l>ONx_`E7kdXu{YIZbp1$(^oBAH({T~&oQ&1{X951QW zmhHUxd)t%GQ9#ak5fTjk-cahWC;>^Rg7(`TVlvy0W@Y!Jc%QL3Ozu# zDPIqBCy&T2PWBj+d-JA-pxZlM=9ja2ce|3B(^VCF+a*MMp`(rH>Rt6W1$;r{n1(VK zLs>UtkT43LR2G$AOYHVailiqk7naz2yZGLo*xQs!T9VN5Q>eE(w zw$4&)&6xIV$IO^>1N-jrEUg>O8G4^@y+-hQv6@OmF@gy^nL_n1P1-Rtyy$Bl;|VcV zF=p*&41-qI5gG9UhKmmnjs932!6hceXa#-qfK;3d*a{)BrwNFeKU|ge?N!;zk+kB! zMD_uHJR#%b54c2tr~uGPLTRLg$`fupo}cRJeTwK;~}A>(Acy4k-Xk&Aa1&eWYS1ULWUj@fhBiWY$pdfy+F z@G{OG{*v*mYtH3OdUjwEr6%_ZPZ3P{@rfbNPQG!BZ7lRyC^xlMpWH`@YRar`tr}d> z#wz87t?#2FsH-jM6m{U=gp6WPrZ%*w0bFm(T#7m#v^;f%Z!kCeB5oiF`W33W5Srdt zdU?YeOdPG@98H7NpI{(uN{FJdu14r(URPH^F6tOpXuhU7T9a{3G3_#Ldfx_nT(Hec zo<1dyhsVsTw;ZkVcJ_0-h-T3G1W@q)_Q30LNv)W?FbMH+XJ* zy=$@39Op|kZv`Rt>X`zg&at(?PO^I=X8d9&myFEx#S`dYTg1W+iE?vt#b47QwoHI9 zNP+|3WjtXo{u}VG(lLUaW0&@yD|O?4TS4dfJI`HC-^q;M(b3r2;7|FONXphw-%7~* z&;2!X17|05+kZOpQ3~3!Nb>O94b&ZSs%p)TK)n3m=4eiblVtSx@KNFgBY_xV6ts;NF;GcGxMP8OKV^h6LmSb2E#Qnw ze!6Mnz7>lE9u{AgQ~8u2zM8CYD5US8dMDX-5iMlgpE9m*s+Lh~A#P1er*rF}GHV3h z=`STo?kIXw8I<`W0^*@mB1$}pj60R{aJ7>C2m=oghKyxMbFNq#EVLgP0cH3q7H z%0?L93-z6|+jiN|@v>ix?tRBU(v-4RV`}cQH*fp|)vd3)8i9hJ3hkuh^8dz{F5-~_ zUUr1T3cP%cCaTooM8dj|4*M=e6flH0&8ve32Q)0dyisl))XkZ7Wg~N}6y`+Qi2l+e zUd#F!nJp{#KIjbQdI`%oZ`?h=5G^kZ_uN`<(`3;a!~EMsWV|j-o>c?x#;zR2ktiB! z);5rrHl?GPtr6-o!tYd|uK;Vbsp4P{v_4??=^a>>U4_aUXPWQ$FPLE4PK$T^3Gkf$ zHo&9$U&G`d(Os6xt1r?sg14n)G8HNyWa^q8#nf0lbr4A-Fi;q6t-`pAx1T*$eKM*$ z|CX|gDrk#&1}>5H+`EjV$9Bm)Njw&7-ZR{1!CJTaXuP!$Pcg69`{w5BRHysB$(tWUes@@6aM69kb|Lx$%BRY^-o6bjH#0!7b;5~{6J+jKxU!Kmi# zndh@+?}WKSRY2gZ?Q`{(Uj|kb1%VWmRryOH0T)f3cKtG4oIF=F7RaRnH0Rc_&372={_3lRNsr95%ZO{IX{p@YJ^EI%+gvvKes5cY+PE@unghjdY5#9A!G z70u6}?zmd?v+{`vCu-53_v5@z)X{oPC@P)iA3jK$`r zSA2a7&!^zmUiZ82R2=1cumBQwOJUPz5Ay`RLfY(EiwKkrx%@YN^^XuET;tE zmr-6~I7j!R!KrHu5CWGSChO6deaLWa*9LLJbcAJsFd%Dy>a!>J`N)Z&oiU4OEP-!Ti^_!p}O?7`}i7Lsf$-gBkuY*`Zb z7=!nTT;5z$_5$=J=Ko+Cp|Q0J=%oFr>hBgnL3!tvFoLNhf#D0O=X^h+x08iB;@8pXdRHxX}6R4k@i6%vmsQwu^5z zk1ip`#^N)^#Lg#HOW3sPI33xqFB4#bOPVnY%d6prwxf;Y-w9{ky4{O6&94Ra8VN@K zb-lY;&`HtxW@sF!doT5T$2&lIvJpbKGMuDAFM#!QPXW87>}=Q4J3JeXlwHys?!1^#37q_k?N@+u&Ns20pEoBeZC*np;i;M{2C0Z4_br2gsh6eL z#8`#sn41+$iD?^GL%5?cbRcaa-Nx0vE(D=*WY%rXy3B%gNz0l?#noGJGP728RMY#q z=2&aJf@DcR?QbMmN)ItUe+VM_U!ryqA@1VVt$^*xYt~-qvW!J4Tp<-3>jT=7Zow5M z8mSKp0v4b%a8bxFr>3MwZHSWD73D@+$5?nZAqGM#>H@`)mIeC#->B)P8T$zh-Pxnc z8)~Zx?TWF4(YfKuF3WN_ckpCe5;x4V4AA3(i$pm|78{%!q?|~*eH0f=?j6i)n~Hso zmTo>vqEtB)`%hP55INf7HM@taH)v`Fw40Ayc*R!T?O{ziUpYmP)AH`euTK!zg9*6Z z!>M=$3pd0!&TzU=hc_@@^Yd3eUQpX4-33}b{?~5t5lgW=ldJ@dUAH%`l5US1y_`40 zs(X`Qk}vvMDYYq+@Rm+~IyCX;iD~pMgq^KY)T*aBz@DYEB={PxA>)mI6tM*sx-DmGQHEaHwRrAmNjO!ZLHO4b;;5mf@zzlPhkP($JeZGE7 z?^XN}Gf_feGoG~BjUgVa*)O`>lX=$BSR2)uD<9 z>o^|nb1^oVDhQbfW>>!;8-7<}nL6L^V*4pB=>wwW+RXAeRvKED(n1;R`A6v$6gy0I(;Vf?!4;&sgn7F%LpM}6PQ?0%2Z@b{It<(G1CZ|>913E0nR2r^Pa*Bp z@tFGi*CQ~@Yc-?{cwu1 zsilf=k^+Qs>&WZG(3WDixisHpR>`+ihiRwkL(3T|=xsoNP*@XX3BU8hr57l3k;pni zI``=3Nl4xh4oDj<%>Q1zYXHr%Xg_xrK3Nq?vKX3|^Hb(Bj+lONTz>4yhU-UdXt2>j z<>S4NB&!iE+ao{0Tx^N*^|EZU;0kJkx@zh}S^P{ieQjGl468CbC`SWnwLRYYiStXm zOxt~Rb3D{dz=nHMcY)#r^kF8|q8KZHVb9FCX2m^X*(|L9FZg!5a7((!J8%MjT$#Fs)M1Pb zq6hBGp%O1A+&%2>l0mpaIzbo&jc^!oN^3zxap3V2dNj3x<=TwZ&0eKX5PIso9j1;e zwUg+C&}FJ`k(M|%%}p=6RPUq4sT3-Y;k-<68ciZ~_j|bt>&9ZLHNVrp#+pk}XvM{8 z`?k}o-!if>hVlCP9j%&WI2V`5SW)BCeR5>MQhF)po=p~AYN%cNa_BbV6EEh_kk^@a zD>4&>uCGCUmyA-c)%DIcF4R6!>?6T~Mj_m{Hpq`*(wj>foHL;;%;?(((YOxGt)Bhx zuS+K{{CUsaC++%}S6~CJ=|vr(iIs-je)e9uJEU8ZJAz)w166q)R^2XI?@E2vUQ!R% zn@dxS!JcOimXkWJBz8Y?2JKQr>`~SmE2F2SL38$SyR1^yqj8_mkBp)o$@+3BQ~Mid z9U$XVqxX3P=XCKj0*W>}L0~Em`(vG<>srF8+*kPrw z20{z(=^w+ybdGe~Oo_i|hYJ@kZl*(9sHw#Chi&OIc?w`nBODp?ia$uF%Hs(X>xm?j zqZQ`Ybf@g#wli`!-al~3GWiE$K+LCe=Ndi!#CVjzUZ z!sD2O*;d28zkl))m)YN7HDi^z5IuNo3^w(zy8 zszJG#mp#Cj)Q@E@r-=NP2FVxxEAeOI2e=|KshybNB6HgE^(r>HD{*}S}mO>LuRGJT{*tfTzw_#+er-0${}%YPe@CMJ1Ng#j#)i)SnY@ss3gL;g zg2D~#Kpdfu#G;q1qz_TwSz1VJT(b3zby$Vk&;Y#1(A)|xj`_?i5YQ;TR%jice5E;0 zYHg;`zS5{S*9xI6o^j>rE8Ua*XhIw{_-*&@(R|C(am8__>+Ws&Q^ymy*X4~hR2b5r zm^p3sw}yv=tdyncy_Ui7{BQS732et~Z_@{-IhHDXAV`(Wlay<#hb>%H%WDi+K$862nA@BDtM#UCKMu+kM`!JHyWSi?&)A7_ z3{cyNG%a~nnH_!+;g&JxEMAmh-Z}rC!o7>OVzW&PoMyTA_g{hqXG)SLraA^OP**<7 zjWbr7z!o2n3hnx7A=2O=WL;`@9N{vQIM@&|G-ljrPvIuJHYtss0Er0fT5cMXNUf1B z7FAwBDixt0X7C3S)mPe5g`YtME23wAnbU)+AtV}z+e8G;0BP=bI;?(#|Ep!vVfDbK zvx+|CKF>yt0hWQ3drchU#XBU+HiuG*V^snFAPUp-5<#R&BUAzoB!aZ+e*KIxa26V}s6?nBK(U-7REa573wg-jqCg>H8~>O{ z*C0JL-?X-k_y%hpUFL?I>0WV{oV`Nb)nZbJG01R~AG>flIJf)3O*oB2i8~;!P?Wo_ z0|QEB*fifiL6E6%>tlAYHm2cjTFE@*<);#>689Z6S#BySQ@VTMhf9vYQyLeDg1*F} zjq>i1*x>5|CGKN{l9br3kB0EHY|k4{%^t7-uhjd#NVipUZa=EUuE5kS1_~qYX?>hJ z$}!jc9$O$>J&wnu0SgfYods^z?J4X;X7c77Me0kS-dO_VUQ39T(Kv(Y#s}Qqz-0AH z^?WRL(4RzpkD+T5FG_0NyPq-a-B7A5LHOCqwObRJi&oRi(<;OuIN7SV5PeHU$<@Zh zPozEV`dYmu0Z&Tqd>t>8JVde9#Pt+l95iHe$4Xwfy1AhI zDM4XJ;bBTTvRFtW>E+GzkN)9k!hA5z;xUOL2 zq4}zn-DP{qc^i|Y%rvi|^5k-*8;JZ~9a;>-+q_EOX+p1Wz;>i7c}M6Nv`^NY&{J-> z`(mzDJDM}QPu5i44**2Qbo(XzZ-ZDu%6vm8w@DUarqXj41VqP~ zs&4Y8F^Waik3y1fQo`bVUH;b=!^QrWb)3Gl=QVKr+6sxc=ygauUG|cm?|X=;Q)kQ8 zM(xrICifa2p``I7>g2R~?a{hmw@{!NS5`VhH8+;cV(F>B94M*S;5#O`YzZH1Z%yD? zZ61w(M`#aS-*~Fj;x|J!KM|^o;MI#Xkh0ULJcA?o4u~f%Z^16ViA27FxU5GM*rKq( z7cS~MrZ=f>_OWx8j#-Q3%!aEU2hVuTu(7`TQk-Bi6*!<}0WQi;_FpO;fhpL4`DcWp zGOw9vx0N~6#}lz(r+dxIGZM3ah-8qrqMmeRh%{z@dbUD2w15*_4P?I~UZr^anP}DB zU9CCrNiy9I3~d#&!$DX9e?A});BjBtQ7oGAyoI$8YQrkLBIH@2;lt4E^)|d6Jwj}z z&2_E}Y;H#6I4<10d_&P0{4|EUacwFHauvrjAnAm6yeR#}f}Rk27CN)vhgRqEyPMMS7zvunj2?`f;%?alsJ+-K+IzjJx>h8 zu~m_y$!J5RWAh|C<6+uiCNsOKu)E72M3xKK(a9Okw3e_*O&}7llNV!=P87VM2DkAk zci!YXS2&=P0}Hx|wwSc9JP%m8dMJA*q&VFB0yMI@5vWoAGraygwn){R+Cj6B1a2Px z5)u(K5{+;z2n*_XD!+Auv#LJEM)(~Hx{$Yb^ldQmcYF2zNH1V30*)CN_|1$v2|`LnFUT$%-tO0Eg|c5$BB~yDfzS zcOXJ$wpzVK0MfTjBJ0b$r#_OvAJ3WRt+YOLlJPYMx~qp>^$$$h#bc|`g0pF-Ao43? z>*A+8lx>}L{p(Tni2Vvk)dtzg$hUKjSjXRagj)$h#8=KV>5s)J4vGtRn5kP|AXIz! zPgbbVxW{2o4s-UM;c#We8P&mPN|DW7_uLF!a|^0S=wr6Esx9Z$2|c1?GaupU6$tb| zY_KU`(_29O_%k(;>^|6*pZURH3`@%EuKS;Ns z1lujmf;r{qAN&Q0&m{wJSZ8MeE7RM5+Sq;ul_ z`+ADrd_Um+G37js6tKsArNB}n{p*zTUxQr>3@wA;{EUbjNjlNd6$Mx zg0|MyU)v`sa~tEY5$en7^PkC=S<2@!nEdG6L=h(vT__0F=S8Y&eM=hal#7eM(o^Lu z2?^;05&|CNliYrq6gUv;|i!(W{0N)LWd*@{2q*u)}u*> z7MQgk6t9OqqXMln?zoMAJcc zMKaof_Up})q#DzdF?w^%tTI7STI^@8=Wk#enR*)&%8yje>+tKvUYbW8UAPg55xb70 zEn5&Ba~NmOJlgI#iS8W3-@N%>V!#z-ZRwfPO1)dQdQkaHsiqG|~we2ALqG7Ruup(DqSOft2RFg_X%3w?6VqvV1uzX_@F(diNVp z4{I|}35=11u$;?|JFBEE*gb;T`dy+8gWJ9~pNsecrO`t#V9jW-6mnfO@ff9od}b(3s4>p0i30gbGIv~1@a^F2kl7YO;DxmF3? zWi-RoXhzRJV0&XE@ACc?+@6?)LQ2XNm4KfalMtsc%4!Fn0rl zpHTrHwR>t>7W?t!Yc{*-^xN%9P0cs0kr=`?bQ5T*oOo&VRRu+1chM!qj%2I!@+1XF z4GWJ=7ix9;Wa@xoZ0RP`NCWw0*8247Y4jIZ>GEW7zuoCFXl6xIvz$ezsWgKdVMBH> z{o!A7f;R-@eK9Vj7R40xx)T<2$?F2E<>Jy3F;;=Yt}WE59J!1WN367 zA^6pu_zLoZIf*x031CcwotS{L8bJE(<_F%j_KJ2P_IusaZXwN$&^t716W{M6X2r_~ zaiMwdISX7Y&Qi&Uh0upS3TyEIXNDICQlT5fHXC`aji-c{U(J@qh-mWl-uMN|T&435 z5)a1dvB|oe%b2mefc=Vpm0C%IUYYh7HI*;3UdgNIz}R##(#{(_>82|zB0L*1i4B5j-xi9O4x10rs_J6*gdRBX=@VJ+==sWb&_Qc6tSOowM{BX@(zawtjl zdU!F4OYw2@Tk1L^%~JCwb|e#3CC>srRHQ*(N%!7$Mu_sKh@|*XtR>)BmWw!;8-mq7 zBBnbjwx8Kyv|hd*`5}84flTHR1Y@@uqjG`UG+jN_YK&RYTt7DVwfEDXDW4U+iO{>K zw1hr{_XE*S*K9TzzUlJH2rh^hUm2v7_XjwTuYap|>zeEDY$HOq3X4Tz^X}E9z)x4F zs+T?Ed+Hj<#jY-`Va~fT2C$=qFT-5q$@p9~0{G&eeL~tiIAHXA!f6C(rAlS^)&k<- zXU|ZVs}XQ>s5iONo~t!XXZgtaP$Iau;JT%h)>}v54yut~pykaNye4axEK#5@?TSsQ zE;Jvf9I$GVb|S`7$pG)4vgo9NXsKr?u=F!GnA%VS2z$@Z(!MR9?EPcAqi5ft)Iz6sNl`%kj+_H-X`R<>BFrBW=fSlD|{`D%@Rcbu2?%>t7i34k?Ujb)2@J-`j#4 zLK<69qcUuniIan-$A1+fR=?@+thwDIXtF1Tks@Br-xY zfB+zblrR(ke`U;6U~-;p1Kg8Lh6v~LjW@9l2P6s+?$2!ZRPX`(ZkRGe7~q(4&gEi<$ch`5kQ?*1=GSqkeV z{SA1EaW_A!t{@^UY2D^YO0(H@+kFVzZaAh0_`A`f(}G~EP~?B|%gtxu&g%^x{EYSz zk+T;_c@d;+n@$<>V%P=nk36?L!}?*=vK4>nJSm+1%a}9UlmTJTrfX4{Lb7smNQn@T zw9p2%(Zjl^bWGo1;DuMHN(djsEm)P8mEC2sL@KyPjwD@d%QnZ$ zMJ3cnn!_!iP{MzWk%PI&D?m?C(y2d|2VChluN^yHya(b`h>~GkI1y;}O_E57zOs!{ zt2C@M$^PR2U#(dZmA-sNreB@z-yb0Bf7j*yONhZG=onhx>t4)RB`r6&TP$n zgmN*)eCqvgriBO-abHQ8ECN0bw?z5Bxpx z=jF@?zFdVn?@gD5egM4o$m`}lV(CWrOKKq(sv*`mNcHcvw&Xryfw<{ch{O&qc#WCTXX6=#{MV@q#iHYba!OUY+MGeNTjP%Fj!WgM&`&RlI^=AWTOqy-o zHo9YFt!gQ*p7{Fl86>#-JLZo(b^O`LdFK~OsZBRR@6P?ad^Ujbqm_j^XycM4ZHFyg ziUbIFW#2tj`65~#2V!4z7DM8Z;fG0|APaQ{a2VNYpNotB7eZ5kp+tPDz&Lqs0j%Y4tA*URpcfi z_M(FD=fRGdqf430j}1z`O0I=;tLu81bwJXdYiN7_&a-?ly|-j*+=--XGvCq#32Gh(=|qj5F?kmihk{%M&$}udW5)DHK zF_>}5R8&&API}o0osZJRL3n~>76nUZ&L&iy^s>PMnNcYZ|9*1$v-bzbT3rpWsJ+y{ zPrg>5Zlery96Um?lc6L|)}&{992{_$J&=4%nRp9BAC6!IB=A&=tF>r8S*O-=!G(_( zwXbX_rGZgeiK*&n5E;f=k{ktyA1(;x_kiMEt0*gpp_4&(twlS2e5C?NoD{n>X2AT# zY@Zp?#!b1zNq96MQqeO*M1MMBin5v#RH52&Xd~DO6-BZLnA6xO1$sou(YJ1Dlc{WF zVa%2DyYm`V#81jP@70IJ;DX@y*iUt$MLm)ByAD$eUuji|5{ptFYq(q)mE(5bOpxjM z^Q`AHWq44SG3`_LxC9fwR)XRVIp=B%<(-lOC3jI#bb@dK(*vjom!=t|#<@dZql%>O z15y^{4tQoeW9Lu%G&V$90x6F)xN6y_oIn;!Q zs)8jT$;&;u%Y>=T3hg34A-+Y*na=|glcStr5D;&5*t5*DmD~x;zQAV5{}Ya`?RRGa zT*t9@$a~!co;pD^!J5bo?lDOWFx%)Y=-fJ+PDGc0>;=q=s?P4aHForSB+)v0WY2JH z?*`O;RHum6j%#LG)Vu#ciO#+jRC3!>T(9fr+XE7T2B7Z|0nR5jw@WG)kDDzTJ=o4~ zUpeyt7}_nd`t}j9BKqryOha{34erm)RmST)_9Aw)@ zHbiyg5n&E{_CQR@h<}34d7WM{s{%5wdty1l+KX8*?+-YkNK2Be*6&jc>@{Fd;Ps|| z26LqdI3#9le?;}risDq$K5G3yoqK}C^@-8z^wj%tdgw-6@F#Ju{Sg7+y)L?)U$ez> zoOaP$UFZ?y5BiFycir*pnaAaY+|%1%8&|(@VB)zweR%?IidwJyK5J!STzw&2RFx zZV@qeaCB01Hu#U9|1#=Msc8Pgz5P*4Lrp!Q+~(G!OiNR{qa7|r^H?FC6gVhkk3y7=uW#Sh;&>78bZ}aK*C#NH$9rX@M3f{nckYI+5QG?Aj1DM)@~z_ zw!UAD@gedTlePB*%4+55naJ8ak_;))#S;4ji!LOqY5VRI){GMwHR~}6t4g>5C_#U# ztYC!tjKjrKvRy=GAsJVK++~$|+s!w9z3H4G^mACv=EErXNSmH7qN}%PKcN|8%9=i)qS5+$L zu&ya~HW%RMVJi4T^pv?>mw*Gf<)-7gf#Qj|e#w2|v4#t!%Jk{&xlf;$_?jW*n!Pyx zkG$<18kiLOAUPuFfyu-EfWX%4jYnjBYc~~*9JEz6oa)_R|8wjZA|RNrAp%}14L7fW zi7A5Wym*K+V8pkqqO-X#3ft{0qs?KVt^)?kS>AicmeO&q+~J~ zp0YJ_P~_a8j= zsAs~G=8F=M{4GZL{|B__UorX@MRNQLn?*_gym4aW(~+i13knnk1P=khoC-ViMZk+x zLW(l}oAg1H`dU+Fv**;qw|ANDSRs>cGqL!Yw^`; zv;{E&8CNJcc)GHzTYM}f&NPw<6j{C3gaeelU#y!M)w-utYEHOCCJo|Vgp7K6C_$14 zqIrLUB0bsgz^D%V%fbo2f9#yb#CntTX?55Xy|Kps&Xek*4_r=KDZ z+`TQuv|$l}MWLzA5Ay6Cvsa^7xvwXpy?`w(6vx4XJ zWuf1bVSb#U8{xlY4+wlZ$9jjPk)X_;NFMqdgq>m&W=!KtP+6NL57`AMljW+es zzqjUjgz;V*kktJI?!NOg^s_)ph45>4UDA!Vo0hn>KZ+h-3=?Y3*R=#!fOX zP$Y~+14$f66ix?UWB_6r#fMcC^~X4R-<&OD1CSDNuX~y^YwJ>sW0j`T<2+3F9>cLo z#!j57$ll2K9(%$4>eA7(>FJX5e)pR5&EZK!IMQzOfik#FU*o*LGz~7u(8}XzIQRy- z!U7AlMTIe|DgQFmc%cHy_9^{o`eD%ja_L>ckU6$O4*U**o5uR7`FzqkU8k4gxtI=o z^P^oGFPm5jwZMI{;nH}$?p@uV8FT4r=|#GziKXK07bHJLtK}X%I0TON$uj(iJ`SY^ zc$b2CoxCQ>7LH@nxcdW&_C#fMYBtTxcg46dL{vf%EFCZ~eErMvZq&Z%Lhumnkn^4A zsx$ay(FnN7kYah}tZ@0?-0Niroa~13`?hVi6`ndno`G+E8;$<6^gsE-K3)TxyoJ4M zb6pj5=I8^FD5H@`^V#Qb2^0cx7wUz&cruA5g>6>qR5)O^t1(-qqP&1g=qvY#s&{bx zq8Hc%LsbK1*%n|Y=FfojpE;w~)G0-X4i*K3{o|J7`krhIOd*c*$y{WIKz2n2*EXEH zT{oml3Th5k*vkswuFXdGDlcLj15Nec5pFfZ*0?XHaF_lVuiB%Pv&p7z)%38}%$Gup zVTa~C8=cw%6BKn_|4E?bPNW4PT7}jZQLhDJhvf4z;~L)506IE0 zX!tWXX(QOQPRj-p80QG79t8T2^az4Zp2hOHziQlvT!|H)jv{Ixodabzv6lBj)6WRB z{)Kg@$~~(7$-az?lw$4@L%I&DI0Lo)PEJJziWP33a3azb?jyXt1v0N>2kxwA6b%l> zZqRpAo)Npi&loWbjFWtEV)783BbeIAhqyuc+~>i7aQ8shIXt)bjCWT6$~ro^>99G} z2XfmT0(|l!)XJb^E!#3z4oEGIsL(xd; zYX1`1I(cG|u#4R4T&C|m*9KB1`UzKvho5R@1eYtUL9B72{i(ir&ls8g!pD ztR|25xGaF!4z5M+U@@lQf(12?xGy`!|3E}7pI$k`jOIFjiDr{tqf0va&3pOn6Pu)% z@xtG2zjYuJXrV)DUrIF*y<1O1<$#54kZ#2;=X51J^F#0nZ0(;S$OZDt_U2bx{RZ=Q zMMdd$fH|!s{ zXq#l;{`xfV`gp&C>A`WrQU?d{!Ey5(1u*VLJt>i27aZ-^&2IIk=zP5p+{$q(K?2(b z8?9h)kvj9SF!Dr zoyF}?V|9;6abHxWk2cEvGs$-}Pg}D+ZzgkaN&$Snp%;5m%zh1E#?Wac-}x?BYlGN#U#Mek*}kek#I9XaHt?mz3*fDrRTQ#&#~xyeqJk1QJ~E$7qsw6 z?sV;|?*=-{M<1+hXoj?@-$y+(^BJ1H~wQ9G8C0#^aEAyhDduNX@haoa=PuPp zYsGv8UBfQaRHgBgLjmP^eh>fLMeh{8ic)?xz?#3kX-D#Z{;W#cd_`9OMFIaJg-=t`_3*!YDgtNQ2+QUEAJB9M{~AvT$H`E)IKmCR21H532+ata8_i_MR@ z2Xj<3w<`isF~Ah$W{|9;51ub*f4#9ziKrOR&jM{x7I_7()O@`F*5o$KtZ?fxU~g`t zUovNEVKYn$U~VX8eR)qb`7;D8pn*Pp$(otYTqL)5KH$lUS-jf}PGBjy$weoceAcPp z&5ZYB$r&P$MN{0H0AxCe4Qmd3T%M*5d4i%#!nmBCN-WU-4m4Tjxn-%j3HagwTxCZ9 z)j5vO-C7%s%D!&UfO>bi2oXiCw<-w{vVTK^rVbv#W=WjdADJy8$khnU!`ZWCIU`># zyjc^1W~pcu>@lDZ{zr6gv%)2X4n27~Ve+cQqcND%0?IFSP4sH#yIaXXYAq^z3|cg` z`I3$m%jra>e2W-=DiD@84T!cb%||k)nPmEE09NC%@PS_OLhkrX*U!cgD*;;&gIaA(DyVT4QD+q_xu z>r`tg{hiGY&DvD-)B*h+YEd+Zn)WylQl}<4>(_NlsKXCRV;a)Rcw!wtelM2_rWX`j zTh5A|i6=2BA(iMCnj_fob@*eA;V?oa4Z1kRBGaU07O70fb6-qmA$Hg$ps@^ka1=RO zTbE_2#)1bndC3VuK@e!Sftxq4=Uux}fDxXE#Q5_x=E1h>T5`DPHz zbH<_OjWx$wy7=%0!mo*qH*7N4tySm+R0~(rbus`7;+wGh;C0O%x~fEMkt!eV>U$`i z5>Q(o z=t$gPjgGh0&I7KY#k50V7DJRX<%^X z>6+ebc9efB3@eE2Tr){;?_w`vhgF>`-GDY(YkR{9RH(MiCnyRtd!LxXJ75z+?2 zGi@m^+2hKJ5sB1@Xi@s_@p_Kwbc<*LQ_`mr^Y%j}(sV_$`J(?_FWP)4NW*BIL~sR>t6 zM;qTJZ~GoY36&{h-Pf}L#y2UtR}>ZaI%A6VkU>vG4~}9^i$5WP2Tj?Cc}5oQxe2=q z8BeLa$hwCg_psjZyC2+?yX4*hJ58Wu^w9}}7X*+i5Rjqu5^@GzXiw#SUir1G1`jY% zOL=GE_ENYxhcyUrEt9XlMNP6kx6h&%6^u3@zB8KUCAa18T(R2J`%JjWZ z!{7cXaEW+Qu*iJPu+m>QqW}Lo$4Z+!I)0JNzZ&_M%=|B1yejFRM04bGAvu{=lNPd+ zJRI^DRQ(?FcVUD+bgEcAi@o(msqys9RTCG#)TjI!9~3-dc`>gW;HSJuQvH~d`MQs86R$|SKXHh zqS9Qy)u;T`>>a!$LuaE2keJV%;8g)tr&Nnc;EkvA-RanHXsy)D@XN0a>h}z2j81R; zsUNJf&g&rKpuD0WD@=dDrPHdBoK42WoBU|nMo17o(5^;M|dB4?|FsAGVrSyWcI`+FVw^vTVC`y}f(BwJl zrw3Sp151^9=}B})6@H*i4-dIN_o^br+BkcLa^H56|^2XsT0dESw2 zMX>(KqNl=x2K5=zIKg}2JpGAZu{I_IO}0$EQ5P{4zol**PCt3F4`GX}2@vr8#Y)~J zKb)gJeHcFnR@4SSh%b;c%J`l=W*40UPjF#q{<}ywv-=vHRFmDjv)NtmC zQx9qm)d%0zH&qG7AFa3VAU1S^(n8VFTC~Hb+HjYMjX8r#&_0MzlNR*mnLH5hi}`@{ zK$8qiDDvS_(L9_2vHgzEQ${DYSE;DqB!g*jhJghE&=LTnbgl&Xepo<*uRtV{2wDHN z)l;Kg$TA>Y|K8Lc&LjWGj<+bp4Hiye_@BfU(y#nF{fpR&|Ltbye?e^j0}8JC4#xi% zv29ZR%8%hk=3ZDvO-@1u8KmQ@6p%E|dlHuy#H1&MiC<*$YdLkHmR#F3ae;bKd;@*i z2_VfELG=B}JMLCO-6UQy^>RDE%K4b>c%9ki`f~Z2Qu8hO7C#t%Aeg8E%+}6P7Twtg z-)dj(w}_zFK&86KR@q9MHicUAucLVshUdmz_2@32(V`y3`&Kf8Q2I)+!n0mR=rrDU zXvv^$ho;yh*kNqJ#r1}b0|i|xRUF6;lhx$M*uG3SNLUTC@|htC z-=fsw^F%$qqz4%QdjBrS+ov}Qv!z00E+JWas>p?z@=t!WWU3K*?Z(0meTuTOC7OTx zU|kFLE0bLZ+WGcL$u4E}5dB0g`h|uwv3=H6f+{5z9oLv-=Q45+n~V4WwgO=CabjM% zBAN+RjM65(-}>Q2V#i1Na@a0`08g&y;W#@sBiX6Tpy8r}*+{RnyGUT`?XeHSqo#|J z^ww~c;ou|iyzpErDtlVU=`8N7JSu>4M z_pr9=tX0edVn9B}YFO2y(88j#S{w%E8vVOpAboK*27a7e4Ekjt0)hIX99*1oE;vex z7#%jhY=bPijA=Ce@9rRO(Vl_vnd00!^TAc<+wVvRM9{;hP*rqEL_(RzfK$er_^SN; z)1a8vo8~Dr5?;0X0J62Cusw$A*c^Sx1)dom`-)Pl7hsW4i(r*^Mw`z5K>!2ixB_mu z*Ddqjh}zceRFdmuX1akM1$3>G=#~|y?eYv(e-`Qy?bRHIq=fMaN~fB zUa6I8Rt=)jnplP>yuS+P&PxeWpJ#1$F`iqRl|jF$WL_aZFZl@kLo&d$VJtu&w?Q0O zzuXK>6gmygq(yXJy0C1SL}T8AplK|AGNUOhzlGeK_oo|haD@)5PxF}rV+5`-w{Aag zus45t=FU*{LguJ11Sr-28EZkq;!mJO7AQGih1L4rEyUmp>B!%X0YemsrV3QFvlgt* z5kwlPzaiJ+kZ^PMd-RRbl(Y?F*m`4*UIhIuf#8q>H_M=fM*L_Op-<_r zBZagV=4B|EW+KTja?srADTZXCd3Yv%^Chfpi)cg{ED${SI>InNpRj5!euKv?=Xn92 zsS&FH(*w`qLIy$doc>RE&A5R?u zzkl1sxX|{*fLpXvIW>9d<$ePROttn3oc6R!sN{&Y+>Jr@yeQN$sFR z;w6A<2-0%UA?c8Qf;sX7>>uKRBv3Ni)E9pI{uVzX|6Bb0U)`lhLE3hK58ivfRs1}d zNjlGK0hdq0qjV@q1qI%ZFMLgcpWSY~mB^LK)4GZ^h_@H+3?dAe_a~k*;9P_d7%NEFP6+ zgV(oGr*?W(ql?6SQ~`lUsjLb%MbfC4V$)1E0Y_b|OIYxz4?O|!kRb?BGrgiH5+(>s zoqM}v*;OBfg-D1l`M6T6{K`LG+0dJ1)!??G5g(2*vlNkm%Q(MPABT$r13q?|+kL4- zf)Mi5r$sn;u41aK(K#!m+goyd$c!KPl~-&-({j#D4^7hQkV3W|&>l_b!}!z?4($OA z5IrkfuT#F&S1(`?modY&I40%gtroig{YMvF{K{>5u^I51k8RriGd${z)=5k2tG zM|&Bp5kDTfb#vfuTTd?)a=>bX=lokw^y9+2LS?kwHQIWI~pYgy7 zb?A-RKVm_vM5!9?C%qYdfRAw& zAU7`up~%g=p@}pg#b7E)BFYx3g%(J36Nw(Dij!b>cMl@CSNbrW!DBDbTD4OXk!G4x zi}JBKc8HBYx$J~31PXH+4^x|UxK~(<@I;^3pWN$E=sYma@JP|8YL`L(zI6Y#c%Q{6 z*APf`DU$S4pr#_!60BH$FGViP14iJmbrzSrOkR;f3YZa{#E7Wpd@^4E-zH8EgPc-# zKWFPvh%WbqU_%ZEt`=Q?odKHc7@SUmY{GK`?40VuL~o)bS|is$Hn=<=KGHOsEC5tB zFb|q}gGlL97NUf$G$>^1b^3E18PZ~Pm9kX%*ftnolljiEt@2#F2R5ah$zbXd%V_Ev zyDd{1o_uuoBga$fB@Fw!V5F3jIr=a-ykqrK?WWZ#a(bglI_-8pq74RK*KfQ z0~Dzus7_l;pMJYf>Bk`)`S8gF!To-BdMnVw5M-pyu+aCiC5dwNH|6fgRsIKZcF&)g zr}1|?VOp}I3)IR@m1&HX1~#wsS!4iYqES zK}4J{Ei>;e3>LB#Oly>EZkW14^@YmpbgxCDi#0RgdM${&wxR+LiX}B+iRioOB0(pDKpVEI;ND?wNx>%e|m{RsqR_{(nmQ z3ZS}@t!p4a(BKx_-CYwrcyJ5u1TO9bcXti$8sy>xcLKqKCc#~UOZYD{llKTSFEjJ~ zyNWt>tLU}*>^`TvPxtP%F`ZJQw@W0^>x;!^@?k_)9#bF$j0)S3;mH-IR5y82l|%=F z2lR8zhP?XNP-ucZZ6A+o$xOyF!w;RaLHGh57GZ|TCXhJqY~GCh)aXEV$1O&$c}La1 zjuJxkY9SM4av^Hb;i7efiYaMwI%jGy`3NdY)+mcJhF(3XEiSlU3c|jMBi|;m-c?~T z+x0_@;SxcoY=(6xNgO$bBt~Pj8`-<1S|;Bsjrzw3@zSjt^JC3X3*$HI79i~!$RmTz zsblZsLYs7L$|=1CB$8qS!tXrWs!F@BVuh?kN(PvE5Av-*r^iYu+L^j^m9JG^#=m>@ z=1soa)H*w6KzoR$B8mBCXoU;f5^bVuwQ3~2LKg!yxomG1#XPmn(?YH@E~_ED+W6mxs%x{%Z<$pW`~ON1~2XjP5v(0{C{+6Dm$00tsd3w=f=ZENy zOgb-=f}|Hb*LQ$YdWg<(u7x3`PKF)B7ZfZ6;1FrNM63 z?O6tE%EiU@6%rVuwIQjvGtOofZBGZT1Sh(xLIYt9c4VI8`!=UJd2BfLjdRI#SbVAX ziT(f*RI^T!IL5Ac>ql7uduF#nuCRJ1)2bdvAyMxp-5^Ww5p#X{rb5)(X|fEhDHHW{ zw(Lfc$g;+Q`B0AiPGtmK%*aWfQQ$d!*U<|-@n2HZvCWSiw^I>#vh+LyC;aaVWGbmkENr z&kl*8o^_FW$T?rDYLO1Pyi%>@&kJKQoH2E0F`HjcN}Zlnx1ddoDA>G4Xu_jyp6vuT zPvC}pT&Owx+qB`zUeR|4G;OH(<<^_bzkjln0k40t`PQxc$7h(T8Ya~X+9gDc8Z9{Z z&y0RAU}#_kQGrM;__MK9vwIwK^aoqFhk~dK!ARf1zJqHMxF2?7-8|~yoO@_~Ed;_wvT%Vs{9RK$6uUQ|&@#6vyBsFK9eZW1Ft#D2)VpQRwpR(;x^ zdoTgMqfF9iBl%{`QDv7B0~8{8`8k`C4@cbZAXBu00v#kYl!#_Wug{)2PwD5cNp?K^ z9+|d-4z|gZ!L{57>!Ogfbzchm>J1)Y%?NThxIS8frAw@z>Zb9v%3_3~F@<=LG%r*U zaTov}{{^z~SeX!qgSYow`_5)ij*QtGp4lvF`aIGQ>@3ZTkDmsl#@^5*NGjOuu82}o zzLF~Q9SW+mP=>88%eSA1W4_W7-Q>rdq^?t=m6}^tDPaBRGFLg%ak93W!kOp#EO{6& zP%}Iff5HZQ9VW$~+9r=|Quj#z*=YwcnssS~9|ub2>v|u1JXP47vZ1&L1O%Z1DsOrDfSIMHU{VT>&>H=9}G3i@2rP+rx@eU@uE8rJNec zij~#FmuEBj03F1~ct@C@$>y)zB+tVyjV3*n`mtAhIM0$58vM9jOQC}JJOem|EpwqeMuYPxu3sv}oMS?S#o6GGK@8PN59)m&K4Dc&X% z(;XL_kKeYkafzS3Wn5DD>Yiw{LACy_#jY4op(>9q>>-*9@C0M+=b#bknAWZ37^(Ij zq>H%<@>o4a#6NydoF{_M4i4zB_KG)#PSye9bk0Ou8h%1Dtl7Q_y#7*n%g)?m>xF~( zjqvOwC;*qvN_3(*a+w2|ao0D?@okOvg8JskUw(l7n`0fncglavwKd?~l_ryKJ^Ky! zKCHkIC-o7%fFvPa$)YNh022lakMar^dgL=t#@XLyNHHw!b?%WlM)R@^!)I!smZL@k zBi=6wE5)2v&!UNV(&)oOYW(6Qa!nUjDKKBf-~Da=#^HE4(@mWk)LPvhyN3i4goB$3K8iV7uh zsv+a?#c4&NWeK(3AH;ETrMOIFgu{_@%XRwCZ;L=^8Ts)hix4Pf3yJRQ<8xb^CkdmC z?c_gB)XmRsk`9ch#tx4*hO=#qS7={~Vb4*tTf<5P%*-XMfUUYkI9T1cEF;ObfxxI-yNuA=I$dCtz3ey znVkctYD*`fUuZ(57+^B*R=Q}~{1z#2!ca?)+YsRQb+lt^LmEvZt_`=j^wqig+wz@n@ z`LIMQJT3bxMzuKg8EGBU+Q-6cs5(@5W?N>JpZL{$9VF)veF`L5%DSYTNQEypW%6$u zm_~}T{HeHj1bAlKl8ii92l9~$dm=UM21kLemA&b$;^!wB7#IKWGnF$TVq!!lBlG4 z{?Rjz?P(uvid+|i$VH?`-C&Gcb3{(~Vpg`w+O);Wk1|Mrjxrht0GfRUnZqz2MhrXa zqgVC9nemD5)H$to=~hp)c=l9?#~Z_7i~=U-`FZxb-|TR9@YCxx;Zjo-WpMNOn2)z) zFPGGVl%3N$f`gp$gPnWC+f4(rmts%fidpo^BJx72zAd7|*Xi{2VXmbOm)1`w^tm9% znM=0Fg4bDxH5PxPEm{P3#A(mxqlM7SIARP?|2&+c7qmU8kP&iApzL|F>Dz)Ixp_`O zP%xrP1M6@oYhgo$ZWwrAsYLa4 z|I;DAvJxno9HkQrhLPQk-8}=De{9U3U%)dJ$955?_AOms!9gia%)0E$Mp}$+0er@< zq7J&_SzvShM?e%V?_zUu{niL@gt5UFOjFJUJ}L?$f%eU%jUSoujr{^O=?=^{19`ON zlRIy8Uo_nqcPa6@yyz`CM?pMJ^^SN^Fqtt`GQ8Q#W4kE7`V9^LT}j#pMChl!j#g#J zr-=CCaV%xyFeQ9SK+mG(cTwW*)xa(eK;_Z(jy)woZp~> zA(4}-&VH+TEeLzPTqw&FOoK(ZjD~m{KW05fiGLe@E3Z2`rLukIDahE*`u!ubU)9`o zn^-lyht#E#-dt~S>}4y$-mSbR8{T@}22cn^refuQ08NjLOv?JiEWjyOnzk<^R5%gO zhUH_B{oz~u#IYwVnUg8?3P*#DqD8#X;%q%HY**=I>>-S|!X*-!x1{^l#OnR56O>iD zc;i;KS+t$koh)E3)w0OjWJl_aW2;xF=9D9Kr>)(5}4FqUbk# zI#$N8o0w;IChL49m9CJTzoC!|u{Ljd%ECgBOf$}&jA^$(V#P#~)`&g`H8E{uv52pp zwto`xUL-L&WTAVREEm$0g_gYPL(^vHq(*t1WCH_6alhkeW&GCZ3hL)|{O-jiFOBrF z!EW=Jej|dqQitT6!B-7&io2K)WIm~Q)v@yq%U|VpV+I?{y0@Yd%n8~-NuuM*pM~KA z85YB};IS~M(c<}4Hxx>qRK0cdl&e?t253N%vefkgds>Ubn8X}j6Vpgs>a#nFq$osY z1ZRwLqFv=+BTb=i%D2Wv>_yE0z}+niZ4?rE|*a3d7^kndWGwnFqt+iZ(7+aln<}jzbAQ(#Z2SS}3S$%Bd}^ zc9ghB%O)Z_mTZMRC&H#)I#fiLuIkGa^`4e~9oM5zKPx?zjkC&Xy0~r{;S?FS%c7w< zWbMpzc(xSw?9tGxG~_l}Acq}zjt5ClaB7-!vzqnlrX;}$#+PyQ9oU)_DfePh2E1<7 ztok6g6K^k^DuHR*iJ?jw?bs_whk|bx`dxu^nC6#e{1*m~z1eq7m}Cf$*^Eua(oi_I zAL+3opNhJteu&mWQ@kQWPucmiP)4|nFG`b2tpC;h{-PI@`+h?9v=9mn|0R-n8#t=+Z*FD(c5 zjj79Jxkgck*DV=wpFgRZuwr%}KTm+dx?RT@aUHJdaX-ODh~gByS?WGx&czAkvkg;x zrf92l8$Or_zOwJVwh>5rB`Q5_5}ef6DjS*$x30nZbuO3dijS*wvNEqTY5p1_A0gWr znH<(Qvb!os14|R)n2Ost>jS2;d1zyLHu`Svm|&dZD+PpP{Bh>U&`Md;gRl64q;>{8MJJM$?UNUd`aC>BiLe>*{ zJY15->yW+<3rLgYeTruFDtk1ovU<$(_y7#HgUq>)r0{^}Xbth}V#6?%5jeFYt;SG^ z3qF)=uWRU;Jj)Q}cpY8-H+l_n$2$6{ZR?&*IGr{>ek!69ZH0ZoJ*Ji+ezzlJ^%qL3 zO5a`6gwFw(moEzqxh=yJ9M1FTn!eo&qD#y5AZXErHs%22?A+JmS&GIolml!)rZTnUDM3YgzYfT#;OXn)`PWv3Ta z!-i|-Wojv*k&bC}_JJDjiAK(Ba|YZgUI{f}TdEOFT2+}nPmttytw7j%@bQZDV1vvj z^rp{gRkCDmYJHGrE1~e~AE!-&6B6`7UxVQuvRrfdFkGX8H~SNP_X4EodVd;lXd^>eV1jN+Tt4}Rsn)R0LxBz0c=NXU|pUe!MQQFkGBWbR3&(jLm z%RSLc#p}5_dO{GD=DEFr=Fc% z85CBF>*t!6ugI?soX(*JNxBp+-DdZ4X0LldiK}+WWGvXV(C(Ht|!3$psR=&c*HIM=BmX;pRIpz@Ale{9dhGe(U2|Giv;# zOc|;?p67J=Q(kamB*aus=|XP|m{jN^6@V*Bpm?ye56Njh#vyJqE=DweC;?Rv7faX~ zde03n^I~0B2vUmr;w^X37tVxUK?4}ifsSH5_kpKZIzpYu0;Kv}SBGfI2AKNp+VN#z`nI{UNDRbo-wqa4NEls zICRJpu)??cj^*WcZ^MAv+;bDbh~gpN$1Cor<{Y2oyIDws^JsfW^5AL$azE(T0p&pP z1Mv~6Q44R&RHoH95&OuGx2srIr<@zYJTOMKiVs;Bx3py89I87LOb@%mr`0)#;7_~Z zzcZj8?w=)>%5@HoCHE_&hnu(n_yQ-L(~VjpjjkbT7e)Dk5??fApg(d>vwLRJ-x{um z*Nt?DqTSxh_MIyogY!vf1mU1`Gld-&L)*43f6dilz`Q@HEz;+>MDDYv9u!s;WXeao zUq=TaL$P*IFgJzrGc>j1dDOd zed+=ZBo?w4mr$2)Ya}?vedDopomhW1`#P<%YOJ_j=WwClX0xJH-f@s?^tmzs_j7t!k zK@j^zS0Q|mM4tVP5Ram$VbS6|YDY&y?Q1r1joe9dj08#CM{RSMTU}(RCh`hp_Rkl- zGd|Cv~G@F{DLhCizAm9AN!^{rNs8hu!G@8RpnGx7e`-+K$ffN<0qjR zGq^$dj_Tv!n*?zOSyk5skI7JVKJ)3jysnjIu-@VSzQiP8r6MzudCU=~?v-U8yzo^7 zGf~SUTvEp+S*!X9uX!sq=o}lH;r{pzk~M*VA(uyQ`3C8!{C;)&6)95fv(cK!%Cuz$ z_Zal57H6kPN>25KNiI6z6F)jzEkh#%OqU#-__Xzy)KyH};81#N6OfX$$IXWzOn`Q& z4f$Z1t>)8&8PcYfEwY5UadU1yg+U*(1m2ZlHoC-!2?gB!!fLhmTl))D@dhvkx#+Yj z1O=LV{(T%{^IeCuFK>%QR!VZ4GnO5tK8a+thWE zg4VytZrwcS?7^ zuZfhYnB8dwd%VLO?DK7pV5Wi<(`~DYqOXn8#jUIL^)12*Dbhk4GmL_E2`WX&iT16o zk(t|hok(Y|v-wzn?4x34T)|+SfZP>fiq!><*%vnxGN~ypST-FtC+@TPv*vYv@iU!_ z@2gf|PrgQ?Ktf*9^CnJ(x*CtZVB8!OBfg0%!wL;Z8(tYYre0vcnPGlyCc$V(Ipl*P z_(J!a=o@vp^%Efme!K74(Ke7A>Y}|sxV+JL^aYa{~m%5#$$+R1? zGaQhZTTX!#s#=Xtpegqero$RNt&`4xn3g$)=y*;=N=Qai)}~`xtxI_N*#MMCIq#HFifT zz(-*m;pVH&+4bixL&Bbg)W5FN^bH87pAHp)zPkWNMfTFqS=l~AC$3FX3kQUSh_C?-ZftyClgM)o_D7cX$RGlEYblux0jv5 zTr|i-I3@ZPCGheCl~BGhImF)K4!9@?pC(gi3ozX=a!|r1)LFxy_8c&wY0<^{2cm|P zv6Y`QktY*;I)IUd5y3ne1CqpVanlY45z8hf4&$EUBnucDj16pDa4&GI&TArYhf*xh zdj>*%APH8(h~c>o@l#%T>R$e>rwVx_WUB|~V`p^JHsg*y12lzj&zF}w6W09HwB2yb z%Q~`es&(;7#*DUC_w-Dmt7|$*?TA_m;zB+-u{2;Bg{O}nV7G_@7~<)Bv8fH^G$XG8$(&{A zwXJK5LRK%M34(t$&NI~MHT{UQ9qN-V_yn|%PqC81EIiSzmMM=2zb`mIwiP_b)x+2M z7Gd`83h79j#SItpQ}luuf2uOU`my_rY5T{6P#BNlb%h%<#MZb=m@y5aW;#o1^2Z)SWo+b`y0gV^iRcZtz5!-05vF z7wNo=hc6h4hc&s@uL^jqRvD6thVYtbErDK9k!;+a0xoE0WL7zLixjn5;$fXvT=O3I zT6jI&^A7k6R{&5#lVjz#8%_RiAa2{di{`kx79K+j72$H(!ass|B%@l%KeeKchYLe_ z>!(JC2fxsv>XVen+Y42GeYPxMWqm`6F$(E<6^s|g(slNk!lL*6v^W2>f6hh^mE$s= z3D$)}{V5(Qm&A6bp%2Q}*GZ5Qrf}n7*Hr51?bJOyA-?B4vg6y_EX<*-e20h{=0Mxs zbuQGZ$fLyO5v$nQ&^kuH+mNq9O#MWSfThtH|0q1i!NrWj^S}_P;Q1OkYLW6U^?_7G zx2wg?CULj7))QU(n{$0JE%1t2dWrMi2g-Os{v|8^wK{@qlj%+1b^?NI z$}l2tjp0g>K3O+p%yK<9!XqmQ?E9>z&(|^Pi~aSRwI5x$jaA62GFz9%fmO3t3a>cq zK8Xbv=5Ps~4mKN5+Eqw12(!PEyedFXv~VLxMB~HwT1Vfo51pQ#D8e$e4pFZ{&RC2P z5gTIzl{3!&(tor^BwZfR8j4k{7Rq#`riKXP2O-Bh66#WWK2w=z;iD9GLl+3 zpHIaI4#lQ&S-xBK8PiQ%dwOh?%BO~DCo06pN7<^dnZCN@NzY{_Z1>rrB0U|nC&+!2 z2y!oBcTd2;@lzyk(B=TkyZ)zy0deK05*Q0zk+o$@nun`VI1Er7pjq>8V zNmlW{p7S^Btgb(TA}jL(uR>`0w8gHP^T~Sh5Tkip^spk4SBAhC{TZU}_Z)UJw-}zm zPq{KBm!k)?P{`-(9?LFt&YN4s%SIZ-9lJ!Ws~B%exHOeVFk3~}HewnnH(d)qkLQ_d z6h>O)pEE{vbOVw}E+jdYC^wM+AAhaI(YAibUc@B#_mDss0Ji&BK{WG`4 zOk>vSNq(Bq2IB@s>>Rxm6Wv?h;ZXkpb1l8u|+_qXWdC*jjcPCixq;!%BVPSp#hP zqo`%cNf&YoQXHC$D=D45RiT|5ngPlh?0T~?lUf*O)){K@*Kbh?3RW1j9-T?%lDk@y z4+~?wKI%Y!-=O|_IuKz|=)F;V7ps=5@g)RrE;;tvM$gUhG>jHcw2Hr@fS+k^Zr~>G z^JvPrZc}_&d_kEsqAEMTMJw!!CBw)u&ZVzmq+ZworuaE&TT>$pYsd9|g9O^0orAe8 z221?Va!l1|Y5X1Y?{G7rt1sX#qFA^?RLG^VjoxPf63;AS=_mVDfGJKg73L zsGdnTUD40y(>S##2l|W2Cy!H(@@5KBa(#gs`vlz}Y~$ot5VsqPQ{{YtjYFvIumZzt zA{CcxZLJR|4#{j7k~Tu*jkwz8QA|5G1$Cl895R`Zyp;irp1{KN){kB30O8P1W5;@bG znvX74roeMmQlUi=v9Y%(wl$ZC#9tKNFpvi3!C}f1m6Ct|l2g%psc{TJp)@yu)*e2> z((p0Fg*8gJ!|3WZke9;Z{8}&NRkv7iP=#_y-F}x^y?2m%-D_aj^)f04%mneyjo_;) z6qc_Zu$q37d~X``*eP~Q>I2gg%rrV8v=kDfpp$=%Vj}hF)^dsSWygoN(A$g*E=Do6FX?&(@F#7pbiJ`;c0c@Ul zDqW_90Wm#5f2L<(Lf3)3TeXtI7nhYwRm(F;*r_G6K@OPW4H(Y3O5SjUzBC}u3d|eQ8*8d@?;zUPE+i#QNMn=r(ap?2SH@vo*m z3HJ%XuG_S6;QbWy-l%qU;8x;>z>4pMW7>R}J%QLf%@1BY(4f_1iixd-6GlO7Vp*yU zp{VU^3?s?90i=!#>H`lxT!q8rk>W_$2~kbpz7eV{3wR|8E=8**5?qn8#n`*(bt1xRQrdGxyx2y%B$qmw#>ZV$c7%cO#%JM1lY$Y0q?Yuo> ze9KdJoiM)RH*SB%^;TAdX-zEjA7@%y=!0=Zg%iWK7jVI9b&Dk}0$Af&08KHo+ zOwDhFvA(E|ER%a^cdh@^wLUlmIv6?_3=BvX8jKk92L=Y}7Jf5OGMfh` zBdR1wFCi-i5@`9km{isRb0O%TX+f~)KNaEz{rXQa89`YIF;EN&gN)cigu6mNh>?Cm zAO&Im2flv6D{jwm+y<%WsPe4!89n~KN|7}Cb{Z;XweER73r}Qp2 zz}WP4j}U0&(uD&9yGy6`!+_v-S(yG*iytsTR#x_Rc>=6u^vnRDnf1gP{#2>`ffrAC% zTZ5WQ@hAK;P;>kX{D)mIXe4%a5p=LO1xXH@8T?mz7Q@d)$3pL{{B!2{-v70L*o1AO+|n5beiw~ zk@(>m?T3{2k2c;NWc^`4@P&Z?BjxXJ@;x1qhn)9Mn*IFdt_J-dIqx5#d`NfyfX~m( zIS~5)MfZ2Uy?_4W`47i}u0ZgPh<{D|w_d#;D}Q&U$Q-G}xM1A@1f{#%A$jh6Qp&0hQ<0bPOM z-{1Wm&p%%#eb_?x7i;bol EfAhh=DF6Tf literal 0 HcmV?d00001 diff --git a/reactive-systems/inventory-service/.mvn/wrapper/maven-wrapper.properties b/reactive-systems/inventory-service/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..642d572ce9 --- /dev/null +++ b/reactive-systems/inventory-service/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/reactive-systems/inventory-service/Dockerfile b/reactive-systems/inventory-service/Dockerfile new file mode 100644 index 0000000000..d37887cf34 --- /dev/null +++ b/reactive-systems/inventory-service/Dockerfile @@ -0,0 +1,3 @@ +FROM openjdk:8-jdk-alpine +COPY target/inventory-service-async-0.0.1-SNAPSHOT.jar app.jar +ENTRYPOINT ["java","-jar","-Dspring.profiles.active=docker","/app.jar"] \ No newline at end of file diff --git a/reactive-systems/inventory-service/HELP.md b/reactive-systems/inventory-service/HELP.md new file mode 100644 index 0000000000..53d5801551 --- /dev/null +++ b/reactive-systems/inventory-service/HELP.md @@ -0,0 +1,11 @@ +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/#build-image) +* [Spring Data Reactive MongoDB](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/htmlsingle/#boot-features-mongodb) +* [Spring for Apache Kafka](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/htmlsingle/#boot-features-kafka) + diff --git a/reactive-systems/inventory-service/mvnw b/reactive-systems/inventory-service/mvnw new file mode 100644 index 0000000000..a16b5431b4 --- /dev/null +++ b/reactive-systems/inventory-service/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/reactive-systems/inventory-service/mvnw.cmd b/reactive-systems/inventory-service/mvnw.cmd new file mode 100644 index 0000000000..c8d43372c9 --- /dev/null +++ b/reactive-systems/inventory-service/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/reactive-systems/inventory-service/pom.xml b/reactive-systems/inventory-service/pom.xml new file mode 100644 index 0000000000..4c04afb5cb --- /dev/null +++ b/reactive-systems/inventory-service/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + com.baeldung.reactive + inventory-service + inventory-service + Demo project for Spring Boot + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-data-mongodb-reactive + + + org.springframework.boot + spring-boot-starter-webflux + + + org.springframework.kafka + spring-kafka + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + io.projectreactor + reactor-test + test + + + org.springframework.kafka + spring-kafka-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + \ No newline at end of file diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/AsyncApplication.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/AsyncApplication.java new file mode 100644 index 0000000000..ed04eadac6 --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/AsyncApplication.java @@ -0,0 +1,46 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.data.mongodb.ReactiveMongoDatabaseFactory; +import org.springframework.data.mongodb.ReactiveMongoTransactionManager; +import org.springframework.data.repository.init.Jackson2RepositoryPopulatorFactoryBean; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; + +@SpringBootApplication +public class AsyncApplication { + + public static void main(String[] args) { + SpringApplication.run(AsyncApplication.class, args); + } + + /** + * TODO: This does not work for reactive repositories from Mongo. + */ + @Bean + public Jackson2RepositoryPopulatorFactoryBean getRespositoryPopulator() { + Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean(); + factory.setResources(new Resource[] { new ClassPathResource("data.json") }); + return factory; + } + + @Bean + ReactiveMongoTransactionManager transactionManager(ReactiveMongoDatabaseFactory dbFactory) { + return new ReactiveMongoTransactionManager(dbFactory); + } + + @ControllerAdvice + public class ExceptionController { + @ExceptionHandler(value = RuntimeException.class) + public ResponseEntity exception(RuntimeException exception) { + return new ResponseEntity<>(exception.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); + } + } + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java new file mode 100644 index 0000000000..5bdc9693df --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java @@ -0,0 +1,57 @@ +package com.baeldung.async.consumer; + +import java.io.IOException; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Service; + +import com.baeldung.async.producer.OrderProducer; +import com.baeldung.constants.OrderStatus; +import com.baeldung.domain.Order; +import com.baeldung.reactive.service.ProductService; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class OrderConsumer { + + @Autowired + ProductService productService; + + @Autowired + OrderProducer orderProducer; + + @KafkaListener(topics = "orders", groupId = "inventory") + public void consume(Order order) throws IOException { + log.info("Order received to process: {}", order); + if (OrderStatus.RESERVE_INVENTORY.equals(order.getOrderStatus())) { + productService.handleOrder(order) + .doOnSuccess(o -> { + log.info("Order processed succesfully."); + orderProducer.sendMessage(order.setOrderStatus(OrderStatus.INVENTORY_SUCCESS)); + }) + .doOnError(e -> { + if (log.isDebugEnabled()) + log.error("Order failed to process: " + e); + orderProducer.sendMessage(order.setOrderStatus(OrderStatus.INVENTORY_FAILURE) + .setResponseMessage(e.getMessage())); + }) + .subscribe(); + } else if (OrderStatus.REVERT_INVENTORY.equals(order.getOrderStatus())) { + productService.revertOrder(order) + .doOnSuccess(o -> { + log.info("Order reverted succesfully."); + orderProducer.sendMessage(order.setOrderStatus(OrderStatus.INVENTORY_REVERT_SUCCESS)); + }) + .doOnError(e -> { + if (log.isDebugEnabled()) + log.error("Order failed to revert: " + e); + orderProducer.sendMessage(order.setOrderStatus(OrderStatus.INVENTORY_REVERT_FAILURE) + .setResponseMessage(e.getMessage())); + }) + .subscribe(); + } + } +} \ No newline at end of file diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/async/producer/OrderProducer.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/async/producer/OrderProducer.java new file mode 100644 index 0000000000..082d274ab0 --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/async/producer/OrderProducer.java @@ -0,0 +1,23 @@ +package com.baeldung.async.producer; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.stereotype.Service; + +import com.baeldung.domain.Order; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class OrderProducer { + + @Autowired + private KafkaTemplate kafkaTemplate; + + public void sendMessage(Order order) { + log.info("Order processed to dispatch: {}", order); + this.kafkaTemplate.send("orders", order); + } + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/constants/OrderStatus.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/constants/OrderStatus.java new file mode 100644 index 0000000000..030d302e2e --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/constants/OrderStatus.java @@ -0,0 +1,7 @@ +package com.baeldung.constants; + +public enum OrderStatus { + + SUCCESS, FAILURE, INITIATION_SUCCESS, RESERVE_INVENTORY, REVERT_INVENTORY, INVENTORY_SUCCESS, INVENTORY_FAILURE, INVENTORY_REVERT_SUCCESS, INVENTORY_REVERT_FAILURE, PREPARE_SHIPPING, SHIPPING_SUCCESS, SHIPPING_FAILURE, + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/LineItem.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/LineItem.java new file mode 100644 index 0000000000..0a475aed8d --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/LineItem.java @@ -0,0 +1,29 @@ +package com.baeldung.domain; + +import org.bson.types.ObjectId; + +import com.baeldung.serdeser.ObjectIdSerializer; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class LineItem { + + @JsonSerialize(using = ObjectIdSerializer.class) + private ObjectId productId; + private int quantity; + + public LineItem setProductId(ObjectId productId) { + this.productId = productId; + return this; + } + + public LineItem setQuantity(int quantity) { + this.quantity = quantity; + return this; + } + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/Order.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/Order.java new file mode 100644 index 0000000000..595b555eed --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/Order.java @@ -0,0 +1,40 @@ +package com.baeldung.domain; + +import java.util.List; + +import org.bson.types.ObjectId; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import com.baeldung.constants.OrderStatus; +import com.baeldung.serdeser.ObjectIdSerializer; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import lombok.Data; + +@Data +@Document +@JsonIgnoreProperties(ignoreUnknown = true) +public class Order { + + @Id + @JsonSerialize(using = ObjectIdSerializer.class) + private ObjectId id; + private String userId; + private List lineItems; + private Long total; + private OrderStatus orderStatus; + private String responseMessage; + + public Order setOrderStatus(OrderStatus orderStatus) { + this.orderStatus = orderStatus; + return this; + } + + public Order setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + return this; + } + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/Product.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/Product.java new file mode 100644 index 0000000000..33f801c194 --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/domain/Product.java @@ -0,0 +1,21 @@ +package com.baeldung.domain; + +import org.bson.types.ObjectId; +import org.springframework.data.mongodb.core.mapping.Document; + +import com.baeldung.serdeser.ObjectIdSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import lombok.Data; + +@Data +@Document +public class Product { + + @JsonSerialize(using = ObjectIdSerializer.class) + private ObjectId id; + private String name; + private Long price; + private Integer stock; + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/controller/ProductController.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/controller/ProductController.java new file mode 100644 index 0000000000..500400f74f --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/controller/ProductController.java @@ -0,0 +1,30 @@ +package com.baeldung.reactive.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.domain.Product; +import com.baeldung.reactive.service.ProductService; + +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Flux; + +@Slf4j +@RestController +@CrossOrigin(origins = "*") +@RequestMapping("/api/products") +public class ProductController { + + @Autowired + ProductService productService; + + @GetMapping + public Flux getAllProducts() { + log.info("Get all products invoked."); + return productService.getProducts(); + } + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/repository/ProductRepository.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/repository/ProductRepository.java new file mode 100644 index 0000000000..7dbaf2a4c4 --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/repository/ProductRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.reactive.repository; + +import org.bson.types.ObjectId; +import org.springframework.data.mongodb.repository.ReactiveMongoRepository; + +import com.baeldung.domain.Product; + +public interface ProductRepository extends ReactiveMongoRepository { + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/service/ProductService.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/service/ProductService.java new file mode 100644 index 0000000000..087d0a3be5 --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/reactive/service/ProductService.java @@ -0,0 +1,72 @@ +package com.baeldung.reactive.service; + +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.constants.OrderStatus; +import com.baeldung.domain.Order; +import com.baeldung.domain.Product; +import com.baeldung.reactive.repository.ProductRepository; + +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@Slf4j +@Service +public class ProductService { + + @Autowired + ProductRepository productRepository; + + @Transactional + public Mono handleOrder(Order order) { + log.info("Handle order invoked with: {}", order); + return Flux.fromIterable(order.getLineItems()) + .flatMap(l -> productRepository.findById(l.getProductId())) + .flatMap(p -> { + int q = order.getLineItems() + .stream() + .filter(l -> l.getProductId() + .equals(p.getId())) + .findAny() + .get() + .getQuantity(); + if (p.getStock() >= q) { + p.setStock(p.getStock() - q); + return productRepository.save(p); + } else { + return Mono.error(new RuntimeException("Product is out of stock: " + p.getId())); + } + }) + .then(Mono.just(order.setOrderStatus(OrderStatus.SUCCESS))); + } + + @Transactional + public Mono revertOrder(Order order) { + log.info("Revert order invoked with: {}", order); + return Flux.fromIterable(order.getLineItems()) + .flatMap(l -> productRepository.findById(l.getProductId())) + .flatMap(p -> { + int q = order.getLineItems() + .stream() + .filter(l -> l.getProductId() + .equals(p.getId())) + .collect(Collectors.toList()) + .get(0) + .getQuantity(); + + p.setStock(p.getStock() + q); + return productRepository.save(p); + }) + .then(Mono.just(order.setOrderStatus(OrderStatus.SUCCESS))); + } + + public Flux getProducts() { + return productRepository.findAll(); + } + +} diff --git a/reactive-systems/inventory-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java b/reactive-systems/inventory-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java new file mode 100644 index 0000000000..0b0b743e7e --- /dev/null +++ b/reactive-systems/inventory-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java @@ -0,0 +1,20 @@ +package com.baeldung.serdeser; + +import java.io.IOException; + +import org.bson.types.ObjectId; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +@Component +public class ObjectIdSerializer extends JsonSerializer { + + @Override + public void serialize(ObjectId value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeString(value.toString()); + } +} diff --git a/reactive-systems/inventory-service/src/main/resources/application-docker.properties b/reactive-systems/inventory-service/src/main/resources/application-docker.properties new file mode 100644 index 0000000000..2b494a8dbc --- /dev/null +++ b/reactive-systems/inventory-service/src/main/resources/application-docker.properties @@ -0,0 +1,7 @@ +server.port=8081 +spring.data.mongodb.uri=mongodb://mongo-db:27017/reactive-systems +spring.kafka.bootstrap-servers=kafka-broker:9092 +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.producer.properties.spring.json.add.type.headers=false +spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer +spring.kafka.consumer.properties.spring.json.value.default.type=com.baeldung.domain.Order \ No newline at end of file diff --git a/reactive-systems/inventory-service/src/main/resources/application.properties b/reactive-systems/inventory-service/src/main/resources/application.properties new file mode 100644 index 0000000000..d8a8c7af08 --- /dev/null +++ b/reactive-systems/inventory-service/src/main/resources/application.properties @@ -0,0 +1,7 @@ +server.port=8081 +spring.data.mongodb.uri=mongodb://localhost:27017/reactive-systems +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.producer.properties.spring.json.add.type.headers=false +spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer +spring.kafka.consumer.properties.spring.json.value.default.type=com.baeldung.domain.Order \ No newline at end of file diff --git a/reactive-systems/inventory-service/src/main/resources/data.json b/reactive-systems/inventory-service/src/main/resources/data.json new file mode 100644 index 0000000000..624770ca60 --- /dev/null +++ b/reactive-systems/inventory-service/src/main/resources/data.json @@ -0,0 +1,16 @@ +[ + { + "_class" : "com.baeldung.domain.Product", + "id": "5edcbfd30717397ae8cfb7f0", + "name" : "Product A", + "price" : "12", + "stock" : "100" + }, + { + "_class" : "com.baeldung.domain.Product", + "id": "5edcbfd30717397ae8cfb7f1", + "name" : "Product D", + "price" : "16", + "stock" : "100" + } +] \ No newline at end of file diff --git a/reactive-systems/order-service/.mvn/wrapper/MavenWrapperDownloader.java b/reactive-systems/order-service/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..e76d1f3241 --- /dev/null +++ b/reactive-systems/order-service/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/reactive-systems/order-service/.mvn/wrapper/maven-wrapper.jar b/reactive-systems/order-service/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054 GIT binary patch literal 50710 zcmbTd1CVCTmM+|7+wQV$+qP}n>auOywyU~q+qUhh+uxis_~*a##hm*_WW?9E7Pb7N%LRFiwbEGCJ0XP=%-6oeT$XZcYgtzC2~q zk(K08IQL8oTl}>>+hE5YRgXTB@fZ4TH9>7=79e`%%tw*SQUa9~$xKD5rS!;ZG@ocK zQdcH}JX?W|0_Afv?y`-NgLum62B&WSD$-w;O6G0Sm;SMX65z)l%m1e-g8Q$QTI;(Q z+x$xth4KFvH@Bs6(zn!iF#nenk^Y^ce;XIItAoCsow38eq?Y-Auh!1in#Rt-_D>H^ z=EjbclGGGa6VnaMGmMLj`x3NcwA43Jb(0gzl;RUIRAUDcR1~99l2SAPkVhoRMMtN} zXvC<tOmX83grD8GSo_Lo?%lNfhD#EBgPo z*nf@ppMC#B!T)Ae0RG$mlJWmGl7CkuU~B8-==5i;rS;8i6rJ=PoQxf446XDX9g|c> zU64ePyMlsI^V5Jq5A+BPe#e73+kpc_r1tv#B)~EZ;7^67F0*QiYfrk0uVW;Qb=NsG zN>gsuCwvb?s-KQIppEaeXtEMdc9dy6Dfduz-tMTms+i01{eD9JE&h?Kht*$eOl#&L zJdM_-vXs(V#$Ed;5wyNWJdPNh+Z$+;$|%qR(t`4W@kDhd*{(7-33BOS6L$UPDeE_53j${QfKN-0v-HG z(QfyvFNbwPK%^!eIo4ac1;b>c0vyf9}Xby@YY!lkz-UvNp zwj#Gg|4B~?n?G^{;(W;|{SNoJbHTMpQJ*Wq5b{l9c8(%?Kd^1?H1om1de0Da9M;Q=n zUfn{f87iVb^>Exl*nZ0hs(Yt>&V9$Pg`zX`AI%`+0SWQ4Zc(8lUDcTluS z5a_KerZWe}a-MF9#Cd^fi!y3%@RFmg&~YnYZ6<=L`UJ0v={zr)>$A;x#MCHZy1st7 ztT+N07NR+vOwSV2pvWuN1%lO!K#Pj0Fr>Q~R40{bwdL%u9i`DSM4RdtEH#cW)6}+I-eE< z&tZs+(Ogu(H_;$a$!7w`MH0r%h&@KM+<>gJL@O~2K2?VrSYUBbhCn#yy?P)uF3qWU z0o09mIik+kvzV6w>vEZy@&Mr)SgxPzUiDA&%07m17udz9usD82afQEps3$pe!7fUf z0eiidkJ)m3qhOjVHC_M(RYCBO%CZKZXFb8}s0-+}@CIn&EF(rRWUX2g^yZCvl0bI} zbP;1S)iXnRC&}5-Tl(hASKqdSnO?ASGJ*MIhOXIblmEudj(M|W!+I3eDc}7t`^mtg z)PKlaXe(OH+q-)qcQ8a@!llRrpGI8DsjhoKvw9T;TEH&?s=LH0w$EzI>%u;oD@x83 zJL7+ncjI9nn!TlS_KYu5vn%f*@qa5F;| zEFxY&B?g=IVlaF3XNm_03PA)=3|{n-UCgJoTr;|;1AU9|kPE_if8!Zvb}0q$5okF$ zHaJdmO&gg!9oN|M{!qGE=tb|3pVQ8PbL$}e;NgXz<6ZEggI}wO@aBP**2Wo=yN#ZC z4G$m^yaM9g=|&!^ft8jOLuzc3Psca*;7`;gnHm}tS0%f4{|VGEwu45KptfNmwxlE~ z^=r30gi@?cOm8kAz!EylA4G~7kbEiRlRIzwrb~{_2(x^$-?|#e6Bi_**(vyr_~9Of z!n>Gqf+Qwiu!xhi9f53=PM3`3tNF}pCOiPU|H4;pzjcsqbwg*{{kyrTxk<;mx~(;; z1NMrpaQ`57yn34>Jo3b|HROE(UNcQash!0p2-!Cz;{IRv#Vp5!3o$P8!%SgV~k&Hnqhp`5eLjTcy93cK!3Hm-$`@yGnaE=?;*2uSpiZTs_dDd51U%i z{|Zd9ou-;laGS_x=O}a+ zB||za<795A?_~Q=r=coQ+ZK@@ zId~hWQL<%)fI_WDIX#=(WNl!Dm$a&ROfLTd&B$vatq!M-2Jcs;N2vps$b6P1(N}=oI3<3luMTmC|0*{ zm1w8bt7vgX($!0@V0A}XIK)w!AzUn7vH=pZEp0RU0p?}ch2XC-7r#LK&vyc2=-#Q2 z^L%8)JbbcZ%g0Du;|8=q8B>X=mIQirpE=&Ox{TiuNDnOPd-FLI^KfEF729!!0x#Es z@>3ursjFSpu%C-8WL^Zw!7a0O-#cnf`HjI+AjVCFitK}GXO`ME&on|^=~Zc}^LBp9 zj=-vlN;Uc;IDjtK38l7}5xxQF&sRtfn4^TNtnzXv4M{r&ek*(eNbIu!u$>Ed%` z5x7+&)2P&4>0J`N&ZP8$vcR+@FS0126s6+Jx_{{`3ZrIMwaJo6jdrRwE$>IU_JTZ} z(||hyyQ)4Z1@wSlT94(-QKqkAatMmkT7pCycEB1U8KQbFX&?%|4$yyxCtm3=W`$4fiG0WU3yI@c zx{wfmkZAYE_5M%4{J-ygbpH|(|GD$2f$3o_Vti#&zfSGZMQ5_f3xt6~+{RX=$H8at z?GFG1Tmp}}lmm-R->ve*Iv+XJ@58p|1_jRvfEgz$XozU8#iJS})UM6VNI!3RUU!{5 zXB(+Eqd-E;cHQ>)`h0(HO_zLmzR3Tu-UGp;08YntWwMY-9i^w_u#wR?JxR2bky5j9 z3Sl-dQQU$xrO0xa&>vsiK`QN<$Yd%YXXM7*WOhnRdSFt5$aJux8QceC?lA0_if|s> ze{ad*opH_kb%M&~(~&UcX0nFGq^MqjxW?HJIP462v9XG>j(5Gat_)#SiNfahq2Mz2 zU`4uV8m$S~o9(W>mu*=h%Gs(Wz+%>h;R9Sg)jZ$q8vT1HxX3iQnh6&2rJ1u|j>^Qf`A76K%_ubL`Zu?h4`b=IyL>1!=*%!_K)=XC z6d}4R5L+sI50Q4P3upXQ3Z!~1ZXLlh!^UNcK6#QpYt-YC=^H=EPg3)z*wXo*024Q4b2sBCG4I# zlTFFY=kQ>xvR+LsuDUAk)q%5pEcqr(O_|^spjhtpb1#aC& zghXzGkGDC_XDa%t(X`E+kvKQ4zrQ*uuQoj>7@@ykWvF332)RO?%AA&Fsn&MNzmFa$ zWk&&^=NNjxLjrli_8ESU)}U|N{%j&TQmvY~lk!~Jh}*=^INA~&QB9em!in_X%Rl1&Kd~Z(u z9mra#<@vZQlOY+JYUwCrgoea4C8^(xv4ceCXcejq84TQ#sF~IU2V}LKc~Xlr_P=ry zl&Hh0exdCbVd^NPCqNNlxM3vA13EI8XvZ1H9#bT7y*U8Y{H8nwGpOR!e!!}*g;mJ#}T{ekSb}5zIPmye*If(}}_=PcuAW#yidAa^9-`<8Gr0 z)Fz=NiZ{)HAvw{Pl5uu)?)&i&Us$Cx4gE}cIJ}B4Xz~-q7)R_%owbP!z_V2=Aq%Rj z{V;7#kV1dNT9-6R+H}}(ED*_!F=~uz>&nR3gb^Ce%+0s#u|vWl<~JD3MvS0T9thdF zioIG3c#Sdsv;LdtRv3ml7%o$6LTVL>(H`^@TNg`2KPIk*8-IB}X!MT0`hN9Ddf7yN z?J=GxPL!uJ7lqwowsl?iRrh@#5C$%E&h~Z>XQcvFC*5%0RN-Opq|=IwX(dq(*sjs+ zqy99+v~m|6T#zR*e1AVxZ8djd5>eIeCi(b8sUk)OGjAsKSOg^-ugwl2WSL@d#?mdl zib0v*{u-?cq}dDGyZ%$XRY=UkQwt2oGu`zQneZh$=^! zj;!pCBWQNtvAcwcWIBM2y9!*W|8LmQy$H~5BEx)78J`4Z0(FJO2P^!YyQU{*Al+fs z){!4JvT1iLrJ8aU3k0t|P}{RN)_^v%$$r;+p0DY7N8CXzmS*HB*=?qaaF9D@#_$SN zSz{moAK<*RH->%r7xX~9gVW$l7?b|_SYI)gcjf0VAUJ%FcQP(TpBs; zg$25D!Ry_`8xpS_OJdeo$qh#7U+cepZ??TII7_%AXsT$B z=e)Bx#v%J0j``00Zk5hsvv6%T^*xGNx%KN-=pocSoqE5_R)OK%-Pbu^1MNzfds)mL zxz^F4lDKV9D&lEY;I+A)ui{TznB*CE$=9(wgE{m}`^<--OzV-5V4X2w9j(_!+jpTr zJvD*y6;39&T+==$F&tsRKM_lqa1HC}aGL0o`%c9mO=fts?36@8MGm7Vi{Y z^<7m$(EtdSr#22<(rm_(l_(`j!*Pu~Y>>xc>I9M#DJYDJNHO&4=HM%YLIp?;iR&$m z#_$ZWYLfGLt5FJZhr3jpYb`*%9S!zCG6ivNHYzNHcI%khtgHBliM^Ou}ZVD7ehU9 zS+W@AV=?Ro!=%AJ>Kcy9aU3%VX3|XM_K0A+ZaknKDyIS3S-Hw1C7&BSW5)sqj5Ye_ z4OSW7Yu-;bCyYKHFUk}<*<(@TH?YZPHr~~Iy%9@GR2Yd}J2!N9K&CN7Eq{Ka!jdu; zQNB*Y;i(7)OxZK%IHGt#Rt?z`I|A{q_BmoF!f^G}XVeTbe1Wnzh%1g>j}>DqFf;Rp zz7>xIs12@Ke0gr+4-!pmFP84vCIaTjqFNg{V`5}Rdt~xE^I;Bxp4)|cs8=f)1YwHz zqI`G~s2~qqDV+h02b`PQpUE#^^Aq8l%y2|ByQeXSADg5*qMprEAE3WFg0Q39`O+i1 z!J@iV!`Y~C$wJ!5Z+j5$i<1`+@)tBG$JL=!*uk=2k;T<@{|s1$YL079FvK%mPhyHV zP8^KGZnp`(hVMZ;s=n~3r2y;LTwcJwoBW-(ndU-$03{RD zh+Qn$ja_Z^OuMf3Ub|JTY74s&Am*(n{J3~@#OJNYuEVVJd9*H%)oFoRBkySGm`hx! zT3tG|+aAkXcx-2Apy)h^BkOyFTWQVeZ%e2@;*0DtlG9I3Et=PKaPt&K zw?WI7S;P)TWED7aSH$3hL@Qde?H#tzo^<(o_sv_2ci<7M?F$|oCFWc?7@KBj-;N$P zB;q!8@bW-WJY9do&y|6~mEruZAVe$!?{)N9rZZxD-|oltkhW9~nR8bLBGXw<632!l z*TYQn^NnUy%Ds}$f^=yQ+BM-a5X4^GHF=%PDrRfm_uqC zh{sKwIu|O0&jWb27;wzg4w5uA@TO_j(1X?8E>5Zfma|Ly7Bklq|s z9)H`zoAGY3n-+&JPrT!>u^qg9Evx4y@GI4$n-Uk_5wttU1_t?6><>}cZ-U+&+~JE) zPlDbO_j;MoxdLzMd~Ew|1o^a5q_1R*JZ=#XXMzg?6Zy!^hop}qoLQlJ{(%!KYt`MK z8umEN@Z4w!2=q_oe=;QttPCQy3Nm4F@x>@v4sz_jo{4m*0r%J(w1cSo;D_hQtJs7W z><$QrmG^+<$4{d2bgGo&3-FV}avg9zI|Rr(k{wTyl3!M1q+a zD9W{pCd%il*j&Ft z5H$nENf>>k$;SONGW`qo6`&qKs*T z2^RS)pXk9b@(_Fw1bkb)-oqK|v}r$L!W&aXA>IpcdNZ_vWE#XO8X`#Yp1+?RshVcd zknG%rPd*4ECEI0wD#@d+3NbHKxl}n^Sgkx==Iu%}HvNliOqVBqG?P2va zQ;kRJ$J6j;+wP9cS za#m;#GUT!qAV%+rdWolk+)6kkz4@Yh5LXP+LSvo9_T+MmiaP-eq6_k;)i6_@WSJ zlT@wK$zqHu<83U2V*yJ|XJU4farT#pAA&@qu)(PO^8PxEmPD4;Txpio+2)#!9 z>&=i7*#tc0`?!==vk>s7V+PL#S1;PwSY?NIXN2=Gu89x(cToFm))7L;< z+bhAbVD*bD=}iU`+PU+SBobTQ%S!=VL!>q$rfWsaaV}Smz>lO9JXT#`CcH_mRCSf4%YQAw`$^yY z3Y*^Nzk_g$xn7a_NO(2Eb*I=^;4f!Ra#Oo~LLjlcjke*k*o$~U#0ZXOQ5@HQ&T46l z7504MUgZkz2gNP1QFN8Y?nSEnEai^Rgyvl}xZfMUV6QrJcXp;jKGqB=D*tj{8(_pV zqyB*DK$2lgYGejmJUW)*s_Cv65sFf&pb(Yz8oWgDtQ0~k^0-wdF|tj}MOXaN@ydF8 zNr={U?=;&Z?wr^VC+`)S2xl}QFagy;$mG=TUs7Vi2wws5zEke4hTa2)>O0U?$WYsZ z<8bN2bB_N4AWd%+kncgknZ&}bM~eDtj#C5uRkp21hWW5gxWvc6b*4+dn<{c?w9Rmf zIVZKsPl{W2vQAlYO3yh}-{Os=YBnL8?uN5(RqfQ=-1cOiUnJu>KcLA*tQK3FU`_bM zM^T28w;nAj5EdAXFi&Kk1Nnl2)D!M{@+D-}bIEe+Lc4{s;YJc-{F#``iS2uk;2!Zp zF9#myUmO!wCeJIoi^A+T^e~20c+c2C}XltaR!|U-HfDA=^xF97ev}$l6#oY z&-&T{egB)&aV$3_aVA51XGiU07$s9vubh_kQG?F$FycvS6|IO!6q zq^>9|3U^*!X_C~SxX&pqUkUjz%!j=VlXDo$!2VLH!rKj@61mDpSr~7B2yy{>X~_nc zRI+7g2V&k zd**H++P9dg!-AOs3;GM`(g<+GRV$+&DdMVpUxY9I1@uK28$az=6oaa+PutlO9?6#? zf-OsgT>^@8KK>ggkUQRPPgC7zjKFR5spqQb3ojCHzj^(UH~v+!y*`Smv)VpVoPwa6 zWG18WJaPKMi*F6Zdk*kU^`i~NNTfn3BkJniC`yN98L-Awd)Z&mY? zprBW$!qL-OL7h@O#kvYnLsfff@kDIegt~?{-*5A7JrA;#TmTe?jICJqhub-G@e??D zqiV#g{)M!kW1-4SDel7TO{;@*h2=_76g3NUD@|c*WO#>MfYq6_YVUP+&8e4|%4T`w zXzhmVNziAHazWO2qXcaOu@R1MrPP{t)`N)}-1&~mq=ZH=w=;-E$IOk=y$dOls{6sRR`I5>|X zpq~XYW4sd;J^6OwOf**J>a7u$S>WTFPRkjY;BfVgQst)u4aMLR1|6%)CB^18XCz+r ztkYQ}G43j~Q&1em(_EkMv0|WEiKu;z2zhb(L%$F&xWwzOmk;VLBYAZ8lOCziNoPw1 zv2BOyXA`A8z^WH!nXhKXM`t0;6D*-uGds3TYGrm8SPnJJOQ^fJU#}@aIy@MYWz**H zvkp?7I5PE{$$|~{-ZaFxr6ZolP^nL##mHOErB^AqJqn^hFA=)HWj!m3WDaHW$C)i^ z9@6G$SzB=>jbe>4kqr#sF7#K}W*Cg-5y6kun3u&0L7BpXF9=#7IN8FOjWrWwUBZiU zT_se3ih-GBKx+Uw0N|CwP3D@-C=5(9T#BH@M`F2!Goiqx+Js5xC92|Sy0%WWWp={$(am!#l~f^W_oz78HX<0X#7 zp)p1u~M*o9W@O8P{0Qkg@Wa# z2{Heb&oX^CQSZWSFBXKOfE|tsAm#^U-WkDnU;IowZ`Ok4!mwHwH=s|AqZ^YD4!5!@ zPxJj+Bd-q6w_YG`z_+r;S86zwXb+EO&qogOq8h-Ect5(M2+>(O7n7)^dP*ws_3U6v zVsh)sk^@*c>)3EML|0<-YROho{lz@Nd4;R9gL{9|64xVL`n!m$-Jjrx?-Bacp!=^5 z1^T^eB{_)Y<9)y{-4Rz@9_>;_7h;5D+@QcbF4Wv7hu)s0&==&6u)33 zHRj+&Woq-vDvjwJCYES@$C4{$?f$Ibi4G()UeN11rgjF+^;YE^5nYprYoJNoudNj= zm1pXSeG64dcWHObUetodRn1Fw|1nI$D9z}dVEYT0lQnsf_E1x2vBLql7NrHH!n&Sq z6lc*mvU=WS6=v9Lrl}&zRiu_6u;6g%_DU{9b+R z#YHqX7`m9eydf?KlKu6Sb%j$%_jmydig`B*TN`cZL-g!R)iE?+Q5oOqBFKhx z%MW>BC^(F_JuG(ayE(MT{S3eI{cKiwOtPwLc0XO*{*|(JOx;uQOfq@lp_^cZo=FZj z4#}@e@dJ>Bn%2`2_WPeSN7si^{U#H=7N4o%Dq3NdGybrZgEU$oSm$hC)uNDC_M9xc zGzwh5Sg?mpBIE8lT2XsqTt3j3?We8}3bzLBTQd639vyg^$0#1epq8snlDJP2(BF)K zSx30RM+{f+b$g{9usIL8H!hCO117Xgv}ttPJm9wVRjPk;ePH@zxv%j9k5`TzdXLeT zFgFX`V7cYIcBls5WN0Pf6SMBN+;CrQ(|EsFd*xtwr#$R{Z9FP`OWtyNsq#mCgZ7+P z^Yn$haBJ)r96{ZJd8vlMl?IBxrgh=fdq_NF!1{jARCVz>jNdC)H^wfy?R94#MPdUjcYX>#wEx+LB#P-#4S-%YH>t-j+w zOFTI8gX$ard6fAh&g=u&56%3^-6E2tpk*wx3HSCQ+t7+*iOs zPk5ysqE}i*cQocFvA68xHfL|iX(C4h*67@3|5Qwle(8wT&!&{8*{f%0(5gH+m>$tq zp;AqrP7?XTEooYG1Dzfxc>W%*CyL16q|fQ0_jp%%Bk^k!i#Nbi(N9&T>#M{gez_Ws zYK=l}adalV(nH}I_!hNeb;tQFk3BHX7N}}R8%pek^E`X}%ou=cx8InPU1EE0|Hen- zyw8MoJqB5=)Z%JXlrdTXAE)eqLAdVE-=>wGHrkRet}>3Yu^lt$Kzu%$3#(ioY}@Gu zjk3BZuQH&~7H+C*uX^4}F*|P89JX;Hg2U!pt>rDi(n(Qe-c}tzb0#6_ItoR0->LSt zR~UT<-|@TO%O`M+_e_J4wx7^)5_%%u+J=yF_S#2Xd?C;Ss3N7KY^#-vx+|;bJX&8r zD?|MetfhdC;^2WG`7MCgs>TKKN=^=!x&Q~BzmQio_^l~LboTNT=I zC5pme^P@ER``p$2md9>4!K#vV-Fc1an7pl>_|&>aqP}+zqR?+~Z;f2^`a+-!Te%V? z;H2SbF>jP^GE(R1@%C==XQ@J=G9lKX+Z<@5}PO(EYkJh=GCv#)Nj{DkWJM2}F&oAZ6xu8&g7pn1ps2U5srwQ7CAK zN&*~@t{`31lUf`O;2w^)M3B@o)_mbRu{-`PrfNpF!R^q>yTR&ETS7^-b2*{-tZAZz zw@q5x9B5V8Qd7dZ!Ai$9hk%Q!wqbE1F1c96&zwBBaRW}(^axoPpN^4Aw}&a5dMe+*Gomky_l^54*rzXro$ z>LL)U5Ry>~FJi=*{JDc)_**c)-&faPz`6v`YU3HQa}pLtb5K)u%K+BOqXP0)rj5Au$zB zW1?vr?mDv7Fsxtsr+S6ucp2l#(4dnr9sD*v+@*>g#M4b|U?~s93>Pg{{a5|rm2xfI z`>E}?9S@|IoUX{Q1zjm5YJT|3S>&09D}|2~BiMo=z4YEjXlWh)V&qs;*C{`UMxp$9 zX)QB?G$fPD6z5_pNs>Jeh{^&U^)Wbr?2D6-q?)`*1k@!UvwQgl8eG$r+)NnFoT)L6 zg7lEh+E6J17krfYJCSjWzm67hEth24pomhz71|Qodn#oAILN)*Vwu2qpJirG)4Wnv}9GWOFrQg%Je+gNrPl8mw7ykE8{ z=|B4+uwC&bpp%eFcRU6{mxRV32VeH8XxX>v$du<$(DfinaaWxP<+Y97Z#n#U~V zVEu-GoPD=9$}P;xv+S~Ob#mmi$JQmE;Iz4(){y*9pFyW-jjgdk#oG$fl4o9E8bo|L zWjo4l%n51@Kz-n%zeSCD`uB?T%FVk+KBI}=ve zvlcS#wt`U6wrJo}6I6Rwb=1GzZfwE=I&Ne@p7*pH84XShXYJRgvK)UjQL%R9Zbm(m zxzTQsLTON$WO7vM)*vl%Pc0JH7WhP;$z@j=y#avW4X8iqy6mEYr@-}PW?H)xfP6fQ z&tI$F{NNct4rRMSHhaelo<5kTYq+(?pY)Ieh8*sa83EQfMrFupMM@nfEV@EmdHUv9 z35uzIrIuo4#WnF^_jcpC@uNNaYTQ~uZWOE6P@LFT^1@$o&q+9Qr8YR+ObBkpP9=F+$s5+B!mX2~T zAuQ6RenX?O{IlLMl1%)OK{S7oL}X%;!XUxU~xJN8xk z`xywS*naF(J#?vOpB(K=o~lE;m$zhgPWDB@=p#dQIW>xe_p1OLoWInJRKbEuoncf; zmS1!u-ycc1qWnDg5Nk2D)BY%jmOwCLC+Ny>`f&UxFowIsHnOXfR^S;&F(KXd{ODlm z$6#1ccqt-HIH9)|@fHnrKudu!6B$_R{fbCIkSIb#aUN|3RM>zuO>dpMbROZ`^hvS@ z$FU-;e4W}!ubzKrU@R*dW*($tFZ>}dd*4_mv)#O>X{U@zSzQt*83l9mI zI$8O<5AIDx`wo0}f2fsPC_l>ONx_`E7kdXu{YIZbp1$(^oBAH({T~&oQ&1{X951QW zmhHUxd)t%GQ9#ak5fTjk-cahWC;>^Rg7(`TVlvy0W@Y!Jc%QL3Ozu# zDPIqBCy&T2PWBj+d-JA-pxZlM=9ja2ce|3B(^VCF+a*MMp`(rH>Rt6W1$;r{n1(VK zLs>UtkT43LR2G$AOYHVailiqk7naz2yZGLo*xQs!T9VN5Q>eE(w zw$4&)&6xIV$IO^>1N-jrEUg>O8G4^@y+-hQv6@OmF@gy^nL_n1P1-Rtyy$Bl;|VcV zF=p*&41-qI5gG9UhKmmnjs932!6hceXa#-qfK;3d*a{)BrwNFeKU|ge?N!;zk+kB! zMD_uHJR#%b54c2tr~uGPLTRLg$`fupo}cRJeTwK;~}A>(Acy4k-Xk&Aa1&eWYS1ULWUj@fhBiWY$pdfy+F z@G{OG{*v*mYtH3OdUjwEr6%_ZPZ3P{@rfbNPQG!BZ7lRyC^xlMpWH`@YRar`tr}d> z#wz87t?#2FsH-jM6m{U=gp6WPrZ%*w0bFm(T#7m#v^;f%Z!kCeB5oiF`W33W5Srdt zdU?YeOdPG@98H7NpI{(uN{FJdu14r(URPH^F6tOpXuhU7T9a{3G3_#Ldfx_nT(Hec zo<1dyhsVsTw;ZkVcJ_0-h-T3G1W@q)_Q30LNv)W?FbMH+XJ* zy=$@39Op|kZv`Rt>X`zg&at(?PO^I=X8d9&myFEx#S`dYTg1W+iE?vt#b47QwoHI9 zNP+|3WjtXo{u}VG(lLUaW0&@yD|O?4TS4dfJI`HC-^q;M(b3r2;7|FONXphw-%7~* z&;2!X17|05+kZOpQ3~3!Nb>O94b&ZSs%p)TK)n3m=4eiblVtSx@KNFgBY_xV6ts;NF;GcGxMP8OKV^h6LmSb2E#Qnw ze!6Mnz7>lE9u{AgQ~8u2zM8CYD5US8dMDX-5iMlgpE9m*s+Lh~A#P1er*rF}GHV3h z=`STo?kIXw8I<`W0^*@mB1$}pj60R{aJ7>C2m=oghKyxMbFNq#EVLgP0cH3q7H z%0?L93-z6|+jiN|@v>ix?tRBU(v-4RV`}cQH*fp|)vd3)8i9hJ3hkuh^8dz{F5-~_ zUUr1T3cP%cCaTooM8dj|4*M=e6flH0&8ve32Q)0dyisl))XkZ7Wg~N}6y`+Qi2l+e zUd#F!nJp{#KIjbQdI`%oZ`?h=5G^kZ_uN`<(`3;a!~EMsWV|j-o>c?x#;zR2ktiB! z);5rrHl?GPtr6-o!tYd|uK;Vbsp4P{v_4??=^a>>U4_aUXPWQ$FPLE4PK$T^3Gkf$ zHo&9$U&G`d(Os6xt1r?sg14n)G8HNyWa^q8#nf0lbr4A-Fi;q6t-`pAx1T*$eKM*$ z|CX|gDrk#&1}>5H+`EjV$9Bm)Njw&7-ZR{1!CJTaXuP!$Pcg69`{w5BRHysB$(tWUes@@6aM69kb|Lx$%BRY^-o6bjH#0!7b;5~{6J+jKxU!Kmi# zndh@+?}WKSRY2gZ?Q`{(Uj|kb1%VWmRryOH0T)f3cKtG4oIF=F7RaRnH0Rc_&372={_3lRNsr95%ZO{IX{p@YJ^EI%+gvvKes5cY+PE@unghjdY5#9A!G z70u6}?zmd?v+{`vCu-53_v5@z)X{oPC@P)iA3jK$`r zSA2a7&!^zmUiZ82R2=1cumBQwOJUPz5Ay`RLfY(EiwKkrx%@YN^^XuET;tE zmr-6~I7j!R!KrHu5CWGSChO6deaLWa*9LLJbcAJsFd%Dy>a!>J`N)Z&oiU4OEP-!Ti^_!p}O?7`}i7Lsf$-gBkuY*`Zb z7=!nTT;5z$_5$=J=Ko+Cp|Q0J=%oFr>hBgnL3!tvFoLNhf#D0O=X^h+x08iB;@8pXdRHxX}6R4k@i6%vmsQwu^5z zk1ip`#^N)^#Lg#HOW3sPI33xqFB4#bOPVnY%d6prwxf;Y-w9{ky4{O6&94Ra8VN@K zb-lY;&`HtxW@sF!doT5T$2&lIvJpbKGMuDAFM#!QPXW87>}=Q4J3JeXlwHys?!1^#37q_k?N@+u&Ns20pEoBeZC*np;i;M{2C0Z4_br2gsh6eL z#8`#sn41+$iD?^GL%5?cbRcaa-Nx0vE(D=*WY%rXy3B%gNz0l?#noGJGP728RMY#q z=2&aJf@DcR?QbMmN)ItUe+VM_U!ryqA@1VVt$^*xYt~-qvW!J4Tp<-3>jT=7Zow5M z8mSKp0v4b%a8bxFr>3MwZHSWD73D@+$5?nZAqGM#>H@`)mIeC#->B)P8T$zh-Pxnc z8)~Zx?TWF4(YfKuF3WN_ckpCe5;x4V4AA3(i$pm|78{%!q?|~*eH0f=?j6i)n~Hso zmTo>vqEtB)`%hP55INf7HM@taH)v`Fw40Ayc*R!T?O{ziUpYmP)AH`euTK!zg9*6Z z!>M=$3pd0!&TzU=hc_@@^Yd3eUQpX4-33}b{?~5t5lgW=ldJ@dUAH%`l5US1y_`40 zs(X`Qk}vvMDYYq+@Rm+~IyCX;iD~pMgq^KY)T*aBz@DYEB={PxA>)mI6tM*sx-DmGQHEaHwRrAmNjO!ZLHO4b;;5mf@zzlPhkP($JeZGE7 z?^XN}Gf_feGoG~BjUgVa*)O`>lX=$BSR2)uD<9 z>o^|nb1^oVDhQbfW>>!;8-7<}nL6L^V*4pB=>wwW+RXAeRvKED(n1;R`A6v$6gy0I(;Vf?!4;&sgn7F%LpM}6PQ?0%2Z@b{It<(G1CZ|>913E0nR2r^Pa*Bp z@tFGi*CQ~@Yc-?{cwu1 zsilf=k^+Qs>&WZG(3WDixisHpR>`+ihiRwkL(3T|=xsoNP*@XX3BU8hr57l3k;pni zI``=3Nl4xh4oDj<%>Q1zYXHr%Xg_xrK3Nq?vKX3|^Hb(Bj+lONTz>4yhU-UdXt2>j z<>S4NB&!iE+ao{0Tx^N*^|EZU;0kJkx@zh}S^P{ieQjGl468CbC`SWnwLRYYiStXm zOxt~Rb3D{dz=nHMcY)#r^kF8|q8KZHVb9FCX2m^X*(|L9FZg!5a7((!J8%MjT$#Fs)M1Pb zq6hBGp%O1A+&%2>l0mpaIzbo&jc^!oN^3zxap3V2dNj3x<=TwZ&0eKX5PIso9j1;e zwUg+C&}FJ`k(M|%%}p=6RPUq4sT3-Y;k-<68ciZ~_j|bt>&9ZLHNVrp#+pk}XvM{8 z`?k}o-!if>hVlCP9j%&WI2V`5SW)BCeR5>MQhF)po=p~AYN%cNa_BbV6EEh_kk^@a zD>4&>uCGCUmyA-c)%DIcF4R6!>?6T~Mj_m{Hpq`*(wj>foHL;;%;?(((YOxGt)Bhx zuS+K{{CUsaC++%}S6~CJ=|vr(iIs-je)e9uJEU8ZJAz)w166q)R^2XI?@E2vUQ!R% zn@dxS!JcOimXkWJBz8Y?2JKQr>`~SmE2F2SL38$SyR1^yqj8_mkBp)o$@+3BQ~Mid z9U$XVqxX3P=XCKj0*W>}L0~Em`(vG<>srF8+*kPrw z20{z(=^w+ybdGe~Oo_i|hYJ@kZl*(9sHw#Chi&OIc?w`nBODp?ia$uF%Hs(X>xm?j zqZQ`Ybf@g#wli`!-al~3GWiE$K+LCe=Ndi!#CVjzUZ z!sD2O*;d28zkl))m)YN7HDi^z5IuNo3^w(zy8 zszJG#mp#Cj)Q@E@r-=NP2FVxxEAeOI2e=|KshybNB6HgE^(r>HD{*}S}mO>LuRGJT{*tfTzw_#+er-0${}%YPe@CMJ1Ng#j#)i)SnY@ss3gL;g zg2D~#Kpdfu#G;q1qz_TwSz1VJT(b3zby$Vk&;Y#1(A)|xj`_?i5YQ;TR%jice5E;0 zYHg;`zS5{S*9xI6o^j>rE8Ua*XhIw{_-*&@(R|C(am8__>+Ws&Q^ymy*X4~hR2b5r zm^p3sw}yv=tdyncy_Ui7{BQS732et~Z_@{-IhHDXAV`(Wlay<#hb>%H%WDi+K$862nA@BDtM#UCKMu+kM`!JHyWSi?&)A7_ z3{cyNG%a~nnH_!+;g&JxEMAmh-Z}rC!o7>OVzW&PoMyTA_g{hqXG)SLraA^OP**<7 zjWbr7z!o2n3hnx7A=2O=WL;`@9N{vQIM@&|G-ljrPvIuJHYtss0Er0fT5cMXNUf1B z7FAwBDixt0X7C3S)mPe5g`YtME23wAnbU)+AtV}z+e8G;0BP=bI;?(#|Ep!vVfDbK zvx+|CKF>yt0hWQ3drchU#XBU+HiuG*V^snFAPUp-5<#R&BUAzoB!aZ+e*KIxa26V}s6?nBK(U-7REa573wg-jqCg>H8~>O{ z*C0JL-?X-k_y%hpUFL?I>0WV{oV`Nb)nZbJG01R~AG>flIJf)3O*oB2i8~;!P?Wo_ z0|QEB*fifiL6E6%>tlAYHm2cjTFE@*<);#>689Z6S#BySQ@VTMhf9vYQyLeDg1*F} zjq>i1*x>5|CGKN{l9br3kB0EHY|k4{%^t7-uhjd#NVipUZa=EUuE5kS1_~qYX?>hJ z$}!jc9$O$>J&wnu0SgfYods^z?J4X;X7c77Me0kS-dO_VUQ39T(Kv(Y#s}Qqz-0AH z^?WRL(4RzpkD+T5FG_0NyPq-a-B7A5LHOCqwObRJi&oRi(<;OuIN7SV5PeHU$<@Zh zPozEV`dYmu0Z&Tqd>t>8JVde9#Pt+l95iHe$4Xwfy1AhI zDM4XJ;bBTTvRFtW>E+GzkN)9k!hA5z;xUOL2 zq4}zn-DP{qc^i|Y%rvi|^5k-*8;JZ~9a;>-+q_EOX+p1Wz;>i7c}M6Nv`^NY&{J-> z`(mzDJDM}QPu5i44**2Qbo(XzZ-ZDu%6vm8w@DUarqXj41VqP~ zs&4Y8F^Waik3y1fQo`bVUH;b=!^QrWb)3Gl=QVKr+6sxc=ygauUG|cm?|X=;Q)kQ8 zM(xrICifa2p``I7>g2R~?a{hmw@{!NS5`VhH8+;cV(F>B94M*S;5#O`YzZH1Z%yD? zZ61w(M`#aS-*~Fj;x|J!KM|^o;MI#Xkh0ULJcA?o4u~f%Z^16ViA27FxU5GM*rKq( z7cS~MrZ=f>_OWx8j#-Q3%!aEU2hVuTu(7`TQk-Bi6*!<}0WQi;_FpO;fhpL4`DcWp zGOw9vx0N~6#}lz(r+dxIGZM3ah-8qrqMmeRh%{z@dbUD2w15*_4P?I~UZr^anP}DB zU9CCrNiy9I3~d#&!$DX9e?A});BjBtQ7oGAyoI$8YQrkLBIH@2;lt4E^)|d6Jwj}z z&2_E}Y;H#6I4<10d_&P0{4|EUacwFHauvrjAnAm6yeR#}f}Rk27CN)vhgRqEyPMMS7zvunj2?`f;%?alsJ+-K+IzjJx>h8 zu~m_y$!J5RWAh|C<6+uiCNsOKu)E72M3xKK(a9Okw3e_*O&}7llNV!=P87VM2DkAk zci!YXS2&=P0}Hx|wwSc9JP%m8dMJA*q&VFB0yMI@5vWoAGraygwn){R+Cj6B1a2Px z5)u(K5{+;z2n*_XD!+Auv#LJEM)(~Hx{$Yb^ldQmcYF2zNH1V30*)CN_|1$v2|`LnFUT$%-tO0Eg|c5$BB~yDfzS zcOXJ$wpzVK0MfTjBJ0b$r#_OvAJ3WRt+YOLlJPYMx~qp>^$$$h#bc|`g0pF-Ao43? z>*A+8lx>}L{p(Tni2Vvk)dtzg$hUKjSjXRagj)$h#8=KV>5s)J4vGtRn5kP|AXIz! zPgbbVxW{2o4s-UM;c#We8P&mPN|DW7_uLF!a|^0S=wr6Esx9Z$2|c1?GaupU6$tb| zY_KU`(_29O_%k(;>^|6*pZURH3`@%EuKS;Ns z1lujmf;r{qAN&Q0&m{wJSZ8MeE7RM5+Sq;ul_ z`+ADrd_Um+G37js6tKsArNB}n{p*zTUxQr>3@wA;{EUbjNjlNd6$Mx zg0|MyU)v`sa~tEY5$en7^PkC=S<2@!nEdG6L=h(vT__0F=S8Y&eM=hal#7eM(o^Lu z2?^;05&|CNliYrq6gUv;|i!(W{0N)LWd*@{2q*u)}u*> z7MQgk6t9OqqXMln?zoMAJcc zMKaof_Up})q#DzdF?w^%tTI7STI^@8=Wk#enR*)&%8yje>+tKvUYbW8UAPg55xb70 zEn5&Ba~NmOJlgI#iS8W3-@N%>V!#z-ZRwfPO1)dQdQkaHsiqG|~we2ALqG7Ruup(DqSOft2RFg_X%3w?6VqvV1uzX_@F(diNVp z4{I|}35=11u$;?|JFBEE*gb;T`dy+8gWJ9~pNsecrO`t#V9jW-6mnfO@ff9od}b(3s4>p0i30gbGIv~1@a^F2kl7YO;DxmF3? zWi-RoXhzRJV0&XE@ACc?+@6?)LQ2XNm4KfalMtsc%4!Fn0rl zpHTrHwR>t>7W?t!Yc{*-^xN%9P0cs0kr=`?bQ5T*oOo&VRRu+1chM!qj%2I!@+1XF z4GWJ=7ix9;Wa@xoZ0RP`NCWw0*8247Y4jIZ>GEW7zuoCFXl6xIvz$ezsWgKdVMBH> z{o!A7f;R-@eK9Vj7R40xx)T<2$?F2E<>Jy3F;;=Yt}WE59J!1WN367 zA^6pu_zLoZIf*x031CcwotS{L8bJE(<_F%j_KJ2P_IusaZXwN$&^t716W{M6X2r_~ zaiMwdISX7Y&Qi&Uh0upS3TyEIXNDICQlT5fHXC`aji-c{U(J@qh-mWl-uMN|T&435 z5)a1dvB|oe%b2mefc=Vpm0C%IUYYh7HI*;3UdgNIz}R##(#{(_>82|zB0L*1i4B5j-xi9O4x10rs_J6*gdRBX=@VJ+==sWb&_Qc6tSOowM{BX@(zawtjl zdU!F4OYw2@Tk1L^%~JCwb|e#3CC>srRHQ*(N%!7$Mu_sKh@|*XtR>)BmWw!;8-mq7 zBBnbjwx8Kyv|hd*`5}84flTHR1Y@@uqjG`UG+jN_YK&RYTt7DVwfEDXDW4U+iO{>K zw1hr{_XE*S*K9TzzUlJH2rh^hUm2v7_XjwTuYap|>zeEDY$HOq3X4Tz^X}E9z)x4F zs+T?Ed+Hj<#jY-`Va~fT2C$=qFT-5q$@p9~0{G&eeL~tiIAHXA!f6C(rAlS^)&k<- zXU|ZVs}XQ>s5iONo~t!XXZgtaP$Iau;JT%h)>}v54yut~pykaNye4axEK#5@?TSsQ zE;Jvf9I$GVb|S`7$pG)4vgo9NXsKr?u=F!GnA%VS2z$@Z(!MR9?EPcAqi5ft)Iz6sNl`%kj+_H-X`R<>BFrBW=fSlD|{`D%@Rcbu2?%>t7i34k?Ujb)2@J-`j#4 zLK<69qcUuniIan-$A1+fR=?@+thwDIXtF1Tks@Br-xY zfB+zblrR(ke`U;6U~-;p1Kg8Lh6v~LjW@9l2P6s+?$2!ZRPX`(ZkRGe7~q(4&gEi<$ch`5kQ?*1=GSqkeV z{SA1EaW_A!t{@^UY2D^YO0(H@+kFVzZaAh0_`A`f(}G~EP~?B|%gtxu&g%^x{EYSz zk+T;_c@d;+n@$<>V%P=nk36?L!}?*=vK4>nJSm+1%a}9UlmTJTrfX4{Lb7smNQn@T zw9p2%(Zjl^bWGo1;DuMHN(djsEm)P8mEC2sL@KyPjwD@d%QnZ$ zMJ3cnn!_!iP{MzWk%PI&D?m?C(y2d|2VChluN^yHya(b`h>~GkI1y;}O_E57zOs!{ zt2C@M$^PR2U#(dZmA-sNreB@z-yb0Bf7j*yONhZG=onhx>t4)RB`r6&TP$n zgmN*)eCqvgriBO-abHQ8ECN0bw?z5Bxpx z=jF@?zFdVn?@gD5egM4o$m`}lV(CWrOKKq(sv*`mNcHcvw&Xryfw<{ch{O&qc#WCTXX6=#{MV@q#iHYba!OUY+MGeNTjP%Fj!WgM&`&RlI^=AWTOqy-o zHo9YFt!gQ*p7{Fl86>#-JLZo(b^O`LdFK~OsZBRR@6P?ad^Ujbqm_j^XycM4ZHFyg ziUbIFW#2tj`65~#2V!4z7DM8Z;fG0|APaQ{a2VNYpNotB7eZ5kp+tPDz&Lqs0j%Y4tA*URpcfi z_M(FD=fRGdqf430j}1z`O0I=;tLu81bwJXdYiN7_&a-?ly|-j*+=--XGvCq#32Gh(=|qj5F?kmihk{%M&$}udW5)DHK zF_>}5R8&&API}o0osZJRL3n~>76nUZ&L&iy^s>PMnNcYZ|9*1$v-bzbT3rpWsJ+y{ zPrg>5Zlery96Um?lc6L|)}&{992{_$J&=4%nRp9BAC6!IB=A&=tF>r8S*O-=!G(_( zwXbX_rGZgeiK*&n5E;f=k{ktyA1(;x_kiMEt0*gpp_4&(twlS2e5C?NoD{n>X2AT# zY@Zp?#!b1zNq96MQqeO*M1MMBin5v#RH52&Xd~DO6-BZLnA6xO1$sou(YJ1Dlc{WF zVa%2DyYm`V#81jP@70IJ;DX@y*iUt$MLm)ByAD$eUuji|5{ptFYq(q)mE(5bOpxjM z^Q`AHWq44SG3`_LxC9fwR)XRVIp=B%<(-lOC3jI#bb@dK(*vjom!=t|#<@dZql%>O z15y^{4tQoeW9Lu%G&V$90x6F)xN6y_oIn;!Q zs)8jT$;&;u%Y>=T3hg34A-+Y*na=|glcStr5D;&5*t5*DmD~x;zQAV5{}Ya`?RRGa zT*t9@$a~!co;pD^!J5bo?lDOWFx%)Y=-fJ+PDGc0>;=q=s?P4aHForSB+)v0WY2JH z?*`O;RHum6j%#LG)Vu#ciO#+jRC3!>T(9fr+XE7T2B7Z|0nR5jw@WG)kDDzTJ=o4~ zUpeyt7}_nd`t}j9BKqryOha{34erm)RmST)_9Aw)@ zHbiyg5n&E{_CQR@h<}34d7WM{s{%5wdty1l+KX8*?+-YkNK2Be*6&jc>@{Fd;Ps|| z26LqdI3#9le?;}risDq$K5G3yoqK}C^@-8z^wj%tdgw-6@F#Ju{Sg7+y)L?)U$ez> zoOaP$UFZ?y5BiFycir*pnaAaY+|%1%8&|(@VB)zweR%?IidwJyK5J!STzw&2RFx zZV@qeaCB01Hu#U9|1#=Msc8Pgz5P*4Lrp!Q+~(G!OiNR{qa7|r^H?FC6gVhkk3y7=uW#Sh;&>78bZ}aK*C#NH$9rX@M3f{nckYI+5QG?Aj1DM)@~z_ zw!UAD@gedTlePB*%4+55naJ8ak_;))#S;4ji!LOqY5VRI){GMwHR~}6t4g>5C_#U# ztYC!tjKjrKvRy=GAsJVK++~$|+s!w9z3H4G^mACv=EErXNSmH7qN}%PKcN|8%9=i)qS5+$L zu&ya~HW%RMVJi4T^pv?>mw*Gf<)-7gf#Qj|e#w2|v4#t!%Jk{&xlf;$_?jW*n!Pyx zkG$<18kiLOAUPuFfyu-EfWX%4jYnjBYc~~*9JEz6oa)_R|8wjZA|RNrAp%}14L7fW zi7A5Wym*K+V8pkqqO-X#3ft{0qs?KVt^)?kS>AicmeO&q+~J~ zp0YJ_P~_a8j= zsAs~G=8F=M{4GZL{|B__UorX@MRNQLn?*_gym4aW(~+i13knnk1P=khoC-ViMZk+x zLW(l}oAg1H`dU+Fv**;qw|ANDSRs>cGqL!Yw^`; zv;{E&8CNJcc)GHzTYM}f&NPw<6j{C3gaeelU#y!M)w-utYEHOCCJo|Vgp7K6C_$14 zqIrLUB0bsgz^D%V%fbo2f9#yb#CntTX?55Xy|Kps&Xek*4_r=KDZ z+`TQuv|$l}MWLzA5Ay6Cvsa^7xvwXpy?`w(6vx4XJ zWuf1bVSb#U8{xlY4+wlZ$9jjPk)X_;NFMqdgq>m&W=!KtP+6NL57`AMljW+es zzqjUjgz;V*kktJI?!NOg^s_)ph45>4UDA!Vo0hn>KZ+h-3=?Y3*R=#!fOX zP$Y~+14$f66ix?UWB_6r#fMcC^~X4R-<&OD1CSDNuX~y^YwJ>sW0j`T<2+3F9>cLo z#!j57$ll2K9(%$4>eA7(>FJX5e)pR5&EZK!IMQzOfik#FU*o*LGz~7u(8}XzIQRy- z!U7AlMTIe|DgQFmc%cHy_9^{o`eD%ja_L>ckU6$O4*U**o5uR7`FzqkU8k4gxtI=o z^P^oGFPm5jwZMI{;nH}$?p@uV8FT4r=|#GziKXK07bHJLtK}X%I0TON$uj(iJ`SY^ zc$b2CoxCQ>7LH@nxcdW&_C#fMYBtTxcg46dL{vf%EFCZ~eErMvZq&Z%Lhumnkn^4A zsx$ay(FnN7kYah}tZ@0?-0Niroa~13`?hVi6`ndno`G+E8;$<6^gsE-K3)TxyoJ4M zb6pj5=I8^FD5H@`^V#Qb2^0cx7wUz&cruA5g>6>qR5)O^t1(-qqP&1g=qvY#s&{bx zq8Hc%LsbK1*%n|Y=FfojpE;w~)G0-X4i*K3{o|J7`krhIOd*c*$y{WIKz2n2*EXEH zT{oml3Th5k*vkswuFXdGDlcLj15Nec5pFfZ*0?XHaF_lVuiB%Pv&p7z)%38}%$Gup zVTa~C8=cw%6BKn_|4E?bPNW4PT7}jZQLhDJhvf4z;~L)506IE0 zX!tWXX(QOQPRj-p80QG79t8T2^az4Zp2hOHziQlvT!|H)jv{Ixodabzv6lBj)6WRB z{)Kg@$~~(7$-az?lw$4@L%I&DI0Lo)PEJJziWP33a3azb?jyXt1v0N>2kxwA6b%l> zZqRpAo)Npi&loWbjFWtEV)783BbeIAhqyuc+~>i7aQ8shIXt)bjCWT6$~ro^>99G} z2XfmT0(|l!)XJb^E!#3z4oEGIsL(xd; zYX1`1I(cG|u#4R4T&C|m*9KB1`UzKvho5R@1eYtUL9B72{i(ir&ls8g!pD ztR|25xGaF!4z5M+U@@lQf(12?xGy`!|3E}7pI$k`jOIFjiDr{tqf0va&3pOn6Pu)% z@xtG2zjYuJXrV)DUrIF*y<1O1<$#54kZ#2;=X51J^F#0nZ0(;S$OZDt_U2bx{RZ=Q zMMdd$fH|!s{ zXq#l;{`xfV`gp&C>A`WrQU?d{!Ey5(1u*VLJt>i27aZ-^&2IIk=zP5p+{$q(K?2(b z8?9h)kvj9SF!Dr zoyF}?V|9;6abHxWk2cEvGs$-}Pg}D+ZzgkaN&$Snp%;5m%zh1E#?Wac-}x?BYlGN#U#Mek*}kek#I9XaHt?mz3*fDrRTQ#&#~xyeqJk1QJ~E$7qsw6 z?sV;|?*=-{M<1+hXoj?@-$y+(^BJ1H~wQ9G8C0#^aEAyhDduNX@haoa=PuPp zYsGv8UBfQaRHgBgLjmP^eh>fLMeh{8ic)?xz?#3kX-D#Z{;W#cd_`9OMFIaJg-=t`_3*!YDgtNQ2+QUEAJB9M{~AvT$H`E)IKmCR21H532+ata8_i_MR@ z2Xj<3w<`isF~Ah$W{|9;51ub*f4#9ziKrOR&jM{x7I_7()O@`F*5o$KtZ?fxU~g`t zUovNEVKYn$U~VX8eR)qb`7;D8pn*Pp$(otYTqL)5KH$lUS-jf}PGBjy$weoceAcPp z&5ZYB$r&P$MN{0H0AxCe4Qmd3T%M*5d4i%#!nmBCN-WU-4m4Tjxn-%j3HagwTxCZ9 z)j5vO-C7%s%D!&UfO>bi2oXiCw<-w{vVTK^rVbv#W=WjdADJy8$khnU!`ZWCIU`># zyjc^1W~pcu>@lDZ{zr6gv%)2X4n27~Ve+cQqcND%0?IFSP4sH#yIaXXYAq^z3|cg` z`I3$m%jra>e2W-=DiD@84T!cb%||k)nPmEE09NC%@PS_OLhkrX*U!cgD*;;&gIaA(DyVT4QD+q_xu z>r`tg{hiGY&DvD-)B*h+YEd+Zn)WylQl}<4>(_NlsKXCRV;a)Rcw!wtelM2_rWX`j zTh5A|i6=2BA(iMCnj_fob@*eA;V?oa4Z1kRBGaU07O70fb6-qmA$Hg$ps@^ka1=RO zTbE_2#)1bndC3VuK@e!Sftxq4=Uux}fDxXE#Q5_x=E1h>T5`DPHz zbH<_OjWx$wy7=%0!mo*qH*7N4tySm+R0~(rbus`7;+wGh;C0O%x~fEMkt!eV>U$`i z5>Q(o z=t$gPjgGh0&I7KY#k50V7DJRX<%^X z>6+ebc9efB3@eE2Tr){;?_w`vhgF>`-GDY(YkR{9RH(MiCnyRtd!LxXJ75z+?2 zGi@m^+2hKJ5sB1@Xi@s_@p_Kwbc<*LQ_`mr^Y%j}(sV_$`J(?_FWP)4NW*BIL~sR>t6 zM;qTJZ~GoY36&{h-Pf}L#y2UtR}>ZaI%A6VkU>vG4~}9^i$5WP2Tj?Cc}5oQxe2=q z8BeLa$hwCg_psjZyC2+?yX4*hJ58Wu^w9}}7X*+i5Rjqu5^@GzXiw#SUir1G1`jY% zOL=GE_ENYxhcyUrEt9XlMNP6kx6h&%6^u3@zB8KUCAa18T(R2J`%JjWZ z!{7cXaEW+Qu*iJPu+m>QqW}Lo$4Z+!I)0JNzZ&_M%=|B1yejFRM04bGAvu{=lNPd+ zJRI^DRQ(?FcVUD+bgEcAi@o(msqys9RTCG#)TjI!9~3-dc`>gW;HSJuQvH~d`MQs86R$|SKXHh zqS9Qy)u;T`>>a!$LuaE2keJV%;8g)tr&Nnc;EkvA-RanHXsy)D@XN0a>h}z2j81R; zsUNJf&g&rKpuD0WD@=dDrPHdBoK42WoBU|nMo17o(5^;M|dB4?|FsAGVrSyWcI`+FVw^vTVC`y}f(BwJl zrw3Sp151^9=}B})6@H*i4-dIN_o^br+BkcLa^H56|^2XsT0dESw2 zMX>(KqNl=x2K5=zIKg}2JpGAZu{I_IO}0$EQ5P{4zol**PCt3F4`GX}2@vr8#Y)~J zKb)gJeHcFnR@4SSh%b;c%J`l=W*40UPjF#q{<}ywv-=vHRFmDjv)NtmC zQx9qm)d%0zH&qG7AFa3VAU1S^(n8VFTC~Hb+HjYMjX8r#&_0MzlNR*mnLH5hi}`@{ zK$8qiDDvS_(L9_2vHgzEQ${DYSE;DqB!g*jhJghE&=LTnbgl&Xepo<*uRtV{2wDHN z)l;Kg$TA>Y|K8Lc&LjWGj<+bp4Hiye_@BfU(y#nF{fpR&|Ltbye?e^j0}8JC4#xi% zv29ZR%8%hk=3ZDvO-@1u8KmQ@6p%E|dlHuy#H1&MiC<*$YdLkHmR#F3ae;bKd;@*i z2_VfELG=B}JMLCO-6UQy^>RDE%K4b>c%9ki`f~Z2Qu8hO7C#t%Aeg8E%+}6P7Twtg z-)dj(w}_zFK&86KR@q9MHicUAucLVshUdmz_2@32(V`y3`&Kf8Q2I)+!n0mR=rrDU zXvv^$ho;yh*kNqJ#r1}b0|i|xRUF6;lhx$M*uG3SNLUTC@|htC z-=fsw^F%$qqz4%QdjBrS+ov}Qv!z00E+JWas>p?z@=t!WWU3K*?Z(0meTuTOC7OTx zU|kFLE0bLZ+WGcL$u4E}5dB0g`h|uwv3=H6f+{5z9oLv-=Q45+n~V4WwgO=CabjM% zBAN+RjM65(-}>Q2V#i1Na@a0`08g&y;W#@sBiX6Tpy8r}*+{RnyGUT`?XeHSqo#|J z^ww~c;ou|iyzpErDtlVU=`8N7JSu>4M z_pr9=tX0edVn9B}YFO2y(88j#S{w%E8vVOpAboK*27a7e4Ekjt0)hIX99*1oE;vex z7#%jhY=bPijA=Ce@9rRO(Vl_vnd00!^TAc<+wVvRM9{;hP*rqEL_(RzfK$er_^SN; z)1a8vo8~Dr5?;0X0J62Cusw$A*c^Sx1)dom`-)Pl7hsW4i(r*^Mw`z5K>!2ixB_mu z*Ddqjh}zceRFdmuX1akM1$3>G=#~|y?eYv(e-`Qy?bRHIq=fMaN~fB zUa6I8Rt=)jnplP>yuS+P&PxeWpJ#1$F`iqRl|jF$WL_aZFZl@kLo&d$VJtu&w?Q0O zzuXK>6gmygq(yXJy0C1SL}T8AplK|AGNUOhzlGeK_oo|haD@)5PxF}rV+5`-w{Aag zus45t=FU*{LguJ11Sr-28EZkq;!mJO7AQGih1L4rEyUmp>B!%X0YemsrV3QFvlgt* z5kwlPzaiJ+kZ^PMd-RRbl(Y?F*m`4*UIhIuf#8q>H_M=fM*L_Op-<_r zBZagV=4B|EW+KTja?srADTZXCd3Yv%^Chfpi)cg{ED${SI>InNpRj5!euKv?=Xn92 zsS&FH(*w`qLIy$doc>RE&A5R?u zzkl1sxX|{*fLpXvIW>9d<$ePROttn3oc6R!sN{&Y+>Jr@yeQN$sFR z;w6A<2-0%UA?c8Qf;sX7>>uKRBv3Ni)E9pI{uVzX|6Bb0U)`lhLE3hK58ivfRs1}d zNjlGK0hdq0qjV@q1qI%ZFMLgcpWSY~mB^LK)4GZ^h_@H+3?dAe_a~k*;9P_d7%NEFP6+ zgV(oGr*?W(ql?6SQ~`lUsjLb%MbfC4V$)1E0Y_b|OIYxz4?O|!kRb?BGrgiH5+(>s zoqM}v*;OBfg-D1l`M6T6{K`LG+0dJ1)!??G5g(2*vlNkm%Q(MPABT$r13q?|+kL4- zf)Mi5r$sn;u41aK(K#!m+goyd$c!KPl~-&-({j#D4^7hQkV3W|&>l_b!}!z?4($OA z5IrkfuT#F&S1(`?modY&I40%gtroig{YMvF{K{>5u^I51k8RriGd${z)=5k2tG zM|&Bp5kDTfb#vfuTTd?)a=>bX=lokw^y9+2LS?kwHQIWI~pYgy7 zb?A-RKVm_vM5!9?C%qYdfRAw& zAU7`up~%g=p@}pg#b7E)BFYx3g%(J36Nw(Dij!b>cMl@CSNbrW!DBDbTD4OXk!G4x zi}JBKc8HBYx$J~31PXH+4^x|UxK~(<@I;^3pWN$E=sYma@JP|8YL`L(zI6Y#c%Q{6 z*APf`DU$S4pr#_!60BH$FGViP14iJmbrzSrOkR;f3YZa{#E7Wpd@^4E-zH8EgPc-# zKWFPvh%WbqU_%ZEt`=Q?odKHc7@SUmY{GK`?40VuL~o)bS|is$Hn=<=KGHOsEC5tB zFb|q}gGlL97NUf$G$>^1b^3E18PZ~Pm9kX%*ftnolljiEt@2#F2R5ah$zbXd%V_Ev zyDd{1o_uuoBga$fB@Fw!V5F3jIr=a-ykqrK?WWZ#a(bglI_-8pq74RK*KfQ z0~Dzus7_l;pMJYf>Bk`)`S8gF!To-BdMnVw5M-pyu+aCiC5dwNH|6fgRsIKZcF&)g zr}1|?VOp}I3)IR@m1&HX1~#wsS!4iYqES zK}4J{Ei>;e3>LB#Oly>EZkW14^@YmpbgxCDi#0RgdM${&wxR+LiX}B+iRioOB0(pDKpVEI;ND?wNx>%e|m{RsqR_{(nmQ z3ZS}@t!p4a(BKx_-CYwrcyJ5u1TO9bcXti$8sy>xcLKqKCc#~UOZYD{llKTSFEjJ~ zyNWt>tLU}*>^`TvPxtP%F`ZJQw@W0^>x;!^@?k_)9#bF$j0)S3;mH-IR5y82l|%=F z2lR8zhP?XNP-ucZZ6A+o$xOyF!w;RaLHGh57GZ|TCXhJqY~GCh)aXEV$1O&$c}La1 zjuJxkY9SM4av^Hb;i7efiYaMwI%jGy`3NdY)+mcJhF(3XEiSlU3c|jMBi|;m-c?~T z+x0_@;SxcoY=(6xNgO$bBt~Pj8`-<1S|;Bsjrzw3@zSjt^JC3X3*$HI79i~!$RmTz zsblZsLYs7L$|=1CB$8qS!tXrWs!F@BVuh?kN(PvE5Av-*r^iYu+L^j^m9JG^#=m>@ z=1soa)H*w6KzoR$B8mBCXoU;f5^bVuwQ3~2LKg!yxomG1#XPmn(?YH@E~_ED+W6mxs%x{%Z<$pW`~ON1~2XjP5v(0{C{+6Dm$00tsd3w=f=ZENy zOgb-=f}|Hb*LQ$YdWg<(u7x3`PKF)B7ZfZ6;1FrNM63 z?O6tE%EiU@6%rVuwIQjvGtOofZBGZT1Sh(xLIYt9c4VI8`!=UJd2BfLjdRI#SbVAX ziT(f*RI^T!IL5Ac>ql7uduF#nuCRJ1)2bdvAyMxp-5^Ww5p#X{rb5)(X|fEhDHHW{ zw(Lfc$g;+Q`B0AiPGtmK%*aWfQQ$d!*U<|-@n2HZvCWSiw^I>#vh+LyC;aaVWGbmkENr z&kl*8o^_FW$T?rDYLO1Pyi%>@&kJKQoH2E0F`HjcN}Zlnx1ddoDA>G4Xu_jyp6vuT zPvC}pT&Owx+qB`zUeR|4G;OH(<<^_bzkjln0k40t`PQxc$7h(T8Ya~X+9gDc8Z9{Z z&y0RAU}#_kQGrM;__MK9vwIwK^aoqFhk~dK!ARf1zJqHMxF2?7-8|~yoO@_~Ed;_wvT%Vs{9RK$6uUQ|&@#6vyBsFK9eZW1Ft#D2)VpQRwpR(;x^ zdoTgMqfF9iBl%{`QDv7B0~8{8`8k`C4@cbZAXBu00v#kYl!#_Wug{)2PwD5cNp?K^ z9+|d-4z|gZ!L{57>!Ogfbzchm>J1)Y%?NThxIS8frAw@z>Zb9v%3_3~F@<=LG%r*U zaTov}{{^z~SeX!qgSYow`_5)ij*QtGp4lvF`aIGQ>@3ZTkDmsl#@^5*NGjOuu82}o zzLF~Q9SW+mP=>88%eSA1W4_W7-Q>rdq^?t=m6}^tDPaBRGFLg%ak93W!kOp#EO{6& zP%}Iff5HZQ9VW$~+9r=|Quj#z*=YwcnssS~9|ub2>v|u1JXP47vZ1&L1O%Z1DsOrDfSIMHU{VT>&>H=9}G3i@2rP+rx@eU@uE8rJNec zij~#FmuEBj03F1~ct@C@$>y)zB+tVyjV3*n`mtAhIM0$58vM9jOQC}JJOem|EpwqeMuYPxu3sv}oMS?S#o6GGK@8PN59)m&K4Dc&X% z(;XL_kKeYkafzS3Wn5DD>Yiw{LACy_#jY4op(>9q>>-*9@C0M+=b#bknAWZ37^(Ij zq>H%<@>o4a#6NydoF{_M4i4zB_KG)#PSye9bk0Ou8h%1Dtl7Q_y#7*n%g)?m>xF~( zjqvOwC;*qvN_3(*a+w2|ao0D?@okOvg8JskUw(l7n`0fncglavwKd?~l_ryKJ^Ky! zKCHkIC-o7%fFvPa$)YNh022lakMar^dgL=t#@XLyNHHw!b?%WlM)R@^!)I!smZL@k zBi=6wE5)2v&!UNV(&)oOYW(6Qa!nUjDKKBf-~Da=#^HE4(@mWk)LPvhyN3i4goB$3K8iV7uh zsv+a?#c4&NWeK(3AH;ETrMOIFgu{_@%XRwCZ;L=^8Ts)hix4Pf3yJRQ<8xb^CkdmC z?c_gB)XmRsk`9ch#tx4*hO=#qS7={~Vb4*tTf<5P%*-XMfUUYkI9T1cEF;ObfxxI-yNuA=I$dCtz3ey znVkctYD*`fUuZ(57+^B*R=Q}~{1z#2!ca?)+YsRQb+lt^LmEvZt_`=j^wqig+wz@n@ z`LIMQJT3bxMzuKg8EGBU+Q-6cs5(@5W?N>JpZL{$9VF)veF`L5%DSYTNQEypW%6$u zm_~}T{HeHj1bAlKl8ii92l9~$dm=UM21kLemA&b$;^!wB7#IKWGnF$TVq!!lBlG4 z{?Rjz?P(uvid+|i$VH?`-C&Gcb3{(~Vpg`w+O);Wk1|Mrjxrht0GfRUnZqz2MhrXa zqgVC9nemD5)H$to=~hp)c=l9?#~Z_7i~=U-`FZxb-|TR9@YCxx;Zjo-WpMNOn2)z) zFPGGVl%3N$f`gp$gPnWC+f4(rmts%fidpo^BJx72zAd7|*Xi{2VXmbOm)1`w^tm9% znM=0Fg4bDxH5PxPEm{P3#A(mxqlM7SIARP?|2&+c7qmU8kP&iApzL|F>Dz)Ixp_`O zP%xrP1M6@oYhgo$ZWwrAsYLa4 z|I;DAvJxno9HkQrhLPQk-8}=De{9U3U%)dJ$955?_AOms!9gia%)0E$Mp}$+0er@< zq7J&_SzvShM?e%V?_zUu{niL@gt5UFOjFJUJ}L?$f%eU%jUSoujr{^O=?=^{19`ON zlRIy8Uo_nqcPa6@yyz`CM?pMJ^^SN^Fqtt`GQ8Q#W4kE7`V9^LT}j#pMChl!j#g#J zr-=CCaV%xyFeQ9SK+mG(cTwW*)xa(eK;_Z(jy)woZp~> zA(4}-&VH+TEeLzPTqw&FOoK(ZjD~m{KW05fiGLe@E3Z2`rLukIDahE*`u!ubU)9`o zn^-lyht#E#-dt~S>}4y$-mSbR8{T@}22cn^refuQ08NjLOv?JiEWjyOnzk<^R5%gO zhUH_B{oz~u#IYwVnUg8?3P*#DqD8#X;%q%HY**=I>>-S|!X*-!x1{^l#OnR56O>iD zc;i;KS+t$koh)E3)w0OjWJl_aW2;xF=9D9Kr>)(5}4FqUbk# zI#$N8o0w;IChL49m9CJTzoC!|u{Ljd%ECgBOf$}&jA^$(V#P#~)`&g`H8E{uv52pp zwto`xUL-L&WTAVREEm$0g_gYPL(^vHq(*t1WCH_6alhkeW&GCZ3hL)|{O-jiFOBrF z!EW=Jej|dqQitT6!B-7&io2K)WIm~Q)v@yq%U|VpV+I?{y0@Yd%n8~-NuuM*pM~KA z85YB};IS~M(c<}4Hxx>qRK0cdl&e?t253N%vefkgds>Ubn8X}j6Vpgs>a#nFq$osY z1ZRwLqFv=+BTb=i%D2Wv>_yE0z}+niZ4?rE|*a3d7^kndWGwnFqt+iZ(7+aln<}jzbAQ(#Z2SS}3S$%Bd}^ zc9ghB%O)Z_mTZMRC&H#)I#fiLuIkGa^`4e~9oM5zKPx?zjkC&Xy0~r{;S?FS%c7w< zWbMpzc(xSw?9tGxG~_l}Acq}zjt5ClaB7-!vzqnlrX;}$#+PyQ9oU)_DfePh2E1<7 ztok6g6K^k^DuHR*iJ?jw?bs_whk|bx`dxu^nC6#e{1*m~z1eq7m}Cf$*^Eua(oi_I zAL+3opNhJteu&mWQ@kQWPucmiP)4|nFG`b2tpC;h{-PI@`+h?9v=9mn|0R-n8#t=+Z*FD(c5 zjj79Jxkgck*DV=wpFgRZuwr%}KTm+dx?RT@aUHJdaX-ODh~gByS?WGx&czAkvkg;x zrf92l8$Or_zOwJVwh>5rB`Q5_5}ef6DjS*$x30nZbuO3dijS*wvNEqTY5p1_A0gWr znH<(Qvb!os14|R)n2Ost>jS2;d1zyLHu`Svm|&dZD+PpP{Bh>U&`Md;gRl64q;>{8MJJM$?UNUd`aC>BiLe>*{ zJY15->yW+<3rLgYeTruFDtk1ovU<$(_y7#HgUq>)r0{^}Xbth}V#6?%5jeFYt;SG^ z3qF)=uWRU;Jj)Q}cpY8-H+l_n$2$6{ZR?&*IGr{>ek!69ZH0ZoJ*Ji+ezzlJ^%qL3 zO5a`6gwFw(moEzqxh=yJ9M1FTn!eo&qD#y5AZXErHs%22?A+JmS&GIolml!)rZTnUDM3YgzYfT#;OXn)`PWv3Ta z!-i|-Wojv*k&bC}_JJDjiAK(Ba|YZgUI{f}TdEOFT2+}nPmttytw7j%@bQZDV1vvj z^rp{gRkCDmYJHGrE1~e~AE!-&6B6`7UxVQuvRrfdFkGX8H~SNP_X4EodVd;lXd^>eV1jN+Tt4}Rsn)R0LxBz0c=NXU|pUe!MQQFkGBWbR3&(jLm z%RSLc#p}5_dO{GD=DEFr=Fc% z85CBF>*t!6ugI?soX(*JNxBp+-DdZ4X0LldiK}+WWGvXV(C(Ht|!3$psR=&c*HIM=BmX;pRIpz@Ale{9dhGe(U2|Giv;# zOc|;?p67J=Q(kamB*aus=|XP|m{jN^6@V*Bpm?ye56Njh#vyJqE=DweC;?Rv7faX~ zde03n^I~0B2vUmr;w^X37tVxUK?4}ifsSH5_kpKZIzpYu0;Kv}SBGfI2AKNp+VN#z`nI{UNDRbo-wqa4NEls zICRJpu)??cj^*WcZ^MAv+;bDbh~gpN$1Cor<{Y2oyIDws^JsfW^5AL$azE(T0p&pP z1Mv~6Q44R&RHoH95&OuGx2srIr<@zYJTOMKiVs;Bx3py89I87LOb@%mr`0)#;7_~Z zzcZj8?w=)>%5@HoCHE_&hnu(n_yQ-L(~VjpjjkbT7e)Dk5??fApg(d>vwLRJ-x{um z*Nt?DqTSxh_MIyogY!vf1mU1`Gld-&L)*43f6dilz`Q@HEz;+>MDDYv9u!s;WXeao zUq=TaL$P*IFgJzrGc>j1dDOd zed+=ZBo?w4mr$2)Ya}?vedDopomhW1`#P<%YOJ_j=WwClX0xJH-f@s?^tmzs_j7t!k zK@j^zS0Q|mM4tVP5Ram$VbS6|YDY&y?Q1r1joe9dj08#CM{RSMTU}(RCh`hp_Rkl- zGd|Cv~G@F{DLhCizAm9AN!^{rNs8hu!G@8RpnGx7e`-+K$ffN<0qjR zGq^$dj_Tv!n*?zOSyk5skI7JVKJ)3jysnjIu-@VSzQiP8r6MzudCU=~?v-U8yzo^7 zGf~SUTvEp+S*!X9uX!sq=o}lH;r{pzk~M*VA(uyQ`3C8!{C;)&6)95fv(cK!%Cuz$ z_Zal57H6kPN>25KNiI6z6F)jzEkh#%OqU#-__Xzy)KyH};81#N6OfX$$IXWzOn`Q& z4f$Z1t>)8&8PcYfEwY5UadU1yg+U*(1m2ZlHoC-!2?gB!!fLhmTl))D@dhvkx#+Yj z1O=LV{(T%{^IeCuFK>%QR!VZ4GnO5tK8a+thWE zg4VytZrwcS?7^ zuZfhYnB8dwd%VLO?DK7pV5Wi<(`~DYqOXn8#jUIL^)12*Dbhk4GmL_E2`WX&iT16o zk(t|hok(Y|v-wzn?4x34T)|+SfZP>fiq!><*%vnxGN~ypST-FtC+@TPv*vYv@iU!_ z@2gf|PrgQ?Ktf*9^CnJ(x*CtZVB8!OBfg0%!wL;Z8(tYYre0vcnPGlyCc$V(Ipl*P z_(J!a=o@vp^%Efme!K74(Ke7A>Y}|sxV+JL^aYa{~m%5#$$+R1? zGaQhZTTX!#s#=Xtpegqero$RNt&`4xn3g$)=y*;=N=Qai)}~`xtxI_N*#MMCIq#HFifT zz(-*m;pVH&+4bixL&Bbg)W5FN^bH87pAHp)zPkWNMfTFqS=l~AC$3FX3kQUSh_C?-ZftyClgM)o_D7cX$RGlEYblux0jv5 zTr|i-I3@ZPCGheCl~BGhImF)K4!9@?pC(gi3ozX=a!|r1)LFxy_8c&wY0<^{2cm|P zv6Y`QktY*;I)IUd5y3ne1CqpVanlY45z8hf4&$EUBnucDj16pDa4&GI&TArYhf*xh zdj>*%APH8(h~c>o@l#%T>R$e>rwVx_WUB|~V`p^JHsg*y12lzj&zF}w6W09HwB2yb z%Q~`es&(;7#*DUC_w-Dmt7|$*?TA_m;zB+-u{2;Bg{O}nV7G_@7~<)Bv8fH^G$XG8$(&{A zwXJK5LRK%M34(t$&NI~MHT{UQ9qN-V_yn|%PqC81EIiSzmMM=2zb`mIwiP_b)x+2M z7Gd`83h79j#SItpQ}luuf2uOU`my_rY5T{6P#BNlb%h%<#MZb=m@y5aW;#o1^2Z)SWo+b`y0gV^iRcZtz5!-05vF z7wNo=hc6h4hc&s@uL^jqRvD6thVYtbErDK9k!;+a0xoE0WL7zLixjn5;$fXvT=O3I zT6jI&^A7k6R{&5#lVjz#8%_RiAa2{di{`kx79K+j72$H(!ass|B%@l%KeeKchYLe_ z>!(JC2fxsv>XVen+Y42GeYPxMWqm`6F$(E<6^s|g(slNk!lL*6v^W2>f6hh^mE$s= z3D$)}{V5(Qm&A6bp%2Q}*GZ5Qrf}n7*Hr51?bJOyA-?B4vg6y_EX<*-e20h{=0Mxs zbuQGZ$fLyO5v$nQ&^kuH+mNq9O#MWSfThtH|0q1i!NrWj^S}_P;Q1OkYLW6U^?_7G zx2wg?CULj7))QU(n{$0JE%1t2dWrMi2g-Os{v|8^wK{@qlj%+1b^?NI z$}l2tjp0g>K3O+p%yK<9!XqmQ?E9>z&(|^Pi~aSRwI5x$jaA62GFz9%fmO3t3a>cq zK8Xbv=5Ps~4mKN5+Eqw12(!PEyedFXv~VLxMB~HwT1Vfo51pQ#D8e$e4pFZ{&RC2P z5gTIzl{3!&(tor^BwZfR8j4k{7Rq#`riKXP2O-Bh66#WWK2w=z;iD9GLl+3 zpHIaI4#lQ&S-xBK8PiQ%dwOh?%BO~DCo06pN7<^dnZCN@NzY{_Z1>rrB0U|nC&+!2 z2y!oBcTd2;@lzyk(B=TkyZ)zy0deK05*Q0zk+o$@nun`VI1Er7pjq>8V zNmlW{p7S^Btgb(TA}jL(uR>`0w8gHP^T~Sh5Tkip^spk4SBAhC{TZU}_Z)UJw-}zm zPq{KBm!k)?P{`-(9?LFt&YN4s%SIZ-9lJ!Ws~B%exHOeVFk3~}HewnnH(d)qkLQ_d z6h>O)pEE{vbOVw}E+jdYC^wM+AAhaI(YAibUc@B#_mDss0Ji&BK{WG`4 zOk>vSNq(Bq2IB@s>>Rxm6Wv?h;ZXkpb1l8u|+_qXWdC*jjcPCixq;!%BVPSp#hP zqo`%cNf&YoQXHC$D=D45RiT|5ngPlh?0T~?lUf*O)){K@*Kbh?3RW1j9-T?%lDk@y z4+~?wKI%Y!-=O|_IuKz|=)F;V7ps=5@g)RrE;;tvM$gUhG>jHcw2Hr@fS+k^Zr~>G z^JvPrZc}_&d_kEsqAEMTMJw!!CBw)u&ZVzmq+ZworuaE&TT>$pYsd9|g9O^0orAe8 z221?Va!l1|Y5X1Y?{G7rt1sX#qFA^?RLG^VjoxPf63;AS=_mVDfGJKg73L zsGdnTUD40y(>S##2l|W2Cy!H(@@5KBa(#gs`vlz}Y~$ot5VsqPQ{{YtjYFvIumZzt zA{CcxZLJR|4#{j7k~Tu*jkwz8QA|5G1$Cl895R`Zyp;irp1{KN){kB30O8P1W5;@bG znvX74roeMmQlUi=v9Y%(wl$ZC#9tKNFpvi3!C}f1m6Ct|l2g%psc{TJp)@yu)*e2> z((p0Fg*8gJ!|3WZke9;Z{8}&NRkv7iP=#_y-F}x^y?2m%-D_aj^)f04%mneyjo_;) z6qc_Zu$q37d~X``*eP~Q>I2gg%rrV8v=kDfpp$=%Vj}hF)^dsSWygoN(A$g*E=Do6FX?&(@F#7pbiJ`;c0c@Ul zDqW_90Wm#5f2L<(Lf3)3TeXtI7nhYwRm(F;*r_G6K@OPW4H(Y3O5SjUzBC}u3d|eQ8*8d@?;zUPE+i#QNMn=r(ap?2SH@vo*m z3HJ%XuG_S6;QbWy-l%qU;8x;>z>4pMW7>R}J%QLf%@1BY(4f_1iixd-6GlO7Vp*yU zp{VU^3?s?90i=!#>H`lxT!q8rk>W_$2~kbpz7eV{3wR|8E=8**5?qn8#n`*(bt1xRQrdGxyx2y%B$qmw#>ZV$c7%cO#%JM1lY$Y0q?Yuo> ze9KdJoiM)RH*SB%^;TAdX-zEjA7@%y=!0=Zg%iWK7jVI9b&Dk}0$Af&08KHo+ zOwDhFvA(E|ER%a^cdh@^wLUlmIv6?_3=BvX8jKk92L=Y}7Jf5OGMfh` zBdR1wFCi-i5@`9km{isRb0O%TX+f~)KNaEz{rXQa89`YIF;EN&gN)cigu6mNh>?Cm zAO&Im2flv6D{jwm+y<%WsPe4!89n~KN|7}Cb{Z;XweER73r}Qp2 zz}WP4j}U0&(uD&9yGy6`!+_v-S(yG*iytsTR#x_Rc>=6u^vnRDnf1gP{#2>`ffrAC% zTZ5WQ@hAK;P;>kX{D)mIXe4%a5p=LO1xXH@8T?mz7Q@d)$3pL{{B!2{-v70L*o1AO+|n5beiw~ zk@(>m?T3{2k2c;NWc^`4@P&Z?BjxXJ@;x1qhn)9Mn*IFdt_J-dIqx5#d`NfyfX~m( zIS~5)MfZ2Uy?_4W`47i}u0ZgPh<{D|w_d#;D}Q&U$Q-G}xM1A@1f{#%A$jh6Qp&0hQ<0bPOM z-{1Wm&p%%#eb_?x7i;bol EfAhh=DF6Tf literal 0 HcmV?d00001 diff --git a/reactive-systems/order-service/.mvn/wrapper/maven-wrapper.properties b/reactive-systems/order-service/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..642d572ce9 --- /dev/null +++ b/reactive-systems/order-service/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/reactive-systems/order-service/Dockerfile b/reactive-systems/order-service/Dockerfile new file mode 100644 index 0000000000..516e088a05 --- /dev/null +++ b/reactive-systems/order-service/Dockerfile @@ -0,0 +1,3 @@ +FROM openjdk:8-jdk-alpine +COPY target/order-service-async-0.0.1-SNAPSHOT.jar app.jar +ENTRYPOINT ["java","-jar","-Dspring.profiles.active=docker","/app.jar"] \ No newline at end of file diff --git a/reactive-systems/order-service/HELP.md b/reactive-systems/order-service/HELP.md new file mode 100644 index 0000000000..53d5801551 --- /dev/null +++ b/reactive-systems/order-service/HELP.md @@ -0,0 +1,11 @@ +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/#build-image) +* [Spring Data Reactive MongoDB](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/htmlsingle/#boot-features-mongodb) +* [Spring for Apache Kafka](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/htmlsingle/#boot-features-kafka) + diff --git a/reactive-systems/order-service/mvnw b/reactive-systems/order-service/mvnw new file mode 100644 index 0000000000..a16b5431b4 --- /dev/null +++ b/reactive-systems/order-service/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/reactive-systems/order-service/mvnw.cmd b/reactive-systems/order-service/mvnw.cmd new file mode 100644 index 0000000000..c8d43372c9 --- /dev/null +++ b/reactive-systems/order-service/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/reactive-systems/order-service/pom.xml b/reactive-systems/order-service/pom.xml new file mode 100644 index 0000000000..c793f448b5 --- /dev/null +++ b/reactive-systems/order-service/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + com.baeldung.reactive + order-service + order-service + Demo project for Spring Boot + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-data-mongodb-reactive + + + org.springframework.boot + spring-boot-starter-webflux + + + org.springframework.kafka + spring-kafka + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + io.projectreactor + reactor-test + test + + + org.springframework.kafka + spring-kafka-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/AsyncApplication.java b/reactive-systems/order-service/src/main/java/com/baeldung/AsyncApplication.java new file mode 100644 index 0000000000..892122984e --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/AsyncApplication.java @@ -0,0 +1,25 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; + +@SpringBootApplication +public class AsyncApplication { + + public static void main(String[] args) { + SpringApplication.run(AsyncApplication.class, args); + } + + @ControllerAdvice + public class ExceptionController { + @ExceptionHandler(value = RuntimeException.class) + public ResponseEntity exception(RuntimeException exception) { + return new ResponseEntity<>(exception.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); + } + } + +} diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java b/reactive-systems/order-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java new file mode 100644 index 0000000000..31599f76ba --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java @@ -0,0 +1,66 @@ +package com.baeldung.async.consumer; + +import java.io.IOException; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Service; + +import com.baeldung.async.producer.OrderProducer; +import com.baeldung.constants.OrderStatus; +import com.baeldung.domain.Order; +import com.baeldung.reactive.repository.OrderRepository; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class OrderConsumer { + + @Autowired + OrderRepository orderRepository; + + @Autowired + OrderProducer orderProducer; + + @KafkaListener(topics = "orders", groupId = "orders") + public void consume(Order order) throws IOException { + log.info("Order received to process: {}", order); + if (OrderStatus.INITIATION_SUCCESS.equals(order.getOrderStatus())) { + orderRepository.findById(order.getId()) + .map(o -> { + orderProducer.sendMessage(o.setOrderStatus(OrderStatus.RESERVE_INVENTORY)); + return o.setOrderStatus(order.getOrderStatus()) + .setResponseMessage(order.getResponseMessage()); + }) + .flatMap(orderRepository::save) + .subscribe(); + } else if (OrderStatus.INVENTORY_SUCCESS.equals(order.getOrderStatus())) { + orderRepository.findById(order.getId()) + .map(o -> { + orderProducer.sendMessage(o.setOrderStatus(OrderStatus.PREPARE_SHIPPING)); + return o.setOrderStatus(order.getOrderStatus()) + .setResponseMessage(order.getResponseMessage()); + }) + .flatMap(orderRepository::save) + .subscribe(); + } else if (OrderStatus.SHIPPING_FAILURE.equals(order.getOrderStatus())) { + orderRepository.findById(order.getId()) + .map(o -> { + orderProducer.sendMessage(o.setOrderStatus(OrderStatus.REVERT_INVENTORY)); + return o.setOrderStatus(order.getOrderStatus()) + .setResponseMessage(order.getResponseMessage()); + }) + .flatMap(orderRepository::save) + .subscribe(); + } else { + orderRepository.findById(order.getId()) + .map(o -> { + return o.setOrderStatus(order.getOrderStatus()) + .setResponseMessage(order.getResponseMessage()); + }) + .flatMap(orderRepository::save) + .subscribe(); + } + } +} \ No newline at end of file diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/async/producer/OrderProducer.java b/reactive-systems/order-service/src/main/java/com/baeldung/async/producer/OrderProducer.java new file mode 100644 index 0000000000..082d274ab0 --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/async/producer/OrderProducer.java @@ -0,0 +1,23 @@ +package com.baeldung.async.producer; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.stereotype.Service; + +import com.baeldung.domain.Order; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class OrderProducer { + + @Autowired + private KafkaTemplate kafkaTemplate; + + public void sendMessage(Order order) { + log.info("Order processed to dispatch: {}", order); + this.kafkaTemplate.send("orders", order); + } + +} diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/constants/OrderStatus.java b/reactive-systems/order-service/src/main/java/com/baeldung/constants/OrderStatus.java new file mode 100644 index 0000000000..030d302e2e --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/constants/OrderStatus.java @@ -0,0 +1,7 @@ +package com.baeldung.constants; + +public enum OrderStatus { + + SUCCESS, FAILURE, INITIATION_SUCCESS, RESERVE_INVENTORY, REVERT_INVENTORY, INVENTORY_SUCCESS, INVENTORY_FAILURE, INVENTORY_REVERT_SUCCESS, INVENTORY_REVERT_FAILURE, PREPARE_SHIPPING, SHIPPING_SUCCESS, SHIPPING_FAILURE, + +} diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/domain/Address.java b/reactive-systems/order-service/src/main/java/com/baeldung/domain/Address.java new file mode 100644 index 0000000000..987803d9c1 --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/domain/Address.java @@ -0,0 +1,14 @@ +package com.baeldung.domain; + +import lombok.Data; + +@Data +public class Address { + + private String name; + private String house; + private String street; + private String city; + private String zip; + +} diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/domain/LineItem.java b/reactive-systems/order-service/src/main/java/com/baeldung/domain/LineItem.java new file mode 100644 index 0000000000..0a475aed8d --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/domain/LineItem.java @@ -0,0 +1,29 @@ +package com.baeldung.domain; + +import org.bson.types.ObjectId; + +import com.baeldung.serdeser.ObjectIdSerializer; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import lombok.Data; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class LineItem { + + @JsonSerialize(using = ObjectIdSerializer.class) + private ObjectId productId; + private int quantity; + + public LineItem setProductId(ObjectId productId) { + this.productId = productId; + return this; + } + + public LineItem setQuantity(int quantity) { + this.quantity = quantity; + return this; + } + +} diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/domain/Order.java b/reactive-systems/order-service/src/main/java/com/baeldung/domain/Order.java new file mode 100644 index 0000000000..2176aceb89 --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/domain/Order.java @@ -0,0 +1,52 @@ +package com.baeldung.domain; + +import java.util.Date; +import java.util.List; + +import org.bson.types.ObjectId; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import com.baeldung.constants.OrderStatus; +import com.baeldung.serdeser.ObjectIdSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import lombok.Data; + +@Data +@Document +public class Order { + + @Id + @JsonSerialize(using = ObjectIdSerializer.class) + private ObjectId id; + private String userId; + private List lineItems; + private Long total; + private String paymentMode; + private Address shippingAddress; + private Date shippingDate; + private OrderStatus orderStatus; + private String responseMessage; + + public Order setLineItems(List lineItems) { + this.lineItems = lineItems; + return this; + } + + public Order setShippingDate(Date shippingDate) { + this.shippingDate = shippingDate; + return this; + } + + public Order setOrderStatus(OrderStatus orderStatus) { + this.orderStatus = orderStatus; + return this; + } + + public Order setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + return this; + } + +} diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/reactive/controller/OrderController.java b/reactive-systems/order-service/src/main/java/com/baeldung/reactive/controller/OrderController.java new file mode 100644 index 0000000000..2aea36820b --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/reactive/controller/OrderController.java @@ -0,0 +1,47 @@ +package com.baeldung.reactive.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.constants.OrderStatus; +import com.baeldung.domain.Order; +import com.baeldung.reactive.service.OrderService; + +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@Slf4j +@RestController +@CrossOrigin(origins = "*") +@RequestMapping("/api/orders") +public class OrderController { + + @Autowired + private OrderService orderService; + + @PostMapping + public Mono create(@RequestBody Order order) { + log.info("Create order invoked with: {}", order); + return orderService.createOrder(order) + .flatMap(o -> { + if (OrderStatus.FAILURE.equals(o.getOrderStatus())) { + return Mono.error(new RuntimeException("Order processing failed, please try again later. " + o.getResponseMessage())); + } else { + return Mono.just(o); + } + }); + } + + @GetMapping + public Flux getAll() { + log.info("Get all orders invoked."); + return orderService.getOrders(); + } + +} \ No newline at end of file diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/reactive/repository/OrderRepository.java b/reactive-systems/order-service/src/main/java/com/baeldung/reactive/repository/OrderRepository.java new file mode 100644 index 0000000000..f461813a65 --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/reactive/repository/OrderRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.reactive.repository; + +import org.bson.types.ObjectId; +import org.springframework.data.mongodb.repository.ReactiveMongoRepository; + +import com.baeldung.domain.Order; + +public interface OrderRepository extends ReactiveMongoRepository { + +} diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/reactive/service/OrderService.java b/reactive-systems/order-service/src/main/java/com/baeldung/reactive/service/OrderService.java new file mode 100644 index 0000000000..625345cb4e --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/reactive/service/OrderService.java @@ -0,0 +1,52 @@ +package com.baeldung.reactive.service; + +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baeldung.async.producer.OrderProducer; +import com.baeldung.constants.OrderStatus; +import com.baeldung.domain.Order; +import com.baeldung.reactive.repository.OrderRepository; + +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@Slf4j +@Service +public class OrderService { + + @Autowired + private OrderRepository orderRepository; + + @Autowired + private OrderProducer orderProducer; + + public Mono createOrder(Order order) { + log.info("Create order invoked with: {}", order); + return Mono.just(order) + .map(o -> { + return o.setLineItems(o.getLineItems() + .stream() + .filter(l -> l.getQuantity() > 0) + .collect(Collectors.toList())); + }) + .flatMap(orderRepository::save) + .map(o -> { + orderProducer.sendMessage(o.setOrderStatus(OrderStatus.INITIATION_SUCCESS)); + return o; + }) + .onErrorResume(err -> { + return Mono.just(order.setOrderStatus(OrderStatus.FAILURE) + .setResponseMessage(err.getMessage())); + }) + .flatMap(orderRepository::save); + } + + public Flux getOrders() { + log.info("Get all orders invoked."); + return orderRepository.findAll(); + } +} diff --git a/reactive-systems/order-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java b/reactive-systems/order-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java new file mode 100644 index 0000000000..0b0b743e7e --- /dev/null +++ b/reactive-systems/order-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java @@ -0,0 +1,20 @@ +package com.baeldung.serdeser; + +import java.io.IOException; + +import org.bson.types.ObjectId; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +@Component +public class ObjectIdSerializer extends JsonSerializer { + + @Override + public void serialize(ObjectId value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeString(value.toString()); + } +} diff --git a/reactive-systems/order-service/src/main/resources/application-docker.properties b/reactive-systems/order-service/src/main/resources/application-docker.properties new file mode 100644 index 0000000000..326c86af7b --- /dev/null +++ b/reactive-systems/order-service/src/main/resources/application-docker.properties @@ -0,0 +1,7 @@ +server.port=8080 +spring.data.mongodb.uri=mongodb://mongo-db:27017/reactive-systems +spring.kafka.bootstrap-servers=kafka-broker:9092 +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.producer.properties.spring.json.add.type.headers=false +spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer +spring.kafka.consumer.properties.spring.json.value.default.type=com.baeldung.domain.Order \ No newline at end of file diff --git a/reactive-systems/order-service/src/main/resources/application.properties b/reactive-systems/order-service/src/main/resources/application.properties new file mode 100644 index 0000000000..759ba14164 --- /dev/null +++ b/reactive-systems/order-service/src/main/resources/application.properties @@ -0,0 +1,7 @@ +server.port=8080 +spring.data.mongodb.uri=mongodb://localhost:27017/reactive-systems +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.producer.properties.spring.json.add.type.headers=false +spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer +spring.kafka.consumer.properties.spring.json.value.default.type=com.baeldung.domain.Order \ No newline at end of file diff --git a/reactive-systems/pom.xml b/reactive-systems/pom.xml new file mode 100644 index 0000000000..bce2575d9e --- /dev/null +++ b/reactive-systems/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + reactive-systems + 0.0.1-SNAPSHOT + reactive-systems + pom + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + inventory-service + shipping-service + order-service + + + diff --git a/reactive-systems/shipping-service/.mvn/wrapper/MavenWrapperDownloader.java b/reactive-systems/shipping-service/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000000..e76d1f3241 --- /dev/null +++ b/reactive-systems/shipping-service/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/reactive-systems/shipping-service/.mvn/wrapper/maven-wrapper.jar b/reactive-systems/shipping-service/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054 GIT binary patch literal 50710 zcmbTd1CVCTmM+|7+wQV$+qP}n>auOywyU~q+qUhh+uxis_~*a##hm*_WW?9E7Pb7N%LRFiwbEGCJ0XP=%-6oeT$XZcYgtzC2~q zk(K08IQL8oTl}>>+hE5YRgXTB@fZ4TH9>7=79e`%%tw*SQUa9~$xKD5rS!;ZG@ocK zQdcH}JX?W|0_Afv?y`-NgLum62B&WSD$-w;O6G0Sm;SMX65z)l%m1e-g8Q$QTI;(Q z+x$xth4KFvH@Bs6(zn!iF#nenk^Y^ce;XIItAoCsow38eq?Y-Auh!1in#Rt-_D>H^ z=EjbclGGGa6VnaMGmMLj`x3NcwA43Jb(0gzl;RUIRAUDcR1~99l2SAPkVhoRMMtN} zXvC<tOmX83grD8GSo_Lo?%lNfhD#EBgPo z*nf@ppMC#B!T)Ae0RG$mlJWmGl7CkuU~B8-==5i;rS;8i6rJ=PoQxf446XDX9g|c> zU64ePyMlsI^V5Jq5A+BPe#e73+kpc_r1tv#B)~EZ;7^67F0*QiYfrk0uVW;Qb=NsG zN>gsuCwvb?s-KQIppEaeXtEMdc9dy6Dfduz-tMTms+i01{eD9JE&h?Kht*$eOl#&L zJdM_-vXs(V#$Ed;5wyNWJdPNh+Z$+;$|%qR(t`4W@kDhd*{(7-33BOS6L$UPDeE_53j${QfKN-0v-HG z(QfyvFNbwPK%^!eIo4ac1;b>c0vyf9}Xby@YY!lkz-UvNp zwj#Gg|4B~?n?G^{;(W;|{SNoJbHTMpQJ*Wq5b{l9c8(%?Kd^1?H1om1de0Da9M;Q=n zUfn{f87iVb^>Exl*nZ0hs(Yt>&V9$Pg`zX`AI%`+0SWQ4Zc(8lUDcTluS z5a_KerZWe}a-MF9#Cd^fi!y3%@RFmg&~YnYZ6<=L`UJ0v={zr)>$A;x#MCHZy1st7 ztT+N07NR+vOwSV2pvWuN1%lO!K#Pj0Fr>Q~R40{bwdL%u9i`DSM4RdtEH#cW)6}+I-eE< z&tZs+(Ogu(H_;$a$!7w`MH0r%h&@KM+<>gJL@O~2K2?VrSYUBbhCn#yy?P)uF3qWU z0o09mIik+kvzV6w>vEZy@&Mr)SgxPzUiDA&%07m17udz9usD82afQEps3$pe!7fUf z0eiidkJ)m3qhOjVHC_M(RYCBO%CZKZXFb8}s0-+}@CIn&EF(rRWUX2g^yZCvl0bI} zbP;1S)iXnRC&}5-Tl(hASKqdSnO?ASGJ*MIhOXIblmEudj(M|W!+I3eDc}7t`^mtg z)PKlaXe(OH+q-)qcQ8a@!llRrpGI8DsjhoKvw9T;TEH&?s=LH0w$EzI>%u;oD@x83 zJL7+ncjI9nn!TlS_KYu5vn%f*@qa5F;| zEFxY&B?g=IVlaF3XNm_03PA)=3|{n-UCgJoTr;|;1AU9|kPE_if8!Zvb}0q$5okF$ zHaJdmO&gg!9oN|M{!qGE=tb|3pVQ8PbL$}e;NgXz<6ZEggI}wO@aBP**2Wo=yN#ZC z4G$m^yaM9g=|&!^ft8jOLuzc3Psca*;7`;gnHm}tS0%f4{|VGEwu45KptfNmwxlE~ z^=r30gi@?cOm8kAz!EylA4G~7kbEiRlRIzwrb~{_2(x^$-?|#e6Bi_**(vyr_~9Of z!n>Gqf+Qwiu!xhi9f53=PM3`3tNF}pCOiPU|H4;pzjcsqbwg*{{kyrTxk<;mx~(;; z1NMrpaQ`57yn34>Jo3b|HROE(UNcQash!0p2-!Cz;{IRv#Vp5!3o$P8!%SgV~k&Hnqhp`5eLjTcy93cK!3Hm-$`@yGnaE=?;*2uSpiZTs_dDd51U%i z{|Zd9ou-;laGS_x=O}a+ zB||za<795A?_~Q=r=coQ+ZK@@ zId~hWQL<%)fI_WDIX#=(WNl!Dm$a&ROfLTd&B$vatq!M-2Jcs;N2vps$b6P1(N}=oI3<3luMTmC|0*{ zm1w8bt7vgX($!0@V0A}XIK)w!AzUn7vH=pZEp0RU0p?}ch2XC-7r#LK&vyc2=-#Q2 z^L%8)JbbcZ%g0Du;|8=q8B>X=mIQirpE=&Ox{TiuNDnOPd-FLI^KfEF729!!0x#Es z@>3ursjFSpu%C-8WL^Zw!7a0O-#cnf`HjI+AjVCFitK}GXO`ME&on|^=~Zc}^LBp9 zj=-vlN;Uc;IDjtK38l7}5xxQF&sRtfn4^TNtnzXv4M{r&ek*(eNbIu!u$>Ed%` z5x7+&)2P&4>0J`N&ZP8$vcR+@FS0126s6+Jx_{{`3ZrIMwaJo6jdrRwE$>IU_JTZ} z(||hyyQ)4Z1@wSlT94(-QKqkAatMmkT7pCycEB1U8KQbFX&?%|4$yyxCtm3=W`$4fiG0WU3yI@c zx{wfmkZAYE_5M%4{J-ygbpH|(|GD$2f$3o_Vti#&zfSGZMQ5_f3xt6~+{RX=$H8at z?GFG1Tmp}}lmm-R->ve*Iv+XJ@58p|1_jRvfEgz$XozU8#iJS})UM6VNI!3RUU!{5 zXB(+Eqd-E;cHQ>)`h0(HO_zLmzR3Tu-UGp;08YntWwMY-9i^w_u#wR?JxR2bky5j9 z3Sl-dQQU$xrO0xa&>vsiK`QN<$Yd%YXXM7*WOhnRdSFt5$aJux8QceC?lA0_if|s> ze{ad*opH_kb%M&~(~&UcX0nFGq^MqjxW?HJIP462v9XG>j(5Gat_)#SiNfahq2Mz2 zU`4uV8m$S~o9(W>mu*=h%Gs(Wz+%>h;R9Sg)jZ$q8vT1HxX3iQnh6&2rJ1u|j>^Qf`A76K%_ubL`Zu?h4`b=IyL>1!=*%!_K)=XC z6d}4R5L+sI50Q4P3upXQ3Z!~1ZXLlh!^UNcK6#QpYt-YC=^H=EPg3)z*wXo*024Q4b2sBCG4I# zlTFFY=kQ>xvR+LsuDUAk)q%5pEcqr(O_|^spjhtpb1#aC& zghXzGkGDC_XDa%t(X`E+kvKQ4zrQ*uuQoj>7@@ykWvF332)RO?%AA&Fsn&MNzmFa$ zWk&&^=NNjxLjrli_8ESU)}U|N{%j&TQmvY~lk!~Jh}*=^INA~&QB9em!in_X%Rl1&Kd~Z(u z9mra#<@vZQlOY+JYUwCrgoea4C8^(xv4ceCXcejq84TQ#sF~IU2V}LKc~Xlr_P=ry zl&Hh0exdCbVd^NPCqNNlxM3vA13EI8XvZ1H9#bT7y*U8Y{H8nwGpOR!e!!}*g;mJ#}T{ekSb}5zIPmye*If(}}_=PcuAW#yidAa^9-`<8Gr0 z)Fz=NiZ{)HAvw{Pl5uu)?)&i&Us$Cx4gE}cIJ}B4Xz~-q7)R_%owbP!z_V2=Aq%Rj z{V;7#kV1dNT9-6R+H}}(ED*_!F=~uz>&nR3gb^Ce%+0s#u|vWl<~JD3MvS0T9thdF zioIG3c#Sdsv;LdtRv3ml7%o$6LTVL>(H`^@TNg`2KPIk*8-IB}X!MT0`hN9Ddf7yN z?J=GxPL!uJ7lqwowsl?iRrh@#5C$%E&h~Z>XQcvFC*5%0RN-Opq|=IwX(dq(*sjs+ zqy99+v~m|6T#zR*e1AVxZ8djd5>eIeCi(b8sUk)OGjAsKSOg^-ugwl2WSL@d#?mdl zib0v*{u-?cq}dDGyZ%$XRY=UkQwt2oGu`zQneZh$=^! zj;!pCBWQNtvAcwcWIBM2y9!*W|8LmQy$H~5BEx)78J`4Z0(FJO2P^!YyQU{*Al+fs z){!4JvT1iLrJ8aU3k0t|P}{RN)_^v%$$r;+p0DY7N8CXzmS*HB*=?qaaF9D@#_$SN zSz{moAK<*RH->%r7xX~9gVW$l7?b|_SYI)gcjf0VAUJ%FcQP(TpBs; zg$25D!Ry_`8xpS_OJdeo$qh#7U+cepZ??TII7_%AXsT$B z=e)Bx#v%J0j``00Zk5hsvv6%T^*xGNx%KN-=pocSoqE5_R)OK%-Pbu^1MNzfds)mL zxz^F4lDKV9D&lEY;I+A)ui{TznB*CE$=9(wgE{m}`^<--OzV-5V4X2w9j(_!+jpTr zJvD*y6;39&T+==$F&tsRKM_lqa1HC}aGL0o`%c9mO=fts?36@8MGm7Vi{Y z^<7m$(EtdSr#22<(rm_(l_(`j!*Pu~Y>>xc>I9M#DJYDJNHO&4=HM%YLIp?;iR&$m z#_$ZWYLfGLt5FJZhr3jpYb`*%9S!zCG6ivNHYzNHcI%khtgHBliM^Ou}ZVD7ehU9 zS+W@AV=?Ro!=%AJ>Kcy9aU3%VX3|XM_K0A+ZaknKDyIS3S-Hw1C7&BSW5)sqj5Ye_ z4OSW7Yu-;bCyYKHFUk}<*<(@TH?YZPHr~~Iy%9@GR2Yd}J2!N9K&CN7Eq{Ka!jdu; zQNB*Y;i(7)OxZK%IHGt#Rt?z`I|A{q_BmoF!f^G}XVeTbe1Wnzh%1g>j}>DqFf;Rp zz7>xIs12@Ke0gr+4-!pmFP84vCIaTjqFNg{V`5}Rdt~xE^I;Bxp4)|cs8=f)1YwHz zqI`G~s2~qqDV+h02b`PQpUE#^^Aq8l%y2|ByQeXSADg5*qMprEAE3WFg0Q39`O+i1 z!J@iV!`Y~C$wJ!5Z+j5$i<1`+@)tBG$JL=!*uk=2k;T<@{|s1$YL079FvK%mPhyHV zP8^KGZnp`(hVMZ;s=n~3r2y;LTwcJwoBW-(ndU-$03{RD zh+Qn$ja_Z^OuMf3Ub|JTY74s&Am*(n{J3~@#OJNYuEVVJd9*H%)oFoRBkySGm`hx! zT3tG|+aAkXcx-2Apy)h^BkOyFTWQVeZ%e2@;*0DtlG9I3Et=PKaPt&K zw?WI7S;P)TWED7aSH$3hL@Qde?H#tzo^<(o_sv_2ci<7M?F$|oCFWc?7@KBj-;N$P zB;q!8@bW-WJY9do&y|6~mEruZAVe$!?{)N9rZZxD-|oltkhW9~nR8bLBGXw<632!l z*TYQn^NnUy%Ds}$f^=yQ+BM-a5X4^GHF=%PDrRfm_uqC zh{sKwIu|O0&jWb27;wzg4w5uA@TO_j(1X?8E>5Zfma|Ly7Bklq|s z9)H`zoAGY3n-+&JPrT!>u^qg9Evx4y@GI4$n-Uk_5wttU1_t?6><>}cZ-U+&+~JE) zPlDbO_j;MoxdLzMd~Ew|1o^a5q_1R*JZ=#XXMzg?6Zy!^hop}qoLQlJ{(%!KYt`MK z8umEN@Z4w!2=q_oe=;QttPCQy3Nm4F@x>@v4sz_jo{4m*0r%J(w1cSo;D_hQtJs7W z><$QrmG^+<$4{d2bgGo&3-FV}avg9zI|Rr(k{wTyl3!M1q+a zD9W{pCd%il*j&Ft z5H$nENf>>k$;SONGW`qo6`&qKs*T z2^RS)pXk9b@(_Fw1bkb)-oqK|v}r$L!W&aXA>IpcdNZ_vWE#XO8X`#Yp1+?RshVcd zknG%rPd*4ECEI0wD#@d+3NbHKxl}n^Sgkx==Iu%}HvNliOqVBqG?P2va zQ;kRJ$J6j;+wP9cS za#m;#GUT!qAV%+rdWolk+)6kkz4@Yh5LXP+LSvo9_T+MmiaP-eq6_k;)i6_@WSJ zlT@wK$zqHu<83U2V*yJ|XJU4farT#pAA&@qu)(PO^8PxEmPD4;Txpio+2)#!9 z>&=i7*#tc0`?!==vk>s7V+PL#S1;PwSY?NIXN2=Gu89x(cToFm))7L;< z+bhAbVD*bD=}iU`+PU+SBobTQ%S!=VL!>q$rfWsaaV}Smz>lO9JXT#`CcH_mRCSf4%YQAw`$^yY z3Y*^Nzk_g$xn7a_NO(2Eb*I=^;4f!Ra#Oo~LLjlcjke*k*o$~U#0ZXOQ5@HQ&T46l z7504MUgZkz2gNP1QFN8Y?nSEnEai^Rgyvl}xZfMUV6QrJcXp;jKGqB=D*tj{8(_pV zqyB*DK$2lgYGejmJUW)*s_Cv65sFf&pb(Yz8oWgDtQ0~k^0-wdF|tj}MOXaN@ydF8 zNr={U?=;&Z?wr^VC+`)S2xl}QFagy;$mG=TUs7Vi2wws5zEke4hTa2)>O0U?$WYsZ z<8bN2bB_N4AWd%+kncgknZ&}bM~eDtj#C5uRkp21hWW5gxWvc6b*4+dn<{c?w9Rmf zIVZKsPl{W2vQAlYO3yh}-{Os=YBnL8?uN5(RqfQ=-1cOiUnJu>KcLA*tQK3FU`_bM zM^T28w;nAj5EdAXFi&Kk1Nnl2)D!M{@+D-}bIEe+Lc4{s;YJc-{F#``iS2uk;2!Zp zF9#myUmO!wCeJIoi^A+T^e~20c+c2C}XltaR!|U-HfDA=^xF97ev}$l6#oY z&-&T{egB)&aV$3_aVA51XGiU07$s9vubh_kQG?F$FycvS6|IO!6q zq^>9|3U^*!X_C~SxX&pqUkUjz%!j=VlXDo$!2VLH!rKj@61mDpSr~7B2yy{>X~_nc zRI+7g2V&k zd**H++P9dg!-AOs3;GM`(g<+GRV$+&DdMVpUxY9I1@uK28$az=6oaa+PutlO9?6#? zf-OsgT>^@8KK>ggkUQRPPgC7zjKFR5spqQb3ojCHzj^(UH~v+!y*`Smv)VpVoPwa6 zWG18WJaPKMi*F6Zdk*kU^`i~NNTfn3BkJniC`yN98L-Awd)Z&mY? zprBW$!qL-OL7h@O#kvYnLsfff@kDIegt~?{-*5A7JrA;#TmTe?jICJqhub-G@e??D zqiV#g{)M!kW1-4SDel7TO{;@*h2=_76g3NUD@|c*WO#>MfYq6_YVUP+&8e4|%4T`w zXzhmVNziAHazWO2qXcaOu@R1MrPP{t)`N)}-1&~mq=ZH=w=;-E$IOk=y$dOls{6sRR`I5>|X zpq~XYW4sd;J^6OwOf**J>a7u$S>WTFPRkjY;BfVgQst)u4aMLR1|6%)CB^18XCz+r ztkYQ}G43j~Q&1em(_EkMv0|WEiKu;z2zhb(L%$F&xWwzOmk;VLBYAZ8lOCziNoPw1 zv2BOyXA`A8z^WH!nXhKXM`t0;6D*-uGds3TYGrm8SPnJJOQ^fJU#}@aIy@MYWz**H zvkp?7I5PE{$$|~{-ZaFxr6ZolP^nL##mHOErB^AqJqn^hFA=)HWj!m3WDaHW$C)i^ z9@6G$SzB=>jbe>4kqr#sF7#K}W*Cg-5y6kun3u&0L7BpXF9=#7IN8FOjWrWwUBZiU zT_se3ih-GBKx+Uw0N|CwP3D@-C=5(9T#BH@M`F2!Goiqx+Js5xC92|Sy0%WWWp={$(am!#l~f^W_oz78HX<0X#7 zp)p1u~M*o9W@O8P{0Qkg@Wa# z2{Heb&oX^CQSZWSFBXKOfE|tsAm#^U-WkDnU;IowZ`Ok4!mwHwH=s|AqZ^YD4!5!@ zPxJj+Bd-q6w_YG`z_+r;S86zwXb+EO&qogOq8h-Ect5(M2+>(O7n7)^dP*ws_3U6v zVsh)sk^@*c>)3EML|0<-YROho{lz@Nd4;R9gL{9|64xVL`n!m$-Jjrx?-Bacp!=^5 z1^T^eB{_)Y<9)y{-4Rz@9_>;_7h;5D+@QcbF4Wv7hu)s0&==&6u)33 zHRj+&Woq-vDvjwJCYES@$C4{$?f$Ibi4G()UeN11rgjF+^;YE^5nYprYoJNoudNj= zm1pXSeG64dcWHObUetodRn1Fw|1nI$D9z}dVEYT0lQnsf_E1x2vBLql7NrHH!n&Sq z6lc*mvU=WS6=v9Lrl}&zRiu_6u;6g%_DU{9b+R z#YHqX7`m9eydf?KlKu6Sb%j$%_jmydig`B*TN`cZL-g!R)iE?+Q5oOqBFKhx z%MW>BC^(F_JuG(ayE(MT{S3eI{cKiwOtPwLc0XO*{*|(JOx;uQOfq@lp_^cZo=FZj z4#}@e@dJ>Bn%2`2_WPeSN7si^{U#H=7N4o%Dq3NdGybrZgEU$oSm$hC)uNDC_M9xc zGzwh5Sg?mpBIE8lT2XsqTt3j3?We8}3bzLBTQd639vyg^$0#1epq8snlDJP2(BF)K zSx30RM+{f+b$g{9usIL8H!hCO117Xgv}ttPJm9wVRjPk;ePH@zxv%j9k5`TzdXLeT zFgFX`V7cYIcBls5WN0Pf6SMBN+;CrQ(|EsFd*xtwr#$R{Z9FP`OWtyNsq#mCgZ7+P z^Yn$haBJ)r96{ZJd8vlMl?IBxrgh=fdq_NF!1{jARCVz>jNdC)H^wfy?R94#MPdUjcYX>#wEx+LB#P-#4S-%YH>t-j+w zOFTI8gX$ard6fAh&g=u&56%3^-6E2tpk*wx3HSCQ+t7+*iOs zPk5ysqE}i*cQocFvA68xHfL|iX(C4h*67@3|5Qwle(8wT&!&{8*{f%0(5gH+m>$tq zp;AqrP7?XTEooYG1Dzfxc>W%*CyL16q|fQ0_jp%%Bk^k!i#Nbi(N9&T>#M{gez_Ws zYK=l}adalV(nH}I_!hNeb;tQFk3BHX7N}}R8%pek^E`X}%ou=cx8InPU1EE0|Hen- zyw8MoJqB5=)Z%JXlrdTXAE)eqLAdVE-=>wGHrkRet}>3Yu^lt$Kzu%$3#(ioY}@Gu zjk3BZuQH&~7H+C*uX^4}F*|P89JX;Hg2U!pt>rDi(n(Qe-c}tzb0#6_ItoR0->LSt zR~UT<-|@TO%O`M+_e_J4wx7^)5_%%u+J=yF_S#2Xd?C;Ss3N7KY^#-vx+|;bJX&8r zD?|MetfhdC;^2WG`7MCgs>TKKN=^=!x&Q~BzmQio_^l~LboTNT=I zC5pme^P@ER``p$2md9>4!K#vV-Fc1an7pl>_|&>aqP}+zqR?+~Z;f2^`a+-!Te%V? z;H2SbF>jP^GE(R1@%C==XQ@J=G9lKX+Z<@5}PO(EYkJh=GCv#)Nj{DkWJM2}F&oAZ6xu8&g7pn1ps2U5srwQ7CAK zN&*~@t{`31lUf`O;2w^)M3B@o)_mbRu{-`PrfNpF!R^q>yTR&ETS7^-b2*{-tZAZz zw@q5x9B5V8Qd7dZ!Ai$9hk%Q!wqbE1F1c96&zwBBaRW}(^axoPpN^4Aw}&a5dMe+*Gomky_l^54*rzXro$ z>LL)U5Ry>~FJi=*{JDc)_**c)-&faPz`6v`YU3HQa}pLtb5K)u%K+BOqXP0)rj5Au$zB zW1?vr?mDv7Fsxtsr+S6ucp2l#(4dnr9sD*v+@*>g#M4b|U?~s93>Pg{{a5|rm2xfI z`>E}?9S@|IoUX{Q1zjm5YJT|3S>&09D}|2~BiMo=z4YEjXlWh)V&qs;*C{`UMxp$9 zX)QB?G$fPD6z5_pNs>Jeh{^&U^)Wbr?2D6-q?)`*1k@!UvwQgl8eG$r+)NnFoT)L6 zg7lEh+E6J17krfYJCSjWzm67hEth24pomhz71|Qodn#oAILN)*Vwu2qpJirG)4Wnv}9GWOFrQg%Je+gNrPl8mw7ykE8{ z=|B4+uwC&bpp%eFcRU6{mxRV32VeH8XxX>v$du<$(DfinaaWxP<+Y97Z#n#U~V zVEu-GoPD=9$}P;xv+S~Ob#mmi$JQmE;Iz4(){y*9pFyW-jjgdk#oG$fl4o9E8bo|L zWjo4l%n51@Kz-n%zeSCD`uB?T%FVk+KBI}=ve zvlcS#wt`U6wrJo}6I6Rwb=1GzZfwE=I&Ne@p7*pH84XShXYJRgvK)UjQL%R9Zbm(m zxzTQsLTON$WO7vM)*vl%Pc0JH7WhP;$z@j=y#avW4X8iqy6mEYr@-}PW?H)xfP6fQ z&tI$F{NNct4rRMSHhaelo<5kTYq+(?pY)Ieh8*sa83EQfMrFupMM@nfEV@EmdHUv9 z35uzIrIuo4#WnF^_jcpC@uNNaYTQ~uZWOE6P@LFT^1@$o&q+9Qr8YR+ObBkpP9=F+$s5+B!mX2~T zAuQ6RenX?O{IlLMl1%)OK{S7oL}X%;!XUxU~xJN8xk z`xywS*naF(J#?vOpB(K=o~lE;m$zhgPWDB@=p#dQIW>xe_p1OLoWInJRKbEuoncf; zmS1!u-ycc1qWnDg5Nk2D)BY%jmOwCLC+Ny>`f&UxFowIsHnOXfR^S;&F(KXd{ODlm z$6#1ccqt-HIH9)|@fHnrKudu!6B$_R{fbCIkSIb#aUN|3RM>zuO>dpMbROZ`^hvS@ z$FU-;e4W}!ubzKrU@R*dW*($tFZ>}dd*4_mv)#O>X{U@zSzQt*83l9mI zI$8O<5AIDx`wo0}f2fsPC_l>ONx_`E7kdXu{YIZbp1$(^oBAH({T~&oQ&1{X951QW zmhHUxd)t%GQ9#ak5fTjk-cahWC;>^Rg7(`TVlvy0W@Y!Jc%QL3Ozu# zDPIqBCy&T2PWBj+d-JA-pxZlM=9ja2ce|3B(^VCF+a*MMp`(rH>Rt6W1$;r{n1(VK zLs>UtkT43LR2G$AOYHVailiqk7naz2yZGLo*xQs!T9VN5Q>eE(w zw$4&)&6xIV$IO^>1N-jrEUg>O8G4^@y+-hQv6@OmF@gy^nL_n1P1-Rtyy$Bl;|VcV zF=p*&41-qI5gG9UhKmmnjs932!6hceXa#-qfK;3d*a{)BrwNFeKU|ge?N!;zk+kB! zMD_uHJR#%b54c2tr~uGPLTRLg$`fupo}cRJeTwK;~}A>(Acy4k-Xk&Aa1&eWYS1ULWUj@fhBiWY$pdfy+F z@G{OG{*v*mYtH3OdUjwEr6%_ZPZ3P{@rfbNPQG!BZ7lRyC^xlMpWH`@YRar`tr}d> z#wz87t?#2FsH-jM6m{U=gp6WPrZ%*w0bFm(T#7m#v^;f%Z!kCeB5oiF`W33W5Srdt zdU?YeOdPG@98H7NpI{(uN{FJdu14r(URPH^F6tOpXuhU7T9a{3G3_#Ldfx_nT(Hec zo<1dyhsVsTw;ZkVcJ_0-h-T3G1W@q)_Q30LNv)W?FbMH+XJ* zy=$@39Op|kZv`Rt>X`zg&at(?PO^I=X8d9&myFEx#S`dYTg1W+iE?vt#b47QwoHI9 zNP+|3WjtXo{u}VG(lLUaW0&@yD|O?4TS4dfJI`HC-^q;M(b3r2;7|FONXphw-%7~* z&;2!X17|05+kZOpQ3~3!Nb>O94b&ZSs%p)TK)n3m=4eiblVtSx@KNFgBY_xV6ts;NF;GcGxMP8OKV^h6LmSb2E#Qnw ze!6Mnz7>lE9u{AgQ~8u2zM8CYD5US8dMDX-5iMlgpE9m*s+Lh~A#P1er*rF}GHV3h z=`STo?kIXw8I<`W0^*@mB1$}pj60R{aJ7>C2m=oghKyxMbFNq#EVLgP0cH3q7H z%0?L93-z6|+jiN|@v>ix?tRBU(v-4RV`}cQH*fp|)vd3)8i9hJ3hkuh^8dz{F5-~_ zUUr1T3cP%cCaTooM8dj|4*M=e6flH0&8ve32Q)0dyisl))XkZ7Wg~N}6y`+Qi2l+e zUd#F!nJp{#KIjbQdI`%oZ`?h=5G^kZ_uN`<(`3;a!~EMsWV|j-o>c?x#;zR2ktiB! z);5rrHl?GPtr6-o!tYd|uK;Vbsp4P{v_4??=^a>>U4_aUXPWQ$FPLE4PK$T^3Gkf$ zHo&9$U&G`d(Os6xt1r?sg14n)G8HNyWa^q8#nf0lbr4A-Fi;q6t-`pAx1T*$eKM*$ z|CX|gDrk#&1}>5H+`EjV$9Bm)Njw&7-ZR{1!CJTaXuP!$Pcg69`{w5BRHysB$(tWUes@@6aM69kb|Lx$%BRY^-o6bjH#0!7b;5~{6J+jKxU!Kmi# zndh@+?}WKSRY2gZ?Q`{(Uj|kb1%VWmRryOH0T)f3cKtG4oIF=F7RaRnH0Rc_&372={_3lRNsr95%ZO{IX{p@YJ^EI%+gvvKes5cY+PE@unghjdY5#9A!G z70u6}?zmd?v+{`vCu-53_v5@z)X{oPC@P)iA3jK$`r zSA2a7&!^zmUiZ82R2=1cumBQwOJUPz5Ay`RLfY(EiwKkrx%@YN^^XuET;tE zmr-6~I7j!R!KrHu5CWGSChO6deaLWa*9LLJbcAJsFd%Dy>a!>J`N)Z&oiU4OEP-!Ti^_!p}O?7`}i7Lsf$-gBkuY*`Zb z7=!nTT;5z$_5$=J=Ko+Cp|Q0J=%oFr>hBgnL3!tvFoLNhf#D0O=X^h+x08iB;@8pXdRHxX}6R4k@i6%vmsQwu^5z zk1ip`#^N)^#Lg#HOW3sPI33xqFB4#bOPVnY%d6prwxf;Y-w9{ky4{O6&94Ra8VN@K zb-lY;&`HtxW@sF!doT5T$2&lIvJpbKGMuDAFM#!QPXW87>}=Q4J3JeXlwHys?!1^#37q_k?N@+u&Ns20pEoBeZC*np;i;M{2C0Z4_br2gsh6eL z#8`#sn41+$iD?^GL%5?cbRcaa-Nx0vE(D=*WY%rXy3B%gNz0l?#noGJGP728RMY#q z=2&aJf@DcR?QbMmN)ItUe+VM_U!ryqA@1VVt$^*xYt~-qvW!J4Tp<-3>jT=7Zow5M z8mSKp0v4b%a8bxFr>3MwZHSWD73D@+$5?nZAqGM#>H@`)mIeC#->B)P8T$zh-Pxnc z8)~Zx?TWF4(YfKuF3WN_ckpCe5;x4V4AA3(i$pm|78{%!q?|~*eH0f=?j6i)n~Hso zmTo>vqEtB)`%hP55INf7HM@taH)v`Fw40Ayc*R!T?O{ziUpYmP)AH`euTK!zg9*6Z z!>M=$3pd0!&TzU=hc_@@^Yd3eUQpX4-33}b{?~5t5lgW=ldJ@dUAH%`l5US1y_`40 zs(X`Qk}vvMDYYq+@Rm+~IyCX;iD~pMgq^KY)T*aBz@DYEB={PxA>)mI6tM*sx-DmGQHEaHwRrAmNjO!ZLHO4b;;5mf@zzlPhkP($JeZGE7 z?^XN}Gf_feGoG~BjUgVa*)O`>lX=$BSR2)uD<9 z>o^|nb1^oVDhQbfW>>!;8-7<}nL6L^V*4pB=>wwW+RXAeRvKED(n1;R`A6v$6gy0I(;Vf?!4;&sgn7F%LpM}6PQ?0%2Z@b{It<(G1CZ|>913E0nR2r^Pa*Bp z@tFGi*CQ~@Yc-?{cwu1 zsilf=k^+Qs>&WZG(3WDixisHpR>`+ihiRwkL(3T|=xsoNP*@XX3BU8hr57l3k;pni zI``=3Nl4xh4oDj<%>Q1zYXHr%Xg_xrK3Nq?vKX3|^Hb(Bj+lONTz>4yhU-UdXt2>j z<>S4NB&!iE+ao{0Tx^N*^|EZU;0kJkx@zh}S^P{ieQjGl468CbC`SWnwLRYYiStXm zOxt~Rb3D{dz=nHMcY)#r^kF8|q8KZHVb9FCX2m^X*(|L9FZg!5a7((!J8%MjT$#Fs)M1Pb zq6hBGp%O1A+&%2>l0mpaIzbo&jc^!oN^3zxap3V2dNj3x<=TwZ&0eKX5PIso9j1;e zwUg+C&}FJ`k(M|%%}p=6RPUq4sT3-Y;k-<68ciZ~_j|bt>&9ZLHNVrp#+pk}XvM{8 z`?k}o-!if>hVlCP9j%&WI2V`5SW)BCeR5>MQhF)po=p~AYN%cNa_BbV6EEh_kk^@a zD>4&>uCGCUmyA-c)%DIcF4R6!>?6T~Mj_m{Hpq`*(wj>foHL;;%;?(((YOxGt)Bhx zuS+K{{CUsaC++%}S6~CJ=|vr(iIs-je)e9uJEU8ZJAz)w166q)R^2XI?@E2vUQ!R% zn@dxS!JcOimXkWJBz8Y?2JKQr>`~SmE2F2SL38$SyR1^yqj8_mkBp)o$@+3BQ~Mid z9U$XVqxX3P=XCKj0*W>}L0~Em`(vG<>srF8+*kPrw z20{z(=^w+ybdGe~Oo_i|hYJ@kZl*(9sHw#Chi&OIc?w`nBODp?ia$uF%Hs(X>xm?j zqZQ`Ybf@g#wli`!-al~3GWiE$K+LCe=Ndi!#CVjzUZ z!sD2O*;d28zkl))m)YN7HDi^z5IuNo3^w(zy8 zszJG#mp#Cj)Q@E@r-=NP2FVxxEAeOI2e=|KshybNB6HgE^(r>HD{*}S}mO>LuRGJT{*tfTzw_#+er-0${}%YPe@CMJ1Ng#j#)i)SnY@ss3gL;g zg2D~#Kpdfu#G;q1qz_TwSz1VJT(b3zby$Vk&;Y#1(A)|xj`_?i5YQ;TR%jice5E;0 zYHg;`zS5{S*9xI6o^j>rE8Ua*XhIw{_-*&@(R|C(am8__>+Ws&Q^ymy*X4~hR2b5r zm^p3sw}yv=tdyncy_Ui7{BQS732et~Z_@{-IhHDXAV`(Wlay<#hb>%H%WDi+K$862nA@BDtM#UCKMu+kM`!JHyWSi?&)A7_ z3{cyNG%a~nnH_!+;g&JxEMAmh-Z}rC!o7>OVzW&PoMyTA_g{hqXG)SLraA^OP**<7 zjWbr7z!o2n3hnx7A=2O=WL;`@9N{vQIM@&|G-ljrPvIuJHYtss0Er0fT5cMXNUf1B z7FAwBDixt0X7C3S)mPe5g`YtME23wAnbU)+AtV}z+e8G;0BP=bI;?(#|Ep!vVfDbK zvx+|CKF>yt0hWQ3drchU#XBU+HiuG*V^snFAPUp-5<#R&BUAzoB!aZ+e*KIxa26V}s6?nBK(U-7REa573wg-jqCg>H8~>O{ z*C0JL-?X-k_y%hpUFL?I>0WV{oV`Nb)nZbJG01R~AG>flIJf)3O*oB2i8~;!P?Wo_ z0|QEB*fifiL6E6%>tlAYHm2cjTFE@*<);#>689Z6S#BySQ@VTMhf9vYQyLeDg1*F} zjq>i1*x>5|CGKN{l9br3kB0EHY|k4{%^t7-uhjd#NVipUZa=EUuE5kS1_~qYX?>hJ z$}!jc9$O$>J&wnu0SgfYods^z?J4X;X7c77Me0kS-dO_VUQ39T(Kv(Y#s}Qqz-0AH z^?WRL(4RzpkD+T5FG_0NyPq-a-B7A5LHOCqwObRJi&oRi(<;OuIN7SV5PeHU$<@Zh zPozEV`dYmu0Z&Tqd>t>8JVde9#Pt+l95iHe$4Xwfy1AhI zDM4XJ;bBTTvRFtW>E+GzkN)9k!hA5z;xUOL2 zq4}zn-DP{qc^i|Y%rvi|^5k-*8;JZ~9a;>-+q_EOX+p1Wz;>i7c}M6Nv`^NY&{J-> z`(mzDJDM}QPu5i44**2Qbo(XzZ-ZDu%6vm8w@DUarqXj41VqP~ zs&4Y8F^Waik3y1fQo`bVUH;b=!^QrWb)3Gl=QVKr+6sxc=ygauUG|cm?|X=;Q)kQ8 zM(xrICifa2p``I7>g2R~?a{hmw@{!NS5`VhH8+;cV(F>B94M*S;5#O`YzZH1Z%yD? zZ61w(M`#aS-*~Fj;x|J!KM|^o;MI#Xkh0ULJcA?o4u~f%Z^16ViA27FxU5GM*rKq( z7cS~MrZ=f>_OWx8j#-Q3%!aEU2hVuTu(7`TQk-Bi6*!<}0WQi;_FpO;fhpL4`DcWp zGOw9vx0N~6#}lz(r+dxIGZM3ah-8qrqMmeRh%{z@dbUD2w15*_4P?I~UZr^anP}DB zU9CCrNiy9I3~d#&!$DX9e?A});BjBtQ7oGAyoI$8YQrkLBIH@2;lt4E^)|d6Jwj}z z&2_E}Y;H#6I4<10d_&P0{4|EUacwFHauvrjAnAm6yeR#}f}Rk27CN)vhgRqEyPMMS7zvunj2?`f;%?alsJ+-K+IzjJx>h8 zu~m_y$!J5RWAh|C<6+uiCNsOKu)E72M3xKK(a9Okw3e_*O&}7llNV!=P87VM2DkAk zci!YXS2&=P0}Hx|wwSc9JP%m8dMJA*q&VFB0yMI@5vWoAGraygwn){R+Cj6B1a2Px z5)u(K5{+;z2n*_XD!+Auv#LJEM)(~Hx{$Yb^ldQmcYF2zNH1V30*)CN_|1$v2|`LnFUT$%-tO0Eg|c5$BB~yDfzS zcOXJ$wpzVK0MfTjBJ0b$r#_OvAJ3WRt+YOLlJPYMx~qp>^$$$h#bc|`g0pF-Ao43? z>*A+8lx>}L{p(Tni2Vvk)dtzg$hUKjSjXRagj)$h#8=KV>5s)J4vGtRn5kP|AXIz! zPgbbVxW{2o4s-UM;c#We8P&mPN|DW7_uLF!a|^0S=wr6Esx9Z$2|c1?GaupU6$tb| zY_KU`(_29O_%k(;>^|6*pZURH3`@%EuKS;Ns z1lujmf;r{qAN&Q0&m{wJSZ8MeE7RM5+Sq;ul_ z`+ADrd_Um+G37js6tKsArNB}n{p*zTUxQr>3@wA;{EUbjNjlNd6$Mx zg0|MyU)v`sa~tEY5$en7^PkC=S<2@!nEdG6L=h(vT__0F=S8Y&eM=hal#7eM(o^Lu z2?^;05&|CNliYrq6gUv;|i!(W{0N)LWd*@{2q*u)}u*> z7MQgk6t9OqqXMln?zoMAJcc zMKaof_Up})q#DzdF?w^%tTI7STI^@8=Wk#enR*)&%8yje>+tKvUYbW8UAPg55xb70 zEn5&Ba~NmOJlgI#iS8W3-@N%>V!#z-ZRwfPO1)dQdQkaHsiqG|~we2ALqG7Ruup(DqSOft2RFg_X%3w?6VqvV1uzX_@F(diNVp z4{I|}35=11u$;?|JFBEE*gb;T`dy+8gWJ9~pNsecrO`t#V9jW-6mnfO@ff9od}b(3s4>p0i30gbGIv~1@a^F2kl7YO;DxmF3? zWi-RoXhzRJV0&XE@ACc?+@6?)LQ2XNm4KfalMtsc%4!Fn0rl zpHTrHwR>t>7W?t!Yc{*-^xN%9P0cs0kr=`?bQ5T*oOo&VRRu+1chM!qj%2I!@+1XF z4GWJ=7ix9;Wa@xoZ0RP`NCWw0*8247Y4jIZ>GEW7zuoCFXl6xIvz$ezsWgKdVMBH> z{o!A7f;R-@eK9Vj7R40xx)T<2$?F2E<>Jy3F;;=Yt}WE59J!1WN367 zA^6pu_zLoZIf*x031CcwotS{L8bJE(<_F%j_KJ2P_IusaZXwN$&^t716W{M6X2r_~ zaiMwdISX7Y&Qi&Uh0upS3TyEIXNDICQlT5fHXC`aji-c{U(J@qh-mWl-uMN|T&435 z5)a1dvB|oe%b2mefc=Vpm0C%IUYYh7HI*;3UdgNIz}R##(#{(_>82|zB0L*1i4B5j-xi9O4x10rs_J6*gdRBX=@VJ+==sWb&_Qc6tSOowM{BX@(zawtjl zdU!F4OYw2@Tk1L^%~JCwb|e#3CC>srRHQ*(N%!7$Mu_sKh@|*XtR>)BmWw!;8-mq7 zBBnbjwx8Kyv|hd*`5}84flTHR1Y@@uqjG`UG+jN_YK&RYTt7DVwfEDXDW4U+iO{>K zw1hr{_XE*S*K9TzzUlJH2rh^hUm2v7_XjwTuYap|>zeEDY$HOq3X4Tz^X}E9z)x4F zs+T?Ed+Hj<#jY-`Va~fT2C$=qFT-5q$@p9~0{G&eeL~tiIAHXA!f6C(rAlS^)&k<- zXU|ZVs}XQ>s5iONo~t!XXZgtaP$Iau;JT%h)>}v54yut~pykaNye4axEK#5@?TSsQ zE;Jvf9I$GVb|S`7$pG)4vgo9NXsKr?u=F!GnA%VS2z$@Z(!MR9?EPcAqi5ft)Iz6sNl`%kj+_H-X`R<>BFrBW=fSlD|{`D%@Rcbu2?%>t7i34k?Ujb)2@J-`j#4 zLK<69qcUuniIan-$A1+fR=?@+thwDIXtF1Tks@Br-xY zfB+zblrR(ke`U;6U~-;p1Kg8Lh6v~LjW@9l2P6s+?$2!ZRPX`(ZkRGe7~q(4&gEi<$ch`5kQ?*1=GSqkeV z{SA1EaW_A!t{@^UY2D^YO0(H@+kFVzZaAh0_`A`f(}G~EP~?B|%gtxu&g%^x{EYSz zk+T;_c@d;+n@$<>V%P=nk36?L!}?*=vK4>nJSm+1%a}9UlmTJTrfX4{Lb7smNQn@T zw9p2%(Zjl^bWGo1;DuMHN(djsEm)P8mEC2sL@KyPjwD@d%QnZ$ zMJ3cnn!_!iP{MzWk%PI&D?m?C(y2d|2VChluN^yHya(b`h>~GkI1y;}O_E57zOs!{ zt2C@M$^PR2U#(dZmA-sNreB@z-yb0Bf7j*yONhZG=onhx>t4)RB`r6&TP$n zgmN*)eCqvgriBO-abHQ8ECN0bw?z5Bxpx z=jF@?zFdVn?@gD5egM4o$m`}lV(CWrOKKq(sv*`mNcHcvw&Xryfw<{ch{O&qc#WCTXX6=#{MV@q#iHYba!OUY+MGeNTjP%Fj!WgM&`&RlI^=AWTOqy-o zHo9YFt!gQ*p7{Fl86>#-JLZo(b^O`LdFK~OsZBRR@6P?ad^Ujbqm_j^XycM4ZHFyg ziUbIFW#2tj`65~#2V!4z7DM8Z;fG0|APaQ{a2VNYpNotB7eZ5kp+tPDz&Lqs0j%Y4tA*URpcfi z_M(FD=fRGdqf430j}1z`O0I=;tLu81bwJXdYiN7_&a-?ly|-j*+=--XGvCq#32Gh(=|qj5F?kmihk{%M&$}udW5)DHK zF_>}5R8&&API}o0osZJRL3n~>76nUZ&L&iy^s>PMnNcYZ|9*1$v-bzbT3rpWsJ+y{ zPrg>5Zlery96Um?lc6L|)}&{992{_$J&=4%nRp9BAC6!IB=A&=tF>r8S*O-=!G(_( zwXbX_rGZgeiK*&n5E;f=k{ktyA1(;x_kiMEt0*gpp_4&(twlS2e5C?NoD{n>X2AT# zY@Zp?#!b1zNq96MQqeO*M1MMBin5v#RH52&Xd~DO6-BZLnA6xO1$sou(YJ1Dlc{WF zVa%2DyYm`V#81jP@70IJ;DX@y*iUt$MLm)ByAD$eUuji|5{ptFYq(q)mE(5bOpxjM z^Q`AHWq44SG3`_LxC9fwR)XRVIp=B%<(-lOC3jI#bb@dK(*vjom!=t|#<@dZql%>O z15y^{4tQoeW9Lu%G&V$90x6F)xN6y_oIn;!Q zs)8jT$;&;u%Y>=T3hg34A-+Y*na=|glcStr5D;&5*t5*DmD~x;zQAV5{}Ya`?RRGa zT*t9@$a~!co;pD^!J5bo?lDOWFx%)Y=-fJ+PDGc0>;=q=s?P4aHForSB+)v0WY2JH z?*`O;RHum6j%#LG)Vu#ciO#+jRC3!>T(9fr+XE7T2B7Z|0nR5jw@WG)kDDzTJ=o4~ zUpeyt7}_nd`t}j9BKqryOha{34erm)RmST)_9Aw)@ zHbiyg5n&E{_CQR@h<}34d7WM{s{%5wdty1l+KX8*?+-YkNK2Be*6&jc>@{Fd;Ps|| z26LqdI3#9le?;}risDq$K5G3yoqK}C^@-8z^wj%tdgw-6@F#Ju{Sg7+y)L?)U$ez> zoOaP$UFZ?y5BiFycir*pnaAaY+|%1%8&|(@VB)zweR%?IidwJyK5J!STzw&2RFx zZV@qeaCB01Hu#U9|1#=Msc8Pgz5P*4Lrp!Q+~(G!OiNR{qa7|r^H?FC6gVhkk3y7=uW#Sh;&>78bZ}aK*C#NH$9rX@M3f{nckYI+5QG?Aj1DM)@~z_ zw!UAD@gedTlePB*%4+55naJ8ak_;))#S;4ji!LOqY5VRI){GMwHR~}6t4g>5C_#U# ztYC!tjKjrKvRy=GAsJVK++~$|+s!w9z3H4G^mACv=EErXNSmH7qN}%PKcN|8%9=i)qS5+$L zu&ya~HW%RMVJi4T^pv?>mw*Gf<)-7gf#Qj|e#w2|v4#t!%Jk{&xlf;$_?jW*n!Pyx zkG$<18kiLOAUPuFfyu-EfWX%4jYnjBYc~~*9JEz6oa)_R|8wjZA|RNrAp%}14L7fW zi7A5Wym*K+V8pkqqO-X#3ft{0qs?KVt^)?kS>AicmeO&q+~J~ zp0YJ_P~_a8j= zsAs~G=8F=M{4GZL{|B__UorX@MRNQLn?*_gym4aW(~+i13knnk1P=khoC-ViMZk+x zLW(l}oAg1H`dU+Fv**;qw|ANDSRs>cGqL!Yw^`; zv;{E&8CNJcc)GHzTYM}f&NPw<6j{C3gaeelU#y!M)w-utYEHOCCJo|Vgp7K6C_$14 zqIrLUB0bsgz^D%V%fbo2f9#yb#CntTX?55Xy|Kps&Xek*4_r=KDZ z+`TQuv|$l}MWLzA5Ay6Cvsa^7xvwXpy?`w(6vx4XJ zWuf1bVSb#U8{xlY4+wlZ$9jjPk)X_;NFMqdgq>m&W=!KtP+6NL57`AMljW+es zzqjUjgz;V*kktJI?!NOg^s_)ph45>4UDA!Vo0hn>KZ+h-3=?Y3*R=#!fOX zP$Y~+14$f66ix?UWB_6r#fMcC^~X4R-<&OD1CSDNuX~y^YwJ>sW0j`T<2+3F9>cLo z#!j57$ll2K9(%$4>eA7(>FJX5e)pR5&EZK!IMQzOfik#FU*o*LGz~7u(8}XzIQRy- z!U7AlMTIe|DgQFmc%cHy_9^{o`eD%ja_L>ckU6$O4*U**o5uR7`FzqkU8k4gxtI=o z^P^oGFPm5jwZMI{;nH}$?p@uV8FT4r=|#GziKXK07bHJLtK}X%I0TON$uj(iJ`SY^ zc$b2CoxCQ>7LH@nxcdW&_C#fMYBtTxcg46dL{vf%EFCZ~eErMvZq&Z%Lhumnkn^4A zsx$ay(FnN7kYah}tZ@0?-0Niroa~13`?hVi6`ndno`G+E8;$<6^gsE-K3)TxyoJ4M zb6pj5=I8^FD5H@`^V#Qb2^0cx7wUz&cruA5g>6>qR5)O^t1(-qqP&1g=qvY#s&{bx zq8Hc%LsbK1*%n|Y=FfojpE;w~)G0-X4i*K3{o|J7`krhIOd*c*$y{WIKz2n2*EXEH zT{oml3Th5k*vkswuFXdGDlcLj15Nec5pFfZ*0?XHaF_lVuiB%Pv&p7z)%38}%$Gup zVTa~C8=cw%6BKn_|4E?bPNW4PT7}jZQLhDJhvf4z;~L)506IE0 zX!tWXX(QOQPRj-p80QG79t8T2^az4Zp2hOHziQlvT!|H)jv{Ixodabzv6lBj)6WRB z{)Kg@$~~(7$-az?lw$4@L%I&DI0Lo)PEJJziWP33a3azb?jyXt1v0N>2kxwA6b%l> zZqRpAo)Npi&loWbjFWtEV)783BbeIAhqyuc+~>i7aQ8shIXt)bjCWT6$~ro^>99G} z2XfmT0(|l!)XJb^E!#3z4oEGIsL(xd; zYX1`1I(cG|u#4R4T&C|m*9KB1`UzKvho5R@1eYtUL9B72{i(ir&ls8g!pD ztR|25xGaF!4z5M+U@@lQf(12?xGy`!|3E}7pI$k`jOIFjiDr{tqf0va&3pOn6Pu)% z@xtG2zjYuJXrV)DUrIF*y<1O1<$#54kZ#2;=X51J^F#0nZ0(;S$OZDt_U2bx{RZ=Q zMMdd$fH|!s{ zXq#l;{`xfV`gp&C>A`WrQU?d{!Ey5(1u*VLJt>i27aZ-^&2IIk=zP5p+{$q(K?2(b z8?9h)kvj9SF!Dr zoyF}?V|9;6abHxWk2cEvGs$-}Pg}D+ZzgkaN&$Snp%;5m%zh1E#?Wac-}x?BYlGN#U#Mek*}kek#I9XaHt?mz3*fDrRTQ#&#~xyeqJk1QJ~E$7qsw6 z?sV;|?*=-{M<1+hXoj?@-$y+(^BJ1H~wQ9G8C0#^aEAyhDduNX@haoa=PuPp zYsGv8UBfQaRHgBgLjmP^eh>fLMeh{8ic)?xz?#3kX-D#Z{;W#cd_`9OMFIaJg-=t`_3*!YDgtNQ2+QUEAJB9M{~AvT$H`E)IKmCR21H532+ata8_i_MR@ z2Xj<3w<`isF~Ah$W{|9;51ub*f4#9ziKrOR&jM{x7I_7()O@`F*5o$KtZ?fxU~g`t zUovNEVKYn$U~VX8eR)qb`7;D8pn*Pp$(otYTqL)5KH$lUS-jf}PGBjy$weoceAcPp z&5ZYB$r&P$MN{0H0AxCe4Qmd3T%M*5d4i%#!nmBCN-WU-4m4Tjxn-%j3HagwTxCZ9 z)j5vO-C7%s%D!&UfO>bi2oXiCw<-w{vVTK^rVbv#W=WjdADJy8$khnU!`ZWCIU`># zyjc^1W~pcu>@lDZ{zr6gv%)2X4n27~Ve+cQqcND%0?IFSP4sH#yIaXXYAq^z3|cg` z`I3$m%jra>e2W-=DiD@84T!cb%||k)nPmEE09NC%@PS_OLhkrX*U!cgD*;;&gIaA(DyVT4QD+q_xu z>r`tg{hiGY&DvD-)B*h+YEd+Zn)WylQl}<4>(_NlsKXCRV;a)Rcw!wtelM2_rWX`j zTh5A|i6=2BA(iMCnj_fob@*eA;V?oa4Z1kRBGaU07O70fb6-qmA$Hg$ps@^ka1=RO zTbE_2#)1bndC3VuK@e!Sftxq4=Uux}fDxXE#Q5_x=E1h>T5`DPHz zbH<_OjWx$wy7=%0!mo*qH*7N4tySm+R0~(rbus`7;+wGh;C0O%x~fEMkt!eV>U$`i z5>Q(o z=t$gPjgGh0&I7KY#k50V7DJRX<%^X z>6+ebc9efB3@eE2Tr){;?_w`vhgF>`-GDY(YkR{9RH(MiCnyRtd!LxXJ75z+?2 zGi@m^+2hKJ5sB1@Xi@s_@p_Kwbc<*LQ_`mr^Y%j}(sV_$`J(?_FWP)4NW*BIL~sR>t6 zM;qTJZ~GoY36&{h-Pf}L#y2UtR}>ZaI%A6VkU>vG4~}9^i$5WP2Tj?Cc}5oQxe2=q z8BeLa$hwCg_psjZyC2+?yX4*hJ58Wu^w9}}7X*+i5Rjqu5^@GzXiw#SUir1G1`jY% zOL=GE_ENYxhcyUrEt9XlMNP6kx6h&%6^u3@zB8KUCAa18T(R2J`%JjWZ z!{7cXaEW+Qu*iJPu+m>QqW}Lo$4Z+!I)0JNzZ&_M%=|B1yejFRM04bGAvu{=lNPd+ zJRI^DRQ(?FcVUD+bgEcAi@o(msqys9RTCG#)TjI!9~3-dc`>gW;HSJuQvH~d`MQs86R$|SKXHh zqS9Qy)u;T`>>a!$LuaE2keJV%;8g)tr&Nnc;EkvA-RanHXsy)D@XN0a>h}z2j81R; zsUNJf&g&rKpuD0WD@=dDrPHdBoK42WoBU|nMo17o(5^;M|dB4?|FsAGVrSyWcI`+FVw^vTVC`y}f(BwJl zrw3Sp151^9=}B})6@H*i4-dIN_o^br+BkcLa^H56|^2XsT0dESw2 zMX>(KqNl=x2K5=zIKg}2JpGAZu{I_IO}0$EQ5P{4zol**PCt3F4`GX}2@vr8#Y)~J zKb)gJeHcFnR@4SSh%b;c%J`l=W*40UPjF#q{<}ywv-=vHRFmDjv)NtmC zQx9qm)d%0zH&qG7AFa3VAU1S^(n8VFTC~Hb+HjYMjX8r#&_0MzlNR*mnLH5hi}`@{ zK$8qiDDvS_(L9_2vHgzEQ${DYSE;DqB!g*jhJghE&=LTnbgl&Xepo<*uRtV{2wDHN z)l;Kg$TA>Y|K8Lc&LjWGj<+bp4Hiye_@BfU(y#nF{fpR&|Ltbye?e^j0}8JC4#xi% zv29ZR%8%hk=3ZDvO-@1u8KmQ@6p%E|dlHuy#H1&MiC<*$YdLkHmR#F3ae;bKd;@*i z2_VfELG=B}JMLCO-6UQy^>RDE%K4b>c%9ki`f~Z2Qu8hO7C#t%Aeg8E%+}6P7Twtg z-)dj(w}_zFK&86KR@q9MHicUAucLVshUdmz_2@32(V`y3`&Kf8Q2I)+!n0mR=rrDU zXvv^$ho;yh*kNqJ#r1}b0|i|xRUF6;lhx$M*uG3SNLUTC@|htC z-=fsw^F%$qqz4%QdjBrS+ov}Qv!z00E+JWas>p?z@=t!WWU3K*?Z(0meTuTOC7OTx zU|kFLE0bLZ+WGcL$u4E}5dB0g`h|uwv3=H6f+{5z9oLv-=Q45+n~V4WwgO=CabjM% zBAN+RjM65(-}>Q2V#i1Na@a0`08g&y;W#@sBiX6Tpy8r}*+{RnyGUT`?XeHSqo#|J z^ww~c;ou|iyzpErDtlVU=`8N7JSu>4M z_pr9=tX0edVn9B}YFO2y(88j#S{w%E8vVOpAboK*27a7e4Ekjt0)hIX99*1oE;vex z7#%jhY=bPijA=Ce@9rRO(Vl_vnd00!^TAc<+wVvRM9{;hP*rqEL_(RzfK$er_^SN; z)1a8vo8~Dr5?;0X0J62Cusw$A*c^Sx1)dom`-)Pl7hsW4i(r*^Mw`z5K>!2ixB_mu z*Ddqjh}zceRFdmuX1akM1$3>G=#~|y?eYv(e-`Qy?bRHIq=fMaN~fB zUa6I8Rt=)jnplP>yuS+P&PxeWpJ#1$F`iqRl|jF$WL_aZFZl@kLo&d$VJtu&w?Q0O zzuXK>6gmygq(yXJy0C1SL}T8AplK|AGNUOhzlGeK_oo|haD@)5PxF}rV+5`-w{Aag zus45t=FU*{LguJ11Sr-28EZkq;!mJO7AQGih1L4rEyUmp>B!%X0YemsrV3QFvlgt* z5kwlPzaiJ+kZ^PMd-RRbl(Y?F*m`4*UIhIuf#8q>H_M=fM*L_Op-<_r zBZagV=4B|EW+KTja?srADTZXCd3Yv%^Chfpi)cg{ED${SI>InNpRj5!euKv?=Xn92 zsS&FH(*w`qLIy$doc>RE&A5R?u zzkl1sxX|{*fLpXvIW>9d<$ePROttn3oc6R!sN{&Y+>Jr@yeQN$sFR z;w6A<2-0%UA?c8Qf;sX7>>uKRBv3Ni)E9pI{uVzX|6Bb0U)`lhLE3hK58ivfRs1}d zNjlGK0hdq0qjV@q1qI%ZFMLgcpWSY~mB^LK)4GZ^h_@H+3?dAe_a~k*;9P_d7%NEFP6+ zgV(oGr*?W(ql?6SQ~`lUsjLb%MbfC4V$)1E0Y_b|OIYxz4?O|!kRb?BGrgiH5+(>s zoqM}v*;OBfg-D1l`M6T6{K`LG+0dJ1)!??G5g(2*vlNkm%Q(MPABT$r13q?|+kL4- zf)Mi5r$sn;u41aK(K#!m+goyd$c!KPl~-&-({j#D4^7hQkV3W|&>l_b!}!z?4($OA z5IrkfuT#F&S1(`?modY&I40%gtroig{YMvF{K{>5u^I51k8RriGd${z)=5k2tG zM|&Bp5kDTfb#vfuTTd?)a=>bX=lokw^y9+2LS?kwHQIWI~pYgy7 zb?A-RKVm_vM5!9?C%qYdfRAw& zAU7`up~%g=p@}pg#b7E)BFYx3g%(J36Nw(Dij!b>cMl@CSNbrW!DBDbTD4OXk!G4x zi}JBKc8HBYx$J~31PXH+4^x|UxK~(<@I;^3pWN$E=sYma@JP|8YL`L(zI6Y#c%Q{6 z*APf`DU$S4pr#_!60BH$FGViP14iJmbrzSrOkR;f3YZa{#E7Wpd@^4E-zH8EgPc-# zKWFPvh%WbqU_%ZEt`=Q?odKHc7@SUmY{GK`?40VuL~o)bS|is$Hn=<=KGHOsEC5tB zFb|q}gGlL97NUf$G$>^1b^3E18PZ~Pm9kX%*ftnolljiEt@2#F2R5ah$zbXd%V_Ev zyDd{1o_uuoBga$fB@Fw!V5F3jIr=a-ykqrK?WWZ#a(bglI_-8pq74RK*KfQ z0~Dzus7_l;pMJYf>Bk`)`S8gF!To-BdMnVw5M-pyu+aCiC5dwNH|6fgRsIKZcF&)g zr}1|?VOp}I3)IR@m1&HX1~#wsS!4iYqES zK}4J{Ei>;e3>LB#Oly>EZkW14^@YmpbgxCDi#0RgdM${&wxR+LiX}B+iRioOB0(pDKpVEI;ND?wNx>%e|m{RsqR_{(nmQ z3ZS}@t!p4a(BKx_-CYwrcyJ5u1TO9bcXti$8sy>xcLKqKCc#~UOZYD{llKTSFEjJ~ zyNWt>tLU}*>^`TvPxtP%F`ZJQw@W0^>x;!^@?k_)9#bF$j0)S3;mH-IR5y82l|%=F z2lR8zhP?XNP-ucZZ6A+o$xOyF!w;RaLHGh57GZ|TCXhJqY~GCh)aXEV$1O&$c}La1 zjuJxkY9SM4av^Hb;i7efiYaMwI%jGy`3NdY)+mcJhF(3XEiSlU3c|jMBi|;m-c?~T z+x0_@;SxcoY=(6xNgO$bBt~Pj8`-<1S|;Bsjrzw3@zSjt^JC3X3*$HI79i~!$RmTz zsblZsLYs7L$|=1CB$8qS!tXrWs!F@BVuh?kN(PvE5Av-*r^iYu+L^j^m9JG^#=m>@ z=1soa)H*w6KzoR$B8mBCXoU;f5^bVuwQ3~2LKg!yxomG1#XPmn(?YH@E~_ED+W6mxs%x{%Z<$pW`~ON1~2XjP5v(0{C{+6Dm$00tsd3w=f=ZENy zOgb-=f}|Hb*LQ$YdWg<(u7x3`PKF)B7ZfZ6;1FrNM63 z?O6tE%EiU@6%rVuwIQjvGtOofZBGZT1Sh(xLIYt9c4VI8`!=UJd2BfLjdRI#SbVAX ziT(f*RI^T!IL5Ac>ql7uduF#nuCRJ1)2bdvAyMxp-5^Ww5p#X{rb5)(X|fEhDHHW{ zw(Lfc$g;+Q`B0AiPGtmK%*aWfQQ$d!*U<|-@n2HZvCWSiw^I>#vh+LyC;aaVWGbmkENr z&kl*8o^_FW$T?rDYLO1Pyi%>@&kJKQoH2E0F`HjcN}Zlnx1ddoDA>G4Xu_jyp6vuT zPvC}pT&Owx+qB`zUeR|4G;OH(<<^_bzkjln0k40t`PQxc$7h(T8Ya~X+9gDc8Z9{Z z&y0RAU}#_kQGrM;__MK9vwIwK^aoqFhk~dK!ARf1zJqHMxF2?7-8|~yoO@_~Ed;_wvT%Vs{9RK$6uUQ|&@#6vyBsFK9eZW1Ft#D2)VpQRwpR(;x^ zdoTgMqfF9iBl%{`QDv7B0~8{8`8k`C4@cbZAXBu00v#kYl!#_Wug{)2PwD5cNp?K^ z9+|d-4z|gZ!L{57>!Ogfbzchm>J1)Y%?NThxIS8frAw@z>Zb9v%3_3~F@<=LG%r*U zaTov}{{^z~SeX!qgSYow`_5)ij*QtGp4lvF`aIGQ>@3ZTkDmsl#@^5*NGjOuu82}o zzLF~Q9SW+mP=>88%eSA1W4_W7-Q>rdq^?t=m6}^tDPaBRGFLg%ak93W!kOp#EO{6& zP%}Iff5HZQ9VW$~+9r=|Quj#z*=YwcnssS~9|ub2>v|u1JXP47vZ1&L1O%Z1DsOrDfSIMHU{VT>&>H=9}G3i@2rP+rx@eU@uE8rJNec zij~#FmuEBj03F1~ct@C@$>y)zB+tVyjV3*n`mtAhIM0$58vM9jOQC}JJOem|EpwqeMuYPxu3sv}oMS?S#o6GGK@8PN59)m&K4Dc&X% z(;XL_kKeYkafzS3Wn5DD>Yiw{LACy_#jY4op(>9q>>-*9@C0M+=b#bknAWZ37^(Ij zq>H%<@>o4a#6NydoF{_M4i4zB_KG)#PSye9bk0Ou8h%1Dtl7Q_y#7*n%g)?m>xF~( zjqvOwC;*qvN_3(*a+w2|ao0D?@okOvg8JskUw(l7n`0fncglavwKd?~l_ryKJ^Ky! zKCHkIC-o7%fFvPa$)YNh022lakMar^dgL=t#@XLyNHHw!b?%WlM)R@^!)I!smZL@k zBi=6wE5)2v&!UNV(&)oOYW(6Qa!nUjDKKBf-~Da=#^HE4(@mWk)LPvhyN3i4goB$3K8iV7uh zsv+a?#c4&NWeK(3AH;ETrMOIFgu{_@%XRwCZ;L=^8Ts)hix4Pf3yJRQ<8xb^CkdmC z?c_gB)XmRsk`9ch#tx4*hO=#qS7={~Vb4*tTf<5P%*-XMfUUYkI9T1cEF;ObfxxI-yNuA=I$dCtz3ey znVkctYD*`fUuZ(57+^B*R=Q}~{1z#2!ca?)+YsRQb+lt^LmEvZt_`=j^wqig+wz@n@ z`LIMQJT3bxMzuKg8EGBU+Q-6cs5(@5W?N>JpZL{$9VF)veF`L5%DSYTNQEypW%6$u zm_~}T{HeHj1bAlKl8ii92l9~$dm=UM21kLemA&b$;^!wB7#IKWGnF$TVq!!lBlG4 z{?Rjz?P(uvid+|i$VH?`-C&Gcb3{(~Vpg`w+O);Wk1|Mrjxrht0GfRUnZqz2MhrXa zqgVC9nemD5)H$to=~hp)c=l9?#~Z_7i~=U-`FZxb-|TR9@YCxx;Zjo-WpMNOn2)z) zFPGGVl%3N$f`gp$gPnWC+f4(rmts%fidpo^BJx72zAd7|*Xi{2VXmbOm)1`w^tm9% znM=0Fg4bDxH5PxPEm{P3#A(mxqlM7SIARP?|2&+c7qmU8kP&iApzL|F>Dz)Ixp_`O zP%xrP1M6@oYhgo$ZWwrAsYLa4 z|I;DAvJxno9HkQrhLPQk-8}=De{9U3U%)dJ$955?_AOms!9gia%)0E$Mp}$+0er@< zq7J&_SzvShM?e%V?_zUu{niL@gt5UFOjFJUJ}L?$f%eU%jUSoujr{^O=?=^{19`ON zlRIy8Uo_nqcPa6@yyz`CM?pMJ^^SN^Fqtt`GQ8Q#W4kE7`V9^LT}j#pMChl!j#g#J zr-=CCaV%xyFeQ9SK+mG(cTwW*)xa(eK;_Z(jy)woZp~> zA(4}-&VH+TEeLzPTqw&FOoK(ZjD~m{KW05fiGLe@E3Z2`rLukIDahE*`u!ubU)9`o zn^-lyht#E#-dt~S>}4y$-mSbR8{T@}22cn^refuQ08NjLOv?JiEWjyOnzk<^R5%gO zhUH_B{oz~u#IYwVnUg8?3P*#DqD8#X;%q%HY**=I>>-S|!X*-!x1{^l#OnR56O>iD zc;i;KS+t$koh)E3)w0OjWJl_aW2;xF=9D9Kr>)(5}4FqUbk# zI#$N8o0w;IChL49m9CJTzoC!|u{Ljd%ECgBOf$}&jA^$(V#P#~)`&g`H8E{uv52pp zwto`xUL-L&WTAVREEm$0g_gYPL(^vHq(*t1WCH_6alhkeW&GCZ3hL)|{O-jiFOBrF z!EW=Jej|dqQitT6!B-7&io2K)WIm~Q)v@yq%U|VpV+I?{y0@Yd%n8~-NuuM*pM~KA z85YB};IS~M(c<}4Hxx>qRK0cdl&e?t253N%vefkgds>Ubn8X}j6Vpgs>a#nFq$osY z1ZRwLqFv=+BTb=i%D2Wv>_yE0z}+niZ4?rE|*a3d7^kndWGwnFqt+iZ(7+aln<}jzbAQ(#Z2SS}3S$%Bd}^ zc9ghB%O)Z_mTZMRC&H#)I#fiLuIkGa^`4e~9oM5zKPx?zjkC&Xy0~r{;S?FS%c7w< zWbMpzc(xSw?9tGxG~_l}Acq}zjt5ClaB7-!vzqnlrX;}$#+PyQ9oU)_DfePh2E1<7 ztok6g6K^k^DuHR*iJ?jw?bs_whk|bx`dxu^nC6#e{1*m~z1eq7m}Cf$*^Eua(oi_I zAL+3opNhJteu&mWQ@kQWPucmiP)4|nFG`b2tpC;h{-PI@`+h?9v=9mn|0R-n8#t=+Z*FD(c5 zjj79Jxkgck*DV=wpFgRZuwr%}KTm+dx?RT@aUHJdaX-ODh~gByS?WGx&czAkvkg;x zrf92l8$Or_zOwJVwh>5rB`Q5_5}ef6DjS*$x30nZbuO3dijS*wvNEqTY5p1_A0gWr znH<(Qvb!os14|R)n2Ost>jS2;d1zyLHu`Svm|&dZD+PpP{Bh>U&`Md;gRl64q;>{8MJJM$?UNUd`aC>BiLe>*{ zJY15->yW+<3rLgYeTruFDtk1ovU<$(_y7#HgUq>)r0{^}Xbth}V#6?%5jeFYt;SG^ z3qF)=uWRU;Jj)Q}cpY8-H+l_n$2$6{ZR?&*IGr{>ek!69ZH0ZoJ*Ji+ezzlJ^%qL3 zO5a`6gwFw(moEzqxh=yJ9M1FTn!eo&qD#y5AZXErHs%22?A+JmS&GIolml!)rZTnUDM3YgzYfT#;OXn)`PWv3Ta z!-i|-Wojv*k&bC}_JJDjiAK(Ba|YZgUI{f}TdEOFT2+}nPmttytw7j%@bQZDV1vvj z^rp{gRkCDmYJHGrE1~e~AE!-&6B6`7UxVQuvRrfdFkGX8H~SNP_X4EodVd;lXd^>eV1jN+Tt4}Rsn)R0LxBz0c=NXU|pUe!MQQFkGBWbR3&(jLm z%RSLc#p}5_dO{GD=DEFr=Fc% z85CBF>*t!6ugI?soX(*JNxBp+-DdZ4X0LldiK}+WWGvXV(C(Ht|!3$psR=&c*HIM=BmX;pRIpz@Ale{9dhGe(U2|Giv;# zOc|;?p67J=Q(kamB*aus=|XP|m{jN^6@V*Bpm?ye56Njh#vyJqE=DweC;?Rv7faX~ zde03n^I~0B2vUmr;w^X37tVxUK?4}ifsSH5_kpKZIzpYu0;Kv}SBGfI2AKNp+VN#z`nI{UNDRbo-wqa4NEls zICRJpu)??cj^*WcZ^MAv+;bDbh~gpN$1Cor<{Y2oyIDws^JsfW^5AL$azE(T0p&pP z1Mv~6Q44R&RHoH95&OuGx2srIr<@zYJTOMKiVs;Bx3py89I87LOb@%mr`0)#;7_~Z zzcZj8?w=)>%5@HoCHE_&hnu(n_yQ-L(~VjpjjkbT7e)Dk5??fApg(d>vwLRJ-x{um z*Nt?DqTSxh_MIyogY!vf1mU1`Gld-&L)*43f6dilz`Q@HEz;+>MDDYv9u!s;WXeao zUq=TaL$P*IFgJzrGc>j1dDOd zed+=ZBo?w4mr$2)Ya}?vedDopomhW1`#P<%YOJ_j=WwClX0xJH-f@s?^tmzs_j7t!k zK@j^zS0Q|mM4tVP5Ram$VbS6|YDY&y?Q1r1joe9dj08#CM{RSMTU}(RCh`hp_Rkl- zGd|Cv~G@F{DLhCizAm9AN!^{rNs8hu!G@8RpnGx7e`-+K$ffN<0qjR zGq^$dj_Tv!n*?zOSyk5skI7JVKJ)3jysnjIu-@VSzQiP8r6MzudCU=~?v-U8yzo^7 zGf~SUTvEp+S*!X9uX!sq=o}lH;r{pzk~M*VA(uyQ`3C8!{C;)&6)95fv(cK!%Cuz$ z_Zal57H6kPN>25KNiI6z6F)jzEkh#%OqU#-__Xzy)KyH};81#N6OfX$$IXWzOn`Q& z4f$Z1t>)8&8PcYfEwY5UadU1yg+U*(1m2ZlHoC-!2?gB!!fLhmTl))D@dhvkx#+Yj z1O=LV{(T%{^IeCuFK>%QR!VZ4GnO5tK8a+thWE zg4VytZrwcS?7^ zuZfhYnB8dwd%VLO?DK7pV5Wi<(`~DYqOXn8#jUIL^)12*Dbhk4GmL_E2`WX&iT16o zk(t|hok(Y|v-wzn?4x34T)|+SfZP>fiq!><*%vnxGN~ypST-FtC+@TPv*vYv@iU!_ z@2gf|PrgQ?Ktf*9^CnJ(x*CtZVB8!OBfg0%!wL;Z8(tYYre0vcnPGlyCc$V(Ipl*P z_(J!a=o@vp^%Efme!K74(Ke7A>Y}|sxV+JL^aYa{~m%5#$$+R1? zGaQhZTTX!#s#=Xtpegqero$RNt&`4xn3g$)=y*;=N=Qai)}~`xtxI_N*#MMCIq#HFifT zz(-*m;pVH&+4bixL&Bbg)W5FN^bH87pAHp)zPkWNMfTFqS=l~AC$3FX3kQUSh_C?-ZftyClgM)o_D7cX$RGlEYblux0jv5 zTr|i-I3@ZPCGheCl~BGhImF)K4!9@?pC(gi3ozX=a!|r1)LFxy_8c&wY0<^{2cm|P zv6Y`QktY*;I)IUd5y3ne1CqpVanlY45z8hf4&$EUBnucDj16pDa4&GI&TArYhf*xh zdj>*%APH8(h~c>o@l#%T>R$e>rwVx_WUB|~V`p^JHsg*y12lzj&zF}w6W09HwB2yb z%Q~`es&(;7#*DUC_w-Dmt7|$*?TA_m;zB+-u{2;Bg{O}nV7G_@7~<)Bv8fH^G$XG8$(&{A zwXJK5LRK%M34(t$&NI~MHT{UQ9qN-V_yn|%PqC81EIiSzmMM=2zb`mIwiP_b)x+2M z7Gd`83h79j#SItpQ}luuf2uOU`my_rY5T{6P#BNlb%h%<#MZb=m@y5aW;#o1^2Z)SWo+b`y0gV^iRcZtz5!-05vF z7wNo=hc6h4hc&s@uL^jqRvD6thVYtbErDK9k!;+a0xoE0WL7zLixjn5;$fXvT=O3I zT6jI&^A7k6R{&5#lVjz#8%_RiAa2{di{`kx79K+j72$H(!ass|B%@l%KeeKchYLe_ z>!(JC2fxsv>XVen+Y42GeYPxMWqm`6F$(E<6^s|g(slNk!lL*6v^W2>f6hh^mE$s= z3D$)}{V5(Qm&A6bp%2Q}*GZ5Qrf}n7*Hr51?bJOyA-?B4vg6y_EX<*-e20h{=0Mxs zbuQGZ$fLyO5v$nQ&^kuH+mNq9O#MWSfThtH|0q1i!NrWj^S}_P;Q1OkYLW6U^?_7G zx2wg?CULj7))QU(n{$0JE%1t2dWrMi2g-Os{v|8^wK{@qlj%+1b^?NI z$}l2tjp0g>K3O+p%yK<9!XqmQ?E9>z&(|^Pi~aSRwI5x$jaA62GFz9%fmO3t3a>cq zK8Xbv=5Ps~4mKN5+Eqw12(!PEyedFXv~VLxMB~HwT1Vfo51pQ#D8e$e4pFZ{&RC2P z5gTIzl{3!&(tor^BwZfR8j4k{7Rq#`riKXP2O-Bh66#WWK2w=z;iD9GLl+3 zpHIaI4#lQ&S-xBK8PiQ%dwOh?%BO~DCo06pN7<^dnZCN@NzY{_Z1>rrB0U|nC&+!2 z2y!oBcTd2;@lzyk(B=TkyZ)zy0deK05*Q0zk+o$@nun`VI1Er7pjq>8V zNmlW{p7S^Btgb(TA}jL(uR>`0w8gHP^T~Sh5Tkip^spk4SBAhC{TZU}_Z)UJw-}zm zPq{KBm!k)?P{`-(9?LFt&YN4s%SIZ-9lJ!Ws~B%exHOeVFk3~}HewnnH(d)qkLQ_d z6h>O)pEE{vbOVw}E+jdYC^wM+AAhaI(YAibUc@B#_mDss0Ji&BK{WG`4 zOk>vSNq(Bq2IB@s>>Rxm6Wv?h;ZXkpb1l8u|+_qXWdC*jjcPCixq;!%BVPSp#hP zqo`%cNf&YoQXHC$D=D45RiT|5ngPlh?0T~?lUf*O)){K@*Kbh?3RW1j9-T?%lDk@y z4+~?wKI%Y!-=O|_IuKz|=)F;V7ps=5@g)RrE;;tvM$gUhG>jHcw2Hr@fS+k^Zr~>G z^JvPrZc}_&d_kEsqAEMTMJw!!CBw)u&ZVzmq+ZworuaE&TT>$pYsd9|g9O^0orAe8 z221?Va!l1|Y5X1Y?{G7rt1sX#qFA^?RLG^VjoxPf63;AS=_mVDfGJKg73L zsGdnTUD40y(>S##2l|W2Cy!H(@@5KBa(#gs`vlz}Y~$ot5VsqPQ{{YtjYFvIumZzt zA{CcxZLJR|4#{j7k~Tu*jkwz8QA|5G1$Cl895R`Zyp;irp1{KN){kB30O8P1W5;@bG znvX74roeMmQlUi=v9Y%(wl$ZC#9tKNFpvi3!C}f1m6Ct|l2g%psc{TJp)@yu)*e2> z((p0Fg*8gJ!|3WZke9;Z{8}&NRkv7iP=#_y-F}x^y?2m%-D_aj^)f04%mneyjo_;) z6qc_Zu$q37d~X``*eP~Q>I2gg%rrV8v=kDfpp$=%Vj}hF)^dsSWygoN(A$g*E=Do6FX?&(@F#7pbiJ`;c0c@Ul zDqW_90Wm#5f2L<(Lf3)3TeXtI7nhYwRm(F;*r_G6K@OPW4H(Y3O5SjUzBC}u3d|eQ8*8d@?;zUPE+i#QNMn=r(ap?2SH@vo*m z3HJ%XuG_S6;QbWy-l%qU;8x;>z>4pMW7>R}J%QLf%@1BY(4f_1iixd-6GlO7Vp*yU zp{VU^3?s?90i=!#>H`lxT!q8rk>W_$2~kbpz7eV{3wR|8E=8**5?qn8#n`*(bt1xRQrdGxyx2y%B$qmw#>ZV$c7%cO#%JM1lY$Y0q?Yuo> ze9KdJoiM)RH*SB%^;TAdX-zEjA7@%y=!0=Zg%iWK7jVI9b&Dk}0$Af&08KHo+ zOwDhFvA(E|ER%a^cdh@^wLUlmIv6?_3=BvX8jKk92L=Y}7Jf5OGMfh` zBdR1wFCi-i5@`9km{isRb0O%TX+f~)KNaEz{rXQa89`YIF;EN&gN)cigu6mNh>?Cm zAO&Im2flv6D{jwm+y<%WsPe4!89n~KN|7}Cb{Z;XweER73r}Qp2 zz}WP4j}U0&(uD&9yGy6`!+_v-S(yG*iytsTR#x_Rc>=6u^vnRDnf1gP{#2>`ffrAC% zTZ5WQ@hAK;P;>kX{D)mIXe4%a5p=LO1xXH@8T?mz7Q@d)$3pL{{B!2{-v70L*o1AO+|n5beiw~ zk@(>m?T3{2k2c;NWc^`4@P&Z?BjxXJ@;x1qhn)9Mn*IFdt_J-dIqx5#d`NfyfX~m( zIS~5)MfZ2Uy?_4W`47i}u0ZgPh<{D|w_d#;D}Q&U$Q-G}xM1A@1f{#%A$jh6Qp&0hQ<0bPOM z-{1Wm&p%%#eb_?x7i;bol EfAhh=DF6Tf literal 0 HcmV?d00001 diff --git a/reactive-systems/shipping-service/.mvn/wrapper/maven-wrapper.properties b/reactive-systems/shipping-service/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..642d572ce9 --- /dev/null +++ b/reactive-systems/shipping-service/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/reactive-systems/shipping-service/Dockerfile b/reactive-systems/shipping-service/Dockerfile new file mode 100644 index 0000000000..4906d1d9a8 --- /dev/null +++ b/reactive-systems/shipping-service/Dockerfile @@ -0,0 +1,3 @@ +FROM openjdk:8-jdk-alpine +COPY target/shipping-service-async-0.0.1-SNAPSHOT.jar app.jar +ENTRYPOINT ["java","-jar","-Dspring.profiles.active=docker","/app.jar"] \ No newline at end of file diff --git a/reactive-systems/shipping-service/HELP.md b/reactive-systems/shipping-service/HELP.md new file mode 100644 index 0000000000..53d5801551 --- /dev/null +++ b/reactive-systems/shipping-service/HELP.md @@ -0,0 +1,11 @@ +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/#build-image) +* [Spring Data Reactive MongoDB](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/htmlsingle/#boot-features-mongodb) +* [Spring for Apache Kafka](https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/reference/htmlsingle/#boot-features-kafka) + diff --git a/reactive-systems/shipping-service/mvnw b/reactive-systems/shipping-service/mvnw new file mode 100644 index 0000000000..a16b5431b4 --- /dev/null +++ b/reactive-systems/shipping-service/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/reactive-systems/shipping-service/mvnw.cmd b/reactive-systems/shipping-service/mvnw.cmd new file mode 100644 index 0000000000..c8d43372c9 --- /dev/null +++ b/reactive-systems/shipping-service/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/reactive-systems/shipping-service/pom.xml b/reactive-systems/shipping-service/pom.xml new file mode 100644 index 0000000000..72487e691e --- /dev/null +++ b/reactive-systems/shipping-service/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + com.baeldung.reactive + shipping-service + shipping-service + Demo project for Spring Boot + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-data-mongodb-reactive + + + org.springframework.kafka + spring-kafka + + + + com.fasterxml.jackson.core + jackson-databind + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + io.projectreactor + reactor-test + test + + + org.springframework.kafka + spring-kafka-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/AsyncApplication.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/AsyncApplication.java new file mode 100644 index 0000000000..20eb0d30ab --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/AsyncApplication.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class AsyncApplication { + + public static void main(String[] args) { + SpringApplication.run(AsyncApplication.class, args); + } + +} diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java new file mode 100644 index 0000000000..16808c0b40 --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/async/consumer/OrderConsumer.java @@ -0,0 +1,45 @@ +package com.baeldung.async.consumer; + +import java.io.IOException; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.annotation.KafkaListener; +import org.springframework.stereotype.Service; + +import com.baeldung.async.producer.OrderProducer; +import com.baeldung.constants.OrderStatus; +import com.baeldung.domain.Order; +import com.baeldung.reactive.service.ShippingService; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class OrderConsumer { + + @Autowired + ShippingService shippingService; + + @Autowired + OrderProducer orderProducer; + + @KafkaListener(topics = "orders", groupId = "shipping") + public void consume(Order order) throws IOException { + log.info("Order received to process: {}", order); + if (OrderStatus.PREPARE_SHIPPING.equals(order.getOrderStatus())) { + shippingService.handleOrder(order) + .doOnSuccess(o -> { + log.info("Order processed succesfully."); + orderProducer.sendMessage(order.setOrderStatus(OrderStatus.SHIPPING_SUCCESS) + .setShippingDate(o.getShippingDate())); + }) + .doOnError(e -> { + if (log.isErrorEnabled()) + log.error("Order failed to process: " + e); + orderProducer.sendMessage(order.setOrderStatus(OrderStatus.SHIPPING_FAILURE) + .setResponseMessage(e.getMessage())); + }) + .subscribe(); + } + } +} \ No newline at end of file diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/async/producer/OrderProducer.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/async/producer/OrderProducer.java new file mode 100644 index 0000000000..082d274ab0 --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/async/producer/OrderProducer.java @@ -0,0 +1,23 @@ +package com.baeldung.async.producer; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.stereotype.Service; + +import com.baeldung.domain.Order; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +public class OrderProducer { + + @Autowired + private KafkaTemplate kafkaTemplate; + + public void sendMessage(Order order) { + log.info("Order processed to dispatch: {}", order); + this.kafkaTemplate.send("orders", order); + } + +} diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/constants/OrderStatus.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/constants/OrderStatus.java new file mode 100644 index 0000000000..030d302e2e --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/constants/OrderStatus.java @@ -0,0 +1,7 @@ +package com.baeldung.constants; + +public enum OrderStatus { + + SUCCESS, FAILURE, INITIATION_SUCCESS, RESERVE_INVENTORY, REVERT_INVENTORY, INVENTORY_SUCCESS, INVENTORY_FAILURE, INVENTORY_REVERT_SUCCESS, INVENTORY_REVERT_FAILURE, PREPARE_SHIPPING, SHIPPING_SUCCESS, SHIPPING_FAILURE, + +} diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Address.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Address.java new file mode 100644 index 0000000000..987803d9c1 --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Address.java @@ -0,0 +1,14 @@ +package com.baeldung.domain; + +import lombok.Data; + +@Data +public class Address { + + private String name; + private String house; + private String street; + private String city; + private String zip; + +} diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Order.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Order.java new file mode 100644 index 0000000000..ed1f85aa4b --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Order.java @@ -0,0 +1,45 @@ +package com.baeldung.domain; + +import java.time.LocalDate; + +import org.bson.types.ObjectId; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import com.baeldung.constants.OrderStatus; +import com.baeldung.serdeser.ObjectIdSerializer; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +import lombok.Data; + +@Data +@Document +public class Order { + + @Id + @JsonSerialize(using = ObjectIdSerializer.class) + private ObjectId id; + private String userId; + private Long total; + private String paymentMode; + private Address shippingAddress; + private LocalDate shippingDate; + private OrderStatus orderStatus; + private String responseMessage; + + public Order setShippingDate(LocalDate shippingDate) { + this.shippingDate = shippingDate; + return this; + } + + public Order setOrderStatus(OrderStatus orderStatus) { + this.orderStatus = orderStatus; + return this; + } + + public Order setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + return this; + } + +} diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Shipment.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Shipment.java new file mode 100644 index 0000000000..74971f942b --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/domain/Shipment.java @@ -0,0 +1,28 @@ +package com.baeldung.domain; + +import java.time.LocalDate; + +import org.bson.types.ObjectId; +import org.springframework.data.mongodb.core.mapping.Document; + +import lombok.Data; + +@Data +@Document +public class Shipment { + + private ObjectId id; + private LocalDate shippingDate; + private Address address; + + public Shipment setShippingDate(LocalDate shippingDate) { + this.shippingDate = shippingDate; + return this; + } + + public Shipment setAddress(Address address) { + this.address = address; + return this; + } + +} diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/reactive/repository/ShipmentRepository.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/reactive/repository/ShipmentRepository.java new file mode 100644 index 0000000000..5916cc1b06 --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/reactive/repository/ShipmentRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.reactive.repository; + +import org.bson.types.ObjectId; +import org.springframework.data.mongodb.repository.ReactiveMongoRepository; + +import com.baeldung.domain.Shipment; + +public interface ShipmentRepository extends ReactiveMongoRepository { + +} diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/reactive/service/ShippingService.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/reactive/service/ShippingService.java new file mode 100644 index 0000000000..14afbb9ed6 --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/reactive/service/ShippingService.java @@ -0,0 +1,45 @@ +package com.baeldung.reactive.service; + +import java.time.LocalDate; +import java.time.LocalTime; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baeldung.constants.OrderStatus; +import com.baeldung.domain.Order; +import com.baeldung.domain.Shipment; +import com.baeldung.reactive.repository.ShipmentRepository; + +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Mono; + +@Slf4j +@Service +public class ShippingService { + + @Autowired + ShipmentRepository shipmentRepository; + + public Mono handleOrder(Order order) { + log.info("Handle order invoked with: {}", order); + return Mono.just(order) + .flatMap(o -> { + LocalDate shippingDate = null; + if (LocalTime.now() + .isAfter(LocalTime.parse("10:00")) + && LocalTime.now() + .isBefore(LocalTime.parse("18:00"))) { + shippingDate = LocalDate.now() + .plusDays(1); + } else { + return Mono.error(new RuntimeException("The current time is off the limits to place order.")); + } + return shipmentRepository.save(new Shipment().setAddress(order.getShippingAddress()) + .setShippingDate(shippingDate)); + }) + .map(s -> order.setShippingDate(s.getShippingDate()) + .setOrderStatus(OrderStatus.SUCCESS)); + } + +} \ No newline at end of file diff --git a/reactive-systems/shipping-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java b/reactive-systems/shipping-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java new file mode 100644 index 0000000000..0b0b743e7e --- /dev/null +++ b/reactive-systems/shipping-service/src/main/java/com/baeldung/serdeser/ObjectIdSerializer.java @@ -0,0 +1,20 @@ +package com.baeldung.serdeser; + +import java.io.IOException; + +import org.bson.types.ObjectId; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +@Component +public class ObjectIdSerializer extends JsonSerializer { + + @Override + public void serialize(ObjectId value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeString(value.toString()); + } +} diff --git a/reactive-systems/shipping-service/src/main/resources/application-docker.properties b/reactive-systems/shipping-service/src/main/resources/application-docker.properties new file mode 100644 index 0000000000..1909018ce8 --- /dev/null +++ b/reactive-systems/shipping-service/src/main/resources/application-docker.properties @@ -0,0 +1,7 @@ +server.port=8082 +spring.data.mongodb.uri=mongodb://mongo-db:27017/reactive-systems +spring.kafka.bootstrap-servers=kafka-broker:9092 +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.producer.properties.spring.json.add.type.headers=false +spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer +spring.kafka.consumer.properties.spring.json.value.default.type=com.baeldung.domain.Order \ No newline at end of file diff --git a/reactive-systems/shipping-service/src/main/resources/application.properties b/reactive-systems/shipping-service/src/main/resources/application.properties new file mode 100644 index 0000000000..d71073a4cc --- /dev/null +++ b/reactive-systems/shipping-service/src/main/resources/application.properties @@ -0,0 +1,7 @@ +server.port=8082 +spring.data.mongodb.uri=mongodb://localhost:27017/reactive-systems +spring.kafka.bootstrap-servers=localhost:9092 +spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer +spring.kafka.producer.properties.spring.json.add.type.headers=false +spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer +spring.kafka.consumer.properties.spring.json.value.default.type=com.baeldung.domain.Order \ No newline at end of file From c5c128033deee4fe152b550d062007c3411915cc Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 Jul 2020 18:59:16 +0000 Subject: [PATCH 0102/1862] Code Review BAEL-4302 --- .../com/baeldung/loadedclasslisting/ClassLoaderType.java | 6 ------ .../main/java/com/baeldung/loadedclasslisting/Launcher.java | 5 +---- .../baeldung/loadedclasslisting/ListLoadedClassesAgent.java | 4 ++++ .../loadedclasslisting/customLoader/ClassLoaderInfo.java | 1 - 4 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java deleted file mode 100644 index 1111fc21fe..0000000000 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ClassLoaderType.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.loadedclasslisting; - -public enum ClassLoaderType { - - SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM -} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java index 19c42dfd8d..e1851275c9 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java @@ -3,6 +3,7 @@ package com.baeldung.loadedclasslisting; import java.lang.reflect.Method; import java.util.Arrays; +import com.baeldung.loadedclasslisting.ListLoadedClassesAgent.ClassLoaderType; import com.baeldung.loadedclasslisting.customLoader.ClassLoaderInfo; import com.baeldung.loadedclasslisting.customLoader.CustomClassLoader; @@ -11,13 +12,9 @@ public class Launcher { private static ClassLoader customClassLoader; public static void main(String[] args) { - printClassesLoadedBy(ClassLoaderType.BOOTSTRAP); - printClassesLoadedBy(ClassLoaderType.SYSTEM); - printClassesLoadedBy(ClassLoaderType.EXTENSION); - printClassesLoadedBy(ClassLoaderType.CUSTOM); } diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java index 03907f8b04..8f4b8ebd41 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java @@ -4,6 +4,10 @@ import java.lang.instrument.Instrumentation; public class ListLoadedClassesAgent { + public enum ClassLoaderType { + SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM , PLATFORM + } + private static Instrumentation instrumentation; public static void premain(String agentArgs, Instrumentation instrumentation) { diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java index a787b062d5..2574394c13 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java @@ -5,7 +5,6 @@ import java.util.ArrayList; public class ClassLoaderInfo { public void printClassLoaders() throws ClassNotFoundException { - System.out.println("Classloader of this class:" + ClassLoaderInfo.class.getClassLoader()); System.out.println("Classloader of ArrayList:" + ArrayList.class.getClassLoader()); } From 34d2e20e56029b05f6da6b510f2ab9d87e7ebf10 Mon Sep 17 00:00:00 2001 From: mikr Date: Wed, 15 Jul 2020 12:33:27 +0200 Subject: [PATCH 0103/1862] JAVA-2096 Update "Create File" article --- core-java-modules/core-java-io-2/README.md | 2 +- core-java-modules/core-java-io-3/README.md | 7 ++ core-java-modules/core-java-io-3/pom.xml | 86 +++++++++++++++++++ .../createfile/CreateFileUnitTest.java | 50 +++++++++++ core-java-modules/pom.xml | 1 + 5 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 core-java-modules/core-java-io-3/README.md create mode 100644 core-java-modules/core-java-io-3/pom.xml create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java diff --git a/core-java-modules/core-java-io-2/README.md b/core-java-modules/core-java-io-2/README.md index 84cabc5992..b078a66a7a 100644 --- a/core-java-modules/core-java-io-2/README.md +++ b/core-java-modules/core-java-io-2/README.md @@ -13,4 +13,4 @@ This module contains articles about core Java input and output (IO) - [How to Copy a File with Java](https://www.baeldung.com/java-copy-file) - [Create a Directory in Java](https://www.baeldung.com/java-create-directory) - [Java IO vs NIO](https://www.baeldung.com/java-io-vs-nio) -- [[<-- Prev]](/core-java-modules/core-java-io) +- [[<-- Prev]](/core-java-modules/core-java-io)[[More -->]](/core-java-modules/core-java-io-3) diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md new file mode 100644 index 0000000000..39752346d3 --- /dev/null +++ b/core-java-modules/core-java-io-3/README.md @@ -0,0 +1,7 @@ +## Core Java IO + +This module contains articles about core Java input and output (IO) + +### Relevant Articles: +- [Java – Create a File](https://www.baeldung.com/java-how-to-create-a-file) +- [[<-- Prev]](/core-java-modules/core-java-io-2) diff --git a/core-java-modules/core-java-io-3/pom.xml b/core-java-modules/core-java-io-3/pom.xml new file mode 100644 index 0000000000..cb341ca2ae --- /dev/null +++ b/core-java-modules/core-java-io-3/pom.xml @@ -0,0 +1,86 @@ + + + 4.0.0 + core-java-io-3 + 0.1.0-SNAPSHOT + core-java-io-3 + jar + + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../ + + + + + + com.google.guava + guava + ${guava.version} + + + + commons-io + commons-io + ${commons-io.version} + + + + log4j + log4j + ${log4j.version} + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + com.github.tomakehurst + wiremock + ${wiremock.version} + test + + + + + + core-java-io-3 + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + + 3.6.1 + 3.0.0-M1 + 2.26.3 + + + \ No newline at end of file diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java new file mode 100644 index 0000000000..f3cdb22f4d --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.createfile; + +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class CreateFileUnitTest { + + private final String FILE_NAME = "src/test/resources/fileToCreate.txt"; + + @AfterEach + @BeforeEach + public void cleanUpFiles() { + File targetFile = new File(FILE_NAME); + targetFile.delete(); + } + + @Test + public void givenUsingNio_whenCreatingFile_thenCorrect() throws IOException { + Path newFilePath = Paths.get(FILE_NAME); + Files.createFile(newFilePath); + } + + @Test + public void givenUsingFile_whenCreatingFile_thenCorrect() throws IOException { + File newFile = new File(FILE_NAME); + boolean success = newFile.createNewFile(); + assertTrue(success); + } + + @Test + public void givenUsingGuava_whenCreatingFile_thenCorrect() throws IOException { + com.google.common.io.Files.touch(new File(FILE_NAME)); + } + + @Test + public void givenUsingCommonsIo_whenCreatingFile_thenCorrect() throws IOException { + FileUtils.touch(new File(FILE_NAME)); + } + +} diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 03b15f60d6..589097cf48 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -72,6 +72,7 @@ core-java-io core-java-io-2 + core-java-io-3 core-java-io-apis core-java-io-conversions core-java-io-conversions-2 From 05446fb887c488d11e3944cd1e3ed7f5b0f1b8eb Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 15 Jul 2020 17:24:34 +0530 Subject: [PATCH 0104/1862] JAVA-628: Moved 3 articles from spring-core --- spring-core/README.md | 4 +- .../com/baeldung/lombok/ApologizeService.java | 22 --------- .../com/baeldung/lombok/FarewellService.java | 18 -------- .../com/baeldung/lombok/GreetingService.java | 15 ------- .../com/baeldung/lombok/ThankingService.java | 15 ------- .../java/com/baeldung/lombok/Translator.java | 5 --- ...pplicationContextTestResourceNameType.java | 16 ------- ...plicationContextTestResourceQualifier.java | 22 --------- ...ogizeServiceAutowiringIntegrationTest.java | 33 -------------- .../ApologizeServiceIntegrationTest.java | 21 --------- .../FarewellAutowiringIntegrationTest.java | 31 ------------- .../FarewellServiceIntegrationTest.java | 20 --------- .../GreetingServiceIntegrationTest.java | 37 --------------- .../java/com/baeldung/lombok/TestConfig.java | 17 ------- ...nkingServiceAutowiringIntegrationTest.java | 31 ------------- .../ThankingServiceIntegrationTest.java | 20 --------- ...FieldResourceInjectionIntegrationTest.java | 30 ------------- ...hodByQualifierResourceIntegrationTest.java | 45 ------------------- .../MethodByTypeResourceIntegrationTest.java | 34 -------------- ...ethodResourceInjectionIntegrationTest.java | 34 -------------- .../NamedResourceIntegrationTest.java | 29 ------------ ...ifierResourceInjectionIntegrationTest.java | 42 ----------------- ...etterResourceInjectionIntegrationTest.java | 33 -------------- 23 files changed, 1 insertion(+), 573 deletions(-) delete mode 100644 spring-core/src/main/java/com/baeldung/lombok/ApologizeService.java delete mode 100644 spring-core/src/main/java/com/baeldung/lombok/FarewellService.java delete mode 100644 spring-core/src/main/java/com/baeldung/lombok/GreetingService.java delete mode 100644 spring-core/src/main/java/com/baeldung/lombok/ThankingService.java delete mode 100644 spring-core/src/main/java/com/baeldung/lombok/Translator.java delete mode 100644 spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java delete mode 100644 spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java delete mode 100644 spring-core/src/test/java/com/baeldung/lombok/ApologizeServiceAutowiringIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/lombok/ApologizeServiceIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/lombok/FarewellAutowiringIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/lombok/FarewellServiceIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/lombok/GreetingServiceIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/lombok/TestConfig.java delete mode 100644 spring-core/src/test/java/com/baeldung/lombok/ThankingServiceAutowiringIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/lombok/ThankingServiceIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/resource/FieldResourceInjectionIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/resource/MethodByQualifierResourceIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/resource/MethodByTypeResourceIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/resource/MethodResourceInjectionIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/resource/NamedResourceIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/resource/QualifierResourceInjectionIntegrationTest.java delete mode 100644 spring-core/src/test/java/com/baeldung/resource/SetterResourceInjectionIntegrationTest.java diff --git a/spring-core/README.md b/spring-core/README.md index 1f3dcb783b..b8d46f6b34 100644 --- a/spring-core/README.md +++ b/spring-core/README.md @@ -3,10 +3,8 @@ This module contains articles about core Spring functionality ### Relevant Articles: -- [Wiring in Spring: @Autowired, @Resource and @Inject](https://www.baeldung.com/spring-annotations-resource-inject-autowire) -- [Constructor Injection in Spring with Lombok](https://www.baeldung.com/spring-injection-lombok) + - [Introduction to Spring’s StreamUtils](https://www.baeldung.com/spring-stream-utils) -- [XML-Based Injection in Spring](https://www.baeldung.com/spring-xml-injection) - [A Quick Guide to the Spring @Lazy Annotation](https://www.baeldung.com/spring-lazy-annotation) - [BeanNameAware and BeanFactoryAware Interfaces in Spring](https://www.baeldung.com/spring-bean-name-factory-aware) - [Access a File from the Classpath in a Spring Application](https://www.baeldung.com/spring-classpath-file-access) diff --git a/spring-core/src/main/java/com/baeldung/lombok/ApologizeService.java b/spring-core/src/main/java/com/baeldung/lombok/ApologizeService.java deleted file mode 100644 index 76c3df8217..0000000000 --- a/spring-core/src/main/java/com/baeldung/lombok/ApologizeService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.lombok; - -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -@RequiredArgsConstructor -public class ApologizeService { - - private final Translator translator; - private final String message; - - @Autowired - public ApologizeService(Translator translator) { - this(translator, "sorry"); - } - - public String apologize() { - return translator.translate(message); - } -} diff --git a/spring-core/src/main/java/com/baeldung/lombok/FarewellService.java b/spring-core/src/main/java/com/baeldung/lombok/FarewellService.java deleted file mode 100644 index 4e8c4993cb..0000000000 --- a/spring-core/src/main/java/com/baeldung/lombok/FarewellService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.lombok; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class FarewellService { - - private final Translator translator; - - public FarewellService(Translator translator) { - this.translator = translator; - } - - public String farewell() { - return translator.translate("bye"); - } -} diff --git a/spring-core/src/main/java/com/baeldung/lombok/GreetingService.java b/spring-core/src/main/java/com/baeldung/lombok/GreetingService.java deleted file mode 100644 index 0e03e177e1..0000000000 --- a/spring-core/src/main/java/com/baeldung/lombok/GreetingService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.lombok; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class GreetingService { - - @Autowired - private Translator translator; - - public String greet() { - return translator.translate("hello"); - } -} diff --git a/spring-core/src/main/java/com/baeldung/lombok/ThankingService.java b/spring-core/src/main/java/com/baeldung/lombok/ThankingService.java deleted file mode 100644 index 2e0c398d2d..0000000000 --- a/spring-core/src/main/java/com/baeldung/lombok/ThankingService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.lombok; - -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -@Component -@RequiredArgsConstructor -public class ThankingService { - - private final Translator translator; - - public String thank() { - return translator.translate("thank you"); - } -} diff --git a/spring-core/src/main/java/com/baeldung/lombok/Translator.java b/spring-core/src/main/java/com/baeldung/lombok/Translator.java deleted file mode 100644 index 2dea20b726..0000000000 --- a/spring-core/src/main/java/com/baeldung/lombok/Translator.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.baeldung.lombok; - -public interface Translator { - String translate(String input); -} diff --git a/spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java b/spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java deleted file mode 100644 index cb1b5981e8..0000000000 --- a/spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.configuration; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.io.File; - -@Configuration -public class ApplicationContextTestResourceNameType { - - @Bean(name = "namedFile") - public File namedFile() { - File namedFile = new File("namedFile.txt"); - return namedFile; - } -} diff --git a/spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java b/spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java deleted file mode 100644 index c9aa2f4a7d..0000000000 --- a/spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.configuration; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.io.File; - -@Configuration -public class ApplicationContextTestResourceQualifier { - - @Bean(name = "defaultFile") - public File defaultFile() { - File defaultFile = new File("defaultFile.txt"); - return defaultFile; - } - - @Bean(name = "namedFile") - public File namedFile() { - File namedFile = new File("namedFile.txt"); - return namedFile; - } -} diff --git a/spring-core/src/test/java/com/baeldung/lombok/ApologizeServiceAutowiringIntegrationTest.java b/spring-core/src/test/java/com/baeldung/lombok/ApologizeServiceAutowiringIntegrationTest.java deleted file mode 100644 index a49dd84f11..0000000000 --- a/spring-core/src/test/java/com/baeldung/lombok/ApologizeServiceAutowiringIntegrationTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.lombok; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = TestConfig.class) -public class ApologizeServiceAutowiringIntegrationTest { - - private final static String TRANSLATED = "TRANSLATED"; - - @Autowired - private ApologizeService apologizeService; - - @Autowired - private Translator translator; - - @Test - public void apologizeWithTranslatedMessage() { - when(translator.translate("sorry")).thenReturn(TRANSLATED); - assertEquals(TRANSLATED, apologizeService.apologize()); - } - -} \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/lombok/ApologizeServiceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/lombok/ApologizeServiceIntegrationTest.java deleted file mode 100644 index 77f0c94299..0000000000 --- a/spring-core/src/test/java/com/baeldung/lombok/ApologizeServiceIntegrationTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.lombok; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class ApologizeServiceIntegrationTest { - - private final static String MESSAGE = "MESSAGE"; - private final static String TRANSLATED = "TRANSLATED"; - - @Test - public void apologizeWithCustomTranslatedMessage() { - Translator translator = mock(Translator.class); - ApologizeService apologizeService = new ApologizeService(translator, MESSAGE); - when(translator.translate(MESSAGE)).thenReturn(TRANSLATED); - assertEquals(TRANSLATED, apologizeService.apologize()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/lombok/FarewellAutowiringIntegrationTest.java b/spring-core/src/test/java/com/baeldung/lombok/FarewellAutowiringIntegrationTest.java deleted file mode 100644 index ec0793bd2e..0000000000 --- a/spring-core/src/test/java/com/baeldung/lombok/FarewellAutowiringIntegrationTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.lombok; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = TestConfig.class) -public class FarewellAutowiringIntegrationTest { - - @Autowired - private FarewellService farewellService; - - @Autowired - private Translator translator; - - @Test - public void sayByeWithTranslatedMessage() { - String translated = "translated"; - when(translator.translate("bye")).thenReturn(translated); - assertEquals(translated, farewellService.farewell()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/lombok/FarewellServiceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/lombok/FarewellServiceIntegrationTest.java deleted file mode 100644 index 38959a511f..0000000000 --- a/spring-core/src/test/java/com/baeldung/lombok/FarewellServiceIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.lombok; - -import org.junit.Test; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class FarewellServiceIntegrationTest { - - private final static String TRANSLATED = "TRANSLATED"; - - @Test - public void sayByeWithTranslatedMessage() { - Translator translator = mock(Translator.class); - when(translator.translate("bye")).thenReturn(TRANSLATED); - FarewellService farewellService = new FarewellService(translator); - assertEquals(TRANSLATED, farewellService.farewell()); - } -} \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/lombok/GreetingServiceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/lombok/GreetingServiceIntegrationTest.java deleted file mode 100644 index 0516b5eb56..0000000000 --- a/spring-core/src/test/java/com/baeldung/lombok/GreetingServiceIntegrationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.lombok; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = TestConfig.class) -public class GreetingServiceIntegrationTest { - - @Autowired - private GreetingService greetingService; - - @Autowired - private Translator translator; - - @Test - public void greetWithTranslatedMessage() { - String translated = "translated"; - when(translator.translate("hello")).thenReturn(translated); - assertEquals(translated, greetingService.greet()); - } - - @Test(expected = NullPointerException.class) - public void throwWhenInstantiated() { - GreetingService greetingService = new GreetingService(); - greetingService.greet(); - } -} \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/lombok/TestConfig.java b/spring-core/src/test/java/com/baeldung/lombok/TestConfig.java deleted file mode 100644 index 3278a8188f..0000000000 --- a/spring-core/src/test/java/com/baeldung/lombok/TestConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.lombok; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -import static org.mockito.Mockito.mock; - -@Configuration -@ComponentScan("com.baeldung.lombok") -class TestConfig { - - @Bean - public Translator mockTranslator() { - return mock(Translator.class); - } -} diff --git a/spring-core/src/test/java/com/baeldung/lombok/ThankingServiceAutowiringIntegrationTest.java b/spring-core/src/test/java/com/baeldung/lombok/ThankingServiceAutowiringIntegrationTest.java deleted file mode 100644 index fb9abbad46..0000000000 --- a/spring-core/src/test/java/com/baeldung/lombok/ThankingServiceAutowiringIntegrationTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.lombok; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = TestConfig.class) -public class ThankingServiceAutowiringIntegrationTest { - - @Autowired - private ThankingService thankingService; - - @Autowired - private Translator translator; - - @Test - public void thankWithTranslatedMessage() { - String translated = "translated"; - when(translator.translate("thank you")).thenReturn(translated); - assertEquals(translated, thankingService.thank()); - } -} \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/lombok/ThankingServiceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/lombok/ThankingServiceIntegrationTest.java deleted file mode 100644 index 680f926717..0000000000 --- a/spring-core/src/test/java/com/baeldung/lombok/ThankingServiceIntegrationTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.lombok; - -import org.junit.Test; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class ThankingServiceIntegrationTest { - - private final static String TRANSLATED = "TRANSLATED"; - - @Test - public void thankWithTranslatedMessage() { - Translator translator = mock(Translator.class); - when(translator.translate("thank you")).thenReturn(TRANSLATED); - ThankingService thankingService = new ThankingService(translator); - assertEquals(TRANSLATED, thankingService.thank()); - } -} \ No newline at end of file diff --git a/spring-core/src/test/java/com/baeldung/resource/FieldResourceInjectionIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/FieldResourceInjectionIntegrationTest.java deleted file mode 100644 index 63a25cb499..0000000000 --- a/spring-core/src/test/java/com/baeldung/resource/FieldResourceInjectionIntegrationTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.resource; - -import com.baeldung.configuration.ApplicationContextTestResourceNameType; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.annotation.Resource; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestResourceNameType.class) -public class FieldResourceInjectionIntegrationTest { - - @Resource(name = "namedFile") - private File defaultFile; - - @Test - public void givenResourceAnnotation_WhenOnField_ThenDependencyValid() { - assertNotNull(defaultFile); - assertEquals("namedFile.txt", defaultFile.getName()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/resource/MethodByQualifierResourceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/MethodByQualifierResourceIntegrationTest.java deleted file mode 100644 index f5bb9f10cf..0000000000 --- a/spring-core/src/test/java/com/baeldung/resource/MethodByQualifierResourceIntegrationTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baeldung.resource; - -import com.baeldung.configuration.ApplicationContextTestResourceQualifier; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.annotation.Resource; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestResourceQualifier.class) -public class MethodByQualifierResourceIntegrationTest { - - private File arbDependency; - private File anotherArbDependency; - - @Test - public void givenResourceQualifier_WhenSetter_ThenValidDependencies() { - assertNotNull(arbDependency); - assertEquals("namedFile.txt", arbDependency.getName()); - assertNotNull(anotherArbDependency); - assertEquals("defaultFile.txt", anotherArbDependency.getName()); - } - - @Resource - @Qualifier("namedFile") - public void setArbDependency(File arbDependency) { - this.arbDependency = arbDependency; - } - - @Resource - @Qualifier("defaultFile") - public void setAnotherArbDependency(File anotherArbDependency) { - this.anotherArbDependency = anotherArbDependency; - } -} diff --git a/spring-core/src/test/java/com/baeldung/resource/MethodByTypeResourceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/MethodByTypeResourceIntegrationTest.java deleted file mode 100644 index 171cbfea47..0000000000 --- a/spring-core/src/test/java/com/baeldung/resource/MethodByTypeResourceIntegrationTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.resource; - -import com.baeldung.configuration.ApplicationContextTestResourceNameType; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.annotation.Resource; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestResourceNameType.class) -public class MethodByTypeResourceIntegrationTest { - - private File defaultFile; - - @Resource - protected void setDefaultFile(File defaultFile) { - this.defaultFile = defaultFile; - } - - @Test - public void givenResourceAnnotation_WhenSetter_ThenValidDependency() { - assertNotNull(defaultFile); - assertEquals("namedFile.txt", defaultFile.getName()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/resource/MethodResourceInjectionIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/MethodResourceInjectionIntegrationTest.java deleted file mode 100644 index 2e1c3c39a9..0000000000 --- a/spring-core/src/test/java/com/baeldung/resource/MethodResourceInjectionIntegrationTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.resource; - -import com.baeldung.configuration.ApplicationContextTestResourceNameType; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.annotation.Resource; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestResourceNameType.class) -public class MethodResourceInjectionIntegrationTest { - - private File defaultFile; - - @Resource(name = "namedFile") - protected void setDefaultFile(File defaultFile) { - this.defaultFile = defaultFile; - } - - @Test - public void givenResourceAnnotation_WhenSetter_ThenDependencyValid() { - assertNotNull(defaultFile); - assertEquals("namedFile.txt", defaultFile.getName()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/resource/NamedResourceIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/NamedResourceIntegrationTest.java deleted file mode 100644 index d52660e9b8..0000000000 --- a/spring-core/src/test/java/com/baeldung/resource/NamedResourceIntegrationTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.resource; - -import com.baeldung.configuration.ApplicationContextTestResourceNameType; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.annotation.Resource; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestResourceNameType.class) -public class NamedResourceIntegrationTest { - - @Resource(name = "namedFile") - private File testFile; - - @Test - public void givenResourceAnnotation_WhenOnField_THEN_DEPENDENCY_Found() { - assertNotNull(testFile); - assertEquals("namedFile.txt", testFile.getName()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/resource/QualifierResourceInjectionIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/QualifierResourceInjectionIntegrationTest.java deleted file mode 100644 index 3f812350c9..0000000000 --- a/spring-core/src/test/java/com/baeldung/resource/QualifierResourceInjectionIntegrationTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.resource; - -import com.baeldung.configuration.ApplicationContextTestResourceQualifier; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.annotation.Resource; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestResourceQualifier.class) -public class QualifierResourceInjectionIntegrationTest { - - @Resource - @Qualifier("defaultFile") - private File dependency1; - - @Resource - @Qualifier("namedFile") - private File dependency2; - - @Test - public void givenResourceAnnotation_WhenField_ThenDependency1Valid() { - assertNotNull(dependency1); - assertEquals("defaultFile.txt", dependency1.getName()); - } - - @Test - public void givenResourceQualifier_WhenField_ThenDependency2Valid() { - assertNotNull(dependency2); - assertEquals("namedFile.txt", dependency2.getName()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/resource/SetterResourceInjectionIntegrationTest.java b/spring-core/src/test/java/com/baeldung/resource/SetterResourceInjectionIntegrationTest.java deleted file mode 100644 index ae13b2336a..0000000000 --- a/spring-core/src/test/java/com/baeldung/resource/SetterResourceInjectionIntegrationTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.resource; - -import com.baeldung.configuration.ApplicationContextTestResourceNameType; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.annotation.Resource; -import java.io.File; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestResourceNameType.class) -public class SetterResourceInjectionIntegrationTest { - - private File defaultFile; - - @Resource - protected void setDefaultFile(File defaultFile) { - this.defaultFile = defaultFile; - } - - @Test - public void givenResourceAnnotation_WhenOnSetter_THEN_MUST_INJECT_Dependency() { - assertNotNull(defaultFile); - assertEquals("namedFile.txt", defaultFile.getName()); - } -} From cf4ed21884090db86ff4b86ace4b506193b5a2c2 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 15 Jul 2020 17:25:43 +0530 Subject: [PATCH 0105/1862] JAVA-628: Moved 4 articles from spring-core-2 --- spring-core-2/README.md | 4 - .../CustomAnnotationConfiguration.java | 9 -- .../baeldung/customannotation/DataAccess.java | 14 --- .../DataAccessAnnotationProcessor.java | 37 ------- .../DataAccessFieldCallback.java | 96 ------------------- .../baeldung/customannotation/GenericDAO.java | 30 ------ .../com/baeldung/customscope/TenantBean.java | 14 --- .../TenantBeanFactoryPostProcessor.java | 13 --- .../customscope/TenantBeansConfig.java | 21 ---- .../com/baeldung/customscope/TenantScope.java | 43 --------- .../customscope/TenantScopeConfig.java | 14 --- .../baeldung/sampleabstract/BallService.java | 28 ------ .../sampleabstract/BasketballService.java | 13 --- .../com/baeldung/sampleabstract/DemoApp.java | 18 ---- .../sampleabstract/LogRepository.java | 12 --- .../sampleabstract/RuleRepository.java | 12 --- .../startup/AllStrategiesExampleBean.java | 35 ------- .../startup/EventListenerExampleBean.java | 21 ---- .../startup/InitMethodExampleBean.java | 24 ----- .../startup/InitializingBeanExampleBean.java | 26 ----- .../startup/InvalidInitExampleBean.java | 18 ---- .../LogicInConstructorExampleBean.java | 22 ----- .../startup/PostConstructExampleBean.java | 27 ------ .../baeldung/startup/SpringStartupConfig.java | 9 -- .../StartupApplicationListenerExample.java | 22 ----- .../src/main/resources/startupConfig.xml | 16 ---- .../baeldung/customannotation/Account.java | 40 -------- .../customannotation/BeanWithGenericDAO.java | 18 ---- .../DataAccessAnnotationIntegrationTest.java | 57 ----------- ...ataAccessFieldCallbackIntegrationTest.java | 51 ---------- .../com/baeldung/customannotation/Person.java | 31 ------ .../TenantScopeIntegrationTest.java | 72 -------------- .../startup/SpringStartupIntegrationTest.java | 44 --------- ...SpringStartupXMLConfigIntegrationTest.java | 26 ----- 34 files changed, 937 deletions(-) delete mode 100644 spring-core-2/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customannotation/DataAccess.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customannotation/GenericDAO.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customscope/TenantBean.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customscope/TenantBeansConfig.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customscope/TenantScope.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/customscope/TenantScopeConfig.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/sampleabstract/BallService.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/sampleabstract/BasketballService.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/sampleabstract/DemoApp.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/sampleabstract/LogRepository.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/sampleabstract/RuleRepository.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/EventListenerExampleBean.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/InitMethodExampleBean.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/PostConstructExampleBean.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/SpringStartupConfig.java delete mode 100644 spring-core-2/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java delete mode 100644 spring-core-2/src/main/resources/startupConfig.xml delete mode 100644 spring-core-2/src/test/java/com/baeldung/customannotation/Account.java delete mode 100644 spring-core-2/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java delete mode 100644 spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java delete mode 100644 spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java delete mode 100644 spring-core-2/src/test/java/com/baeldung/customannotation/Person.java delete mode 100644 spring-core-2/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java delete mode 100644 spring-core-2/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java delete mode 100644 spring-core-2/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java diff --git a/spring-core-2/README.md b/spring-core-2/README.md index 10d3080b45..3c6bd05876 100644 --- a/spring-core-2/README.md +++ b/spring-core-2/README.md @@ -6,13 +6,9 @@ This module contains articles about core Spring functionality - [Guide to Spring @Autowired](http://www.baeldung.com/spring-autowire) - [Spring Profiles](http://www.baeldung.com/spring-profiles) -- [A Spring Custom Annotation for a Better DAO](http://www.baeldung.com/spring-annotation-bean-pre-processor) - [Quick Guide to Spring Bean Scopes](http://www.baeldung.com/spring-bean-scopes) -- [Custom Scope in Spring](http://www.baeldung.com/spring-custom-scope) - [@Order in Spring](http://www.baeldung.com/spring-order) - [Spring @Primary Annotation](http://www.baeldung.com/spring-primary) - [Spring Events](https://www.baeldung.com/spring-events) - [Spring Null-Safety Annotations](https://www.baeldung.com/spring-null-safety-annotations) -- [Using @Autowired in Abstract Classes](https://www.baeldung.com/spring-autowired-abstract-class) -- [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring) - More articles: [[<-- prev]](/spring-core)[[next -->]](/spring-core-3) diff --git a/spring-core-2/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java b/spring-core-2/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java deleted file mode 100644 index 2e42a3f744..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.customannotation; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ComponentScan("com.baeldung.customannotation") -public class CustomAnnotationConfiguration { -} diff --git a/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccess.java b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccess.java deleted file mode 100644 index 4160bad16d..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccess.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.customannotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) -@Documented -public @interface DataAccess { - Class entity(); -} diff --git a/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java deleted file mode 100644 index 27008176a8..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.customannotation; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.stereotype.Component; -import org.springframework.util.ReflectionUtils; -import org.springframework.util.ReflectionUtils.FieldCallback; - -@Component -public class DataAccessAnnotationProcessor implements BeanPostProcessor { - - private ConfigurableListableBeanFactory configurableListableBeanFactory; - - @Autowired - public DataAccessAnnotationProcessor(ConfigurableListableBeanFactory bf) { - configurableListableBeanFactory = bf; - } - - @Override - public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { - scanDataAccessAnnotation(bean, beanName); - return bean; - } - - @Override - public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { - return bean; - } - - protected void scanDataAccessAnnotation(Object bean, String beanName) { - Class managedBeanClass = bean.getClass(); - FieldCallback fcb = new DataAccessFieldCallback(configurableListableBeanFactory, bean); - ReflectionUtils.doWithFields(managedBeanClass, fcb); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java b/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java deleted file mode 100644 index 07b5298ea9..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.baeldung.customannotation; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.util.ReflectionUtils; -import org.springframework.util.ReflectionUtils.FieldCallback; - -public final class DataAccessFieldCallback implements FieldCallback { - - private static Logger logger = LoggerFactory.getLogger(DataAccessFieldCallback.class); - private static int AUTOWIRE_MODE = AutowireCapableBeanFactory.AUTOWIRE_BY_NAME; - - private static String ERROR_ENTITY_VALUE_NOT_SAME = "@DataAccess(entity) " + "value should have same type with injected generic type."; - private static String WARN_NON_GENERIC_VALUE = "@DataAccess annotation assigned " + "to raw (non-generic) declaration. This will make your code less type-safe."; - private static String ERROR_CREATE_INSTANCE = "Cannot create instance of " + "type '{}' or instance creation is failed because: {}"; - - private ConfigurableListableBeanFactory configurableListableBeanFactory; - private Object bean; - - public DataAccessFieldCallback(final ConfigurableListableBeanFactory bf, final Object bean) { - configurableListableBeanFactory = bf; - this.bean = bean; - } - - @Override - public void doWith(final Field field) throws IllegalArgumentException, IllegalAccessException { - if (!field.isAnnotationPresent(DataAccess.class)) { - return; - } - ReflectionUtils.makeAccessible(field); - final Type fieldGenericType = field.getGenericType(); - // In this example, get actual "GenericDAO' type. - final Class generic = field.getType(); - final Class classValue = field.getDeclaredAnnotation(DataAccess.class).entity(); - - if (genericTypeIsValid(classValue, fieldGenericType)) { - final String beanName = classValue.getSimpleName() + generic.getSimpleName(); - final Object beanInstance = getBeanInstance(beanName, generic, classValue); - field.set(bean, beanInstance); - } else { - throw new IllegalArgumentException(ERROR_ENTITY_VALUE_NOT_SAME); - } - } - - /** - * For example, if user write: - *
    -     * @DataAccess(entity=Person.class) 
    -     * private GenericDAO<Account> personGenericDAO;
    -     * 
    - * then this is should be failed. - */ - public boolean genericTypeIsValid(final Class clazz, final Type field) { - if (field instanceof ParameterizedType) { - final ParameterizedType parameterizedType = (ParameterizedType) field; - final Type type = parameterizedType.getActualTypeArguments()[0]; - - return type.equals(clazz); - } else { - logger.warn(WARN_NON_GENERIC_VALUE); - return true; - } - } - - public final Object getBeanInstance(final String beanName, final Class genericClass, final Class paramClass) { - Object daoInstance = null; - if (!configurableListableBeanFactory.containsBean(beanName)) { - logger.info("Creating new DataAccess bean named '{}'.", beanName); - - Object toRegister = null; - try { - final Constructor ctr = genericClass.getConstructor(Class.class); - toRegister = ctr.newInstance(paramClass); - } catch (final Exception e) { - logger.error(ERROR_CREATE_INSTANCE, genericClass.getTypeName(), e); - throw new RuntimeException(e); - } - - daoInstance = configurableListableBeanFactory.initializeBean(toRegister, beanName); - configurableListableBeanFactory.autowireBeanProperties(daoInstance, AUTOWIRE_MODE, true); - configurableListableBeanFactory.registerSingleton(beanName, daoInstance); - logger.info("Bean named '{}' created successfully.", beanName); - } else { - daoInstance = configurableListableBeanFactory.getBean(beanName); - logger.info("Bean named '{}' already exist used as current bean reference.", beanName); - } - return daoInstance; - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/customannotation/GenericDAO.java b/spring-core-2/src/main/java/com/baeldung/customannotation/GenericDAO.java deleted file mode 100644 index 0edd33b049..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customannotation/GenericDAO.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.customannotation; - -import java.util.Collections; -import java.util.List; -import java.util.Optional; - -public class GenericDAO { - - private Class entityClass; - private String message; - - public GenericDAO(Class entityClass) { - this.entityClass = entityClass; - } - - public List findAll() { - message = "Would create findAll query from " + entityClass.getSimpleName(); - return Collections.emptyList(); - } - - public Optional persist(E toPersist) { - message = "Would create persist query from " + toPersist.getClass().getSimpleName(); - return Optional.empty(); - } - - /** Only used for unit-testing. */ - public final String getMessage() { - return message; - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/customscope/TenantBean.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBean.java deleted file mode 100644 index e892ae9d9b..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customscope/TenantBean.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.customscope; - -public class TenantBean { - - private final String name; - - public TenantBean(String name) { - this.name = name; - } - - public void sayHello() { - System.out.println(String.format("Hello from %s of type %s", this.name, this.getClass().getName())); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java deleted file mode 100644 index 84ed0b46d7..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.customscope; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; - -public class TenantBeanFactoryPostProcessor implements BeanFactoryPostProcessor { - - @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory factory) throws BeansException { - factory.registerScope("tenant", new TenantScope()); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeansConfig.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeansConfig.java deleted file mode 100644 index c219000fe6..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customscope/TenantBeansConfig.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.customscope; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Scope; - -@Configuration -public class TenantBeansConfig { - - @Scope(scopeName = "tenant") - @Bean - public TenantBean foo() { - return new TenantBean("foo"); - } - - @Scope(scopeName = "tenant") - @Bean - public TenantBean bar() { - return new TenantBean("bar"); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/customscope/TenantScope.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantScope.java deleted file mode 100644 index f3077bc4c2..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customscope/TenantScope.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.baeldung.customscope; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.springframework.beans.factory.ObjectFactory; -import org.springframework.beans.factory.config.Scope; - -public class TenantScope implements Scope { - - private Map scopedObjects = Collections.synchronizedMap(new HashMap()); - private Map destructionCallbacks = Collections.synchronizedMap(new HashMap()); - - @Override - public Object get(String name, ObjectFactory objectFactory) { - if (!scopedObjects.containsKey(name)) { - scopedObjects.put(name, objectFactory.getObject()); - } - return scopedObjects.get(name); - } - - @Override - public Object remove(String name) { - destructionCallbacks.remove(name); - return scopedObjects.remove(name); - } - - @Override - public void registerDestructionCallback(String name, Runnable callback) { - destructionCallbacks.put(name, callback); - } - - @Override - public Object resolveContextualObject(String key) { - return null; - } - - @Override - public String getConversationId() { - return "tenant"; - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/customscope/TenantScopeConfig.java b/spring-core-2/src/main/java/com/baeldung/customscope/TenantScopeConfig.java deleted file mode 100644 index 1829e1e8c4..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/customscope/TenantScopeConfig.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.customscope; - -import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class TenantScopeConfig { - - @Bean - public static BeanFactoryPostProcessor beanFactoryPostProcessor() { - return new TenantBeanFactoryPostProcessor(); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/sampleabstract/BallService.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/BallService.java deleted file mode 100644 index 0d951aac8b..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/sampleabstract/BallService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.sampleabstract; - -import org.springframework.beans.factory.annotation.Autowired; - -import javax.annotation.PostConstruct; - -public abstract class BallService { - - private RuleRepository ruleRepository; - - private LogRepository logRepository; - - public BallService(RuleRepository ruleRepository) { - this.ruleRepository = ruleRepository; - } - - @Autowired - public final void setLogRepository(LogRepository logRepository) { - this.logRepository = logRepository; - } - - @PostConstruct - public void afterInitialize() { - - System.out.println(ruleRepository.toString()); - System.out.println(logRepository.toString()); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/sampleabstract/BasketballService.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/BasketballService.java deleted file mode 100644 index 4d6345b069..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/sampleabstract/BasketballService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.sampleabstract; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class BasketballService extends BallService { - - @Autowired - public BasketballService(RuleRepository ruleRepository) { - super(ruleRepository); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/sampleabstract/DemoApp.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/DemoApp.java deleted file mode 100644 index 5a308b2671..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/sampleabstract/DemoApp.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.sampleabstract; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ComponentScan(basePackages = "com.baeldung.sampleabstract") -public class DemoApp { - - - public static void main(String[] args) { - - ApplicationContext applicationContext = new AnnotationConfigApplicationContext(DemoApp.class); - } - -} diff --git a/spring-core-2/src/main/java/com/baeldung/sampleabstract/LogRepository.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/LogRepository.java deleted file mode 100644 index 84979768b5..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/sampleabstract/LogRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.sampleabstract; - -import org.springframework.stereotype.Component; - -@Component -public class LogRepository { - - @Override - public String toString() { - return "logRepository"; - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/sampleabstract/RuleRepository.java b/spring-core-2/src/main/java/com/baeldung/sampleabstract/RuleRepository.java deleted file mode 100644 index a1c5b5067f..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/sampleabstract/RuleRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.sampleabstract; - -import org.springframework.stereotype.Component; - -@Component -public class RuleRepository { - - @Override - public String toString() { - return "ruleRepository"; - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java deleted file mode 100644 index e08309d474..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.startup; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.springframework.beans.factory.InitializingBean; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; - -@Component -@Scope(value = "prototype") -public class AllStrategiesExampleBean implements InitializingBean { - - private static final Logger LOG = LoggerFactory.getLogger(AllStrategiesExampleBean.class); - - public AllStrategiesExampleBean() { - LOG.info("Constructor"); - } - - @Override - public void afterPropertiesSet() throws Exception { - LOG.info("InitializingBean"); - } - - @PostConstruct - public void postConstruct() { - LOG.info("PostConstruct"); - } - - public void init() { - LOG.info("init-method"); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/startup/EventListenerExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/EventListenerExampleBean.java deleted file mode 100644 index a76fc6a2b2..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/EventListenerExampleBean.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.startup; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.context.event.EventListener; -import org.springframework.stereotype.Component; - -@Component -public class EventListenerExampleBean { - private static final Logger LOG = LoggerFactory.getLogger(EventListenerExampleBean.class); - - public static int counter; - - @EventListener - public void onApplicationEvent(ContextRefreshedEvent event) { - LOG.info("Increment counter"); - counter++; - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/startup/InitMethodExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/InitMethodExampleBean.java deleted file mode 100644 index a3b12028d1..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/InitMethodExampleBean.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.startup; - -import java.util.Arrays; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -@Component -@Scope(value = "prototype") -public class InitMethodExampleBean { - - private static final Logger LOG = LoggerFactory.getLogger(InitMethodExampleBean.class); - - @Autowired - private Environment environment; - - public void init() { - LOG.info("Env Default Profiles", Arrays.asList(environment.getDefaultProfiles())); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java deleted file mode 100644 index c625a172fd..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.startup; - -import java.util.Arrays; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -@Component -@Scope(value = "prototype") -public class InitializingBeanExampleBean implements InitializingBean { - - private static final Logger LOG = LoggerFactory.getLogger(InitializingBeanExampleBean.class); - - @Autowired - private Environment environment; - - @Override - public void afterPropertiesSet() throws Exception { - LOG.info("Env Default Profiles", Arrays.asList(environment.getDefaultProfiles())); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java deleted file mode 100644 index d31aee8acd..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.startup; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -@Component -@Scope("prototype") -public class InvalidInitExampleBean { - - @Autowired - private Environment environment; - - public InvalidInitExampleBean() { - environment.getActiveProfiles(); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java deleted file mode 100644 index ade7573bbe..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.startup; - -import java.util.Arrays; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -@Component -@Scope(value = "prototype") -public class LogicInConstructorExampleBean { - - private static final Logger LOG = LoggerFactory.getLogger(LogicInConstructorExampleBean.class); - - @Autowired - public LogicInConstructorExampleBean(Environment environment) { - LOG.info("Env Default Profiles", Arrays.asList(environment.getDefaultProfiles())); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/startup/PostConstructExampleBean.java b/spring-core-2/src/main/java/com/baeldung/startup/PostConstructExampleBean.java deleted file mode 100644 index 1001043d86..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/PostConstructExampleBean.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.startup; - -import java.util.Arrays; - -import javax.annotation.PostConstruct; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Scope; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -@Component -@Scope(value = "prototype") -public class PostConstructExampleBean { - - private static final Logger LOG = LoggerFactory.getLogger(PostConstructExampleBean.class); - - @Autowired - private Environment environment; - - @PostConstruct - public void init() { - LOG.info("Env Default Profiles", Arrays.asList(environment.getDefaultProfiles())); - } -} diff --git a/spring-core-2/src/main/java/com/baeldung/startup/SpringStartupConfig.java b/spring-core-2/src/main/java/com/baeldung/startup/SpringStartupConfig.java deleted file mode 100644 index ad6492dadc..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/SpringStartupConfig.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.startup; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ComponentScan("com.baeldung.startup") -public class SpringStartupConfig { -} \ No newline at end of file diff --git a/spring-core-2/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java b/spring-core-2/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java deleted file mode 100644 index 2cc5e6abcb..0000000000 --- a/spring-core-2/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.startup; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.stereotype.Component; - -@Component -public class StartupApplicationListenerExample implements ApplicationListener { - - private static final Logger LOG = LoggerFactory.getLogger(StartupApplicationListenerExample.class); - - public static int counter; - - @Override - public void onApplicationEvent(ContextRefreshedEvent event) { - LOG.info("Increment counter"); - counter++; - } -} diff --git a/spring-core-2/src/main/resources/startupConfig.xml b/spring-core-2/src/main/resources/startupConfig.xml deleted file mode 100644 index d42e0f6c2b..0000000000 --- a/spring-core-2/src/main/resources/startupConfig.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/spring-core-2/src/test/java/com/baeldung/customannotation/Account.java b/spring-core-2/src/test/java/com/baeldung/customannotation/Account.java deleted file mode 100644 index cfdd8815e4..0000000000 --- a/spring-core-2/src/test/java/com/baeldung/customannotation/Account.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.customannotation; - -import java.io.Serializable; - -public class Account implements Serializable { - - private static final long serialVersionUID = 7857541629844398625L; - - private Long id; - private String email; - private Person person; - - public Account() { - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Person getPerson() { - return person; - } - - public void setPerson(Person person) { - this.person = person; - } - -} diff --git a/spring-core-2/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java b/spring-core-2/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java deleted file mode 100644 index a0707f263b..0000000000 --- a/spring-core-2/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.customannotation; - -import org.springframework.stereotype.Repository; - -@Repository -public class BeanWithGenericDAO { - - @DataAccess(entity = Person.class) - private GenericDAO personGenericDAO; - - public BeanWithGenericDAO() { - } - - public GenericDAO getPersonGenericDAO() { - return personGenericDAO; - } - -} diff --git a/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java deleted file mode 100644 index 1baea4505b..0000000000 --- a/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.baeldung.customannotation; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.CoreMatchers.sameInstance; -import static org.junit.Assert.assertThat; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { CustomAnnotationConfiguration.class }) -public class DataAccessAnnotationIntegrationTest { - - @DataAccess(entity = Person.class) - private GenericDAO personGenericDAO; - @DataAccess(entity = Account.class) - private GenericDAO accountGenericDAO; - @DataAccess(entity = Person.class) - private GenericDAO anotherPersonGenericDAO; - - @Test - public void whenGenericDAOInitialized_thenNotNull() { - assertThat(personGenericDAO, is(notNullValue())); - assertThat(accountGenericDAO, is(notNullValue())); - } - - @Test - public void whenGenericDAOInjected_thenItIsSingleton() { - assertThat(personGenericDAO, not(sameInstance(accountGenericDAO))); - assertThat(personGenericDAO, not(equalTo(accountGenericDAO))); - - assertThat(personGenericDAO, sameInstance(anotherPersonGenericDAO)); - } - - @Test - public void whenFindAll_thenMessagesIsCorrect() { - personGenericDAO.findAll(); - assertThat(personGenericDAO.getMessage(), is("Would create findAll query from Person")); - - accountGenericDAO.findAll(); - assertThat(accountGenericDAO.getMessage(), is("Would create findAll query from Account")); - } - - @Test - public void whenPersist_thenMakeSureThatMessagesIsCorrect() { - personGenericDAO.persist(new Person()); - assertThat(personGenericDAO.getMessage(), is("Would create persist query from Person")); - - accountGenericDAO.persist(new Account()); - assertThat(accountGenericDAO.getMessage(), is("Would create persist query from Account")); - } -} diff --git a/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java deleted file mode 100644 index bc7a5f7246..0000000000 --- a/spring-core-2/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baeldung.customannotation; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; - -import java.lang.reflect.Type; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { CustomAnnotationConfiguration.class }) -public class DataAccessFieldCallbackIntegrationTest { - - @Autowired - private ConfigurableListableBeanFactory configurableListableBeanFactory; - - @Autowired - private BeanWithGenericDAO beanWithGenericDAO; - - @Rule - public ExpectedException ex = ExpectedException.none(); - - @Test - public void whenObjectCreated_thenObjectCreationIsSuccessful() { - final DataAccessFieldCallback dataAccessFieldCallback = new DataAccessFieldCallback(configurableListableBeanFactory, beanWithGenericDAO); - assertThat(dataAccessFieldCallback, is(notNullValue())); - } - - @Test - public void whenMethodGenericTypeIsValidCalled_thenReturnCorrectValue() throws NoSuchFieldException, SecurityException { - final DataAccessFieldCallback callback = new DataAccessFieldCallback(configurableListableBeanFactory, beanWithGenericDAO); - final Type fieldType = BeanWithGenericDAO.class.getDeclaredField("personGenericDAO").getGenericType(); - final boolean result = callback.genericTypeIsValid(Person.class, fieldType); - assertThat(result, is(true)); - } - - @Test - public void whenMethodGetBeanInstanceCalled_thenReturnCorrectInstance() { - final DataAccessFieldCallback callback = new DataAccessFieldCallback(configurableListableBeanFactory, beanWithGenericDAO); - final Object result = callback.getBeanInstance("personGenericDAO", GenericDAO.class, Person.class); - assertThat((result instanceof GenericDAO), is(true)); - } -} diff --git a/spring-core-2/src/test/java/com/baeldung/customannotation/Person.java b/spring-core-2/src/test/java/com/baeldung/customannotation/Person.java deleted file mode 100644 index 4fa70e51af..0000000000 --- a/spring-core-2/src/test/java/com/baeldung/customannotation/Person.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.customannotation; - -import java.io.Serializable; - -public class Person implements Serializable { - - private static final long serialVersionUID = 9005331414216374586L; - - private Long id; - private String name; - - public Person() { - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} diff --git a/spring-core-2/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java deleted file mode 100644 index 1cd7357a09..0000000000 --- a/spring-core-2/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baeldung.customscope; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.util.Map; - -import org.junit.Test; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -public class TenantScopeIntegrationTest { - - @Test - public final void whenRegisterScopeAndBeans_thenContextContainsFooAndBar() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - try { - ctx.register(TenantScopeConfig.class); - ctx.register(TenantBeansConfig.class); - ctx.refresh(); - - TenantBean foo = (TenantBean) ctx.getBean("foo", TenantBean.class); - foo.sayHello(); - TenantBean bar = (TenantBean) ctx.getBean("bar", TenantBean.class); - bar.sayHello(); - Map foos = ctx.getBeansOfType(TenantBean.class); - - assertThat(foo, not(equalTo(bar))); - assertThat(foos.size(), equalTo(2)); - assertTrue(foos.containsValue(foo)); - assertTrue(foos.containsValue(bar)); - - BeanDefinition fooDefinition = ctx.getBeanDefinition("foo"); - BeanDefinition barDefinition = ctx.getBeanDefinition("bar"); - - assertThat(fooDefinition.getScope(), equalTo("tenant")); - assertThat(barDefinition.getScope(), equalTo("tenant")); - } finally { - ctx.close(); - } - } - - @Test - public final void whenComponentScan_thenContextContainsFooAndBar() { - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); - try { - ctx.scan("com.baeldung.customscope"); - ctx.refresh(); - - TenantBean foo = (TenantBean) ctx.getBean("foo", TenantBean.class); - foo.sayHello(); - TenantBean bar = (TenantBean) ctx.getBean("bar", TenantBean.class); - bar.sayHello(); - Map foos = ctx.getBeansOfType(TenantBean.class); - - assertThat(foo, not(equalTo(bar))); - assertThat(foos.size(), equalTo(2)); - assertTrue(foos.containsValue(foo)); - assertTrue(foos.containsValue(bar)); - - BeanDefinition fooDefinition = ctx.getBeanDefinition("foo"); - BeanDefinition barDefinition = ctx.getBeanDefinition("bar"); - - assertThat(fooDefinition.getScope(), equalTo("tenant")); - assertThat(barDefinition.getScope(), equalTo("tenant")); - } finally { - ctx.close(); - } - } -} diff --git a/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java deleted file mode 100644 index b58c093c31..0000000000 --- a/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.startup; - -import org.assertj.core.api.Assertions; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.BeanCreationException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { SpringStartupConfig.class }, loader = AnnotationConfigContextLoader.class) -public class SpringStartupIntegrationTest { - - @Autowired - private ApplicationContext ctx; - - @Test(expected = BeanCreationException.class) - public void whenInstantiating_shouldThrowBCE() throws Exception { - ctx.getBean(InvalidInitExampleBean.class); - } - - @Test - public void whenPostConstruct_shouldLogEnv() throws Exception { - ctx.getBean(PostConstructExampleBean.class); - } - - @Test - public void whenConstructorInjection_shouldLogEnv() throws Exception { - ctx.getBean(LogicInConstructorExampleBean.class); - } - - @Test - public void whenInitializingBean_shouldLogEnv() throws Exception { - ctx.getBean(InitializingBeanExampleBean.class); - } - - @Test - public void whenApplicationListener_shouldRunOnce() throws Exception { - Assertions.assertThat(StartupApplicationListenerExample.counter).isEqualTo(1); - } -} \ No newline at end of file diff --git a/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java deleted file mode 100644 index 3dfd4835df..0000000000 --- a/spring-core-2/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.startup; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration("classpath:startupConfig.xml") -public class SpringStartupXMLConfigIntegrationTest { - - @Autowired - private ApplicationContext ctx; - - @Test - public void whenPostConstruct_shouldLogEnv() throws Exception { - ctx.getBean(InitMethodExampleBean.class); - } - - @Test - public void whenAllStrategies_shouldLogOrder() throws Exception { - ctx.getBean(AllStrategiesExampleBean.class); - } -} From c3e41be3c43254f54c9b3c4e64506c7aa9376af4 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 15 Jul 2020 17:27:20 +0530 Subject: [PATCH 0106/1862] JAVA-628: Moved 2 articles from spring-core-3 --- spring-core-3/README.md | 4 +- .../com/baeldung/collection/BaeldungBean.java | 18 ------ .../baeldung/collection/CollectionConfig.java | 50 --------------- .../collection/CollectionInjectionDemo.java | 21 ------- .../baeldung/collection/CollectionsBean.java | 62 ------------------- .../staticvalue/injection/Application.java | 16 ----- .../injection/PropertyController.java | 30 --------- 7 files changed, 2 insertions(+), 199 deletions(-) delete mode 100644 spring-core-3/src/main/java/com/baeldung/collection/BaeldungBean.java delete mode 100644 spring-core-3/src/main/java/com/baeldung/collection/CollectionConfig.java delete mode 100644 spring-core-3/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java delete mode 100644 spring-core-3/src/main/java/com/baeldung/collection/CollectionsBean.java delete mode 100644 spring-core-3/src/main/java/com/baeldung/staticvalue/injection/Application.java delete mode 100644 spring-core-3/src/main/java/com/baeldung/staticvalue/injection/PropertyController.java diff --git a/spring-core-3/README.md b/spring-core-3/README.md index 6c210b23ef..b6257cb9a4 100644 --- a/spring-core-3/README.md +++ b/spring-core-3/README.md @@ -7,8 +7,8 @@ This module contains articles about core Spring functionality - [Understanding getBean() in Spring](https://www.baeldung.com/spring-getbean) - [Guide to the Spring BeanFactory](https://www.baeldung.com/spring-beanfactory) - [How to use the Spring FactoryBean?](https://www.baeldung.com/spring-factorybean) -- [Spring – Injecting Collections](https://www.baeldung.com/spring-injecting-collections) - [Design Patterns in the Spring Framework](https://www.baeldung.com/spring-framework-design-patterns) -- [Injecting a Value in a Static Field in Spring](https://www.baeldung.com/spring-inject-static-field) - [Difference Between BeanFactory and ApplicationContext](https://www.baeldung.com/spring-beanfactory-vs-applicationcontext) +- [A Spring Custom Annotation for a Better DAO](http://www.baeldung.com/spring-annotation-bean-pre-processor) +- [Custom Scope in Spring](http://www.baeldung.com/spring-custom-scope) - More articles: [[<-- prev]](/spring-core-2) diff --git a/spring-core-3/src/main/java/com/baeldung/collection/BaeldungBean.java b/spring-core-3/src/main/java/com/baeldung/collection/BaeldungBean.java deleted file mode 100644 index 6d7351df02..0000000000 --- a/spring-core-3/src/main/java/com/baeldung/collection/BaeldungBean.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.collection; - -/** - * Created by Gebruiker on 5/22/2018. - */ -public class BaeldungBean { - - private String name; - - public BaeldungBean(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } -} diff --git a/spring-core-3/src/main/java/com/baeldung/collection/CollectionConfig.java b/spring-core-3/src/main/java/com/baeldung/collection/CollectionConfig.java deleted file mode 100644 index fbae2963e5..0000000000 --- a/spring-core-3/src/main/java/com/baeldung/collection/CollectionConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baeldung.collection; - -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.annotation.Order; - -import java.util.*; - -@Configuration -public class CollectionConfig { - - @Bean - public CollectionsBean getCollectionsBean() { - return new CollectionsBean(new HashSet<>(Arrays.asList("John", "Adam", "Harry"))); - } - - @Bean - public List nameList(){ - return Arrays.asList("John", "Adam", "Harry", null); - } - - @Bean - public Map nameMap(){ - Map nameMap = new HashMap<>(); - nameMap.put(1, "John"); - nameMap.put(2, "Adam"); - nameMap.put(3, "Harry"); - return nameMap; - } - - @Bean - @Qualifier("CollectionsBean") - @Order(2) - public BaeldungBean getElement() { - return new BaeldungBean("John"); - } - - @Bean - @Order(3) - public BaeldungBean getAnotherElement() { - return new BaeldungBean("Adam"); - } - - @Bean - @Order(1) - public BaeldungBean getOneMoreElement() { - return new BaeldungBean("Harry"); - } -} diff --git a/spring-core-3/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java b/spring-core-3/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java deleted file mode 100644 index 2ee265f134..0000000000 --- a/spring-core-3/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.collection; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -/** - * Created by Gebruiker on 5/18/2018. - */ -public class CollectionInjectionDemo { - - public static void main(String[] args) { - - ApplicationContext context = new AnnotationConfigApplicationContext(CollectionConfig.class); - CollectionsBean collectionsBean = context.getBean(CollectionsBean.class); - collectionsBean.printNameList(); - collectionsBean.printNameSet(); - collectionsBean.printNameMap(); - collectionsBean.printBeanList(); - collectionsBean.printNameListWithDefaults(); - } -} diff --git a/spring-core-3/src/main/java/com/baeldung/collection/CollectionsBean.java b/spring-core-3/src/main/java/com/baeldung/collection/CollectionsBean.java deleted file mode 100644 index fc90f2c6ff..0000000000 --- a/spring-core-3/src/main/java/com/baeldung/collection/CollectionsBean.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.baeldung.collection; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; - -/** - * Created by Gebruiker on 5/18/2018. - */ -public class CollectionsBean { - - @Autowired - private List nameList; - - private Set nameSet; - - private Map nameMap; - - @Autowired(required = false) - @Qualifier("CollectionsBean") - private List beanList = new ArrayList<>(); - - @Value("${names.list:}#{T(java.util.Collections).emptyList()}") - private List nameListWithDefaultValue; - - public CollectionsBean() { - } - - public CollectionsBean(Set strings) { - this.nameSet = strings; - } - - @Autowired - public void setNameMap(Map nameMap) { - this.nameMap = nameMap; - } - - public void printNameList() { - System.out.println(nameList); - } - - public void printNameSet() { - System.out.println(nameSet); - } - - public void printNameMap() { - System.out.println(nameMap); - } - - public void printBeanList() { - System.out.println(beanList); - } - - public void printNameListWithDefaults() { - System.out.println(nameListWithDefaultValue); - } -} diff --git a/spring-core-3/src/main/java/com/baeldung/staticvalue/injection/Application.java b/spring-core-3/src/main/java/com/baeldung/staticvalue/injection/Application.java deleted file mode 100644 index 45c47c955f..0000000000 --- a/spring-core-3/src/main/java/com/baeldung/staticvalue/injection/Application.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.staticvalue.injection; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.PropertySource; - -@SpringBootApplication -@PropertySource("/application.properties") - -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/spring-core-3/src/main/java/com/baeldung/staticvalue/injection/PropertyController.java b/spring-core-3/src/main/java/com/baeldung/staticvalue/injection/PropertyController.java deleted file mode 100644 index f5910ea4f8..0000000000 --- a/spring-core-3/src/main/java/com/baeldung/staticvalue/injection/PropertyController.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.staticvalue.injection; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Arrays; -import java.util.List; - -@RestController -public class PropertyController { - - @Value("${name}") - private String name; - - @Value("${name}") - private static String NAME_NULL; - - private static String NAME_STATIC; - - @Value("${name}") - public void setNameStatic(String name){ - PropertyController.NAME_STATIC = name; - } - - @GetMapping("/properties") - public List getProperties(){ - return Arrays.asList(this.name, NAME_STATIC, NAME_NULL) ; - } -} From 502bf3c45c3eed30562b7ef09e34b4f651ba4b80 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 15 Jul 2020 17:27:50 +0530 Subject: [PATCH 0107/1862] JAVA-628: Moved 2 articles to spring-core-3 --- .../CustomAnnotationConfiguration.java | 9 ++ .../baeldung/customannotation/DataAccess.java | 14 +++ .../DataAccessAnnotationProcessor.java | 37 +++++++ .../DataAccessFieldCallback.java | 96 +++++++++++++++++++ .../baeldung/customannotation/GenericDAO.java | 30 ++++++ .../com/baeldung/customscope/TenantBean.java | 14 +++ .../TenantBeanFactoryPostProcessor.java | 13 +++ .../customscope/TenantBeansConfig.java | 21 ++++ .../com/baeldung/customscope/TenantScope.java | 43 +++++++++ .../customscope/TenantScopeConfig.java | 14 +++ .../baeldung/customannotation/Account.java | 40 ++++++++ .../customannotation/BeanWithGenericDAO.java | 18 ++++ .../DataAccessAnnotationIntegrationTest.java | 57 +++++++++++ ...ataAccessFieldCallbackIntegrationTest.java | 51 ++++++++++ .../com/baeldung/customannotation/Person.java | 31 ++++++ .../TenantScopeIntegrationTest.java | 72 ++++++++++++++ 16 files changed, 560 insertions(+) create mode 100644 spring-core-3/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customannotation/DataAccess.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customannotation/GenericDAO.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customscope/TenantBean.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customscope/TenantBeansConfig.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customscope/TenantScope.java create mode 100644 spring-core-3/src/main/java/com/baeldung/customscope/TenantScopeConfig.java create mode 100644 spring-core-3/src/test/java/com/baeldung/customannotation/Account.java create mode 100644 spring-core-3/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java create mode 100644 spring-core-3/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java create mode 100644 spring-core-3/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java create mode 100644 spring-core-3/src/test/java/com/baeldung/customannotation/Person.java create mode 100644 spring-core-3/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java diff --git a/spring-core-3/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java b/spring-core-3/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java new file mode 100644 index 0000000000..2e42a3f744 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customannotation/CustomAnnotationConfiguration.java @@ -0,0 +1,9 @@ +package com.baeldung.customannotation; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan("com.baeldung.customannotation") +public class CustomAnnotationConfiguration { +} diff --git a/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccess.java b/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccess.java new file mode 100644 index 0000000000..4160bad16d --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccess.java @@ -0,0 +1,14 @@ +package com.baeldung.customannotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Documented +public @interface DataAccess { + Class entity(); +} diff --git a/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java b/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java new file mode 100644 index 0000000000..27008176a8 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccessAnnotationProcessor.java @@ -0,0 +1,37 @@ +package com.baeldung.customannotation; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.stereotype.Component; +import org.springframework.util.ReflectionUtils; +import org.springframework.util.ReflectionUtils.FieldCallback; + +@Component +public class DataAccessAnnotationProcessor implements BeanPostProcessor { + + private ConfigurableListableBeanFactory configurableListableBeanFactory; + + @Autowired + public DataAccessAnnotationProcessor(ConfigurableListableBeanFactory bf) { + configurableListableBeanFactory = bf; + } + + @Override + public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + scanDataAccessAnnotation(bean, beanName); + return bean; + } + + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + return bean; + } + + protected void scanDataAccessAnnotation(Object bean, String beanName) { + Class managedBeanClass = bean.getClass(); + FieldCallback fcb = new DataAccessFieldCallback(configurableListableBeanFactory, bean); + ReflectionUtils.doWithFields(managedBeanClass, fcb); + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java b/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java new file mode 100644 index 0000000000..07b5298ea9 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customannotation/DataAccessFieldCallback.java @@ -0,0 +1,96 @@ +package com.baeldung.customannotation; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.config.AutowireCapableBeanFactory; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.util.ReflectionUtils; +import org.springframework.util.ReflectionUtils.FieldCallback; + +public final class DataAccessFieldCallback implements FieldCallback { + + private static Logger logger = LoggerFactory.getLogger(DataAccessFieldCallback.class); + private static int AUTOWIRE_MODE = AutowireCapableBeanFactory.AUTOWIRE_BY_NAME; + + private static String ERROR_ENTITY_VALUE_NOT_SAME = "@DataAccess(entity) " + "value should have same type with injected generic type."; + private static String WARN_NON_GENERIC_VALUE = "@DataAccess annotation assigned " + "to raw (non-generic) declaration. This will make your code less type-safe."; + private static String ERROR_CREATE_INSTANCE = "Cannot create instance of " + "type '{}' or instance creation is failed because: {}"; + + private ConfigurableListableBeanFactory configurableListableBeanFactory; + private Object bean; + + public DataAccessFieldCallback(final ConfigurableListableBeanFactory bf, final Object bean) { + configurableListableBeanFactory = bf; + this.bean = bean; + } + + @Override + public void doWith(final Field field) throws IllegalArgumentException, IllegalAccessException { + if (!field.isAnnotationPresent(DataAccess.class)) { + return; + } + ReflectionUtils.makeAccessible(field); + final Type fieldGenericType = field.getGenericType(); + // In this example, get actual "GenericDAO' type. + final Class generic = field.getType(); + final Class classValue = field.getDeclaredAnnotation(DataAccess.class).entity(); + + if (genericTypeIsValid(classValue, fieldGenericType)) { + final String beanName = classValue.getSimpleName() + generic.getSimpleName(); + final Object beanInstance = getBeanInstance(beanName, generic, classValue); + field.set(bean, beanInstance); + } else { + throw new IllegalArgumentException(ERROR_ENTITY_VALUE_NOT_SAME); + } + } + + /** + * For example, if user write: + *
    +     * @DataAccess(entity=Person.class) 
    +     * private GenericDAO<Account> personGenericDAO;
    +     * 
    + * then this is should be failed. + */ + public boolean genericTypeIsValid(final Class clazz, final Type field) { + if (field instanceof ParameterizedType) { + final ParameterizedType parameterizedType = (ParameterizedType) field; + final Type type = parameterizedType.getActualTypeArguments()[0]; + + return type.equals(clazz); + } else { + logger.warn(WARN_NON_GENERIC_VALUE); + return true; + } + } + + public final Object getBeanInstance(final String beanName, final Class genericClass, final Class paramClass) { + Object daoInstance = null; + if (!configurableListableBeanFactory.containsBean(beanName)) { + logger.info("Creating new DataAccess bean named '{}'.", beanName); + + Object toRegister = null; + try { + final Constructor ctr = genericClass.getConstructor(Class.class); + toRegister = ctr.newInstance(paramClass); + } catch (final Exception e) { + logger.error(ERROR_CREATE_INSTANCE, genericClass.getTypeName(), e); + throw new RuntimeException(e); + } + + daoInstance = configurableListableBeanFactory.initializeBean(toRegister, beanName); + configurableListableBeanFactory.autowireBeanProperties(daoInstance, AUTOWIRE_MODE, true); + configurableListableBeanFactory.registerSingleton(beanName, daoInstance); + logger.info("Bean named '{}' created successfully.", beanName); + } else { + daoInstance = configurableListableBeanFactory.getBean(beanName); + logger.info("Bean named '{}' already exist used as current bean reference.", beanName); + } + return daoInstance; + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/customannotation/GenericDAO.java b/spring-core-3/src/main/java/com/baeldung/customannotation/GenericDAO.java new file mode 100644 index 0000000000..0edd33b049 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customannotation/GenericDAO.java @@ -0,0 +1,30 @@ +package com.baeldung.customannotation; + +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +public class GenericDAO { + + private Class entityClass; + private String message; + + public GenericDAO(Class entityClass) { + this.entityClass = entityClass; + } + + public List findAll() { + message = "Would create findAll query from " + entityClass.getSimpleName(); + return Collections.emptyList(); + } + + public Optional persist(E toPersist) { + message = "Would create persist query from " + toPersist.getClass().getSimpleName(); + return Optional.empty(); + } + + /** Only used for unit-testing. */ + public final String getMessage() { + return message; + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/customscope/TenantBean.java b/spring-core-3/src/main/java/com/baeldung/customscope/TenantBean.java new file mode 100644 index 0000000000..e892ae9d9b --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customscope/TenantBean.java @@ -0,0 +1,14 @@ +package com.baeldung.customscope; + +public class TenantBean { + + private final String name; + + public TenantBean(String name) { + this.name = name; + } + + public void sayHello() { + System.out.println(String.format("Hello from %s of type %s", this.name, this.getClass().getName())); + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java new file mode 100644 index 0000000000..84ed0b46d7 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customscope/TenantBeanFactoryPostProcessor.java @@ -0,0 +1,13 @@ +package com.baeldung.customscope; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; + +public class TenantBeanFactoryPostProcessor implements BeanFactoryPostProcessor { + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory factory) throws BeansException { + factory.registerScope("tenant", new TenantScope()); + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/customscope/TenantBeansConfig.java b/spring-core-3/src/main/java/com/baeldung/customscope/TenantBeansConfig.java new file mode 100644 index 0000000000..c219000fe6 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customscope/TenantBeansConfig.java @@ -0,0 +1,21 @@ +package com.baeldung.customscope; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; + +@Configuration +public class TenantBeansConfig { + + @Scope(scopeName = "tenant") + @Bean + public TenantBean foo() { + return new TenantBean("foo"); + } + + @Scope(scopeName = "tenant") + @Bean + public TenantBean bar() { + return new TenantBean("bar"); + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/customscope/TenantScope.java b/spring-core-3/src/main/java/com/baeldung/customscope/TenantScope.java new file mode 100644 index 0000000000..f3077bc4c2 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customscope/TenantScope.java @@ -0,0 +1,43 @@ +package com.baeldung.customscope; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.factory.ObjectFactory; +import org.springframework.beans.factory.config.Scope; + +public class TenantScope implements Scope { + + private Map scopedObjects = Collections.synchronizedMap(new HashMap()); + private Map destructionCallbacks = Collections.synchronizedMap(new HashMap()); + + @Override + public Object get(String name, ObjectFactory objectFactory) { + if (!scopedObjects.containsKey(name)) { + scopedObjects.put(name, objectFactory.getObject()); + } + return scopedObjects.get(name); + } + + @Override + public Object remove(String name) { + destructionCallbacks.remove(name); + return scopedObjects.remove(name); + } + + @Override + public void registerDestructionCallback(String name, Runnable callback) { + destructionCallbacks.put(name, callback); + } + + @Override + public Object resolveContextualObject(String key) { + return null; + } + + @Override + public String getConversationId() { + return "tenant"; + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/customscope/TenantScopeConfig.java b/spring-core-3/src/main/java/com/baeldung/customscope/TenantScopeConfig.java new file mode 100644 index 0000000000..1829e1e8c4 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/customscope/TenantScopeConfig.java @@ -0,0 +1,14 @@ +package com.baeldung.customscope; + +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class TenantScopeConfig { + + @Bean + public static BeanFactoryPostProcessor beanFactoryPostProcessor() { + return new TenantBeanFactoryPostProcessor(); + } +} diff --git a/spring-core-3/src/test/java/com/baeldung/customannotation/Account.java b/spring-core-3/src/test/java/com/baeldung/customannotation/Account.java new file mode 100644 index 0000000000..cfdd8815e4 --- /dev/null +++ b/spring-core-3/src/test/java/com/baeldung/customannotation/Account.java @@ -0,0 +1,40 @@ +package com.baeldung.customannotation; + +import java.io.Serializable; + +public class Account implements Serializable { + + private static final long serialVersionUID = 7857541629844398625L; + + private Long id; + private String email; + private Person person; + + public Account() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Person getPerson() { + return person; + } + + public void setPerson(Person person) { + this.person = person; + } + +} diff --git a/spring-core-3/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java b/spring-core-3/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java new file mode 100644 index 0000000000..a0707f263b --- /dev/null +++ b/spring-core-3/src/test/java/com/baeldung/customannotation/BeanWithGenericDAO.java @@ -0,0 +1,18 @@ +package com.baeldung.customannotation; + +import org.springframework.stereotype.Repository; + +@Repository +public class BeanWithGenericDAO { + + @DataAccess(entity = Person.class) + private GenericDAO personGenericDAO; + + public BeanWithGenericDAO() { + } + + public GenericDAO getPersonGenericDAO() { + return personGenericDAO; + } + +} diff --git a/spring-core-3/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java b/spring-core-3/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java new file mode 100644 index 0000000000..1baea4505b --- /dev/null +++ b/spring-core-3/src/test/java/com/baeldung/customannotation/DataAccessAnnotationIntegrationTest.java @@ -0,0 +1,57 @@ +package com.baeldung.customannotation; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.CoreMatchers.sameInstance; +import static org.junit.Assert.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { CustomAnnotationConfiguration.class }) +public class DataAccessAnnotationIntegrationTest { + + @DataAccess(entity = Person.class) + private GenericDAO personGenericDAO; + @DataAccess(entity = Account.class) + private GenericDAO accountGenericDAO; + @DataAccess(entity = Person.class) + private GenericDAO anotherPersonGenericDAO; + + @Test + public void whenGenericDAOInitialized_thenNotNull() { + assertThat(personGenericDAO, is(notNullValue())); + assertThat(accountGenericDAO, is(notNullValue())); + } + + @Test + public void whenGenericDAOInjected_thenItIsSingleton() { + assertThat(personGenericDAO, not(sameInstance(accountGenericDAO))); + assertThat(personGenericDAO, not(equalTo(accountGenericDAO))); + + assertThat(personGenericDAO, sameInstance(anotherPersonGenericDAO)); + } + + @Test + public void whenFindAll_thenMessagesIsCorrect() { + personGenericDAO.findAll(); + assertThat(personGenericDAO.getMessage(), is("Would create findAll query from Person")); + + accountGenericDAO.findAll(); + assertThat(accountGenericDAO.getMessage(), is("Would create findAll query from Account")); + } + + @Test + public void whenPersist_thenMakeSureThatMessagesIsCorrect() { + personGenericDAO.persist(new Person()); + assertThat(personGenericDAO.getMessage(), is("Would create persist query from Person")); + + accountGenericDAO.persist(new Account()); + assertThat(accountGenericDAO.getMessage(), is("Would create persist query from Account")); + } +} diff --git a/spring-core-3/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java b/spring-core-3/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java new file mode 100644 index 0000000000..bc7a5f7246 --- /dev/null +++ b/spring-core-3/src/test/java/com/baeldung/customannotation/DataAccessFieldCallbackIntegrationTest.java @@ -0,0 +1,51 @@ +package com.baeldung.customannotation; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; + +import java.lang.reflect.Type; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { CustomAnnotationConfiguration.class }) +public class DataAccessFieldCallbackIntegrationTest { + + @Autowired + private ConfigurableListableBeanFactory configurableListableBeanFactory; + + @Autowired + private BeanWithGenericDAO beanWithGenericDAO; + + @Rule + public ExpectedException ex = ExpectedException.none(); + + @Test + public void whenObjectCreated_thenObjectCreationIsSuccessful() { + final DataAccessFieldCallback dataAccessFieldCallback = new DataAccessFieldCallback(configurableListableBeanFactory, beanWithGenericDAO); + assertThat(dataAccessFieldCallback, is(notNullValue())); + } + + @Test + public void whenMethodGenericTypeIsValidCalled_thenReturnCorrectValue() throws NoSuchFieldException, SecurityException { + final DataAccessFieldCallback callback = new DataAccessFieldCallback(configurableListableBeanFactory, beanWithGenericDAO); + final Type fieldType = BeanWithGenericDAO.class.getDeclaredField("personGenericDAO").getGenericType(); + final boolean result = callback.genericTypeIsValid(Person.class, fieldType); + assertThat(result, is(true)); + } + + @Test + public void whenMethodGetBeanInstanceCalled_thenReturnCorrectInstance() { + final DataAccessFieldCallback callback = new DataAccessFieldCallback(configurableListableBeanFactory, beanWithGenericDAO); + final Object result = callback.getBeanInstance("personGenericDAO", GenericDAO.class, Person.class); + assertThat((result instanceof GenericDAO), is(true)); + } +} diff --git a/spring-core-3/src/test/java/com/baeldung/customannotation/Person.java b/spring-core-3/src/test/java/com/baeldung/customannotation/Person.java new file mode 100644 index 0000000000..4fa70e51af --- /dev/null +++ b/spring-core-3/src/test/java/com/baeldung/customannotation/Person.java @@ -0,0 +1,31 @@ +package com.baeldung.customannotation; + +import java.io.Serializable; + +public class Person implements Serializable { + + private static final long serialVersionUID = 9005331414216374586L; + + private Long id; + private String name; + + public Person() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/spring-core-3/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java b/spring-core-3/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java new file mode 100644 index 0000000000..1cd7357a09 --- /dev/null +++ b/spring-core-3/src/test/java/com/baeldung/customscope/TenantScopeIntegrationTest.java @@ -0,0 +1,72 @@ +package com.baeldung.customscope; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.util.Map; + +import org.junit.Test; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +public class TenantScopeIntegrationTest { + + @Test + public final void whenRegisterScopeAndBeans_thenContextContainsFooAndBar() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); + try { + ctx.register(TenantScopeConfig.class); + ctx.register(TenantBeansConfig.class); + ctx.refresh(); + + TenantBean foo = (TenantBean) ctx.getBean("foo", TenantBean.class); + foo.sayHello(); + TenantBean bar = (TenantBean) ctx.getBean("bar", TenantBean.class); + bar.sayHello(); + Map foos = ctx.getBeansOfType(TenantBean.class); + + assertThat(foo, not(equalTo(bar))); + assertThat(foos.size(), equalTo(2)); + assertTrue(foos.containsValue(foo)); + assertTrue(foos.containsValue(bar)); + + BeanDefinition fooDefinition = ctx.getBeanDefinition("foo"); + BeanDefinition barDefinition = ctx.getBeanDefinition("bar"); + + assertThat(fooDefinition.getScope(), equalTo("tenant")); + assertThat(barDefinition.getScope(), equalTo("tenant")); + } finally { + ctx.close(); + } + } + + @Test + public final void whenComponentScan_thenContextContainsFooAndBar() { + AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); + try { + ctx.scan("com.baeldung.customscope"); + ctx.refresh(); + + TenantBean foo = (TenantBean) ctx.getBean("foo", TenantBean.class); + foo.sayHello(); + TenantBean bar = (TenantBean) ctx.getBean("bar", TenantBean.class); + bar.sayHello(); + Map foos = ctx.getBeansOfType(TenantBean.class); + + assertThat(foo, not(equalTo(bar))); + assertThat(foos.size(), equalTo(2)); + assertTrue(foos.containsValue(foo)); + assertTrue(foos.containsValue(bar)); + + BeanDefinition fooDefinition = ctx.getBeanDefinition("foo"); + BeanDefinition barDefinition = ctx.getBeanDefinition("bar"); + + assertThat(fooDefinition.getScope(), equalTo("tenant")); + assertThat(barDefinition.getScope(), equalTo("tenant")); + } finally { + ctx.close(); + } + } +} From 9ffb4d4d641d6e153b6f10729ddf084b7f575232 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 15 Jul 2020 17:29:08 +0530 Subject: [PATCH 0108/1862] JAVA-628: Moved 3 articles to spring-core-4 --- spring-core-4/README.md | 3 ++ spring-core-4/pom.xml | 5 +++ .../com/baeldung/lombok/ApologizeService.java | 22 ++++++++++ .../com/baeldung/lombok/FarewellService.java | 18 ++++++++ .../com/baeldung/lombok/GreetingService.java | 15 +++++++ .../com/baeldung/lombok/ThankingService.java | 15 +++++++ .../java/com/baeldung/lombok/Translator.java | 5 +++ .../baeldung/sampleabstract/BallService.java | 28 ++++++++++++ .../sampleabstract/BasketballService.java | 13 ++++++ .../com/baeldung/sampleabstract/DemoApp.java | 18 ++++++++ .../sampleabstract/LogRepository.java | 12 +++++ .../sampleabstract/RuleRepository.java | 12 +++++ .../startup/AllStrategiesExampleBean.java | 35 +++++++++++++++ .../startup/EventListenerExampleBean.java | 21 +++++++++ .../startup/InitMethodExampleBean.java | 24 ++++++++++ .../startup/InitializingBeanExampleBean.java | 26 +++++++++++ .../startup/InvalidInitExampleBean.java | 18 ++++++++ .../LogicInConstructorExampleBean.java | 22 ++++++++++ .../startup/PostConstructExampleBean.java | 27 ++++++++++++ .../baeldung/startup/SpringStartupConfig.java | 9 ++++ .../StartupApplicationListenerExample.java | 22 ++++++++++ .../src/main/resources/startupConfig.xml | 16 +++++++ ...ogizeServiceAutowiringIntegrationTest.java | 33 ++++++++++++++ .../ApologizeServiceIntegrationTest.java | 21 +++++++++ .../FarewellAutowiringIntegrationTest.java | 31 +++++++++++++ .../FarewellServiceIntegrationTest.java | 20 +++++++++ .../GreetingServiceIntegrationTest.java | 37 ++++++++++++++++ .../java/com/baeldung/lombok/TestConfig.java | 17 +++++++ ...nkingServiceAutowiringIntegrationTest.java | 31 +++++++++++++ .../ThankingServiceIntegrationTest.java | 20 +++++++++ .../startup/SpringStartupIntegrationTest.java | 44 +++++++++++++++++++ ...SpringStartupXMLConfigIntegrationTest.java | 26 +++++++++++ 32 files changed, 666 insertions(+) create mode 100644 spring-core-4/src/main/java/com/baeldung/lombok/ApologizeService.java create mode 100644 spring-core-4/src/main/java/com/baeldung/lombok/FarewellService.java create mode 100644 spring-core-4/src/main/java/com/baeldung/lombok/GreetingService.java create mode 100644 spring-core-4/src/main/java/com/baeldung/lombok/ThankingService.java create mode 100644 spring-core-4/src/main/java/com/baeldung/lombok/Translator.java create mode 100644 spring-core-4/src/main/java/com/baeldung/sampleabstract/BallService.java create mode 100644 spring-core-4/src/main/java/com/baeldung/sampleabstract/BasketballService.java create mode 100644 spring-core-4/src/main/java/com/baeldung/sampleabstract/DemoApp.java create mode 100644 spring-core-4/src/main/java/com/baeldung/sampleabstract/LogRepository.java create mode 100644 spring-core-4/src/main/java/com/baeldung/sampleabstract/RuleRepository.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/EventListenerExampleBean.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/InitMethodExampleBean.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/PostConstructExampleBean.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/SpringStartupConfig.java create mode 100644 spring-core-4/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java create mode 100644 spring-core-4/src/main/resources/startupConfig.xml create mode 100644 spring-core-4/src/test/java/com/baeldung/lombok/ApologizeServiceAutowiringIntegrationTest.java create mode 100644 spring-core-4/src/test/java/com/baeldung/lombok/ApologizeServiceIntegrationTest.java create mode 100644 spring-core-4/src/test/java/com/baeldung/lombok/FarewellAutowiringIntegrationTest.java create mode 100644 spring-core-4/src/test/java/com/baeldung/lombok/FarewellServiceIntegrationTest.java create mode 100644 spring-core-4/src/test/java/com/baeldung/lombok/GreetingServiceIntegrationTest.java create mode 100644 spring-core-4/src/test/java/com/baeldung/lombok/TestConfig.java create mode 100644 spring-core-4/src/test/java/com/baeldung/lombok/ThankingServiceAutowiringIntegrationTest.java create mode 100644 spring-core-4/src/test/java/com/baeldung/lombok/ThankingServiceIntegrationTest.java create mode 100644 spring-core-4/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java create mode 100644 spring-core-4/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java diff --git a/spring-core-4/README.md b/spring-core-4/README.md index 9da90ac77a..706c330f39 100644 --- a/spring-core-4/README.md +++ b/spring-core-4/README.md @@ -8,4 +8,7 @@ This module contains articles about core Spring functionality - [How to dynamically Autowire a Bean in Spring](https://www.baeldung.com/spring-dynamic-autowire) - [Spring @Import Annotation](https://www.baeldung.com/spring-import-annotation) - [Spring BeanPostProcessor](https://www.baeldung.com/spring-beanpostprocessor) +- [Using @Autowired in Abstract Classes](https://www.baeldung.com/spring-autowired-abstract-class) +- [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring) +- [Constructor Injection in Spring with Lombok](https://www.baeldung.com/spring-injection-lombok) - More articles: [[<-- prev]](/spring-core-3) diff --git a/spring-core-4/pom.xml b/spring-core-4/pom.xml index 299debbc3c..e5aee1f81d 100644 --- a/spring-core-4/pom.xml +++ b/spring-core-4/pom.xml @@ -29,6 +29,11 @@ spring-expression ${spring.version} + + org.projectlombok + lombok + ${lombok.version} + com.google.guava guava diff --git a/spring-core-4/src/main/java/com/baeldung/lombok/ApologizeService.java b/spring-core-4/src/main/java/com/baeldung/lombok/ApologizeService.java new file mode 100644 index 0000000000..76c3df8217 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/lombok/ApologizeService.java @@ -0,0 +1,22 @@ +package com.baeldung.lombok; + +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class ApologizeService { + + private final Translator translator; + private final String message; + + @Autowired + public ApologizeService(Translator translator) { + this(translator, "sorry"); + } + + public String apologize() { + return translator.translate(message); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/lombok/FarewellService.java b/spring-core-4/src/main/java/com/baeldung/lombok/FarewellService.java new file mode 100644 index 0000000000..4e8c4993cb --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/lombok/FarewellService.java @@ -0,0 +1,18 @@ +package com.baeldung.lombok; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class FarewellService { + + private final Translator translator; + + public FarewellService(Translator translator) { + this.translator = translator; + } + + public String farewell() { + return translator.translate("bye"); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/lombok/GreetingService.java b/spring-core-4/src/main/java/com/baeldung/lombok/GreetingService.java new file mode 100644 index 0000000000..0e03e177e1 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/lombok/GreetingService.java @@ -0,0 +1,15 @@ +package com.baeldung.lombok; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class GreetingService { + + @Autowired + private Translator translator; + + public String greet() { + return translator.translate("hello"); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/lombok/ThankingService.java b/spring-core-4/src/main/java/com/baeldung/lombok/ThankingService.java new file mode 100644 index 0000000000..2e0c398d2d --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/lombok/ThankingService.java @@ -0,0 +1,15 @@ +package com.baeldung.lombok; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class ThankingService { + + private final Translator translator; + + public String thank() { + return translator.translate("thank you"); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/lombok/Translator.java b/spring-core-4/src/main/java/com/baeldung/lombok/Translator.java new file mode 100644 index 0000000000..2dea20b726 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/lombok/Translator.java @@ -0,0 +1,5 @@ +package com.baeldung.lombok; + +public interface Translator { + String translate(String input); +} diff --git a/spring-core-4/src/main/java/com/baeldung/sampleabstract/BallService.java b/spring-core-4/src/main/java/com/baeldung/sampleabstract/BallService.java new file mode 100644 index 0000000000..0d951aac8b --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/sampleabstract/BallService.java @@ -0,0 +1,28 @@ +package com.baeldung.sampleabstract; + +import org.springframework.beans.factory.annotation.Autowired; + +import javax.annotation.PostConstruct; + +public abstract class BallService { + + private RuleRepository ruleRepository; + + private LogRepository logRepository; + + public BallService(RuleRepository ruleRepository) { + this.ruleRepository = ruleRepository; + } + + @Autowired + public final void setLogRepository(LogRepository logRepository) { + this.logRepository = logRepository; + } + + @PostConstruct + public void afterInitialize() { + + System.out.println(ruleRepository.toString()); + System.out.println(logRepository.toString()); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/sampleabstract/BasketballService.java b/spring-core-4/src/main/java/com/baeldung/sampleabstract/BasketballService.java new file mode 100644 index 0000000000..4d6345b069 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/sampleabstract/BasketballService.java @@ -0,0 +1,13 @@ +package com.baeldung.sampleabstract; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class BasketballService extends BallService { + + @Autowired + public BasketballService(RuleRepository ruleRepository) { + super(ruleRepository); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/sampleabstract/DemoApp.java b/spring-core-4/src/main/java/com/baeldung/sampleabstract/DemoApp.java new file mode 100644 index 0000000000..5a308b2671 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/sampleabstract/DemoApp.java @@ -0,0 +1,18 @@ +package com.baeldung.sampleabstract; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan(basePackages = "com.baeldung.sampleabstract") +public class DemoApp { + + + public static void main(String[] args) { + + ApplicationContext applicationContext = new AnnotationConfigApplicationContext(DemoApp.class); + } + +} diff --git a/spring-core-4/src/main/java/com/baeldung/sampleabstract/LogRepository.java b/spring-core-4/src/main/java/com/baeldung/sampleabstract/LogRepository.java new file mode 100644 index 0000000000..84979768b5 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/sampleabstract/LogRepository.java @@ -0,0 +1,12 @@ +package com.baeldung.sampleabstract; + +import org.springframework.stereotype.Component; + +@Component +public class LogRepository { + + @Override + public String toString() { + return "logRepository"; + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/sampleabstract/RuleRepository.java b/spring-core-4/src/main/java/com/baeldung/sampleabstract/RuleRepository.java new file mode 100644 index 0000000000..a1c5b5067f --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/sampleabstract/RuleRepository.java @@ -0,0 +1,12 @@ +package com.baeldung.sampleabstract; + +import org.springframework.stereotype.Component; + +@Component +public class RuleRepository { + + @Override + public String toString() { + return "ruleRepository"; + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java b/spring-core-4/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java new file mode 100644 index 0000000000..e08309d474 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java @@ -0,0 +1,35 @@ +package com.baeldung.startup; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.beans.factory.InitializingBean; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; + +@Component +@Scope(value = "prototype") +public class AllStrategiesExampleBean implements InitializingBean { + + private static final Logger LOG = LoggerFactory.getLogger(AllStrategiesExampleBean.class); + + public AllStrategiesExampleBean() { + LOG.info("Constructor"); + } + + @Override + public void afterPropertiesSet() throws Exception { + LOG.info("InitializingBean"); + } + + @PostConstruct + public void postConstruct() { + LOG.info("PostConstruct"); + } + + public void init() { + LOG.info("init-method"); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/startup/EventListenerExampleBean.java b/spring-core-4/src/main/java/com/baeldung/startup/EventListenerExampleBean.java new file mode 100644 index 0000000000..a76fc6a2b2 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/EventListenerExampleBean.java @@ -0,0 +1,21 @@ +package com.baeldung.startup; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; + +@Component +public class EventListenerExampleBean { + private static final Logger LOG = LoggerFactory.getLogger(EventListenerExampleBean.class); + + public static int counter; + + @EventListener + public void onApplicationEvent(ContextRefreshedEvent event) { + LOG.info("Increment counter"); + counter++; + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/startup/InitMethodExampleBean.java b/spring-core-4/src/main/java/com/baeldung/startup/InitMethodExampleBean.java new file mode 100644 index 0000000000..a3b12028d1 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/InitMethodExampleBean.java @@ -0,0 +1,24 @@ +package com.baeldung.startup; + +import java.util.Arrays; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Scope(value = "prototype") +public class InitMethodExampleBean { + + private static final Logger LOG = LoggerFactory.getLogger(InitMethodExampleBean.class); + + @Autowired + private Environment environment; + + public void init() { + LOG.info("Env Default Profiles", Arrays.asList(environment.getDefaultProfiles())); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java b/spring-core-4/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java new file mode 100644 index 0000000000..c625a172fd --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java @@ -0,0 +1,26 @@ +package com.baeldung.startup; + +import java.util.Arrays; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Scope(value = "prototype") +public class InitializingBeanExampleBean implements InitializingBean { + + private static final Logger LOG = LoggerFactory.getLogger(InitializingBeanExampleBean.class); + + @Autowired + private Environment environment; + + @Override + public void afterPropertiesSet() throws Exception { + LOG.info("Env Default Profiles", Arrays.asList(environment.getDefaultProfiles())); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java b/spring-core-4/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java new file mode 100644 index 0000000000..d31aee8acd --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java @@ -0,0 +1,18 @@ +package com.baeldung.startup; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Scope("prototype") +public class InvalidInitExampleBean { + + @Autowired + private Environment environment; + + public InvalidInitExampleBean() { + environment.getActiveProfiles(); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java b/spring-core-4/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java new file mode 100644 index 0000000000..ade7573bbe --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java @@ -0,0 +1,22 @@ +package com.baeldung.startup; + +import java.util.Arrays; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Scope(value = "prototype") +public class LogicInConstructorExampleBean { + + private static final Logger LOG = LoggerFactory.getLogger(LogicInConstructorExampleBean.class); + + @Autowired + public LogicInConstructorExampleBean(Environment environment) { + LOG.info("Env Default Profiles", Arrays.asList(environment.getDefaultProfiles())); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/startup/PostConstructExampleBean.java b/spring-core-4/src/main/java/com/baeldung/startup/PostConstructExampleBean.java new file mode 100644 index 0000000000..1001043d86 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/PostConstructExampleBean.java @@ -0,0 +1,27 @@ +package com.baeldung.startup; + +import java.util.Arrays; + +import javax.annotation.PostConstruct; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Scope(value = "prototype") +public class PostConstructExampleBean { + + private static final Logger LOG = LoggerFactory.getLogger(PostConstructExampleBean.class); + + @Autowired + private Environment environment; + + @PostConstruct + public void init() { + LOG.info("Env Default Profiles", Arrays.asList(environment.getDefaultProfiles())); + } +} diff --git a/spring-core-4/src/main/java/com/baeldung/startup/SpringStartupConfig.java b/spring-core-4/src/main/java/com/baeldung/startup/SpringStartupConfig.java new file mode 100644 index 0000000000..ad6492dadc --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/SpringStartupConfig.java @@ -0,0 +1,9 @@ +package com.baeldung.startup; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan("com.baeldung.startup") +public class SpringStartupConfig { +} \ No newline at end of file diff --git a/spring-core-4/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java b/spring-core-4/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java new file mode 100644 index 0000000000..2cc5e6abcb --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java @@ -0,0 +1,22 @@ +package com.baeldung.startup; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.stereotype.Component; + +@Component +public class StartupApplicationListenerExample implements ApplicationListener { + + private static final Logger LOG = LoggerFactory.getLogger(StartupApplicationListenerExample.class); + + public static int counter; + + @Override + public void onApplicationEvent(ContextRefreshedEvent event) { + LOG.info("Increment counter"); + counter++; + } +} diff --git a/spring-core-4/src/main/resources/startupConfig.xml b/spring-core-4/src/main/resources/startupConfig.xml new file mode 100644 index 0000000000..d42e0f6c2b --- /dev/null +++ b/spring-core-4/src/main/resources/startupConfig.xml @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/spring-core-4/src/test/java/com/baeldung/lombok/ApologizeServiceAutowiringIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/lombok/ApologizeServiceAutowiringIntegrationTest.java new file mode 100644 index 0000000000..a49dd84f11 --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/lombok/ApologizeServiceAutowiringIntegrationTest.java @@ -0,0 +1,33 @@ +package com.baeldung.lombok; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = TestConfig.class) +public class ApologizeServiceAutowiringIntegrationTest { + + private final static String TRANSLATED = "TRANSLATED"; + + @Autowired + private ApologizeService apologizeService; + + @Autowired + private Translator translator; + + @Test + public void apologizeWithTranslatedMessage() { + when(translator.translate("sorry")).thenReturn(TRANSLATED); + assertEquals(TRANSLATED, apologizeService.apologize()); + } + +} \ No newline at end of file diff --git a/spring-core-4/src/test/java/com/baeldung/lombok/ApologizeServiceIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/lombok/ApologizeServiceIntegrationTest.java new file mode 100644 index 0000000000..77f0c94299 --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/lombok/ApologizeServiceIntegrationTest.java @@ -0,0 +1,21 @@ +package com.baeldung.lombok; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class ApologizeServiceIntegrationTest { + + private final static String MESSAGE = "MESSAGE"; + private final static String TRANSLATED = "TRANSLATED"; + + @Test + public void apologizeWithCustomTranslatedMessage() { + Translator translator = mock(Translator.class); + ApologizeService apologizeService = new ApologizeService(translator, MESSAGE); + when(translator.translate(MESSAGE)).thenReturn(TRANSLATED); + assertEquals(TRANSLATED, apologizeService.apologize()); + } +} diff --git a/spring-core-4/src/test/java/com/baeldung/lombok/FarewellAutowiringIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/lombok/FarewellAutowiringIntegrationTest.java new file mode 100644 index 0000000000..ec0793bd2e --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/lombok/FarewellAutowiringIntegrationTest.java @@ -0,0 +1,31 @@ +package com.baeldung.lombok; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = TestConfig.class) +public class FarewellAutowiringIntegrationTest { + + @Autowired + private FarewellService farewellService; + + @Autowired + private Translator translator; + + @Test + public void sayByeWithTranslatedMessage() { + String translated = "translated"; + when(translator.translate("bye")).thenReturn(translated); + assertEquals(translated, farewellService.farewell()); + } +} diff --git a/spring-core-4/src/test/java/com/baeldung/lombok/FarewellServiceIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/lombok/FarewellServiceIntegrationTest.java new file mode 100644 index 0000000000..38959a511f --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/lombok/FarewellServiceIntegrationTest.java @@ -0,0 +1,20 @@ +package com.baeldung.lombok; + +import org.junit.Test; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class FarewellServiceIntegrationTest { + + private final static String TRANSLATED = "TRANSLATED"; + + @Test + public void sayByeWithTranslatedMessage() { + Translator translator = mock(Translator.class); + when(translator.translate("bye")).thenReturn(TRANSLATED); + FarewellService farewellService = new FarewellService(translator); + assertEquals(TRANSLATED, farewellService.farewell()); + } +} \ No newline at end of file diff --git a/spring-core-4/src/test/java/com/baeldung/lombok/GreetingServiceIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/lombok/GreetingServiceIntegrationTest.java new file mode 100644 index 0000000000..0516b5eb56 --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/lombok/GreetingServiceIntegrationTest.java @@ -0,0 +1,37 @@ +package com.baeldung.lombok; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = TestConfig.class) +public class GreetingServiceIntegrationTest { + + @Autowired + private GreetingService greetingService; + + @Autowired + private Translator translator; + + @Test + public void greetWithTranslatedMessage() { + String translated = "translated"; + when(translator.translate("hello")).thenReturn(translated); + assertEquals(translated, greetingService.greet()); + } + + @Test(expected = NullPointerException.class) + public void throwWhenInstantiated() { + GreetingService greetingService = new GreetingService(); + greetingService.greet(); + } +} \ No newline at end of file diff --git a/spring-core-4/src/test/java/com/baeldung/lombok/TestConfig.java b/spring-core-4/src/test/java/com/baeldung/lombok/TestConfig.java new file mode 100644 index 0000000000..3278a8188f --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/lombok/TestConfig.java @@ -0,0 +1,17 @@ +package com.baeldung.lombok; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +import static org.mockito.Mockito.mock; + +@Configuration +@ComponentScan("com.baeldung.lombok") +class TestConfig { + + @Bean + public Translator mockTranslator() { + return mock(Translator.class); + } +} diff --git a/spring-core-4/src/test/java/com/baeldung/lombok/ThankingServiceAutowiringIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/lombok/ThankingServiceAutowiringIntegrationTest.java new file mode 100644 index 0000000000..fb9abbad46 --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/lombok/ThankingServiceAutowiringIntegrationTest.java @@ -0,0 +1,31 @@ +package com.baeldung.lombok; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = TestConfig.class) +public class ThankingServiceAutowiringIntegrationTest { + + @Autowired + private ThankingService thankingService; + + @Autowired + private Translator translator; + + @Test + public void thankWithTranslatedMessage() { + String translated = "translated"; + when(translator.translate("thank you")).thenReturn(translated); + assertEquals(translated, thankingService.thank()); + } +} \ No newline at end of file diff --git a/spring-core-4/src/test/java/com/baeldung/lombok/ThankingServiceIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/lombok/ThankingServiceIntegrationTest.java new file mode 100644 index 0000000000..680f926717 --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/lombok/ThankingServiceIntegrationTest.java @@ -0,0 +1,20 @@ +package com.baeldung.lombok; + +import org.junit.Test; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class ThankingServiceIntegrationTest { + + private final static String TRANSLATED = "TRANSLATED"; + + @Test + public void thankWithTranslatedMessage() { + Translator translator = mock(Translator.class); + when(translator.translate("thank you")).thenReturn(TRANSLATED); + ThankingService thankingService = new ThankingService(translator); + assertEquals(TRANSLATED, thankingService.thank()); + } +} \ No newline at end of file diff --git a/spring-core-4/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java new file mode 100644 index 0000000000..b58c093c31 --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java @@ -0,0 +1,44 @@ +package com.baeldung.startup; + +import org.assertj.core.api.Assertions; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.BeanCreationException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { SpringStartupConfig.class }, loader = AnnotationConfigContextLoader.class) +public class SpringStartupIntegrationTest { + + @Autowired + private ApplicationContext ctx; + + @Test(expected = BeanCreationException.class) + public void whenInstantiating_shouldThrowBCE() throws Exception { + ctx.getBean(InvalidInitExampleBean.class); + } + + @Test + public void whenPostConstruct_shouldLogEnv() throws Exception { + ctx.getBean(PostConstructExampleBean.class); + } + + @Test + public void whenConstructorInjection_shouldLogEnv() throws Exception { + ctx.getBean(LogicInConstructorExampleBean.class); + } + + @Test + public void whenInitializingBean_shouldLogEnv() throws Exception { + ctx.getBean(InitializingBeanExampleBean.class); + } + + @Test + public void whenApplicationListener_shouldRunOnce() throws Exception { + Assertions.assertThat(StartupApplicationListenerExample.counter).isEqualTo(1); + } +} \ No newline at end of file diff --git a/spring-core-4/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java b/spring-core-4/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java new file mode 100644 index 0000000000..3dfd4835df --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.startup; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("classpath:startupConfig.xml") +public class SpringStartupXMLConfigIntegrationTest { + + @Autowired + private ApplicationContext ctx; + + @Test + public void whenPostConstruct_shouldLogEnv() throws Exception { + ctx.getBean(InitMethodExampleBean.class); + } + + @Test + public void whenAllStrategies_shouldLogOrder() throws Exception { + ctx.getBean(AllStrategiesExampleBean.class); + } +} From 013c4917d2b5df78d844b86d00b56379a046db48 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 15 Jul 2020 17:30:45 +0530 Subject: [PATCH 0109/1862] JAVA-628: Corrected README, moved article code to appropriate module --- spring-di/README.md | 2 + .../AnotherArbitraryDependency.java | 13 ------ .../dependency/ArbitraryDependency.java | 13 ------ .../YetAnotherArbitraryDependency.java | 13 ------ .../FieldAutowiredIntegrationTest.java | 29 ------------- .../FieldAutowiredNameIntegrationTest.java | 29 ------------- ...ieldQualifierAutowiredIntegrationTest.java | 41 ------------------- .../ApplicationContextTestAutowiredName.java | 9 ---- ...licationContextTestAutowiredQualifier.java | 24 ----------- .../ApplicationContextTestAutowiredType.java | 15 ------- .../ApplicationContextTestInjectName.java | 16 -------- ...ApplicationContextTestInjectQualifier.java | 22 ---------- .../ApplicationContextTestInjectType.java | 15 ------- .../FieldByNameInjectIntegrationTest.java | 32 --------------- .../inject/FieldInjectIntegrationTest.java | 30 -------------- .../FieldQualifierInjectIntegrationTest.java | 41 ------------------- 16 files changed, 2 insertions(+), 342 deletions(-) delete mode 100644 spring-di/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java delete mode 100644 spring-di/src/main/java/com/baeldung/dependency/ArbitraryDependency.java delete mode 100644 spring-di/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java delete mode 100644 spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java delete mode 100644 spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java delete mode 100644 spring-di/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java delete mode 100644 spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java delete mode 100644 spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java delete mode 100644 spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java delete mode 100644 spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectName.java delete mode 100644 spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java delete mode 100644 spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectType.java delete mode 100644 spring-di/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java delete mode 100644 spring-di/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java delete mode 100644 spring-di/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java diff --git a/spring-di/README.md b/spring-di/README.md index 7571b12916..d470768f16 100644 --- a/spring-di/README.md +++ b/spring-di/README.md @@ -13,3 +13,5 @@ This module contains articles about dependency injection with Spring - [Controlling Bean Creation Order with @DependsOn Annotation](https://www.baeldung.com/spring-depends-on) - [Unsatisfied Dependency in Spring](https://www.baeldung.com/spring-unsatisfied-dependency) - [Circular Dependencies in Spring](https://www.baeldung.com/circular-dependencies-in-spring) +- [XML-Based Injection in Spring](https://www.baeldung.com/spring-xml-injection) +- More articles: [[next -->]](/spring-di-2) diff --git a/spring-di/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java b/spring-di/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java deleted file mode 100644 index 0e19523b7e..0000000000 --- a/spring-di/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.dependency; - -import org.springframework.stereotype.Component; - -@Component -public class AnotherArbitraryDependency extends ArbitraryDependency { - - private final String label = "Another Arbitrary Dependency"; - - public String toString() { - return label; - } -} diff --git a/spring-di/src/main/java/com/baeldung/dependency/ArbitraryDependency.java b/spring-di/src/main/java/com/baeldung/dependency/ArbitraryDependency.java deleted file mode 100644 index 3c90492d2c..0000000000 --- a/spring-di/src/main/java/com/baeldung/dependency/ArbitraryDependency.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.dependency; - -import org.springframework.stereotype.Component; - -@Component(value = "autowiredFieldDependency") -public class ArbitraryDependency { - - private final String label = "Arbitrary Dependency"; - - public String toString() { - return label; - } -} diff --git a/spring-di/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java b/spring-di/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java deleted file mode 100644 index a88abd0924..0000000000 --- a/spring-di/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.dependency; - -import org.springframework.stereotype.Component; - -@Component -public class YetAnotherArbitraryDependency extends ArbitraryDependency { - - private final String label = "Yet Another Arbitrary Dependency"; - - public String toString() { - return label; - } -} diff --git a/spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java b/spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java deleted file mode 100644 index a78799f1d9..0000000000 --- a/spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.autowired; - -import com.baeldung.configuration.ApplicationContextTestAutowiredType; -import com.baeldung.dependency.ArbitraryDependency; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestAutowiredType.class) -public class FieldAutowiredIntegrationTest { - - @Autowired - private ArbitraryDependency fieldDependency; - - @Test - public void givenAutowired_WhenSetOnField_ThenDependencyResolved() { - assertNotNull(fieldDependency); - assertEquals("Arbitrary Dependency", fieldDependency.toString()); - } -} diff --git a/spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java b/spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java deleted file mode 100644 index 8f09e73c33..0000000000 --- a/spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.autowired; - -import com.baeldung.configuration.ApplicationContextTestAutowiredName; -import com.baeldung.dependency.ArbitraryDependency; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestAutowiredName.class) -public class FieldAutowiredNameIntegrationTest { - - @Autowired - private ArbitraryDependency autowiredFieldDependency; - - @Test - public void givenAutowiredAnnotation_WhenOnField_ThenDependencyValid() { - assertNotNull(autowiredFieldDependency); - assertEquals("Arbitrary Dependency", autowiredFieldDependency.toString()); - } -} diff --git a/spring-di/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java b/spring-di/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java deleted file mode 100644 index 01317aef6f..0000000000 --- a/spring-di/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.autowired; - -import com.baeldung.configuration.ApplicationContextTestAutowiredQualifier; -import com.baeldung.dependency.ArbitraryDependency; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestAutowiredQualifier.class) -public class FieldQualifierAutowiredIntegrationTest { - - @Autowired - @Qualifier("autowiredFieldDependency") - private ArbitraryDependency fieldDependency1; - - @Autowired - @Qualifier("anotherAutowiredFieldDependency") - private ArbitraryDependency fieldDependency2; - - @Test - public void givenAutowiredQualifier_WhenOnField_ThenDep1Valid() { - assertNotNull(fieldDependency1); - assertEquals("Arbitrary Dependency", fieldDependency1.toString()); - } - - @Test - public void givenAutowiredQualifier_WhenOnField_ThenDep2Valid() { - assertNotNull(fieldDependency2); - assertEquals("Another Arbitrary Dependency", fieldDependency2.toString()); - } -} diff --git a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java deleted file mode 100644 index 48c4495465..0000000000 --- a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.configuration; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ComponentScan(basePackages = {"com.baeldung.dependency"}) -public class ApplicationContextTestAutowiredName { -} diff --git a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java deleted file mode 100644 index ef6690ab4b..0000000000 --- a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.configuration; - -import com.baeldung.dependency.AnotherArbitraryDependency; -import com.baeldung.dependency.ArbitraryDependency; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class ApplicationContextTestAutowiredQualifier { - - @Bean - public ArbitraryDependency autowiredFieldDependency() { - ArbitraryDependency autowiredFieldDependency = new ArbitraryDependency(); - - return autowiredFieldDependency; - } - - @Bean - public ArbitraryDependency anotherAutowiredFieldDependency() { - ArbitraryDependency anotherAutowiredFieldDependency = new AnotherArbitraryDependency(); - - return anotherAutowiredFieldDependency; - } -} diff --git a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java deleted file mode 100644 index 240bc466b7..0000000000 --- a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.configuration; - -import com.baeldung.dependency.ArbitraryDependency; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class ApplicationContextTestAutowiredType { - - @Bean - public ArbitraryDependency autowiredFieldDependency() { - ArbitraryDependency autowiredFieldDependency = new ArbitraryDependency(); - return autowiredFieldDependency; - } -} diff --git a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectName.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectName.java deleted file mode 100644 index 851aa0b8ee..0000000000 --- a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectName.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.configuration; - -import com.baeldung.dependency.ArbitraryDependency; -import com.baeldung.dependency.YetAnotherArbitraryDependency; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class ApplicationContextTestInjectName { - - @Bean - public ArbitraryDependency yetAnotherFieldInjectDependency() { - ArbitraryDependency yetAnotherFieldInjectDependency = new YetAnotherArbitraryDependency(); - return yetAnotherFieldInjectDependency; - } -} diff --git a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java deleted file mode 100644 index 59af5a91bb..0000000000 --- a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.configuration; - -import com.baeldung.dependency.AnotherArbitraryDependency; -import com.baeldung.dependency.ArbitraryDependency; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class ApplicationContextTestInjectQualifier { - - @Bean - public ArbitraryDependency defaultFile() { - ArbitraryDependency defaultFile = new ArbitraryDependency(); - return defaultFile; - } - - @Bean - public ArbitraryDependency namedFile() { - ArbitraryDependency namedFile = new AnotherArbitraryDependency(); - return namedFile; - } -} diff --git a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectType.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectType.java deleted file mode 100644 index 1e1f01f269..0000000000 --- a/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectType.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.configuration; - -import com.baeldung.dependency.ArbitraryDependency; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class ApplicationContextTestInjectType { - - @Bean - public ArbitraryDependency injectDependency() { - ArbitraryDependency injectDependency = new ArbitraryDependency(); - return injectDependency; - } -} diff --git a/spring-di/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java b/spring-di/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java deleted file mode 100644 index f5897febab..0000000000 --- a/spring-di/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.inject; - -import com.baeldung.configuration.ApplicationContextTestInjectName; -import com.baeldung.dependency.ArbitraryDependency; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.inject.Inject; -import javax.inject.Named; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestInjectName.class) -public class FieldByNameInjectIntegrationTest { - - @Inject - @Named("yetAnotherFieldInjectDependency") - private ArbitraryDependency yetAnotherFieldInjectDependency; - - @Test - public void givenInjectQualifier_WhenSetOnField_ThenDependencyValid() { - assertNotNull(yetAnotherFieldInjectDependency); - assertEquals("Yet Another Arbitrary Dependency", yetAnotherFieldInjectDependency.toString()); - } -} diff --git a/spring-di/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java b/spring-di/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java deleted file mode 100644 index 45b7c8015c..0000000000 --- a/spring-di/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.inject; - -import com.baeldung.configuration.ApplicationContextTestInjectType; -import com.baeldung.dependency.ArbitraryDependency; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.inject.Inject; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration( - loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestInjectType.class) -public class FieldInjectIntegrationTest { - - @Inject - private ArbitraryDependency fieldInjectDependency; - - @Test - public void givenInjectAnnotation_WhenOnField_ThenValidDependency() { - assertNotNull(fieldInjectDependency); - assertEquals("Arbitrary Dependency", fieldInjectDependency.toString()); - } -} diff --git a/spring-di/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java b/spring-di/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java deleted file mode 100644 index 0fd6a0e4c1..0000000000 --- a/spring-di/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.inject; - -import com.baeldung.configuration.ApplicationContextTestInjectQualifier; -import com.baeldung.dependency.ArbitraryDependency; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import javax.inject.Inject; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(loader = AnnotationConfigContextLoader.class, - classes = ApplicationContextTestInjectQualifier.class) -public class FieldQualifierInjectIntegrationTest { - - @Inject - @Qualifier("defaultFile") - private ArbitraryDependency defaultDependency; - - @Inject - @Qualifier("namedFile") - private ArbitraryDependency namedDependency; - - @Test - public void givenInjectQualifier_WhenOnField_ThenDefaultFileValid() { - assertNotNull(defaultDependency); - assertEquals("Arbitrary Dependency", defaultDependency.toString()); - } - - @Test - public void givenInjectQualifier_WhenOnField_ThenNamedFileValid() { - assertNotNull(defaultDependency); - assertEquals("Another Arbitrary Dependency", namedDependency.toString()); - } -} From f3c3086b0793c88cc1c10dfae9a59f558fc1c831 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 15 Jul 2020 17:31:47 +0530 Subject: [PATCH 0110/1862] JAVA-628: Moved 3 articles to spring-di-2, added README --- spring-di-2/README.md | 11 ++++ spring-di-2/pom.xml | 16 +++++ .../com/baeldung/collection/BaeldungBean.java | 18 ++++++ .../baeldung/collection/CollectionConfig.java | 50 +++++++++++++++ .../collection/CollectionInjectionDemo.java | 21 +++++++ .../baeldung/collection/CollectionsBean.java | 62 +++++++++++++++++++ .../AnotherArbitraryDependency.java | 13 ++++ .../dependency/ArbitraryDependency.java | 13 ++++ .../YetAnotherArbitraryDependency.java | 13 ++++ .../staticvalue/injection/Application.java | 17 +++++ .../injection/PropertyController.java | 30 +++++++++ .../src/main/resources/application.properties | 1 + .../ApplicationContextTestAutowiredName.java | 9 +++ ...licationContextTestAutowiredQualifier.java | 25 ++++++++ .../ApplicationContextTestAutowiredType.java | 16 +++++ .../ApplicationContextTestInjectName.java | 17 +++++ ...ApplicationContextTestInjectQualifier.java | 23 +++++++ .../ApplicationContextTestInjectType.java | 16 +++++ ...pplicationContextTestResourceNameType.java | 16 +++++ ...plicationContextTestResourceQualifier.java | 22 +++++++ .../FieldAutowiredIntegrationTest.java | 30 +++++++++ .../FieldAutowiredNameIntegrationTest.java | 30 +++++++++ ...ieldQualifierAutowiredIntegrationTest.java | 42 +++++++++++++ .../FieldByNameInjectIntegrationTest.java | 33 ++++++++++ .../inject/FieldInjectIntegrationTest.java | 31 ++++++++++ .../FieldQualifierInjectIntegrationTest.java | 42 +++++++++++++ ...FieldResourceInjectionIntegrationTest.java | 32 ++++++++++ ...hodByQualifierResourceIntegrationTest.java | 46 ++++++++++++++ .../MethodByTypeResourceIntegrationTest.java | 35 +++++++++++ ...ethodResourceInjectionIntegrationTest.java | 35 +++++++++++ .../NamedResourceIntegrationTest.java | 30 +++++++++ ...ifierResourceInjectionIntegrationTest.java | 43 +++++++++++++ ...etterResourceInjectionIntegrationTest.java | 34 ++++++++++ 33 files changed, 872 insertions(+) create mode 100644 spring-di-2/README.md create mode 100644 spring-di-2/src/main/java/com/baeldung/collection/BaeldungBean.java create mode 100644 spring-di-2/src/main/java/com/baeldung/collection/CollectionConfig.java create mode 100644 spring-di-2/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java create mode 100644 spring-di-2/src/main/java/com/baeldung/collection/CollectionsBean.java create mode 100644 spring-di-2/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java create mode 100644 spring-di-2/src/main/java/com/baeldung/dependency/ArbitraryDependency.java create mode 100644 spring-di-2/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java create mode 100644 spring-di-2/src/main/java/com/baeldung/staticvalue/injection/Application.java create mode 100644 spring-di-2/src/main/java/com/baeldung/staticvalue/injection/PropertyController.java create mode 100644 spring-di-2/src/main/resources/application.properties create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredName.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredQualifier.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredType.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectName.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectQualifier.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectType.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestResourceNameType.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestResourceQualifier.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldAutowiredIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldAutowiredNameIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldQualifierAutowiredIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldByNameInjectIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldInjectIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldQualifierInjectIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/FieldResourceInjectionIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodByQualifierResourceIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodByTypeResourceIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodResourceInjectionIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/NamedResourceIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/QualifierResourceInjectionIntegrationTest.java create mode 100644 spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/SetterResourceInjectionIntegrationTest.java diff --git a/spring-di-2/README.md b/spring-di-2/README.md new file mode 100644 index 0000000000..15249efa7c --- /dev/null +++ b/spring-di-2/README.md @@ -0,0 +1,11 @@ +## Spring Dependency Injection + +This module contains articles about dependency injection with Spring + +### Relevant Articles + +- [Injecting Spring Beans into Unmanaged Objects](https://www.baeldung.com/spring-inject-bean-into-unmanaged-objects) +- [Injecting a Value in a Static Field in Spring](https://www.baeldung.com/spring-inject-static-field) +- [Spring – Injecting Collections](https://www.baeldung.com/spring-injecting-collections) +- [Wiring in Spring: @Autowired, @Resource and @Inject](https://www.baeldung.com/spring-annotations-resource-inject-autowire) +- More articles: [[<-- prev]](/spring-di) \ No newline at end of file diff --git a/spring-di-2/pom.xml b/spring-di-2/pom.xml index 9b703d55d9..4dd92ca18c 100644 --- a/spring-di-2/pom.xml +++ b/spring-di-2/pom.xml @@ -25,11 +25,26 @@ spring-boot-starter-data-jpa ${spring-boot.version} + + org.springframework.boot + spring-boot-starter-web + ${spring-boot.version} + org.springframework spring-aspects ${spring.version} + + org.projectlombok + lombok + ${lombok.version} + + + javax.inject + javax.inject + ${javax.inject.version} + @@ -61,5 +76,6 @@ 2.3.1.RELEASE 1.11 + 1 \ No newline at end of file diff --git a/spring-di-2/src/main/java/com/baeldung/collection/BaeldungBean.java b/spring-di-2/src/main/java/com/baeldung/collection/BaeldungBean.java new file mode 100644 index 0000000000..6d7351df02 --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/collection/BaeldungBean.java @@ -0,0 +1,18 @@ +package com.baeldung.collection; + +/** + * Created by Gebruiker on 5/22/2018. + */ +public class BaeldungBean { + + private String name; + + public BaeldungBean(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } +} diff --git a/spring-di-2/src/main/java/com/baeldung/collection/CollectionConfig.java b/spring-di-2/src/main/java/com/baeldung/collection/CollectionConfig.java new file mode 100644 index 0000000000..fbae2963e5 --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/collection/CollectionConfig.java @@ -0,0 +1,50 @@ +package com.baeldung.collection; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; + +import java.util.*; + +@Configuration +public class CollectionConfig { + + @Bean + public CollectionsBean getCollectionsBean() { + return new CollectionsBean(new HashSet<>(Arrays.asList("John", "Adam", "Harry"))); + } + + @Bean + public List nameList(){ + return Arrays.asList("John", "Adam", "Harry", null); + } + + @Bean + public Map nameMap(){ + Map nameMap = new HashMap<>(); + nameMap.put(1, "John"); + nameMap.put(2, "Adam"); + nameMap.put(3, "Harry"); + return nameMap; + } + + @Bean + @Qualifier("CollectionsBean") + @Order(2) + public BaeldungBean getElement() { + return new BaeldungBean("John"); + } + + @Bean + @Order(3) + public BaeldungBean getAnotherElement() { + return new BaeldungBean("Adam"); + } + + @Bean + @Order(1) + public BaeldungBean getOneMoreElement() { + return new BaeldungBean("Harry"); + } +} diff --git a/spring-di-2/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java b/spring-di-2/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java new file mode 100644 index 0000000000..2ee265f134 --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java @@ -0,0 +1,21 @@ +package com.baeldung.collection; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +/** + * Created by Gebruiker on 5/18/2018. + */ +public class CollectionInjectionDemo { + + public static void main(String[] args) { + + ApplicationContext context = new AnnotationConfigApplicationContext(CollectionConfig.class); + CollectionsBean collectionsBean = context.getBean(CollectionsBean.class); + collectionsBean.printNameList(); + collectionsBean.printNameSet(); + collectionsBean.printNameMap(); + collectionsBean.printBeanList(); + collectionsBean.printNameListWithDefaults(); + } +} diff --git a/spring-di-2/src/main/java/com/baeldung/collection/CollectionsBean.java b/spring-di-2/src/main/java/com/baeldung/collection/CollectionsBean.java new file mode 100644 index 0000000000..fc90f2c6ff --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/collection/CollectionsBean.java @@ -0,0 +1,62 @@ +package com.baeldung.collection; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; + +/** + * Created by Gebruiker on 5/18/2018. + */ +public class CollectionsBean { + + @Autowired + private List nameList; + + private Set nameSet; + + private Map nameMap; + + @Autowired(required = false) + @Qualifier("CollectionsBean") + private List beanList = new ArrayList<>(); + + @Value("${names.list:}#{T(java.util.Collections).emptyList()}") + private List nameListWithDefaultValue; + + public CollectionsBean() { + } + + public CollectionsBean(Set strings) { + this.nameSet = strings; + } + + @Autowired + public void setNameMap(Map nameMap) { + this.nameMap = nameMap; + } + + public void printNameList() { + System.out.println(nameList); + } + + public void printNameSet() { + System.out.println(nameSet); + } + + public void printNameMap() { + System.out.println(nameMap); + } + + public void printBeanList() { + System.out.println(beanList); + } + + public void printNameListWithDefaults() { + System.out.println(nameListWithDefaultValue); + } +} diff --git a/spring-di-2/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java b/spring-di-2/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java new file mode 100644 index 0000000000..0e19523b7e --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java @@ -0,0 +1,13 @@ +package com.baeldung.dependency; + +import org.springframework.stereotype.Component; + +@Component +public class AnotherArbitraryDependency extends ArbitraryDependency { + + private final String label = "Another Arbitrary Dependency"; + + public String toString() { + return label; + } +} diff --git a/spring-di-2/src/main/java/com/baeldung/dependency/ArbitraryDependency.java b/spring-di-2/src/main/java/com/baeldung/dependency/ArbitraryDependency.java new file mode 100644 index 0000000000..3c90492d2c --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/dependency/ArbitraryDependency.java @@ -0,0 +1,13 @@ +package com.baeldung.dependency; + +import org.springframework.stereotype.Component; + +@Component(value = "autowiredFieldDependency") +public class ArbitraryDependency { + + private final String label = "Arbitrary Dependency"; + + public String toString() { + return label; + } +} diff --git a/spring-di-2/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java b/spring-di-2/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java new file mode 100644 index 0000000000..a88abd0924 --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java @@ -0,0 +1,13 @@ +package com.baeldung.dependency; + +import org.springframework.stereotype.Component; + +@Component +public class YetAnotherArbitraryDependency extends ArbitraryDependency { + + private final String label = "Yet Another Arbitrary Dependency"; + + public String toString() { + return label; + } +} diff --git a/spring-di-2/src/main/java/com/baeldung/staticvalue/injection/Application.java b/spring-di-2/src/main/java/com/baeldung/staticvalue/injection/Application.java new file mode 100644 index 0000000000..b4222ddcc9 --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/staticvalue/injection/Application.java @@ -0,0 +1,17 @@ +package com.baeldung.staticvalue.injection; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication(exclude={DataSourceAutoConfiguration.class}) +@PropertySource("/application.properties") + +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/spring-di-2/src/main/java/com/baeldung/staticvalue/injection/PropertyController.java b/spring-di-2/src/main/java/com/baeldung/staticvalue/injection/PropertyController.java new file mode 100644 index 0000000000..f5910ea4f8 --- /dev/null +++ b/spring-di-2/src/main/java/com/baeldung/staticvalue/injection/PropertyController.java @@ -0,0 +1,30 @@ +package com.baeldung.staticvalue.injection; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; + +@RestController +public class PropertyController { + + @Value("${name}") + private String name; + + @Value("${name}") + private static String NAME_NULL; + + private static String NAME_STATIC; + + @Value("${name}") + public void setNameStatic(String name){ + PropertyController.NAME_STATIC = name; + } + + @GetMapping("/properties") + public List getProperties(){ + return Arrays.asList(this.name, NAME_STATIC, NAME_NULL) ; + } +} diff --git a/spring-di-2/src/main/resources/application.properties b/spring-di-2/src/main/resources/application.properties new file mode 100644 index 0000000000..828fa9cd2a --- /dev/null +++ b/spring-di-2/src/main/resources/application.properties @@ -0,0 +1 @@ +name = Inject a value to a static field diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredName.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredName.java new file mode 100644 index 0000000000..3046e68829 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredName.java @@ -0,0 +1,9 @@ +package com.baeldung.wiring.configuration; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan(basePackages = {"com.baeldung.dependency"}) +public class ApplicationContextTestAutowiredName { +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredQualifier.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredQualifier.java new file mode 100644 index 0000000000..33969ea69d --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredQualifier.java @@ -0,0 +1,25 @@ +package com.baeldung.wiring.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.dependency.AnotherArbitraryDependency; +import com.baeldung.dependency.ArbitraryDependency; + +@Configuration +public class ApplicationContextTestAutowiredQualifier { + + @Bean + public ArbitraryDependency autowiredFieldDependency() { + ArbitraryDependency autowiredFieldDependency = new ArbitraryDependency(); + + return autowiredFieldDependency; + } + + @Bean + public ArbitraryDependency anotherAutowiredFieldDependency() { + ArbitraryDependency anotherAutowiredFieldDependency = new AnotherArbitraryDependency(); + + return anotherAutowiredFieldDependency; + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredType.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredType.java new file mode 100644 index 0000000000..24cdd978e4 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestAutowiredType.java @@ -0,0 +1,16 @@ +package com.baeldung.wiring.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.dependency.ArbitraryDependency; + +@Configuration +public class ApplicationContextTestAutowiredType { + + @Bean + public ArbitraryDependency autowiredFieldDependency() { + ArbitraryDependency autowiredFieldDependency = new ArbitraryDependency(); + return autowiredFieldDependency; + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectName.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectName.java new file mode 100644 index 0000000000..cb465d0183 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectName.java @@ -0,0 +1,17 @@ +package com.baeldung.wiring.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.dependency.ArbitraryDependency; +import com.baeldung.dependency.YetAnotherArbitraryDependency; + +@Configuration +public class ApplicationContextTestInjectName { + + @Bean + public ArbitraryDependency yetAnotherFieldInjectDependency() { + ArbitraryDependency yetAnotherFieldInjectDependency = new YetAnotherArbitraryDependency(); + return yetAnotherFieldInjectDependency; + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectQualifier.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectQualifier.java new file mode 100644 index 0000000000..c2a63dac9e --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectQualifier.java @@ -0,0 +1,23 @@ +package com.baeldung.wiring.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.dependency.AnotherArbitraryDependency; +import com.baeldung.dependency.ArbitraryDependency; + +@Configuration +public class ApplicationContextTestInjectQualifier { + + @Bean + public ArbitraryDependency defaultFile() { + ArbitraryDependency defaultFile = new ArbitraryDependency(); + return defaultFile; + } + + @Bean + public ArbitraryDependency namedFile() { + ArbitraryDependency namedFile = new AnotherArbitraryDependency(); + return namedFile; + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectType.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectType.java new file mode 100644 index 0000000000..15a75b8f2d --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestInjectType.java @@ -0,0 +1,16 @@ +package com.baeldung.wiring.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.dependency.ArbitraryDependency; + +@Configuration +public class ApplicationContextTestInjectType { + + @Bean + public ArbitraryDependency injectDependency() { + ArbitraryDependency injectDependency = new ArbitraryDependency(); + return injectDependency; + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestResourceNameType.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestResourceNameType.java new file mode 100644 index 0000000000..708ade7647 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestResourceNameType.java @@ -0,0 +1,16 @@ +package com.baeldung.wiring.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.io.File; + +@Configuration +public class ApplicationContextTestResourceNameType { + + @Bean(name = "namedFile") + public File namedFile() { + File namedFile = new File("namedFile.txt"); + return namedFile; + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestResourceQualifier.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestResourceQualifier.java new file mode 100644 index 0000000000..87864b183e --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/ApplicationContextTestResourceQualifier.java @@ -0,0 +1,22 @@ +package com.baeldung.wiring.configuration; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.io.File; + +@Configuration +public class ApplicationContextTestResourceQualifier { + + @Bean(name = "defaultFile") + public File defaultFile() { + File defaultFile = new File("defaultFile.txt"); + return defaultFile; + } + + @Bean(name = "namedFile") + public File namedFile() { + File namedFile = new File("namedFile.txt"); + return namedFile; + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldAutowiredIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldAutowiredIntegrationTest.java new file mode 100644 index 0000000000..f3f065ed4d --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldAutowiredIntegrationTest.java @@ -0,0 +1,30 @@ +package com.baeldung.wiring.configuration.autowired; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.dependency.ArbitraryDependency; +import com.baeldung.wiring.configuration.ApplicationContextTestAutowiredType; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestAutowiredType.class) +public class FieldAutowiredIntegrationTest { + + @Autowired + private ArbitraryDependency fieldDependency; + + @Test + public void givenAutowired_WhenSetOnField_ThenDependencyResolved() { + assertNotNull(fieldDependency); + assertEquals("Arbitrary Dependency", fieldDependency.toString()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldAutowiredNameIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldAutowiredNameIntegrationTest.java new file mode 100644 index 0000000000..199241c7e2 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldAutowiredNameIntegrationTest.java @@ -0,0 +1,30 @@ +package com.baeldung.wiring.configuration.autowired; + +import com.baeldung.dependency.ArbitraryDependency; +import com.baeldung.wiring.configuration.ApplicationContextTestAutowiredName; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestAutowiredName.class) +public class FieldAutowiredNameIntegrationTest { + + @Autowired + private ArbitraryDependency autowiredFieldDependency; + + @Test + public void givenAutowiredAnnotation_WhenOnField_ThenDependencyValid() { + assertNotNull(autowiredFieldDependency); + assertEquals("Arbitrary Dependency", autowiredFieldDependency.toString()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldQualifierAutowiredIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldQualifierAutowiredIntegrationTest.java new file mode 100644 index 0000000000..081fbf24ad --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/autowired/FieldQualifierAutowiredIntegrationTest.java @@ -0,0 +1,42 @@ +package com.baeldung.wiring.configuration.autowired; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.dependency.ArbitraryDependency; +import com.baeldung.wiring.configuration.ApplicationContextTestAutowiredQualifier; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestAutowiredQualifier.class) +public class FieldQualifierAutowiredIntegrationTest { + + @Autowired + @Qualifier("autowiredFieldDependency") + private ArbitraryDependency fieldDependency1; + + @Autowired + @Qualifier("anotherAutowiredFieldDependency") + private ArbitraryDependency fieldDependency2; + + @Test + public void givenAutowiredQualifier_WhenOnField_ThenDep1Valid() { + assertNotNull(fieldDependency1); + assertEquals("Arbitrary Dependency", fieldDependency1.toString()); + } + + @Test + public void givenAutowiredQualifier_WhenOnField_ThenDep2Valid() { + assertNotNull(fieldDependency2); + assertEquals("Another Arbitrary Dependency", fieldDependency2.toString()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldByNameInjectIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldByNameInjectIntegrationTest.java new file mode 100644 index 0000000000..d1a75d73ea --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldByNameInjectIntegrationTest.java @@ -0,0 +1,33 @@ +package com.baeldung.wiring.configuration.inject; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import javax.inject.Inject; +import javax.inject.Named; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.dependency.ArbitraryDependency; +import com.baeldung.wiring.configuration.ApplicationContextTestInjectName; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestInjectName.class) +public class FieldByNameInjectIntegrationTest { + + @Inject + @Named("yetAnotherFieldInjectDependency") + private ArbitraryDependency yetAnotherFieldInjectDependency; + + @Test + public void givenInjectQualifier_WhenSetOnField_ThenDependencyValid() { + assertNotNull(yetAnotherFieldInjectDependency); + assertEquals("Yet Another Arbitrary Dependency", yetAnotherFieldInjectDependency.toString()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldInjectIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldInjectIntegrationTest.java new file mode 100644 index 0000000000..995f560701 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldInjectIntegrationTest.java @@ -0,0 +1,31 @@ +package com.baeldung.wiring.configuration.inject; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import javax.inject.Inject; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.dependency.ArbitraryDependency; +import com.baeldung.wiring.configuration.ApplicationContextTestInjectType; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestInjectType.class) +public class FieldInjectIntegrationTest { + + @Inject + private ArbitraryDependency fieldInjectDependency; + + @Test + public void givenInjectAnnotation_WhenOnField_ThenValidDependency() { + assertNotNull(fieldInjectDependency); + assertEquals("Arbitrary Dependency", fieldInjectDependency.toString()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldQualifierInjectIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldQualifierInjectIntegrationTest.java new file mode 100644 index 0000000000..67fa2bf3d4 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/inject/FieldQualifierInjectIntegrationTest.java @@ -0,0 +1,42 @@ +package com.baeldung.wiring.configuration.inject; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import javax.inject.Inject; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.dependency.ArbitraryDependency; +import com.baeldung.wiring.configuration.ApplicationContextTestInjectQualifier; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestInjectQualifier.class) +public class FieldQualifierInjectIntegrationTest { + + @Inject + @Qualifier("defaultFile") + private ArbitraryDependency defaultDependency; + + @Inject + @Qualifier("namedFile") + private ArbitraryDependency namedDependency; + + @Test + public void givenInjectQualifier_WhenOnField_ThenDefaultFileValid() { + assertNotNull(defaultDependency); + assertEquals("Arbitrary Dependency", defaultDependency.toString()); + } + + @Test + public void givenInjectQualifier_WhenOnField_ThenNamedFileValid() { + assertNotNull(defaultDependency); + assertEquals("Another Arbitrary Dependency", namedDependency.toString()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/FieldResourceInjectionIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/FieldResourceInjectionIntegrationTest.java new file mode 100644 index 0000000000..938d557939 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/FieldResourceInjectionIntegrationTest.java @@ -0,0 +1,32 @@ +package com.baeldung.wiring.configuration.resource; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.File; + +import javax.annotation.Resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.wiring.configuration.ApplicationContextTestResourceNameType; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestResourceNameType.class) +public class FieldResourceInjectionIntegrationTest { + + @Resource(name = "namedFile") + private File defaultFile; + + @Test + public void givenResourceAnnotation_WhenOnField_ThenDependencyValid() { + assertNotNull(defaultFile); + assertEquals("namedFile.txt", defaultFile.getName()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodByQualifierResourceIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodByQualifierResourceIntegrationTest.java new file mode 100644 index 0000000000..f49bf70aba --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodByQualifierResourceIntegrationTest.java @@ -0,0 +1,46 @@ +package com.baeldung.wiring.configuration.resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.wiring.configuration.ApplicationContextTestResourceQualifier; + +import javax.annotation.Resource; +import java.io.File; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestResourceQualifier.class) +public class MethodByQualifierResourceIntegrationTest { + + private File arbDependency; + private File anotherArbDependency; + + @Test + public void givenResourceQualifier_WhenSetter_ThenValidDependencies() { + assertNotNull(arbDependency); + assertEquals("namedFile.txt", arbDependency.getName()); + assertNotNull(anotherArbDependency); + assertEquals("defaultFile.txt", anotherArbDependency.getName()); + } + + @Resource + @Qualifier("namedFile") + public void setArbDependency(File arbDependency) { + this.arbDependency = arbDependency; + } + + @Resource + @Qualifier("defaultFile") + public void setAnotherArbDependency(File anotherArbDependency) { + this.anotherArbDependency = anotherArbDependency; + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodByTypeResourceIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodByTypeResourceIntegrationTest.java new file mode 100644 index 0000000000..aecd02a1d5 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodByTypeResourceIntegrationTest.java @@ -0,0 +1,35 @@ +package com.baeldung.wiring.configuration.resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.wiring.configuration.ApplicationContextTestResourceNameType; + +import javax.annotation.Resource; +import java.io.File; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestResourceNameType.class) +public class MethodByTypeResourceIntegrationTest { + + private File defaultFile; + + @Resource + protected void setDefaultFile(File defaultFile) { + this.defaultFile = defaultFile; + } + + @Test + public void givenResourceAnnotation_WhenSetter_ThenValidDependency() { + assertNotNull(defaultFile); + assertEquals("namedFile.txt", defaultFile.getName()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodResourceInjectionIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodResourceInjectionIntegrationTest.java new file mode 100644 index 0000000000..4ef9368c28 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/MethodResourceInjectionIntegrationTest.java @@ -0,0 +1,35 @@ +package com.baeldung.wiring.configuration.resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.wiring.configuration.ApplicationContextTestResourceNameType; + +import javax.annotation.Resource; +import java.io.File; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestResourceNameType.class) +public class MethodResourceInjectionIntegrationTest { + + private File defaultFile; + + @Resource(name = "namedFile") + protected void setDefaultFile(File defaultFile) { + this.defaultFile = defaultFile; + } + + @Test + public void givenResourceAnnotation_WhenSetter_ThenDependencyValid() { + assertNotNull(defaultFile); + assertEquals("namedFile.txt", defaultFile.getName()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/NamedResourceIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/NamedResourceIntegrationTest.java new file mode 100644 index 0000000000..4339194f63 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/NamedResourceIntegrationTest.java @@ -0,0 +1,30 @@ +package com.baeldung.wiring.configuration.resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.wiring.configuration.ApplicationContextTestResourceNameType; + +import javax.annotation.Resource; +import java.io.File; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestResourceNameType.class) +public class NamedResourceIntegrationTest { + + @Resource(name = "namedFile") + private File testFile; + + @Test + public void givenResourceAnnotation_WhenOnField_THEN_DEPENDENCY_Found() { + assertNotNull(testFile); + assertEquals("namedFile.txt", testFile.getName()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/QualifierResourceInjectionIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/QualifierResourceInjectionIntegrationTest.java new file mode 100644 index 0000000000..cc8c669757 --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/QualifierResourceInjectionIntegrationTest.java @@ -0,0 +1,43 @@ +package com.baeldung.wiring.configuration.resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.wiring.configuration.ApplicationContextTestResourceQualifier; + +import javax.annotation.Resource; +import java.io.File; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration( + loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestResourceQualifier.class) +public class QualifierResourceInjectionIntegrationTest { + + @Resource + @Qualifier("defaultFile") + private File dependency1; + + @Resource + @Qualifier("namedFile") + private File dependency2; + + @Test + public void givenResourceAnnotation_WhenField_ThenDependency1Valid() { + assertNotNull(dependency1); + assertEquals("defaultFile.txt", dependency1.getName()); + } + + @Test + public void givenResourceQualifier_WhenField_ThenDependency2Valid() { + assertNotNull(dependency2); + assertEquals("namedFile.txt", dependency2.getName()); + } +} diff --git a/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/SetterResourceInjectionIntegrationTest.java b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/SetterResourceInjectionIntegrationTest.java new file mode 100644 index 0000000000..90c8677bff --- /dev/null +++ b/spring-di-2/src/test/java/com/baeldung/wiring/configuration/resource/SetterResourceInjectionIntegrationTest.java @@ -0,0 +1,34 @@ +package com.baeldung.wiring.configuration.resource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.wiring.configuration.ApplicationContextTestResourceNameType; + +import javax.annotation.Resource; +import java.io.File; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(loader = AnnotationConfigContextLoader.class, + classes = ApplicationContextTestResourceNameType.class) +public class SetterResourceInjectionIntegrationTest { + + private File defaultFile; + + @Resource + protected void setDefaultFile(File defaultFile) { + this.defaultFile = defaultFile; + } + + @Test + public void givenResourceAnnotation_WhenOnSetter_THEN_MUST_INJECT_Dependency() { + assertNotNull(defaultFile); + assertEquals("namedFile.txt", defaultFile.getName()); + } +} From 2c62d0214cc55b32625620bb7223699875138e75 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Wed, 15 Jul 2020 21:40:56 +0530 Subject: [PATCH 0111/1862] Add files via upload Difference between request.getSession() and request.getSession(true) --- .../WebContent/META-INF/MANIFEST.MF | 3 ++ .../WebContent/WEB-INF/web.xml | 34 +++++++++++++++++++ .../WebContent/index.html | 13 +++++++ .../src/httpsessionexample/FirstServlet.java | 33 ++++++++++++++++++ .../src/httpsessionexample/SecondServlet.java | 31 +++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 spring-session/http-session-example/WebContent/META-INF/MANIFEST.MF create mode 100644 spring-session/http-session-example/WebContent/WEB-INF/web.xml create mode 100644 spring-session/http-session-example/WebContent/index.html create mode 100644 spring-session/http-session-example/src/httpsessionexample/FirstServlet.java create mode 100644 spring-session/http-session-example/src/httpsessionexample/SecondServlet.java diff --git a/spring-session/http-session-example/WebContent/META-INF/MANIFEST.MF b/spring-session/http-session-example/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..5e9495128c --- /dev/null +++ b/spring-session/http-session-example/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/spring-session/http-session-example/WebContent/WEB-INF/web.xml b/spring-session/http-session-example/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000000..6f88776c72 --- /dev/null +++ b/spring-session/http-session-example/WebContent/WEB-INF/web.xml @@ -0,0 +1,34 @@ + + + httpsessionexample + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + + +firstservlet +httpsessionexample.FirstServlet + + + +firstservlet +/firstservlet + + + +secondservlet +httpsessionexample.SecondServlet + + + +secondservlet +/secondservlet + + + + \ No newline at end of file diff --git a/spring-session/http-session-example/WebContent/index.html b/spring-session/http-session-example/WebContent/index.html new file mode 100644 index 0000000000..063d330854 --- /dev/null +++ b/spring-session/http-session-example/WebContent/index.html @@ -0,0 +1,13 @@ + + + + +Insert title here + + +
    +Name:

    + +
    + + \ No newline at end of file diff --git a/spring-session/http-session-example/src/httpsessionexample/FirstServlet.java b/spring-session/http-session-example/src/httpsessionexample/FirstServlet.java new file mode 100644 index 0000000000..d49c0f3e14 --- /dev/null +++ b/spring-session/http-session-example/src/httpsessionexample/FirstServlet.java @@ -0,0 +1,33 @@ +package httpsessionexample; + +import java.io.PrintWriter; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +public class FirstServlet extends HttpServlet { + public void doGet(HttpServletRequest request, HttpServletResponse response) { + try { + HttpSession session = request.getSession(); + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + + String name = request.getParameter("userName"); + out.print("Hi " + name); + + session.setAttribute("uname", name); + out.print("
    "); + out.print("Session Id : " + session.getId()); + out.print("
    "); + out.print("Second Servlet"); + + out.close(); + + } catch (Exception e) { + System.out.println(e); + } + } + +} diff --git a/spring-session/http-session-example/src/httpsessionexample/SecondServlet.java b/spring-session/http-session-example/src/httpsessionexample/SecondServlet.java new file mode 100644 index 0000000000..ab0b9c34ad --- /dev/null +++ b/spring-session/http-session-example/src/httpsessionexample/SecondServlet.java @@ -0,0 +1,31 @@ +package httpsessionexample; + +import java.io.PrintWriter; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +public class SecondServlet extends HttpServlet { + + public void doGet(HttpServletRequest request, HttpServletResponse response) { + try { + + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + + HttpSession session = request.getSession(true); + String name = (String) session.getAttribute("uname"); + out.print("Hi " + name); + out.print("
    "); + out.print("Session Id : " + session.getId()); + out.print("
    "); + out.close(); + + } catch (Exception e) { + System.out.println(e); + } + } + +} From 26cc3e84d2cf5376fb30b9e9d06a5106fae7cafc Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Wed, 15 Jul 2020 21:48:11 +0530 Subject: [PATCH 0112/1862] Update README.md Difference Between request.getSession() and request.getSession(true) --- spring-session/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-session/README.md b/spring-session/README.md index 65040ec734..05343f67c2 100644 --- a/spring-session/README.md +++ b/spring-session/README.md @@ -6,3 +6,4 @@ This module contains articles about Spring Session - [Guide to Spring Session](https://www.baeldung.com/spring-session) - [Spring Session with JDBC](https://www.baeldung.com/spring-session-jdbc) - [Spring Session with MongoDB](https://www.baeldung.com/spring-session-mongodb) +- [Difference Between request.getSession() and request.getSession(true)](http://inprogress.baeldung.com/?p=215685&preview=true) From 7015c666912301c80cff0e181ad3f44bda117f72 Mon Sep 17 00:00:00 2001 From: mikr Date: Wed, 15 Jul 2020 22:12:07 +0200 Subject: [PATCH 0113/1862] JAVA-38 Move all Spring Cloud Modules to Boot 2 --- parent-boot-2/pom.xml | 1 + spring-cloud/pom.xml | 26 +++++++++---------- .../discovery/DiscoveryClientApplication.java | 4 ++- .../health/ServiceDiscoveryApplication.java | 5 +++- .../DistributedPropertiesApplication.java | 4 ++- .../feign-rest-consumer/pom.xml | 4 +++ .../hystrix/rest/consumer/GreetingClient.java | 2 +- .../RestConsumerFeignApplication.java | 2 +- ...putsServiceApplicationIntegrationTest.java | 6 ++--- ...sWithConditionsServiceIntegrationTest.java | 6 ++--- .../MyLoggerApplicationIntegrationTest.java | 2 +- .../spring-cloud-zookeeper/Greeting/pom.xml | 10 +++++-- .../cloud/greeting/HelloWorldClient.java | 4 +-- spring-cloud/spring-cloud-zookeeper/pom.xml | 3 +-- 14 files changed, 47 insertions(+), 32 deletions(-) diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index ab5424bfaf..ed0f327b8c 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -31,6 +31,7 @@ io.rest-assured rest-assured + ${rest-assured.version} org.springframework.boot diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 6fddb1693f..0e2cac1ff9 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -10,9 +10,9 @@ com.baeldung - parent-modules - 1.0.0-SNAPSHOT - .. + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 @@ -56,17 +56,15 @@
    - 1.2.2.RELEASE - Brixton.SR7 - 1.2.2.RELEASE - 1.2.2.RELEASE - 2.0.2.RELEASE - 1.4.6.RELEASE - 1.2.3.RELEASE - 1.3.0.RELEASE - 1.4.2.RELEASE - 1.4.2.RELEASE - 1.2.3.RELEASE + Hoxton.SR4 + 2.2.3.RELEASE + 2.2.3.RELEASE + 1.4.7.RELEASE + 1.4.7.RELEASE + 1.4.7.RELEASE + 3.0.6.RELEASE + 2.3.1.RELEASE + 2.3.1.RELEASE diff --git a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/discovery/DiscoveryClientApplication.java b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/discovery/DiscoveryClientApplication.java index d013969ad3..e01799b8d9 100644 --- a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/discovery/DiscoveryClientApplication.java +++ b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/discovery/DiscoveryClientApplication.java @@ -4,12 +4,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import static org.springframework.boot.WebApplicationType.NONE; + @SpringBootApplication @EnableDiscoveryClient public class DiscoveryClientApplication { public static void main(String[] args) { - new SpringApplicationBuilder(DiscoveryClientApplication.class).web(true) + new SpringApplicationBuilder(DiscoveryClientApplication.class).web(NONE) .run(args); } diff --git a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/health/ServiceDiscoveryApplication.java b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/health/ServiceDiscoveryApplication.java index 020d7d017c..1ef3e34e08 100644 --- a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/health/ServiceDiscoveryApplication.java +++ b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/health/ServiceDiscoveryApplication.java @@ -1,13 +1,16 @@ package com.baeldung.spring.cloud.consul.health; +import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; +import static org.springframework.boot.WebApplicationType.NONE; + @SpringBootApplication public class ServiceDiscoveryApplication { public static void main(String[] args) { - new SpringApplicationBuilder(ServiceDiscoveryApplication.class).web(true) + new SpringApplicationBuilder(ServiceDiscoveryApplication.class).web(NONE) .run(args); } diff --git a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/properties/DistributedPropertiesApplication.java b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/properties/DistributedPropertiesApplication.java index c1d2b0acc5..d854b5aaba 100644 --- a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/properties/DistributedPropertiesApplication.java +++ b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/properties/DistributedPropertiesApplication.java @@ -4,12 +4,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.web.bind.annotation.RestController; +import static org.springframework.boot.WebApplicationType.NONE; + @SpringBootApplication @RestController public class DistributedPropertiesApplication { public static void main(String[] args) { - new SpringApplicationBuilder(DistributedPropertiesApplication.class).web(true) + new SpringApplicationBuilder(DistributedPropertiesApplication.class).web(NONE) .run(args); } diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml index 367b7c111e..acb9993881 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml @@ -36,18 +36,22 @@ org.springframework.cloud spring-cloud-starter-hystrix + ${spring-cloud-starter-hystrix.version} org.springframework.cloud spring-cloud-starter-hystrix-dashboard + ${spring-cloud-starter-hystrix.version} org.springframework.cloud spring-cloud-starter-feign + ${spring-cloud-starter-feign.version} org.springframework.boot spring-boot-starter-web + ${spring-boot-starter-web.version} org.springframework.boot diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/java/com/baeldung/spring/cloud/hystrix/rest/consumer/GreetingClient.java b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/java/com/baeldung/spring/cloud/hystrix/rest/consumer/GreetingClient.java index 4fcfb0eeda..2a31917352 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/java/com/baeldung/spring/cloud/hystrix/rest/consumer/GreetingClient.java +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/java/com/baeldung/spring/cloud/hystrix/rest/consumer/GreetingClient.java @@ -1,7 +1,7 @@ package com.baeldung.spring.cloud.hystrix.rest.consumer; import com.baeldung.spring.cloud.hystrix.rest.producer.GreetingController; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.FeignClient; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.PathVariable; diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/java/com/baeldung/spring/cloud/hystrix/rest/consumer/RestConsumerFeignApplication.java b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/java/com/baeldung/spring/cloud/hystrix/rest/consumer/RestConsumerFeignApplication.java index 2fc54216fe..044b0dbcb8 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/java/com/baeldung/spring/cloud/hystrix/rest/consumer/RestConsumerFeignApplication.java +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/src/main/java/com/baeldung/spring/cloud/hystrix/rest/consumer/RestConsumerFeignApplication.java @@ -3,8 +3,8 @@ package com.baeldung.spring.cloud.hystrix.rest.consumer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; -import org.springframework.cloud.netflix.feign.EnableFeignClients; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; +import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication @EnableCircuitBreaker diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MultipleOutputsServiceApplicationIntegrationTest.java b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MultipleOutputsServiceApplicationIntegrationTest.java index 898d06897f..c8b8c9f1a9 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MultipleOutputsServiceApplicationIntegrationTest.java +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MultipleOutputsServiceApplicationIntegrationTest.java @@ -28,13 +28,13 @@ public class MultipleOutputsServiceApplicationIntegrationTest { @Test public void whenSendMessage_thenResponseIsInAOutput() { whenSendMessage(1); - thenPayloadInChannelIs(pipe.anOutput(), 1); + thenPayloadInChannelIs(pipe.anOutput(), "1"); } @Test public void whenSendMessage_thenResponseIsInAnotherOutput() { whenSendMessage(11); - thenPayloadInChannelIs(pipe.anotherOutput(), 11); + thenPayloadInChannelIs(pipe.anotherOutput(), "11"); } private void whenSendMessage(Integer val) { @@ -43,7 +43,7 @@ public class MultipleOutputsServiceApplicationIntegrationTest { .build()); } - private void thenPayloadInChannelIs(MessageChannel channel, Integer expectedValue) { + private void thenPayloadInChannelIs(MessageChannel channel, String expectedValue) { Object payload = messageCollector.forChannel(channel) .poll() .getPayload(); diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MultipleOutputsWithConditionsServiceIntegrationTest.java b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MultipleOutputsWithConditionsServiceIntegrationTest.java index c3bf5a1205..1aa8d38aa1 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MultipleOutputsWithConditionsServiceIntegrationTest.java +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MultipleOutputsWithConditionsServiceIntegrationTest.java @@ -28,13 +28,13 @@ public class MultipleOutputsWithConditionsServiceIntegrationTest { @Test public void whenSendMessage_thenResponseIsInAOutput() { whenSendMessage(1); - thenPayloadInChannelIs(pipe.anOutput(), 1); + thenPayloadInChannelIs(pipe.anOutput(), "1"); } @Test public void whenSendMessage_thenResponseIsInAnotherOutput() { whenSendMessage(11); - thenPayloadInChannelIs(pipe.anotherOutput(), 11); + thenPayloadInChannelIs(pipe.anotherOutput(), "11"); } private void whenSendMessage(Integer val) { @@ -43,7 +43,7 @@ public class MultipleOutputsWithConditionsServiceIntegrationTest { .build()); } - private void thenPayloadInChannelIs(MessageChannel channel, Integer expectedValue) { + private void thenPayloadInChannelIs(MessageChannel channel, String expectedValue) { Object payload = messageCollector.forChannel(channel) .poll() .getPayload(); diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MyLoggerApplicationIntegrationTest.java b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MyLoggerApplicationIntegrationTest.java index 21d84e79e0..7e5f4fbec7 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MyLoggerApplicationIntegrationTest.java +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/com/baeldung/spring/cloud/stream/rabbit/MyLoggerApplicationIntegrationTest.java @@ -35,6 +35,6 @@ public class MyLoggerApplicationIntegrationTest { .poll() .getPayload(); - assertEquals("[1]: This is my message", payload.toString()); + assertEquals("{\"message\":\"[1]: This is my message\"}", payload.toString()); } } diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml b/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml index ac469d8bc4..871218e78c 100644 --- a/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml +++ b/spring-cloud/spring-cloud-zookeeper/Greeting/pom.xml @@ -30,6 +30,10 @@ spring-boot-starter ${spring-boot.version} + + org.springframework.boot + spring-boot-starter-web + org.springframework spring-web @@ -56,7 +60,10 @@ spring-cloud-starter-feign ${spring-cloud-starter-feign.version} - + + org.springframework.cloud + spring-cloud-starter-openfeign + org.springframework.boot spring-boot-starter-test @@ -71,7 +78,6 @@ - 1.2.5.RELEASE 1.3 diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/HelloWorldClient.java b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/HelloWorldClient.java index c56cb1907a..dc90576e08 100644 --- a/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/HelloWorldClient.java +++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/main/java/com/baeldung/spring/cloud/greeting/HelloWorldClient.java @@ -2,8 +2,8 @@ package com.baeldung.spring.cloud.greeting; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.netflix.feign.EnableFeignClients; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.EnableFeignClients; +import org.springframework.cloud.openfeign.FeignClient; import org.springframework.context.annotation.Configuration; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; diff --git a/spring-cloud/spring-cloud-zookeeper/pom.xml b/spring-cloud/spring-cloud-zookeeper/pom.xml index 64d30b19a6..244ccbd957 100644 --- a/spring-cloud/spring-cloud-zookeeper/pom.xml +++ b/spring-cloud/spring-cloud-zookeeper/pom.xml @@ -18,8 +18,7 @@ - 1.5.2.RELEASE - 4.3.7.RELEASE + 5.2.7.RELEASE 1.0.3.RELEASE From 8a76711fb522814c9f0e862f9692565b1885d0cc Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Thu, 16 Jul 2020 00:38:26 +0200 Subject: [PATCH 0114/1862] Minor code refinement --- .../com/baeldung/exceptionhandling/ExceptionHandling.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt b/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt index 137a303edb..225a1339e2 100644 --- a/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt +++ b/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt @@ -28,7 +28,7 @@ class ExceptionHandling { fun multipleCatchBlock(): Int? { return try { val result = 25 / 0 - return result + result } catch (exception: NumberFormatException) { println("NumberFormatException in the code") null @@ -69,10 +69,10 @@ class ExceptionHandling { } } - fun throwKeyword() { + fun throwKeyword(): Int { val message = "Welcome to Kotlin Tutorials" if (message.length > 10) throw IllegalArgumentException("String is invalid") - else println("String is valid") + else return message.length } @Throws(IOException::class) From 9e03b89e699d9dc567af844157dc9307fe3f8329 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Wed, 15 Jul 2020 20:53:23 -0400 Subject: [PATCH 0115/1862] BAEL-4007 Add jpa data equality unit test specs --- persistence-modules/java-jpa-3/README.md | 3 + persistence-modules/java-jpa-3/pom.xml | 139 ++++++++++++++++++ .../jpa/equality/EqualByBusinessKey.java | 54 +++++++ .../com/baeldung/jpa/equality/EqualById.java | 54 +++++++ .../jpa/equality/EqualByJavaDefault.java | 38 +++++ .../main/resources/META-INF/persistence.xml | 25 ++++ .../java-jpa-3/src/main/resources/logback.xml | 15 ++ .../jpa/equality/EqualityUnitTest.java | 74 ++++++++++ 8 files changed, 402 insertions(+) create mode 100644 persistence-modules/java-jpa-3/README.md create mode 100644 persistence-modules/java-jpa-3/pom.xml create mode 100644 persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java create mode 100644 persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java create mode 100644 persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java create mode 100644 persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml create mode 100644 persistence-modules/java-jpa-3/src/main/resources/logback.xml create mode 100644 persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java diff --git a/persistence-modules/java-jpa-3/README.md b/persistence-modules/java-jpa-3/README.md new file mode 100644 index 0000000000..01fdf05b53 --- /dev/null +++ b/persistence-modules/java-jpa-3/README.md @@ -0,0 +1,3 @@ +## JPA in Java + +This module contains articles about the Java Persistence API (JPA) in Java. diff --git a/persistence-modules/java-jpa-3/pom.xml b/persistence-modules/java-jpa-3/pom.xml new file mode 100644 index 0000000000..562f337215 --- /dev/null +++ b/persistence-modules/java-jpa-3/pom.xml @@ -0,0 +1,139 @@ + + + 4.0.0 + java-jpa-3 + java-jpa-3 + + + com.baeldung + persistence-modules + 1.0.0-SNAPSHOT + + + + + org.hibernate + hibernate-core + ${hibernate.version} + + + org.hibernate + hibernate-jpamodelgen + ${hibernate.version} + + + com.h2database + h2 + ${h2.version} + + + + + javax.persistence + javax.persistence-api + ${javax.persistence-api.version} + + + + + org.eclipse.persistence + eclipselink + ${eclipselink.version} + runtime + + + org.postgresql + postgresql + ${postgres.version} + runtime + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + -proc:none + + + + org.bsc.maven + maven-processor-plugin + ${maven-processor-plugin.version} + + + process + + process + + generate-sources + + target/metamodel + + org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + ${build-helper-maven-plugin.version} + + + add-source + generate-sources + + add-source + + + + target/metamodel + ${project.build.directory}/generated-sources/java/ + + + + + + + com.mysema.maven + apt-maven-plugin + 1.1.3 + + + + process + + + target/generated-sources/java + com.querydsl.apt.jpa.JPAAnnotationProcessor + + + + + + + + + 5.4.14.Final + 2.7.4 + 42.2.5 + 2.2 + 3.11.1 + 3.5.1 + 3.3.3 + 3.0.0 + + + diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java new file mode 100644 index 0000000000..3e34f97d77 --- /dev/null +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java @@ -0,0 +1,54 @@ +package com.baeldung.jpa.equality; + +import javax.persistence.*; + +@Entity +public class EqualByBusinessKey { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private String email; + + public EqualByBusinessKey() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((email == null) ? 0 : email.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (obj instanceof EqualByBusinessKey) + if (((EqualByBusinessKey) obj).getEmail() == getEmail()) + return true; + + return false; + } + +} diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java new file mode 100644 index 0000000000..f29a152f3e --- /dev/null +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java @@ -0,0 +1,54 @@ +package com.baeldung.jpa.equality; + +import javax.persistence.*; + +@Entity +public class EqualById { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private String email; + + public EqualById() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (obj instanceof EqualById) + return ((EqualById) obj).getId() == getId(); + + return false; + } + +} diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java new file mode 100644 index 0000000000..04a81865c6 --- /dev/null +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java @@ -0,0 +1,38 @@ +package com.baeldung.jpa.equality; + +import javax.persistence.*; + +@Entity +public class EqualByJavaDefault implements Cloneable{ + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private String email; + + public EqualByJavaDefault() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Object clone() throws + CloneNotSupportedException + { + return super.clone(); + } +} diff --git a/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml b/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..28a929f912 --- /dev/null +++ b/persistence-modules/java-jpa-3/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,25 @@ + + + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.equality.EqualByJavaDefault + com.baeldung.jpa.equality.EqualById + com.baeldung.jpa.equality.EqualByBusinessKey + true + + + + + + + + + + + + + diff --git a/persistence-modules/java-jpa-3/src/main/resources/logback.xml b/persistence-modules/java-jpa-3/src/main/resources/logback.xml new file mode 100644 index 0000000000..2527fea245 --- /dev/null +++ b/persistence-modules/java-jpa-3/src/main/resources/logback.xml @@ -0,0 +1,15 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - + %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java new file mode 100644 index 0000000000..c672c9e460 --- /dev/null +++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java @@ -0,0 +1,74 @@ +package com.baeldung.jpa.equality; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class EqualityUnitTest { + + private static EntityManagerFactory factory; + private static EntityManager entityManager; + + @BeforeClass + public static void setup() { + factory = Persistence.createEntityManagerFactory("jpa-h2-equality"); + entityManager = factory.createEntityManager(); + } + + @Test + public void givenObjectBasedEquality_whenUsingEquals_thenEqualIsBasedOnInstance() throws CloneNotSupportedException { + EqualByJavaDefault object1 = new EqualByJavaDefault(); + EqualByJavaDefault object2 = new EqualByJavaDefault(); + + object1.setEmail("test.user@domain.com"); + + entityManager.getTransaction().begin(); + entityManager.persist(object1); + entityManager.getTransaction().commit(); + + object2 = (EqualByJavaDefault) object1.clone(); + + Assert.assertNotEquals(object1, object2); + Assert.assertEquals(object1.getId(), object2.getId()); + Assert.assertEquals(object1.getEmail(), object2.getEmail()); + } + + @Test + public void givenIdBasedEquality_whenUsingEquals_thenEqualIsBasedOnId() { + EqualById object1 = new EqualById(); + EqualById object2 = new EqualById(); + + object1.setEmail("test.user.1@domain.com"); + object2.setEmail("test.user.2@domain.com"); + + entityManager.getTransaction().begin(); + entityManager.persist(object1); + entityManager.getTransaction().commit(); + + object2.setId(object1.getId()); + + Assert.assertEquals(object1, object2); + Assert.assertEquals(object1.getId(), object2.getId()); + Assert.assertNotEquals(object1.getEmail(), object2.getEmail()); + } + + @Test + public void givenBusinessKeyBasedEquality_whenUsingEquals_thenEqualIsBasedOnBusinessKey() { + EqualByBusinessKey object1 = new EqualByBusinessKey(); + EqualByBusinessKey object2 = new EqualByBusinessKey(); + + object1.setEmail("test.user@test-domain.com"); + object2.setEmail("test.user@test-domain.com"); + + entityManager.getTransaction().begin(); + entityManager.persist(object1); + entityManager.getTransaction().commit(); + + Assert.assertEquals(object1, object2); + Assert.assertNotEquals(object1.getId(), object2.getId()); + } +} \ No newline at end of file From 1ba39d1b95e0d6984903a2f8755d2c1026e1fa7b Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Wed, 15 Jul 2020 21:16:31 -0400 Subject: [PATCH 0116/1862] Remove heagonal architecture --- architecture/README.md | 3 -- architecture/pom.xml | 33 ------------ .../HexagonalArchitectureTaskApplication.java | 12 ----- .../application/task/AddNewDailyTask.java | 29 ---------- .../application/task/AddNewTask.java | 22 -------- .../application/task/GetTasks.java | 22 -------- .../commands/task/CreateTask.java | 7 --- .../commands/task/GetAllTasks.java | 7 --- .../architecture/domain/task/Task.java | 53 ------------------- .../domain/task/TaskRepository.java | 7 --- .../architecture/domain/task/TaskService.java | 22 -------- .../framework/cli/StartupRunner.java | 24 --------- .../http/task/TaskApiController.java | 42 --------------- .../framework/http/task/TaskRequest.java | 28 ---------- 14 files changed, 311 deletions(-) delete mode 100644 architecture/README.md delete mode 100644 architecture/pom.xml delete mode 100644 architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/domain/task/Task.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/domain/task/TaskRepository.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java delete mode 100644 architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java diff --git a/architecture/README.md b/architecture/README.md deleted file mode 100644 index be093f25ed..0000000000 --- a/architecture/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant articles - -- [A Quick and Practical Example of Hexagonal Architecture in Java](https://www.baeldung.com/a-quick-and-practical-example-of-hexagonal-architecture-in-java-3/) diff --git a/architecture/pom.xml b/architecture/pom.xml deleted file mode 100644 index 4ad104293e..0000000000 --- a/architecture/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - 4.0.0 - com.baeldung.architecture - architecture - 0.0.1-SNAPSHOT - architecture - jar - A Quick and Practical Example of Hexagonal Architecture in Java - - - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.h2database - h2 - runtime - - - org.springframework.boot - spring-boot-starter-web - - - diff --git a/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java b/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java deleted file mode 100644 index 69c6f4b276..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/HexagonalArchitectureTaskApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.architecture; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class HexagonalArchitectureTaskApplication { - public static void main(String[] args) { - SpringApplication.run(HexagonalArchitectureTaskApplication.class, args); - } - -} diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java deleted file mode 100644 index f9ee97542c..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewDailyTask.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.architecture.application.task; - -import java.time.Instant; -import java.time.temporal.ChronoUnit; - -import com.baeldung.architecture.commands.task.CreateTask; -import com.baeldung.architecture.domain.task.Task; - -import org.springframework.stereotype.Component; - -@Component -public class AddNewDailyTask implements CreateTask { - - private AddNewTask addNewTask; - - public AddNewDailyTask(AddNewTask addNewTask) { - this.addNewTask = addNewTask; - } - - @Override - public void create(Task newTask) { - Instant initialDueDate = newTask.getDueDate(); - String description = newTask.getDescription(); - for (int i = 1; i <= 5; i++) { - Task task = new Task(initialDueDate.plus(i, ChronoUnit.DAYS), description); - addNewTask.create(task); - } - } -} diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java b/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java deleted file mode 100644 index 70638378f9..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/application/task/AddNewTask.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.architecture.application.task; - -import com.baeldung.architecture.domain.task.Task; -import com.baeldung.architecture.domain.task.TaskService; -import com.baeldung.architecture.commands.task.*; - -import org.springframework.stereotype.Component; - -@Component -public class AddNewTask implements CreateTask { - - private TaskService taskService; - - public AddNewTask(TaskService taskService) { - this.taskService = taskService; - } - - @Override - public void create(Task newTask) { - taskService.createTask(newTask); - } -} diff --git a/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java b/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java deleted file mode 100644 index c876f7de85..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/application/task/GetTasks.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.architecture.application.task; - -import com.baeldung.architecture.domain.task.Task; -import com.baeldung.architecture.domain.task.TaskService; -import com.baeldung.architecture.commands.task.*; - -import org.springframework.stereotype.Component; - -@Component -public class GetTasks implements GetAllTasks { - - private TaskService taskService; - - public GetTasks(TaskService taskService) { - this.taskService = taskService; - } - - @Override - public Iterable getAll() { - return taskService.getAllTasks(); - } -} diff --git a/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java b/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java deleted file mode 100644 index ec60868a22..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/commands/task/CreateTask.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.architecture.commands.task; - -import com.baeldung.architecture.domain.task.Task; - -public interface CreateTask { - public void create(Task newTask); -} diff --git a/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java b/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java deleted file mode 100644 index c9aa1be5f8..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/commands/task/GetAllTasks.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.architecture.commands.task; - -import com.baeldung.architecture.domain.task.Task; - -public interface GetAllTasks { - public Iterable getAll(); -} diff --git a/architecture/src/main/java/com/baeldung/architecture/domain/task/Task.java b/architecture/src/main/java/com/baeldung/architecture/domain/task/Task.java deleted file mode 100644 index 240dc33571..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/domain/task/Task.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.baeldung.architecture.domain.task; - -import java.time.Instant; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - -@Entity -public class Task { - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - private Long id; - private Instant dueDate = Instant.now(); - private String description; - - public Task() {} - - public Task(Instant dueDate, String description) { - this.dueDate = dueDate; - this.description = description; - } - - public Task(Long id, Instant dueDate, String description) { - this(dueDate, description); - this.id = id; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Instant getDueDate() { - return dueDate; - } - - public void setDueDate(Instant dueDate) { - this.dueDate = dueDate; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } -} diff --git a/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskRepository.java b/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskRepository.java deleted file mode 100644 index d896212714..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.architecture.domain.task; - -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface TaskRepository extends CrudRepository {}; diff --git a/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java b/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java deleted file mode 100644 index 11ef0f3e19..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/domain/task/TaskService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.architecture.domain.task; - -import org.springframework.stereotype.Service; - -@Service -public class TaskService { - - private TaskRepository taskRepository; - - public TaskService(TaskRepository taskRepository) { - this.taskRepository = taskRepository; - } - - public void createTask(Task task) { - taskRepository.save(task); - } - - public Iterable getAllTasks() { - return taskRepository.findAll(); - } - -} diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java b/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java deleted file mode 100644 index 449bc9386e..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/framework/cli/StartupRunner.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.architecture.framework.cli; - -import com.baeldung.architecture.application.task.AddNewDailyTask; -import com.baeldung.architecture.domain.task.Task; - -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.stereotype.Component; - -@Component -public class StartupRunner implements ApplicationRunner { - - AddNewDailyTask addNewDailyTask; - - public StartupRunner(AddNewDailyTask addNewDailyTask) { - this.addNewDailyTask = addNewDailyTask; - } - @Override - public void run(ApplicationArguments args) throws Exception { - Task task = new Task(); - task.setDescription("Startup Task"); - addNewDailyTask.create(task); - } -} diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java deleted file mode 100644 index 87a8f5fe4b..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskApiController.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.architecture.framework.http.task; - -import java.time.Instant; - -import com.baeldung.architecture.application.task.AddNewTask; -import com.baeldung.architecture.application.task.GetTasks; -import com.baeldung.architecture.domain.task.Task; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("task") -public class TaskApiController { - - private AddNewTask addNewTask; - private GetTasks getTasks; - - public TaskApiController( - AddNewTask addNewTask, - GetTasks getTasks - ) { - this.addNewTask = addNewTask; - this.getTasks = getTasks; - } - - @GetMapping - Iterable listTasks() { - return getTasks.getAll(); - } - - @PostMapping(consumes = "application/json", produces = "application/json") - void createTask(@RequestBody TaskRequest taskRequest) { - Task task = new Task(); - task.setDescription(taskRequest.getDescription()); - task.setDueDate(Instant.parse(taskRequest.getDueDate())); - addNewTask.create(task); - } -} diff --git a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java b/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java deleted file mode 100644 index 70b98a32f9..0000000000 --- a/architecture/src/main/java/com/baeldung/architecture/framework/http/task/TaskRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.architecture.framework.http.task; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -public class TaskRequest { - @JsonInclude(Include.NON_NULL) - private String description; - - @JsonInclude(Include.NON_NULL) - private String dueDate; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getDueDate() { - return dueDate; - } - - public void setDueDate(String dueDate) { - this.dueDate = dueDate; - } -} From 03c92a6023f4f5a65a8a23ff11c1cf507f1e6f70 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Thu, 16 Jul 2020 10:31:54 +0430 Subject: [PATCH 0117/1862] Moved to Specific Package --- .../main/java/com/baeldung/{ => falsesharing}/FalseSharing.java | 2 +- .../main/java/com/baeldung/{ => falsesharing}/LongAdder.java | 2 +- .../main/java/com/baeldung/{ => falsesharing}/Striped64.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename jmh/src/main/java/com/baeldung/{ => falsesharing}/FalseSharing.java (93%) rename jmh/src/main/java/com/baeldung/{ => falsesharing}/LongAdder.java (99%) rename jmh/src/main/java/com/baeldung/{ => falsesharing}/Striped64.java (99%) diff --git a/jmh/src/main/java/com/baeldung/FalseSharing.java b/jmh/src/main/java/com/baeldung/falsesharing/FalseSharing.java similarity index 93% rename from jmh/src/main/java/com/baeldung/FalseSharing.java rename to jmh/src/main/java/com/baeldung/falsesharing/FalseSharing.java index 24ba0c0b6b..faad31066b 100644 --- a/jmh/src/main/java/com/baeldung/FalseSharing.java +++ b/jmh/src/main/java/com/baeldung/falsesharing/FalseSharing.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.falsesharing; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; diff --git a/jmh/src/main/java/com/baeldung/LongAdder.java b/jmh/src/main/java/com/baeldung/falsesharing/LongAdder.java similarity index 99% rename from jmh/src/main/java/com/baeldung/LongAdder.java rename to jmh/src/main/java/com/baeldung/falsesharing/LongAdder.java index 8fd2b85c4f..06365ee3d2 100644 --- a/jmh/src/main/java/com/baeldung/LongAdder.java +++ b/jmh/src/main/java/com/baeldung/falsesharing/LongAdder.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.falsesharing; import java.io.Serializable; import java.util.concurrent.atomic.AtomicLong; diff --git a/jmh/src/main/java/com/baeldung/Striped64.java b/jmh/src/main/java/com/baeldung/falsesharing/Striped64.java similarity index 99% rename from jmh/src/main/java/com/baeldung/Striped64.java rename to jmh/src/main/java/com/baeldung/falsesharing/Striped64.java index d305c334e0..284e62bc65 100644 --- a/jmh/src/main/java/com/baeldung/Striped64.java +++ b/jmh/src/main/java/com/baeldung/falsesharing/Striped64.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.falsesharing; import sun.misc.Unsafe; From c597e8dc6afefb5dbbe700047c24612d69ae76b9 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Thu, 16 Jul 2020 10:35:04 +0430 Subject: [PATCH 0118/1862] Added Javadoc Hint --- jmh/src/main/java/com/baeldung/falsesharing/LongAdder.java | 2 ++ jmh/src/main/java/com/baeldung/falsesharing/Striped64.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/jmh/src/main/java/com/baeldung/falsesharing/LongAdder.java b/jmh/src/main/java/com/baeldung/falsesharing/LongAdder.java index 06365ee3d2..39f9f981ab 100644 --- a/jmh/src/main/java/com/baeldung/falsesharing/LongAdder.java +++ b/jmh/src/main/java/com/baeldung/falsesharing/LongAdder.java @@ -4,6 +4,8 @@ import java.io.Serializable; import java.util.concurrent.atomic.AtomicLong; /** + * Copy-pasted from {@link java.util.concurrent.atomic.LongAdder} + * * One or more variables that together maintain an initially zero * {@code long} sum. When updates (method {@link #add}) are contended * across threads, the set of variables may grow dynamically to reduce diff --git a/jmh/src/main/java/com/baeldung/falsesharing/Striped64.java b/jmh/src/main/java/com/baeldung/falsesharing/Striped64.java index 284e62bc65..71c34a9de3 100644 --- a/jmh/src/main/java/com/baeldung/falsesharing/Striped64.java +++ b/jmh/src/main/java/com/baeldung/falsesharing/Striped64.java @@ -8,6 +8,8 @@ import java.util.function.DoubleBinaryOperator; import java.util.concurrent.ThreadLocalRandom; /** + * Copy-pasted from {@code java.util.concurrent.atomic.Striped64} class. + * * A package-local class holding common representation and mechanics * for classes supporting dynamic striping on 64bit values. The class * extends Number so that concrete subclasses must publicly do so. From 3ccb59bf84c06e6c50757af8440ca9d2b16ace4a Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 16 Jul 2020 09:15:40 +0200 Subject: [PATCH 0119/1862] BAEL-3917: Fix the integrations tests in ddd (#9708) --- .../config/CustomMongoConfiguration.java | 46 +++++++++++++++++++ ...ionTest.java => PersistOrderLiveTest.java} | 17 ++++--- ...ationTest.java => OrderMongoLiveTest.java} | 7 ++- ...> CassandraDbOrderRepositoryLiveTest.java} | 7 ++- ...va => MongoDbOrderRepositoryLiveTest.java} | 7 ++- 5 files changed, 75 insertions(+), 9 deletions(-) create mode 100644 ddd/src/main/java/com/baeldung/ddd/order/config/CustomMongoConfiguration.java rename ddd/src/test/java/com/baeldung/ddd/order/jpa/{PersistOrderIntegrationTest.java => PersistOrderLiveTest.java} (84%) rename ddd/src/test/java/com/baeldung/ddd/order/mongo/{OrderMongoIntegrationTest.java => OrderMongoLiveTest.java} (87%) rename ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{CassandraDbOrderRepositoryIntegrationTest.java => CassandraDbOrderRepositoryLiveTest.java} (87%) rename ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/{MongoDbOrderRepositoryIntegrationTest.java => MongoDbOrderRepositoryLiveTest.java} (87%) diff --git a/ddd/src/main/java/com/baeldung/ddd/order/config/CustomMongoConfiguration.java b/ddd/src/main/java/com/baeldung/ddd/order/config/CustomMongoConfiguration.java new file mode 100644 index 0000000000..fcc6a50267 --- /dev/null +++ b/ddd/src/main/java/com/baeldung/ddd/order/config/CustomMongoConfiguration.java @@ -0,0 +1,46 @@ +package com.baeldung.ddd.order.config; + +import org.bson.Document; +import org.joda.money.CurrencyUnit; +import org.joda.money.Money; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.convert.converter.Converter; +import org.springframework.data.convert.ReadingConverter; +import org.springframework.data.mongodb.core.convert.MongoCustomConversions; + +import java.math.BigDecimal; +import java.util.Collections; + +@Configuration +public class CustomMongoConfiguration { + + @Bean + public MongoCustomConversions customConversions() { + return new MongoCustomConversions(Collections.singletonList(DocumentToMoneyConverter.INSTANCE)); + } + + @ReadingConverter + enum DocumentToMoneyConverter implements Converter { + + INSTANCE; + + @Override + public Money convert(Document source) { + Document money = source.get("money", Document.class); + + return Money.of(getCurrency(money), getAmount(money)); + } + + private CurrencyUnit getCurrency(Document money) { + Document currency = money.get("currency", Document.class); + String currencyCode = currency.getString("code"); + return CurrencyUnit.of(currencyCode); + } + + private BigDecimal getAmount(Document money) { + String amount = money.getString("amount"); + return BigDecimal.valueOf(Double.parseDouble(amount)); + } + } +} diff --git a/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderIntegrationTest.java b/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderLiveTest.java similarity index 84% rename from ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderIntegrationTest.java rename to ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderLiveTest.java index c503c9960b..8f30bc14a7 100644 --- a/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderIntegrationTest.java +++ b/ddd/src/test/java/com/baeldung/ddd/order/jpa/PersistOrderLiveTest.java @@ -1,19 +1,24 @@ package com.baeldung.ddd.order.jpa; -import static org.assertj.core.api.Assertions.assertThat; - -import java.math.BigDecimal; -import java.util.Arrays; - import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; +import java.math.BigDecimal; +import java.util.Arrays; + +import static org.assertj.core.api.Assertions.assertThat; + +/* + To run this test we need to run the databases first. + A dedicated docker-compose.yml file is located under the resources directory. + We can run it by simple executing `docker-compose up`. + */ @SpringJUnitConfig @SpringBootTest -public class PersistOrderIntegrationTest { +public class PersistOrderLiveTest { @Autowired private JpaOrderRepository repository; diff --git a/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoIntegrationTest.java b/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoLiveTest.java similarity index 87% rename from ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoIntegrationTest.java rename to ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoLiveTest.java index ca4315c416..38e00be0b0 100644 --- a/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoIntegrationTest.java +++ b/ddd/src/test/java/com/baeldung/ddd/order/mongo/OrderMongoLiveTest.java @@ -17,9 +17,14 @@ import com.baeldung.ddd.order.Order; import com.baeldung.ddd.order.OrderLine; import com.baeldung.ddd.order.Product; +/* + To run this test we need to run the databases first. + A dedicated docker-compose.yml file is located under the resources directory. + We can run it by simple executing `docker-compose up`. + */ @SpringJUnitConfig @SpringBootTest -public class OrderMongoIntegrationTest { +public class OrderMongoLiveTest { @Autowired private OrderMongoRepository repo; diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryLiveTest.java similarity index 87% rename from ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java rename to ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryLiveTest.java index 668d1e5e34..4b44e1d7b4 100644 --- a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryIntegrationTest.java +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/CassandraDbOrderRepositoryLiveTest.java @@ -18,10 +18,15 @@ import com.baeldung.dddhexagonalspring.domain.Product; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; import com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra.SpringDataCassandraOrderRepository; +/* + To run this test we need to run the databases first. + A dedicated docker-compose.yml file is located under the resources directory. + We can run it by simple executing `docker-compose up`. + */ @SpringJUnitConfig @SpringBootTest @TestPropertySource("classpath:ddd-layers-test.properties") -class CassandraDbOrderRepositoryIntegrationTest { +class CassandraDbOrderRepositoryLiveTest { @Autowired private SpringDataCassandraOrderRepository cassandraOrderRepository; diff --git a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryLiveTest.java similarity index 87% rename from ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java rename to ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryLiveTest.java index 9a7736c419..3cb3528448 100644 --- a/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryIntegrationTest.java +++ b/ddd/src/test/java/com/baeldung/dddhexagonalspring/infrastracture/repository/MongoDbOrderRepositoryLiveTest.java @@ -18,10 +18,15 @@ import com.baeldung.dddhexagonalspring.domain.Product; import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository; import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.SpringDataMongoOrderRepository; +/* + To run this test we need to run the databases first. + A dedicated docker-compose.yml file is located under the resources directory. + We can run it by simple executing `docker-compose up`. + */ @SpringJUnitConfig @SpringBootTest @TestPropertySource("classpath:ddd-layers-test.properties") -class MongoDbOrderRepositoryIntegrationTest { +class MongoDbOrderRepositoryLiveTest { @Autowired private SpringDataMongoOrderRepository mongoOrderRepository; From 0b083391bb81bf49f72594e7c337bcc17fa1c6d3 Mon Sep 17 00:00:00 2001 From: mikr Date: Thu, 16 Jul 2020 10:45:06 +0200 Subject: [PATCH 0120/1862] JAVA-2096 Add dummy file to make sure the directory is versioned --- core-java-modules/core-java-io-3/src/test/resources/dummy.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 core-java-modules/core-java-io-3/src/test/resources/dummy.txt diff --git a/core-java-modules/core-java-io-3/src/test/resources/dummy.txt b/core-java-modules/core-java-io-3/src/test/resources/dummy.txt new file mode 100644 index 0000000000..e69de29bb2 From 60ef1c85512c0ae4b5462935b84e66e8b9c20640 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 17 Jul 2020 03:46:41 +0200 Subject: [PATCH 0121/1862] JAVA-2116: Split or move libraries-data-2 module (#9716) * JAVA-2116: Move Java-R Integration to libraries-6 module * JAVA-2116: Move Guide to JMapper to libraries-data module --- libraries-6/README.md | 1 + libraries-6/pom.xml | 45 +++++++++++++++ .../main/java/com/baeldung/r/FastRMean.java | 3 - .../main/java/com/baeldung/r/RCallerMean.java | 6 +- .../src/main/java/com/baeldung/r/RUtils.java | 0 .../main/java/com/baeldung/r/RenjinMean.java | 9 ++- .../main/java/com/baeldung/r/RserveMean.java | 0 .../com/baeldung/r/FastRMeanUnitTest.java | 0 .../r/RCallerMeanIntegrationTest.java | 9 ++- .../com/baeldung/r/RenjinMeanUnitTest.java | 10 ++-- .../baeldung/r/RserveMeanIntegrationTest.java | 0 .../src/test/resources/script.R | 0 libraries-data-2/README.md | 2 - libraries-data-2/pom.xml | 55 ++----------------- libraries-data/README.md | 1 + libraries-data/pom.xml | 6 ++ .../main/java/com/baeldung/jmapper/User.java | 0 .../java/com/baeldung/jmapper/UserDto.java | 0 .../java/com/baeldung/jmapper/UserDto1.java | 0 .../com/baeldung/jmapper/relational/User.java | 0 .../baeldung/jmapper/relational/UserDto1.java | 0 .../baeldung/jmapper/relational/UserDto2.java | 0 .../jmapper/JMapperIntegrationTest.java | 3 + .../JMapperRelationalIntegrationTest.java | 4 +- .../src/test/resources/user_jmapper.xml | 0 .../src/test/resources/user_jmapper1.xml | 0 .../src/test/resources/user_jmapper2.xml | 0 27 files changed, 79 insertions(+), 75 deletions(-) rename {libraries-data-2 => libraries-6}/src/main/java/com/baeldung/r/FastRMean.java (92%) rename {libraries-data-2 => libraries-6}/src/main/java/com/baeldung/r/RCallerMean.java (99%) rename {libraries-data-2 => libraries-6}/src/main/java/com/baeldung/r/RUtils.java (100%) rename {libraries-data-2 => libraries-6}/src/main/java/com/baeldung/r/RenjinMean.java (99%) rename {libraries-data-2 => libraries-6}/src/main/java/com/baeldung/r/RserveMean.java (100%) rename {libraries-data-2 => libraries-6}/src/test/java/com/baeldung/r/FastRMeanUnitTest.java (100%) rename {libraries-data-2 => libraries-6}/src/test/java/com/baeldung/r/RCallerMeanIntegrationTest.java (99%) rename {libraries-data-2 => libraries-6}/src/test/java/com/baeldung/r/RenjinMeanUnitTest.java (99%) rename {libraries-data-2 => libraries-6}/src/test/java/com/baeldung/r/RserveMeanIntegrationTest.java (100%) rename {libraries-data-2 => libraries-6}/src/test/resources/script.R (100%) rename {libraries-data-2 => libraries-data}/src/main/java/com/baeldung/jmapper/User.java (100%) rename {libraries-data-2 => libraries-data}/src/main/java/com/baeldung/jmapper/UserDto.java (100%) rename {libraries-data-2 => libraries-data}/src/main/java/com/baeldung/jmapper/UserDto1.java (100%) rename {libraries-data-2 => libraries-data}/src/main/java/com/baeldung/jmapper/relational/User.java (100%) rename {libraries-data-2 => libraries-data}/src/main/java/com/baeldung/jmapper/relational/UserDto1.java (100%) rename {libraries-data-2 => libraries-data}/src/main/java/com/baeldung/jmapper/relational/UserDto2.java (100%) rename {libraries-data-2 => libraries-data}/src/test/java/com/baeldung/jmapper/JMapperIntegrationTest.java (95%) rename {libraries-data-2 => libraries-data}/src/test/java/com/baeldung/jmapper/JMapperRelationalIntegrationTest.java (97%) rename {libraries-data-2 => libraries-data}/src/test/resources/user_jmapper.xml (100%) rename {libraries-data-2 => libraries-data}/src/test/resources/user_jmapper1.xml (100%) rename {libraries-data-2 => libraries-data}/src/test/resources/user_jmapper2.xml (100%) diff --git a/libraries-6/README.md b/libraries-6/README.md index 5f74517ab5..3748522b9d 100644 --- a/libraries-6/README.md +++ b/libraries-6/README.md @@ -15,4 +15,5 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m - [A Guide to the Reflections Library](https://www.baeldung.com/reflections-library) - [Exactly Once Processing in Kafka](https://www.baeldung.com/kafka-exactly-once) - [Introduction to Protonpack](https://www.baeldung.com/java-protonpack) +- [Java-R Integration](https://www.baeldung.com/java-r-integration) - More articles [[<-- prev]](/libraries-5) diff --git a/libraries-6/pom.xml b/libraries-6/pom.xml index 030e5aa77b..2f8cc385cb 100644 --- a/libraries-6/pom.xml +++ b/libraries-6/pom.xml @@ -92,8 +92,50 @@ ${commonsio.version} test + + org.rosuda.REngine + Rserve + ${rserve.version} + + + com.github.jbytecode + RCaller + ${rcaller.version} + + + org.renjin + renjin-script-engine + ${renjin.version} + + + + + bedatadriven + bedatadriven public repo + https://nexus.bedatadriven.com/content/groups/public/ + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + com/baeldung/r/FastRMean.java + + + com/baeldung/r/FastRMeanUnitTest.java + + + + + + 2.0.0 1.10.0 @@ -105,6 +147,9 @@ 3.6 3.6.2 2.6 + RELEASE + 3.0 + 1.8.1 diff --git a/libraries-data-2/src/main/java/com/baeldung/r/FastRMean.java b/libraries-6/src/main/java/com/baeldung/r/FastRMean.java similarity index 92% rename from libraries-data-2/src/main/java/com/baeldung/r/FastRMean.java rename to libraries-6/src/main/java/com/baeldung/r/FastRMean.java index 8348bfa403..1202cfaa2a 100644 --- a/libraries-data-2/src/main/java/com/baeldung/r/FastRMean.java +++ b/libraries-6/src/main/java/com/baeldung/r/FastRMean.java @@ -1,8 +1,5 @@ package com.baeldung.r; -import java.io.IOException; -import java.net.URISyntaxException; - /** * FastR showcase. * diff --git a/libraries-data-2/src/main/java/com/baeldung/r/RCallerMean.java b/libraries-6/src/main/java/com/baeldung/r/RCallerMean.java similarity index 99% rename from libraries-data-2/src/main/java/com/baeldung/r/RCallerMean.java rename to libraries-6/src/main/java/com/baeldung/r/RCallerMean.java index 99edb8c043..d07a989444 100644 --- a/libraries-data-2/src/main/java/com/baeldung/r/RCallerMean.java +++ b/libraries-6/src/main/java/com/baeldung/r/RCallerMean.java @@ -1,12 +1,12 @@ package com.baeldung.r; -import java.io.IOException; -import java.net.URISyntaxException; - import com.github.rcaller.rstuff.RCaller; import com.github.rcaller.rstuff.RCallerOptions; import com.github.rcaller.rstuff.RCode; +import java.io.IOException; +import java.net.URISyntaxException; + /** * RCaller showcase. * diff --git a/libraries-data-2/src/main/java/com/baeldung/r/RUtils.java b/libraries-6/src/main/java/com/baeldung/r/RUtils.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/r/RUtils.java rename to libraries-6/src/main/java/com/baeldung/r/RUtils.java diff --git a/libraries-data-2/src/main/java/com/baeldung/r/RenjinMean.java b/libraries-6/src/main/java/com/baeldung/r/RenjinMean.java similarity index 99% rename from libraries-data-2/src/main/java/com/baeldung/r/RenjinMean.java rename to libraries-6/src/main/java/com/baeldung/r/RenjinMean.java index 4576ec5fb4..22cfad3a6f 100644 --- a/libraries-data-2/src/main/java/com/baeldung/r/RenjinMean.java +++ b/libraries-6/src/main/java/com/baeldung/r/RenjinMean.java @@ -1,13 +1,12 @@ package com.baeldung.r; -import java.io.IOException; -import java.net.URISyntaxException; - -import javax.script.ScriptException; - import org.renjin.script.RenjinScriptEngine; import org.renjin.sexp.DoubleArrayVector; +import javax.script.ScriptException; +import java.io.IOException; +import java.net.URISyntaxException; + /** * Renjin showcase. * diff --git a/libraries-data-2/src/main/java/com/baeldung/r/RserveMean.java b/libraries-6/src/main/java/com/baeldung/r/RserveMean.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/r/RserveMean.java rename to libraries-6/src/main/java/com/baeldung/r/RserveMean.java diff --git a/libraries-data-2/src/test/java/com/baeldung/r/FastRMeanUnitTest.java b/libraries-6/src/test/java/com/baeldung/r/FastRMeanUnitTest.java similarity index 100% rename from libraries-data-2/src/test/java/com/baeldung/r/FastRMeanUnitTest.java rename to libraries-6/src/test/java/com/baeldung/r/FastRMeanUnitTest.java diff --git a/libraries-data-2/src/test/java/com/baeldung/r/RCallerMeanIntegrationTest.java b/libraries-6/src/test/java/com/baeldung/r/RCallerMeanIntegrationTest.java similarity index 99% rename from libraries-data-2/src/test/java/com/baeldung/r/RCallerMeanIntegrationTest.java rename to libraries-6/src/test/java/com/baeldung/r/RCallerMeanIntegrationTest.java index ce6b3a4332..94dd9b89e5 100644 --- a/libraries-data-2/src/test/java/com/baeldung/r/RCallerMeanIntegrationTest.java +++ b/libraries-6/src/test/java/com/baeldung/r/RCallerMeanIntegrationTest.java @@ -1,14 +1,13 @@ package com.baeldung.r; -import java.io.IOException; -import java.net.URISyntaxException; - -import javax.script.ScriptException; - import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; +import javax.script.ScriptException; +import java.io.IOException; +import java.net.URISyntaxException; + /** * Test for {@link RCallerMean}. * diff --git a/libraries-data-2/src/test/java/com/baeldung/r/RenjinMeanUnitTest.java b/libraries-6/src/test/java/com/baeldung/r/RenjinMeanUnitTest.java similarity index 99% rename from libraries-data-2/src/test/java/com/baeldung/r/RenjinMeanUnitTest.java rename to libraries-6/src/test/java/com/baeldung/r/RenjinMeanUnitTest.java index f52d37d614..49472aaee6 100644 --- a/libraries-data-2/src/test/java/com/baeldung/r/RenjinMeanUnitTest.java +++ b/libraries-6/src/test/java/com/baeldung/r/RenjinMeanUnitTest.java @@ -1,13 +1,11 @@ package com.baeldung.r; -import java.io.IOException; -import java.net.URISyntaxException; - -import javax.script.ScriptException; - +import org.junit.Assert; import org.junit.Test; -import org.junit.Assert; +import javax.script.ScriptException; +import java.io.IOException; +import java.net.URISyntaxException; /** * Test for {@link RenjinMean}. diff --git a/libraries-data-2/src/test/java/com/baeldung/r/RserveMeanIntegrationTest.java b/libraries-6/src/test/java/com/baeldung/r/RserveMeanIntegrationTest.java similarity index 100% rename from libraries-data-2/src/test/java/com/baeldung/r/RserveMeanIntegrationTest.java rename to libraries-6/src/test/java/com/baeldung/r/RserveMeanIntegrationTest.java diff --git a/libraries-data-2/src/test/resources/script.R b/libraries-6/src/test/resources/script.R similarity index 100% rename from libraries-data-2/src/test/resources/script.R rename to libraries-6/src/test/resources/script.R diff --git a/libraries-data-2/README.md b/libraries-data-2/README.md index 3fd9242d82..a8f2a0cb37 100644 --- a/libraries-data-2/README.md +++ b/libraries-data-2/README.md @@ -8,10 +8,8 @@ This module contains articles about libraries for data processing in Java. - [Introduction to Conflict-Free Replicated Data Types](https://www.baeldung.com/java-conflict-free-replicated-data-types) - [Introduction to javax.measure](https://www.baeldung.com/javax-measure) - [A Guide to Infinispan in Java](https://www.baeldung.com/infinispan) -- [Guide to JMapper](https://www.baeldung.com/jmapper) - [An Introduction to SuanShu](https://www.baeldung.com/suanshu) - [Intro to Derive4J](https://www.baeldung.com/derive4j) -- [Java-R Integration](https://www.baeldung.com/java-r-integration) - [Univocity Parsers](https://www.baeldung.com/java-univocity-parsers) - [Using Kafka MockConsumer](https://www.baeldung.com/kafka-mockconsumer) - [Using Kafka MockProducer](https://www.baeldung.com/kafka-mockproducer) diff --git a/libraries-data-2/pom.xml b/libraries-data-2/pom.xml index 93a2f28167..26d8651cdd 100644 --- a/libraries-data-2/pom.xml +++ b/libraries-data-2/pom.xml @@ -86,11 +86,6 @@ spring-web ${spring.version} - - com.googlecode.jmapper-framework - jmapper-core - ${jmapper.version} - com.numericalmethod suanshu @@ -126,6 +121,11 @@ kafka-clients ${kafka.version} + + com.google.guava + guava + ${guava.version} + org.awaitility awaitility @@ -138,21 +138,6 @@ ${awaitility.version} test - - org.rosuda.REngine - Rserve - ${rserve.version} - - - com.github.jbytecode - RCaller - ${rcaller.version} - - - org.renjin - renjin-script-engine - ${renjin.version} - net.bytebuddy byte-buddy @@ -175,33 +160,8 @@ http://repo.numericalmethod.com/maven/ default - - - - bedatadriven - bedatadriven public repo - https://nexus.bedatadriven.com/content/groups/public/ - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - com/baeldung/r/FastRMean.java - - - com/baeldung/r/FastRMeanUnitTest.java - - - - - - 1.5.0 1.6.0 @@ -210,17 +170,14 @@ 9.1.5.Final 2.9.8 4.3.8.RELEASE - 1.6.0.1 4.0.0 1.1.0 3.6.2 1.7.25 3.0.0 2.8.4 - RELEASE - 3.0 - 1.8.1 2.5.0 + 29.0-jre \ No newline at end of file diff --git a/libraries-data/README.md b/libraries-data/README.md index 7614d11b16..44fddfd90e 100644 --- a/libraries-data/README.md +++ b/libraries-data/README.md @@ -12,4 +12,5 @@ This module contains articles about libraries for data processing in Java. - [Introduction to Kafka Connectors](https://www.baeldung.com/kafka-connectors-guide) - [Kafka Connect Example with MQTT and MongoDB](https://www.baeldung.com/kafka-connect-mqtt-mongodb) - [Building a Data Pipeline with Flink and Kafka](https://www.baeldung.com/kafka-flink-data-pipeline) +- [Guide to JMapper](https://www.baeldung.com/jmapper) More articles: [[next -->]](/../libraries-data-2) \ No newline at end of file diff --git a/libraries-data/pom.xml b/libraries-data/pom.xml index 1267982c49..95d771ce4e 100644 --- a/libraries-data/pom.xml +++ b/libraries-data/pom.xml @@ -126,6 +126,11 @@ + + com.googlecode.jmapper-framework + jmapper-core + ${jmapper.version} + @@ -172,6 +177,7 @@ 0.15.0 2.2.0 1.7.25 + 1.6.0.1 diff --git a/libraries-data-2/src/main/java/com/baeldung/jmapper/User.java b/libraries-data/src/main/java/com/baeldung/jmapper/User.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/jmapper/User.java rename to libraries-data/src/main/java/com/baeldung/jmapper/User.java diff --git a/libraries-data-2/src/main/java/com/baeldung/jmapper/UserDto.java b/libraries-data/src/main/java/com/baeldung/jmapper/UserDto.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/jmapper/UserDto.java rename to libraries-data/src/main/java/com/baeldung/jmapper/UserDto.java diff --git a/libraries-data-2/src/main/java/com/baeldung/jmapper/UserDto1.java b/libraries-data/src/main/java/com/baeldung/jmapper/UserDto1.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/jmapper/UserDto1.java rename to libraries-data/src/main/java/com/baeldung/jmapper/UserDto1.java diff --git a/libraries-data-2/src/main/java/com/baeldung/jmapper/relational/User.java b/libraries-data/src/main/java/com/baeldung/jmapper/relational/User.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/jmapper/relational/User.java rename to libraries-data/src/main/java/com/baeldung/jmapper/relational/User.java diff --git a/libraries-data-2/src/main/java/com/baeldung/jmapper/relational/UserDto1.java b/libraries-data/src/main/java/com/baeldung/jmapper/relational/UserDto1.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/jmapper/relational/UserDto1.java rename to libraries-data/src/main/java/com/baeldung/jmapper/relational/UserDto1.java diff --git a/libraries-data-2/src/main/java/com/baeldung/jmapper/relational/UserDto2.java b/libraries-data/src/main/java/com/baeldung/jmapper/relational/UserDto2.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/jmapper/relational/UserDto2.java rename to libraries-data/src/main/java/com/baeldung/jmapper/relational/UserDto2.java diff --git a/libraries-data-2/src/test/java/com/baeldung/jmapper/JMapperIntegrationTest.java b/libraries-data/src/test/java/com/baeldung/jmapper/JMapperIntegrationTest.java similarity index 95% rename from libraries-data-2/src/test/java/com/baeldung/jmapper/JMapperIntegrationTest.java rename to libraries-data/src/test/java/com/baeldung/jmapper/JMapperIntegrationTest.java index 177ef08d41..0b7a7c95f4 100644 --- a/libraries-data-2/src/test/java/com/baeldung/jmapper/JMapperIntegrationTest.java +++ b/libraries-data/src/test/java/com/baeldung/jmapper/JMapperIntegrationTest.java @@ -7,6 +7,9 @@ import org.junit.Test; import java.time.LocalDate; import static com.googlecode.jmapper.api.JMapperAPI.*; +import static com.googlecode.jmapper.api.JMapperAPI.attribute; +import static com.googlecode.jmapper.api.JMapperAPI.global; +import static com.googlecode.jmapper.api.JMapperAPI.mappedClass; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/libraries-data-2/src/test/java/com/baeldung/jmapper/JMapperRelationalIntegrationTest.java b/libraries-data/src/test/java/com/baeldung/jmapper/JMapperRelationalIntegrationTest.java similarity index 97% rename from libraries-data-2/src/test/java/com/baeldung/jmapper/JMapperRelationalIntegrationTest.java rename to libraries-data/src/test/java/com/baeldung/jmapper/JMapperRelationalIntegrationTest.java index a44d608a0a..7a497c4a83 100644 --- a/libraries-data-2/src/test/java/com/baeldung/jmapper/JMapperRelationalIntegrationTest.java +++ b/libraries-data/src/test/java/com/baeldung/jmapper/JMapperRelationalIntegrationTest.java @@ -55,8 +55,8 @@ public class JMapperRelationalIntegrationTest { public void givenUser_whenUseApi_thenConverted(){ JMapperAPI jmapperApi = new JMapperAPI() .add(mappedClass(User.class) - .add(attribute("id").value("id").targetClasses(UserDto1.class,UserDto2.class)) - .add(attribute("email").targetAttributes("username","email").targetClasses(UserDto1.class,UserDto2.class)) ) + .add(attribute("id").value("id").targetClasses(UserDto1.class, UserDto2.class)) + .add(attribute("email").targetAttributes("username","email").targetClasses(UserDto1.class, UserDto2.class)) ) ; RelationalJMapper relationalMapper = new RelationalJMapper<>(User.class,jmapperApi); diff --git a/libraries-data-2/src/test/resources/user_jmapper.xml b/libraries-data/src/test/resources/user_jmapper.xml similarity index 100% rename from libraries-data-2/src/test/resources/user_jmapper.xml rename to libraries-data/src/test/resources/user_jmapper.xml diff --git a/libraries-data-2/src/test/resources/user_jmapper1.xml b/libraries-data/src/test/resources/user_jmapper1.xml similarity index 100% rename from libraries-data-2/src/test/resources/user_jmapper1.xml rename to libraries-data/src/test/resources/user_jmapper1.xml diff --git a/libraries-data-2/src/test/resources/user_jmapper2.xml b/libraries-data/src/test/resources/user_jmapper2.xml similarity index 100% rename from libraries-data-2/src/test/resources/user_jmapper2.xml rename to libraries-data/src/test/resources/user_jmapper2.xml From dc06936a5d22cbb5a09ac5488af58d30b1c90ad3 Mon Sep 17 00:00:00 2001 From: SauDev Date: Fri, 17 Jul 2020 11:43:25 +0530 Subject: [PATCH 0122/1862] BAEL-4135 - When are static variables initialized? (#9607) * Hexagonal Architecture in Java A quick and practical example of Hexagonal Architecture in Java * Fixed code formatting issues * When are static variables initialized Sample class and test class. * Revert "When are static variables initialized" This reverts commit c781923093ccc88bc269bea276653169065cb17b. * Revert "Revert "When are static variables initialized"" This reverts commit 2bffdf401d4e7dc2cefd7eb16357b2d51271edad. * New java module for static variable Created a new core-java-lang-3 module for static variables. * PR review changes: Added more scenarios to the static variable test Covered the following cases: 1. Variable initialization in a static block 2. Variable initialization in a static nested class --- core-java-modules/core-java-lang-3/pom.xml | 2 +- .../staticvariables/StaticVariableDemo.java | 23 ++++ .../StaticVariableUnitTest.java | 113 ++++++++++++++++++ patterns/hexagonal-architecture/pom.xml | 59 +++++++++ .../hexagonal/HexArchApplicationDemo.java | 13 ++ .../pattern/hexagonal/config/AppConfig.java | 15 +++ .../pattern/hexagonal/config/MongoConfig.java | 10 ++ .../controller/EmployeeController.java | 25 ++++ .../hexagonal/domain/model/Employee.java | 51 ++++++++ .../domain/services/EmployeeService.java | 10 ++ .../domain/services/EmployeeServiceImpl.java | 34 ++++++ .../persistence/EmployeeRepository.java | 15 +++ .../persistence/MongoDBRepository.java | 24 ++++ .../hexagonal/persistence/MongoRepoEx.java | 9 ++ .../src/main/resources/application.properties | 1 + .../services/EmployeeServiceImplTest.java | 46 +++++++ 16 files changed, 449 insertions(+), 1 deletion(-) create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/staticvariables/StaticVariableDemo.java create mode 100644 core-java-modules/core-java-lang-3/src/test/java/com/baeldung/staticvariables/StaticVariableUnitTest.java create mode 100644 patterns/hexagonal-architecture/pom.xml create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/HexArchApplicationDemo.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/config/AppConfig.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/config/MongoConfig.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/controller/EmployeeController.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/model/Employee.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeService.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImpl.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/EmployeeRepository.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/MongoDBRepository.java create mode 100644 patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/MongoRepoEx.java create mode 100644 patterns/hexagonal-architecture/src/main/resources/application.properties create mode 100644 patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplTest.java diff --git a/core-java-modules/core-java-lang-3/pom.xml b/core-java-modules/core-java-lang-3/pom.xml index 2a2856a80a..de290717b1 100644 --- a/core-java-modules/core-java-lang-3/pom.xml +++ b/core-java-modules/core-java-lang-3/pom.xml @@ -39,4 +39,4 @@ 3.12.2 - + \ No newline at end of file diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/staticvariables/StaticVariableDemo.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/staticvariables/StaticVariableDemo.java new file mode 100644 index 0000000000..917e9b0953 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/staticvariables/StaticVariableDemo.java @@ -0,0 +1,23 @@ +package com.baeldung.staticvariables; + +public class StaticVariableDemo { + public static int i; + public static int j = 20; + public static int z; + + static { + z = 30; + a = 40; + } + + public static int a = 50; + + public static final int b = 100; + + public StaticVariableDemo() { + } + + static class Nested { + public static String nestedClassStaticVariable = "test"; + } +} diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/staticvariables/StaticVariableUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/staticvariables/StaticVariableUnitTest.java new file mode 100644 index 0000000000..06711a888b --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/staticvariables/StaticVariableUnitTest.java @@ -0,0 +1,113 @@ +package com.baeldung.staticvariables; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.lang.reflect.Field; + +import org.junit.jupiter.api.Test; + +public class StaticVariableUnitTest { + + @Test + public void initializeStaticVariable_checkAssignedValues() { + + try { + Class staticVariableDemo = this.getClass() + .getClassLoader() + .loadClass("com.baeldung.staticvariables.StaticVariableDemo"); + + Field field1 = staticVariableDemo.getField("i"); + + assertThat(field1.getInt(staticVariableDemo)).isEqualTo(0); + + Field field2 = staticVariableDemo.getField("j"); + + assertThat(field2.getInt(staticVariableDemo)).isEqualTo(20); + + } catch (ClassNotFoundException | NoSuchFieldException | SecurityException e) { + e.printStackTrace(); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + } + + @Test + public void initializeStaticVariable_checkStaticBlock() { + + try { + Class staticVariableDemo = this.getClass() + .getClassLoader() + .loadClass("com.baeldung.staticvariables.StaticVariableDemo"); + + Field field1 = staticVariableDemo.getField("z"); + + assertThat(field1.getInt(staticVariableDemo)).isEqualTo(30); + + Field field2 = staticVariableDemo.getField("a"); + + assertThat(field2.getInt(staticVariableDemo)).isEqualTo(50); + + } catch (ClassNotFoundException | NoSuchFieldException | SecurityException e) { + e.printStackTrace(); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + } + + @Test + public void initializeStaticVariable_checkFinalValues() { + + try { + Class staticVariableDemo = this.getClass() + .getClassLoader() + .loadClass("com.baeldung.staticvariables.StaticVariableDemo"); + + Field field1 = staticVariableDemo.getField("b"); + + assertThat(field1.getInt(staticVariableDemo)).isEqualTo(100); + + } catch (ClassNotFoundException | NoSuchFieldException | SecurityException e) { + e.printStackTrace(); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + } + + @Test + public void initializeStaticVariable_checkInnerClassValues() { + + try { + Class staticVariableDemo = this.getClass() + .getClassLoader() + .loadClass("com.baeldung.staticvariables.StaticVariableDemo"); + + Class[] nestedClasses = staticVariableDemo.getClasses(); + + for (Class nestedClass : nestedClasses) { + if (nestedClass.getName() + .equals("Nested")) { + + Field field1 = nestedClass.getField("nestedClassStaticVariable"); + assertThat(field1.get(nestedClass)).isEqualTo("test"); + } + } + + } catch (ClassNotFoundException | NoSuchFieldException | SecurityException e) { + e.printStackTrace(); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + + } +} diff --git a/patterns/hexagonal-architecture/pom.xml b/patterns/hexagonal-architecture/pom.xml new file mode 100644 index 0000000000..9317a25e56 --- /dev/null +++ b/patterns/hexagonal-architecture/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.0.RELEASE + + + com.baeldung + hexagonal-architecture + 1.0 + hexagonal-architecture + Project for hexagonal architecture in java + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.mockito + mockito-core + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/HexArchApplicationDemo.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/HexArchApplicationDemo.java new file mode 100644 index 0000000000..52aaefaaf7 --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/HexArchApplicationDemo.java @@ -0,0 +1,13 @@ +package com.baeldung.pattern.hexagonal; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HexArchApplicationDemo { + + public static void main(String[] args) { + SpringApplication.run(HexArchApplicationDemo.class, args); + } + +} diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/config/AppConfig.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/config/AppConfig.java new file mode 100644 index 0000000000..ee8a01d0e2 --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/config/AppConfig.java @@ -0,0 +1,15 @@ +package com.baeldung.pattern.hexagonal.config; + +import com.baeldung.pattern.hexagonal.domain.services.EmployeeService; +import com.baeldung.pattern.hexagonal.domain.services.EmployeeServiceImpl; +import com.baeldung.pattern.hexagonal.persistence.EmployeeRepository; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class AppConfig { + @Bean + public EmployeeService getEmployeeService(EmployeeRepository employeeRepository) { + return new EmployeeServiceImpl(employeeRepository); + } +} diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/config/MongoConfig.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/config/MongoConfig.java new file mode 100644 index 0000000000..fa6980824a --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/config/MongoConfig.java @@ -0,0 +1,10 @@ +package com.baeldung.pattern.hexagonal.config; + +import com.baeldung.pattern.hexagonal.persistence.MongoRepoEx; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; + +@Configuration +@EnableMongoRepositories(basePackageClasses = MongoRepoEx.class) +public class MongoConfig { +} diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/controller/EmployeeController.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/controller/EmployeeController.java new file mode 100644 index 0000000000..077fc6fdea --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/controller/EmployeeController.java @@ -0,0 +1,25 @@ +package com.baeldung.pattern.hexagonal.controller; + +import com.baeldung.pattern.hexagonal.domain.model.Employee; +import com.baeldung.pattern.hexagonal.domain.services.EmployeeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/employees") +public class EmployeeController { + @Autowired + EmployeeService employeeService; + + @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public Employee addEmployee(@RequestBody Employee employee) { + return employeeService.addEmployee(employee); + } + + @GetMapping(path = "/{employeeId}") + public Employee getEmployee(@PathVariable("employeeId") String employeeId) { + return employeeService.getEmployee(employeeId); + } +} diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/model/Employee.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/model/Employee.java new file mode 100644 index 0000000000..de1f15cf53 --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/model/Employee.java @@ -0,0 +1,51 @@ +package com.baeldung.pattern.hexagonal.domain.model; + +import org.springframework.data.annotation.Id; + +import java.util.Objects; + +public class Employee { + @Id + private String empId; + private String empName; + private String empJobTitle; + + public String getEmpId() { + return empId; + } + + public void setEmpId(String empId) { + this.empId = empId; + } + + public String getEmpName() { + return empName; + } + + public void setEmpName(String empName) { + this.empName = empName; + } + + public String getEmpJobTitle() { + return empJobTitle; + } + + public void setEmpJobTitle(String empJobTitle) { + this.empJobTitle = empJobTitle; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Employee employee = (Employee) o; + return empId.equals(employee.empId); + } + + @Override + public int hashCode() { + return Objects.hash(empId); + } +} \ No newline at end of file diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeService.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeService.java new file mode 100644 index 0000000000..902abefabb --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeService.java @@ -0,0 +1,10 @@ +package com.baeldung.pattern.hexagonal.domain.services; + +import com.baeldung.pattern.hexagonal.domain.model.Employee; + +public interface EmployeeService { + + Employee addEmployee(Employee employee); + + Employee getEmployee(String employeeId); +} diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImpl.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImpl.java new file mode 100644 index 0000000000..cd7c30ff30 --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImpl.java @@ -0,0 +1,34 @@ +package com.baeldung.pattern.hexagonal.domain.services; + +import com.baeldung.pattern.hexagonal.domain.model.Employee; +import com.baeldung.pattern.hexagonal.persistence.EmployeeRepository; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Optional; + +public class EmployeeServiceImpl implements EmployeeService { + + private EmployeeRepository employeeRepository; + + @Autowired + public EmployeeServiceImpl(EmployeeRepository employeeRepository) { + this.employeeRepository = employeeRepository; + } + + @Override + public Employee addEmployee(Employee employee) { + return employeeRepository.add(employee); + } + + @Override + public Employee getEmployee(String employeeId) { + Optional employee = employeeRepository.findById(employeeId); + + if (employee.isPresent()) { + return employee.get(); + } else { + // throw + } + return null; + } +} diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/EmployeeRepository.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/EmployeeRepository.java new file mode 100644 index 0000000000..53b4b6d276 --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/EmployeeRepository.java @@ -0,0 +1,15 @@ +package com.baeldung.pattern.hexagonal.persistence; + +import com.baeldung.pattern.hexagonal.domain.model.Employee; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface EmployeeRepository { + + Employee add(Employee employee); + + Optional findById(String id); + +} diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/MongoDBRepository.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/MongoDBRepository.java new file mode 100644 index 0000000000..08f0c96ab0 --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/MongoDBRepository.java @@ -0,0 +1,24 @@ +package com.baeldung.pattern.hexagonal.persistence; + +import com.baeldung.pattern.hexagonal.domain.model.Employee; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public class MongoDBRepository implements EmployeeRepository { + + @Autowired + MongoRepoEx mongoRepository; + + @Override + public Employee add(Employee employee) { + return mongoRepository.insert(employee); + } + + @Override + public Optional findById(String id) { + return mongoRepository.findById(id); + } +} diff --git a/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/MongoRepoEx.java b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/MongoRepoEx.java new file mode 100644 index 0000000000..766444c22f --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/java/com/baeldung/pattern/hexagonal/persistence/MongoRepoEx.java @@ -0,0 +1,9 @@ +package com.baeldung.pattern.hexagonal.persistence; + +import com.baeldung.pattern.hexagonal.domain.model.Employee; +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface MongoRepoEx extends MongoRepository { +} diff --git a/patterns/hexagonal-architecture/src/main/resources/application.properties b/patterns/hexagonal-architecture/src/main/resources/application.properties new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/patterns/hexagonal-architecture/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplTest.java b/patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplTest.java new file mode 100644 index 0000000000..cadb3b094b --- /dev/null +++ b/patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplTest.java @@ -0,0 +1,46 @@ +package com.baeldung.pattern.hexagonal.domain.services; + +import com.baeldung.pattern.hexagonal.domain.model.Employee; +import com.baeldung.pattern.hexagonal.persistence.EmployeeRepository; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +class EmployeeServiceImplTest { + + private EmployeeRepository employeeRepository; + private EmployeeService testService; + private Employee testModel; + + @BeforeEach + void setUp() { + employeeRepository = mock(EmployeeRepository.class); + + testService = new EmployeeServiceImpl(employeeRepository); + testModel = new Employee(); + testModel.setEmpId("2000"); + testModel.setEmpName("Test user 1"); + testModel.setEmpJobTitle("Software engineer"); + } + + @Test + void addEmployee() { + when(employeeRepository.add(any(Employee.class))).thenReturn(testModel); + + Employee testResponse = testService.addEmployee(testModel); + assertEquals(testModel, testResponse); + } + + @Test + void getEmployee() { + when(employeeRepository.findById("2000")).thenReturn(Optional.of(testModel)); + + Employee testResponse = testService.getEmployee("2000"); + assertEquals(testModel, testResponse); + } +} \ No newline at end of file From 176fc37a4479fe5d7d85bc761b362faaf241378e Mon Sep 17 00:00:00 2001 From: Loredana Date: Fri, 17 Jul 2020 09:33:34 +0300 Subject: [PATCH 0123/1862] JAVA-2096 remove unused dependencies --- core-java-modules/core-java-io-3/pom.xml | 27 ------------------------ 1 file changed, 27 deletions(-) diff --git a/core-java-modules/core-java-io-3/pom.xml b/core-java-modules/core-java-io-3/pom.xml index cb341ca2ae..cc4dca5fa5 100644 --- a/core-java-modules/core-java-io-3/pom.xml +++ b/core-java-modules/core-java-io-3/pom.xml @@ -46,41 +46,14 @@ ${assertj.version} test - - - com.github.tomakehurst - wiremock - ${wiremock.version} - test - - core-java-io-3 - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - ${maven.compiler.source} - ${maven.compiler.target} - - - 3.6.1 - 3.0.0-M1 - 2.26.3 \ No newline at end of file From 3802825c6117bb4aa1a76f3ff31b3add9db5fc6b Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:57:33 +0530 Subject: [PATCH 0124/1862] Delete pom.xml --- bookstore/pom.xml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 bookstore/pom.xml diff --git a/bookstore/pom.xml b/bookstore/pom.xml deleted file mode 100644 index 68286076e5..0000000000 --- a/bookstore/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - com.hexagonal - bookstore - 0.0.1-SNAPSHOT - - - 1.8 - - - - org.springframework.boot - spring-boot-starter-parent - 2.3.1.RELEASE - - - - - org.springframework.boot - spring-boot-starter-web - - - \ No newline at end of file From d578a7585ef77aa6598d18a0902a9d539360cf4f Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:57:50 +0530 Subject: [PATCH 0125/1862] Delete MainApp.java --- bookstore/src/main/java/com/hexagonal/MainApp.java | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 bookstore/src/main/java/com/hexagonal/MainApp.java diff --git a/bookstore/src/main/java/com/hexagonal/MainApp.java b/bookstore/src/main/java/com/hexagonal/MainApp.java deleted file mode 100644 index 0d6ef861b3..0000000000 --- a/bookstore/src/main/java/com/hexagonal/MainApp.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hexagonal; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; - -@SpringBootApplication -public class MainApp { - public static void main(String[] args) { - SpringApplication.run(MainApp.class, args); - } - -} \ No newline at end of file From de2955f4b39edd9a2ef80ca0bcdb5aabcef1a172 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:58:07 +0530 Subject: [PATCH 0126/1862] Delete BookController.java --- .../hexagonal/controller/BookController.java | 37 ------------------- 1 file changed, 37 deletions(-) delete mode 100644 bookstore/src/main/java/com/hexagonal/controller/BookController.java diff --git a/bookstore/src/main/java/com/hexagonal/controller/BookController.java b/bookstore/src/main/java/com/hexagonal/controller/BookController.java deleted file mode 100644 index 7e525deaa1..0000000000 --- a/bookstore/src/main/java/com/hexagonal/controller/BookController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.hexagonal.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.hexagonal.domain.Book; -import com.hexagonal.service.BookService; - -@RestController -public class BookController { - - @Autowired - private BookService bookService; - - @RequestMapping("/book/add") - @PostMapping(produces = { MediaType.TEXT_PLAIN_VALUE }) - public void addBook(@RequestBody Book book) { - bookService.addBook(book); - } - - public Book buyBook(@PathVariable String isbn) { - return bookService.buyBook(isbn); - } - - public List listBooks() { - return bookService.listBooks(); - } - -} From d7a9fe81f9457a849cca901e4fba5d56c516213b Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:58:24 +0530 Subject: [PATCH 0127/1862] Delete Book.java --- .../main/java/com/hexagonal/domain/Book.java | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 bookstore/src/main/java/com/hexagonal/domain/Book.java diff --git a/bookstore/src/main/java/com/hexagonal/domain/Book.java b/bookstore/src/main/java/com/hexagonal/domain/Book.java deleted file mode 100644 index 84125391cc..0000000000 --- a/bookstore/src/main/java/com/hexagonal/domain/Book.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.hexagonal.domain; - -public class Book { - - private String name; - private String isbn; - private String author; - - @Override - public String toString() { - return "Book [name=" + name + ", ISBN=" + isbn + ", author=" + author + "]"; - } - - public String getIsbn() { - return isbn; - } - - public void setIsbn(String isbn) { - this.isbn = isbn; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - -} From fc717bb9f173d3f5e82fcef9c5ddde8e6fe1971a Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:58:40 +0530 Subject: [PATCH 0128/1862] Delete BookRepository.java --- .../com/hexagonal/repository/BookRepository.java | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 bookstore/src/main/java/com/hexagonal/repository/BookRepository.java diff --git a/bookstore/src/main/java/com/hexagonal/repository/BookRepository.java b/bookstore/src/main/java/com/hexagonal/repository/BookRepository.java deleted file mode 100644 index 1e64a2d21b..0000000000 --- a/bookstore/src/main/java/com/hexagonal/repository/BookRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hexagonal.repository; - -import java.util.List; - -import com.hexagonal.domain.Book; - -public interface BookRepository { - - public void add(Book book); - - public Book buy(String isbn); - - public List list(); - -} From d600c40573a71db98d0c5a399201df0ec65f35b5 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:58:51 +0530 Subject: [PATCH 0129/1862] Delete BookRepositoryImpl.java --- .../repository/BookRepositoryImpl.java | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 bookstore/src/main/java/com/hexagonal/repository/BookRepositoryImpl.java diff --git a/bookstore/src/main/java/com/hexagonal/repository/BookRepositoryImpl.java b/bookstore/src/main/java/com/hexagonal/repository/BookRepositoryImpl.java deleted file mode 100644 index f4f99583dd..0000000000 --- a/bookstore/src/main/java/com/hexagonal/repository/BookRepositoryImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hexagonal.repository; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.springframework.stereotype.Repository; - -import com.hexagonal.domain.Book; - -@Repository -public class BookRepositoryImpl implements BookRepository { - - private Map bookMap = new HashMap<>(); - - @Override - public void add(Book book) { - bookMap.put(book.getIsbn(), book); - System.out.println("Book Added " + book); - } - - @Override - public Book buy(String isbn) { - return bookMap.get(isbn); - } - - @Override - public List list() { - return bookMap.values() - .stream() - .collect(Collectors.toList()); - } - -} From c7b9e81e15ad40ebc5fbfa803d3b2e0e5574de9c Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:59:07 +0530 Subject: [PATCH 0130/1862] Delete BookService.java --- .../java/com/hexagonal/service/BookService.java | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 bookstore/src/main/java/com/hexagonal/service/BookService.java diff --git a/bookstore/src/main/java/com/hexagonal/service/BookService.java b/bookstore/src/main/java/com/hexagonal/service/BookService.java deleted file mode 100644 index cb5e1a930e..0000000000 --- a/bookstore/src/main/java/com/hexagonal/service/BookService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hexagonal.service; - -import java.util.List; - -import com.hexagonal.domain.Book; - -public interface BookService { - - public void addBook(Book book); - - public Book buyBook(String isbn); - - public List listBooks(); - -} From 8cdfb5b0efcd3789807a82d3ff793e341ff6081f Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 12:59:18 +0530 Subject: [PATCH 0131/1862] Delete BookServiceImpl.java --- .../hexagonal/service/BookServiceImpl.java | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 bookstore/src/main/java/com/hexagonal/service/BookServiceImpl.java diff --git a/bookstore/src/main/java/com/hexagonal/service/BookServiceImpl.java b/bookstore/src/main/java/com/hexagonal/service/BookServiceImpl.java deleted file mode 100644 index c7e660ea36..0000000000 --- a/bookstore/src/main/java/com/hexagonal/service/BookServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hexagonal.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.hexagonal.domain.Book; -import com.hexagonal.repository.BookRepository; - -@Service -public class BookServiceImpl implements BookService { - - @Autowired - private BookRepository bookRepository; - - @Override - public void addBook(Book book) { - bookRepository.add(book); - - } - - @Override - public Book buyBook(String isbn) { - - return bookRepository.buy(isbn); - } - - @Override - public List listBooks() { - - return bookRepository.list(); - } - -} From 52ff90ee1aebf36b2058d60e1b516f50993a7226 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 13:00:40 +0530 Subject: [PATCH 0132/1862] Update pom.xml --- spring-session/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-session/pom.xml b/spring-session/pom.xml index 8388efb6c3..d5dbe28a2b 100644 --- a/spring-session/pom.xml +++ b/spring-session/pom.xml @@ -19,6 +19,7 @@ spring-session-jdbc spring-session-redis spring-session-mongodb + http-session-example - \ No newline at end of file + From 65b6b29ea1e52c666ef764449e1baa0b4d96022d Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 13:01:48 +0530 Subject: [PATCH 0133/1862] Update README.md --- spring-session/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-session/README.md b/spring-session/README.md index 05343f67c2..47125a6032 100644 --- a/spring-session/README.md +++ b/spring-session/README.md @@ -6,4 +6,4 @@ This module contains articles about Spring Session - [Guide to Spring Session](https://www.baeldung.com/spring-session) - [Spring Session with JDBC](https://www.baeldung.com/spring-session-jdbc) - [Spring Session with MongoDB](https://www.baeldung.com/spring-session-mongodb) -- [Difference Between request.getSession() and request.getSession(true)](http://inprogress.baeldung.com/?p=215685&preview=true) +- Difference Between request.getSession() and request.getSession(true) From 6d59756a7d0b2809640dc350fa334ce58986eda9 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 13:02:41 +0530 Subject: [PATCH 0134/1862] Update web.xml --- .../http-session-example/WebContent/WEB-INF/web.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/spring-session/http-session-example/WebContent/WEB-INF/web.xml b/spring-session/http-session-example/WebContent/WEB-INF/web.xml index 6f88776c72..01b1b6f308 100644 --- a/spring-session/http-session-example/WebContent/WEB-INF/web.xml +++ b/spring-session/http-session-example/WebContent/WEB-INF/web.xml @@ -3,11 +3,6 @@ httpsessionexample index.html - index.htm - index.jsp - default.html - default.htm - default.jsp @@ -31,4 +26,4 @@ - \ No newline at end of file + From a8fc50e9b23c9bae382789f82bceea2208b9220c Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Fri, 17 Jul 2020 13:03:14 +0530 Subject: [PATCH 0135/1862] Delete MANIFEST.MF --- .../http-session-example/WebContent/META-INF/MANIFEST.MF | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 spring-session/http-session-example/WebContent/META-INF/MANIFEST.MF diff --git a/spring-session/http-session-example/WebContent/META-INF/MANIFEST.MF b/spring-session/http-session-example/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128c..0000000000 --- a/spring-session/http-session-example/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - From be1f906a9a9217a7eecf612c849eac4a851db135 Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Fri, 17 Jul 2020 10:54:38 +0200 Subject: [PATCH 0136/1862] [BAEL4288] initial commit --- persistence-modules/flyway-repair/README.MD | 3 + .../flyway-repair/docker-compose/.env | 2 + .../docker-compose/docker-compose.yaml | 23 ++++ .../flyway-repair/docker-compose/mysql.env | 5 + .../flyway-repair/docker-compose/postgres.env | 3 + persistence-modules/flyway-repair/pom.xml | 105 ++++++++++++++++++ .../flywaycallbacks/FlywayApplication.java | 13 +++ .../application-callbacks.properties | 1 + .../main/resources/application-h2.properties | 3 + .../resources/application-mysql.properties | 3 + .../resources/application-postgres.properties | 3 + .../src/main/resources/application.properties | 6 + .../db/callbacks/afterMigrateError.sql | 1 + .../db/migration/V1_0__add_table_one.sql | 3 + .../db/migration/V1_1__add_table_two.sql | 3 + .../db/migration/V1_2__add_table_three.sql | 3 + .../db/migration/V1_3__add_table.sql | 3 + .../src/main/resources/logback.xml | 19 ++++ 18 files changed, 202 insertions(+) create mode 100644 persistence-modules/flyway-repair/README.MD create mode 100644 persistence-modules/flyway-repair/docker-compose/.env create mode 100644 persistence-modules/flyway-repair/docker-compose/docker-compose.yaml create mode 100644 persistence-modules/flyway-repair/docker-compose/mysql.env create mode 100644 persistence-modules/flyway-repair/docker-compose/postgres.env create mode 100644 persistence-modules/flyway-repair/pom.xml create mode 100644 persistence-modules/flyway-repair/src/main/java/com/baeldung/flywaycallbacks/FlywayApplication.java create mode 100644 persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties create mode 100644 persistence-modules/flyway-repair/src/main/resources/application-h2.properties create mode 100644 persistence-modules/flyway-repair/src/main/resources/application-mysql.properties create mode 100644 persistence-modules/flyway-repair/src/main/resources/application-postgres.properties create mode 100644 persistence-modules/flyway-repair/src/main/resources/application.properties create mode 100644 persistence-modules/flyway-repair/src/main/resources/db/callbacks/afterMigrateError.sql create mode 100644 persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table_one.sql create mode 100644 persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table_two.sql create mode 100644 persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table_three.sql create mode 100644 persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql create mode 100644 persistence-modules/flyway-repair/src/main/resources/logback.xml diff --git a/persistence-modules/flyway-repair/README.MD b/persistence-modules/flyway-repair/README.MD new file mode 100644 index 0000000000..daeb9012b5 --- /dev/null +++ b/persistence-modules/flyway-repair/README.MD @@ -0,0 +1,3 @@ +### Relevant Articles: +- [Database Migrations with Flyway](http://www.baeldung.com/database-migrations-with-flyway) +- [A Guide to Flyway Callbacks](http://www.baeldung.com/flyway-callbacks) diff --git a/persistence-modules/flyway-repair/docker-compose/.env b/persistence-modules/flyway-repair/docker-compose/.env new file mode 100644 index 0000000000..52bd0d6510 --- /dev/null +++ b/persistence-modules/flyway-repair/docker-compose/.env @@ -0,0 +1,2 @@ +MYSQL_PORT=3316 +POSTGRES_PORT=5431 \ No newline at end of file diff --git a/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml b/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml new file mode 100644 index 0000000000..23270c043d --- /dev/null +++ b/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml @@ -0,0 +1,23 @@ +version: '3.0' + +services: + mysql-test: + image: mysql:8.0.17 + ports: + - ${MYSQL_PORT}:3306 + env_file: + - mysql.env + networks: + - baeldung + + postgres-test: + image: postgres:11.5 + ports: + - ${POSTGRES_PORT}:5432 + env_file: postgres.env + networks: + - baeldung + +networks: + baeldung: + driver: bridge \ No newline at end of file diff --git a/persistence-modules/flyway-repair/docker-compose/mysql.env b/persistence-modules/flyway-repair/docker-compose/mysql.env new file mode 100644 index 0000000000..597344d88c --- /dev/null +++ b/persistence-modules/flyway-repair/docker-compose/mysql.env @@ -0,0 +1,5 @@ +MYSQL_ROOT_PASSWORD=password +MYSQL_RANDOM_ROOT_PASSWORD=yes +MYSQL_USER=testuser +MYSQL_PASSWORD=password +MYSQL_DATABASE=testdb \ No newline at end of file diff --git a/persistence-modules/flyway-repair/docker-compose/postgres.env b/persistence-modules/flyway-repair/docker-compose/postgres.env new file mode 100644 index 0000000000..1e7373fdf0 --- /dev/null +++ b/persistence-modules/flyway-repair/docker-compose/postgres.env @@ -0,0 +1,3 @@ +POSTGRES_USER=testuser +POSTGRES_PASSWORD=password +POSTGRES_DB=testdb diff --git a/persistence-modules/flyway-repair/pom.xml b/persistence-modules/flyway-repair/pom.xml new file mode 100644 index 0000000000..f9d62d5dad --- /dev/null +++ b/persistence-modules/flyway-repair/pom.xml @@ -0,0 +1,105 @@ + + + 4.0.0 + flyway + flyway-repair + jar + Flyway Repair Demo + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.flywaydb + flyway-core + ${flyway-core.version} + + + org.springframework.boot + spring-boot-starter-jdbc + + + + + + + org.flywaydb + flyway-maven-plugin + ${flyway-maven-plugin.version} + + + org.springframework.boot + spring-boot-maven-plugin + + + + + true + src/main/resources + + *.properties + db/**/*.sql + + + + + + + 6.5.0 + 6.5.0 + src/main/resources/application-${db.engine}.properties + + + + + + h2 + + h2 + + + + com.h2database + h2 + runtime + + + + + + mysql + + mysql + + + + mysql + mysql-connector-java + runtime + + + + + + postgres + + postgres + + + + org.postgresql + postgresql + runtime + + + + + + + diff --git a/persistence-modules/flyway-repair/src/main/java/com/baeldung/flywaycallbacks/FlywayApplication.java b/persistence-modules/flyway-repair/src/main/java/com/baeldung/flywaycallbacks/FlywayApplication.java new file mode 100644 index 0000000000..34d794f7d1 --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/java/com/baeldung/flywaycallbacks/FlywayApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.flywaycallbacks; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class FlywayApplication { + + public static void main(String[] args) { + SpringApplication.run(FlywayApplication.class, args); + } + +} diff --git a/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties b/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties new file mode 100644 index 0000000000..2c10fc711f --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties @@ -0,0 +1 @@ +flyway.locations=db/migration,db/callbacks \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/application-h2.properties b/persistence-modules/flyway-repair/src/main/resources/application-h2.properties new file mode 100644 index 0000000000..15bd482adf --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/application-h2.properties @@ -0,0 +1,3 @@ +flyway.url=jdbc:h2:file:./testdb;DB_CLOSE_ON_EXIT=FALSE;AUTO_RECONNECT=TRUE;MODE=MySQL;DATABASE_TO_UPPER=false; +flyway.user=testuser +flyway.password=password \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/application-mysql.properties b/persistence-modules/flyway-repair/src/main/resources/application-mysql.properties new file mode 100644 index 0000000000..341f978068 --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/application-mysql.properties @@ -0,0 +1,3 @@ +flyway.url=jdbc:mysql://127.0.0.1:3316/testdb +flyway.user=testuser +flyway.password=password \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/application-postgres.properties b/persistence-modules/flyway-repair/src/main/resources/application-postgres.properties new file mode 100644 index 0000000000..5afaca96b5 --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/application-postgres.properties @@ -0,0 +1,3 @@ +flyway.url=jdbc:postgresql://127.0.0.1:5431/testdb +flyway.user=testuser +flyway.password=password \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/application.properties b/persistence-modules/flyway-repair/src/main/resources/application.properties new file mode 100644 index 0000000000..3fae835eb1 --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/application.properties @@ -0,0 +1,6 @@ +spring.profiles.include=@db.engine@ + +spring.datasource.url=${flyway.url} +spring.datasource.username=${flyway.user} +spring.datasource.password=${flyway.password} +spring.flyway.locations=${flyway.locations:db/migration} \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/db/callbacks/afterMigrateError.sql b/persistence-modules/flyway-repair/src/main/resources/db/callbacks/afterMigrateError.sql new file mode 100644 index 0000000000..c975e85056 --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/db/callbacks/afterMigrateError.sql @@ -0,0 +1 @@ +DELETE FROM flyway_schema_history WHERE success=false; \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table_one.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table_one.sql new file mode 100644 index 0000000000..ec434dd5b2 --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table_one.sql @@ -0,0 +1,3 @@ +create table table_one ( + id numeric primary key +); \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table_two.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table_two.sql new file mode 100644 index 0000000000..48720d59d6 --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table_two.sql @@ -0,0 +1,3 @@ +create table table_two ( + id numeric primary key +); \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table_three.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table_three.sql new file mode 100644 index 0000000000..1917c88b9b --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table_three.sql @@ -0,0 +1,3 @@ +create table table_three ( + id numeric primary key +); \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql new file mode 100644 index 0000000000..ec434dd5b2 --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql @@ -0,0 +1,3 @@ +create table table_one ( + id numeric primary key +); \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/logback.xml b/persistence-modules/flyway-repair/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/persistence-modules/flyway-repair/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file From 2923bae61f2704b707f0a8e7b266e0b2c7c99aad Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Fri, 17 Jul 2020 13:12:36 +0200 Subject: [PATCH 0137/1862] JAVA-1634: Get rid of the overriden spring-boot.version property --- spring-cloud/spring-cloud-openfeign/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-cloud/spring-cloud-openfeign/pom.xml b/spring-cloud/spring-cloud-openfeign/pom.xml index df529d7fb1..c1f3f2dc30 100644 --- a/spring-cloud/spring-cloud-openfeign/pom.xml +++ b/spring-cloud/spring-cloud-openfeign/pom.xml @@ -51,8 +51,7 @@ - 2.0.1.RELEASE - Finchley.SR2 + Hoxton.SR6 From 8a98cce3db70202418486de4962e32eaaf5c6ed9 Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Fri, 17 Jul 2020 15:13:57 +0200 Subject: [PATCH 0138/1862] [BAEL4288] remove mysql flow --- .../flyway-repair/docker-compose/.env | 1 - .../docker-compose/docker-compose.yaml | 8 ---- .../flyway-repair/docker-compose/mysql.env | 5 --- persistence-modules/flyway-repair/pom.xml | 43 ++++--------------- .../application-callbacks.properties | 2 +- .../resources/application-mysql.properties | 3 -- .../src/main/resources/application.properties | 3 -- .../afterMigrateError__repair.sql} | 0 ..._add_table_one.sql => V1_0__add_table.sql} | 0 ..._add_table_two.sql => V1_1__add_table.sql} | 0 ...dd_table_three.sql => V1_2__add_table.sql} | 0 .../db/migration/V1_3__add_table.sql | 2 +- 12 files changed, 11 insertions(+), 56 deletions(-) delete mode 100644 persistence-modules/flyway-repair/docker-compose/mysql.env delete mode 100644 persistence-modules/flyway-repair/src/main/resources/application-mysql.properties rename persistence-modules/flyway-repair/src/main/resources/db/{callbacks/afterMigrateError.sql => callback/afterMigrateError__repair.sql} (100%) rename persistence-modules/flyway-repair/src/main/resources/db/migration/{V1_0__add_table_one.sql => V1_0__add_table.sql} (100%) rename persistence-modules/flyway-repair/src/main/resources/db/migration/{V1_1__add_table_two.sql => V1_1__add_table.sql} (100%) rename persistence-modules/flyway-repair/src/main/resources/db/migration/{V1_2__add_table_three.sql => V1_2__add_table.sql} (100%) diff --git a/persistence-modules/flyway-repair/docker-compose/.env b/persistence-modules/flyway-repair/docker-compose/.env index 52bd0d6510..69785c6e5c 100644 --- a/persistence-modules/flyway-repair/docker-compose/.env +++ b/persistence-modules/flyway-repair/docker-compose/.env @@ -1,2 +1 @@ -MYSQL_PORT=3316 POSTGRES_PORT=5431 \ No newline at end of file diff --git a/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml b/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml index 23270c043d..b3502f8775 100644 --- a/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml +++ b/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml @@ -1,14 +1,6 @@ version: '3.0' services: - mysql-test: - image: mysql:8.0.17 - ports: - - ${MYSQL_PORT}:3306 - env_file: - - mysql.env - networks: - - baeldung postgres-test: image: postgres:11.5 diff --git a/persistence-modules/flyway-repair/docker-compose/mysql.env b/persistence-modules/flyway-repair/docker-compose/mysql.env deleted file mode 100644 index 597344d88c..0000000000 --- a/persistence-modules/flyway-repair/docker-compose/mysql.env +++ /dev/null @@ -1,5 +0,0 @@ -MYSQL_ROOT_PASSWORD=password -MYSQL_RANDOM_ROOT_PASSWORD=yes -MYSQL_USER=testuser -MYSQL_PASSWORD=password -MYSQL_DATABASE=testdb \ No newline at end of file diff --git a/persistence-modules/flyway-repair/pom.xml b/persistence-modules/flyway-repair/pom.xml index f9d62d5dad..4d61bd5c0e 100644 --- a/persistence-modules/flyway-repair/pom.xml +++ b/persistence-modules/flyway-repair/pom.xml @@ -18,7 +18,6 @@ org.flywaydb flyway-core - ${flyway-core.version} org.springframework.boot @@ -31,37 +30,23 @@ org.flywaydb flyway-maven-plugin - ${flyway-maven-plugin.version} org.springframework.boot spring-boot-maven-plugin - - - true - src/main/resources - - *.properties - db/**/*.sql - - - - - 6.5.0 - 6.5.0 - src/main/resources/application-${db.engine}.properties - - h2 + + true + - h2 + h2 @@ -72,24 +57,10 @@ - - mysql - - mysql - - - - mysql - mysql-connector-java - runtime - - - - postgres - postgres + postgres @@ -102,4 +73,8 @@ + + src/main/resources/application-${spring-boot.run.profiles}.properties + + diff --git a/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties b/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties index 2c10fc711f..7fb3124764 100644 --- a/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties +++ b/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties @@ -1 +1 @@ -flyway.locations=db/migration,db/callbacks \ No newline at end of file +spring.flyway.locations=classpath:db/migration,classpath:db/callback \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/application-mysql.properties b/persistence-modules/flyway-repair/src/main/resources/application-mysql.properties deleted file mode 100644 index 341f978068..0000000000 --- a/persistence-modules/flyway-repair/src/main/resources/application-mysql.properties +++ /dev/null @@ -1,3 +0,0 @@ -flyway.url=jdbc:mysql://127.0.0.1:3316/testdb -flyway.user=testuser -flyway.password=password \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/application.properties b/persistence-modules/flyway-repair/src/main/resources/application.properties index 3fae835eb1..da666d3cc2 100644 --- a/persistence-modules/flyway-repair/src/main/resources/application.properties +++ b/persistence-modules/flyway-repair/src/main/resources/application.properties @@ -1,6 +1,3 @@ -spring.profiles.include=@db.engine@ - spring.datasource.url=${flyway.url} spring.datasource.username=${flyway.user} spring.datasource.password=${flyway.password} -spring.flyway.locations=${flyway.locations:db/migration} \ No newline at end of file diff --git a/persistence-modules/flyway-repair/src/main/resources/db/callbacks/afterMigrateError.sql b/persistence-modules/flyway-repair/src/main/resources/db/callback/afterMigrateError__repair.sql similarity index 100% rename from persistence-modules/flyway-repair/src/main/resources/db/callbacks/afterMigrateError.sql rename to persistence-modules/flyway-repair/src/main/resources/db/callback/afterMigrateError__repair.sql diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table_one.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table.sql similarity index 100% rename from persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table_one.sql rename to persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table.sql diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table_two.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table.sql similarity index 100% rename from persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table_two.sql rename to persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table.sql diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table_three.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table.sql similarity index 100% rename from persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table_three.sql rename to persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table.sql diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql index ec434dd5b2..cf89d5f308 100644 --- a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql @@ -1,3 +1,3 @@ -create table table_one ( +create table table_four ( id numeric primary key ); \ No newline at end of file From c53f498e12cced788e23abe6f0d373563551aa0e Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Fri, 17 Jul 2020 15:32:41 +0200 Subject: [PATCH 0139/1862] [BAEL4288] small fixes --- persistence-modules/flyway-repair/README.MD | 3 +-- persistence-modules/flyway-repair/docker-compose/.env | 2 +- .../flyway-repair/docker-compose/docker-compose.yaml | 2 +- .../src/main/resources/application-callbacks.properties | 2 +- .../flyway-repair/src/main/resources/application-h2.properties | 2 +- .../src/main/resources/application-postgres.properties | 2 +- .../main/resources/db/callback/afterMigrateError__repair.sql | 2 +- .../src/main/resources/db/migration/V1_0__add_table.sql | 2 +- .../src/main/resources/db/migration/V1_1__add_table.sql | 2 +- .../src/main/resources/db/migration/V1_2__add_table.sql | 2 +- .../src/main/resources/db/migration/V1_3__add_table.sql | 2 +- 11 files changed, 11 insertions(+), 12 deletions(-) diff --git a/persistence-modules/flyway-repair/README.MD b/persistence-modules/flyway-repair/README.MD index daeb9012b5..ca029e8299 100644 --- a/persistence-modules/flyway-repair/README.MD +++ b/persistence-modules/flyway-repair/README.MD @@ -1,3 +1,2 @@ ### Relevant Articles: -- [Database Migrations with Flyway](http://www.baeldung.com/database-migrations-with-flyway) -- [A Guide to Flyway Callbacks](http://www.baeldung.com/flyway-callbacks) +- [Flyway Repair With Spring Boot](http://www.baeldung.com/flyway-repair-with-spring-boot) diff --git a/persistence-modules/flyway-repair/docker-compose/.env b/persistence-modules/flyway-repair/docker-compose/.env index 69785c6e5c..8a9d0e7954 100644 --- a/persistence-modules/flyway-repair/docker-compose/.env +++ b/persistence-modules/flyway-repair/docker-compose/.env @@ -1 +1 @@ -POSTGRES_PORT=5431 \ No newline at end of file +POSTGRES_PORT=5431 diff --git a/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml b/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml index b3502f8775..b32b48d1cf 100644 --- a/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml +++ b/persistence-modules/flyway-repair/docker-compose/docker-compose.yaml @@ -12,4 +12,4 @@ services: networks: baeldung: - driver: bridge \ No newline at end of file + driver: bridge diff --git a/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties b/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties index 7fb3124764..46ad86afee 100644 --- a/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties +++ b/persistence-modules/flyway-repair/src/main/resources/application-callbacks.properties @@ -1 +1 @@ -spring.flyway.locations=classpath:db/migration,classpath:db/callback \ No newline at end of file +spring.flyway.locations=classpath:db/migration,classpath:db/callback diff --git a/persistence-modules/flyway-repair/src/main/resources/application-h2.properties b/persistence-modules/flyway-repair/src/main/resources/application-h2.properties index 15bd482adf..64e485244e 100644 --- a/persistence-modules/flyway-repair/src/main/resources/application-h2.properties +++ b/persistence-modules/flyway-repair/src/main/resources/application-h2.properties @@ -1,3 +1,3 @@ flyway.url=jdbc:h2:file:./testdb;DB_CLOSE_ON_EXIT=FALSE;AUTO_RECONNECT=TRUE;MODE=MySQL;DATABASE_TO_UPPER=false; flyway.user=testuser -flyway.password=password \ No newline at end of file +flyway.password=password diff --git a/persistence-modules/flyway-repair/src/main/resources/application-postgres.properties b/persistence-modules/flyway-repair/src/main/resources/application-postgres.properties index 5afaca96b5..951f8f583d 100644 --- a/persistence-modules/flyway-repair/src/main/resources/application-postgres.properties +++ b/persistence-modules/flyway-repair/src/main/resources/application-postgres.properties @@ -1,3 +1,3 @@ flyway.url=jdbc:postgresql://127.0.0.1:5431/testdb flyway.user=testuser -flyway.password=password \ No newline at end of file +flyway.password=password diff --git a/persistence-modules/flyway-repair/src/main/resources/db/callback/afterMigrateError__repair.sql b/persistence-modules/flyway-repair/src/main/resources/db/callback/afterMigrateError__repair.sql index c975e85056..ee0cbb6cee 100644 --- a/persistence-modules/flyway-repair/src/main/resources/db/callback/afterMigrateError__repair.sql +++ b/persistence-modules/flyway-repair/src/main/resources/db/callback/afterMigrateError__repair.sql @@ -1 +1 @@ -DELETE FROM flyway_schema_history WHERE success=false; \ No newline at end of file +DELETE FROM flyway_schema_history WHERE success=false; diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table.sql index ec434dd5b2..1774e837b7 100644 --- a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table.sql +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_0__add_table.sql @@ -1,3 +1,3 @@ create table table_one ( id numeric primary key -); \ No newline at end of file +); diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table.sql index 48720d59d6..76f2ee7ba1 100644 --- a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table.sql +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_1__add_table.sql @@ -1,3 +1,3 @@ create table table_two ( id numeric primary key -); \ No newline at end of file +); diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table.sql index 1917c88b9b..dd5cf34059 100644 --- a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table.sql +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_2__add_table.sql @@ -1,3 +1,3 @@ create table table_three ( id numeric primary key -); \ No newline at end of file +); diff --git a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql index cf89d5f308..4a126ffe33 100644 --- a/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql +++ b/persistence-modules/flyway-repair/src/main/resources/db/migration/V1_3__add_table.sql @@ -1,3 +1,3 @@ create table table_four ( id numeric primary key -); \ No newline at end of file +); From 9cf9cf91a2454a0a3e20df17ae3d222575e80138 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 17 Jul 2020 17:06:50 +0200 Subject: [PATCH 0140/1862] BAEL-3275: Convert RedisMessageListenerIntegrationTest to a SpringBootTest (#9717) --- .../data/redis/SpringRedisApplication.java | 13 +++++++ .../RedisMessageListenerIntegrationTest.java | 34 ++++++++----------- 2 files changed, 28 insertions(+), 19 deletions(-) create mode 100644 persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/SpringRedisApplication.java diff --git a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/SpringRedisApplication.java b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/SpringRedisApplication.java new file mode 100644 index 0000000000..82c06f803b --- /dev/null +++ b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/SpringRedisApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.spring.data.redis; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringRedisApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringRedisApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/RedisMessageListenerIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/RedisMessageListenerIntegrationTest.java index 6f9e6a8757..6501f3f9f0 100644 --- a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/RedisMessageListenerIntegrationTest.java +++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/spring/data/redis/RedisMessageListenerIntegrationTest.java @@ -1,44 +1,40 @@ package com.baeldung.spring.data.redis; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.UUID; - +import com.baeldung.spring.data.redis.queue.RedisMessagePublisher; +import com.baeldung.spring.data.redis.queue.RedisMessageSubscriber; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.spring.data.redis.config.RedisConfig; -import com.baeldung.spring.data.redis.queue.RedisMessagePublisher; -import com.baeldung.spring.data.redis.queue.RedisMessageSubscriber; - +import org.springframework.test.context.junit4.SpringRunner; import redis.embedded.RedisServerBuilder; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = RedisConfig.class) +import java.util.UUID; + +import static org.junit.Assert.assertTrue; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisApplication.class) @DirtiesContext(classMode = ClassMode.BEFORE_CLASS) public class RedisMessageListenerIntegrationTest { private static redis.embedded.RedisServer redisServer; - + @Autowired private RedisMessagePublisher redisMessagePublisher; - + @BeforeClass - public static void startRedisServer() throws IOException { + public static void startRedisServer() { redisServer = new RedisServerBuilder().port(6379).setting("maxmemory 256M").build(); redisServer.start(); } - + @AfterClass - public static void stopRedisServer() throws IOException { + public static void stopRedisServer() { redisServer.stop(); } From 8d6257111ab9d3ab11aee1a3ebc74e374628afc0 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Sat, 18 Jul 2020 12:54:29 +0200 Subject: [PATCH 0141/1862] Moved to new module --- .../com/baeldung/exceptionhandling/ExceptionHandling.kt | 5 +++++ .../baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt | 5 +++++ 2 files changed, 10 insertions(+) rename core-kotlin-modules/{core-kotlin-lang-2 => core-kotlin}/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt (93%) rename core-kotlin-modules/{core-kotlin-lang-2 => core-kotlin}/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt (88%) diff --git a/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt similarity index 93% rename from core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt rename to core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt index 225a1339e2..6689ab43e4 100644 --- a/core-kotlin-modules/core-kotlin-lang-2/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt +++ b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/exceptionhandling/ExceptionHandling.kt @@ -75,6 +75,11 @@ class ExceptionHandling { else return message.length } + fun throwExpression(): Int? { + val message: String? = null + return message?.length ?: throw IllegalArgumentException("String is null") + } + @Throws(IOException::class) fun throwsAnnotation(): String?{ val filePath = null diff --git a/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt b/core-kotlin-modules/core-kotlin/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt similarity index 88% rename from core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt rename to core-kotlin-modules/core-kotlin/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt index 49ad3c38e0..af7aa4406f 100644 --- a/core-kotlin-modules/core-kotlin-lang-2/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt +++ b/core-kotlin-modules/core-kotlin/src/test/kotlin/com/baeldung/exceptionhandling/ExceptionHandlingUnitTest.kt @@ -39,6 +39,11 @@ class ExceptionHandlingUnitTest { assertThrows { classUnderTest.throwKeyword() } } + @Test + fun givenIllegalArgument_whenElvisExpressionUsed_thenThrowsException(){ + assertThrows { classUnderTest.throwExpression() } + } + @Test fun whenAnnotationUsed_thenThrowsException(){ assertThrows { classUnderTest.throwsAnnotation() } From d752f841ff0dad8e5028d7b3c0d9dd4d61390a5e Mon Sep 17 00:00:00 2001 From: Maiklins Date: Sat, 18 Jul 2020 14:57:09 +0200 Subject: [PATCH 0142/1862] JAVA-2114 Split or move hibernate JPA module (#9713) Co-authored-by: mikr --- persistence-modules/hibernate-exceptions/README.md | 2 ++ persistence-modules/hibernate-jpa/README.md | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/persistence-modules/hibernate-exceptions/README.md b/persistence-modules/hibernate-exceptions/README.md index c2014a3c91..616800a63d 100644 --- a/persistence-modules/hibernate-exceptions/README.md +++ b/persistence-modules/hibernate-exceptions/README.md @@ -1,3 +1,5 @@ ### Relevant Articles: - [Hibernate could not initialize proxy – no Session](https://www.baeldung.com/hibernate-initialize-proxy-exception) +- [Hibernate Error “No Persistence Provider for EntityManager”](https://www.baeldung.com/hibernate-no-persistence-provider) +- [TransactionRequiredException Error](https://www.baeldung.com/jpa-transaction-required-exception) \ No newline at end of file diff --git a/persistence-modules/hibernate-jpa/README.md b/persistence-modules/hibernate-jpa/README.md index 514fcedb8a..64ec9dcae3 100644 --- a/persistence-modules/hibernate-jpa/README.md +++ b/persistence-modules/hibernate-jpa/README.md @@ -11,7 +11,5 @@ This module contains articles specific to use of Hibernate as a JPA implementati - [Criteria API – An Example of IN Expressions](https://www.baeldung.com/jpa-criteria-api-in-expressions) - [One-to-One Relationship in JPA](https://www.baeldung.com/jpa-one-to-one) - [Enabling Transaction Locks in Spring Data JPA](https://www.baeldung.com/java-jpa-transaction-locks) -- [TransactionRequiredException Error](https://www.baeldung.com/jpa-transaction-required-exception) - [JPA/Hibernate Persistence Context](https://www.baeldung.com/jpa-hibernate-persistence-context) - [Quick Guide to EntityManager#getReference()](https://www.baeldung.com/jpa-entity-manager-get-reference) -- [Hibernate Error “No Persistence Provider for EntityManager”](https://www.baeldung.com/hibernate-no-persistence-provider) From 1ac7e203216efaf31147ae4820f086145836470f Mon Sep 17 00:00:00 2001 From: Nguyen Nam Thai Date: Sat, 18 Jul 2020 21:56:20 +0700 Subject: [PATCH 0143/1862] BAEL-4113 Measure exception performance --- .../java/com/baeldung/ExceptionBenchmark.java | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 jmh/src/main/java/com/baeldung/ExceptionBenchmark.java diff --git a/jmh/src/main/java/com/baeldung/ExceptionBenchmark.java b/jmh/src/main/java/com/baeldung/ExceptionBenchmark.java new file mode 100644 index 0000000000..9a166fe2ce --- /dev/null +++ b/jmh/src/main/java/com/baeldung/ExceptionBenchmark.java @@ -0,0 +1,69 @@ +package com.baeldung; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.infra.Blackhole; + +import java.util.concurrent.TimeUnit; + +@Fork(1) +@Warmup(iterations = 2) +@Measurement(iterations = 10) +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.MILLISECONDS) +public class ExceptionBenchmark { + private static final int LIMIT = 10_000; + + @Benchmark + public void doNotThrowException(Blackhole blackhole) { + for (int i = 0; i < LIMIT; i++) { + blackhole.consume(new Object()); + } + } + + @Benchmark + public void throwAndCatchException(Blackhole blackhole) { + for (int i = 0; i < LIMIT; i++) { + try { + throw new Exception(); + } catch (Exception e) { + blackhole.consume(e); + } + } + } + + @Benchmark + public void createExceptionWithoutThrowingIt(Blackhole blackhole) { + for (int i = 0; i < LIMIT; i++) { + blackhole.consume(new Exception()); + } + } + + @Benchmark + @Fork(value = 1, jvmArgs = "-XX:-StackTraceInThrowable") + public void throwExceptionWithoutAddingStackTrace(Blackhole blackhole) { + for (int i = 0; i < LIMIT; i++) { + try { + throw new Exception(); + } catch (Exception e) { + blackhole.consume(e); + } + } + } + + @Benchmark + public void throwExceptionAndUnwindStackTrace(Blackhole blackhole) { + for (int i = 0; i < LIMIT; i++) { + try { + throw new Exception(); + } catch (Exception e) { + blackhole.consume(e.getStackTrace()); + } + } + } +} From 2f2450fbb9c0d98a98e9c2142f089389bb540f89 Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sat, 18 Jul 2020 23:49:58 +0530 Subject: [PATCH 0144/1862] used standard parent in the project --- patterns/hexagonal-architecture/pom.xml | 13 +++++++------ ...plTest.java => EmployeeServiceImplUnitTest.java} | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) rename patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/{EmployeeServiceImplTest.java => EmployeeServiceImplUnitTest.java} (97%) diff --git a/patterns/hexagonal-architecture/pom.xml b/patterns/hexagonal-architecture/pom.xml index 9317a25e56..62f55c2efa 100644 --- a/patterns/hexagonal-architecture/pom.xml +++ b/patterns/hexagonal-architecture/pom.xml @@ -2,18 +2,19 @@ 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.3.0.RELEASE - - com.baeldung hexagonal-architecture 1.0 hexagonal-architecture Project for hexagonal architecture in java + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + 1.8 diff --git a/patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplTest.java b/patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplUnitTest.java similarity index 97% rename from patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplTest.java rename to patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplUnitTest.java index cadb3b094b..542e45d6f4 100644 --- a/patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplTest.java +++ b/patterns/hexagonal-architecture/src/test/java/com/baeldung/pattern/hexagonal/domain/services/EmployeeServiceImplUnitTest.java @@ -11,7 +11,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class EmployeeServiceImplTest { +class EmployeeServiceImplUnitTest { private EmployeeRepository employeeRepository; private EmployeeService testService; From 09ac6a9cf99be3ef849e87ca14a0d8eb79670213 Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 19 Jul 2020 00:57:36 +0530 Subject: [PATCH 0145/1862] fix for the build warning --- spring-security-modules/spring-security-config/cors/pom.xml | 1 + spring-security-modules/spring-security-config/pom.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/spring-security-modules/spring-security-config/cors/pom.xml b/spring-security-modules/spring-security-config/cors/pom.xml index 19ca7f5ccc..175b21a77d 100644 --- a/spring-security-modules/spring-security-config/cors/pom.xml +++ b/spring-security-modules/spring-security-config/cors/pom.xml @@ -11,6 +11,7 @@ com.baeldung spring-security-modules 0.0.1-SNAPSHOT + ../../ diff --git a/spring-security-modules/spring-security-config/pom.xml b/spring-security-modules/spring-security-config/pom.xml index b3796d1cc6..2b6b6b6b4e 100644 --- a/spring-security-modules/spring-security-config/pom.xml +++ b/spring-security-modules/spring-security-config/pom.xml @@ -11,6 +11,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../../ From 9b7caf3118b9b7b051fbed8f9f5b6a874996c876 Mon Sep 17 00:00:00 2001 From: STS Date: Sun, 19 Jul 2020 10:15:37 +0200 Subject: [PATCH 0146/1862] change excel file direcory --- .../{setFormula => setformula}/ExcelFormula.java | 2 +- .../poi/excel/setformula}/SetFormulaTest.xlsx | Bin .../ExcelFormulaUnitTest.java | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename apache-poi/src/main/java/com/baeldung/poi/excel/{setFormula => setformula}/ExcelFormula.java (93%) rename apache-poi/src/main/resources/{ => com/bealdung/poi/excel/setformula}/SetFormulaTest.xlsx (100%) rename apache-poi/src/test/java/com/baeldung/poi/excel/{setFormula => setformula}/ExcelFormulaUnitTest.java (93%) diff --git a/apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java b/apache-poi/src/main/java/com/baeldung/poi/excel/setformula/ExcelFormula.java similarity index 93% rename from apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java rename to apache-poi/src/main/java/com/baeldung/poi/excel/setformula/ExcelFormula.java index 8b1ca5a89a..f5179b19c9 100644 --- a/apache-poi/src/main/java/com/baeldung/poi/excel/setFormula/ExcelFormula.java +++ b/apache-poi/src/main/java/com/baeldung/poi/excel/setformula/ExcelFormula.java @@ -1,4 +1,4 @@ -package com.baeldung.poi.excel.setFormula; +package com.baeldung.poi.excel.setformula; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; diff --git a/apache-poi/src/main/resources/SetFormulaTest.xlsx b/apache-poi/src/main/resources/com/bealdung/poi/excel/setformula/SetFormulaTest.xlsx similarity index 100% rename from apache-poi/src/main/resources/SetFormulaTest.xlsx rename to apache-poi/src/main/resources/com/bealdung/poi/excel/setformula/SetFormulaTest.xlsx diff --git a/apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java b/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java similarity index 93% rename from apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java rename to apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java index 990b93fcbb..45314519d4 100644 --- a/apache-poi/src/test/java/com/baeldung/poi/excel/setFormula/ExcelFormulaUnitTest.java +++ b/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.poi.excel.setFormula; +package com.baeldung.poi.excel.setformula; import org.apache.poi.ss.util.CellReference; import org.apache.poi.xssf.usermodel.XSSFSheet; @@ -14,7 +14,7 @@ import java.net.URISyntaxException; import java.nio.file.Paths; class ExcelFormulaUnitTest { - private static String FILE_NAME = "SetFormulaTest.xlsx"; + private static String FILE_NAME = "com/bealdung/poi/excel/setformula/SetFormulaTest.xlsx"; private String fileLocation; private ExcelFormula excelFormula; From 2a88d24386eec8969f275f25d3b226e3ac944313 Mon Sep 17 00:00:00 2001 From: developerDiv Date: Sat, 11 Jul 2020 16:42:03 +0100 Subject: [PATCH 0147/1862] Initial commit of ArgumentCaptor --- .../argumentcaptor/AuthenticationStatus.java | 7 ++ .../mockito/argumentcaptor/Credentials.java | 15 +++ .../argumentcaptor/DeliveryPlatform.java | 10 ++ .../mockito/argumentcaptor/Email.java | 47 ++++++++ .../mockito/argumentcaptor/EmailService.java | 36 +++++++ .../mockito/argumentcaptor/Format.java | 6 ++ .../mockito/argumentcaptor/ServiceStatus.java | 7 ++ .../argumentcaptor/EmailServiceUnitTest.java | 100 ++++++++++++++++++ 8 files changed, 228 insertions(+) create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/AuthenticationStatus.java create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Credentials.java create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/DeliveryPlatform.java create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Email.java create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/EmailService.java create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Format.java create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/ServiceStatus.java create mode 100644 testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/AuthenticationStatus.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/AuthenticationStatus.java new file mode 100644 index 0000000000..8307b4323b --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/AuthenticationStatus.java @@ -0,0 +1,7 @@ +package com.baeldung.mockito.argumentcaptor; + +public enum AuthenticationStatus { + AUTHENTICATED, + NOT_AUTHENTICATED, + ERROR +} diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Credentials.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Credentials.java new file mode 100644 index 0000000000..5aec15505e --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Credentials.java @@ -0,0 +1,15 @@ +package com.baeldung.mockito.argumentcaptor; + +public class Credentials { + private final String name; + private final String password; + private final String key; + + public Credentials(String name, String password, String key) { + + this.name = name; + this.password = password; + this.key = key; + } +} + diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/DeliveryPlatform.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/DeliveryPlatform.java new file mode 100644 index 0000000000..dbad1e1bcf --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/DeliveryPlatform.java @@ -0,0 +1,10 @@ +package com.baeldung.mockito.argumentcaptor; + +public interface DeliveryPlatform { + + void send(Email email); + + String getServiceStatus(); + + AuthenticationStatus authenticate(Credentials credentials); +} diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Email.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Email.java new file mode 100644 index 0000000000..6fc753a31c --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Email.java @@ -0,0 +1,47 @@ +package com.baeldung.mockito.argumentcaptor; + +public class Email { + + private String address; + private String subject; + private String body; + private Format format; + + public Email(String address, String subject, String body) { + this.address = address; + this.subject = subject; + this.body = body; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public Format getFormat() { + return format; + } + + public void setFormat(Format format) { + this.format = format; + } +} diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/EmailService.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/EmailService.java new file mode 100644 index 0000000000..c368f41d2f --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/EmailService.java @@ -0,0 +1,36 @@ +package com.baeldung.mockito.argumentcaptor; + +public class EmailService { + + private DeliveryPlatform platform; + + public EmailService(DeliveryPlatform platform) { + this.platform = platform; + } + + public void send(String to, String subject, String body, boolean html) { + Format format = Format.TEXT_ONLY; + if (html) { + format = Format.HTML; + } + Email email = new Email(to, subject, body); + email.setFormat(format); + platform.send(email); + } + + public ServiceStatus checkServiceStatus() { + if (platform.getServiceStatus().equals("OK")) { + return ServiceStatus.UP; + } else { + return ServiceStatus.DOWN; + } + } + + public boolean authenticatedSuccessfully(Credentials credentials) { + if (platform.authenticate(credentials).equals(AuthenticationStatus.AUTHENTICATED)) { + return true; + } else { + return false; + } + } +} diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Format.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Format.java new file mode 100644 index 0000000000..4c10375159 --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Format.java @@ -0,0 +1,6 @@ +package com.baeldung.mockito.argumentcaptor; + +public enum Format { + TEXT_ONLY, + HTML +} diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/ServiceStatus.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/ServiceStatus.java new file mode 100644 index 0000000000..65def5af64 --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/ServiceStatus.java @@ -0,0 +1,7 @@ +package com.baeldung.mockito.argumentcaptor; + +public enum ServiceStatus { + UP, + DOWN, + AUTHENTICATED +} diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java new file mode 100644 index 0000000000..cdae118e92 --- /dev/null +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java @@ -0,0 +1,100 @@ +package com.baeldung.mockito.argumentcaptor; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +import static org.junit.Assert.*; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@RunWith(MockitoJUnitRunner.class) +public class EmailServiceUnitTest { + + @InjectMocks + EmailService emailService; + + @Mock + DeliveryPlatform platform; + + @Captor + ArgumentCaptor emailCaptor; + + @Captor + ArgumentCaptor credentialsCaptor; + + @Test + public void whenDoesNotSupportHtml_expectTextOnlyEmailFormat() { + String to = "info@baeldung.com"; + String subject = "Using ArgumentCaptor"; + String body = "Article on using ArgumentCaptor"; + + emailService.send(to, subject, body, false); + + verify(platform).send(emailCaptor.capture()); + Email emailCaptorValue = emailCaptor.getValue(); + assertEquals(Format.TEXT_ONLY, emailCaptorValue.getFormat()); + } + + @Test + public void send_whenDoesSupportHtml_expectHTMLEmailFormat() { + String to = "baeldung@baeldung.com"; + String subject = "Great New Course!"; + String body = "Try out our new course."; + + emailService.send(to, subject, body, true); + + verify(platform).send(emailCaptor.capture()); + Email value = emailCaptor.getValue(); + assertEquals(Format.HTML, value.getFormat()); + } + + @Test + public void getServiceStatus_whenServiceRunning_expectUpResponse() { + when(platform.getServiceStatus()).thenReturn("OK"); + + ServiceStatus serviceStatus = emailService.checkServiceStatus(); + + assertEquals(ServiceStatus.UP, serviceStatus); + } + + @Test + public void getServiceStatus_whenServiceNotRunning_expectDownResponse() { + when(platform.getServiceStatus()).thenReturn("Error"); + + ServiceStatus serviceStatus = emailService.checkServiceStatus(); + + assertEquals(ServiceStatus.DOWN, serviceStatus); + } + + @Test + public void usingArgumemtMatcher_whenAuthenticatedWithValidCredentials_expectTrue() { + Credentials credentials = new Credentials("baeldung", "correct_password", "correct_key"); + when(platform.authenticate(eq(credentials))).thenReturn(AuthenticationStatus.AUTHENTICATED); + + assertTrue(emailService.authenticatedSuccessfully(credentials)); + } + + @Test + public void usingArgumentCapture_whenAuthenticatedWithValidCredentials_expectTrue() { + Credentials credentials = new Credentials("baeldung", "correct_password", "correct_key"); + when(platform.authenticate(credentialsCaptor.capture())).thenReturn(AuthenticationStatus.AUTHENTICATED); + + assertTrue(emailService.authenticatedSuccessfully(credentials)); + assertEquals(credentials, credentialsCaptor.getValue()); + } + + @Test + public void authenticate_whenNotAuthenticated_expectFalse() { + Credentials credentials = new Credentials("baeldung", "incorrect_password", "incorrect_key"); + when(platform.authenticate(credentialsCaptor.capture())).thenReturn(AuthenticationStatus.NOT_AUTHENTICATED); + + assertFalse(emailService.authenticatedSuccessfully(credentials)); + assertEquals(credentials, credentialsCaptor.getValue()); + } +} \ No newline at end of file From 92b1c62c1aebdbef3699e3a97ff9ee888550b212 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 19 Jul 2020 14:29:41 +0530 Subject: [PATCH 0148/1862] JAVA-66: New module spring-data-jpa-annotations --- .../spring-data-jpa-annotations/README.md | 23 +++ .../spring-data-jpa-annotations/pom.xml | 77 +++++++++ .../main/java/com/baeldung/Application.java | 13 ++ .../baeldung/boot/ddd/event/Aggregate.java | 46 ++++++ .../baeldung/boot/ddd/event/Aggregate2.java | 44 +++++ .../boot/ddd/event/Aggregate2Repository.java | 10 ++ .../baeldung/boot/ddd/event/Aggregate3.java | 23 +++ .../boot/ddd/event/Aggregate3Repository.java | 14 ++ .../boot/ddd/event/AggregateRepository.java | 10 ++ .../baeldung/boot/ddd/event/DddConfig.java | 15 ++ .../baeldung/boot/ddd/event/DomainEvent.java | 8 + .../boot/ddd/event/DomainService.java | 31 ++++ .../baeldung/composite/BookApplication.java | 12 ++ .../com/baeldung/composite/entity/Book.java | 47 ++++++ .../com/baeldung/composite/entity/BookId.java | 51 ++++++ .../composite/repository/BookRepository.java | 18 +++ .../baeldung/embeddable/model/Company.java | 71 ++++++++ .../embeddable/model/ContactPerson.java | 38 +++++ .../repositories/CompanyRepository.java | 18 +++ .../SpringBootLifecycleEventApplication.java | 11 ++ .../model/AuditTrailListener.java | 39 +++++ .../baeldung/lifecycleevents/model/User.java | 104 ++++++++++++ .../repository/UserRepository.java | 9 ++ .../java/com/baeldung/tx/TxApplication.java | 13 ++ .../java/com/baeldung/tx/model/Payment.java | 55 +++++++ .../src/main/resources/application.properties | 6 + .../src/main/resources/ddd.properties | 1 + .../src/main/resources/logback.xml | 13 ++ .../src/main/resources/persistence.properties | 14 ++ .../Aggregate2EventsIntegrationTest.java | 72 +++++++++ .../Aggregate3EventsIntegrationTest.java | 67 ++++++++ .../event/AggregateEventsIntegrationTest.java | 87 ++++++++++ .../boot/ddd/event/TestEventHandler.java | 14 ++ .../BookRepositoryIntegrationTest.java | 64 ++++++++ .../embeddable/EmbeddableIntegrationTest.java | 125 ++++++++++++++ .../tx/ManualTransactionIntegrationTest.java | 152 ++++++++++++++++++ .../UserRepositoryIntegrationTest.java | 80 +++++++++ 37 files changed, 1495 insertions(+) create mode 100644 persistence-modules/spring-data-jpa-annotations/README.md create mode 100644 persistence-modules/spring-data-jpa-annotations/pom.xml create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/Application.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate2.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate2Repository.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate3.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate3Repository.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/AggregateRepository.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DddConfig.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DomainEvent.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DomainService.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/BookApplication.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/entity/Book.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/entity/BookId.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/repository/BookRepository.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/model/Company.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/model/ContactPerson.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/SpringBootLifecycleEventApplication.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/model/AuditTrailListener.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/model/User.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/repository/UserRepository.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/TxApplication.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/model/Payment.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/resources/ddd.properties create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/resources/logback.xml create mode 100644 persistence-modules/spring-data-jpa-annotations/src/main/resources/persistence.properties create mode 100644 persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/Aggregate2EventsIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/Aggregate3EventsIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/AggregateEventsIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/TestEventHandler.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/composite/repository/BookRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/embeddable/EmbeddableIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-annotations/src/test/java/lifecycleevents/UserRepositoryIntegrationTest.java diff --git a/persistence-modules/spring-data-jpa-annotations/README.md b/persistence-modules/spring-data-jpa-annotations/README.md new file mode 100644 index 0000000000..5f1c8dbc27 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/README.md @@ -0,0 +1,23 @@ +## Spring Data JPA - Annotations + +This module contains articles about annotations used in Spring Data JPA + +### Relevant articles + +- [Spring Data Annotations](https://www.baeldung.com/spring-data-annotations) +- [DDD Aggregates and @DomainEvents](https://www.baeldung.com/spring-data-ddd) +- [JPA @Embedded And @Embeddable](https://www.baeldung.com/jpa-embedded-embeddable) +- [Spring Data JPA @Modifying Annotation](https://www.baeldung.com/spring-data-jpa-modifying-annotation) +- [Spring JPA @Embedded and @EmbeddedId](https://www.baeldung.com/spring-jpa-embedded-method-parameters) +- [Programmatic Transaction Management in Spring](https://www.baeldung.com/spring-programmatic-transaction-management) +- [JPA Entity Lifecycle Events](https://www.baeldung.com/jpa-entity-lifecycle-events) + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator + diff --git a/persistence-modules/spring-data-jpa-annotations/pom.xml b/persistence-modules/spring-data-jpa-annotations/pom.xml new file mode 100644 index 0000000000..67b788c404 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + spring-data-jpa-annotations + spring-data-jpa-annotations + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.hibernate + hibernate-ehcache + + + org.hibernate + hibernate-envers + + + + com.h2database + h2 + + + + + org.testcontainers + postgresql + ${testcontainers.postgresql.version} + test + + + + org.postgresql + postgresql + + + + + org.springframework.security + spring-security-test + test + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.google.guava + guava + ${guava.version} + + + + + com.baeldung.boot.Application + 1.10.6 + 42.2.5 + 21.0 + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..3ea3d113da --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/Application.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate.java new file mode 100644 index 0000000000..e435f4c85c --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate.java @@ -0,0 +1,46 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Transient; + +import org.springframework.context.ApplicationEventPublisher; + +@Entity +class Aggregate { + @Transient + private ApplicationEventPublisher eventPublisher; + @Id + private long id; + + private Aggregate() { + } + + Aggregate(long id, ApplicationEventPublisher eventPublisher) { + this.id = id; + this.eventPublisher = eventPublisher; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "DomainEntity [id=" + id + "]"; + } + + void domainOperation() { + // some business logic + if (eventPublisher != null) { + eventPublisher.publishEvent(new DomainEvent()); + } + } + + long getId() { + return id; + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate2.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate2.java new file mode 100644 index 0000000000..08f61db812 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate2.java @@ -0,0 +1,44 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import java.util.ArrayList; +import java.util.Collection; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Transient; + +import org.springframework.data.domain.AfterDomainEventPublication; +import org.springframework.data.domain.DomainEvents; + +@Entity +public class Aggregate2 { + @Transient + private final Collection domainEvents; + @Id + @GeneratedValue + private long id; + + public Aggregate2() { + domainEvents = new ArrayList<>(); + } + + @AfterDomainEventPublication + public void clearEvents() { + domainEvents.clear(); + } + + public void domainOperation() { + // some domain operation + domainEvents.add(new DomainEvent()); + } + + @DomainEvents + public Collection events() { + return domainEvents; + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate2Repository.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate2Repository.java new file mode 100644 index 0000000000..7f09c410fc --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate2Repository.java @@ -0,0 +1,10 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import org.springframework.data.repository.CrudRepository; + +public interface Aggregate2Repository extends CrudRepository { + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate3.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate3.java new file mode 100644 index 0000000000..f664322a59 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate3.java @@ -0,0 +1,23 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +import org.springframework.data.domain.AbstractAggregateRoot; + +@Entity +public class Aggregate3 extends AbstractAggregateRoot { + @Id + @GeneratedValue + private long id; + + public void domainOperation() { + // some domain operation + registerEvent(new DomainEvent()); + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate3Repository.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate3Repository.java new file mode 100644 index 0000000000..93f50bb5cf --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/Aggregate3Repository.java @@ -0,0 +1,14 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import org.springframework.data.repository.CrudRepository; + +/** + * @author goobar + * + */ +public interface Aggregate3Repository extends CrudRepository { + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/AggregateRepository.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/AggregateRepository.java new file mode 100644 index 0000000000..1c2d3884bf --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/AggregateRepository.java @@ -0,0 +1,10 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import org.springframework.data.repository.CrudRepository; + +public interface AggregateRepository extends CrudRepository { + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DddConfig.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DddConfig.java new file mode 100644 index 0000000000..34cf21463b --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DddConfig.java @@ -0,0 +1,15 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.context.annotation.PropertySource; + +@SpringBootConfiguration +@EnableAutoConfiguration +@PropertySource("classpath:/ddd.properties") +public class DddConfig { + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DomainEvent.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DomainEvent.java new file mode 100644 index 0000000000..e7626e742d --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DomainEvent.java @@ -0,0 +1,8 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +class DomainEvent { + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DomainService.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DomainService.java new file mode 100644 index 0000000000..80aa5ca6cb --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/boot/ddd/event/DomainService.java @@ -0,0 +1,31 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import javax.transaction.Transactional; + +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.stereotype.Service; + +@Service +public class DomainService { + private final ApplicationEventPublisher eventPublisher; + private final AggregateRepository repository; + + public DomainService(AggregateRepository repository, ApplicationEventPublisher eventPublisher) { + this.repository = repository; + this.eventPublisher = eventPublisher; + } + + @Transactional + public void serviceDomainOperation(long entityId) { + repository.findById(entityId) + .ifPresent(entity -> { + entity.domainOperation(); + repository.save(entity); + eventPublisher.publishEvent(new DomainEvent()); + }); + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/BookApplication.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/BookApplication.java new file mode 100644 index 0000000000..52f06058aa --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/BookApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.composite; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BookApplication { + + public static void main(String[] args) { + SpringApplication.run(BookApplication.class); + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/entity/Book.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/entity/Book.java new file mode 100644 index 0000000000..e4f1727654 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/entity/Book.java @@ -0,0 +1,47 @@ +package com.baeldung.composite.entity; + +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; + +@Entity +public class Book { + + @EmbeddedId + private BookId id; + private String genre; + private Integer price; + + public Book() { + } + + public Book(String author, String name, String genre, Integer price) { + BookId id = new BookId(author, name); + this.id = id; + this.genre = genre; + this.price = price; + } + + public BookId getId() { + return id; + } + + public void setId(BookId id) { + this.id = id; + } + + public String getGenre() { + return genre; + } + + public void setGenre(String genre) { + this.genre = genre; + } + + public Integer getPrice() { + return price; + } + + public void setPrice(Integer price) { + this.price = price; + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/entity/BookId.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/entity/BookId.java new file mode 100644 index 0000000000..1524452412 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/entity/BookId.java @@ -0,0 +1,51 @@ +package com.baeldung.composite.entity; + +import javax.persistence.Embeddable; +import java.io.Serializable; +import java.util.Objects; + +@Embeddable +public class BookId implements Serializable { + + private String author; + private String name; + + public BookId() { + } + + public BookId(String author, String name) { + this.author = author; + this.name = name; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + BookId bookId = (BookId) o; + return Objects.equals(author, bookId.author) && Objects.equals(name, bookId.name); + } + + @Override + public int hashCode() { + return Objects.hash(author, name); + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/repository/BookRepository.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/repository/BookRepository.java new file mode 100644 index 0000000000..d5993eaf79 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/composite/repository/BookRepository.java @@ -0,0 +1,18 @@ +package com.baeldung.composite.repository; + +import com.baeldung.composite.entity.Book; +import com.baeldung.composite.entity.BookId; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface BookRepository extends JpaRepository { + + List findByIdName(String name); + + List findByIdAuthor(String author); + + List findByGenre(String genre); +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/model/Company.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/model/Company.java new file mode 100644 index 0000000000..203cff1e35 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/model/Company.java @@ -0,0 +1,71 @@ +package com.baeldung.embeddable.model; + +import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; +import javax.persistence.Column; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class Company { + + @Id + @GeneratedValue + private Integer id; + + private String name; + + private String address; + + private String phone; + + @Embedded + @AttributeOverrides(value = { + @AttributeOverride( name = "firstName", column = @Column(name = "contact_first_name")), + @AttributeOverride( name = "lastName", column = @Column(name = "contact_last_name")), + @AttributeOverride( name = "phone", column = @Column(name = "contact_phone")) + }) + private ContactPerson contactPerson; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public ContactPerson getContactPerson() { + return contactPerson; + } + + public void setContactPerson(ContactPerson contactPerson) { + this.contactPerson = contactPerson; + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/model/ContactPerson.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/model/ContactPerson.java new file mode 100644 index 0000000000..561da80878 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/model/ContactPerson.java @@ -0,0 +1,38 @@ +package com.baeldung.embeddable.model; + +import javax.persistence.Embeddable; + +@Embeddable +public class ContactPerson { + + private String firstName; + + private String lastName; + + private String phone; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java new file mode 100644 index 0000000000..f456b15652 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java @@ -0,0 +1,18 @@ +package com.baeldung.embeddable.repositories; + +import com.baeldung.embeddable.model.Company; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface CompanyRepository extends JpaRepository { + + List findByContactPersonFirstName(String firstName); + + @Query("SELECT C FROM Company C WHERE C.contactPerson.firstName = ?1") + List findByContactPersonFirstNameWithJPQL(String firstName); + + @Query(value = "SELECT * FROM company WHERE contact_first_name = ?1", nativeQuery = true) + List findByContactPersonFirstNameWithNativeQuery(String firstName); +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/SpringBootLifecycleEventApplication.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/SpringBootLifecycleEventApplication.java new file mode 100644 index 0000000000..fbc861c5fe --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/SpringBootLifecycleEventApplication.java @@ -0,0 +1,11 @@ +package com.baeldung.lifecycleevents; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootLifecycleEventApplication { + public static void main(String[] args) { + SpringApplication.run(SpringBootLifecycleEventApplication.class, args); + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/model/AuditTrailListener.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/model/AuditTrailListener.java new file mode 100644 index 0000000000..26ebff42e4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/model/AuditTrailListener.java @@ -0,0 +1,39 @@ +package com.baeldung.lifecycleevents.model; + +import javax.persistence.PostLoad; +import javax.persistence.PostPersist; +import javax.persistence.PostRemove; +import javax.persistence.PostUpdate; +import javax.persistence.PrePersist; +import javax.persistence.PreRemove; +import javax.persistence.PreUpdate; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class AuditTrailListener { + private static Log log = LogFactory.getLog(AuditTrailListener.class); + + @PrePersist + @PreUpdate + @PreRemove + private void beforeAnyUpdate(User user) { + if (user.getId() == 0) { + log.info("[USER AUDIT] About to add a user"); + } else { + log.info("[USER AUDIT] About to update/delete user: " + user.getId()); + } + } + + @PostPersist + @PostUpdate + @PostRemove + private void afterAnyUpdate(User user) { + log.info("[USER AUDIT] add/update/delete complete for user: " + user.getId()); + } + + @PostLoad + private void afterLoad(User user) { + log.info("[USER AUDIT] user loaded from database: " + user.getId()); + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/model/User.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/model/User.java new file mode 100644 index 0000000000..a080cb3bf2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/model/User.java @@ -0,0 +1,104 @@ +package com.baeldung.lifecycleevents.model; + +import javax.persistence.Entity; +import javax.persistence.EntityListeners; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.PostLoad; +import javax.persistence.PostPersist; +import javax.persistence.PostRemove; +import javax.persistence.PostUpdate; +import javax.persistence.PrePersist; +import javax.persistence.PreRemove; +import javax.persistence.PreUpdate; +import javax.persistence.Transient; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +@Entity +@EntityListeners(AuditTrailListener.class) +public class User { + private static Log log = LogFactory.getLog(User.class); + + @Id + @GeneratedValue + private int id; + + private String userName; + private String firstName; + private String lastName; + @Transient + private String fullName; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getFullName() { + return fullName; + } + + @PrePersist + public void logNewUserAttempt() { + log.info("Attempting to add new user with username: " + userName); + } + + @PostPersist + public void logNewUserAdded() { + log.info("Added user '" + userName + "' with ID: " + id); + } + + @PreRemove + public void logUserRemovalAttempt() { + log.info("Attempting to delete user: " + userName); + } + + @PostRemove + public void logUserRemoval() { + log.info("Deleted user: " + userName); + } + + @PreUpdate + public void logUserUpdateAttempt() { + log.info("Attempting to update user: " + userName); + } + + @PostUpdate + public void logUserUpdate() { + log.info("Updated user: " + userName); + } + + @PostLoad + public void logUserLoad() { + fullName = firstName + " " + lastName; + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/repository/UserRepository.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/repository/UserRepository.java new file mode 100644 index 0000000000..af14117ebb --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/lifecycleevents/repository/UserRepository.java @@ -0,0 +1,9 @@ +package com.baeldung.lifecycleevents.repository; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.baeldung.lifecycleevents.model.User; + +public interface UserRepository extends JpaRepository { + public User findByUserName(String userName); +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/TxApplication.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/TxApplication.java new file mode 100644 index 0000000000..4c982c91e9 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/TxApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.tx; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class TxApplication { + + public static void main(String[] args) { + SpringApplication.run(TxApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/model/Payment.java b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/model/Payment.java new file mode 100644 index 0000000000..921a1e9275 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/java/com/baeldung/tx/model/Payment.java @@ -0,0 +1,55 @@ +package com.baeldung.tx.model; + +import javax.persistence.*; + +@Entity +public class Payment { + + @Id + @GeneratedValue + private Long id; + + private Long amount; + + @Column(unique = true) + private String referenceNumber; + + @Enumerated(EnumType.STRING) + private State state; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getAmount() { + return amount; + } + + public void setAmount(Long amount) { + this.amount = amount; + } + + public String getReferenceNumber() { + return referenceNumber; + } + + public void setReferenceNumber(String referenceNumber) { + this.referenceNumber = referenceNumber; + } + + public State getState() { + return state; + } + + public void setState(State state) { + this.state = state; + } + + public enum State { + STARTED, FAILED, SUCCESSFUL + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties new file mode 100644 index 0000000000..f127dd5e50 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/resources/application.properties @@ -0,0 +1,6 @@ +spring.main.allow-bean-definition-overriding=true + +spring.jpa.properties.hibernate.jdbc.batch_size=4 +spring.jpa.properties.hibernate.order_inserts=true +spring.jpa.properties.hibernate.order_updates=true +spring.jpa.properties.hibernate.generate_statistics=true diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/resources/ddd.properties b/persistence-modules/spring-data-jpa-annotations/src/main/resources/ddd.properties new file mode 100644 index 0000000000..e5126b694b --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/resources/ddd.properties @@ -0,0 +1 @@ +spring.datasource.initialization-mode=never \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa-annotations/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-annotations/src/main/resources/persistence.properties b/persistence-modules/spring-data-jpa-annotations/src/main/resources/persistence.properties new file mode 100644 index 0000000000..6bc83edf34 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/main/resources/persistence.properties @@ -0,0 +1,14 @@ +# jdbc.X +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS USERS +jdbc.user=sa +jdbc.pass=sa + +# hibernate.X +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop +hibernate.cache.use_second_level_cache=true +hibernate.cache.use_query_cache=true +hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory + diff --git a/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/Aggregate2EventsIntegrationTest.java b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/Aggregate2EventsIntegrationTest.java new file mode 100644 index 0000000000..e76b932cb9 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/Aggregate2EventsIntegrationTest.java @@ -0,0 +1,72 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import com.baeldung.boot.ddd.event.Aggregate2; +import com.baeldung.boot.ddd.event.Aggregate2Repository; +import com.baeldung.boot.ddd.event.DomainEvent; + +@SpringJUnitConfig +@SpringBootTest +class Aggregate2EventsIntegrationTest { + @MockBean + private TestEventHandler eventHandler; + @Autowired + private Aggregate2Repository repository; + + // @formatter:off + @DisplayName("given aggregate with @AfterDomainEventPublication," + + " when do domain operation and save twice," + + " then an event is published only for the first time") + // @formatter:on + @Test + void afterDomainEvents() { + // given + Aggregate2 aggregate = new Aggregate2(); + + // when + aggregate.domainOperation(); + repository.save(aggregate); + repository.save(aggregate); + + // then + verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); + } + + @BeforeEach + void beforeEach() { + repository.deleteAll(); + } + + // @formatter:off + @DisplayName("given aggregate with @DomainEvents," + + " when do domain operation and save," + + " then an event is published") + // @formatter:on + @Test + void domainEvents() { + // given + Aggregate2 aggregate = new Aggregate2(); + + // when + aggregate.domainOperation(); + repository.save(aggregate); + + // then + verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/Aggregate3EventsIntegrationTest.java b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/Aggregate3EventsIntegrationTest.java new file mode 100644 index 0000000000..4193e932ee --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/Aggregate3EventsIntegrationTest.java @@ -0,0 +1,67 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import com.baeldung.boot.ddd.event.Aggregate3; +import com.baeldung.boot.ddd.event.Aggregate3Repository; +import com.baeldung.boot.ddd.event.DomainEvent; + +@SpringJUnitConfig +@SpringBootTest +class Aggregate3EventsIntegrationTest { + + @MockBean + private TestEventHandler eventHandler; + @Autowired + private Aggregate3Repository repository; + + // @formatter:off + @DisplayName("given aggregate extending AbstractAggregateRoot," + + " when do domain operation and save twice," + + " then an event is published only for the first time") + // @formatter:on + @Test + void afterDomainEvents() { + // given + Aggregate3 aggregate = new Aggregate3(); + + // when + aggregate.domainOperation(); + repository.save(aggregate); + repository.save(aggregate); + + // then + verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); + } + + // @formatter:off + @DisplayName("given aggregate extending AbstractAggregateRoot," + + " when do domain operation and save," + + " then an event is published") + // @formatter:on + @Test + void domainEvents() { + // given + Aggregate3 aggregate = new Aggregate3(); + + // when + aggregate.domainOperation(); + repository.save(aggregate); + + // then + verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/AggregateEventsIntegrationTest.java b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/AggregateEventsIntegrationTest.java new file mode 100644 index 0000000000..ac607063b2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/AggregateEventsIntegrationTest.java @@ -0,0 +1,87 @@ +package com.baeldung.boot.ddd.event; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.context.annotation.Bean; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +import com.baeldung.boot.ddd.event.Aggregate; +import com.baeldung.boot.ddd.event.AggregateRepository; +import com.baeldung.boot.ddd.event.DomainEvent; +import com.baeldung.boot.ddd.event.DomainService; + +@SpringJUnitConfig +@SpringBootTest +class AggregateEventsIntegrationTest { + + @Autowired + private DomainService domainService; + + @MockBean + private TestEventHandler eventHandler; + @Autowired + private ApplicationEventPublisher eventPublisher; + @Autowired + private AggregateRepository repository; + + // @formatter:off + @DisplayName("given existing aggregate," + + " when do domain operation directly on aggregate," + + " then domain event is NOT published") + // @formatter:on + @Test + void aggregateEventsTest() { + Aggregate existingDomainEntity = new Aggregate(0, eventPublisher); + repository.save(existingDomainEntity); + + // when + repository.findById(existingDomainEntity.getId()) + .get() + .domainOperation(); + + // then + verifyZeroInteractions(eventHandler); + } + + @BeforeEach + void beforeEach() { + repository.deleteAll(); + } + + // @formatter:off + @DisplayName("given existing aggregate," + + " when do domain operation on service," + + " then domain event is published") + // @formatter:on + @Test + void serviceEventsTest() { + Aggregate existingDomainEntity = new Aggregate(1, eventPublisher); + repository.save(existingDomainEntity); + + // when + domainService.serviceDomainOperation(existingDomainEntity.getId()); + + // then + verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); + } + + @TestConfiguration + public static class TestConfig { + @Bean + public DomainService domainService(AggregateRepository repository, ApplicationEventPublisher eventPublisher) { + return new DomainService(repository, eventPublisher); + } + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/TestEventHandler.java b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/TestEventHandler.java new file mode 100644 index 0000000000..0f499834eb --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/boot/ddd/event/TestEventHandler.java @@ -0,0 +1,14 @@ +/** + * + */ +package com.baeldung.boot.ddd.event; + +import org.springframework.transaction.event.TransactionalEventListener; + +import com.baeldung.boot.ddd.event.DomainEvent; + +interface TestEventHandler { + @TransactionalEventListener + void handleEvent(DomainEvent event); + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/composite/repository/BookRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/composite/repository/BookRepositoryIntegrationTest.java new file mode 100644 index 0000000000..9d25acbd96 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/composite/repository/BookRepositoryIntegrationTest.java @@ -0,0 +1,64 @@ +package com.baeldung.composite.repository; + +import com.baeldung.composite.BookApplication; +import com.baeldung.composite.entity.Book; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = BookApplication.class) +public class BookRepositoryIntegrationTest { + + public static final String JAVA_101 = "Java101"; + public static final String JANE = "Jane"; + public static final String TECH = "Tech"; + @Autowired + BookRepository repository; + + @Before + public void setUp() { + Book book1 = new Book("John", JAVA_101, TECH, 20); + Book book2 = new Book(JANE, JAVA_101, "Arch", 25); + Book book3 = new Book(JANE, "Scala101", TECH, 23); + + repository.saveAll(Arrays.asList(book1, book2, book3)); + } + + @After + public void tearDown() { + repository.deleteAll(); + } + + @Test + public void testFindByName() { + List books = repository.findByIdName(JAVA_101); + + assertEquals(2, books.size()); + } + + @Test + public void testFindByAuthor() { + List books = repository.findByIdAuthor(JANE); + + assertEquals(2, books.size()); + } + + @Test + public void testFindByGenre() { + List books = repository.findByGenre(TECH); + + assertEquals(2, books.size()); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/embeddable/EmbeddableIntegrationTest.java b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/embeddable/EmbeddableIntegrationTest.java new file mode 100644 index 0000000000..b4c365a2d9 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/embeddable/EmbeddableIntegrationTest.java @@ -0,0 +1,125 @@ +package com.baeldung.embeddable; + +import com.baeldung.Application; +import com.baeldung.embeddable.model.Company; +import com.baeldung.embeddable.model.ContactPerson; +import com.baeldung.embeddable.repositories.CompanyRepository; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static org.junit.Assert.assertEquals; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {Application.class}) +public class EmbeddableIntegrationTest { + + @Autowired + private CompanyRepository companyRepository; + + @Test + @Transactional + public void whenInsertingCompany_thenEmbeddedContactPersonDetailsAreMapped() { + ContactPerson contactPerson = new ContactPerson(); + contactPerson.setFirstName("First"); + contactPerson.setLastName("Last"); + contactPerson.setPhone("123-456-789"); + + Company company = new Company(); + company.setName("Company"); + company.setAddress("1st street"); + company.setPhone("987-654-321"); + company.setContactPerson(contactPerson); + + companyRepository.save(company); + + Company result = companyRepository.getOne(company.getId()); + + assertEquals("Company", result.getName()); + assertEquals("1st street", result.getAddress()); + assertEquals("987-654-321", result.getPhone()); + assertEquals("First", result.getContactPerson().getFirstName()); + assertEquals("Last", result.getContactPerson().getLastName()); + assertEquals("123-456-789", result.getContactPerson().getPhone()); + } + + @Test + @Transactional + public void whenFindingCompanyByContactPersonAttribute_thenCompanyIsReturnedProperly() { + ContactPerson contactPerson = new ContactPerson(); + contactPerson.setFirstName("Name"); + contactPerson.setLastName("Last"); + contactPerson.setPhone("123-456-789"); + + Company company = new Company(); + company.setName("Company"); + company.setAddress("1st street"); + company.setPhone("987-654-321"); + company.setContactPerson(contactPerson); + + companyRepository.save(company); + + List result = companyRepository.findByContactPersonFirstName("Name"); + + assertEquals(1, result.size()); + + result = companyRepository.findByContactPersonFirstName("FirstName"); + + assertEquals(0, result.size()); + } + + @Test + @Transactional + public void whenFindingCompanyByContactPersonAttributeWithJPQL_thenCompanyIsReturnedProperly() { + ContactPerson contactPerson = new ContactPerson(); + contactPerson.setFirstName("@QueryName"); + contactPerson.setLastName("Last"); + contactPerson.setPhone("123-456-789"); + + Company company = new Company(); + company.setName("Company"); + company.setAddress("1st street"); + company.setPhone("987-654-321"); + company.setContactPerson(contactPerson); + + companyRepository.save(company); + + List result = companyRepository.findByContactPersonFirstNameWithJPQL("@QueryName"); + + assertEquals(1, result.size()); + + result = companyRepository.findByContactPersonFirstNameWithJPQL("FirstName"); + + assertEquals(0, result.size()); + } + + @Test + @Transactional + public void whenFindingCompanyByContactPersonAttributeWithNativeQuery_thenCompanyIsReturnedProperly() { + ContactPerson contactPerson = new ContactPerson(); + contactPerson.setFirstName("NativeQueryName"); + contactPerson.setLastName("Last"); + contactPerson.setPhone("123-456-789"); + + Company company = new Company(); + company.setName("Company"); + company.setAddress("1st street"); + company.setPhone("987-654-321"); + company.setContactPerson(contactPerson); + + companyRepository.save(company); + + List result = companyRepository.findByContactPersonFirstNameWithNativeQuery("NativeQueryName"); + + assertEquals(1, result.size()); + + result = companyRepository.findByContactPersonFirstNameWithNativeQuery("FirstName"); + + assertEquals(0, result.size()); + } +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java new file mode 100644 index 0000000000..01551348c9 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java @@ -0,0 +1,152 @@ +package com.baeldung.tx; + +import com.baeldung.tx.model.Payment; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.DefaultTransactionDefinition; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; +import org.springframework.transaction.support.TransactionTemplate; + +import javax.persistence.EntityManager; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.transaction.annotation.Propagation.NOT_SUPPORTED; + +@DataJpaTest +@ActiveProfiles("test") +@Transactional(propagation = NOT_SUPPORTED) +class ManualTransactionIntegrationTest { + + @Autowired + private PlatformTransactionManager transactionManager; + + @Autowired + private EntityManager entityManager; + + private TransactionTemplate transactionTemplate; + + @BeforeEach + void setUp() { + transactionTemplate = new TransactionTemplate(transactionManager); + } + + @AfterEach + void flushDb() { + transactionTemplate.execute(status -> entityManager + .createQuery("delete from Payment") + .executeUpdate()); + } + + @Test + void givenAPayment_WhenNotDuplicate_ThenShouldCommit() { + Long id = transactionTemplate.execute(status -> { + Payment payment = new Payment(); + payment.setAmount(1000L); + payment.setReferenceNumber("Ref-1"); + payment.setState(Payment.State.SUCCESSFUL); + + entityManager.persist(payment); + + return payment.getId(); + }); + + Payment payment = entityManager.find(Payment.class, id); + assertThat(payment).isNotNull(); + } + + @Test + void givenAPayment_WhenMarkAsRollback_ThenShouldRollback() { + transactionTemplate.execute(status -> { + Payment payment = new Payment(); + payment.setAmount(1000L); + payment.setReferenceNumber("Ref-1"); + payment.setState(Payment.State.SUCCESSFUL); + + entityManager.persist(payment); + status.setRollbackOnly(); + + return payment.getId(); + }); + + assertThat(entityManager + .createQuery("select p from Payment p", Payment.class) + .getResultList()).isEmpty(); + } + + @Test + void givenTwoPayments_WhenRefIsDuplicate_ThenShouldRollback() { + try { + transactionTemplate.execute(s -> { + Payment first = new Payment(); + first.setAmount(1000L); + first.setReferenceNumber("Ref-1"); + first.setState(Payment.State.SUCCESSFUL); + + Payment second = new Payment(); + second.setAmount(2000L); + second.setReferenceNumber("Ref-1"); + second.setState(Payment.State.SUCCESSFUL); + + entityManager.persist(first); + entityManager.persist(second); + + return "Ref-1"; + }); + } catch (Exception ignored) { + } + + assertThat(entityManager + .createQuery("select p from Payment p", Payment.class) + .getResultList()).isEmpty(); + } + + @Test + void givenAPayment_WhenNotExpectingAnyResult_ThenShouldCommit() { + transactionTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus status) { + Payment payment = new Payment(); + payment.setReferenceNumber("Ref-1"); + payment.setState(Payment.State.SUCCESSFUL); + + entityManager.persist(payment); + } + }); + + assertThat(entityManager + .createQuery("select p from Payment p", Payment.class) + .getResultList()).hasSize(1); + } + + @Test + void givenAPayment_WhenUsingTxManager_ThenShouldCommit() { + DefaultTransactionDefinition definition = new DefaultTransactionDefinition(); + definition.setIsolationLevel(TransactionDefinition.ISOLATION_REPEATABLE_READ); + definition.setTimeout(3); + + TransactionStatus status = transactionManager.getTransaction(definition); + try { + Payment payment = new Payment(); + payment.setReferenceNumber("Ref-1"); + payment.setState(Payment.State.SUCCESSFUL); + + entityManager.persist(payment); + transactionManager.commit(status); + } catch (Exception ex) { + transactionManager.rollback(status); + } + + assertThat(entityManager + .createQuery("select p from Payment p", Payment.class) + .getResultList()).hasSize(1); + } + +} diff --git a/persistence-modules/spring-data-jpa-annotations/src/test/java/lifecycleevents/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-annotations/src/test/java/lifecycleevents/UserRepositoryIntegrationTest.java new file mode 100644 index 0000000000..078f437474 --- /dev/null +++ b/persistence-modules/spring-data-jpa-annotations/src/test/java/lifecycleevents/UserRepositoryIntegrationTest.java @@ -0,0 +1,80 @@ +package lifecycleevents; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.lifecycleevents.SpringBootLifecycleEventApplication; +import com.baeldung.lifecycleevents.model.User; +import com.baeldung.lifecycleevents.repository.UserRepository; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootLifecycleEventApplication.class) +public class UserRepositoryIntegrationTest { + + @Autowired + private UserRepository userRepository; + + @Before + public void setup() { + User user = new User(); + user.setFirstName("Jane"); + user.setLastName("Smith"); + user.setUserName("jsmith123"); + userRepository.save(user); + } + + @After + public void cleanup() { + userRepository.deleteAll(); + } + + @Test + public void whenNewUserProvided_userIsAdded() { + User user = new User(); + user.setFirstName("John"); + user.setLastName("Doe"); + user.setUserName("jdoe123"); + user = userRepository.save(user); + assertTrue(user.getId() > 0); + } + + @Test + public void whenUserNameProvided_userIsLoaded() { + User user = userRepository.findByUserName("jsmith123"); + assertNotNull(user); + assertEquals("jsmith123", user.getUserName()); + } + + @Test + public void whenExistingUserProvided_userIsUpdated() { + User user = userRepository.findByUserName("jsmith123"); + user.setFirstName("Joe"); + user = userRepository.save(user); + assertEquals("Joe", user.getFirstName()); + } + + @Test + public void whenExistingUserDeleted_userIsDeleted() { + User user = userRepository.findByUserName("jsmith123"); + userRepository.delete(user); + user = userRepository.findByUserName("jsmith123"); + assertNull(user); + } + + @Test + public void whenExistingUserLoaded_fullNameIsAvailable() { + String expectedFullName = "Jane Smith"; + User user = userRepository.findByUserName("jsmith123"); + assertEquals(expectedFullName, user.getFullName()); + } +} From 2ca8ec847cc3f31e3fcba06f82e5ade64187cdb6 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 19 Jul 2020 14:30:00 +0530 Subject: [PATCH 0149/1862] JAVA-66: New module spring-data-jpa-crud --- .../spring-data-jpa-crud/README.md | 21 ++++ .../spring-data-jpa-crud/pom.xml | 71 ++++++++++++++ .../main/java/com/baeldung/Application.java | 14 +++ .../DatasourceProxyBeanPostProcessor.java | 53 ++++++++++ .../baeldung/batchinserts/model/School.java | 45 +++++++++ .../baeldung/batchinserts/model/Student.java | 44 +++++++++ .../java/com/baeldung/boot/Application.java | 17 ++++ .../boot/daos/CustomerRepository.java | 19 ++++ .../daos/impl/PersonInsertRepository.java | 31 ++++++ .../com/baeldung/boot/domain/Customer.java | 56 +++++++++++ .../java/com/baeldung/boot/domain/Person.java | 47 +++++++++ .../web/controllers/CustomerController.java | 41 ++++++++ .../baeldung/datajpadelete/entity/Book.java | 51 ++++++++++ .../datajpadelete/entity/Category.java | 60 ++++++++++++ .../repository/BookRepository.java | 19 ++++ .../repository/CategoryRepository.java | 9 ++ .../java/com/baeldung/entity/Employee.java | 36 +++++++ .../main/java/com/baeldung/entity/Fruit.java | 40 ++++++++ .../repository/EmployeeRepository.java | 9 ++ .../baeldung/repository/FruitRepository.java | 27 +++++ .../schemageneration/AccountApplication.java | 12 +++ .../schemageneration/HibernateUtil.java | 39 ++++++++ .../schemageneration/model/Account.java | 74 ++++++++++++++ .../model/AccountSetting.java | 68 +++++++++++++ .../repository/AccountRepository.java | 8 ++ .../repository/AccountSettingRepository.java | 8 ++ .../src/main/resources/application.properties | 14 +++ .../src/main/resources/logback.xml | 13 +++ .../java/com/baeldung/SpringContextTest.java | 17 ++++ .../SpringJpaContextIntegrationTest.java | 19 ++++ .../BatchInsertIntegrationTest.java | 40 ++++++++ .../JpaBatchInsertsIntegrationTest.java | 98 +++++++++++++++++++ .../JpaNoBatchInsertsIntegrationTest.java | 41 ++++++++ .../batchinserts/TestObjectHelper.java | 20 ++++ ...PersonInsertRepositoryIntegrationTest.java | 82 ++++++++++++++++ .../DeleteFromRepositoryUnitTest.java | 72 ++++++++++++++ .../DeleteInRelationshipsUnitTest.java | 60 ++++++++++++ .../EmployeeRepositoryIntegrationTest.java | 40 ++++++++ .../FruitRepositoryIntegrationTest.java | 75 ++++++++++++++ .../AccountRepositoryIntegrationTest.java | 72 ++++++++++++++ .../application-batchinserts.properties | 6 ++ .../resources/application-test.properties | 2 + .../src/test/resources/test-fruit-data.sql | 6 ++ 43 files changed, 1596 insertions(+) create mode 100644 persistence-modules/spring-data-jpa-crud/README.md create mode 100644 persistence-modules/spring-data-jpa-crud/pom.xml create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/Application.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/DatasourceProxyBeanPostProcessor.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/model/School.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/model/Student.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/Application.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/daos/CustomerRepository.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/daos/impl/PersonInsertRepository.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/domain/Customer.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/domain/Person.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/entity/Book.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/entity/Category.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/repository/BookRepository.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/repository/CategoryRepository.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/entity/Employee.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/entity/Fruit.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/repository/EmployeeRepository.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/repository/FruitRepository.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/AccountApplication.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/HibernateUtil.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/model/Account.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/model/AccountSetting.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/repository/AccountRepository.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/repository/AccountSettingRepository.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/resources/application.properties create mode 100644 persistence-modules/spring-data-jpa-crud/src/main/resources/logback.xml create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/SpringContextTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/BatchInsertIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/JpaBatchInsertsIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/JpaNoBatchInsertsIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/TestObjectHelper.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/boot/daos/PersonInsertRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/datajpadelete/DeleteFromRepositoryUnitTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/datajpadelete/DeleteInRelationshipsUnitTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/repository/EmployeeRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/repository/FruitRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/schemageneration/AccountRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/resources/application-batchinserts.properties create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/resources/application-test.properties create mode 100644 persistence-modules/spring-data-jpa-crud/src/test/resources/test-fruit-data.sql diff --git a/persistence-modules/spring-data-jpa-crud/README.md b/persistence-modules/spring-data-jpa-crud/README.md new file mode 100644 index 0000000000..dc0c78c87e --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/README.md @@ -0,0 +1,21 @@ +## Spring Data JPA - CRUD + +This module contains articles about CRUD operations in Spring Data JPA + +### Relevant Articles: +- [Spring Data JPA – Derived Delete Methods](https://www.baeldung.com/spring-data-jpa-deleteby) +- [Spring Data JPA Delete and Relationships](https://www.baeldung.com/spring-data-jpa-delete) +- [INSERT Statement in JPA](https://www.baeldung.com/jpa-insert) +- [Spring Data JPA Batch Inserts](https://www.baeldung.com/spring-data-jpa-batch-inserts) +- [Batch Insert/Update with Hibernate/JPA](https://www.baeldung.com/jpa-hibernate-batch-insert-update) +- [Difference Between save() and saveAndFlush() in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-save-saveandflush) +- [Generate Database Schema with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-generate-db-schema) + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator diff --git a/persistence-modules/spring-data-jpa-crud/pom.xml b/persistence-modules/spring-data-jpa-crud/pom.xml new file mode 100644 index 0000000000..1708d14fc2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + spring-data-jpa-crud + spring-data-jpa-crud + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + + + com.google.guava + guava + ${guava.version} + + + com.h2database + h2 + + + net.ttddyy + datasource-proxy + ${datasource-proxy.version} + + + org.postgresql + postgresql + + + com.h2database + h2 + runtime + + + + + org.testcontainers + postgresql + ${testcontainers.version} + test + + + + + + 1.4.1 + 21.0 + 1.12.2 + + + diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..ce10072031 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/Application.java @@ -0,0 +1,14 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication +@EnableJpaRepositories +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/DatasourceProxyBeanPostProcessor.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/DatasourceProxyBeanPostProcessor.java new file mode 100644 index 0000000000..504357db44 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/DatasourceProxyBeanPostProcessor.java @@ -0,0 +1,53 @@ +package com.baeldung.batchinserts; + +import java.lang.reflect.Method; +import javax.sql.DataSource; +import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; +import org.springframework.aop.framework.ProxyFactory; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; +import org.springframework.util.ReflectionUtils; + +@Component +@Profile("batchinserts") +public class DatasourceProxyBeanPostProcessor implements BeanPostProcessor { + + @Override + public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException { + return bean; + } + + @Override + public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException { + if (bean instanceof DataSource) { + ProxyFactory factory = new ProxyFactory(bean); + factory.setProxyTargetClass(true); + factory.addAdvice(new ProxyDataSourceInterceptor((DataSource) bean)); + return factory.getProxy(); + } + + return bean; + } + + private static class ProxyDataSourceInterceptor implements MethodInterceptor { + + private final DataSource dataSource; + + public ProxyDataSourceInterceptor(final DataSource dataSource) { + this.dataSource = ProxyDataSourceBuilder.create(dataSource).name("Batch-Insert-Logger").asJson().countQuery().logQueryToSysOut().build(); + } + + @Override + public Object invoke(final MethodInvocation invocation) throws Throwable { + Method proxyMethod = ReflectionUtils.findMethod(dataSource.getClass(), invocation.getMethod().getName()); + if (proxyMethod != null) { + return proxyMethod.invoke(dataSource, invocation.getArguments()); + } + return invocation.proceed(); + } + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/model/School.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/model/School.java new file mode 100644 index 0000000000..6d2f333ac7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/model/School.java @@ -0,0 +1,45 @@ +package com.baeldung.batchinserts.model; + +import java.util.List; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; + +@Entity +public class School { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE) + private long id; + + private String name; + + @OneToMany(mappedBy = "school") + private List students; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getStudents() { + return students; + } + + public void setStudents(List students) { + this.students = students; + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/model/Student.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/model/Student.java new file mode 100644 index 0000000000..d38214f122 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/batchinserts/model/Student.java @@ -0,0 +1,44 @@ +package com.baeldung.batchinserts.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +public class Student { + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE) + private long id; + + private String name; + + @ManyToOne + private School school; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public School getSchool() { + return school; + } + + public void setSchool(School school) { + this.school = school; + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/Application.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/Application.java new file mode 100644 index 0000000000..aaca760499 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/Application.java @@ -0,0 +1,17 @@ +package com.baeldung.boot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication +@EnableJpaRepositories("com.baeldung") +@EntityScan("com.baeldung") +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/daos/CustomerRepository.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/daos/CustomerRepository.java new file mode 100644 index 0000000000..7cb7e45b27 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/daos/CustomerRepository.java @@ -0,0 +1,19 @@ +package com.baeldung.boot.daos; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.boot.domain.Customer; + +/** + * JPA CrudRepository interface + * + * @author ysharma2512 + * + */ +@Repository +@Transactional +public interface CustomerRepository extends CrudRepository{ + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/daos/impl/PersonInsertRepository.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/daos/impl/PersonInsertRepository.java new file mode 100644 index 0000000000..373532e1c3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/daos/impl/PersonInsertRepository.java @@ -0,0 +1,31 @@ +package com.baeldung.boot.daos.impl; + +import org.springframework.stereotype.Repository; + +import com.baeldung.boot.domain.Person; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.transaction.Transactional; + +@Repository +public class PersonInsertRepository { + + @PersistenceContext + private EntityManager entityManager; + + @Transactional + public void insertWithQuery(Person person) { + entityManager.createNativeQuery("INSERT INTO person (id, first_name, last_name) VALUES (?,?,?)") + .setParameter(1, person.getId()) + .setParameter(2, person.getFirstName()) + .setParameter(3, person.getLastName()) + .executeUpdate(); + } + + @Transactional + public void insertWithEntityManager(Person person) { + this.entityManager.persist(person); + } + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/domain/Customer.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/domain/Customer.java new file mode 100644 index 0000000000..af88be0be6 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/domain/Customer.java @@ -0,0 +1,56 @@ +package com.baeldung.boot.domain; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +/** + * Customer Entity class + * @author ysharma2512 + * + */ +@Entity +public class Customer { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + private String firstName; + private String lastName; + + public Customer(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @Override + public String toString() { + return String.format("Customer[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName); + } + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/domain/Person.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/domain/Person.java new file mode 100644 index 0000000000..88894ccc72 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/domain/Person.java @@ -0,0 +1,47 @@ +package com.baeldung.boot.domain; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Person { + + @Id + private Long id; + private String firstName; + private String lastName; + + public Person() { + } + + public Person(Long id, String firstName, String lastName) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java new file mode 100644 index 0000000000..e13afd9b45 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java @@ -0,0 +1,41 @@ +package com.baeldung.boot.web.controllers; + +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.List; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.boot.daos.CustomerRepository; +import com.baeldung.boot.domain.Customer; + +/** + * A simple controller to test the JPA CrudRepository operations + * controllers + * + * @author ysharma2512 + * + */ +@RestController +public class CustomerController { + + CustomerRepository customerRepository; + + public CustomerController(CustomerRepository customerRepository2) { + this.customerRepository = customerRepository2; + } + + @PostMapping("/customers") + public ResponseEntity> insertCustomers() throws URISyntaxException { + Customer c1 = new Customer("James", "Gosling"); + Customer c2 = new Customer("Doug", "Lea"); + Customer c3 = new Customer("Martin", "Fowler"); + Customer c4 = new Customer("Brian", "Goetz"); + List customers = Arrays.asList(c1, c2, c3, c4); + customerRepository.saveAll(customers); + return ResponseEntity.ok(customers); + } + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/entity/Book.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/entity/Book.java new file mode 100644 index 0000000000..deac24548a --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/entity/Book.java @@ -0,0 +1,51 @@ +package com.baeldung.datajpadelete.entity; + +import javax.persistence.*; + +@Entity +public class Book { + + @Id + @GeneratedValue + private Long id; + private String title; + + @ManyToOne + private Category category; + + public Book() { + } + + public Book(String title) { + this.title = title; + } + + public Book(String title, Category category) { + this.title = title; + this.category = category; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/entity/Category.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/entity/Category.java new file mode 100644 index 0000000000..16f1a4157f --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/entity/Category.java @@ -0,0 +1,60 @@ +package com.baeldung.datajpadelete.entity; + +import javax.persistence.*; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Entity +public class Category { + + @Id + @GeneratedValue + private Long id; + private String name; + + @OneToMany(mappedBy = "category", cascade = CascadeType.ALL, orphanRemoval = true) + private List books; + + public Category() { + } + + public Category(String name) { + this.name = name; + } + + public Category(String name, Book... books) { + this.name = name; + this.books = Stream.of(books).collect(Collectors.toList()); + this.books.forEach(x -> x.setCategory(this)); + } + + public Category(String name, List books) { + this.name = name; + this.books = books; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getBooks() { + return books; + } + + public void setBooks(List books) { + this.books = books; + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/repository/BookRepository.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/repository/BookRepository.java new file mode 100644 index 0000000000..5d0f45f127 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/repository/BookRepository.java @@ -0,0 +1,19 @@ +package com.baeldung.datajpadelete.repository; + +import com.baeldung.datajpadelete.entity.Book; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +@Repository +public interface BookRepository extends CrudRepository { + + long deleteByTitle(String title); + + @Modifying + @Query("delete from Book b where b.title=:title") + void deleteBooks(@Param("title") String title); + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/repository/CategoryRepository.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/repository/CategoryRepository.java new file mode 100644 index 0000000000..6fe7058a78 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/datajpadelete/repository/CategoryRepository.java @@ -0,0 +1,9 @@ +package com.baeldung.datajpadelete.repository; + +import com.baeldung.datajpadelete.entity.Category; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CategoryRepository extends CrudRepository { +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/entity/Employee.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/entity/Employee.java new file mode 100644 index 0000000000..4c3dbd25b7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/entity/Employee.java @@ -0,0 +1,36 @@ +package com.baeldung.entity; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Employee { + + @Id + private Long id; + private String name; + + public Employee() { + } + + public Employee(Long id, String name) { + this.id = id; + this.name = name; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/entity/Fruit.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/entity/Fruit.java new file mode 100644 index 0000000000..d45ac33db8 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/entity/Fruit.java @@ -0,0 +1,40 @@ +package com.baeldung.entity; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +@Entity +public class Fruit { + + @Id + private long id; + private String name; + private String color; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/repository/EmployeeRepository.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/repository/EmployeeRepository.java new file mode 100644 index 0000000000..8f0a80814b --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/repository/EmployeeRepository.java @@ -0,0 +1,9 @@ +package com.baeldung.repository; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.baeldung.entity.Employee; + +public interface EmployeeRepository extends JpaRepository { + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/repository/FruitRepository.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/repository/FruitRepository.java new file mode 100644 index 0000000000..5055252adf --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/repository/FruitRepository.java @@ -0,0 +1,27 @@ +package com.baeldung.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.baeldung.entity.Fruit; + +@Repository +public interface FruitRepository extends JpaRepository { + + Long deleteByName(String name); + + List deleteByColor(String color); + + Long removeByName(String name); + + List removeByColor(String color); + + @Modifying + @Query("delete from Fruit f where f.name=:name or f.color=:color") + int deleteFruits(@Param("name") String name, @Param("color") String color); +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/AccountApplication.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/AccountApplication.java new file mode 100644 index 0000000000..547992a6c1 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/AccountApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.schemageneration; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class AccountApplication { + + public static void main(String[] args) { + SpringApplication.run(AccountApplication.class, args); + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/HibernateUtil.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/HibernateUtil.java new file mode 100644 index 0000000000..7d69d65705 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/HibernateUtil.java @@ -0,0 +1,39 @@ +package com.baeldung.schemageneration; + +import com.baeldung.schemageneration.model.Account; +import com.baeldung.schemageneration.model.AccountSetting; +import org.hibernate.boot.Metadata; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.registry.StandardServiceRegistry; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.cfg.Environment; +import org.hibernate.tool.hbm2ddl.SchemaExport; +import org.hibernate.tool.schema.TargetType; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class HibernateUtil { + + /** + * Generates database create commands for the specified entities using Hibernate native API, SchemaExport. + * Creation commands are exported into the create.sql file. + */ + public static void generateSchema() { + Map settings = new HashMap<>(); + settings.put(Environment.URL, "jdbc:h2:mem:schema"); + + StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(settings).build(); + + MetadataSources metadataSources = new MetadataSources(serviceRegistry); + metadataSources.addAnnotatedClass(Account.class); + metadataSources.addAnnotatedClass(AccountSetting.class); + Metadata metadata = metadataSources.buildMetadata(); + + SchemaExport schemaExport = new SchemaExport(); + schemaExport.setFormat(true); + schemaExport.setOutputFile("create.sql"); + schemaExport.createOnly(EnumSet.of(TargetType.SCRIPT), metadata); + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/model/Account.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/model/Account.java new file mode 100644 index 0000000000..785e275e26 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/model/Account.java @@ -0,0 +1,74 @@ +package com.baeldung.schemageneration.model; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import java.util.ArrayList; +import java.util.List; + +@Entity +@Table(name = "accounts") +public class Account { + + @Id + @GeneratedValue + private Long id; + + @Column(nullable = false, length = 100) + private String name; + + @Column(name = "email_address") + private String emailAddress; + + @OneToMany(mappedBy = "account", cascade = CascadeType.ALL) + private List accountSettings = new ArrayList<>(); + + public Account() { + } + + public Account(String name, String emailAddress) { + this.name = name; + this.emailAddress = emailAddress; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public List getAccountSettings() { + return accountSettings; + } + + public void setAccountSettings(List accountSettings) { + this.accountSettings = accountSettings; + } + + public void addAccountSetting(AccountSetting setting) { + this.accountSettings.add(setting); + setting.setAccount(this); + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/model/AccountSetting.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/model/AccountSetting.java new file mode 100644 index 0000000000..61e43894a8 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/model/AccountSetting.java @@ -0,0 +1,68 @@ +package com.baeldung.schemageneration.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "account_settings") +public class AccountSetting { + + @Id + @GeneratedValue + private Long id; + + @Column(name = "name", nullable = false) + private String settingName; + + @Column(name = "value", nullable = false) + private String settingValue; + + @ManyToOne() + @JoinColumn(name ="account_id", nullable = false) + private Account account; + + public AccountSetting() { + } + + public AccountSetting(String settingName, String settingValue) { + this.settingName = settingName; + this.settingValue = settingValue; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSettingName() { + return settingName; + } + + public void setSettingName(String settingName) { + this.settingName = settingName; + } + + public String getSettingValue() { + return settingValue; + } + + public void setSettingValue(String settingValue) { + this.settingValue = settingValue; + } + + public Account getAccount() { + return account; + } + + public void setAccount(Account account) { + this.account = account; + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/repository/AccountRepository.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/repository/AccountRepository.java new file mode 100644 index 0000000000..dc57ffe6d3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/repository/AccountRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.schemageneration.repository; + +import com.baeldung.schemageneration.model.Account; +import org.springframework.data.repository.CrudRepository; + +public interface AccountRepository extends CrudRepository { + Account findByName(String name); +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/repository/AccountSettingRepository.java b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/repository/AccountSettingRepository.java new file mode 100644 index 0000000000..c2b8ff7398 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/java/com/baeldung/schemageneration/repository/AccountSettingRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.schemageneration.repository; + +import com.baeldung.schemageneration.model.AccountSetting; +import org.springframework.data.repository.CrudRepository; + +public interface AccountSettingRepository extends CrudRepository { + AccountSetting findByAccountId(Long accountId); +} diff --git a/persistence-modules/spring-data-jpa-crud/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-crud/src/main/resources/application.properties new file mode 100644 index 0000000000..af0df308cd --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/resources/application.properties @@ -0,0 +1,14 @@ +spring.main.allow-bean-definition-overriding=true + +spring.jpa.properties.hibernate.jdbc.batch_size=4 +spring.jpa.properties.hibernate.order_inserts=true +spring.jpa.properties.hibernate.order_updates=true +spring.jpa.properties.hibernate.generate_statistics=true + +# JPA-Schema-Generation +# Use below configuration to generate database schema create commands based on the entity models +# and export them into the create.sql file +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-source=metadata +#spring.jpa.properties.hibernate.format_sql=true \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa-crud/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/SpringContextTest.java new file mode 100644 index 0000000000..eaccf4acba --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/SpringContextTest.java @@ -0,0 +1,17 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java new file mode 100644 index 0000000000..27c71c5bcc --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java @@ -0,0 +1,19 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; + +@RunWith(SpringRunner.class) +@DataJpaTest +@ContextConfiguration(classes = Application.class) +public class SpringJpaContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/BatchInsertIntegrationTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/BatchInsertIntegrationTest.java new file mode 100644 index 0000000000..7ddf36d3f0 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/BatchInsertIntegrationTest.java @@ -0,0 +1,40 @@ +package com.baeldung.batchinserts; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import com.baeldung.boot.Application; +import com.baeldung.boot.daos.CustomerRepository; +import com.baeldung.boot.web.controllers.CustomerController; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes=Application.class) +@AutoConfigureMockMvc +public class BatchInsertIntegrationTest { + + @Autowired + private CustomerRepository customerRepository; + private MockMvc mockMvc; + @Before + public void setUp() throws Exception { + mockMvc = MockMvcBuilders.standaloneSetup( new CustomerController(customerRepository)) + .build(); + } + + @Test + public void whenInsertingCustomers_thenCustomersAreCreated() throws Exception { + this.mockMvc.perform(post("/customers")) + .andExpect(status().isOk()); + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/JpaBatchInsertsIntegrationTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/JpaBatchInsertsIntegrationTest.java new file mode 100644 index 0000000000..311f227322 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/JpaBatchInsertsIntegrationTest.java @@ -0,0 +1,98 @@ +package com.baeldung.batchinserts; + +import static com.baeldung.batchinserts.TestObjectHelper.createSchool; +import static com.baeldung.batchinserts.TestObjectHelper.createStudent; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.TypedQuery; + +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.batchinserts.model.School; +import com.baeldung.batchinserts.model.Student; +import com.baeldung.boot.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@Transactional +@ActiveProfiles("batchinserts") +public class JpaBatchInsertsIntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + private static final int BATCH_SIZE = 5; + + @Transactional + @Test + public void whenInsertingSingleTypeOfEntity_thenCreatesSingleBatch() { + for (int i = 0; i < 10; i++) { + School school = createSchool(i); + entityManager.persist(school); + } + } + + @Transactional + @Test + public void whenFlushingAfterBatch_ThenClearsMemory() { + for (int i = 0; i < 10; i++) { + if (i > 0 && i % BATCH_SIZE == 0) { + entityManager.flush(); + entityManager.clear(); + } + + School school = createSchool(i); + entityManager.persist(school); + } + } + + @Transactional + @Test + public void whenThereAreMultipleEntities_ThenCreatesNewBatch() { + for (int i = 0; i < 10; i++) { + if (i > 0 && i % BATCH_SIZE == 0) { + entityManager.flush(); + entityManager.clear(); + } + + School school = createSchool(i); + entityManager.persist(school); + Student firstStudent = createStudent(school); + Student secondStudent = createStudent(school); + entityManager.persist(firstStudent); + entityManager.persist(secondStudent); + } + } + + @Transactional + @Test + public void whenUpdatingEntities_thenCreatesBatch() { + for (int i = 0; i < 10; i++) { + School school = createSchool(i); + entityManager.persist(school); + } + + entityManager.flush(); + + TypedQuery schoolQuery = entityManager.createQuery("SELECT s from School s", School.class); + List allSchools = schoolQuery.getResultList(); + + for (School school : allSchools) { + school.setName("Updated_" + school.getName()); + } + } + + @After + public void tearDown() { + entityManager.flush(); + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/JpaNoBatchInsertsIntegrationTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/JpaNoBatchInsertsIntegrationTest.java new file mode 100644 index 0000000000..75b3f1f3aa --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/JpaNoBatchInsertsIntegrationTest.java @@ -0,0 +1,41 @@ +package com.baeldung.batchinserts; + +import static com.baeldung.batchinserts.TestObjectHelper.createSchool; + +import com.baeldung.batchinserts.model.School; +import com.baeldung.boot.Application; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@Transactional +@ActiveProfiles("batchinserts") +@TestPropertySource(properties = "spring.jpa.properties.hibernate.jdbc.batch_size=-1") +public class JpaNoBatchInsertsIntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + @Test + public void whenNotConfigured_ThenSendsInsertsSeparately() { + for (int i = 0; i < 10; i++) { + School school = createSchool(i); + entityManager.persist(school); + } + } + + @After + public void tearDown() { + entityManager.flush(); + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/TestObjectHelper.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/TestObjectHelper.java new file mode 100644 index 0000000000..fcd26cb721 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/batchinserts/TestObjectHelper.java @@ -0,0 +1,20 @@ +package com.baeldung.batchinserts; + +import com.baeldung.batchinserts.model.School; +import com.baeldung.batchinserts.model.Student; + +public class TestObjectHelper { + + public static School createSchool(int nameIdentifier) { + School school = new School(); + school.setName("School" + (nameIdentifier + 1)); + return school; + } + + public static Student createStudent(School school) { + Student student = new Student(); + student.setName("Student-" + school.getName()); + student.setSchool(school); + return student; + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/boot/daos/PersonInsertRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/boot/daos/PersonInsertRepositoryIntegrationTest.java new file mode 100644 index 0000000000..9d45c17035 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/boot/daos/PersonInsertRepositoryIntegrationTest.java @@ -0,0 +1,82 @@ +package com.baeldung.boot.daos; + +import com.baeldung.boot.daos.impl.PersonInsertRepository; +import com.baeldung.boot.domain.Person; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.persistence.EntityExistsException; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceException; + +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +@RunWith(SpringRunner.class) +@DataJpaTest +@Import(PersonInsertRepository.class) +public class PersonInsertRepositoryIntegrationTest { + + private static final Long ID = 1L; + private static final String FIRST_NAME = "firstname"; + private static final String LAST_NAME = "lastname"; + private static final Person PERSON = new Person(ID, FIRST_NAME, LAST_NAME); + + @Autowired + private PersonInsertRepository personInsertRepository; + + @Autowired + private EntityManager entityManager; + + @Test + public void givenPersonEntity_whenInsertWithNativeQuery_ThenPersonIsPersisted() { + insertWithQuery(); + + assertPersonPersisted(); + } + + @Test + public void givenPersonEntity_whenInsertedTwiceWithNativeQuery_thenPersistenceExceptionExceptionIsThrown() { + assertThatExceptionOfType(PersistenceException.class).isThrownBy(() -> { + insertWithQuery(); + insertWithQuery(); + }); + } + + @Test + public void givenPersonEntity_whenInsertWithEntityManager_thenPersonIsPersisted() { + insertPersonWithEntityManager(); + + assertPersonPersisted(); + } + + @Test + public void givenPersonEntity_whenInsertedTwiceWithEntityManager_thenEntityExistsExceptionIsThrown() { + assertThatExceptionOfType(EntityExistsException.class).isThrownBy(() -> { + insertPersonWithEntityManager(); + insertPersonWithEntityManager(); + }); + } + + private void insertWithQuery() { + personInsertRepository.insertWithQuery(PERSON); + } + + private void insertPersonWithEntityManager() { + personInsertRepository.insertWithEntityManager(new Person(ID, FIRST_NAME, LAST_NAME)); + } + + private void assertPersonPersisted() { + Person person = entityManager.find(Person.class, ID); + + assertThat(person).isNotNull(); + assertThat(person.getId()).isEqualTo(PERSON.getId()); + assertThat(person.getFirstName()).isEqualTo(PERSON.getFirstName()); + assertThat(person.getLastName()).isEqualTo(PERSON.getLastName()); + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/datajpadelete/DeleteFromRepositoryUnitTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/datajpadelete/DeleteFromRepositoryUnitTest.java new file mode 100644 index 0000000000..5f4a36bc0e --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/datajpadelete/DeleteFromRepositoryUnitTest.java @@ -0,0 +1,72 @@ +package com.baeldung.datajpadelete; + +import com.baeldung.Application; +import com.baeldung.datajpadelete.entity.Book; +import com.baeldung.datajpadelete.repository.BookRepository; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {Application.class}) +public class DeleteFromRepositoryUnitTest { + + @Autowired + private BookRepository repository; + + Book book1; + Book book2; + + @Before + public void setup() { + book1 = new Book("The Hobbit"); + book2 = new Book("All Quiet on the Western Front"); + + repository.saveAll(Arrays.asList(book1, book2)); + } + + @After + public void teardown() { + repository.deleteAll(); + } + + @Test + public void whenDeleteByIdFromRepository_thenDeletingShouldBeSuccessful() { + repository.deleteById(book1.getId()); + + assertThat(repository.count()).isEqualTo(1); + } + + @Test + public void whenDeleteAllFromRepository_thenRepositoryShouldBeEmpty() { + repository.deleteAll(); + + assertThat(repository.count()).isEqualTo(0); + } + + @Test + @Transactional + public void whenDeleteFromDerivedQuery_thenDeletingShouldBeSuccessful() { + long deletedRecords = repository.deleteByTitle("The Hobbit"); + + assertThat(deletedRecords).isEqualTo(1); + } + + @Test + @Transactional + public void whenDeleteFromCustomQuery_thenDeletingShouldBeSuccessful() { + repository.deleteBooks("The Hobbit"); + + assertThat(repository.count()).isEqualTo(1); + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/datajpadelete/DeleteInRelationshipsUnitTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/datajpadelete/DeleteInRelationshipsUnitTest.java new file mode 100644 index 0000000000..6275ace6e0 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/datajpadelete/DeleteInRelationshipsUnitTest.java @@ -0,0 +1,60 @@ +package com.baeldung.datajpadelete; + +import com.baeldung.Application; +import com.baeldung.datajpadelete.entity.Book; +import com.baeldung.datajpadelete.entity.Category; +import com.baeldung.datajpadelete.repository.BookRepository; +import com.baeldung.datajpadelete.repository.CategoryRepository; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {Application.class}) +public class DeleteInRelationshipsUnitTest { + + @Autowired + private BookRepository bookRepository; + + @Autowired + private CategoryRepository categoryRepository; + + @Before + public void setup() { + Book book1 = new Book("The Hobbit"); + Category category1 = new Category("Cat1", book1); + categoryRepository.save(category1); + + Book book2 = new Book("All Quiet on the Western Front"); + Category category2 = new Category("Cat2", book2); + categoryRepository.save(category2); + } + + @After + public void teardown() { + bookRepository.deleteAll(); + categoryRepository.deleteAll(); + } + + @Test + public void whenDeletingCategories_thenBooksShouldAlsoBeDeleted() { + categoryRepository.deleteAll(); + + assertThat(bookRepository.count()).isEqualTo(0); + assertThat(categoryRepository.count()).isEqualTo(0); + } + + @Test + public void whenDeletingBooks_thenCategoriesShouldAlsoBeDeleted() { + bookRepository.deleteAll(); + + assertThat(bookRepository.count()).isEqualTo(0); + assertThat(categoryRepository.count()).isEqualTo(2); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/repository/EmployeeRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/repository/EmployeeRepositoryIntegrationTest.java new file mode 100644 index 0000000000..0fc9918701 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/repository/EmployeeRepositoryIntegrationTest.java @@ -0,0 +1,40 @@ +package com.baeldung.repository; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; +import com.baeldung.entity.Employee; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class EmployeeRepositoryIntegrationTest { + + private static final Employee EMPLOYEE1 = new Employee(1L, "John"); + private static final Employee EMPLOYEE2 = new Employee(2L, "Alice"); + + @Autowired + private EmployeeRepository employeeRepository; + + @Test + public void givenEmployeeEntity_whenInsertWithSave_ThenEmployeeIsPersisted() { + employeeRepository.save(EMPLOYEE1); + assertEmployeePersisted(EMPLOYEE1); + } + + @Test + public void givenEmployeeEntity_whenInsertWithSaveAndFlush_ThenEmployeeIsPersisted() { + employeeRepository.saveAndFlush(EMPLOYEE2); + assertEmployeePersisted(EMPLOYEE2); + } + + private void assertEmployeePersisted(Employee input) { + Employee employee = employeeRepository.getOne(input.getId()); + assertThat(employee).isNotNull(); + } +} diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/repository/FruitRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/repository/FruitRepositoryIntegrationTest.java new file mode 100644 index 0000000000..cf771dc833 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/repository/FruitRepositoryIntegrationTest.java @@ -0,0 +1,75 @@ +package com.baeldung.repository; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.entity.Fruit; + +@RunWith(SpringRunner.class) +@SpringBootTest +class FruitRepositoryIntegrationTest { + + @Autowired + private FruitRepository fruitRepository; + + @Transactional + @Test + @Sql(scripts = { "/test-fruit-data.sql" }) + public void givenFruits_WhenDeletedByColor_ThenDeletedFruitsShouldReturn() { + + List fruits = fruitRepository.deleteByColor("green"); + + assertEquals("number of fruits are not matching", 2, fruits.size()); + fruits.forEach(fruit -> assertEquals("Its not a green fruit", "green", fruit.getColor())); + } + + @Transactional + @Test + @Sql(scripts = { "/test-fruit-data.sql" }) + public void givenFruits_WhenDeletedByName_ThenDeletedFruitCountShouldReturn() { + + Long deletedFruitCount = fruitRepository.deleteByName("apple"); + + assertEquals("deleted fruit count is not matching", 1, deletedFruitCount.intValue()); + } + + @Transactional + @Test + @Sql(scripts = { "/test-fruit-data.sql" }) + public void givenFruits_WhenRemovedByColor_ThenDeletedFruitsShouldReturn() { + + List fruits = fruitRepository.removeByColor("green"); + + assertEquals("number of fruits are not matching", 2, fruits.size()); + fruits.forEach(fruit -> assertEquals("Its not a green fruit", "green", fruit.getColor())); + } + + @Transactional + @Test + @Sql(scripts = { "/test-fruit-data.sql" }) + public void givenFruits_WhenRemovedByName_ThenDeletedFruitCountShouldReturn() { + + Long deletedFruitCount = fruitRepository.removeByName("apple"); + + assertEquals("deleted fruit count is not matching", 1, deletedFruitCount.intValue()); + } + + @Transactional + @Test + @Sql(scripts = { "/test-fruit-data.sql" }) + public void givenFruits_WhenDeletedByColorOrName_ThenDeletedFruitsShouldReturn() { + + int deletedCount = fruitRepository.deleteFruits("apple", "green"); + + assertEquals("number of fruits are not matching", 3, deletedCount); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/schemageneration/AccountRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/schemageneration/AccountRepositoryIntegrationTest.java new file mode 100644 index 0000000000..86a7671fe4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/java/com/baeldung/schemageneration/AccountRepositoryIntegrationTest.java @@ -0,0 +1,72 @@ +package com.baeldung.schemageneration; + +import com.baeldung.schemageneration.model.Account; +import com.baeldung.schemageneration.model.AccountSetting; +import com.baeldung.schemageneration.repository.AccountRepository; +import com.baeldung.schemageneration.repository.AccountSettingRepository; +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = AccountApplication.class) +public class AccountRepositoryIntegrationTest { + + private static final String USER_NAME = "Eduard"; + private static final String USER_EMAIL_ADDRESS = "eduard@gmx.com"; + private static final String ACCOUNT_SETTING_NAME = "Timezone"; + private static final String ACCOUNT_SETTING_VALUE = "UTC+02"; + + @Autowired + private AccountRepository accountRepository; + + @Autowired + private AccountSettingRepository accountSettingRepository; + + @After + public void tearDown() { + accountRepository.deleteAll(); + } + + @Test + public void givenNewAccount_whenSave_thenSuccess() { + Account account = new Account(USER_NAME, USER_EMAIL_ADDRESS); + accountRepository.save(account); + + assertEquals(1, accountRepository.count()); + } + + @Test + public void givenSavedAccount_whenFindByName_thenFound() { + Account account = new Account(USER_NAME, USER_EMAIL_ADDRESS); + accountRepository.save(account); + + Account accountFound = accountRepository.findByName(USER_NAME); + + assertNotNull(accountFound); + assertEquals(USER_NAME, accountFound.getName()); + assertEquals(USER_EMAIL_ADDRESS, accountFound.getEmailAddress()); + } + + @Test + public void givenSavedAccount_whenAccountSettingIsAdded_thenPersisted() { + Account account = new Account(USER_NAME, USER_EMAIL_ADDRESS); + account.addAccountSetting(new AccountSetting(ACCOUNT_SETTING_NAME, ACCOUNT_SETTING_VALUE)); + accountRepository.save(account); + + Account accountFound = accountRepository.findByName(USER_NAME); + assertNotNull(accountFound); + AccountSetting accountSetting = accountSettingRepository.findByAccountId(accountFound.getId()); + + assertNotNull(accountSetting); + assertEquals(ACCOUNT_SETTING_NAME, accountSetting.getSettingName()); + assertEquals(ACCOUNT_SETTING_VALUE, accountSetting.getSettingValue()); + } + +} diff --git a/persistence-modules/spring-data-jpa-crud/src/test/resources/application-batchinserts.properties b/persistence-modules/spring-data-jpa-crud/src/test/resources/application-batchinserts.properties new file mode 100644 index 0000000000..4141f5668e --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/resources/application-batchinserts.properties @@ -0,0 +1,6 @@ +spring.jpa.show-sql=false + +spring.jpa.properties.hibernate.jdbc.batch_size=5 +spring.jpa.properties.hibernate.order_inserts=true +spring.jpa.properties.hibernate.order_updates=true +spring.jpa.properties.hibernate.batch_versioned_data=true \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/test/resources/application-test.properties b/persistence-modules/spring-data-jpa-crud/src/test/resources/application-test.properties new file mode 100644 index 0000000000..f9497c8f37 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/resources/application-test.properties @@ -0,0 +1,2 @@ +spring.jpa.hibernate.ddl-auto=update +spring.datasource.url=jdbc:h2:mem:jpa3 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/src/test/resources/test-fruit-data.sql b/persistence-modules/spring-data-jpa-crud/src/test/resources/test-fruit-data.sql new file mode 100644 index 0000000000..d99f42e5a7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-crud/src/test/resources/test-fruit-data.sql @@ -0,0 +1,6 @@ +truncate table fruit; + +insert into fruit(id,name,color) values (1,'apple','red'); +insert into fruit(id,name,color) values (2,'custard apple','green'); +insert into fruit(id,name,color) values (3,'mango','yellow'); +insert into fruit(id,name,color) values (4,'guava','green'); \ No newline at end of file From 2f815070760802c98023faff9969e8483d6e4661 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 19 Jul 2020 14:30:26 +0530 Subject: [PATCH 0150/1862] JAVA-66: New module spring-data-jpa-enterprise --- .../spring-data-jpa-enterprise/README.md | 24 + .../spring-data-jpa-enterprise/pom.xml | 107 ++++ .../main/java/com/baeldung/Application.java | 13 + .../java/com/baeldung/boot/Application.java | 17 + .../boot/config/PersistenceConfiguration.java | 23 + .../boot/daos/IBarCrudRepository.java | 11 + .../java/com/baeldung/boot/daos/IFooDao.java | 13 + .../boot/daos/user/UserRepository.java | 99 ++++ .../boot/daos/user/UserRepositoryCustom.java | 14 + .../daos/user/UserRepositoryCustomImpl.java | 57 ++ .../java/com/baeldung/boot/domain/Bar.java | 220 +++++++ .../java/com/baeldung/boot/domain/Foo.java | 94 +++ .../com/baeldung/boot/domain/Possession.java | 83 +++ .../java/com/baeldung/boot/domain/User.java | 132 +++++ .../baeldung/boot/services/IBarService.java | 7 + .../baeldung/boot/services/IFooService.java | 14 + .../baeldung/boot/services/IOperations.java | 26 + .../boot/services/impl/AbstractService.java | 61 ++ .../impl/AbstractSpringDataJpaService.java | 45 ++ .../impl/BarSpringDataJpaService.java | 31 + .../boot/services/impl/FooService.java | 55 ++ .../ElementCollectionApplication.java | 11 + .../elementcollection/model/Employee.java | 68 +++ .../elementcollection/model/Phone.java | 62 ++ .../repository/EmployeeRepository.java | 46 ++ .../multipledb/MultipleDbApplication.java | 14 + .../PersistenceProductAutoConfiguration.java | 71 +++ .../PersistenceProductConfiguration.java | 68 +++ .../PersistenceUserAutoConfiguration.java | 75 +++ .../PersistenceUserConfiguration.java | 69 +++ .../dao/product/ProductRepository.java | 14 + .../dao/user/PossessionRepository.java | 9 + .../multipledb/dao/user/UserRepository.java | 8 + .../multipledb/model/product/Product.java | 67 +++ .../model/user/PossessionMultipleDB.java | 82 +++ .../multipledb/model/user/UserMultipleDB.java | 88 +++ .../com/baeldung/namingstrategy/Person.java | 35 ++ .../namingstrategy/PersonRepository.java | 6 + .../QuotedLowerCaseNamingStrategy.java | 12 + .../QuotedUpperCaseNamingStrategy.java | 12 + ...ingDataJpaNamingConventionApplication.java | 7 + .../UnquotedLowerCaseNamingStrategy.java | 12 + .../UnquotedUpperCaseNamingStrategy.java | 12 + .../com/baeldung/osiv/OsivApplication.java | 13 + .../com/baeldung/osiv/model/BasicUser.java | 42 ++ .../osiv/repository/BasicUserRepository.java | 19 + .../osiv/service/SimpleUserService.java | 25 + .../baeldung/osiv/service/UserService.java | 9 + .../baeldung/osiv/web/DetailedUserDto.java | 45 ++ .../com/baeldung/osiv/web/UserController.java | 27 + .../PartialUpdateApplication.java | 12 + .../partialupdate/model/ContactPhone.java | 22 + .../partialupdate/model/Customer.java | 23 + .../partialupdate/model/CustomerDto.java | 31 + .../model/CustomerStructured.java | 27 + .../repository/ContactPhoneRepository.java | 12 + .../repository/CustomerRepository.java | 18 + .../CustomerStructuredRepository.java | 11 + .../service/CustomerService.java | 87 +++ .../partialupdate/util/CustomerMapper.java | 15 + .../src/main/resources/application.properties | 16 + .../persistence-multiple-db-boot.properties | 11 + .../persistence-multiple-db.properties | 13 + .../java/com/baeldung/SpringContextTest.java | 17 + .../SpringJpaContextIntegrationTest.java | 25 + .../boot/daos/UserRepositoryCommon.java | 545 ++++++++++++++++++ .../daos/UserRepositoryIntegrationTest.java | 37 ++ .../daos/UserRepositoryTCAutoLiveTest.java | 43 ++ .../boot/daos/UserRepositoryTCLiveTest.java | 58 ++ ...ractServicePersistenceIntegrationTest.java | 252 ++++++++ .../FooServicePersistenceIntegrationTest.java | 75 +++ .../SpringDataJPABarAuditIntegrationTest.java | 75 +++ .../ElementCollectionIntegrationTest.java | 64 ++ .../JpaMultipleDBIntegrationTest.java | 96 +++ .../ProductRepositoryIntegrationTest.java | 144 +++++ ...erCaseNamingStrategyH2IntegrationTest.java | 81 +++ ...werCaseNamingStrategyPostgresLiveTest.java | 85 +++ ...erCaseNamingStrategyH2IntegrationTest.java | 85 +++ ...perCaseNamingStrategyPostgresLiveTest.java | 81 +++ ...ysicalNamingStrategyH2IntegrationTest.java | 85 +++ ...hysicalNamingStrategyPostgresLiveTest.java | 85 +++ ...erCaseNamingStrategyH2IntegrationTest.java | 86 +++ ...werCaseNamingStrategyPostgresLiveTest.java | 85 +++ ...erCaseNamingStrategyH2IntegrationTest.java | 85 +++ ...perCaseNamingStrategyPostgresLiveTest.java | 85 +++ .../osiv/UserControllerIntegrationTest.java | 56 ++ .../partialupdate/PartialUpdateUnitTest.java | 63 ++ .../util/BaeldungPostgresqlContainer.java | 35 ++ .../test/java/com/baeldung/util/IDUtil.java | 33 ++ .../resources/application-test.properties | 3 + ...ase-naming-strategy-on-postgres.properties | 9 + ...oted-lower-case-naming-strategy.properties | 9 + ...ase-naming-strategy-on-postgres.properties | 9 + ...oted-upper-case-naming-strategy.properties | 9 + ...cal-naming-strategy-on-postgres.properties | 9 + ...spring-physical-naming-strategy.properties | 9 + ...ase-naming-strategy-on-postgres.properties | 9 + ...oted-lower-case-naming-strategy.properties | 9 + ...ase-naming-strategy-on-postgres.properties | 9 + ...oted-upper-case-naming-strategy.properties | 9 + 100 files changed, 5026 insertions(+) create mode 100644 persistence-modules/spring-data-jpa-enterprise/README.md create mode 100644 persistence-modules/spring-data-jpa-enterprise/pom.xml create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/Application.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/Application.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/config/PersistenceConfiguration.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/IBarCrudRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/IFooDao.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Bar.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Foo.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Possession.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/User.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IBarService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IFooService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IOperations.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/AbstractService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/AbstractSpringDataJpaService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/BarSpringDataJpaService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/FooService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/ElementCollectionApplication.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/model/Employee.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/model/Phone.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/repository/EmployeeRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceProductAutoConfiguration.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceUserAutoConfiguration.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceUserConfiguration.java create mode 100755 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java create mode 100755 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/product/Product.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/Person.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/PersonRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategy.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategy.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/SpringDataJpaNamingConventionApplication.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategy.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategy.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/OsivApplication.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/model/BasicUser.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/service/SimpleUserService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/service/UserService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/web/UserController.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/PartialUpdateApplication.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/ContactPhone.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/Customer.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/CustomerDto.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/CustomerStructured.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/ContactPhoneRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/CustomerRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/CustomerStructuredRepository.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/service/CustomerService.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/util/CustomerMapper.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/resources/application.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/resources/persistence-multiple-db-boot.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/main/resources/persistence-multiple-db.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/SpringContextTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/AbstractServicePersistenceIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/FooServicePersistenceIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/SpringDataJPABarAuditIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/elementcollection/ElementCollectionIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyH2IntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyPostgresLiveTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyH2IntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyPostgresLiveTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyH2IntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyPostgresLiveTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyH2IntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyPostgresLiveTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyH2IntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyPostgresLiveTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/partialupdate/PartialUpdateUnitTest.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/util/IDUtil.java create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/application-test.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy-on-postgres.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy-on-postgres.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy-on-postgres.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy-on-postgres.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy-on-postgres.properties create mode 100644 persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy.properties diff --git a/persistence-modules/spring-data-jpa-enterprise/README.md b/persistence-modules/spring-data-jpa-enterprise/README.md new file mode 100644 index 0000000000..81398b1f00 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/README.md @@ -0,0 +1,24 @@ +## Spring Data JPA - Enterprise + +This module contains articles about Spring Data JPA used in enterprise applications such as transactions, sessions, naming conventions and more + +### Relevant Articles: + +- [Spring JPA – Multiple Databases](https://www.baeldung.com/spring-data-jpa-multiple-databases) +- [Spring Data Java 8 Support](https://www.baeldung.com/spring-data-java-8) +- [Pagination and Sorting using Spring Data JPA](https://www.baeldung.com/spring-data-jpa-pagination-sorting) +- [DB Integration Tests with Spring Boot and Testcontainers](https://www.baeldung.com/spring-boot-testcontainers-integration-test) +- [A Guide to Spring’s Open Session In View](https://www.baeldung.com/spring-open-session-in-view) +- [Working with Lazy Element Collections in JPA](https://www.baeldung.com/java-jpa-lazy-collections) +- [Custom Naming Convention with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-custom-naming) +- [Partial Data Update with Spring Data](https://www.baeldung.com/spring-data-partial-update) + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator + diff --git a/persistence-modules/spring-data-jpa-enterprise/pom.xml b/persistence-modules/spring-data-jpa-enterprise/pom.xml new file mode 100644 index 0000000000..093059ad78 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/pom.xml @@ -0,0 +1,107 @@ + + + + 4.0.0 + spring-data-jpa-enterprise + spring-data-jpa-enterprise + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-starter-data-jdbc + + + + org.springframework.boot + spring-boot-starter-cache + + + + com.h2database + h2 + + + + org.hibernate + hibernate-envers + + + + com.google.guava + guava + ${guava.version} + + + + org.mapstruct + mapstruct-jdk8 + ${mapstruct.version} + provided + + + + org.springframework.security + spring-security-test + test + + + + + org.testcontainers + postgresql + ${testcontainers.version} + test + + + + + + src/main/java + + + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + org.mapstruct + mapstruct-processor + 1.3.1.Final + + + + + + + + + 2.1.9.RELEASE + com.baeldung.springdatageode.app.ClientCacheApp + 1.1.1.RELEASE + 2.1.9.RELEASE + 1.3.1.Final + 21.0 + 1.12.2 + + + diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..3ea3d113da --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/Application.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/Application.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/Application.java new file mode 100644 index 0000000000..aaca760499 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/Application.java @@ -0,0 +1,17 @@ +package com.baeldung.boot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication +@EnableJpaRepositories("com.baeldung") +@EntityScan("com.baeldung") +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/config/PersistenceConfiguration.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/config/PersistenceConfiguration.java new file mode 100644 index 0000000000..76d5887030 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/config/PersistenceConfiguration.java @@ -0,0 +1,23 @@ +package com.baeldung.boot.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.baeldung.boot.services.IBarService; +import com.baeldung.boot.services.impl.BarSpringDataJpaService; + +@Configuration +@Profile("!tc") +@EnableTransactionManagement +@EnableJpaAuditing +public class PersistenceConfiguration { + + @Bean + public IBarService barSpringDataJpaService() { + return new BarSpringDataJpaService(); + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/IBarCrudRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/IBarCrudRepository.java new file mode 100644 index 0000000000..921fabe3fb --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/IBarCrudRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.boot.daos; + +import org.springframework.data.repository.CrudRepository; + +import com.baeldung.boot.domain.Bar; + +import java.io.Serializable; + +public interface IBarCrudRepository extends CrudRepository { + // +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/IFooDao.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/IFooDao.java new file mode 100644 index 0000000000..d537772076 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/IFooDao.java @@ -0,0 +1,13 @@ +package com.baeldung.boot.daos; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import com.baeldung.boot.domain.Foo; + +public interface IFooDao extends JpaRepository { + + @Query("SELECT f FROM Foo f WHERE LOWER(f.name) = LOWER(:name)") + Foo retrieveByName(@Param("name") String name); +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java new file mode 100644 index 0000000000..53f692ff28 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepository.java @@ -0,0 +1,99 @@ +package com.baeldung.boot.daos.user; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import com.baeldung.boot.domain.User; + +import java.time.LocalDate; +import java.util.Collection; +import java.util.List; +import java.util.stream.Stream; + +public interface UserRepository extends JpaRepository , UserRepositoryCustom{ + + Stream findAllByName(String name); + + @Query("SELECT u FROM User u WHERE u.status = 1") + Collection findAllActiveUsers(); + + @Query("select u from User u where u.email like '%@gmail.com'") + List findUsersWithGmailAddress(); + + @Query(value = "SELECT * FROM Users u WHERE u.status = 1", nativeQuery = true) + Collection findAllActiveUsersNative(); + + @Query("SELECT u FROM User u WHERE u.status = ?1") + User findUserByStatus(Integer status); + + @Query(value = "SELECT * FROM Users u WHERE u.status = ?1", nativeQuery = true) + User findUserByStatusNative(Integer status); + + @Query("SELECT u FROM User u WHERE u.status = ?1 and u.name = ?2") + User findUserByStatusAndName(Integer status, String name); + + @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") + User findUserByStatusAndNameNamedParams(@Param("status") Integer status, @Param("name") String name); + + @Query(value = "SELECT * FROM Users u WHERE u.status = :status AND u.name = :name", nativeQuery = true) + User findUserByStatusAndNameNamedParamsNative(@Param("status") Integer status, @Param("name") String name); + + @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") + User findUserByUserStatusAndUserName(@Param("status") Integer userStatus, @Param("name") String userName); + + @Query("SELECT u FROM User u WHERE u.name like ?1%") + User findUserByNameLike(String name); + + @Query("SELECT u FROM User u WHERE u.name like :name%") + User findUserByNameLikeNamedParam(@Param("name") String name); + + @Query(value = "SELECT * FROM users u WHERE u.name LIKE ?1%", nativeQuery = true) + User findUserByNameLikeNative(String name); + + @Query(value = "SELECT u FROM User u") + List findAllUsers(Sort sort); + + @Query(value = "SELECT u FROM User u ORDER BY id") + Page findAllUsersWithPagination(Pageable pageable); + + @Query(value = "SELECT * FROM Users ORDER BY id", countQuery = "SELECT count(*) FROM Users", nativeQuery = true) + Page findAllUsersWithPaginationNative(Pageable pageable); + + @Modifying + @Query("update User u set u.status = :status where u.name = :name") + int updateUserSetStatusForName(@Param("status") Integer status, @Param("name") String name); + + @Modifying + @Query(value = "UPDATE Users u SET u.status = ? WHERE u.name = ?", nativeQuery = true) + int updateUserSetStatusForNameNative(Integer status, String name); + + @Query(value = "INSERT INTO Users (name, age, email, status, active) VALUES (:name, :age, :email, :status, :active)", nativeQuery = true) + @Modifying + void insertUser(@Param("name") String name, @Param("age") Integer age, @Param("email") String email, @Param("status") Integer status, @Param("active") boolean active); + + @Modifying + @Query(value = "UPDATE Users u SET status = ? WHERE u.name = ?", nativeQuery = true) + int updateUserSetStatusForNameNativePostgres(Integer status, String name); + + @Query(value = "SELECT u FROM User u WHERE u.name IN :names") + List findUserByNameList(@Param("names") Collection names); + + void deleteAllByCreationDateAfter(LocalDate date); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("update User u set u.active = false where u.lastLoginDate < :date") + void deactivateUsersNotLoggedInSince(@Param("date") LocalDate date); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete User u where u.active = false") + int deleteDeactivatedUsers(); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query(value = "alter table USERS add column deleted int(1) not null default 0", nativeQuery = true) + void addDeletedColumn(); +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java new file mode 100644 index 0000000000..c586b54027 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java @@ -0,0 +1,14 @@ +package com.baeldung.boot.daos.user; + +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.function.Predicate; + +import com.baeldung.boot.domain.User; + +public interface UserRepositoryCustom { + List findUserByEmails(Set emails); + + List findAllUsersByPredicates(Collection> predicates); +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java new file mode 100644 index 0000000000..63a743b6b5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java @@ -0,0 +1,57 @@ +package com.baeldung.boot.daos.user; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Path; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +import com.baeldung.boot.domain.User; + +public class UserRepositoryCustomImpl implements UserRepositoryCustom { + + @PersistenceContext + private EntityManager entityManager; + + @Override + public List findUserByEmails(Set emails) { + CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + CriteriaQuery query = cb.createQuery(User.class); + Root user = query.from(User.class); + + Path emailPath = user.get("email"); + + List predicates = new ArrayList<>(); + for (String email : emails) { + + predicates.add(cb.like(emailPath, email)); + + } + query.select(user) + .where(cb.or(predicates.toArray(new Predicate[predicates.size()]))); + + return entityManager.createQuery(query) + .getResultList(); + } + + @Override + public List findAllUsersByPredicates(Collection> predicates) { + List allUsers = entityManager.createQuery("select u from User u", User.class).getResultList(); + Stream allUsersStream = allUsers.stream(); + for (java.util.function.Predicate predicate : predicates) { + allUsersStream = allUsersStream.filter(predicate); + } + + return allUsersStream.collect(Collectors.toList()); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Bar.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Bar.java new file mode 100644 index 0000000000..35d1903801 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Bar.java @@ -0,0 +1,220 @@ +package com.baeldung.boot.domain; + +import com.google.common.collect.Sets; +import org.hibernate.annotations.OrderBy; +import org.hibernate.envers.Audited; +import org.jboss.logging.Logger; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +@Entity +@NamedQuery(name = "Bar.findAll", query = "SELECT b FROM Bar b") +@Audited +@EntityListeners(AuditingEntityListener.class) +public class Bar implements Serializable { + + private static Logger logger = Logger.getLogger(Bar.class); + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private int id; + + @Column(name = "name") + private String name; + @OneToMany(mappedBy = "bar", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @OrderBy(clause = "NAME DESC") + // @NotAudited + private Set fooSet = Sets.newHashSet(); + @Column(name = "operation") + private String operation; + @Column(name = "timestamp") + private long timestamp; + @Column(name = "created_date", updatable = false, nullable = false) + @CreatedDate + private long createdDate; + @Column(name = "modified_date") + @LastModifiedDate + private long modifiedDate; + @Column(name = "created_by") + @CreatedBy + private String createdBy; + @Column(name = "modified_by") + @LastModifiedBy + private String modifiedBy; + + public Bar() { + super(); + } + + public Bar(final String name) { + super(); + + this.name = name; + } + + public Set getFooSet() { + return fooSet; + } + + // API + + public void setFooSet(final Set fooSet) { + this.fooSet = fooSet; + } + + public int getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public OPERATION getOperation() { + return OPERATION.parse(operation); + } + + public void setOperation(final String operation) { + this.operation = operation; + } + + public void setOperation(final OPERATION operation) { + this.operation = operation.getValue(); + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(final long timestamp) { + this.timestamp = timestamp; + } + + public long getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(final long createdDate) { + this.createdDate = createdDate; + } + + public long getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(final long modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(final String createdBy) { + this.createdBy = createdBy; + } + + public String getModifiedBy() { + return modifiedBy; + } + + public void setModifiedBy(final String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Bar other = (Bar) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Bar [name=").append(name).append("]"); + return builder.toString(); + } + + @PrePersist + public void onPrePersist() { + logger.info("@PrePersist"); + audit(OPERATION.INSERT); + } + + @PreUpdate + public void onPreUpdate() { + logger.info("@PreUpdate"); + audit(OPERATION.UPDATE); + } + + @PreRemove + public void onPreRemove() { + logger.info("@PreRemove"); + audit(OPERATION.DELETE); + } + + private void audit(final OPERATION operation) { + setOperation(operation); + setTimestamp((new Date()).getTime()); + } + + public enum OPERATION { + INSERT, UPDATE, DELETE; + private String value; + + OPERATION() { + value = toString(); + } + + public static OPERATION parse(final String value) { + OPERATION operation = null; + for (final OPERATION op : OPERATION.values()) { + if (op.getValue().equals(value)) { + operation = op; + break; + } + } + return operation; + } + + public String getValue() { + return value; + } + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Foo.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Foo.java new file mode 100644 index 0000000000..5030e5600b --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Foo.java @@ -0,0 +1,94 @@ +package com.baeldung.boot.domain; + +import org.hibernate.envers.Audited; + +import javax.persistence.*; +import java.io.Serializable; + +@NamedNativeQueries({@NamedNativeQuery(name = "callGetAllFoos", query = "CALL GetAllFoos()", resultClass = Foo.class), @NamedNativeQuery(name = "callGetFoosByName", query = "CALL GetFoosByName(:fooName)", resultClass = Foo.class)}) +@Entity +@Audited +// @Proxy(lazy = false) +public class Foo implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private long id; + + @Column(name = "name", nullable = false) + private String name; + + @ManyToOne(targetEntity = Bar.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @JoinColumn(name = "BAR_ID") + private Bar bar = new Bar(); + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + this.name = name; + } + + // + + public Bar getBar() { + return bar; + } + + public void setBar(final Bar bar) { + this.bar = bar; + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + // + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Foo other = (Foo) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Foo [name=").append(name).append("]"); + return builder.toString(); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Possession.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Possession.java new file mode 100644 index 0000000000..f13491ad82 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/Possession.java @@ -0,0 +1,83 @@ +package com.baeldung.boot.domain; + +import javax.persistence.*; +import com.baeldung.boot.domain.Possession; + +@Entity +@Table +public class Possession { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + private String name; + + public Possession() { + super(); + } + + public Possession(final String name) { + super(); + + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = (prime * result) + (int) (id ^ (id >>> 32)); + result = (prime * result) + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Possession other = (Possession) obj; + if (id != other.id) { + return false; + } + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Possesion [id=").append(id).append(", name=").append(name).append("]"); + return builder.toString(); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/User.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/User.java new file mode 100644 index 0000000000..cca00e52a2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/domain/User.java @@ -0,0 +1,132 @@ +package com.baeldung.boot.domain; + +import javax.persistence.*; + +import java.time.LocalDate; +import java.util.List; +import java.util.Objects; + +@Entity +@Table(name = "users") +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id; + private String name; + private LocalDate creationDate; + private LocalDate lastLoginDate; + private boolean active; + private int age; + @Column(unique = true, nullable = false) + private String email; + private Integer status; + @OneToMany + List possessionList; + + public User() { + super(); + } + + public User(String name, LocalDate creationDate,String email, Integer status) { + this.name = name; + this.creationDate = creationDate; + this.email = email; + this.status = status; + this.active = true; + } + + public int getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(final String email) { + this.email = email; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public int getAge() { + return age; + } + + public void setAge(final int age) { + this.age = age; + } + + public LocalDate getCreationDate() { + return creationDate; + } + + public List getPossessionList() { + return possessionList; + } + + public void setPossessionList(List possessionList) { + this.possessionList = possessionList; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("User [name=").append(name).append(", id=").append(id).append("]"); + return builder.toString(); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + User user = (User) o; + return id == user.id && + age == user.age && + Objects.equals(name, user.name) && + Objects.equals(creationDate, user.creationDate) && + Objects.equals(email, user.email) && + Objects.equals(status, user.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, creationDate, age, email, status); + } + + public LocalDate getLastLoginDate() { + return lastLoginDate; + } + + public void setLastLoginDate(LocalDate lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IBarService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IBarService.java new file mode 100644 index 0000000000..8054cbba59 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IBarService.java @@ -0,0 +1,7 @@ +package com.baeldung.boot.services; + +import com.baeldung.boot.domain.Bar; + +public interface IBarService extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IFooService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IFooService.java new file mode 100644 index 0000000000..871cccdd45 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IFooService.java @@ -0,0 +1,14 @@ +package com.baeldung.boot.services; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import com.baeldung.boot.domain.Foo; + +public interface IFooService extends IOperations { + + Foo retrieveByName(String name); + + Page findPaginated(Pageable pageable); + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IOperations.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IOperations.java new file mode 100644 index 0000000000..ec2b866b6f --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/IOperations.java @@ -0,0 +1,26 @@ +package com.baeldung.boot.services; + +import org.springframework.data.domain.Page; + +import java.io.Serializable; +import java.util.List; + +public interface IOperations { + + T findOne(final long id); + + List findAll(); + + Page findPaginated(int page, int size); + + // write + + T create(final T entity); + + T update(final T entity); + + void delete(final T entity); + + void deleteById(final long entityId); + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/AbstractService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/AbstractService.java new file mode 100644 index 0000000000..f88d018bbb --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/AbstractService.java @@ -0,0 +1,61 @@ +package com.baeldung.boot.services.impl; + +import com.baeldung.boot.services.IOperations; +import com.google.common.collect.Lists; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Transactional +public abstract class AbstractService implements IOperations { + + // read - one + + @Override + @Transactional(readOnly = true) + public T findOne(final long id) { + return getDao().findById(id).orElse(null); + } + + // read - all + + @Override + @Transactional(readOnly = true) + public List findAll() { + return Lists.newArrayList(getDao().findAll()); + } + + @Override + public Page findPaginated(final int page, final int size) { + return getDao().findAll(PageRequest.of(page, size)); + } + + // write + + @Override + public T create(final T entity) { + return getDao().save(entity); + } + + @Override + public T update(final T entity) { + return getDao().save(entity); + } + + @Override + public void delete(final T entity) { + getDao().delete(entity); + } + + @Override + public void deleteById(final long entityId) { + getDao().deleteById(entityId); + } + + protected abstract PagingAndSortingRepository getDao(); + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/AbstractSpringDataJpaService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/AbstractSpringDataJpaService.java new file mode 100644 index 0000000000..a73a6bd7fc --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/AbstractSpringDataJpaService.java @@ -0,0 +1,45 @@ +package com.baeldung.boot.services.impl; + +import com.baeldung.boot.services.IOperations; +import com.google.common.collect.Lists; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.List; + +@Transactional(value = "transactionManager") +public abstract class AbstractSpringDataJpaService implements IOperations { + + @Override + public T findOne(final long id) { + return getDao().findById(id).orElse(null); + } + + @Override + public List findAll() { + return Lists.newArrayList(getDao().findAll()); + } + + @Override + public T create(final T entity) { + return getDao().save(entity); + } + + @Override + public T update(final T entity) { + return getDao().save(entity); + } + + @Override + public void delete(final T entity) { + getDao().delete(entity); + } + + @Override + public void deleteById(final long entityId) { + getDao().deleteById(entityId); + } + + protected abstract CrudRepository getDao(); +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/BarSpringDataJpaService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/BarSpringDataJpaService.java new file mode 100644 index 0000000000..80568f2fd4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/BarSpringDataJpaService.java @@ -0,0 +1,31 @@ +package com.baeldung.boot.services.impl; + +import com.baeldung.boot.daos.IBarCrudRepository; +import com.baeldung.boot.domain.Bar; +import com.baeldung.boot.services.IBarService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.repository.CrudRepository; + +import java.io.Serializable; + +public class BarSpringDataJpaService extends AbstractSpringDataJpaService implements IBarService { + + @Autowired + private IBarCrudRepository dao; + + public BarSpringDataJpaService() { + super(); + } + + @Override + protected CrudRepository getDao() { + return dao; + } + + @Override + public Page findPaginated(int page, int size) { + throw new UnsupportedOperationException("Not implemented yet"); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/FooService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/FooService.java new file mode 100644 index 0000000000..04eec63854 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/services/impl/FooService.java @@ -0,0 +1,55 @@ +package com.baeldung.boot.services.impl; + +import com.google.common.collect.Lists; +import com.baeldung.boot.daos.IFooDao; +import com.baeldung.boot.domain.Foo; +import com.baeldung.boot.services.IFooService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.repository.PagingAndSortingRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service +@Transactional +public class FooService extends AbstractService implements IFooService { + + @Autowired + private IFooDao dao; + + public FooService() { + super(); + } + + // API + + @Override + protected PagingAndSortingRepository getDao() { + return dao; + } + + // custom methods + + @Override + public Foo retrieveByName(final String name) { + return dao.retrieveByName(name); + } + + // overridden to be secured + + @Override + @Transactional(readOnly = true) + public List findAll() { + return Lists.newArrayList(getDao().findAll()); + } + + @Override + public Page findPaginated(Pageable pageable) { + return dao.findAll(pageable); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/ElementCollectionApplication.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/ElementCollectionApplication.java new file mode 100644 index 0000000000..3f152a6ffc --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/ElementCollectionApplication.java @@ -0,0 +1,11 @@ +package com.baeldung.elementcollection; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ElementCollectionApplication { + public static void main(String[] args) { + SpringApplication.run(ElementCollectionApplication.class, args); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/model/Employee.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/model/Employee.java new file mode 100644 index 0000000000..8b98164d63 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/model/Employee.java @@ -0,0 +1,68 @@ +package com.baeldung.elementcollection.model; + +import javax.persistence.*; +import java.util.List; +import java.util.Objects; + +@Entity +public class Employee { + @Id + private int id; + private String name; + @ElementCollection + @CollectionTable(name = "employee_phone", joinColumns = @JoinColumn(name = "employee_id")) + private List phones; + + public Employee() { + } + + public Employee(int id) { + this.id = id; + } + + public Employee(int id, String name) { + this.id = id; + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getPhones() { + return phones; + } + + public void setPhones(List phones) { + this.phones = phones; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Employee)) { + return false; + } + Employee user = (Employee) o; + return getId() == user.getId(); + } + + @Override + public int hashCode() { + return Objects.hash(getId()); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/model/Phone.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/model/Phone.java new file mode 100644 index 0000000000..d73d30c47a --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/model/Phone.java @@ -0,0 +1,62 @@ +package com.baeldung.elementcollection.model; + +import javax.persistence.Embeddable; +import java.util.Objects; + +@Embeddable +public class Phone { + private String type; + private String areaCode; + private String number; + + public Phone() { + } + + public Phone(String type, String areaCode, String number) { + this.type = type; + this.areaCode = areaCode; + this.number = number; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Phone)) { + return false; + } + Phone phone = (Phone) o; + return getType().equals(phone.getType()) && getAreaCode().equals(phone.getAreaCode()) + && getNumber().equals(phone.getNumber()); + } + + @Override + public int hashCode() { + return Objects.hash(getType(), getAreaCode(), getNumber()); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/repository/EmployeeRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/repository/EmployeeRepository.java new file mode 100644 index 0000000000..49180c35eb --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/elementcollection/repository/EmployeeRepository.java @@ -0,0 +1,46 @@ +package com.baeldung.elementcollection.repository; + +import com.baeldung.elementcollection.model.Employee; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import javax.persistence.EntityGraph; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import java.util.HashMap; +import java.util.Map; + +@Repository +public class EmployeeRepository { + + @PersistenceContext + private EntityManager em; + + @Transactional + public void save(Employee employee) { + em.persist(employee); + } + + @Transactional + public void remove(int id) { + Employee employee = findById(id); + em.remove(employee); + } + + public Employee findById(int id) { + return em.find(Employee.class, id); + } + + public Employee findByJPQL(int id) { + return em.createQuery("SELECT u FROM Employee AS u JOIN FETCH u.phones WHERE u.id=:id", Employee.class) + .setParameter("id", id).getSingleResult(); + } + + public Employee findByEntityGraph(int id) { + EntityGraph entityGraph = em.createEntityGraph(Employee.class); + entityGraph.addAttributeNodes("name", "phones"); + Map properties = new HashMap<>(); + properties.put("javax.persistence.fetchgraph", entityGraph); + return em.find(Employee.class, id, properties); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java new file mode 100644 index 0000000000..3b9aa2cc18 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java @@ -0,0 +1,14 @@ +package com.baeldung.multipledb; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class MultipleDbApplication { + + public static void main(String[] args) { + SpringApplication.run(MultipleDbApplication.class, args); + } + +} + diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceProductAutoConfiguration.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceProductAutoConfiguration.java new file mode 100644 index 0000000000..a6f8f0829f --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceProductAutoConfiguration.java @@ -0,0 +1,71 @@ +package com.baeldung.multipledb; + +import java.util.HashMap; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; + +/** + * By default, the persistence-multiple-db.properties file is read for + * non auto configuration in PersistenceProductConfiguration. + *

    + * If we need to use persistence-multiple-db-boot.properties and auto configuration + * then uncomment the below @Configuration class and comment out PersistenceProductConfiguration. + */ +//@Configuration +@PropertySource({"classpath:persistence-multiple-db-boot.properties"}) +@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.product", entityManagerFactoryRef = "productEntityManager", transactionManagerRef = "productTransactionManager") +@Profile("!tc") +public class PersistenceProductAutoConfiguration { + @Autowired + private Environment env; + + public PersistenceProductAutoConfiguration() { + super(); + } + + // + + @Bean + public LocalContainerEntityManagerFactoryBean productEntityManager() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(productDataSource()); + em.setPackagesToScan("com.baeldung.multipledb.model.product"); + + final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + em.setJpaVendorAdapter(vendorAdapter); + final HashMap properties = new HashMap(); + properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); + em.setJpaPropertyMap(properties); + + return em; + } + + @Bean + @ConfigurationProperties(prefix="spring.second-datasource") + public DataSource productDataSource() { + return DataSourceBuilder.create().build(); + } + + @Bean + public PlatformTransactionManager productTransactionManager() { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(productEntityManager().getObject()); + return transactionManager; + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java new file mode 100644 index 0000000000..bcf2cd84eb --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java @@ -0,0 +1,68 @@ +package com.baeldung.multipledb; + +import com.google.common.base.Preconditions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; + +import javax.sql.DataSource; +import java.util.HashMap; + +@Configuration +@PropertySource({"classpath:persistence-multiple-db.properties"}) +@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.product", entityManagerFactoryRef = "productEntityManager", transactionManagerRef = "productTransactionManager") +@Profile("!tc") +public class PersistenceProductConfiguration { + @Autowired + private Environment env; + + public PersistenceProductConfiguration() { + super(); + } + + // + + @Bean + public LocalContainerEntityManagerFactoryBean productEntityManager() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(productDataSource()); + em.setPackagesToScan("com.baeldung.multipledb.model.product"); + + final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + em.setJpaVendorAdapter(vendorAdapter); + final HashMap properties = new HashMap(); + properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); + em.setJpaPropertyMap(properties); + + return em; + } + + @Bean + public DataSource productDataSource() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("product.jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); + + return dataSource; + } + + @Bean + public PlatformTransactionManager productTransactionManager() { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(productEntityManager().getObject()); + return transactionManager; + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceUserAutoConfiguration.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceUserAutoConfiguration.java new file mode 100644 index 0000000000..e04a1621b2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceUserAutoConfiguration.java @@ -0,0 +1,75 @@ +package com.baeldung.multipledb; + +import java.util.HashMap; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.context.annotation.Profile; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; + +/** + * By default, the persistence-multiple-db.properties file is read for + * non auto configuration in PersistenceUserConfiguration. + *

    + * If we need to use persistence-multiple-db-boot.properties and auto configuration + * then uncomment the below @Configuration class and comment out PersistenceUserConfiguration. + */ +//@Configuration +@PropertySource({"classpath:persistence-multiple-db-boot.properties"}) +@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.user", entityManagerFactoryRef = "userEntityManager", transactionManagerRef = "userTransactionManager") +@Profile("!tc") +public class PersistenceUserAutoConfiguration { + @Autowired + private Environment env; + + public PersistenceUserAutoConfiguration() { + super(); + } + + // + + @Primary + @Bean + public LocalContainerEntityManagerFactoryBean userEntityManager() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(userDataSource()); + em.setPackagesToScan("com.baeldung.multipledb.model.user"); + + final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + em.setJpaVendorAdapter(vendorAdapter); + final HashMap properties = new HashMap(); + properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); + em.setJpaPropertyMap(properties); + + return em; + } + + @Bean + @Primary + @ConfigurationProperties(prefix="spring.datasource") + public DataSource userDataSource() { + return DataSourceBuilder.create().build(); + } + + @Primary + @Bean + public PlatformTransactionManager userTransactionManager() { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(userEntityManager().getObject()); + return transactionManager; + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceUserConfiguration.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceUserConfiguration.java new file mode 100644 index 0000000000..6b48455c0c --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/PersistenceUserConfiguration.java @@ -0,0 +1,69 @@ +package com.baeldung.multipledb; + +import com.google.common.base.Preconditions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; + +import javax.sql.DataSource; +import java.util.HashMap; + +@Configuration +@PropertySource({"classpath:persistence-multiple-db.properties"}) +@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.user", entityManagerFactoryRef = "userEntityManager", transactionManagerRef = "userTransactionManager") +@Profile("!tc") +public class PersistenceUserConfiguration { + @Autowired + private Environment env; + + public PersistenceUserConfiguration() { + super(); + } + + // + + @Primary + @Bean + public LocalContainerEntityManagerFactoryBean userEntityManager() { + System.out.println("loading config"); + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(userDataSource()); + em.setPackagesToScan("com.baeldung.multipledb.model.user"); + + final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + em.setJpaVendorAdapter(vendorAdapter); + final HashMap properties = new HashMap(); + properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); + em.setJpaPropertyMap(properties); + + return em; + } + + @Primary + @Bean + public DataSource userDataSource() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("user.jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); + + return dataSource; + } + + @Primary + @Bean + public PlatformTransactionManager userTransactionManager() { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(userEntityManager().getObject()); + return transactionManager; + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java new file mode 100755 index 0000000000..f1256e2c72 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java @@ -0,0 +1,14 @@ +package com.baeldung.multipledb.dao.product; + +import java.util.List; + +import org.springframework.data.domain.Pageable; +import org.springframework.data.repository.PagingAndSortingRepository; + +import com.baeldung.multipledb.model.product.Product; + +public interface ProductRepository extends PagingAndSortingRepository { + + + List findAllByPrice(double price, Pageable pageable); +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java new file mode 100644 index 0000000000..ae37fde20d --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java @@ -0,0 +1,9 @@ +package com.baeldung.multipledb.dao.user; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.baeldung.multipledb.model.user.PossessionMultipleDB; + +public interface PossessionRepository extends JpaRepository { + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java new file mode 100644 index 0000000000..267a61a93f --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.multipledb.dao.user; + +import org.springframework.data.jpa.repository.JpaRepository; + +import com.baeldung.multipledb.model.user.UserMultipleDB; + +public interface UserRepository extends JpaRepository { +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/product/Product.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/product/Product.java new file mode 100755 index 0000000000..eaf471043c --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/product/Product.java @@ -0,0 +1,67 @@ +package com.baeldung.multipledb.model.product; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(schema = "products") +public class Product { + + @Id + private int id; + + private String name; + + private double price; + + public Product() { + super(); + } + + private Product(int id, String name, double price) { + super(); + this.id = id; + this.name = name; + this.price = price; + } + + public static Product from(int id, String name, double price) { + return new Product(id, name, price); + } + + public int getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public double getPrice() { + return price; + } + + public void setPrice(final double price) { + this.price = price; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Product [name=") + .append(name) + .append(", id=") + .append(id) + .append("]"); + return builder.toString(); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java new file mode 100644 index 0000000000..a6a3c88bd0 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java @@ -0,0 +1,82 @@ +package com.baeldung.multipledb.model.user; + +import javax.persistence.*; + +@Entity +@Table +public class PossessionMultipleDB { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + private String name; + + public PossessionMultipleDB() { + super(); + } + + public PossessionMultipleDB(final String name) { + super(); + + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = (prime * result) + (int) (id ^ (id >>> 32)); + result = (prime * result) + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final PossessionMultipleDB other = (PossessionMultipleDB) obj; + if (id != other.id) { + return false; + } + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Possesion [id=").append(id).append(", name=").append(name).append("]"); + return builder.toString(); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java new file mode 100644 index 0000000000..c7cd07f7a1 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java @@ -0,0 +1,88 @@ +package com.baeldung.multipledb.model.user; + +import javax.persistence.*; + +import java.util.List; + +@Entity +@Table(name = "users") +public class UserMultipleDB { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id; + private String name; + private int age; + @Column(unique = true, nullable = false) + private String email; + private Integer status; + + @OneToMany + List possessionList; + + public UserMultipleDB() { + super(); + } + + public UserMultipleDB(String name, String email, Integer status) { + this.name = name; + this.email = email; + this.status = status; + } + + public int getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(final String email) { + this.email = email; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public int getAge() { + return age; + } + + public void setAge(final int age) { + this.age = age; + } + + public List getPossessionList() { + return possessionList; + } + + public void setPossessionList(List possessionList) { + this.possessionList = possessionList; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("User [name=").append(name).append(", id=").append(id).append("]"); + return builder.toString(); + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/Person.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/Person.java new file mode 100644 index 0000000000..cfb6e67c2c --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/Person.java @@ -0,0 +1,35 @@ +package com.baeldung.namingstrategy; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Person { + @Id + private Long id; + + private String firstName; + + private String lastName; + + public Person() {} + + public Person(Long id, String firstName, String lastName) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + } + + public Long id() { + return id; + } + + public String firstName() { + return firstName; + } + + public String lastName() { + return lastName; + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/PersonRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/PersonRepository.java new file mode 100644 index 0000000000..3c7c25bbcb --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/PersonRepository.java @@ -0,0 +1,6 @@ +package com.baeldung.namingstrategy; + +import org.springframework.data.jpa.repository.JpaRepository; + +public interface PersonRepository extends JpaRepository { +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategy.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategy.java new file mode 100644 index 0000000000..16b01e50e3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategy.java @@ -0,0 +1,12 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.boot.model.naming.Identifier; +import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; +import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; + +public class QuotedLowerCaseNamingStrategy extends SpringPhysicalNamingStrategy { + @Override + protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { + return new Identifier(name.toLowerCase(), true); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategy.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategy.java new file mode 100644 index 0000000000..3cb62aa5a2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategy.java @@ -0,0 +1,12 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.boot.model.naming.Identifier; +import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; +import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; + +public class QuotedUpperCaseNamingStrategy extends SpringPhysicalNamingStrategy { + @Override + protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { + return new Identifier(name.toUpperCase(), true); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/SpringDataJpaNamingConventionApplication.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/SpringDataJpaNamingConventionApplication.java new file mode 100644 index 0000000000..f223015db8 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/SpringDataJpaNamingConventionApplication.java @@ -0,0 +1,7 @@ +package com.baeldung.namingstrategy; + +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringDataJpaNamingConventionApplication { +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategy.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategy.java new file mode 100644 index 0000000000..69e96aee27 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategy.java @@ -0,0 +1,12 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.boot.model.naming.Identifier; +import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; +import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; + +public class UnquotedLowerCaseNamingStrategy extends SpringPhysicalNamingStrategy { + @Override + protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { + return new Identifier(name.toLowerCase(), false); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategy.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategy.java new file mode 100644 index 0000000000..cb87af10f4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategy.java @@ -0,0 +1,12 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.boot.model.naming.Identifier; +import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; +import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; + +public class UnquotedUpperCaseNamingStrategy extends SpringPhysicalNamingStrategy { + @Override + protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { + return new Identifier(name.toUpperCase(), false); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/OsivApplication.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/OsivApplication.java new file mode 100644 index 0000000000..4cfcf83e56 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/OsivApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.osiv; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class OsivApplication { + + public static void main(String[] args) { + SpringApplication.run(OsivApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/model/BasicUser.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/model/BasicUser.java new file mode 100644 index 0000000000..98f4e379d4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/model/BasicUser.java @@ -0,0 +1,42 @@ +package com.baeldung.osiv.model; + +import javax.persistence.*; +import java.util.Set; + +@Entity +@Table(name = "users") +public class BasicUser { + + @Id + @GeneratedValue + private Long id; + + private String username; + + @ElementCollection + private Set permissions; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public Set getPermissions() { + return permissions; + } + + public void setPermissions(Set permissions) { + this.permissions = permissions; + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java new file mode 100644 index 0000000000..e8d5955d91 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java @@ -0,0 +1,19 @@ +package com.baeldung.osiv.repository; + +import java.util.Optional; + +import org.springframework.data.jpa.repository.EntityGraph; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.osiv.model.BasicUser; + +@Repository +@Transactional +public interface BasicUserRepository extends JpaRepository { + + @EntityGraph(attributePaths = "permissions") + Optional findDetailedByUsername(String username); + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/service/SimpleUserService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/service/SimpleUserService.java new file mode 100644 index 0000000000..1de51678d5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/service/SimpleUserService.java @@ -0,0 +1,25 @@ +package com.baeldung.osiv.service; + +import java.util.Optional; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.osiv.model.BasicUser; +import com.baeldung.osiv.repository.BasicUserRepository; + +@Service +public class SimpleUserService implements UserService { + + private final BasicUserRepository userRepository; + + public SimpleUserService(BasicUserRepository userRepository) { + this.userRepository = userRepository; + } + + @Override + @Transactional(readOnly = true) + public Optional findOne(String username) { + return userRepository.findDetailedByUsername(username); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/service/UserService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/service/UserService.java new file mode 100644 index 0000000000..3d089fa41b --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/service/UserService.java @@ -0,0 +1,9 @@ +package com.baeldung.osiv.service; + +import com.baeldung.osiv.model.BasicUser; + +import java.util.Optional; + +public interface UserService { + Optional findOne(String username); +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java new file mode 100644 index 0000000000..fd2882c2d5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java @@ -0,0 +1,45 @@ +package com.baeldung.osiv.web; + +import com.baeldung.osiv.model.BasicUser; + +import java.util.Set; + +public class DetailedUserDto { + + private Long id; + private String username; + private Set permissions; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public Set getPermissions() { + return permissions; + } + + public void setPermissions(Set permissions) { + this.permissions = permissions; + } + + public static DetailedUserDto fromEntity(BasicUser user) { + DetailedUserDto detailed = new DetailedUserDto(); + detailed.setId(user.getId()); + detailed.setUsername(user.getUsername()); + detailed.setPermissions(user.getPermissions()); + + return detailed; + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/web/UserController.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/web/UserController.java new file mode 100644 index 0000000000..5466b95166 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/web/UserController.java @@ -0,0 +1,27 @@ +package com.baeldung.osiv.web; + +import com.baeldung.osiv.service.UserService; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/users") +public class UserController { + + private final UserService userService; + + public UserController(UserService userService) { + this.userService = userService; + } + + @GetMapping("/{username}") + public ResponseEntity findOne(@PathVariable String username) { + return userService.findOne(username) + .map(DetailedUserDto::fromEntity) + .map(ResponseEntity::ok) + .orElse(ResponseEntity.notFound().build()); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/PartialUpdateApplication.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/PartialUpdateApplication.java new file mode 100644 index 0000000000..a750fcadf7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/PartialUpdateApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.partialupdate; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class PartialUpdateApplication { + + public static void main(String[] args) { + SpringApplication.run(PartialUpdateApplication.class, args); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/ContactPhone.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/ContactPhone.java new file mode 100644 index 0000000000..352e361bd9 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/ContactPhone.java @@ -0,0 +1,22 @@ +package com.baeldung.partialupdate.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class ContactPhone { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + public long id; + @Column(nullable=false) + public long customerId; + public String phone; + + @Override + public String toString() { + return phone; + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/Customer.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/Customer.java new file mode 100644 index 0000000000..b19d0b7952 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/Customer.java @@ -0,0 +1,23 @@ +package com.baeldung.partialupdate.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Customer { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + public long id; + public String name; + public String phone; + //... + public String phone99; + + @Override public String toString() { + return String.format("Customer %s, Phone: %s", + this.name, this.phone); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/CustomerDto.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/CustomerDto.java new file mode 100644 index 0000000000..0ecf206d9a --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/CustomerDto.java @@ -0,0 +1,31 @@ +package com.baeldung.partialupdate.model; + +public class CustomerDto { + private long id; + public String name; + public String phone; + //... + private String phone99; + + public CustomerDto(long id) { + this.id = id; + } + + public CustomerDto(Customer c) { + this.id = c.id; + this.name = c.name; + this.phone = c.phone; + } + + public long getId() { + return this.id; + } + + public Customer convertToEntity() { + Customer c = new Customer(); + c.id = id; + c.name = name; + c.phone = phone; + return c; + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/CustomerStructured.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/CustomerStructured.java new file mode 100644 index 0000000000..dd053a963d --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/model/CustomerStructured.java @@ -0,0 +1,27 @@ +package com.baeldung.partialupdate.model; + +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; + +@Entity +public class CustomerStructured { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + public long id; + public String name; + @OneToMany(fetch = FetchType.EAGER, targetEntity = ContactPhone.class, mappedBy = "customerId") + public List contactPhones; + + @Override public String toString() { + return String.format("Customer %s, Phone: %s", + this.name, this.contactPhones.stream() + .map(e -> e.toString()).reduce("", String::concat)); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/ContactPhoneRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/ContactPhoneRepository.java new file mode 100644 index 0000000000..4668181e05 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/ContactPhoneRepository.java @@ -0,0 +1,12 @@ +package com.baeldung.partialupdate.repository; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.partialupdate.model.ContactPhone; + +@Repository +public interface ContactPhoneRepository extends CrudRepository { + ContactPhone findById(long id); + ContactPhone findByCustomerId(long id); +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/CustomerRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/CustomerRepository.java new file mode 100644 index 0000000000..43e61df8ab --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/CustomerRepository.java @@ -0,0 +1,18 @@ +package com.baeldung.partialupdate.repository; + +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.baeldung.partialupdate.model.Customer; + +@Repository +public interface CustomerRepository extends CrudRepository { + Customer findById(long id); + + @Modifying + @Query("update Customer u set u.phone = :phone where u.id = :id") + void updatePhone(@Param(value = "id") long id, @Param(value = "phone") String phone); +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/CustomerStructuredRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/CustomerStructuredRepository.java new file mode 100644 index 0000000000..0f9fd1e92e --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/repository/CustomerStructuredRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.partialupdate.repository; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.partialupdate.model.CustomerStructured; + +@Repository +public interface CustomerStructuredRepository extends CrudRepository { + CustomerStructured findById(long id); +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/service/CustomerService.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/service/CustomerService.java new file mode 100644 index 0000000000..9da97a7775 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/service/CustomerService.java @@ -0,0 +1,87 @@ +package com.baeldung.partialupdate.service; + +import javax.transaction.Transactional; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baeldung.partialupdate.model.ContactPhone; +import com.baeldung.partialupdate.model.Customer; +import com.baeldung.partialupdate.model.CustomerDto; +import com.baeldung.partialupdate.model.CustomerStructured; +import com.baeldung.partialupdate.repository.ContactPhoneRepository; +import com.baeldung.partialupdate.repository.CustomerRepository; +import com.baeldung.partialupdate.repository.CustomerStructuredRepository; +import com.baeldung.partialupdate.util.CustomerMapper; + +@Service +@Transactional +public class CustomerService { + + @Autowired + CustomerRepository repo; + @Autowired + CustomerStructuredRepository repo2; + @Autowired + ContactPhoneRepository repo3; + @Autowired + CustomerMapper mapper; + + public Customer getCustomer(long id) { + return repo.findById(id); + } + + public void updateCustomerWithCustomQuery(long id, String phone) { + repo.updatePhone(id, phone); + } + + public Customer addCustomer(String name) { + Customer myCustomer = new Customer(); + myCustomer.name = name; + repo.save(myCustomer); + return myCustomer; + } + + public Customer updateCustomer(long id, String phone) { + Customer myCustomer = repo.findById(id); + myCustomer.phone = phone; + repo.save(myCustomer); + return myCustomer; + } + + public Customer addCustomer(CustomerDto dto) { + Customer myCustomer = new Customer(); + mapper.updateCustomerFromDto(dto, myCustomer); + repo.save(myCustomer); + return myCustomer; + } + + public Customer updateCustomer(CustomerDto dto) { + Customer myCustomer = repo.findById(dto.getId()); + mapper.updateCustomerFromDto(dto, myCustomer); + repo.save(myCustomer); + return myCustomer; + } + + public CustomerStructured addCustomerStructured(String name) { + CustomerStructured myCustomer = new CustomerStructured(); + myCustomer.name = name; + repo2.save(myCustomer); + return myCustomer; + } + + public void addCustomerPhone(long customerId, String phone) { + ContactPhone myPhone = new ContactPhone(); + myPhone.phone = phone; + myPhone.customerId = customerId; + repo3.save(myPhone); + } + + public CustomerStructured updateCustomerStructured(long id, String name) { + CustomerStructured myCustomer = repo2.findById(id); + myCustomer.name = name; + repo2.save(myCustomer); + return myCustomer; + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/util/CustomerMapper.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/util/CustomerMapper.java new file mode 100644 index 0000000000..8a666e3e6c --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/partialupdate/util/CustomerMapper.java @@ -0,0 +1,15 @@ +package com.baeldung.partialupdate.util; + +import org.mapstruct.BeanMapping; +import org.mapstruct.Mapper; +import org.mapstruct.MappingTarget; +import org.mapstruct.NullValuePropertyMappingStrategy; + +import com.baeldung.partialupdate.model.Customer; +import com.baeldung.partialupdate.model.CustomerDto; + +@Mapper(componentModel = "spring") +public interface CustomerMapper { + @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE) + void updateCustomerFromDto(CustomerDto dto, @MappingTarget Customer entity); +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-enterprise/src/main/resources/application.properties new file mode 100644 index 0000000000..29326c6061 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/resources/application.properties @@ -0,0 +1,16 @@ + +spring.datasource.url=jdbc:h2:mem:baeldung + +# JPA-Schema-Generation +# Use below configuration to generate database schema create commands based on the entity models +# and export them into the create.sql file +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-source=metadata +#spring.jpa.properties.hibernate.format_sql=true + +spring.jpa.show-sql=true +spring.main.allow-bean-definition-overriding=true + +#hibernate.dialect=org.hibernate.dialect.H2Dialect +spring.jpa.properties.hibernate.id.new_generator_mappings=false \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/resources/persistence-multiple-db-boot.properties b/persistence-modules/spring-data-jpa-enterprise/src/main/resources/persistence-multiple-db-boot.properties new file mode 100644 index 0000000000..ffca79b3f5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/resources/persistence-multiple-db-boot.properties @@ -0,0 +1,11 @@ +hibernate.hbm2ddl.auto=create-drop +hibernate.cache.use_second_level_cache=false +hibernate.cache.use_query_cache=false + +spring.datasource.jdbcUrl=jdbc:h2:mem:spring_jpa_user;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS USERS +spring.datasource.username=sa +spring.datasource.password=sa + +spring.second-datasource.jdbcUrl=jdbc:h2:mem:spring_jpa_product;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS PRODUCTS +spring.second-datasource.username=sa +spring.second-datasource.password=sa diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/resources/persistence-multiple-db.properties b/persistence-modules/spring-data-jpa-enterprise/src/main/resources/persistence-multiple-db.properties new file mode 100644 index 0000000000..75534e8a54 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/resources/persistence-multiple-db.properties @@ -0,0 +1,13 @@ +# jdbc.X +jdbc.driverClassName=org.h2.Driver +user.jdbc.url=jdbc:h2:mem:spring_jpa_user;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS USERS +product.jdbc.url=jdbc:h2:mem:spring_jpa_product;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS PRODUCTS +jdbc.user=sa +jdbc.pass=sa + +# hibernate.X +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=false +hibernate.hbm2ddl.auto=create-drop +hibernate.cache.use_second_level_cache=false +hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/SpringContextTest.java new file mode 100644 index 0000000000..eaccf4acba --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/SpringContextTest.java @@ -0,0 +1,17 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java new file mode 100644 index 0000000000..f3697bf39f --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java @@ -0,0 +1,25 @@ +package com.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; +import com.baeldung.boot.config.PersistenceConfiguration; +import com.baeldung.multipledb.PersistenceProductConfiguration; +import com.baeldung.multipledb.PersistenceUserConfiguration; + +@RunWith(SpringRunner.class) +@DataJpaTest(excludeAutoConfiguration = { + PersistenceConfiguration.class, + PersistenceUserConfiguration.class, + PersistenceProductConfiguration.class }) +@ContextConfiguration(classes = Application.class) +public class SpringJpaContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java new file mode 100644 index 0000000000..b2581b8034 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java @@ -0,0 +1,545 @@ +package com.baeldung.boot.daos; + +import org.junit.After; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.domain.JpaSort; +import org.springframework.data.mapping.PropertyReferenceException; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.boot.daos.user.UserRepository; +import com.baeldung.boot.domain.User; + +import javax.persistence.EntityManager; +import javax.persistence.Query; +import java.time.LocalDate; +import java.util.*; +import java.util.function.Predicate; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.*; + +public class UserRepositoryCommon { + + final String USER_EMAIL = "email@example.com"; + final String USER_EMAIL2 = "email2@example.com"; + final String USER_EMAIL3 = "email3@example.com"; + final String USER_EMAIL4 = "email4@example.com"; + final Integer INACTIVE_STATUS = 0; + final Integer ACTIVE_STATUS = 1; + final String USER_EMAIL5 = "email5@example.com"; + final String USER_EMAIL6 = "email6@example.com"; + final String USER_NAME_ADAM = "Adam"; + final String USER_NAME_PETER = "Peter"; + + @Autowired + protected UserRepository userRepository; + @Autowired + private EntityManager entityManager; + + @Test + @Transactional + public void givenUsersWithSameNameInDB_WhenFindAllByName_ThenReturnStreamOfUsers() { + User user1 = new User(); + user1.setName(USER_NAME_ADAM); + user1.setEmail(USER_EMAIL); + userRepository.save(user1); + + User user2 = new User(); + user2.setName(USER_NAME_ADAM); + user2.setEmail(USER_EMAIL2); + userRepository.save(user2); + + User user3 = new User(); + user3.setName(USER_NAME_ADAM); + user3.setEmail(USER_EMAIL3); + userRepository.save(user3); + + User user4 = new User(); + user4.setName("SAMPLE"); + user4.setEmail(USER_EMAIL4); + userRepository.save(user4); + + try (Stream foundUsersStream = userRepository.findAllByName(USER_NAME_ADAM)) { + assertThat(foundUsersStream.count()).isEqualTo(3l); + } + } + + @Test + public void givenUsersInDB_WhenFindAllWithQueryAnnotation_ThenReturnCollectionWithActiveUsers() { + User user1 = new User(); + user1.setName(USER_NAME_ADAM); + user1.setEmail(USER_EMAIL); + user1.setStatus(ACTIVE_STATUS); + userRepository.save(user1); + + User user2 = new User(); + user2.setName(USER_NAME_ADAM); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User user3 = new User(); + user3.setName(USER_NAME_ADAM); + user3.setEmail(USER_EMAIL3); + user3.setStatus(INACTIVE_STATUS); + userRepository.save(user3); + + Collection allActiveUsers = userRepository.findAllActiveUsers(); + + assertThat(allActiveUsers.size()).isEqualTo(2); + } + + @Test + public void givenUsersInDB_WhenFindAllWithQueryAnnotationNative_ThenReturnCollectionWithActiveUsers() { + User user1 = new User(); + user1.setName(USER_NAME_ADAM); + user1.setEmail(USER_EMAIL); + user1.setStatus(ACTIVE_STATUS); + userRepository.save(user1); + + User user2 = new User(); + user2.setName(USER_NAME_ADAM); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User user3 = new User(); + user3.setName(USER_NAME_ADAM); + user3.setEmail(USER_EMAIL3); + user3.setStatus(INACTIVE_STATUS); + userRepository.save(user3); + + Collection allActiveUsers = userRepository.findAllActiveUsersNative(); + + assertThat(allActiveUsers.size()).isEqualTo(2); + } + + @Test + public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotation_ThenReturnActiveUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByStatus(ACTIVE_STATUS); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotationNative_ThenReturnActiveUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByStatusNative(ACTIVE_STATUS); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationIndexedParams_ThenReturnOneUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User userByStatus = userRepository.findUserByStatusAndName(ACTIVE_STATUS, USER_NAME_ADAM); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParams_ThenReturnOneUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User userByStatus = userRepository.findUserByStatusAndNameNamedParams(ACTIVE_STATUS, USER_NAME_ADAM); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNativeNamedParams_ThenReturnOneUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User userByStatus = userRepository.findUserByStatusAndNameNamedParamsNative(ACTIVE_STATUS, USER_NAME_ADAM); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParamsCustomNames_ThenReturnOneUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + user2.setStatus(ACTIVE_STATUS); + userRepository.save(user2); + + User userByStatus = userRepository.findUserByUserStatusAndUserName(ACTIVE_STATUS, USER_NAME_ADAM); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationIndexedParams_ThenReturnUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByNameLike("Ad"); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNamedParams_ThenReturnUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByNameLikeNamedParam("Ad"); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNative_ThenReturnUser() { + User user = new User(); + user.setName(USER_NAME_ADAM); + user.setEmail(USER_EMAIL); + user.setStatus(ACTIVE_STATUS); + userRepository.save(user); + + User userByStatus = userRepository.findUserByNameLikeNative("Ad"); + + assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindAllWithSortByName_ThenReturnUsersSorted() { + userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); + + List usersSortByName = userRepository.findAll(Sort.by(Sort.Direction.ASC, "name")); + + assertThat(usersSortByName.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test(expected = PropertyReferenceException.class) + public void givenUsersInDB_WhenFindAllSortWithFunction_ThenThrowException() { + userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); + + userRepository.findAll(Sort.by(Sort.Direction.ASC, "name")); + + List usersSortByNameLength = userRepository.findAll(Sort.by("LENGTH(name)")); + + assertThat(usersSortByNameLength.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindAllSortWithFunctionQueryAnnotationJPQL_ThenReturnUsersSorted() { + userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); + + userRepository.findAllUsers(Sort.by("name")); + + List usersSortByNameLength = userRepository.findAllUsers(JpaSort.unsafe("LENGTH(name)")); + + assertThat(usersSortByNameLength.get(0) + .getName()).isEqualTo(USER_NAME_ADAM); + } + + @Test + public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationJPQL_ThenReturnPageOfUsers() { + userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL4, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE2", LocalDate.now(), USER_EMAIL5, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL6, INACTIVE_STATUS)); + + Page usersPage = userRepository.findAllUsersWithPagination(PageRequest.of(1, 3)); + + assertThat(usersPage.getContent() + .get(0) + .getName()).isEqualTo("SAMPLE1"); + } + + @Test + public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationNative_ThenReturnPageOfUsers() { + userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL4, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE2", LocalDate.now(), USER_EMAIL5, INACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL6, INACTIVE_STATUS)); + + Page usersSortByNameLength = userRepository.findAllUsersWithPaginationNative(PageRequest.of(1, 3)); + + assertThat(usersSortByNameLength.getContent() + .get(0) + .getName()).isEqualTo(USER_NAME_PETER); + } + + @Test + @Transactional + public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationJPQL_ThenModifyMatchingUsers() { + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); + + int updatedUsersSize = userRepository.updateUserSetStatusForName(INACTIVE_STATUS, "SAMPLE"); + + assertThat(updatedUsersSize).isEqualTo(2); + } + + @Test + public void givenUsersInDB_WhenFindByEmailsWithDynamicQuery_ThenReturnCollection() { + + User user1 = new User(); + user1.setEmail(USER_EMAIL); + userRepository.save(user1); + + User user2 = new User(); + user2.setEmail(USER_EMAIL2); + userRepository.save(user2); + + User user3 = new User(); + user3.setEmail(USER_EMAIL3); + userRepository.save(user3); + + Set emails = new HashSet<>(); + emails.add(USER_EMAIL2); + emails.add(USER_EMAIL3); + + Collection usersWithEmails = userRepository.findUserByEmails(emails); + + assertThat(usersWithEmails.size()).isEqualTo(2); + } + + @Test + public void givenUsersInDBWhenFindByNameListReturnCollection() { + + User user1 = new User(); + user1.setName(USER_NAME_ADAM); + user1.setEmail(USER_EMAIL); + userRepository.save(user1); + + User user2 = new User(); + user2.setName(USER_NAME_PETER); + user2.setEmail(USER_EMAIL2); + userRepository.save(user2); + + List names = Arrays.asList(USER_NAME_ADAM, USER_NAME_PETER); + + List usersWithNames = userRepository.findUserByNameList(names); + + assertThat(usersWithNames.size()).isEqualTo(2); + } + + + @Test + @Transactional + public void whenInsertedWithQuery_ThenUserIsPersisted() { + userRepository.insertUser(USER_NAME_ADAM, 1, USER_EMAIL, ACTIVE_STATUS, true); + userRepository.insertUser(USER_NAME_PETER, 1, USER_EMAIL2, ACTIVE_STATUS, true); + + User userAdam = userRepository.findUserByNameLike(USER_NAME_ADAM); + User userPeter = userRepository.findUserByNameLike(USER_NAME_PETER); + + assertThat(userAdam).isNotNull(); + assertThat(userAdam.getEmail()).isEqualTo(USER_EMAIL); + assertThat(userPeter).isNotNull(); + assertThat(userPeter.getEmail()).isEqualTo(USER_EMAIL2); + } + + + @Test + @Transactional + public void givenTwoUsers_whenFindByNameUsr01_ThenUserUsr01() { + User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); + User usr02 = new User("usr02", LocalDate.now(), "usr02@baeldung.com", 1); + + userRepository.save(usr01); + userRepository.save(usr02); + + try (Stream users = userRepository.findAllByName("usr01")) { + assertTrue(users.allMatch(usr -> usr.equals(usr01))); + } + } + + @Test + @Transactional + public void givenTwoUsers_whenFindByNameUsr00_ThenNoUsers() { + User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); + User usr02 = new User("usr02", LocalDate.now(), "usr02@baeldung.com", 1); + + userRepository.save(usr01); + userRepository.save(usr02); + + try (Stream users = userRepository.findAllByName("usr00")) { + assertEquals(0, users.count()); + } + } + + @Test + public void givenTwoUsers_whenFindUsersWithGmailAddress_ThenUserUsr02() { + User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); + User usr02 = new User("usr02", LocalDate.now(), "usr02@gmail.com", 1); + + userRepository.save(usr01); + userRepository.save(usr02); + + List users = userRepository.findUsersWithGmailAddress(); + assertEquals(1, users.size()); + assertEquals(usr02, users.get(0)); + } + + @Test + @Transactional + public void givenTwoUsers_whenDeleteAllByCreationDateAfter_ThenOneUserRemains() { + User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); + User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.com", 1); + + userRepository.save(usr01); + userRepository.save(usr02); + + userRepository.deleteAllByCreationDateAfter(LocalDate.of(2018, 5, 1)); + + List users = userRepository.findAll(); + + assertEquals(1, users.size()); + assertEquals(usr01, users.get(0)); + } + + @Test + public void givenTwoUsers_whenFindAllUsersByPredicates_ThenUserUsr01() { + User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); + User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); + + userRepository.save(usr01); + userRepository.save(usr02); + + List> predicates = new ArrayList<>(); + predicates.add(usr -> usr.getCreationDate().isAfter(LocalDate.of(2017, 12, 31))); + predicates.add(usr -> usr.getEmail().endsWith(".com")); + + List users = userRepository.findAllUsersByPredicates(predicates); + + assertEquals(1, users.size()); + assertEquals(usr01, users.get(0)); + } + + @Test + @Transactional + public void givenTwoUsers_whenDeactivateUsersNotLoggedInSince_ThenUserUsr02Deactivated() { + User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); + usr01.setLastLoginDate(LocalDate.now()); + User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); + usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); + + userRepository.save(usr01); + userRepository.save(usr02); + + userRepository.deactivateUsersNotLoggedInSince(LocalDate.of(2018, 8, 1)); + + List users = userRepository.findAllUsers(Sort.by(Sort.Order.asc("name"))); + assertTrue(users.get(0).isActive()); + assertFalse(users.get(1).isActive()); + } + + @Test + @Transactional + public void givenTwoUsers_whenDeleteDeactivatedUsers_ThenUserUsr02Deleted() { + User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); + usr01.setLastLoginDate(LocalDate.now()); + User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.com", 0); + usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); + usr02.setActive(false); + + userRepository.save(usr01); + userRepository.save(usr02); + + int deletedUsersCount = userRepository.deleteDeactivatedUsers(); + + List users = userRepository.findAll(); + assertEquals(1, users.size()); + assertEquals(usr01, users.get(0)); + assertEquals(1, deletedUsersCount); + } + + @Test + @Transactional + public void givenTwoUsers_whenAddDeletedColumn_ThenUsersHaveDeletedColumn() { + User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); + usr01.setLastLoginDate(LocalDate.now()); + User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); + usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); + usr02.setActive(false); + + userRepository.save(usr01); + userRepository.save(usr02); + + userRepository.addDeletedColumn(); + + Query nativeQuery = entityManager.createNativeQuery("select deleted from USERS where NAME = 'usr01'"); + assertEquals(0, nativeQuery.getResultList().get(0)); + } + + @After + public void cleanUp() { + userRepository.deleteAll(); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryIntegrationTest.java new file mode 100644 index 0000000000..1b1d264574 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryIntegrationTest.java @@ -0,0 +1,37 @@ +package com.baeldung.boot.daos; + +import com.baeldung.boot.Application; +import com.baeldung.boot.domain.User; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDate; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Created by adam. + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@DirtiesContext +public class UserRepositoryIntegrationTest extends UserRepositoryCommon { + + @Test + @Transactional + public void givenUsersInDBWhenUpdateStatusForNameModifyingQueryAnnotationNativeThenModifyMatchingUsers() { + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); + userRepository.flush(); + + int updatedUsersSize = userRepository.updateUserSetStatusForNameNative(INACTIVE_STATUS, "SAMPLE"); + + assertThat(updatedUsersSize).isEqualTo(2); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java new file mode 100644 index 0000000000..99eabc8271 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java @@ -0,0 +1,43 @@ +package com.baeldung.boot.daos; + +import com.baeldung.boot.Application; +import com.baeldung.boot.domain.User; +import com.baeldung.util.BaeldungPostgresqlContainer; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; +import org.testcontainers.containers.PostgreSQLContainer; + +import java.time.LocalDate; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Created by adam. + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@ActiveProfiles({"tc", "tc-auto"}) +public class UserRepositoryTCAutoLiveTest extends UserRepositoryCommon { + + @ClassRule + public static PostgreSQLContainer postgreSQLContainer = BaeldungPostgresqlContainer.getInstance(); + + @Test + @Transactional + public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationNativePostgres_ThenModifyMatchingUsers() { + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); + userRepository.flush(); + + int updatedUsersSize = userRepository.updateUserSetStatusForNameNativePostgres(INACTIVE_STATUS, "SAMPLE"); + + assertThat(updatedUsersSize).isEqualTo(2); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java new file mode 100644 index 0000000000..be8843c166 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java @@ -0,0 +1,58 @@ +package com.baeldung.boot.daos; + +import com.baeldung.boot.Application; +import com.baeldung.boot.domain.User; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; +import org.testcontainers.containers.PostgreSQLContainer; + +import java.time.LocalDate; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@ActiveProfiles("tc") +@ContextConfiguration(initializers = {UserRepositoryTCLiveTest.Initializer.class}) +public class UserRepositoryTCLiveTest extends UserRepositoryCommon { + + @ClassRule + public static PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer("postgres:11.1") + .withDatabaseName("integration-tests-db") + .withUsername("sa") + .withPassword("sa"); + + @Test + @Transactional + public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationNative_ThenModifyMatchingUsers() { + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); + userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); + userRepository.flush(); + + int updatedUsersSize = userRepository.updateUserSetStatusForNameNativePostgres(INACTIVE_STATUS, "SAMPLE"); + + assertThat(updatedUsersSize).isEqualTo(2); + } + + static class Initializer + implements ApplicationContextInitializer { + public void initialize(ConfigurableApplicationContext configurableApplicationContext) { + TestPropertyValues.of( + "spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(), + "spring.datasource.username=" + postgreSQLContainer.getUsername(), + "spring.datasource.password=" + postgreSQLContainer.getPassword() + ).applyTo(configurableApplicationContext.getEnvironment()); + } + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/AbstractServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/AbstractServicePersistenceIntegrationTest.java new file mode 100644 index 0000000000..bf0c85fca6 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/AbstractServicePersistenceIntegrationTest.java @@ -0,0 +1,252 @@ +package com.baeldung.boot.services; + +import com.baeldung.boot.domain.Foo; +import com.baeldung.boot.services.IOperations; +import com.baeldung.util.IDUtil; +import org.hamcrest.Matchers; +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.dao.DataAccessException; + +import java.io.Serializable; +import java.util.List; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.*; + +public abstract class AbstractServicePersistenceIntegrationTest { + + // tests + + // find - one + + @Test + /**/public final void givenResourceDoesNotExist_whenResourceIsRetrieved_thenNoResourceIsReceived() { + // When + final Foo createdResource = getApi().findOne(IDUtil.randomPositiveLong()); + + // Then + assertNull(createdResource); + } + + @Test + public void givenResourceExists_whenResourceIsRetrieved_thenNoExceptions() { + final Foo existingResource = persistNewEntity(); + getApi().findOne(existingResource.getId()); + } + + @Test + public void givenResourceDoesNotExist_whenResourceIsRetrieved_thenNoExceptions() { + getApi().findOne(IDUtil.randomPositiveLong()); + } + + @Test + public void givenResourceExists_whenResourceIsRetrieved_thenTheResultIsNotNull() { + final Foo existingResource = persistNewEntity(); + final Foo retrievedResource = getApi().findOne(existingResource.getId()); + assertNotNull(retrievedResource); + } + + @Test + public void givenResourceExists_whenResourceIsRetrieved_thenResourceIsRetrievedCorrectly() { + final Foo existingResource = persistNewEntity(); + final Foo retrievedResource = getApi().findOne(existingResource.getId()); + assertEquals(existingResource, retrievedResource); + } + + // find - one - by name + + // find - all + + @Test + /**/public void whenAllResourcesAreRetrieved_thenNoExceptions() { + getApi().findAll(); + } + + @Test + /**/public void whenAllResourcesAreRetrieved_thenTheResultIsNotNull() { + final List resources = getApi().findAll(); + + assertNotNull(resources); + } + + @Test + /**/public void givenAtLeastOneResourceExists_whenAllResourcesAreRetrieved_thenRetrievedResourcesAreNotEmpty() { + persistNewEntity(); + + // When + final List allResources = getApi().findAll(); + + // Then + assertThat(allResources, not(Matchers. empty())); + } + + @Test + /**/public void givenAnResourceExists_whenAllResourcesAreRetrieved_thenTheExistingResourceIsIndeedAmongThem() { + final Foo existingResource = persistNewEntity(); + + final List resources = getApi().findAll(); + + assertThat(resources, hasItem(existingResource)); + } + + @Test + /**/public void whenAllResourcesAreRetrieved_thenResourcesHaveIds() { + persistNewEntity(); + + // When + final List allResources = getApi().findAll(); + + // Then + for (final Foo resource : allResources) { + assertNotNull(resource.getId()); + } + } + + // create + + @Test(expected = RuntimeException.class) + /**/public void whenNullResourceIsCreated_thenException() { + getApi().create(null); + } + + @Test + /**/public void whenResourceIsCreated_thenNoExceptions() { + persistNewEntity(); + } + + @Test + /**/public void whenResourceIsCreated_thenResourceIsRetrievable() { + final Foo existingResource = persistNewEntity(); + + assertNotNull(getApi().findOne(existingResource.getId())); + } + + @Test + /**/public void whenResourceIsCreated_thenSavedResourceIsEqualToOriginalResource() { + final Foo originalResource = createNewEntity(); + final Foo savedResource = getApi().create(originalResource); + + assertEquals(originalResource, savedResource); + } + + @Test(expected = RuntimeException.class) + public void whenResourceWithFailedConstraintsIsCreated_thenException() { + final Foo invalidResource = createNewEntity(); + invalidate(invalidResource); + + getApi().create(invalidResource); + } + + /** + * -- specific to the persistence engine + */ + @Test(expected = DataAccessException.class) + @Ignore("Hibernate simply ignores the id silently and still saved (tracking this)") + public void whenResourceWithIdIsCreated_thenDataAccessException() { + final Foo resourceWithId = createNewEntity(); + resourceWithId.setId(IDUtil.randomPositiveLong()); + + getApi().create(resourceWithId); + } + + // update + + @Test(expected = RuntimeException.class) + /**/public void whenNullResourceIsUpdated_thenException() { + getApi().update(null); + } + + @Test + /**/public void givenResourceExists_whenResourceIsUpdated_thenNoExceptions() { + // Given + final Foo existingResource = persistNewEntity(); + + // When + getApi().update(existingResource); + } + + /** + * - can also be the ConstraintViolationException which now occurs on the update operation will not be translated; as a consequence, it will be a TransactionSystemException + */ + @Test(expected = RuntimeException.class) + public void whenResourceIsUpdatedWithFailedConstraints_thenException() { + final Foo existingResource = persistNewEntity(); + invalidate(existingResource); + + getApi().update(existingResource); + } + + @Test + /**/public void givenResourceExists_whenResourceIsUpdated_thenUpdatesArePersisted() { + // Given + final Foo existingResource = persistNewEntity(); + + // When + change(existingResource); + getApi().update(existingResource); + + final Foo updatedResource = getApi().findOne(existingResource.getId()); + + // Then + assertEquals(existingResource, updatedResource); + } + + // delete + + // @Test(expected = RuntimeException.class) + // public void givenResourceDoesNotExists_whenResourceIsDeleted_thenException() { + // // When + // getApi().delete(IDUtil.randomPositiveLong()); + // } + // + // @Test(expected = RuntimeException.class) + // public void whenResourceIsDeletedByNegativeId_thenException() { + // // When + // getApi().delete(IDUtil.randomNegativeLong()); + // } + // + // @Test + // public void givenResourceExists_whenResourceIsDeleted_thenNoExceptions() { + // // Given + // final Foo existingResource = persistNewEntity(); + // + // // When + // getApi().delete(existingResource.getId()); + // } + // + // @Test + // /**/public final void givenResourceExists_whenResourceIsDeleted_thenResourceNoLongerExists() { + // // Given + // final Foo existingResource = persistNewEntity(); + // + // // When + // getApi().delete(existingResource.getId()); + // + // // Then + // assertNull(getApi().findOne(existingResource.getId())); + // } + + // template method + + protected Foo createNewEntity() { + return new Foo(randomAlphabetic(6)); + } + + protected abstract IOperations getApi(); + + private final void invalidate(final Foo entity) { + entity.setName(null); + } + + private final void change(final Foo entity) { + entity.setName(randomAlphabetic(6)); + } + + protected Foo persistNewEntity() { + return getApi().create(createNewEntity()); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/FooServicePersistenceIntegrationTest.java new file mode 100644 index 0000000000..72de4918a2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/FooServicePersistenceIntegrationTest.java @@ -0,0 +1,75 @@ +package com.baeldung.boot.services; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.junit.Assert.assertNotNull; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.dao.InvalidDataAccessApiUsageException; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; +import com.baeldung.boot.domain.Foo; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes=Application.class) +public class FooServicePersistenceIntegrationTest extends AbstractServicePersistenceIntegrationTest { + + @Autowired + private IFooService service; + + // tests + + @Test + public final void whenContextIsBootstrapped_thenNoExceptions() { + // + } + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + service.create(new Foo(randomAlphabetic(6))); + } + + @Test(expected = DataIntegrityViolationException.class) + public final void whenInvalidEntityIsCreated_thenDataException() { + service.create(new Foo()); + } + + @Test(expected = DataIntegrityViolationException.class) + public final void whenEntityWithLongNameIsCreated_thenDataException() { + service.create(new Foo(randomAlphabetic(2048))); + } + + // custom Query method + + @Test + public final void givenUsingCustomQuery_whenRetrievingEntity_thenFound() { + final String name = randomAlphabetic(6); + service.create(new Foo(name)); + + final Foo retrievedByName = service.retrieveByName(name); + assertNotNull(retrievedByName); + } + + // work in progress + + @Test(expected = InvalidDataAccessApiUsageException.class) + @Ignore("Right now, persist has saveOrUpdate semantics, so this will no longer fail") + public final void whenSameEntityIsCreatedTwice_thenDataException() { + final Foo entity = new Foo(randomAlphabetic(8)); + service.create(entity); + service.create(entity); + } + + // API + + @Override + protected final IOperations getApi() { + return service; + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/SpringDataJPABarAuditIntegrationTest.java new file mode 100644 index 0000000000..644d1ec805 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/boot/services/SpringDataJPABarAuditIntegrationTest.java @@ -0,0 +1,75 @@ +package com.baeldung.boot.services; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.Application; +import com.baeldung.boot.domain.Bar; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes=Application.class) +public class SpringDataJPABarAuditIntegrationTest { + + private static Logger logger = LoggerFactory.getLogger(SpringDataJPABarAuditIntegrationTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + logger.info("setUpBeforeClass()"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.info("tearDownAfterClass()"); + } + + @Autowired + @Qualifier("barSpringDataJpaService") + private IBarService barService; + + @Autowired + private EntityManagerFactory entityManagerFactory; + + private EntityManager em; + + @Before + public void setUp() throws Exception { + logger.info("setUp()"); + em = entityManagerFactory.createEntityManager(); + } + + @After + public void tearDown() throws Exception { + logger.info("tearDown()"); + em.close(); + } + + @Test + @WithMockUser(username = "tutorialuser") + public final void whenBarsModified_thenBarsAudited() { + Bar bar = new Bar("BAR1"); + barService.create(bar); + assertEquals(bar.getCreatedDate(), bar.getModifiedDate()); + assertEquals("tutorialuser", bar.getCreatedBy(), bar.getModifiedBy()); + bar.setName("BAR2"); + bar = barService.update(bar); + assertTrue(bar.getCreatedDate() < bar.getModifiedDate()); + assertEquals("tutorialuser", bar.getCreatedBy(), bar.getModifiedBy()); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/elementcollection/ElementCollectionIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/elementcollection/ElementCollectionIntegrationTest.java new file mode 100644 index 0000000000..306798aa68 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/elementcollection/ElementCollectionIntegrationTest.java @@ -0,0 +1,64 @@ +package com.baeldung.elementcollection; + +import com.baeldung.elementcollection.model.Employee; +import com.baeldung.elementcollection.model.Phone; +import com.baeldung.elementcollection.repository.EmployeeRepository; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ElementCollectionApplication.class) +public class ElementCollectionIntegrationTest { + + @Autowired + private EmployeeRepository employeeRepository; + + @Before + public void init() { + Employee employee = new Employee(1, "Fred"); + employee.setPhones( + Arrays.asList(new Phone("work", "+55", "99999-9999"), new Phone("home", "+55", "98888-8888"))); + employeeRepository.save(employee); + } + + @After + public void clean() { + employeeRepository.remove(1); + } + + @Test(expected = org.hibernate.LazyInitializationException.class) + public void whenAccessLazyCollection_thenThrowLazyInitializationException() { + Employee employee = employeeRepository.findById(1); + assertThat(employee.getPhones().size(), is(2)); + } + + @Test + public void whenUseJPAQL_thenFetchResult() { + Employee employee = employeeRepository.findByJPQL(1); + assertThat(employee.getPhones().size(), is(2)); + } + + @Test + public void whenUseEntityGraph_thenFetchResult() { + Employee employee = employeeRepository.findByEntityGraph(1); + assertThat(employee.getPhones().size(), is(2)); + } + + @Test + @Transactional + public void whenUseTransaction_thenFetchResult() { + Employee employee = employeeRepository.findById(1); + assertThat(employee.getPhones().size(), is(2)); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java new file mode 100644 index 0000000000..a1f4a3fa2c --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java @@ -0,0 +1,96 @@ +package com.baeldung.multipledb; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.Collections; +import java.util.Optional; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.multipledb.dao.product.ProductRepository; +import com.baeldung.multipledb.dao.user.PossessionRepository; +import com.baeldung.multipledb.dao.user.UserRepository; +import com.baeldung.multipledb.model.product.Product; +import com.baeldung.multipledb.model.user.PossessionMultipleDB; +import com.baeldung.multipledb.model.user.UserMultipleDB; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes=MultipleDbApplication.class) +@EnableTransactionManagement +public class JpaMultipleDBIntegrationTest { + + @Autowired + private UserRepository userRepository; + + @Autowired + private PossessionRepository possessionRepository; + + @Autowired + private ProductRepository productRepository; + + // tests + + @Test + @Transactional("userTransactionManager") + public void whenCreatingUser_thenCreated() { + UserMultipleDB user = new UserMultipleDB(); + user.setName("John"); + user.setEmail("john@test.com"); + user.setAge(20); + PossessionMultipleDB p = new PossessionMultipleDB("sample"); + p = possessionRepository.save(p); + user.setPossessionList(Collections.singletonList(p)); + user = userRepository.save(user); + final Optional result = userRepository.findById(user.getId()); + assertTrue(result.isPresent()); + System.out.println(result.get().getPossessionList()); + assertEquals(1, result.get().getPossessionList().size()); + } + + @Test + @Transactional("userTransactionManager") + public void whenCreatingUsersWithSameEmail_thenRollback() { + UserMultipleDB user1 = new UserMultipleDB(); + user1.setName("John"); + user1.setEmail("john@test.com"); + user1.setAge(20); + user1 = userRepository.save(user1); + assertTrue(userRepository.findById(user1.getId()).isPresent()); + + UserMultipleDB user2 = new UserMultipleDB(); + user2.setName("Tom"); + user2.setEmail("john@test.com"); + user2.setAge(10); + try { + user2 = userRepository.save(user2); + userRepository.flush(); + fail("DataIntegrityViolationException should be thrown!"); + } catch (final DataIntegrityViolationException e) { + // Expected + } catch (final Exception e) { + fail("DataIntegrityViolationException should be thrown, instead got: " + e); + } + } + + @Test + @Transactional("productTransactionManager") + public void whenCreatingProduct_thenCreated() { + Product product = new Product(); + product.setName("Book"); + product.setId(2); + product.setPrice(20); + product = productRepository.save(product); + + assertTrue(productRepository.findById(product.getId()).isPresent()); + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java new file mode 100644 index 0000000000..9bfba61a3b --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java @@ -0,0 +1,144 @@ +package com.baeldung.multipledb; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.multipledb.PersistenceProductConfiguration; +import com.baeldung.multipledb.dao.product.ProductRepository; +import com.baeldung.multipledb.model.product.Product; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes=MultipleDbApplication.class) +@EnableTransactionManagement +public class ProductRepositoryIntegrationTest { + + @Autowired + private ProductRepository productRepository; + + @Before + @Transactional("productTransactionManager") + public void setUp() { + productRepository.save(Product.from(1001, "Book", 21)); + productRepository.save(Product.from(1002, "Coffee", 10)); + productRepository.save(Product.from(1003, "Jeans", 30)); + productRepository.save(Product.from(1004, "Shirt", 32)); + productRepository.save(Product.from(1005, "Bacon", 10)); + } + + @Test + public void whenRequestingFirstPageOfSizeTwo_ThenReturnFirstPage() { + Pageable pageRequest = PageRequest.of(0, 2); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(2)); + assertTrue(result.stream() + .map(Product::getId) + .allMatch(id -> Arrays.asList(1001, 1002) + .contains(id))); + } + + @Test + public void whenRequestingSecondPageOfSizeTwo_ThenReturnSecondPage() { + Pageable pageRequest = PageRequest.of(1, 2); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(2)); + assertTrue(result.stream() + .map(Product::getId) + .allMatch(id -> Arrays.asList(1003, 1004) + .contains(id))); + } + + @Test + public void whenRequestingLastPage_ThenReturnLastPageWithRemData() { + Pageable pageRequest = PageRequest.of(2, 2); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(1)); + assertTrue(result.stream() + .map(Product::getId) + .allMatch(id -> Arrays.asList(1005) + .contains(id))); + } + + @Test + public void whenSortingByNameAscAndPaging_ThenReturnSortedPagedResult() { + Pageable pageRequest = PageRequest.of(0, 3, Sort.by("name")); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(3)); + assertThat(result.getContent() + .stream() + .map(Product::getId) + .collect(Collectors.toList()), equalTo(Arrays.asList(1005, 1001, 1002))); + + } + + @Test + public void whenSortingByPriceDescAndPaging_ThenReturnSortedPagedResult() { + Pageable pageRequest = PageRequest.of(0, 3, Sort.by("price") + .descending()); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(3)); + assertThat(result.getContent() + .stream() + .map(Product::getId) + .collect(Collectors.toList()), equalTo(Arrays.asList(1004, 1003, 1001))); + + } + + @Test + public void whenSortingByPriceDescAndNameAscAndPaging_ThenReturnSortedPagedResult() { + Pageable pageRequest = PageRequest.of(0, 5, Sort.by("price") + .descending() + .and(Sort.by("name"))); + + Page result = productRepository.findAll(pageRequest); + + assertThat(result.getContent(), hasSize(5)); + assertThat(result.getContent() + .stream() + .map(Product::getId) + .collect(Collectors.toList()), equalTo(Arrays.asList(1004, 1003, 1001, 1005, 1002))); + + } + + @Test + public void whenRequestingFirstPageOfSizeTwoUsingCustomMethod_ThenReturnFirstPage() { + Pageable pageRequest = PageRequest.of(0, 2); + + List result = productRepository.findAllByPrice(10, pageRequest); + + assertThat(result, hasSize(2)); + assertTrue(result.stream() + .map(Product::getId) + .allMatch(id -> Arrays.asList(1002, 1005) + .contains(id))); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyH2IntegrationTest.java new file mode 100644 index 0000000000..71a4dbda3f --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyH2IntegrationTest.java @@ -0,0 +1,81 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("quoted-lower-case-naming-strategy.properties") +class QuotedLowerCaseNamingStrategyH2IntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonUnquoted_thenException(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Unexpected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + @Test + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Expected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + @Test + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyPostgresLiveTest.java new file mode 100644 index 0000000000..6b1c984600 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyPostgresLiveTest.java @@ -0,0 +1,85 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("quoted-lower-case-naming-strategy-on-postgres.properties") +class QuotedLowerCaseNamingStrategyPostgresLiveTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Expected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + @Test + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyH2IntegrationTest.java new file mode 100644 index 0000000000..f819327a5c --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyH2IntegrationTest.java @@ -0,0 +1,85 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("quoted-upper-case-naming-strategy.properties") +class QuotedUpperCaseNamingStrategyH2IntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonUnquoted_thenException(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Expected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyPostgresLiveTest.java new file mode 100644 index 0000000000..bd23b81b4b --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyPostgresLiveTest.java @@ -0,0 +1,81 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("quoted-upper-case-naming-strategy-on-postgres.properties") +class QuotedUpperCaseNamingStrategyPostgresLiveTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Unexpected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + @Test + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Expected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyH2IntegrationTest.java new file mode 100644 index 0000000000..1850fea173 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyH2IntegrationTest.java @@ -0,0 +1,85 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("spring-physical-naming-strategy.properties") +class SpringPhysicalNamingStrategyH2IntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndSpringNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndSpringNamingStrategy_whenQueryPersonQuotedUpperCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Unexpected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndSpringNamingStrategy_whenQueryPersonQuotedLowerCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Unexpected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyPostgresLiveTest.java new file mode 100644 index 0000000000..e26ebb148d --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyPostgresLiveTest.java @@ -0,0 +1,85 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("spring-physical-naming-strategy-on-postgres.properties") +class SpringPhysicalNamingStrategyPostgresLiveTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndSpringNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndSpringNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Expected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + @Test + void givenPeopleAndSpringNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyH2IntegrationTest.java new file mode 100644 index 0000000000..6311c42e93 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyH2IntegrationTest.java @@ -0,0 +1,86 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("unquoted-lower-case-naming-strategy.properties") +class UnquotedLowerCaseNamingStrategyH2IntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Unexpected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Unexpected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyPostgresLiveTest.java new file mode 100644 index 0000000000..033a213cf5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyPostgresLiveTest.java @@ -0,0 +1,85 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("unquoted-lower-case-naming-strategy-on-postgres.properties") +class UnquotedLowerCaseNamingStrategyPostgresLiveTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Expected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + @Test + void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyH2IntegrationTest.java new file mode 100644 index 0000000000..7af8001854 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyH2IntegrationTest.java @@ -0,0 +1,85 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("unquoted-upper-case-naming-strategy.properties") +class UnquotedUpperCaseNamingStrategyH2IntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Expected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyPostgresLiveTest.java new file mode 100644 index 0000000000..0151e7ece4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyPostgresLiveTest.java @@ -0,0 +1,85 @@ +package com.baeldung.namingstrategy; + +import org.hibernate.exception.SQLGrammarException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.TestPropertySource; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) +@TestPropertySource("unquoted-upper-case-naming-strategy-on-postgres.properties") +class UnquotedUpperCaseNamingStrategyPostgresLiveTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private PersonRepository personRepository; + + @BeforeEach + void insertPeople() { + personRepository.saveAll(Arrays.asList( + new Person(1L, "John", "Doe"), + new Person(2L, "Jane", "Doe"), + new Person(3L, "Ted", "Mosby") + )); + } + + @ParameterizedTest + @ValueSource(strings = {"person", "PERSON", "Person"}) + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { + Query query = entityManager.createNativeQuery("select * from " + tableName); + + // Expected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + @Test + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { + Query query = entityManager.createNativeQuery("select * from \"PERSON\""); + + // Unexpected result + assertThrows(SQLGrammarException.class, query::getResultStream); + } + + @Test + void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { + Query query = entityManager.createNativeQuery("select * from \"person\""); + + // Unexpected result + List result = (List) query.getResultStream() + .map(this::fromDatabase) + .collect(Collectors.toList()); + + assertThat(result).isNotEmpty(); + } + + public Person fromDatabase(Object databaseRow) { + Object[] typedDatabaseRow = (Object[]) databaseRow; + + return new Person( + ((BigInteger) typedDatabaseRow[0]).longValue(), + (String) typedDatabaseRow[1], + (String) typedDatabaseRow[2] + ); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java new file mode 100644 index 0000000000..350b67e1c9 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java @@ -0,0 +1,56 @@ +package com.baeldung.osiv; + +import com.baeldung.osiv.model.BasicUser; +import com.baeldung.osiv.repository.BasicUserRepository; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.web.servlet.MockMvc; + +import java.util.Arrays; +import java.util.HashSet; + +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@SpringBootTest +@AutoConfigureMockMvc +@ActiveProfiles("test") +@ContextConfiguration(classes = OsivApplication.class) +class UserControllerIntegrationTest { + + @Autowired + private BasicUserRepository userRepository; + + @Autowired + private MockMvc mockMvc; + + @BeforeEach + void setUp() { + BasicUser user = new BasicUser(); + user.setUsername("root"); + user.setPermissions(new HashSet<>(Arrays.asList("PERM_READ", "PERM_WRITE"))); + + userRepository.save(user); + } + + @Test + void givenTheUserExists_WhenOsivIsEnabled_ThenLazyInitWorkEverywhere() throws Exception { + mockMvc.perform(get("/users/root")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.username").value("root")) + .andExpect(jsonPath("$.permissions", containsInAnyOrder("PERM_READ", "PERM_WRITE"))); + } + + @AfterEach + void flushDb() { + userRepository.deleteAll(); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/partialupdate/PartialUpdateUnitTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/partialupdate/PartialUpdateUnitTest.java new file mode 100644 index 0000000000..874e18c4ad --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/partialupdate/PartialUpdateUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.partialupdate; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.partialupdate.model.Customer; +import com.baeldung.partialupdate.model.CustomerDto; +import com.baeldung.partialupdate.model.CustomerStructured; +import com.baeldung.partialupdate.service.CustomerService; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = PartialUpdateApplication.class) +public class PartialUpdateUnitTest { + + @Autowired + CustomerService service; + + @Test + public void givenCustomer_whenUpdate_thenSuccess() { + Customer myCustomer = service.addCustomer("John"); + myCustomer = service.updateCustomer(myCustomer.id, "+00"); + assertEquals("+00", myCustomer.phone); + } + + @Test + public void givenCustomer_whenUpdateWithQuery_thenSuccess() { + Customer myCustomer = service.addCustomer("John"); + service.updateCustomerWithCustomQuery(myCustomer.id, "+88"); + myCustomer = service.getCustomer(myCustomer.id); + assertEquals("+88", myCustomer.phone); + } + + @Test + public void givenCustomerDto_whenUpdateWithMapper_thenSuccess() { + CustomerDto dto = new CustomerDto(new Customer()); + dto.name = "Johnny"; + Customer entity = service.addCustomer(dto); + + CustomerDto dto2 = new CustomerDto(entity.id); + dto2.phone = "+44"; + entity = service.updateCustomer(dto2); + + assertEquals("Johnny", entity.name); + } + + @Test + public void givenCustomerStructured_whenUpdateCustomerPhone_thenSuccess() { + CustomerStructured myCustomer = service.addCustomerStructured("John"); + assertEquals(null, myCustomer.contactPhones); + + service.addCustomerPhone(myCustomer.id, "+44"); + myCustomer = service.updateCustomerStructured(myCustomer.id, "Mr. John"); + + assertNotEquals(null, myCustomer.contactPhones); + assertEquals(1, myCustomer.contactPhones.size()); + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java new file mode 100644 index 0000000000..e5ad2dd448 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java @@ -0,0 +1,35 @@ +package com.baeldung.util; + +import org.testcontainers.containers.PostgreSQLContainer; + +public class BaeldungPostgresqlContainer extends PostgreSQLContainer { + + private static final String IMAGE_VERSION = "postgres:11.1"; + + private static BaeldungPostgresqlContainer container; + + + private BaeldungPostgresqlContainer() { + super(IMAGE_VERSION); + } + + public static BaeldungPostgresqlContainer getInstance() { + if (container == null) { + container = new BaeldungPostgresqlContainer(); + } + return container; + } + + @Override + public void start() { + super.start(); + System.setProperty("DB_URL", container.getJdbcUrl()); + System.setProperty("DB_USERNAME", container.getUsername()); + System.setProperty("DB_PASSWORD", container.getPassword()); + } + + @Override + public void stop() { + //do nothing, JVM handles shut down + } +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/util/IDUtil.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/util/IDUtil.java new file mode 100644 index 0000000000..45e72e046d --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/util/IDUtil.java @@ -0,0 +1,33 @@ +package com.baeldung.util; + +import java.util.Random; + +public final class IDUtil { + + private IDUtil() { + throw new AssertionError(); + } + + // API + + public static String randomPositiveLongAsString() { + return Long.toString(randomPositiveLong()); + } + + public static String randomNegativeLongAsString() { + return Long.toString(randomNegativeLong()); + } + + public static long randomPositiveLong() { + long id = new Random().nextLong() * 10000; + id = (id < 0) ? (-1 * id) : id; + return id; + } + + private static long randomNegativeLong() { + long id = new Random().nextLong() * 10000; + id = (id > 0) ? (-1 * id) : id; + return id; + } + +} diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/application-test.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/application-test.properties new file mode 100644 index 0000000000..e3d39fe1e2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/application-test.properties @@ -0,0 +1,3 @@ +spring.jpa.hibernate.ddl-auto=update +spring.datasource.url=jdbc:h2:mem:baeldung + diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy-on-postgres.properties new file mode 100644 index 0000000000..04b29de41f --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy-on-postgres.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:postgresql://localhost:5432/quoted-lower-case-strategy +spring.datasource.username=postgres +spring.datasource.password=root + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.QuotedLowerCaseNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy.properties new file mode 100644 index 0000000000..6643c12c8a --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:h2:mem:quoted-lower-case-strategy +spring.datasource.username=sa +spring.datasource.password= + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.QuotedLowerCaseNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy-on-postgres.properties new file mode 100644 index 0000000000..36898d5b4f --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy-on-postgres.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:postgresql://localhost:5432/quoted-upper-case-strategy +spring.datasource.username=postgres +spring.datasource.password=root + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.QuotedUpperCaseNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy.properties new file mode 100644 index 0000000000..6d56d58749 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:h2:mem:quoted-upper-case-strategy +spring.datasource.username=sa +spring.datasource.password= + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.QuotedUpperCaseNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy-on-postgres.properties new file mode 100644 index 0000000000..706b12b1b6 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy-on-postgres.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:postgresql://localhost:5432/spring-strategy +spring.datasource.username=postgres +spring.datasource.password=root + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=default-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy.properties new file mode 100644 index 0000000000..c9a0c6f24c --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:h2:mem:spring-strategy +spring.datasource.username=sa +spring.datasource.password= + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=default-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy-on-postgres.properties new file mode 100644 index 0000000000..b22472bd8f --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy-on-postgres.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:postgresql://localhost:5432/unquoted-lower-case-strategy +spring.datasource.username=postgres +spring.datasource.password=root + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.UnquotedLowerCaseNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy.properties new file mode 100644 index 0000000000..8083515b4b --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:h2:mem:unquoted-lower-case-strategy +spring.datasource.username=sa +spring.datasource.password= + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.UnquotedLowerCaseNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy-on-postgres.properties new file mode 100644 index 0000000000..da03a0d7b5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy-on-postgres.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:postgresql://localhost:5432/unquoted-upper-case-strategy +spring.datasource.username=postgres +spring.datasource.password=root + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.UnquotedUpperCaseNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy.properties b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy.properties new file mode 100644 index 0000000000..d1b63e008c --- /dev/null +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy.properties @@ -0,0 +1,9 @@ +spring.datasource.url=jdbc:h2:mem:unquoted-upper-case-strategy +spring.datasource.username=sa +spring.datasource.password= + +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.UnquotedUpperCaseNamingStrategy +#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata +#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create +#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file From 7a86d7de495ebc36a6fae9be9d1ad9c5e888eb4a Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 19 Jul 2020 14:30:43 +0530 Subject: [PATCH 0151/1862] JAVA-66: New module spring-data-jpa-filtering --- .../spring-data-jpa-filtering/README.md | 19 +++++ .../spring-data-jpa-filtering/pom.xml | 77 +++++++++++++++++ .../main/java/com/baeldung/Application.java | 13 +++ .../com/baeldung/config/StudentJpaConfig.java | 68 +++++++++++++++ .../java/com/baeldung/entity/Customer.java | 37 ++++++++ .../dao/ManyStudentRepository.java | 10 +++ .../persistence/dao/ManyTagRepository.java | 7 ++ .../persistence/dao/StudentRepository.java | 24 ++++++ .../inmemory/persistence/model/KVTag.java | 34 ++++++++ .../persistence/model/LocationTag.java | 40 +++++++++ .../persistence/model/ManyStudent.java | 33 ++++++++ .../inmemory/persistence/model/ManyTag.java | 40 +++++++++ .../inmemory/persistence/model/SkillTag.java | 30 +++++++ .../inmemory/persistence/model/Student.java | 74 ++++++++++++++++ .../baeldung/projection/model/Address.java | 57 +++++++++++++ .../com/baeldung/projection/model/Person.java | 47 +++++++++++ .../repository/AddressRepository.java | 11 +++ .../repository/PersonRepository.java | 14 ++++ .../baeldung/projection/view/AddressView.java | 7 ++ .../baeldung/projection/view/PersonDto.java | 34 ++++++++ .../baeldung/projection/view/PersonView.java | 12 +++ .../repository/CustomerRepository.java | 19 +++++ .../resources/persistence-student.properties | 11 +++ .../AdvancedTaggingIntegrationTest.java | 83 ++++++++++++++++++ .../repository/InMemoryDBIntegrationTest.java | 84 +++++++++++++++++++ .../JpaProjectionIntegrationTest.java | 63 ++++++++++++++ .../CustomerRepositoryIntegrationTest.java | 64 ++++++++++++++ .../resources/persistence-student.properties | 9 ++ .../resources/projection-clean-up-data.sql | 2 + .../test/resources/projection-insert-data.sql | 2 + 30 files changed, 1025 insertions(+) create mode 100644 persistence-modules/spring-data-jpa-filtering/README.md create mode 100644 persistence-modules/spring-data-jpa-filtering/pom.xml create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/Application.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/entity/Customer.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/ManyStudentRepository.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/ManyTagRepository.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/StudentRepository.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/KVTag.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/LocationTag.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/ManyStudent.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/ManyTag.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/SkillTag.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/Student.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/model/Address.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/model/Person.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/repository/AddressRepository.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/repository/PersonRepository.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/AddressView.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/PersonDto.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/PersonView.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/repository/CustomerRepository.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/main/resources/persistence-student.properties create mode 100644 persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/persistence/repository/AdvancedTaggingIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/persistence/repository/InMemoryDBIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/projection/JpaProjectionIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/repository/CustomerRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties create mode 100644 persistence-modules/spring-data-jpa-filtering/src/test/resources/projection-clean-up-data.sql create mode 100644 persistence-modules/spring-data-jpa-filtering/src/test/resources/projection-insert-data.sql diff --git a/persistence-modules/spring-data-jpa-filtering/README.md b/persistence-modules/spring-data-jpa-filtering/README.md new file mode 100644 index 0000000000..fe2f181154 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/README.md @@ -0,0 +1,19 @@ +## Spring Data JPA - Filtering + +This module contains articles about filtering data using Spring Data JPA + +### Relevant Articles: +- [An Advanced Tagging Implementation with JPA](https://www.baeldung.com/jpa-tagging-advanced) +- [A Simple Tagging Implementation with JPA](https://www.baeldung.com/jpa-tagging) +- [Spring Data JPA and Null Parameters](https://www.baeldung.com/spring-data-jpa-null-parameters) +- [Spring Data JPA Projections](https://www.baeldung.com/spring-data-jpa-projections) + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator + diff --git a/persistence-modules/spring-data-jpa-filtering/pom.xml b/persistence-modules/spring-data-jpa-filtering/pom.xml new file mode 100644 index 0000000000..2039ef1a37 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/pom.xml @@ -0,0 +1,77 @@ + + + 4.0.0 + spring-data-jpa-filtering + spring-data-jpa-filtering + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.hibernate + hibernate-ehcache + + + org.hibernate + hibernate-envers + + + + com.h2database + h2 + + + + + org.testcontainers + postgresql + ${testcontainers.postgresql.version} + test + + + + org.postgresql + postgresql + + + + + org.springframework.security + spring-security-test + test + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + test + + + + com.google.guava + guava + ${guava.version} + + + + + com.baeldung.boot.Application + 1.10.6 + 42.2.5 + 21.0 + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..3ea3d113da --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/Application.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java new file mode 100644 index 0000000000..08f37ea806 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/config/StudentJpaConfig.java @@ -0,0 +1,68 @@ +package com.baeldung.config; + +import java.util.Properties; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@EnableJpaRepositories(basePackages = "com.baeldung.inmemory.persistence.dao") +@PropertySource("persistence-student.properties") +@EnableTransactionManagement +public class StudentJpaConfig { + + @Autowired + private Environment env; + + @Bean + public DataSource dataSource() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); + dataSource.setUrl(env.getProperty("jdbc.url")); + dataSource.setUsername(env.getProperty("jdbc.user")); + dataSource.setPassword(env.getProperty("jdbc.pass")); + + return dataSource; + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource()); + em.setPackagesToScan(new String[] { "com.baeldung.inmemory.persistence.model" }); + em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); + em.setJpaProperties(additionalProperties()); + return em; + } + + @Bean + JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { + JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory); + return transactionManager; + } + + final Properties additionalProperties() { + final Properties hibernateProperties = new Properties(); + + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql")); + hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache")); + hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache")); + + return hibernateProperties; + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/entity/Customer.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/entity/Customer.java new file mode 100644 index 0000000000..efcae73853 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/entity/Customer.java @@ -0,0 +1,37 @@ +package com.baeldung.entity; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class Customer { + + @Id + @GeneratedValue + private long id; + private String name; + private String email; + + public Customer(String name, String email) { + this.name = name; + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/ManyStudentRepository.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/ManyStudentRepository.java new file mode 100644 index 0000000000..a2aa0c5780 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/ManyStudentRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.inmemory.persistence.dao; + +import com.baeldung.inmemory.persistence.model.ManyStudent; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.List; + +public interface ManyStudentRepository extends JpaRepository { + List findByManyTags_Name(String name); +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/ManyTagRepository.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/ManyTagRepository.java new file mode 100644 index 0000000000..63337f3cb9 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/ManyTagRepository.java @@ -0,0 +1,7 @@ +package com.baeldung.inmemory.persistence.dao; + +import com.baeldung.inmemory.persistence.model.ManyTag; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ManyTagRepository extends JpaRepository { +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/StudentRepository.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/StudentRepository.java new file mode 100644 index 0000000000..8ac91fbf0c --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/dao/StudentRepository.java @@ -0,0 +1,24 @@ +package com.baeldung.inmemory.persistence.dao; + +import com.baeldung.inmemory.persistence.model.Student; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +public interface StudentRepository extends JpaRepository { + + @Query("SELECT s FROM Student s JOIN s.tags t WHERE t = LOWER(:tag)") + List retrieveByTag(@Param("tag") String tag); + + @Query("SELECT s FROM Student s JOIN s.tags t WHERE s.name = LOWER(:name) AND t = LOWER(:tag)") + List retrieveByNameFilterByTag(@Param("name") String name, @Param("tag") String tag); + + @Query("SELECT s FROM Student s JOIN s.skillTags t WHERE t.name = LOWER(:tagName) AND t.value > :tagValue") + List retrieveByNameFilterByMinimumSkillTag(@Param("tagName") String tagName, @Param("tagValue") int tagValue); + + @Query("SELECT s FROM Student s JOIN s.kvTags t WHERE t.key = LOWER(:key)") + List retrieveByKeyTag(@Param("key") String key); + +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/KVTag.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/KVTag.java new file mode 100644 index 0000000000..1fc186f4ce --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/KVTag.java @@ -0,0 +1,34 @@ +package com.baeldung.inmemory.persistence.model; + +import javax.persistence.Embeddable; + +@Embeddable +public class KVTag { + private String key; + private String value; + + public KVTag() { + } + + public KVTag(String key, String value) { + super(); + this.key = key; + this.value = value; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/LocationTag.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/LocationTag.java new file mode 100644 index 0000000000..b12ad9fbd1 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/LocationTag.java @@ -0,0 +1,40 @@ +package com.baeldung.inmemory.persistence.model; + +import javax.persistence.Embeddable; + +@Embeddable +public class LocationTag { + private String name; + private int xPos; + private int yPos; + + public LocationTag() { + } + + public LocationTag(String name, int xPos, int yPos) { + super(); + this.name = name; + this.xPos = xPos; + this.yPos = yPos; + } + + public String getName() { + return name; + } + + public int getxPos() { + return xPos; + } + + public void setxPos(int xPos) { + this.xPos = xPos; + } + + public int getyPos() { + return yPos; + } + + public void setyPos(int yPos) { + this.yPos = yPos; + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/ManyStudent.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/ManyStudent.java new file mode 100644 index 0000000000..190740d582 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/ManyStudent.java @@ -0,0 +1,33 @@ +package com.baeldung.inmemory.persistence.model; + +import javax.persistence.*; +import java.util.HashSet; +import java.util.Set; + +@Entity +public class ManyStudent { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + private String name; + + @ManyToMany(cascade = CascadeType.ALL) + @JoinTable(name = "manystudent_manytags", joinColumns = @JoinColumn(name = "manystudent_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "manytag_id", referencedColumnName = "id")) + private Set manyTags = new HashSet<>(); + + public ManyStudent() { + } + + public ManyStudent(String name) { + this.name = name; + } + + public Set getManyTags() { + return manyTags; + } + + public void setManyTags(Set manyTags) { + this.manyTags.addAll(manyTags); + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/ManyTag.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/ManyTag.java new file mode 100644 index 0000000000..5af898f7df --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/ManyTag.java @@ -0,0 +1,40 @@ +package com.baeldung.inmemory.persistence.model; + +import javax.persistence.*; +import java.util.HashSet; +import java.util.Set; + +@Entity +public class ManyTag { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + private String name; + + @ManyToMany(mappedBy = "manyTags") + private Set students = new HashSet<>(); + + public ManyTag() { + } + + public ManyTag(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Set getStudents() { + return students; + } + + public void setStudents(Set students) { + this.students.addAll(students); + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/SkillTag.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/SkillTag.java new file mode 100644 index 0000000000..738b5d0b36 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/SkillTag.java @@ -0,0 +1,30 @@ +package com.baeldung.inmemory.persistence.model; + +import javax.persistence.Embeddable; + +@Embeddable +public class SkillTag { + private String name; + private int value; + + public SkillTag() { + } + + public SkillTag(String name, int value) { + super(); + this.name = name; + this.value = value; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + public String getName() { + return name; + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/Student.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/Student.java new file mode 100644 index 0000000000..f0e824e165 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/inmemory/persistence/model/Student.java @@ -0,0 +1,74 @@ +package com.baeldung.inmemory.persistence.model; + +import java.util.ArrayList; +import java.util.List; +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Student { + + @Id + private long id; + private String name; + + @ElementCollection + private List tags = new ArrayList<>(); + + @ElementCollection + private List skillTags = new ArrayList<>(); + + @ElementCollection + private List kvTags = new ArrayList<>(); + + public Student() { + } + + public Student(long id, String name) { + super(); + this.id = id; + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags.addAll(tags); + } + + public List getSkillTags() { + return skillTags; + } + + public void setSkillTags(List skillTags) { + this.skillTags.addAll(skillTags); + } + + public List getKVTags() { + return this.kvTags; + } + + public void setKVTags(List kvTags) { + this.kvTags.addAll(kvTags); + } + +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/model/Address.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/model/Address.java new file mode 100644 index 0000000000..0c5a3eac60 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/model/Address.java @@ -0,0 +1,57 @@ +package com.baeldung.projection.model; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToOne; + +@Entity +public class Address { + @Id + private Long id; + @OneToOne + private Person person; + private String state; + private String city; + private String street; + private String zipCode; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getZipCode() { + return zipCode; + } + + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/model/Person.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/model/Person.java new file mode 100644 index 0000000000..d18bd1c72d --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/model/Person.java @@ -0,0 +1,47 @@ +package com.baeldung.projection.model; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToOne; + +@Entity +public class Person { + @Id + private Long id; + private String firstName; + private String lastName; + @OneToOne(mappedBy = "person") + private Address address; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public Address getAddress() { + return address; + } + + public void setAddress(Address address) { + this.address = address; + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/repository/AddressRepository.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/repository/AddressRepository.java new file mode 100644 index 0000000000..c1053f4867 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/repository/AddressRepository.java @@ -0,0 +1,11 @@ +package com.baeldung.projection.repository; + +import com.baeldung.projection.view.AddressView; +import com.baeldung.projection.model.Address; +import org.springframework.data.repository.Repository; + +import java.util.List; + +public interface AddressRepository extends Repository { + List getAddressByState(String state); +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/repository/PersonRepository.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/repository/PersonRepository.java new file mode 100644 index 0000000000..64bc7471e6 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/repository/PersonRepository.java @@ -0,0 +1,14 @@ +package com.baeldung.projection.repository; + +import com.baeldung.projection.model.Person; +import com.baeldung.projection.view.PersonDto; +import com.baeldung.projection.view.PersonView; +import org.springframework.data.repository.Repository; + +public interface PersonRepository extends Repository { + PersonView findByLastName(String lastName); + + PersonDto findByFirstName(String firstName); + + T findByLastName(String lastName, Class type); +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/AddressView.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/AddressView.java new file mode 100644 index 0000000000..7a24a1e9b9 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/AddressView.java @@ -0,0 +1,7 @@ +package com.baeldung.projection.view; + +public interface AddressView { + String getZipCode(); + + PersonView getPerson(); +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/PersonDto.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/PersonDto.java new file mode 100644 index 0000000000..1fd924450b --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/PersonDto.java @@ -0,0 +1,34 @@ +package com.baeldung.projection.view; + +import java.util.Objects; + +public class PersonDto { + private final String firstName; + private final String lastName; + + public PersonDto(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PersonDto personDto = (PersonDto) o; + return Objects.equals(firstName, personDto.firstName) && Objects.equals(lastName, personDto.lastName); + } + + @Override + public int hashCode() { + return Objects.hash(firstName, lastName); + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/PersonView.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/PersonView.java new file mode 100644 index 0000000000..36777ec26f --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/projection/view/PersonView.java @@ -0,0 +1,12 @@ +package com.baeldung.projection.view; + +import org.springframework.beans.factory.annotation.Value; + +public interface PersonView { + String getFirstName(); + + String getLastName(); + + @Value("#{target.firstName + ' ' + target.lastName}") + String getFullName(); +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/repository/CustomerRepository.java b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/repository/CustomerRepository.java new file mode 100644 index 0000000000..65b22bbd84 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/java/com/baeldung/repository/CustomerRepository.java @@ -0,0 +1,19 @@ +package com.baeldung.repository; + +import com.baeldung.entity.Customer; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +public interface CustomerRepository extends JpaRepository { + + List findByName(String name); + + List findByNameAndEmail(String name, String email); + + @Query("SELECT c FROM Customer c WHERE (:name is null or c.name = :name) and (:email is null or c.email = :email)") + List findCustomerByNameAndEmail(@Param("name") String name, @Param("email") String email); + +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/main/resources/persistence-student.properties b/persistence-modules/spring-data-jpa-filtering/src/main/resources/persistence-student.properties new file mode 100644 index 0000000000..d4c82420de --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/main/resources/persistence-student.properties @@ -0,0 +1,11 @@ +jdbc.driverClassName=com.mysql.cj.jdbc.Driver +jdbc.url=jdbc:mysql://localhost:3306/myDb +jdbc.user=tutorialuser +jdbc.pass=tutorialpass + +hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop + +hibernate.cache.use_second_level_cache=false +hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/persistence/repository/AdvancedTaggingIntegrationTest.java b/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/persistence/repository/AdvancedTaggingIntegrationTest.java new file mode 100644 index 0000000000..e98c1fa4a6 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/persistence/repository/AdvancedTaggingIntegrationTest.java @@ -0,0 +1,83 @@ +package com.baeldung.persistence.repository; + +import com.baeldung.config.StudentJpaConfig; +import com.baeldung.inmemory.persistence.dao.ManyStudentRepository; +import com.baeldung.inmemory.persistence.dao.ManyTagRepository; +import com.baeldung.inmemory.persistence.dao.StudentRepository; +import com.baeldung.inmemory.persistence.model.ManyStudent; +import com.baeldung.inmemory.persistence.model.ManyTag; +import com.baeldung.inmemory.persistence.model.SkillTag; +import com.baeldung.inmemory.persistence.model.Student; +import com.baeldung.inmemory.persistence.model.KVTag; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { StudentJpaConfig.class }, loader = AnnotationConfigContextLoader.class) +@Transactional +@DirtiesContext +public class AdvancedTaggingIntegrationTest { + @Resource + private StudentRepository studentRepository; + + @Resource + private ManyStudentRepository manyStudentRepository; + + @Resource + private ManyTagRepository manyTagRepository; + + @Test + public void givenStudentWithSkillTags_whenSave_thenGetByNameAndSkillTag() { + Student student = new Student(1, "Will"); + SkillTag skill1 = new SkillTag("java", 5); + student.setSkillTags(Arrays.asList(skill1)); + studentRepository.save(student); + + Student student2 = new Student(2, "Joe"); + SkillTag skill2 = new SkillTag("java", 1); + student2.setSkillTags(Arrays.asList(skill2)); + studentRepository.save(student2); + + List students = studentRepository.retrieveByNameFilterByMinimumSkillTag("java", 3); + assertEquals("size incorrect", 1, students.size()); + } + + @Test + public void givenStudentWithKVTags_whenSave_thenGetByTagOk() { + Student student = new Student(0, "John"); + student.setKVTags(Arrays.asList(new KVTag("department", "computer science"))); + studentRepository.save(student); + + Student student2 = new Student(1, "James"); + student2.setKVTags(Arrays.asList(new KVTag("department", "humanities"))); + studentRepository.save(student2); + + List students = studentRepository.retrieveByKeyTag("department"); + assertEquals("size incorrect", 2, students.size()); + } + + @Test + public void givenStudentWithManyTags_whenSave_theyGetByTagOk() { + ManyTag tag = new ManyTag("full time"); + manyTagRepository.save(tag); + + ManyStudent student = new ManyStudent("John"); + student.setManyTags(Collections.singleton(tag)); + manyStudentRepository.save(student); + + List students = manyStudentRepository.findByManyTags_Name("full time"); + assertEquals("size incorrect", 1, students.size()); + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/persistence/repository/InMemoryDBIntegrationTest.java b/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/persistence/repository/InMemoryDBIntegrationTest.java new file mode 100644 index 0000000000..d8d867792e --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/persistence/repository/InMemoryDBIntegrationTest.java @@ -0,0 +1,84 @@ +package com.baeldung.persistence.repository; + +import com.baeldung.config.StudentJpaConfig; +import com.baeldung.inmemory.persistence.dao.StudentRepository; +import com.baeldung.inmemory.persistence.model.Student; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { StudentJpaConfig.class }, loader = AnnotationConfigContextLoader.class) +@Transactional +@DirtiesContext +public class InMemoryDBIntegrationTest { + + @Resource + private StudentRepository studentRepository; + + private static final long ID = 1; + private static final String NAME = "john"; + + @Test + public void givenStudent_whenSave_thenGetOk() { + Student student = new Student(ID, NAME); + studentRepository.save(student); + + Student student2 = studentRepository.findById(ID).get(); + assertEquals("name incorrect", NAME, student2.getName()); + } + + @Test + public void givenStudentWithTags_whenSave_thenGetByTagOk() { + Student student = new Student(ID, NAME); + student.setTags(Arrays.asList("full time", "computer science")); + studentRepository.save(student); + + Student student2 = studentRepository.retrieveByTag("full time").get(0); + assertEquals("name incorrect", NAME, student2.getName()); + } + + @Test + public void givenMultipleStudentsWithTags_whenSave_thenGetByTagReturnsCorrectCount() { + Student student = new Student(0, "Larry"); + student.setTags(Arrays.asList("full time", "computer science")); + studentRepository.save(student); + + Student student2 = new Student(1, "Curly"); + student2.setTags(Arrays.asList("part time", "rocket science")); + studentRepository.save(student2); + + Student student3 = new Student(2, "Moe"); + student3.setTags(Arrays.asList("full time", "philosophy")); + studentRepository.save(student3); + + Student student4 = new Student(3, "Shemp"); + student4.setTags(Arrays.asList("part time", "mathematics")); + studentRepository.save(student4); + + List students = studentRepository.retrieveByTag("full time"); + assertEquals("size incorrect", 2, students.size()); + } + + @Test + public void givenStudentWithTags_whenSave_thenGetByNameAndTagOk() { + Student student = new Student(ID, NAME); + student.setTags(Arrays.asList("full time", "computer science")); + studentRepository.save(student); + + Student student2 = studentRepository.retrieveByNameFilterByTag("John", "full time").get(0); + assertEquals("name incorrect", NAME, student2.getName()); + } + +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/projection/JpaProjectionIntegrationTest.java b/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/projection/JpaProjectionIntegrationTest.java new file mode 100644 index 0000000000..96eaf4ed07 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/projection/JpaProjectionIntegrationTest.java @@ -0,0 +1,63 @@ +package com.baeldung.projection; + +import com.baeldung.projection.model.Person; +import com.baeldung.projection.repository.AddressRepository; +import com.baeldung.projection.repository.PersonRepository; +import com.baeldung.projection.view.AddressView; +import com.baeldung.projection.view.PersonDto; +import com.baeldung.projection.view.PersonView; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_METHOD; + +@DataJpaTest +@RunWith(SpringRunner.class) +@Sql(scripts = "/projection-insert-data.sql") +@Sql(scripts = "/projection-clean-up-data.sql", executionPhase = AFTER_TEST_METHOD) +public class JpaProjectionIntegrationTest { + @Autowired + private AddressRepository addressRepository; + + @Autowired + private PersonRepository personRepository; + + @Test + public void whenUsingClosedProjections_thenViewWithRequiredPropertiesIsReturned() { + AddressView addressView = addressRepository.getAddressByState("CA").get(0); + assertThat(addressView.getZipCode()).isEqualTo("90001"); + + PersonView personView = addressView.getPerson(); + assertThat(personView.getFirstName()).isEqualTo("John"); + assertThat(personView.getLastName()).isEqualTo("Doe"); + } + + @Test + public void whenUsingOpenProjections_thenViewWithRequiredPropertiesIsReturned() { + PersonView personView = personRepository.findByLastName("Doe"); + assertThat(personView.getFullName()).isEqualTo("John Doe"); + } + + @Test + public void whenUsingClassBasedProjections_thenDtoWithRequiredPropertiesIsReturned() { + PersonDto personDto = personRepository.findByFirstName("John"); + assertThat(personDto.getFirstName()).isEqualTo("John"); + assertThat(personDto.getLastName()).isEqualTo("Doe"); + } + + @Test + public void whenUsingDynamicProjections_thenObjectWithRequiredPropertiesIsReturned() { + Person person = personRepository.findByLastName("Doe", Person.class); + PersonView personView = personRepository.findByLastName("Doe", PersonView.class); + PersonDto personDto = personRepository.findByLastName("Doe", PersonDto.class); + + assertThat(person.getFirstName()).isEqualTo("John"); + assertThat(personView.getFirstName()).isEqualTo("John"); + assertThat(personDto.getFirstName()).isEqualTo("John"); + } +} diff --git a/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/repository/CustomerRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/repository/CustomerRepositoryIntegrationTest.java new file mode 100644 index 0000000000..5d6457ce30 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/test/java/com/baeldung/repository/CustomerRepositoryIntegrationTest.java @@ -0,0 +1,64 @@ +package com.baeldung.repository; + +import com.baeldung.entity.Customer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +@DataJpaTest +@RunWith(SpringRunner.class) +public class CustomerRepositoryIntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + @Autowired + private CustomerRepository repository; + + @Before + public void before() { + entityManager.persist(new Customer("A", "A@example.com")); + entityManager.persist(new Customer("D", null)); + entityManager.persist(new Customer("D", "D@example.com")); + } + + @Test + public void givenQueryMethod_whenEmailIsNull_thenFoundByNullEmail() { + List customers = repository.findByNameAndEmail("D", null); + + assertEquals(1, customers.size()); + Customer actual = customers.get(0); + + assertEquals(null, actual.getEmail()); + assertEquals("D", actual.getName()); + } + + @Test + public void givenQueryMethod_whenEmailIsAbsent_thenIgnoreEmail() { + List customers = repository.findByName("D"); + + assertEquals(2, customers.size()); + } + + @Test + public void givenQueryAnnotation_whenEmailIsNull_thenIgnoreEmail() { + List customers = repository.findCustomerByNameAndEmail("D", null); + + assertEquals(2, customers.size()); + } + + @After + public void cleanUp() { + repository.deleteAll(); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties b/persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties new file mode 100644 index 0000000000..3b6b580630 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/test/resources/persistence-student.properties @@ -0,0 +1,9 @@ +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1 + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create + +hibernate.cache.use_second_level_cache=false +hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-filtering/src/test/resources/projection-clean-up-data.sql b/persistence-modules/spring-data-jpa-filtering/src/test/resources/projection-clean-up-data.sql new file mode 100644 index 0000000000..d34f6f0636 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/test/resources/projection-clean-up-data.sql @@ -0,0 +1,2 @@ +DELETE FROM address; +DELETE FROM person; \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-filtering/src/test/resources/projection-insert-data.sql b/persistence-modules/spring-data-jpa-filtering/src/test/resources/projection-insert-data.sql new file mode 100644 index 0000000000..544dcc4b88 --- /dev/null +++ b/persistence-modules/spring-data-jpa-filtering/src/test/resources/projection-insert-data.sql @@ -0,0 +1,2 @@ +INSERT INTO person(id,first_name,last_name) VALUES (1,'John','Doe'); +INSERT INTO address(id,person_id,state,city,street,zip_code) VALUES (1,1,'CA', 'Los Angeles', 'Standford Ave', '90001'); \ No newline at end of file From 52da4c8ee8d39c0bd419d0ed2834fc13e6dac8f7 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 19 Jul 2020 14:31:01 +0530 Subject: [PATCH 0152/1862] JAVA-66: New module spring-data-jpa-query --- .../spring-data-jpa-query/README.md | 22 ++ .../spring-data-jpa-query/pom.xml | 48 +++++ .../main/java/com/baeldung/Application.java | 13 ++ .../baeldung/aggregation/model/Comment.java | 85 ++++++++ .../com/baeldung/aggregation/model/Post.java | 75 +++++++ .../model/custom/CommentCount.java | 27 +++ .../model/custom/ICommentCount.java | 8 + .../repository/CommentRepository.java | 27 +++ .../baeldung/boot/daos/ArticleRepository.java | 23 +++ .../com/baeldung/boot/domain/Article.java | 23 +++ .../passenger/CustomPassengerRepository.java | 8 + .../baeldung/boot/passenger/Passenger.java | 82 ++++++++ .../boot/passenger/PassengerRepository.java | 22 ++ .../passenger/PassengerRepositoryImpl.java | 20 ++ .../entitygraph/model/Characteristic.java | 43 ++++ .../com/baeldung/entitygraph/model/Item.java | 48 +++++ .../repository/CharacteristicsRepository.java | 13 ++ .../repository/ItemRepository.java | 13 ++ .../main/java/com/baeldung/exists/Car.java | 48 +++++ .../com/baeldung/exists/CarRepository.java | 24 +++ .../com/baeldung/joins/model/Department.java | 45 +++++ .../com/baeldung/joins/model/Employee.java | 69 +++++++ .../java/com/baeldung/joins/model/Phone.java | 44 ++++ .../src/main/resources/apple-fruit-data.xml | 7 + .../resources/application-joins.properties | 1 + .../src/main/resources/application.properties | 1 + .../src/main/resources/db/import_joins.sql | 13 ++ .../src/main/resources/fruit-data.json | 14 ++ .../src/main/resources/guava-fruit-data.xml | 7 + .../src/main/resources/import_entities.sql | 3 + .../SpringDataAggregateIntegrationTest.java | 107 ++++++++++ .../ArticleRepositoryIntegrationTest.java | 67 ++++++ .../PassengerRepositoryIntegrationTest.java | 190 ++++++++++++++++++ .../EntityGraphIntegrationTest.java | 39 ++++ .../exists/CarRepositoryIntegrationTest.java | 87 ++++++++ .../joins/JpaJoinsIntegrationTest.java | 142 +++++++++++++ .../src/test/resources/entitygraph-data.sql | 7 + .../resources/projection-clean-up-data.sql | 2 + .../test/resources/projection-insert-data.sql | 2 + .../test/resources/test-aggregation-data.sql | 7 + .../src/test/resources/test-fruit-data.sql | 6 + 41 files changed, 1532 insertions(+) create mode 100644 persistence-modules/spring-data-jpa-query/README.md create mode 100644 persistence-modules/spring-data-jpa-query/pom.xml create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/Application.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/Comment.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/Post.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/custom/CommentCount.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/custom/ICommentCount.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/daos/ArticleRepository.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/domain/Article.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/CustomPassengerRepository.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/Passenger.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepositoryImpl.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/model/Characteristic.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/model/Item.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/repository/CharacteristicsRepository.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/repository/ItemRepository.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/exists/Car.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/exists/CarRepository.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Department.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Employee.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Phone.java create mode 100644 persistence-modules/spring-data-jpa-query/src/main/resources/apple-fruit-data.xml create mode 100644 persistence-modules/spring-data-jpa-query/src/main/resources/application-joins.properties create mode 100644 persistence-modules/spring-data-jpa-query/src/main/resources/application.properties create mode 100644 persistence-modules/spring-data-jpa-query/src/main/resources/db/import_joins.sql create mode 100644 persistence-modules/spring-data-jpa-query/src/main/resources/fruit-data.json create mode 100644 persistence-modules/spring-data-jpa-query/src/main/resources/guava-fruit-data.xml create mode 100644 persistence-modules/spring-data-jpa-query/src/main/resources/import_entities.sql create mode 100644 persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/aggregation/SpringDataAggregateIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/passenger/PassengerRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/entitygraph/EntityGraphIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/exists/CarRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/joins/JpaJoinsIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query/src/test/resources/entitygraph-data.sql create mode 100644 persistence-modules/spring-data-jpa-query/src/test/resources/projection-clean-up-data.sql create mode 100644 persistence-modules/spring-data-jpa-query/src/test/resources/projection-insert-data.sql create mode 100644 persistence-modules/spring-data-jpa-query/src/test/resources/test-aggregation-data.sql create mode 100644 persistence-modules/spring-data-jpa-query/src/test/resources/test-fruit-data.sql diff --git a/persistence-modules/spring-data-jpa-query/README.md b/persistence-modules/spring-data-jpa-query/README.md new file mode 100644 index 0000000000..bfff3c0ef3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/README.md @@ -0,0 +1,22 @@ +## Spring Data JPA - Query + +This module contains articles about querying data using Spring Data JPA + +### Relevant Articles: +- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) +- [The Exists Query in Spring Data](https://www.baeldung.com/spring-data-exists-query) +- [Customizing the Result of JPA Queries with Aggregation Functions](https://www.baeldung.com/jpa-queries-custom-result-with-aggregation-functions) +- [Limiting Query Results with JPA and Spring Data JPA](https://www.baeldung.com/jpa-limit-query-results) +- [Sorting Query Results with Spring Data](https://www.baeldung.com/spring-data-sorting) +- [Spring Data JPA Query by Example](https://www.baeldung.com/spring-data-query-by-example) +- [JPA Join Types](https://www.baeldung.com/jpa-join-types) +- [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs) + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator diff --git a/persistence-modules/spring-data-jpa-query/pom.xml b/persistence-modules/spring-data-jpa-query/pom.xml new file mode 100644 index 0000000000..71498143c3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + spring-data-jpa-query + spring-data-jpa-query + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + com.h2database + h2 + + + + net.ttddyy + datasource-proxy + ${datasource-proxy.version} + + + + com.fasterxml.jackson.core + jackson-databind + + + + org.springframework + spring-oxm + + + + + 1.4.1 + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..3ea3d113da --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/Application.java @@ -0,0 +1,13 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/Comment.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/Comment.java new file mode 100644 index 0000000000..26c2373cbe --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/Comment.java @@ -0,0 +1,85 @@ +package com.baeldung.aggregation.model; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import java.util.Objects; + +@Entity +public class Comment { + @Id + private Integer id; + private Integer year; + private boolean approved; + private String content; + @ManyToOne + private Post post; + + public Comment() { + } + + public Comment(int id, int year, boolean approved, String content, Post post) { + this.id = id; + this.year = year; + this.approved = approved; + this.content = content; + this.post = post; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + this.year = year; + } + + public boolean isApproved() { + return approved; + } + + public void setApproved(boolean approved) { + this.approved = approved; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Post getPost() { + return post; + } + + public void setPost(Post post) { + this.post = post; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Comment)) { + return false; + } + Comment comment = (Comment) o; + return getId().equals(comment.getId()); + } + + @Override + public int hashCode() { + return Objects.hash(getId()); + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/Post.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/Post.java new file mode 100644 index 0000000000..f396e080ae --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/Post.java @@ -0,0 +1,75 @@ +package com.baeldung.aggregation.model; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import java.util.List; +import java.util.Objects; + +@Entity +public class Post { + @Id + private Integer id; + private String title; + private String content; + @OneToMany(mappedBy = "post") + private List comments; + + public Post() { + } + + public Post(Integer id, String title, String content) { + this.id = id; + this.title = title; + this.content = content; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public List getComments() { + return comments; + } + + public void setComments(List comments) { + this.comments = comments; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Post)) { + return false; + } + Post post = (Post) o; + return getId().equals(post.getId()); + } + + @Override + public int hashCode() { + return Objects.hash(getId()); + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/custom/CommentCount.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/custom/CommentCount.java new file mode 100644 index 0000000000..510b52a47c --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/custom/CommentCount.java @@ -0,0 +1,27 @@ +package com.baeldung.aggregation.model.custom; + +public class CommentCount { + private Integer year; + private Long total; + + public CommentCount(Integer year, Long total) { + this.year = year; + this.total = total; + } + + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + this.year = year; + } + + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/custom/ICommentCount.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/custom/ICommentCount.java new file mode 100644 index 0000000000..acb25cfd49 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/model/custom/ICommentCount.java @@ -0,0 +1,8 @@ +package com.baeldung.aggregation.model.custom; + +public interface ICommentCount { + + Integer getYearComment(); + + Long getTotalComment(); +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java new file mode 100644 index 0000000000..89e9345e94 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java @@ -0,0 +1,27 @@ +package com.baeldung.aggregation.repository; + +import com.baeldung.aggregation.model.Comment; +import com.baeldung.aggregation.model.custom.CommentCount; +import com.baeldung.aggregation.model.custom.ICommentCount; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface CommentRepository extends JpaRepository { + + @Query("SELECT c.year, COUNT(c.year) FROM Comment AS c GROUP BY c.year ORDER BY c.year DESC") + List countTotalCommentsByYear(); + + @Query("SELECT new com.baeldung.aggregation.model.custom.CommentCount(c.year, COUNT(c.year)) FROM Comment AS c GROUP BY c.year ORDER BY c.year DESC") + List countTotalCommentsByYearClass(); + + @Query("SELECT c.year AS yearComment, COUNT(c.year) AS totalComment FROM Comment AS c GROUP BY c.year ORDER BY c.year DESC") + List countTotalCommentsByYearInterface(); + + @Query(value = "SELECT c.year AS yearComment, COUNT(c.*) AS totalComment FROM comment AS c GROUP BY c.year ORDER BY c.year DESC", nativeQuery = true) + List countTotalCommentsByYearNative(); + +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/daos/ArticleRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/daos/ArticleRepository.java new file mode 100644 index 0000000000..73397ad42e --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/daos/ArticleRepository.java @@ -0,0 +1,23 @@ +package com.baeldung.boot.daos; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import com.baeldung.boot.domain.Article; + +import java.util.Date; +import java.util.List; + +public interface ArticleRepository extends JpaRepository { + + List

    findAllByPublicationDate(Date publicationDate); + + List
    findAllByPublicationTimeBetween(Date publicationTimeStart, + Date publicationTimeEnd); + + @Query("select a from Article a where a.creationDateTime <= :creationDateTime") + List
    findAllWithCreationDateTimeBefore( + @Param("creationDateTime") Date creationDateTime); + +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/domain/Article.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/domain/Article.java new file mode 100644 index 0000000000..de4dbed1a0 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/domain/Article.java @@ -0,0 +1,23 @@ +package com.baeldung.boot.domain; + +import javax.persistence.*; +import java.util.Date; + +@Entity +public class Article { + + @Id + @GeneratedValue + private Integer id; + @Temporal(TemporalType.DATE) + private Date publicationDate; + @Temporal(TemporalType.TIME) + private Date publicationTime; + @Temporal(TemporalType.TIMESTAMP) + private Date creationDateTime; + + public Integer getId() { + return id; + } + +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/CustomPassengerRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/CustomPassengerRepository.java new file mode 100644 index 0000000000..7152286c83 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/CustomPassengerRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.boot.passenger; + +import java.util.List; + +interface CustomPassengerRepository { + + List findOrderedBySeatNumberLimitedTo(int limit); +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/Passenger.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/Passenger.java new file mode 100644 index 0000000000..c75107a783 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/Passenger.java @@ -0,0 +1,82 @@ +package com.baeldung.boot.passenger; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import java.util.Objects; + +@Entity +class Passenger { + + @Id + @GeneratedValue + @Column(nullable = false) + private Long id; + + @Basic(optional = false) + @Column(nullable = false) + private String firstName; + + @Basic(optional = false) + @Column(nullable = false) + private String lastName; + + @Basic(optional = false) + @Column(nullable = false) + private Integer seatNumber; + + private Passenger(String firstName, String lastName, Integer seatNumber) { + this.firstName = firstName; + this.lastName = lastName; + this.seatNumber = seatNumber; + } + + static Passenger from(String firstName, String lastName, Integer seatNumber) { + return new Passenger(firstName, lastName, seatNumber); + } + + @Override + public boolean equals(Object object) { + if (this == object) + return true; + if (object == null || getClass() != object.getClass()) + return false; + Passenger passenger = (Passenger) object; + return getSeatNumber() == passenger.getSeatNumber() && Objects.equals(getFirstName(), passenger.getFirstName()) + && Objects.equals(getLastName(), passenger.getLastName()); + } + + @Override + public int hashCode() { + return Objects.hash(getFirstName(), getLastName(), getSeatNumber()); + } + + @Override + public String toString() { + final StringBuilder toStringBuilder = new StringBuilder(getClass().getSimpleName()); + toStringBuilder.append("{ id=").append(id); + toStringBuilder.append(", firstName='").append(firstName).append('\''); + toStringBuilder.append(", lastName='").append(lastName).append('\''); + toStringBuilder.append(", seatNumber=").append(seatNumber); + toStringBuilder.append('}'); + return toStringBuilder.toString(); + } + + Long getId() { + return id; + } + + String getFirstName() { + return firstName; + } + + String getLastName() { + return lastName; + } + + Integer getSeatNumber() { + return seatNumber; + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java new file mode 100644 index 0000000000..14d5403cb5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java @@ -0,0 +1,22 @@ +package com.baeldung.boot.passenger; + +import java.util.List; + +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.repository.JpaRepository; + +interface PassengerRepository extends JpaRepository, CustomPassengerRepository { + + Passenger findFirstByOrderBySeatNumberAsc(); + + Passenger findTopByOrderBySeatNumberAsc(); + + List findByOrderBySeatNumberAsc(); + + List findByFirstNameIgnoreCase(String firstName); + + List findByLastNameOrderBySeatNumberAsc(String lastName); + + List findByLastName(String lastName, Sort sort); + +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepositoryImpl.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepositoryImpl.java new file mode 100644 index 0000000000..508c669066 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/passenger/PassengerRepositoryImpl.java @@ -0,0 +1,20 @@ +package com.baeldung.boot.passenger; + +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import java.util.List; + +@Repository +class PassengerRepositoryImpl implements CustomPassengerRepository { + + @PersistenceContext + private EntityManager entityManager; + + @Override + public List findOrderedBySeatNumberLimitedTo(int limit) { + return entityManager.createQuery("SELECT p FROM Passenger p ORDER BY p.seatNumber", + Passenger.class).setMaxResults(limit).getResultList(); + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/model/Characteristic.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/model/Characteristic.java new file mode 100644 index 0000000000..ae20375572 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/model/Characteristic.java @@ -0,0 +1,43 @@ +package com.baeldung.entitygraph.model; + +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; + +@Entity +public class Characteristic { + + @Id + private Long id; + private String type; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn + private Item item; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Item getItem() { + return item; + } + + public void setItem(Item item) { + this.item = item; + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/model/Item.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/model/Item.java new file mode 100644 index 0000000000..e90a22ef62 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/model/Item.java @@ -0,0 +1,48 @@ +package com.baeldung.entitygraph.model; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedAttributeNode; +import javax.persistence.NamedEntityGraph; +import javax.persistence.OneToMany; + +@Entity +@NamedEntityGraph(name = "Item.characteristics", + attributeNodes = @NamedAttributeNode("characteristics") +) +public class Item { + + @Id + private Long id; + private String name; + + @OneToMany(mappedBy = "item") + private List characteristics = new ArrayList<>(); + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getCharacteristics() { + return characteristics; + } + + public void setCharacteristics(List characteristics) { + this.characteristics = characteristics; + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/repository/CharacteristicsRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/repository/CharacteristicsRepository.java new file mode 100644 index 0000000000..9f923ab241 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/repository/CharacteristicsRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.entitygraph.repository; + +import org.springframework.data.jpa.repository.EntityGraph; +import org.springframework.data.jpa.repository.JpaRepository; + +import com.baeldung.entitygraph.model.Characteristic; + +public interface CharacteristicsRepository extends JpaRepository { + + @EntityGraph(attributePaths = {"item"}) + Characteristic findByType(String type); + +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/repository/ItemRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/repository/ItemRepository.java new file mode 100644 index 0000000000..b2a5f223b3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/entitygraph/repository/ItemRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.entitygraph.repository; + +import org.springframework.data.jpa.repository.EntityGraph; +import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType; +import org.springframework.data.jpa.repository.JpaRepository; + +import com.baeldung.entitygraph.model.Item; + +public interface ItemRepository extends JpaRepository { + + @EntityGraph(value = "Item.characteristics", type = EntityGraphType.FETCH) + Item findByName(String name); +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/exists/Car.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/exists/Car.java new file mode 100644 index 0000000000..bf09caf6ff --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/exists/Car.java @@ -0,0 +1,48 @@ +package com.baeldung.exists; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +/** + * @author paullatzelsperger + * @since 2019-03-20 + */ +@Entity +public class Car { + + @Id + @GeneratedValue + private int id; + private Integer power; + private String model; + + Car() { + + } + + public Car(int power, String model) { + this.power = power; + this.model = model; + } + + public Integer getPower() { + return power; + } + + public void setPower(Integer power) { + this.power = power; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public int getId() { + return id; + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/exists/CarRepository.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/exists/CarRepository.java new file mode 100644 index 0000000000..a54f19f4cd --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/exists/CarRepository.java @@ -0,0 +1,24 @@ +package com.baeldung.exists; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +/** + * @author paullatzelsperger + * @since 2019-03-20 + */ +@Repository +public interface CarRepository extends JpaRepository { + + boolean existsCarByPower(int power); + + boolean existsCarByModel(String model); + + @Query("select case when count(c)> 0 then true else false end from Car c where c.model = :model") + boolean existsCarExactCustomQuery(@Param("model") String model); + + @Query("select case when count(c)> 0 then true else false end from Car c where lower(c.model) like lower(:model)") + boolean existsCarLikeCustomQuery(@Param("model") String model); +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Department.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Department.java new file mode 100644 index 0000000000..439f7532f5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Department.java @@ -0,0 +1,45 @@ +package com.baeldung.joins.model; + +import java.util.List; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; + +@Entity +public class Department { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + private String name; + + @OneToMany(mappedBy = "department") + private List employees; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getEmployees() { + return employees; + } + + public void setEmployees(List employees) { + this.employees = employees; + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Employee.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Employee.java new file mode 100644 index 0000000000..277274e61c --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Employee.java @@ -0,0 +1,69 @@ +package com.baeldung.joins.model; + +import java.util.List; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "joins_employee") +public class Employee { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + private String name; + + private int age; + + @ManyToOne + private Department department; + + @OneToMany(mappedBy = "employee") + private List phones; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public Department getDepartment() { + return department; + } + + public void setDepartment(Department department) { + this.department = department; + } + + public List getPhones() { + return phones; + } + + public void setPhones(List phones) { + this.phones = phones; + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Phone.java b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Phone.java new file mode 100644 index 0000000000..41382915b1 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/joins/model/Phone.java @@ -0,0 +1,44 @@ +package com.baeldung.joins.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +public class Phone { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private long id; + + private String number; + + @ManyToOne + private Employee employee; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getNumber() { + return number; + } + + public void setNumber(String number) { + this.number = number; + } + + public Employee getEmployee() { + return employee; + } + + public void setEmployee(Employee employee) { + this.employee = employee; + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/apple-fruit-data.xml b/persistence-modules/spring-data-jpa-query/src/main/resources/apple-fruit-data.xml new file mode 100644 index 0000000000..d87ae28f1e --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/apple-fruit-data.xml @@ -0,0 +1,7 @@ + + + + 1 + apple + red + diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/application-joins.properties b/persistence-modules/spring-data-jpa-query/src/main/resources/application-joins.properties new file mode 100644 index 0000000000..fe2270293b --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/application-joins.properties @@ -0,0 +1 @@ +spring.datasource.data=classpath:db/import_joins.sql diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-query/src/main/resources/application.properties new file mode 100644 index 0000000000..72fc330767 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.jpa.show-sql=true \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/db/import_joins.sql b/persistence-modules/spring-data-jpa-query/src/main/resources/db/import_joins.sql new file mode 100644 index 0000000000..e4772d6ff2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/db/import_joins.sql @@ -0,0 +1,13 @@ +INSERT INTO department (id, name) VALUES (1, 'Infra'); +INSERT INTO department (id, name) VALUES (2, 'Accounting'); +INSERT INTO department (id, name) VALUES (3, 'Management'); + +INSERT INTO joins_employee (id, name, age, department_id) VALUES (1, 'Baeldung', '35', 1); +INSERT INTO joins_employee (id, name, age, department_id) VALUES (2, 'John', '35', 2); +INSERT INTO joins_employee (id, name, age, department_id) VALUES (3, 'Jane', '35', 2); + +INSERT INTO phone (id, number, employee_id) VALUES (1, '111', 1); +INSERT INTO phone (id, number, employee_id) VALUES (2, '222', 1); +INSERT INTO phone (id, number, employee_id) VALUES (3, '333', 1); + +COMMIT; diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/fruit-data.json b/persistence-modules/spring-data-jpa-query/src/main/resources/fruit-data.json new file mode 100644 index 0000000000..6dc44e2586 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/fruit-data.json @@ -0,0 +1,14 @@ +[ + { + "_class": "com.baeldung.entity.Fruit", + "name": "apple", + "color": "red", + "id": 1 + }, + { + "_class": "com.baeldung.entity.Fruit", + "name": "guava", + "color": "green", + "id": 2 + } +] \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/guava-fruit-data.xml b/persistence-modules/spring-data-jpa-query/src/main/resources/guava-fruit-data.xml new file mode 100644 index 0000000000..ffd75bb4bb --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/guava-fruit-data.xml @@ -0,0 +1,7 @@ + + + + 2 + guava + green + diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/import_entities.sql b/persistence-modules/spring-data-jpa-query/src/main/resources/import_entities.sql new file mode 100644 index 0000000000..4fe18bf4aa --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/main/resources/import_entities.sql @@ -0,0 +1,3 @@ +insert into Article(id, publication_date, publication_time, creation_date_time) values(1, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:00', 'HH24:MI'), TO_DATE('31/12/2017 07:30', 'DD/MM/YYYY HH24:MI')); +insert into Article(id, publication_date, publication_time, creation_date_time) values(2, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:30', 'HH24:MI'), TO_DATE('15/12/2017 08:00', 'DD/MM/YYYY HH24:MI')); +insert into Article(id, publication_date, publication_time, creation_date_time) values(3, TO_DATE('15/12/2017', 'DD/MM/YYYY'), TO_DATE('16:00', 'HH24:MI'), TO_DATE('01/12/2017 13:45', 'DD/MM/YYYY HH24:MI')); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/aggregation/SpringDataAggregateIntegrationTest.java b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/aggregation/SpringDataAggregateIntegrationTest.java new file mode 100644 index 0000000000..779ade7a3f --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/aggregation/SpringDataAggregateIntegrationTest.java @@ -0,0 +1,107 @@ +package com.baeldung.aggregation; + +import com.baeldung.aggregation.model.custom.CommentCount; +import com.baeldung.aggregation.model.custom.ICommentCount; +import com.baeldung.aggregation.repository.CommentRepository; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.List; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +@RunWith(SpringRunner.class) +@DataJpaTest + +@Sql(scripts = "/test-aggregation-data.sql") +public class SpringDataAggregateIntegrationTest { + + @Autowired + private CommentRepository commentRepository; + + @Test + public void whenQueryWithAggregation_thenReturnResult() { + List commentCountsByYear = commentRepository.countTotalCommentsByYear(); + + Object[] countYear2019 = commentCountsByYear.get(0); + + assertThat(countYear2019[0], is(Integer.valueOf(2019))); + assertThat(countYear2019[1], is(1l)); + + Object[] countYear2018 = commentCountsByYear.get(1); + + assertThat(countYear2018[0], is(Integer.valueOf(2018))); + assertThat(countYear2018[1], is(2l)); + + Object[] countYear2017 = commentCountsByYear.get(2); + + assertThat(countYear2017[0], is(Integer.valueOf(2017))); + assertThat(countYear2017[1], is(1l)); + } + + @Test + public void whenQueryWithAggregation_thenReturnCustomResult() { + List commentCountsByYear = commentRepository.countTotalCommentsByYearClass(); + + CommentCount countYear2019 = commentCountsByYear.get(0); + + assertThat(countYear2019.getYear(), is(Integer.valueOf(2019))); + assertThat(countYear2019.getTotal(), is(1l)); + + CommentCount countYear2018 = commentCountsByYear.get(1); + + assertThat(countYear2018.getYear(), is(Integer.valueOf(2018))); + assertThat(countYear2018.getTotal(), is(2l)); + + CommentCount countYear2017 = commentCountsByYear.get(2); + + assertThat(countYear2017.getYear(), is(Integer.valueOf(2017))); + assertThat(countYear2017.getTotal(), is(1l)); + } + + @Test + public void whenQueryWithAggregation_thenReturnInterfaceResult() { + List commentCountsByYear = commentRepository.countTotalCommentsByYearInterface(); + + ICommentCount countYear2019 = commentCountsByYear.get(0); + + assertThat(countYear2019.getYearComment(), is(Integer.valueOf(2019))); + assertThat(countYear2019.getTotalComment(), is(1l)); + + ICommentCount countYear2018 = commentCountsByYear.get(1); + + assertThat(countYear2018.getYearComment(), is(Integer.valueOf(2018))); + assertThat(countYear2018.getTotalComment(), is(2l)); + + ICommentCount countYear2017 = commentCountsByYear.get(2); + + assertThat(countYear2017.getYearComment(), is(Integer.valueOf(2017))); + assertThat(countYear2017.getTotalComment(), is(1l)); + } + + @Test + public void whenNativeQueryWithAggregation_thenReturnInterfaceResult() { + List commentCountsByYear = commentRepository.countTotalCommentsByYearNative(); + + ICommentCount countYear2019 = commentCountsByYear.get(0); + + assertThat(countYear2019.getYearComment(), is(Integer.valueOf(2019))); + assertThat(countYear2019.getTotalComment(), is(1l)); + + ICommentCount countYear2018 = commentCountsByYear.get(1); + + assertThat(countYear2018.getYearComment(), is(Integer.valueOf(2018))); + assertThat(countYear2018.getTotalComment(), is(2l)); + + ICommentCount countYear2017 = commentCountsByYear.get(2); + + assertThat(countYear2017.getYearComment(), is(Integer.valueOf(2017))); + assertThat(countYear2017.getTotalComment(), is(1l)); + } + +} diff --git a/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java new file mode 100644 index 0000000000..20fc3cbeaf --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java @@ -0,0 +1,67 @@ +package com.baeldung.boot.daos; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.domain.Article; + +@RunWith(SpringRunner.class) +@DataJpaTest(properties="spring.datasource.data=classpath:import_entities.sql") +public class ArticleRepositoryIntegrationTest { + + @Autowired + private ArticleRepository repository; + + @Test + public void givenImportedArticlesWhenFindAllByPublicationDateThenArticles1And2Returned() + throws Exception { + List
    result = repository.findAllByPublicationDate( + new SimpleDateFormat("yyyy-MM-dd").parse("2018-01-01") + ); + + assertEquals(2, result.size()); + assertTrue(result.stream() + .map(Article::getId) + .allMatch(id -> Arrays.asList(1, 2).contains(id)) + ); + } + + @Test + public void givenImportedArticlesWhenFindAllByPublicationTimeBetweenThenArticles2And3Returned() + throws Exception { + List
    result = repository.findAllByPublicationTimeBetween( + new SimpleDateFormat("HH:mm").parse("15:15"), + new SimpleDateFormat("HH:mm").parse("16:30") + ); + + assertEquals(2, result.size()); + assertTrue(result.stream() + .map(Article::getId) + .allMatch(id -> Arrays.asList(2, 3).contains(id)) + ); + } + + @Test + public void givenImportedArticlesWhenFindAllWithCreationDateTimeBeforeThenArticles2And3Returned() throws Exception { + List
    result = repository.findAllWithCreationDateTimeBefore( + new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2017-12-15 10:00") + ); + + assertEquals(2, result.size()); + assertTrue(result.stream() + .map(Article::getId) + .allMatch(id -> Arrays.asList(2, 3).contains(id)) + ); + } + +} diff --git a/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/passenger/PassengerRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/passenger/PassengerRepositoryIntegrationTest.java new file mode 100644 index 0000000000..f082350019 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/passenger/PassengerRepositoryIntegrationTest.java @@ -0,0 +1,190 @@ +package com.baeldung.boot.passenger; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.data.domain.Example; +import org.springframework.data.domain.ExampleMatcher; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Sort; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.passenger.Passenger; +import com.baeldung.boot.passenger.PassengerRepository; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import java.util.List; +import java.util.Optional; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.core.IsNot.not; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +@DataJpaTest +@RunWith(SpringRunner.class) +public class PassengerRepositoryIntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + @Autowired + private PassengerRepository repository; + + @Before + public void before() { + entityManager.persist(Passenger.from("Jill", "Smith", 50)); + entityManager.persist(Passenger.from("Eve", "Jackson", 95)); + entityManager.persist(Passenger.from("Fred", "Bloggs", 22)); + entityManager.persist(Passenger.from("Ricki", "Bobbie", 36)); + entityManager.persist(Passenger.from("Siya", "Kolisi", 85)); + } + + @Test + public void givenSeveralPassengersWhenOrderedBySeatNumberLimitedToThenThePassengerInTheFirstFilledSeatIsReturned() { + Passenger expected = Passenger.from("Fred", "Bloggs", 22); + + List passengers = repository.findOrderedBySeatNumberLimitedTo(1); + + assertEquals(1, passengers.size()); + + Passenger actual = passengers.get(0); + assertEquals(expected, actual); + } + + @Test + public void givenSeveralPassengersWhenFindFirstByOrderBySeatNumberAscThenThePassengerInTheFirstFilledSeatIsReturned() { + Passenger expected = Passenger.from("Fred", "Bloggs", 22); + + Passenger actual = repository.findFirstByOrderBySeatNumberAsc(); + + assertEquals(expected, actual); + } + + @Test + public void givenSeveralPassengersWhenFindPageSortedByThenThePassengerInTheFirstFilledSeatIsReturned() { + Passenger expected = Passenger.from("Fred", "Bloggs", 22); + + Page page = repository.findAll(PageRequest.of(0, 1, + Sort.by(Sort.Direction.ASC, "seatNumber"))); + + assertEquals(1, page.getContent().size()); + + Passenger actual = page.getContent().get(0); + assertEquals(expected, actual); + } + + @Test + public void givenPassengers_whenOrderedBySeatNumberAsc_thenCorrectOrder() { + Passenger fred = Passenger.from("Fred", "Bloggs", 22); + Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); + Passenger jill = Passenger.from("Jill", "Smith", 50); + Passenger siya = Passenger.from("Siya", "Kolisi", 85); + Passenger eve = Passenger.from("Eve", "Jackson", 95); + + List passengers = repository.findByOrderBySeatNumberAsc(); + + assertThat(passengers, contains(fred, ricki, jill, siya, eve)); + } + + @Test + public void givenPassengers_whenFindAllWithSortBySeatNumberAsc_thenCorrectOrder() { + Passenger fred = Passenger.from("Fred", "Bloggs", 22); + Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); + Passenger jill = Passenger.from("Jill", "Smith", 50); + Passenger siya = Passenger.from("Siya", "Kolisi", 85); + Passenger eve = Passenger.from("Eve", "Jackson", 95); + + List passengers = repository.findAll(Sort.by(Sort.Direction.ASC, "seatNumber")); + + assertThat(passengers, contains(fred, ricki, jill, siya, eve)); + } + + @Test + public void givenPassengers_whenFindByExampleDefaultMatcher_thenExpectedReturned() { + Example example = Example.of(Passenger.from("Fred", "Bloggs", null)); + + Optional actual = repository.findOne(example); + + assertTrue(actual.isPresent()); + assertEquals(Passenger.from("Fred", "Bloggs", 22), actual.get()); + } + + @Test + public void givenPassengers_whenFindByExampleCaseInsensitiveMatcher_thenExpectedReturned() { + ExampleMatcher caseInsensitiveExampleMatcher = ExampleMatcher.matchingAll().withIgnoreCase(); + Example example = Example.of(Passenger.from("fred", "bloggs", null), + caseInsensitiveExampleMatcher); + + Optional actual = repository.findOne(example); + + assertTrue(actual.isPresent()); + assertEquals(Passenger.from("Fred", "Bloggs", 22), actual.get()); + } + + @Test + public void givenPassengers_whenFindByExampleCustomMatcher_thenExpectedReturned() { + Passenger jill = Passenger.from("Jill", "Smith", 50); + Passenger eve = Passenger.from("Eve", "Jackson", 95); + Passenger fred = Passenger.from("Fred", "Bloggs", 22); + Passenger siya = Passenger.from("Siya", "Kolisi", 85); + Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); + + ExampleMatcher customExampleMatcher = ExampleMatcher.matchingAny().withMatcher("firstName", + ExampleMatcher.GenericPropertyMatchers.contains().ignoreCase()).withMatcher("lastName", + ExampleMatcher.GenericPropertyMatchers.contains().ignoreCase()); + + Example example = Example.of(Passenger.from("e", "s", null), + customExampleMatcher); + + List passengers = repository.findAll(example); + + assertThat(passengers, contains(jill, eve, fred, siya)); + assertThat(passengers, not(contains(ricki))); + } + + @Test + public void givenPassengers_whenFindByIgnoringMatcher_thenExpectedReturned() { + Passenger jill = Passenger.from("Jill", "Smith", 50); + Passenger eve = Passenger.from("Eve", "Jackson", 95); + Passenger fred = Passenger.from("Fred", "Bloggs", 22); + Passenger siya = Passenger.from("Siya", "Kolisi", 85); + Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); + + ExampleMatcher ignoringExampleMatcher = ExampleMatcher.matchingAny().withMatcher("lastName", + ExampleMatcher.GenericPropertyMatchers.startsWith().ignoreCase()).withIgnorePaths("firstName", "seatNumber"); + + Example example = Example.of(Passenger.from(null, "b", null), + ignoringExampleMatcher); + + List passengers = repository.findAll(example); + + assertThat(passengers, contains(fred, ricki)); + assertThat(passengers, not(contains(jill))); + assertThat(passengers, not(contains(eve))); + assertThat(passengers, not(contains(siya))); + } + + @Test + public void givenPassengers_whenMatchingIgnoreCase_thenExpectedReturned() { + Passenger jill = Passenger.from("Jill", "Smith", 50); + Passenger eve = Passenger.from("Eve", "Jackson", 95); + Passenger fred = Passenger.from("Fred", "Bloggs", 22); + Passenger siya = Passenger.from("Siya", "Kolisi", 85); + Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); + + List passengers = repository.findByFirstNameIgnoreCase("FRED"); + + assertThat(passengers, contains(fred)); + assertThat(passengers, not(contains(eve))); + assertThat(passengers, not(contains(siya))); + assertThat(passengers, not(contains(jill))); + assertThat(passengers, not(contains(ricki))); + + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/entitygraph/EntityGraphIntegrationTest.java b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/entitygraph/EntityGraphIntegrationTest.java new file mode 100644 index 0000000000..24880a5dff --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/entitygraph/EntityGraphIntegrationTest.java @@ -0,0 +1,39 @@ +package com.baeldung.entitygraph; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.entitygraph.model.Characteristic; +import com.baeldung.entitygraph.model.Item; +import com.baeldung.entitygraph.repository.CharacteristicsRepository; +import com.baeldung.entitygraph.repository.ItemRepository; + +@DataJpaTest +@RunWith(SpringRunner.class) +@Sql(scripts = "/entitygraph-data.sql") +public class EntityGraphIntegrationTest { + + @Autowired + private ItemRepository itemRepo; + + @Autowired + private CharacteristicsRepository characteristicsRepo; + + @Test + public void givenEntityGraph_whenCalled_shouldRetrunDefinedFields() { + Item item = itemRepo.findByName("Table"); + assertThat(item.getId()).isEqualTo(1L); + } + + @Test + public void givenAdhocEntityGraph_whenCalled_shouldRetrunDefinedFields() { + Characteristic characteristic = characteristicsRepo.findByType("Rigid"); + assertThat(characteristic.getId()).isEqualTo(1L); + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/exists/CarRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/exists/CarRepositoryIntegrationTest.java new file mode 100644 index 0000000000..d99f6671a3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/exists/CarRepositoryIntegrationTest.java @@ -0,0 +1,87 @@ +package com.baeldung.exists; + +import com.baeldung.Application; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.domain.Example; +import org.springframework.data.domain.ExampleMatcher; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.Arrays; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.ignoreCase; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {Application.class}) +public class CarRepositoryIntegrationTest { + + @Autowired + private CarRepository repository; + private int searchId; + + @Before + public void setup() { + List cars = repository.saveAll(Arrays.asList(new Car(200, "BMW"), new Car(300, "Audi"))); + searchId = cars.get(0).getId(); + } + + @After + public void teardown() { + repository.deleteAll(); + } + + @Test + public void whenIdIsCorrect_thenExistsShouldReturnTrue() { + assertThat(repository.existsById(searchId)).isTrue(); + } + + @Test + public void givenExample_whenExists_thenIsTrue() { + ExampleMatcher modelMatcher = ExampleMatcher.matching() + .withIgnorePaths("id") // must explicitly ignore -> PK + .withMatcher("model", ignoreCase()); + Car probe = new Car(); + probe.setModel("bmw"); + + Example example = Example.of(probe, modelMatcher); + + assertThat(repository.exists(example)).isTrue(); + } + + @Test + public void givenPower_whenExists_thenIsFalse() { + assertThat(repository.existsCarByPower(200)).isTrue(); + assertThat(repository.existsCarByPower(800)).isFalse(); + } + + @Test + public void existsByDerivedQuery_byModel() { + assertThat(repository.existsCarByModel("Audi")).isTrue(); + assertThat(repository.existsCarByModel("audi")).isFalse(); + assertThat(repository.existsCarByModel("AUDI")).isFalse(); + assertThat(repository.existsCarByModel("")).isFalse(); + } + + @Test + public void givenModelName_whenExistsExact_thenIsTrue() { + assertThat(repository.existsCarExactCustomQuery("BMW")).isTrue(); + assertThat(repository.existsCarExactCustomQuery("Bmw")).isFalse(); + assertThat(repository.existsCarExactCustomQuery("bmw")).isFalse(); + assertThat(repository.existsCarExactCustomQuery("")).isFalse(); + } + + @Test + public void givenModelName_whenExistsLike_thenIsTrue() { + assertThat(repository.existsCarLikeCustomQuery("BMW")).isTrue(); + assertThat(repository.existsCarLikeCustomQuery("Bmw")).isTrue(); + assertThat(repository.existsCarLikeCustomQuery("bmw")).isTrue(); + assertThat(repository.existsCarLikeCustomQuery("")).isFalse(); + } + +} diff --git a/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/joins/JpaJoinsIntegrationTest.java b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/joins/JpaJoinsIntegrationTest.java new file mode 100644 index 0000000000..9b0d23f3e4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/joins/JpaJoinsIntegrationTest.java @@ -0,0 +1,142 @@ +package com.baeldung.joins; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.baeldung.joins.model.Department; +import com.baeldung.joins.model.Phone; +import java.util.Collection; +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.TypedQuery; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@DataJpaTest +@ActiveProfiles("joins") +public class JpaJoinsIntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + + @Test + public void whenPathExpressionIsUsedForSingleValuedAssociation_thenCreatesImplicitInnerJoin() { + TypedQuery query = entityManager.createQuery("SELECT e.department FROM Employee e", Department.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(3); + assertThat(resultList).extracting("name") + .containsOnly("Infra", "Accounting", "Accounting"); + } + + @Test + public void whenJoinKeywordIsUsed_thenCreatesExplicitInnerJoin() { + TypedQuery query = entityManager.createQuery("SELECT d FROM Employee e JOIN e.department d", Department.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(3); + assertThat(resultList).extracting("name") + .containsOnly("Infra", "Accounting", "Accounting"); + } + + @Test + public void whenInnerJoinKeywordIsUsed_thenCreatesExplicitInnerJoin() { + TypedQuery query = entityManager.createQuery("SELECT d FROM Employee e INNER JOIN e.department d", Department.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(3); + assertThat(resultList).extracting("name") + .containsOnly("Infra", "Accounting", "Accounting"); + } + + @Test + public void whenEntitiesAreListedInFromAndMatchedInWhere_ThenCreatesJoin() { + TypedQuery query = entityManager.createQuery("SELECT d FROM Employee e, Department d WHERE e.department = d", Department.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(3); + assertThat(resultList).extracting("name") + .containsOnly("Infra", "Accounting", "Accounting"); + } + + @Test + public void whenEntitiesAreListedInFrom_ThenCreatesCartesianProduct() { + TypedQuery query = entityManager.createQuery("SELECT d FROM Employee e, Department d", Department.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(9); + assertThat(resultList).extracting("name") + .containsOnly("Infra", "Accounting", "Management", "Infra", "Accounting", "Management", "Infra", "Accounting", "Management"); + } + + @Test + public void whenCollectionValuedAssociationIsJoined_ThenCanSelect() { + TypedQuery query = entityManager.createQuery("SELECT ph FROM Employee e JOIN e.phones ph WHERE ph LIKE '1%'", Phone.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(1); + } + + @Test + public void whenMultipleEntitiesAreListedWithJoin_ThenCreatesMultipleJoins() { + TypedQuery query = entityManager.createQuery("SELECT ph FROM Employee e JOIN e.department d JOIN e.phones ph WHERE d.name IS NOT NULL", Phone.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(3); + assertThat(resultList).extracting("number") + .containsOnly("111", "222", "333"); + } + + @Test + public void whenLeftKeywordIsSpecified_thenCreatesOuterJoinAndIncludesNonMatched() { + TypedQuery query = entityManager.createQuery("SELECT DISTINCT d FROM Department d LEFT JOIN d.employees e", Department.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(3); + assertThat(resultList).extracting("name") + .containsOnly("Infra", "Accounting", "Management"); + } + + @Test + public void whenFetchKeywordIsSpecified_ThenCreatesFetchJoin() { + TypedQuery query = entityManager.createQuery("SELECT d FROM Department d JOIN FETCH d.employees", Department.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(3); + assertThat(resultList).extracting("name") + .containsOnly("Infra", "Accounting", "Accounting"); + } + + @Test + public void whenLeftAndFetchKeywordsAreSpecified_ThenCreatesOuterFetchJoin() { + TypedQuery query = entityManager.createQuery("SELECT d FROM Department d LEFT JOIN FETCH d.employees", Department.class); + + List resultList = query.getResultList(); + + assertThat(resultList).hasSize(4); + assertThat(resultList).extracting("name") + .containsOnly("Infra", "Accounting", "Accounting", "Management"); + } + + @Test + public void whenCollectionValuedAssociationIsSpecifiedInSelect_ThenReturnsCollections() { + TypedQuery query = entityManager.createQuery("SELECT e.phones FROM Employee e", Collection.class); + + List resultList = query.getResultList(); + + assertThat(resultList).extracting("number").containsOnly("111", "222", "333"); + } +} diff --git a/persistence-modules/spring-data-jpa-query/src/test/resources/entitygraph-data.sql b/persistence-modules/spring-data-jpa-query/src/test/resources/entitygraph-data.sql new file mode 100644 index 0000000000..685ec2c605 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/resources/entitygraph-data.sql @@ -0,0 +1,7 @@ +INSERT INTO Item(id,name) VALUES (1,'Table'); +INSERT INTO Item(id,name) VALUES (2,'Bottle'); + +INSERT INTO Characteristic(id,item_id, type) VALUES (1,1,'Rigid'); +INSERT INTO Characteristic(id,item_id,type) VALUES (2,1,'Big'); +INSERT INTO Characteristic(id,item_id,type) VALUES (3,2,'Fragile'); +INSERT INTO Characteristic(id,item_id,type) VALUES (4,2,'Small'); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/test/resources/projection-clean-up-data.sql b/persistence-modules/spring-data-jpa-query/src/test/resources/projection-clean-up-data.sql new file mode 100644 index 0000000000..d34f6f0636 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/resources/projection-clean-up-data.sql @@ -0,0 +1,2 @@ +DELETE FROM address; +DELETE FROM person; \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/test/resources/projection-insert-data.sql b/persistence-modules/spring-data-jpa-query/src/test/resources/projection-insert-data.sql new file mode 100644 index 0000000000..544dcc4b88 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/resources/projection-insert-data.sql @@ -0,0 +1,2 @@ +INSERT INTO person(id,first_name,last_name) VALUES (1,'John','Doe'); +INSERT INTO address(id,person_id,state,city,street,zip_code) VALUES (1,1,'CA', 'Los Angeles', 'Standford Ave', '90001'); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/test/resources/test-aggregation-data.sql b/persistence-modules/spring-data-jpa-query/src/test/resources/test-aggregation-data.sql new file mode 100644 index 0000000000..12409a124e --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/resources/test-aggregation-data.sql @@ -0,0 +1,7 @@ +INSERT INTO post (id, title, content) VALUES (1, 'Comment 1', 'Content 1'); +INSERT INTO post (id, title, content) VALUES (2, 'Comment 2', 'Content 2'); +INSERT INTO post (id, title, content) VALUES (3, 'Comment 3', 'Content 3'); +INSERT INTO comment (id, year, approved, content, post_id) VALUES (1, 2019, false, 'Comment 1', 1); +INSERT INTO comment (id, year, approved, content, post_id) VALUES (2, 2018, true, 'Comment 2', 1); +INSERT INTO comment (id, year, approved, content, post_id) VALUES (3, 2018, true, 'Comment 3', 2); +INSERT INTO comment (id, year, approved, content, post_id) VALUES (4, 2017, false, 'Comment 4', 3); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/src/test/resources/test-fruit-data.sql b/persistence-modules/spring-data-jpa-query/src/test/resources/test-fruit-data.sql new file mode 100644 index 0000000000..d99f42e5a7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query/src/test/resources/test-fruit-data.sql @@ -0,0 +1,6 @@ +truncate table fruit; + +insert into fruit(id,name,color) values (1,'apple','red'); +insert into fruit(id,name,color) values (2,'custard apple','green'); +insert into fruit(id,name,color) values (3,'mango','yellow'); +insert into fruit(id,name,color) values (4,'guava','green'); \ No newline at end of file From 733d901d46437653a81771f4023620b507ea011d Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 19 Jul 2020 14:31:28 +0530 Subject: [PATCH 0153/1862] JAVA-66: New module spring-data-jpa-repo --- .../spring-data-jpa-repo/README.md | 22 +++ .../spring-data-jpa-repo/pom.xml | 52 ++++++ .../main/java/com/baeldung/Application.java | 17 ++ .../boot/daos/CustomItemRepository.java | 16 ++ .../boot/daos/CustomItemTypeRepository.java | 13 ++ .../boot/daos/ExtendedRepository.java | 14 ++ .../boot/daos/ExtendedStudentRepository.java | 6 + .../boot/daos/InventoryRepository.java | 8 + .../boot/daos/ItemTypeRepository.java | 10 + .../boot/daos/LocationRepository.java | 10 + .../boot/daos/ReadOnlyLocationRepository.java | 15 ++ .../baeldung/boot/daos/StoreRepository.java | 13 ++ .../daos/impl/CustomItemRepositoryImpl.java | 33 ++++ .../impl/CustomItemTypeRepositoryImpl.java | 27 +++ .../daos/impl/ExtendedRepositoryImpl.java | 37 ++++ .../java/com/baeldung/boot/domain/Item.java | 81 +++++++++ .../com/baeldung/boot/domain/ItemType.java | 46 +++++ .../java/com/baeldung/boot/domain/KVTag.java | 34 ++++ .../com/baeldung/boot/domain/Location.java | 55 ++++++ .../boot/domain/MerchandiseEntity.java | 66 +++++++ .../com/baeldung/boot/domain/SkillTag.java | 30 +++ .../java/com/baeldung/boot/domain/Store.java | 76 ++++++++ .../com/baeldung/boot/domain/Student.java | 74 ++++++++ .../com/baeldung/config/JpaPopulators.java | 35 ++++ .../derivedquery/QueryApplication.java | 13 ++ .../baeldung/derivedquery/entity/User.java | 70 +++++++ .../repository/UserRepository.java | 60 ++++++ .../main/java/com/baeldung/entity/Fruit.java | 40 ++++ .../java/com/baeldung/entity/Passenger.java | 78 ++++++++ .../main/java/com/baeldung/entity/Song.java | 75 ++++++++ .../com/baeldung/like/LikeApplication.java | 13 ++ .../java/com/baeldung/like/model/Movie.java | 58 ++++++ .../like/repository/MovieRepository.java | 41 +++++ .../baeldung/repository/FruitRepository.java | 27 +++ .../repository/PassengerRepository.java | 14 ++ .../baeldung/repository/SongRepository.java | 22 +++ .../StoredProcedureApplication.java | 13 ++ .../controller/CarController.java | 47 +++++ .../baeldung/storedprocedure/entity/Car.java | 41 +++++ .../repository/CarRepository.java | 34 ++++ .../storedprocedure/service/CarService.java | 39 ++++ .../src/main/resources/apple-fruit-data.xml | 7 + .../src/main/resources/application.properties | 5 + .../src/main/resources/car-mysql.sql | 27 +++ .../src/main/resources/fruit-data.json | 14 ++ .../src/main/resources/guava-fruit-data.xml | 7 + .../src/main/resources/import_entities.sql | 17 ++ ...endedStudentRepositoryIntegrationTest.java | 41 +++++ .../InventoryRepositoryIntegrationTest.java | 61 +++++++ .../daos/JpaRepositoriesIntegrationTest.java | 93 ++++++++++ .../UserRepositoryIntegrationTest.java | 172 ++++++++++++++++++ .../like/MovieRepositoryIntegrationTest.java | 87 +++++++++ .../FruitPopulatorIntegrationTest.java | 38 ++++ .../PassengerRepositoryIntegrationTest.java | 56 ++++++ .../SongRepositoryIntegrationTest.java | 59 ++++++ .../resources/application-test.properties | 2 + .../src/test/resources/test-movie-cleanup.sql | 1 + .../src/test/resources/test-movie-data.sql | 7 + .../src/test/resources/test-song-data.sql | 8 + 59 files changed, 2177 insertions(+) create mode 100644 persistence-modules/spring-data-jpa-repo/README.md create mode 100644 persistence-modules/spring-data-jpa-repo/pom.xml create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/Application.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/CustomItemRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/CustomItemTypeRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ExtendedRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ExtendedStudentRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/InventoryRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ItemTypeRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/LocationRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ReadOnlyLocationRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/StoreRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/CustomItemRepositoryImpl.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/CustomItemTypeRepositoryImpl.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/ExtendedRepositoryImpl.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Item.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/ItemType.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/KVTag.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Location.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/MerchandiseEntity.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/SkillTag.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Store.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Student.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/config/JpaPopulators.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/QueryApplication.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/entity/User.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/repository/UserRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Fruit.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Passenger.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Song.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/LikeApplication.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/model/Movie.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/repository/MovieRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/FruitRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/PassengerRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/SongRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/controller/CarController.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/entity/Car.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/service/CarService.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/resources/apple-fruit-data.xml create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/resources/application.properties create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/resources/car-mysql.sql create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/resources/fruit-data.json create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/resources/guava-fruit-data.xml create mode 100644 persistence-modules/spring-data-jpa-repo/src/main/resources/import_entities.sql create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/ExtendedStudentRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/InventoryRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/JpaRepositoriesIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/FruitPopulatorIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/PassengerRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/SongRepositoryIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/resources/application-test.properties create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/resources/test-movie-cleanup.sql create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/resources/test-movie-data.sql create mode 100644 persistence-modules/spring-data-jpa-repo/src/test/resources/test-song-data.sql diff --git a/persistence-modules/spring-data-jpa-repo/README.md b/persistence-modules/spring-data-jpa-repo/README.md new file mode 100644 index 0000000000..284a7ac2b5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/README.md @@ -0,0 +1,22 @@ +## Spring Data JPA - Repo + +This module contains articles about repositories in Spring Data JPA + +### Relevant Articles: +- [Case Insensitive Queries with Spring Data Repository](https://www.baeldung.com/spring-data-case-insensitive-queries) +- [Derived Query Methods in Spring Data JPA Repositories](https://www.baeldung.com/spring-data-derived-queries) +- [LIKE Queries in Spring JPA Repositories](https://www.baeldung.com/spring-jpa-like-queries) +- [Spring Data – CrudRepository save() Method](https://www.baeldung.com/spring-data-crud-repository-save) +- [Spring Data JPA – Adding a Method in All Repositories](https://www.baeldung.com/spring-data-jpa-method-in-all-repositories) +- [Spring Data Composable Repositories](https://www.baeldung.com/spring-data-composable-repositories) +- [Spring Data JPA Repository Populators](https://www.baeldung.com/spring-data-jpa-repository-populators) +- [Calling Stored Procedures from Spring Data JPA Repositories](https://www.baeldung.com/spring-data-jpa-stored-procedures) + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator diff --git a/persistence-modules/spring-data-jpa-repo/pom.xml b/persistence-modules/spring-data-jpa-repo/pom.xml new file mode 100644 index 0000000000..984bc1bdff --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + spring-data-jpa-repo + spring-data-jpa-repo + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-starter-data-jdbc + + + + mysql + mysql-connector-java + + + + org.postgresql + postgresql + + + + com.h2database + h2 + + + + org.springframework + spring-oxm + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..47a18b557f --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/Application.java @@ -0,0 +1,17 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +import com.baeldung.boot.daos.impl.ExtendedRepositoryImpl; + +@SpringBootApplication +@EnableJpaRepositories(repositoryBaseClass = ExtendedRepositoryImpl.class) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/CustomItemRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/CustomItemRepository.java new file mode 100644 index 0000000000..0aebe34921 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/CustomItemRepository.java @@ -0,0 +1,16 @@ +package com.baeldung.boot.daos; + +import org.springframework.stereotype.Repository; + +import com.baeldung.boot.domain.Item; + +@Repository +public interface CustomItemRepository { + + void deleteCustom(Item entity); + + Item findItemById(Long id); + + void findThenDelete(Long id); + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/CustomItemTypeRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/CustomItemTypeRepository.java new file mode 100644 index 0000000000..832d61408c --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/CustomItemTypeRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.boot.daos; + +import org.springframework.stereotype.Repository; + +import com.baeldung.boot.domain.ItemType; + +@Repository +public interface CustomItemTypeRepository { + + void deleteCustom(ItemType entity); + + void findThenDelete(Long id); +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ExtendedRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ExtendedRepository.java new file mode 100644 index 0000000000..adb2af4320 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ExtendedRepository.java @@ -0,0 +1,14 @@ +package com.baeldung.boot.daos; + +import java.io.Serializable; +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.NoRepositoryBean; + +@NoRepositoryBean +public interface ExtendedRepository extends JpaRepository { + + List findByAttributeContainsText(String attributeName, String text); + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ExtendedStudentRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ExtendedStudentRepository.java new file mode 100644 index 0000000000..c9b0192536 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ExtendedStudentRepository.java @@ -0,0 +1,6 @@ +package com.baeldung.boot.daos; + +import com.baeldung.boot.domain.Student; + +public interface ExtendedStudentRepository extends ExtendedRepository { +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/InventoryRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/InventoryRepository.java new file mode 100644 index 0000000000..606f3993d5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/InventoryRepository.java @@ -0,0 +1,8 @@ +package com.baeldung.boot.daos; + +import org.springframework.data.repository.CrudRepository; + +import com.baeldung.boot.domain.MerchandiseEntity; + +public interface InventoryRepository extends CrudRepository { +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ItemTypeRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ItemTypeRepository.java new file mode 100644 index 0000000000..413c09e968 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ItemTypeRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.boot.daos; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.boot.domain.ItemType; + +@Repository +public interface ItemTypeRepository extends JpaRepository, CustomItemTypeRepository, CustomItemRepository { +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/LocationRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/LocationRepository.java new file mode 100644 index 0000000000..697ce295d0 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/LocationRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.boot.daos; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.boot.domain.Location; + +@Repository +public interface LocationRepository extends JpaRepository { +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ReadOnlyLocationRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ReadOnlyLocationRepository.java new file mode 100644 index 0000000000..3a2ea3cda5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/ReadOnlyLocationRepository.java @@ -0,0 +1,15 @@ +package com.baeldung.boot.daos; + +import java.util.Optional; + +import org.springframework.data.repository.Repository; + +import com.baeldung.boot.domain.Location; + +@org.springframework.stereotype.Repository +public interface ReadOnlyLocationRepository extends Repository { + + Optional findById(Long id); + + Location save(Location location); +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/StoreRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/StoreRepository.java new file mode 100644 index 0000000000..ae13f75f66 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/StoreRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.boot.daos; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.boot.domain.Store; + +@Repository +public interface StoreRepository extends JpaRepository { + List findStoreByLocationId(Long locationId); +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/CustomItemRepositoryImpl.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/CustomItemRepositoryImpl.java new file mode 100644 index 0000000000..820a2cdd41 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/CustomItemRepositoryImpl.java @@ -0,0 +1,33 @@ +package com.baeldung.boot.daos.impl; + +import javax.persistence.EntityManager; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.baeldung.boot.daos.CustomItemRepository; +import com.baeldung.boot.domain.Item; + +@Repository +public class CustomItemRepositoryImpl implements CustomItemRepository { + + @Autowired + private EntityManager entityManager; + + @Override + public void deleteCustom(Item item) { + entityManager.remove(item); + } + + @Override + public Item findItemById(Long id) { + return entityManager.find(Item.class, id); + } + + @Override + public void findThenDelete(Long id) { + final Item item = entityManager.find(Item.class, id); + entityManager.remove(item); + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/CustomItemTypeRepositoryImpl.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/CustomItemTypeRepositoryImpl.java new file mode 100644 index 0000000000..e057f36b26 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/CustomItemTypeRepositoryImpl.java @@ -0,0 +1,27 @@ +package com.baeldung.boot.daos.impl; + +import javax.persistence.EntityManager; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.baeldung.boot.daos.CustomItemTypeRepository; +import com.baeldung.boot.domain.ItemType; + +@Repository +public class CustomItemTypeRepositoryImpl implements CustomItemTypeRepository { + + @Autowired + private EntityManager entityManager; + + @Override + public void deleteCustom(ItemType itemType) { + entityManager.remove(itemType); + } + + @Override + public void findThenDelete(Long id) { + ItemType itemTypeToDelete = entityManager.find(ItemType.class, id); + entityManager.remove(itemTypeToDelete); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/ExtendedRepositoryImpl.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/ExtendedRepositoryImpl.java new file mode 100644 index 0000000000..fbe6695844 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/daos/impl/ExtendedRepositoryImpl.java @@ -0,0 +1,37 @@ +package com.baeldung.boot.daos.impl; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; +import javax.transaction.Transactional; + +import org.springframework.data.jpa.repository.support.JpaEntityInformation; +import org.springframework.data.jpa.repository.support.SimpleJpaRepository; + +import com.baeldung.boot.daos.ExtendedRepository; + +public class ExtendedRepositoryImpl extends SimpleJpaRepository implements ExtendedRepository { + + private EntityManager entityManager; + + public ExtendedRepositoryImpl(JpaEntityInformation entityInformation, EntityManager entityManager) { + super(entityInformation, entityManager); + this.entityManager = entityManager; + } + + @Transactional + public List findByAttributeContainsText(String attributeName, String text) { + CriteriaBuilder builder = entityManager.getCriteriaBuilder(); + CriteriaQuery query = builder.createQuery(getDomainClass()); + Root root = query.from(getDomainClass()); + query.select(root).where(builder.like(root. get(attributeName), "%" + text + "%")); + TypedQuery q = entityManager.createQuery(query); + return q.getResultList(); + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Item.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Item.java new file mode 100644 index 0000000000..8ac06af15a --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Item.java @@ -0,0 +1,81 @@ +package com.baeldung.boot.domain; + +import java.math.BigDecimal; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +public class Item { + + private String color; + private String grade; + + @Id + private Long id; + + @ManyToOne + private ItemType itemType; + + private String name; + private BigDecimal price; + @ManyToOne + private Store store; + + public String getColor() { + return color; + } + + public String getGrade() { + return grade; + } + + public Long getId() { + return id; + } + + public ItemType getItemType() { + return itemType; + } + + public String getName() { + return name; + } + + public BigDecimal getPrice() { + return price; + } + + public Store getStore() { + return store; + } + + public void setColor(String color) { + this.color = color; + } + + public void setGrade(String grade) { + this.grade = grade; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItemType(ItemType itemType) { + this.itemType = itemType; + } + + public void setName(String name) { + this.name = name; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public void setStore(Store store) { + this.store = store; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/ItemType.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/ItemType.java new file mode 100644 index 0000000000..8a52a9847c --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/ItemType.java @@ -0,0 +1,46 @@ +package com.baeldung.boot.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; + +@Entity +public class ItemType { + + @Id + private Long id; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "ITEM_TYPE_ID") + private List items = new ArrayList<>(); + + private String name; + + public Long getId() { + return id; + } + + public List getItems() { + return items; + } + + public String getName() { + return name; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItems(List items) { + this.items = items; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/KVTag.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/KVTag.java new file mode 100644 index 0000000000..1901f43c0a --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/KVTag.java @@ -0,0 +1,34 @@ +package com.baeldung.boot.domain; + +import javax.persistence.Embeddable; + +@Embeddable +public class KVTag { + private String key; + private String value; + + public KVTag() { + } + + public KVTag(String key, String value) { + super(); + this.key = key; + this.value = value; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Location.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Location.java new file mode 100644 index 0000000000..9c1b93d551 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Location.java @@ -0,0 +1,55 @@ +package com.baeldung.boot.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; + +@Entity +public class Location { + + private String city; + private String country; + @Id + private Long id; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "LOCATION_ID") + private List stores = new ArrayList<>(); + + public String getCity() { + return city; + } + + public String getCountry() { + return country; + } + + public Long getId() { + return id; + } + + public List getStores() { + return stores; + } + + public void setCity(String city) { + this.city = city; + } + + public void setCountry(String country) { + this.country = country; + } + + public void setId(Long id) { + this.id = id; + } + + public void setStores(List stores) { + this.stores = stores; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/MerchandiseEntity.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/MerchandiseEntity.java new file mode 100644 index 0000000000..e94c23de86 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/MerchandiseEntity.java @@ -0,0 +1,66 @@ +package com.baeldung.boot.domain; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import java.math.BigDecimal; + +@Entity +public class MerchandiseEntity { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + private String title; + + private BigDecimal price; + + private String brand; + + public MerchandiseEntity() { + } + + public MerchandiseEntity(String title, BigDecimal price) { + this.title = title; + this.price = price; + } + + public Long getId() { + return id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + @Override + public String toString() { + return "MerchandiseEntity{" + + "id=" + id + + ", title='" + title + '\'' + + ", price=" + price + + ", brand='" + brand + '\'' + + '}'; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/SkillTag.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/SkillTag.java new file mode 100644 index 0000000000..0933a3e6af --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/SkillTag.java @@ -0,0 +1,30 @@ +package com.baeldung.boot.domain; + +import javax.persistence.Embeddable; + +@Embeddable +public class SkillTag { + private String name; + private int value; + + public SkillTag() { + } + + public SkillTag(String name, int value) { + super(); + this.name = name; + this.value = value; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + public String getName() { + return name; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Store.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Store.java new file mode 100644 index 0000000000..5b4b831cc7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Store.java @@ -0,0 +1,76 @@ +package com.baeldung.boot.domain; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; + +@Entity +public class Store { + + private Boolean active; + @Id + private Long id; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "STORE_ID") + private List items = new ArrayList<>(); + private Long itemsSold; + + @ManyToOne + private Location location; + + private String name; + + public Boolean getActive() { + return active; + } + + public Long getId() { + return id; + } + + public List getItems() { + return items; + } + + public Long getItemsSold() { + return itemsSold; + } + + public Location getLocation() { + return location; + } + + public String getName() { + return name; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public void setId(Long id) { + this.id = id; + } + + public void setItems(List items) { + this.items = items; + } + + public void setItemsSold(Long itemsSold) { + this.itemsSold = itemsSold; + } + + public void setLocation(Location location) { + this.location = location; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Student.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Student.java new file mode 100644 index 0000000000..1003167cc7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/boot/domain/Student.java @@ -0,0 +1,74 @@ +package com.baeldung.boot.domain; + +import javax.persistence.ElementCollection; +import javax.persistence.Entity; +import javax.persistence.Id; +import java.util.ArrayList; +import java.util.List; + +@Entity +public class Student { + + @Id + private long id; + private String name; + + @ElementCollection + private List tags = new ArrayList<>(); + + @ElementCollection + private List skillTags = new ArrayList<>(); + + @ElementCollection + private List kvTags = new ArrayList<>(); + + public Student() { + } + + public Student(long id, String name) { + super(); + this.id = id; + this.name = name; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags.addAll(tags); + } + + public List getSkillTags() { + return skillTags; + } + + public void setSkillTags(List skillTags) { + this.skillTags.addAll(skillTags); + } + + public List getKVTags() { + return this.kvTags; + } + + public void setKVTags(List kvTags) { + this.kvTags.addAll(kvTags); + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/config/JpaPopulators.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/config/JpaPopulators.java new file mode 100644 index 0000000000..24348d31c5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/config/JpaPopulators.java @@ -0,0 +1,35 @@ +package com.baeldung.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.data.repository.init.Jackson2RepositoryPopulatorFactoryBean; +import org.springframework.data.repository.init.UnmarshallerRepositoryPopulatorFactoryBean; +import org.springframework.oxm.jaxb.Jaxb2Marshaller; + +import com.baeldung.entity.Fruit; + +@Configuration +public class JpaPopulators { + + @Bean + public Jackson2RepositoryPopulatorFactoryBean getRespositoryPopulator() throws Exception { + Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean(); + factory.setResources(new Resource[] { new ClassPathResource("fruit-data.json") }); + return factory; + } + + @Bean + public UnmarshallerRepositoryPopulatorFactoryBean repositoryPopulator() { + + Jaxb2Marshaller unmarshaller = new Jaxb2Marshaller(); + unmarshaller.setClassesToBeBound(Fruit.class); + + UnmarshallerRepositoryPopulatorFactoryBean factory = new UnmarshallerRepositoryPopulatorFactoryBean(); + factory.setUnmarshaller(unmarshaller); + factory.setResources(new Resource[] { new ClassPathResource("apple-fruit-data.xml"), new ClassPathResource("guava-fruit-data.xml") }); + return factory; + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/QueryApplication.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/QueryApplication.java new file mode 100644 index 0000000000..d7a1950305 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/QueryApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.derivedquery; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class QueryApplication { + + public static void main(String[] args) { + SpringApplication.run(QueryApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/entity/User.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/entity/User.java new file mode 100644 index 0000000000..49e824f09f --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/entity/User.java @@ -0,0 +1,70 @@ +package com.baeldung.derivedquery.entity; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.ZonedDateTime; + +@Table(name = "users") +@Entity +public class User { + + @Id + @GeneratedValue + private Integer id; + private String name; + private Integer age; + private ZonedDateTime birthDate; + private Boolean active; + + public User() { + } + + public User(String name, Integer age, ZonedDateTime birthDate, Boolean active) { + this.name = name; + this.age = age; + this.birthDate = birthDate; + this.active = active; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getAge() { + return age; + } + + public void setAge(Integer age) { + this.age = age; + } + + public ZonedDateTime getBirthDate() { + return birthDate; + } + + public void setBirthDate(ZonedDateTime birthDate) { + this.birthDate = birthDate; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/repository/UserRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/repository/UserRepository.java new file mode 100644 index 0000000000..e613ee1531 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/derivedquery/repository/UserRepository.java @@ -0,0 +1,60 @@ +package com.baeldung.derivedquery.repository; + +import com.baeldung.derivedquery.entity.User; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.time.ZonedDateTime; +import java.util.Collection; +import java.util.List; + +public interface UserRepository extends JpaRepository { + + List findByName(String name); + + List findByNameIs(String name); + + List findByNameEquals(String name); + + List findByNameIsNull(); + + List findByNameNot(String name); + + List findByNameIsNot(String name); + + List findByNameStartingWith(String name); + + List findByNameEndingWith(String name); + + List findByNameContaining(String name); + + List findByNameLike(String name); + + List findByAgeLessThan(Integer age); + + List findByAgeLessThanEqual(Integer age); + + List findByAgeGreaterThan(Integer age); + + List findByAgeGreaterThanEqual(Integer age); + + List findByAgeBetween(Integer startAge, Integer endAge); + + List findByBirthDateAfter(ZonedDateTime birthDate); + + List findByBirthDateBefore(ZonedDateTime birthDate); + + List findByActiveTrue(); + + List findByActiveFalse(); + + List findByAgeIn(Collection ages); + + List findByNameOrBirthDate(String name, ZonedDateTime birthDate); + + List findByNameOrBirthDateAndActive(String name, ZonedDateTime birthDate, Boolean active); + + List findByNameOrderByName(String name); + + List findByNameOrderByNameDesc(String name); + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Fruit.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Fruit.java new file mode 100644 index 0000000000..d45ac33db8 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Fruit.java @@ -0,0 +1,40 @@ +package com.baeldung.entity; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +@Entity +public class Fruit { + + @Id + private long id; + private String name; + private String color; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Passenger.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Passenger.java new file mode 100644 index 0000000000..3aafbe9afa --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Passenger.java @@ -0,0 +1,78 @@ +package com.baeldung.entity; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import java.util.Objects; + +@Entity +public class Passenger { + + @Id + @GeneratedValue + @Column(nullable = false) + private Long id; + + @Basic(optional = false) + @Column(nullable = false) + private String firstName; + + @Basic(optional = false) + @Column(nullable = false) + private String lastName; + + private Passenger(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public static Passenger from(String firstName, String lastName) { + return new Passenger(firstName, lastName); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @Override + public String toString() { + return "Passenger{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Passenger passenger = (Passenger) o; + return Objects.equals(firstName, passenger.firstName) && Objects.equals(lastName, passenger.lastName); + } + + @Override + public int hashCode() { + return Objects.hash(firstName, lastName); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Song.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Song.java new file mode 100644 index 0000000000..395527c1eb --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/entity/Song.java @@ -0,0 +1,75 @@ +package com.baeldung.entity; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import java.time.LocalDateTime; + +@Entity +public class Song { + + @Id private long id; + private String name; + @Column(name = "length_in_seconds") + private int lengthInSeconds; + private String compositor; + private String singer; + private LocalDateTime released; + private String genre; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getLengthInSeconds() { + return lengthInSeconds; + } + + public void setLengthInSeconds(int lengthInSeconds) { + this.lengthInSeconds = lengthInSeconds; + } + + public String getCompositor() { + return compositor; + } + + public void setCompositor(String compositor) { + this.compositor = compositor; + } + + public String getSinger() { + return singer; + } + + public void setSinger(String singer) { + this.singer = singer; + } + + public LocalDateTime getReleased() { + return released; + } + + public void setReleased(LocalDateTime released) { + this.released = released; + } + + public String getGenre() { + return genre; + } + + public void setGenre(String genre) { + this.genre = genre; + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/LikeApplication.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/LikeApplication.java new file mode 100644 index 0000000000..311aea3001 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/LikeApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.like; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class LikeApplication { + + public static void main(String[] args) { + SpringApplication.run(LikeApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/model/Movie.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/model/Movie.java new file mode 100644 index 0000000000..bba8bd35c4 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/model/Movie.java @@ -0,0 +1,58 @@ +package com.baeldung.like.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class Movie { + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE) + private Long id; + private String title; + private String director; + private String rating; + private int duration; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDirector() { + return director; + } + + public void setDirector(String director) { + this.director = director; + } + + public String getRating() { + return rating; + } + + public void setRating(String rating) { + this.rating = rating; + } + + public int getDuration() { + return duration; + } + + public void setDuration(int duration) { + this.duration = duration; + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/repository/MovieRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/repository/MovieRepository.java new file mode 100644 index 0000000000..241bdd3306 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/like/repository/MovieRepository.java @@ -0,0 +1,41 @@ +package com.baeldung.like.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import com.baeldung.like.model.Movie; + +public interface MovieRepository extends CrudRepository { + + List findByTitleContaining(String title); + + List findByTitleLike(String title); + + List findByTitleContains(String title); + + List findByTitleIsContaining(String title); + + List findByRatingStartsWith(String rating); + + List findByDirectorEndsWith(String director); + + List findByTitleContainingIgnoreCase(String title); + + List findByRatingNotContaining(String rating); + + List findByDirectorNotLike(String director); + + @Query("SELECT m FROM Movie m WHERE m.title LIKE %:title%") + List searchByTitleLike(@Param("title") String title); + + @Query("SELECT m FROM Movie m WHERE m.rating LIKE ?1%") + List searchByRatingStartsWith(String rating); + + //Escaping works in SpringBoot >= 2.4.1 + //@Query("SELECT m FROM Movie m WHERE m.director LIKE %?#{escape([0])} escape ?#{escapeCharacter()}") + @Query("SELECT m FROM Movie m WHERE m.director LIKE %:#{[0]}") + List searchByDirectorEndsWith(String director); +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/FruitRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/FruitRepository.java new file mode 100644 index 0000000000..5055252adf --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/FruitRepository.java @@ -0,0 +1,27 @@ +package com.baeldung.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.baeldung.entity.Fruit; + +@Repository +public interface FruitRepository extends JpaRepository { + + Long deleteByName(String name); + + List deleteByColor(String color); + + Long removeByName(String name); + + List removeByColor(String color); + + @Modifying + @Query("delete from Fruit f where f.name=:name or f.color=:color") + int deleteFruits(@Param("name") String name, @Param("color") String color); +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/PassengerRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/PassengerRepository.java new file mode 100644 index 0000000000..a295a74f1b --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/PassengerRepository.java @@ -0,0 +1,14 @@ +package com.baeldung.repository; + +import com.baeldung.entity.Passenger; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +interface PassengerRepository extends JpaRepository { + + List findByFirstNameIgnoreCase(String firstName); + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/SongRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/SongRepository.java new file mode 100644 index 0000000000..6faed411d3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/repository/SongRepository.java @@ -0,0 +1,22 @@ +package com.baeldung.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import com.baeldung.entity.Song; + +@Repository +public interface SongRepository extends JpaRepository { + + List findByNameLike(String name); + + List findByNameNotLike(String name); + + List findByNameStartingWith(String startingWith); + + List findByNameEndingWith(String endingWith); + + List findBySingerContaining(String singer); +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java new file mode 100644 index 0000000000..5f05764e21 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.storedprocedure; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class StoredProcedureApplication { + + public static void main(String[] args) { + SpringApplication.run(StoredProcedureApplication.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/controller/CarController.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/controller/CarController.java new file mode 100644 index 0000000000..6aef600d01 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/controller/CarController.java @@ -0,0 +1,47 @@ +package com.baeldung.storedprocedure.controller; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.storedprocedure.entity.Car; +import com.baeldung.storedprocedure.service.CarService; + +@RestController +public class CarController { + @Autowired + private CarService carService; + + @GetMapping(path = "/modelcount") + public long getTotalCarsByModel(@RequestParam("model") String model) { + return carService.getTotalCarsByModel(model); + } + + @GetMapping(path = "/modelcountP") + public long getTotalCarsByModelProcedureName(@RequestParam("model") String model) { + return carService.getTotalCarsByModelProcedureName(model); + } + + @GetMapping(path = "/modelcountV") + public long getTotalCarsByModelVaue(@RequestParam("model") String model) { + return carService.getTotalCarsByModelValue(model); + } + + @GetMapping(path = "/modelcountEx") + public long getTotalCarsByModelExplicit(@RequestParam("model") String model) { + return carService.getTotalCarsByModelExplicit(model); + } + + @GetMapping(path = "/modelcountEn") + public long getTotalCarsByModelEntity(@RequestParam("model") String model) { + return carService.getTotalCarsByModelEntity(model); + } + + @GetMapping(path = "/carsafteryear") + public List findCarsAfterYear(@RequestParam("year") Integer year) { + return carService.findCarsAfterYear(year); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/entity/Car.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/entity/Car.java new file mode 100644 index 0000000000..2817c25ff7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/entity/Car.java @@ -0,0 +1,41 @@ +package com.baeldung.storedprocedure.entity; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedStoredProcedureQuery; +import javax.persistence.StoredProcedureParameter; +import javax.persistence.ParameterMode; + +@Entity +@NamedStoredProcedureQuery(name = "Car.getTotalCardsbyModelEntity", procedureName = "GET_TOTAL_CARS_BY_MODEL", parameters = { + @StoredProcedureParameter(mode = ParameterMode.IN, name = "model_in", type = String.class), + @StoredProcedureParameter(mode = ParameterMode.OUT, name = "count_out", type = Integer.class) }) + +public class Car { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column + private long id; + + @Column + private String model; + + @Column + private Integer year; + + public long getId() { + return id; + } + + public String getModel() { + return model; + } + + public Integer getYear() { + return year; + } + +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java new file mode 100644 index 0000000000..3d9428628e --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java @@ -0,0 +1,34 @@ +package com.baeldung.storedprocedure.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.jpa.repository.query.Procedure; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.baeldung.storedprocedure.entity.Car; + +@Repository +public interface CarRepository extends JpaRepository { + + @Procedure + int GET_TOTAL_CARS_BY_MODEL(String model); + + @Procedure("GET_TOTAL_CARS_BY_MODEL") + int getTotalCarsByModel(String model); + + @Procedure(procedureName = "GET_TOTAL_CARS_BY_MODEL") + int getTotalCarsByModelProcedureName(String model); + + @Procedure(value = "GET_TOTAL_CARS_BY_MODEL") + int getTotalCarsByModelValue(String model); + + @Procedure(name = "Car.getTotalCardsbyModelEntity") + int getTotalCarsByModelEntiy(@Param("model_in") String model); + + @Query(value = "CALL FIND_CARS_AFTER_YEAR(:year_in);", nativeQuery = true) + List findCarsAfterYear(@Param("year_in") Integer year_in); + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/service/CarService.java b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/service/CarService.java new file mode 100644 index 0000000000..104f46e324 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/service/CarService.java @@ -0,0 +1,39 @@ +package com.baeldung.storedprocedure.service; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baeldung.storedprocedure.entity.Car; +import com.baeldung.storedprocedure.repository.CarRepository; + +@Service +public class CarService { + @Autowired + private CarRepository carRepository; + + public int getTotalCarsByModel(String model) { + return carRepository.getTotalCarsByModel(model); + } + + public int getTotalCarsByModelProcedureName(String model) { + return carRepository.getTotalCarsByModelProcedureName(model); + } + + public int getTotalCarsByModelValue(String model) { + return carRepository.getTotalCarsByModelValue(model); + } + + public int getTotalCarsByModelExplicit(String model) { + return carRepository.GET_TOTAL_CARS_BY_MODEL(model); + } + + public int getTotalCarsByModelEntity(String model) { + return carRepository.getTotalCarsByModelEntiy(model); + } + + public List findCarsAfterYear(Integer year) { + return carRepository.findCarsAfterYear(year); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/main/resources/apple-fruit-data.xml b/persistence-modules/spring-data-jpa-repo/src/main/resources/apple-fruit-data.xml new file mode 100644 index 0000000000..d87ae28f1e --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/resources/apple-fruit-data.xml @@ -0,0 +1,7 @@ + + + + 1 + apple + red + diff --git a/persistence-modules/spring-data-jpa-repo/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-repo/src/main/resources/application.properties new file mode 100644 index 0000000000..65d7b0bf29 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/resources/application.properties @@ -0,0 +1,5 @@ +spring.jpa.show-sql=true +#MySql +#spring.datasource.url=jdbc:mysql://localhost:3306/baeldung +#spring.datasource.username=baeldung +#spring.datasource.password=baeldung \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/src/main/resources/car-mysql.sql b/persistence-modules/spring-data-jpa-repo/src/main/resources/car-mysql.sql new file mode 100644 index 0000000000..bb4ab2a86e --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/resources/car-mysql.sql @@ -0,0 +1,27 @@ +DROP TABLE IF EXISTS car; + +CREATE TABLE car (id int(10) NOT NULL AUTO_INCREMENT, + model varchar(50) NOT NULL, + year int(4) NOT NULL, + PRIMARY KEY (id)); + +INSERT INTO car (model, year) VALUES ('BMW', 2000); +INSERT INTO car (model, year) VALUES ('BENZ', 2010); +INSERT INTO car (model, year) VALUES ('PORCHE', 2005); +INSERT INTO car (model, year) VALUES ('PORCHE', 2004); + +DELIMITER $$ + +DROP PROCEDURE IF EXISTS FIND_CARS_AFTER_YEAR$$ +CREATE PROCEDURE FIND_CARS_AFTER_YEAR(IN year_in INT) +BEGIN + SELECT * FROM car WHERE year >= year_in ORDER BY year; +END$$ + +DROP PROCEDURE IF EXISTS GET_TOTAL_CARS_BY_MODEL$$ +CREATE PROCEDURE GET_TOTAL_CARS_BY_MODEL(IN model_in VARCHAR(50), OUT count_out INT) +BEGIN + SELECT COUNT(*) into count_out from car WHERE model = model_in; +END$$ + +DELIMITER ; diff --git a/persistence-modules/spring-data-jpa-repo/src/main/resources/fruit-data.json b/persistence-modules/spring-data-jpa-repo/src/main/resources/fruit-data.json new file mode 100644 index 0000000000..6dc44e2586 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/resources/fruit-data.json @@ -0,0 +1,14 @@ +[ + { + "_class": "com.baeldung.entity.Fruit", + "name": "apple", + "color": "red", + "id": 1 + }, + { + "_class": "com.baeldung.entity.Fruit", + "name": "guava", + "color": "green", + "id": 2 + } +] \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/src/main/resources/guava-fruit-data.xml b/persistence-modules/spring-data-jpa-repo/src/main/resources/guava-fruit-data.xml new file mode 100644 index 0000000000..ffd75bb4bb --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/resources/guava-fruit-data.xml @@ -0,0 +1,7 @@ + + + + 2 + guava + green + diff --git a/persistence-modules/spring-data-jpa-repo/src/main/resources/import_entities.sql b/persistence-modules/spring-data-jpa-repo/src/main/resources/import_entities.sql new file mode 100644 index 0000000000..6282fd1481 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/main/resources/import_entities.sql @@ -0,0 +1,17 @@ +insert into location (id, country, city) values (1, 'Country X', 'City One'); +insert into location (id, country, city) values (2, 'Country X', 'City Two'); +insert into location (id, country, city) values (3, 'Country X', 'City Three'); + +insert into store (id, name, location_id, items_sold, active) values (1, 'Store One', 3, 130000, true); +insert into store (id, name, location_id, items_sold, active) values (2, 'Store Two', 1, 170000, false); + +insert into item_type (id, name) values (1, 'Food'); +insert into item_type (id, name) values (2, 'Furniture'); +insert into item_type (id, name) values (3, 'Electronics'); + +insert into item (id, name, store_id, item_type_id, price, grade, color) values (1, 'Food Item One', 1, 1, 100, 'A', 'Color x'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (2, 'Furniture Item One', 1, 2, 2500, 'B', 'Color y'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (3, 'Food Item Two', 1, 1, 35, 'A', 'Color z'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (5, 'Furniture Item Two', 2, 2, 1600, 'A', 'Color w'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (6, 'Food Item Three', 2, 1, 5, 'B', 'Color a'); +insert into item (id, name, store_id, item_type_id, price, grade, color) values (7, 'Electronics Item One', 2, 3, 999, 'B', 'Color b'); diff --git a/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/ExtendedStudentRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/ExtendedStudentRepositoryIntegrationTest.java new file mode 100644 index 0000000000..b367b5fdca --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/ExtendedStudentRepositoryIntegrationTest.java @@ -0,0 +1,41 @@ +package com.baeldung.boot.daos; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; + +import javax.annotation.Resource; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Application; +import com.baeldung.boot.domain.Student; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = {Application.class}) +@DirtiesContext +public class ExtendedStudentRepositoryIntegrationTest { + @Resource + private ExtendedStudentRepository extendedStudentRepository; + + @Before + public void setup() { + Student student = new Student(1, "john"); + extendedStudentRepository.save(student); + Student student2 = new Student(2, "johnson"); + extendedStudentRepository.save(student2); + Student student3 = new Student(3, "tom"); + extendedStudentRepository.save(student3); + } + + @Test + public void givenStudents_whenFindByName_thenGetOk() { + List students = extendedStudentRepository.findByAttributeContainsText("name", "john"); + assertThat(students.size()).isEqualTo(2); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/InventoryRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/InventoryRepositoryIntegrationTest.java new file mode 100644 index 0000000000..22e2c81739 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/InventoryRepositoryIntegrationTest.java @@ -0,0 +1,61 @@ +package com.baeldung.boot.daos; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; + +import java.math.BigDecimal; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Application; +import com.baeldung.boot.domain.MerchandiseEntity; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes=Application.class) +public class InventoryRepositoryIntegrationTest { + + private static final String ORIGINAL_TITLE = "Pair of Pants"; + private static final String UPDATED_TITLE = "Branded Luxury Pants"; + private static final String UPDATED_BRAND = "Armani"; + private static final String ORIGINAL_SHORTS_TITLE = "Pair of Shorts"; + + @Autowired + private InventoryRepository repository; + + @Test + public void shouldCreateNewEntryInDB() { + MerchandiseEntity pants = new MerchandiseEntity(ORIGINAL_TITLE, BigDecimal.ONE); + pants = repository.save(pants); + + MerchandiseEntity shorts = new MerchandiseEntity(ORIGINAL_SHORTS_TITLE, new BigDecimal(3)); + shorts = repository.save(shorts); + + assertNotNull(pants.getId()); + assertNotNull(shorts.getId()); + assertNotEquals(pants.getId(), shorts.getId()); + } + + @Test + public void shouldUpdateExistingEntryInDB() { + MerchandiseEntity pants = new MerchandiseEntity(ORIGINAL_TITLE, BigDecimal.ONE); + pants = repository.save(pants); + + Long originalId = pants.getId(); + + pants.setTitle(UPDATED_TITLE); + pants.setPrice(BigDecimal.TEN); + pants.setBrand(UPDATED_BRAND); + + MerchandiseEntity result = repository.save(pants); + + assertEquals(originalId, result.getId()); + assertEquals(UPDATED_TITLE, result.getTitle()); + assertEquals(BigDecimal.TEN, result.getPrice()); + assertEquals(UPDATED_BRAND, result.getBrand()); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/JpaRepositoriesIntegrationTest.java b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/JpaRepositoriesIntegrationTest.java new file mode 100644 index 0000000000..9e4b78dce3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/boot/daos/JpaRepositoriesIntegrationTest.java @@ -0,0 +1,93 @@ +package com.baeldung.boot.daos; + +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertFalse; +import static junit.framework.TestCase.assertNotNull; +import static junit.framework.TestCase.assertNull; +import static junit.framework.TestCase.assertTrue; + +import java.util.List; +import java.util.Optional; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.boot.domain.Item; +import com.baeldung.boot.domain.ItemType; +import com.baeldung.boot.domain.Location; +import com.baeldung.boot.domain.Store; + +@RunWith(SpringRunner.class) +@DataJpaTest(properties="spring.datasource.data=classpath:import_entities.sql") +public class JpaRepositoriesIntegrationTest { + @Autowired + private LocationRepository locationRepository; + @Autowired + private StoreRepository storeRepository; + @Autowired + private ItemTypeRepository compositeRepository; + @Autowired + private ReadOnlyLocationRepository readOnlyRepository; + + @Test + public void whenSaveLocation_ThenGetSameLocation() { + Location location = new Location(); + location.setId(100L); + location.setCountry("Country H"); + location.setCity("City Hundred"); + location = locationRepository.saveAndFlush(location); + + Location otherLocation = locationRepository.getOne(location.getId()); + assertEquals("Country H", otherLocation.getCountry()); + assertEquals("City Hundred", otherLocation.getCity()); + + locationRepository.delete(otherLocation); + } + + @Test + public void givenLocationId_whenFindStores_thenGetStores() { + List stores = storeRepository.findStoreByLocationId(1L); + assertEquals(1, stores.size()); + } + + @Test + public void givenItemTypeId_whenDeleted_ThenItemTypeDeleted() { + Optional itemType = compositeRepository.findById(1L); + assertTrue(itemType.isPresent()); + compositeRepository.deleteCustom(itemType.get()); + itemType = compositeRepository.findById(1L); + assertFalse(itemType.isPresent()); + } + + @Test + public void givenItemId_whenUsingCustomRepo_ThenDeleteAppropriateEntity() { + Item item = compositeRepository.findItemById(1L); + assertNotNull(item); + compositeRepository.deleteCustom(item); + item = compositeRepository.findItemById(1L); + assertNull(item); + } + + @Test + public void givenItemAndItemType_WhenAmbiguousDeleteCalled_ThenItemTypeDeletedAndNotItem() { + Optional itemType = compositeRepository.findById(1L); + assertTrue(itemType.isPresent()); + Item item = compositeRepository.findItemById(2L); + assertNotNull(item); + + compositeRepository.findThenDelete(1L); + Optional sameItemType = compositeRepository.findById(1L); + assertFalse(sameItemType.isPresent()); + Item sameItem = compositeRepository.findItemById(2L); + assertNotNull(sameItem); + } + + @Test + public void whenCreatingReadOnlyRepo_thenHaveOnlyReadOnlyOperationsAvailable() { + Optional location = readOnlyRepository.findById(1L); + assertNotNull(location); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java new file mode 100644 index 0000000000..2a6e166b88 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java @@ -0,0 +1,172 @@ +package com.baeldung.derivedquery.repository; + +import com.baeldung.derivedquery.QueryApplication; +import com.baeldung.derivedquery.entity.User; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.time.ZonedDateTime; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = QueryApplication.class) +public class UserRepositoryIntegrationTest { + + private static final String USER_NAME_ADAM = "Adam"; + private static final String USER_NAME_EVE = "Eve"; + private static final ZonedDateTime BIRTHDATE = ZonedDateTime.now(); + + @Autowired + private UserRepository userRepository; + + @Before + public void setUp() { + + User user1 = new User(USER_NAME_ADAM, 25, BIRTHDATE, true); + User user2 = new User(USER_NAME_ADAM, 20, BIRTHDATE, false); + User user3 = new User(USER_NAME_EVE, 20, BIRTHDATE, true); + User user4 = new User(null, 30, BIRTHDATE, false); + + userRepository.saveAll(Arrays.asList(user1, user2, user3, user4)); + } + + @After + public void tearDown() { + + userRepository.deleteAll(); + } + + @Test + public void whenFindByName_thenReturnsCorrectResult() { + + assertEquals(2, userRepository.findByName(USER_NAME_ADAM).size()); + } + + @Test + public void whenFindByNameIsNull_thenReturnsCorrectResult() { + + assertEquals(1, userRepository.findByNameIsNull().size()); + } + + @Test + public void whenFindByNameNot_thenReturnsCorrectResult() { + + assertEquals(USER_NAME_EVE, userRepository.findByNameNot(USER_NAME_ADAM).get(0).getName()); + } + + @Test + public void whenFindByNameStartingWith_thenReturnsCorrectResult() { + + assertEquals(2, userRepository.findByNameStartingWith("A").size()); + } + + @Test + public void whenFindByNameEndingWith_thenReturnsCorrectResult() { + + assertEquals(1, userRepository.findByNameEndingWith("e").size()); + } + + @Test + public void whenByNameContaining_thenReturnsCorrectResult() { + + assertEquals(1, userRepository.findByNameContaining("v").size()); + } + + + @Test + public void whenByNameLike_thenReturnsCorrectResult() { + + assertEquals(2, userRepository.findByNameEndingWith("m").size()); + } + + @Test + public void whenByAgeLessThan_thenReturnsCorrectResult() { + + assertEquals(2, userRepository.findByAgeLessThan(25).size()); + } + + + @Test + public void whenByAgeLessThanEqual_thenReturnsCorrectResult() { + + assertEquals(3, userRepository.findByAgeLessThanEqual(25).size()); + } + + @Test + public void whenByAgeGreaterThan_thenReturnsCorrectResult() { + + assertEquals(1, userRepository.findByAgeGreaterThan(25).size()); + } + + @Test + public void whenByAgeGreaterThanEqual_thenReturnsCorrectResult() { + + assertEquals(2, userRepository.findByAgeGreaterThanEqual(25).size()); + } + + @Test + public void whenByAgeBetween_thenReturnsCorrectResult() { + + assertEquals(4, userRepository.findByAgeBetween(20, 30).size()); + } + + @Test + public void whenByBirthDateAfter_thenReturnsCorrectResult() { + + final ZonedDateTime yesterday = BIRTHDATE.minusDays(1); + assertEquals(4, userRepository.findByBirthDateAfter(yesterday).size()); + } + + @Test + public void whenByBirthDateBefore_thenReturnsCorrectResult() { + + final ZonedDateTime yesterday = BIRTHDATE.minusDays(1); + assertEquals(0, userRepository.findByBirthDateBefore(yesterday).size()); + } + + @Test + public void whenByActiveTrue_thenReturnsCorrectResult() { + + assertEquals(2, userRepository.findByActiveTrue().size()); + } + + @Test + public void whenByActiveFalse_thenReturnsCorrectResult() { + + assertEquals(2, userRepository.findByActiveFalse().size()); + } + + + @Test + public void whenByAgeIn_thenReturnsCorrectResult() { + + final List ages = Arrays.asList(20, 25); + assertEquals(3, userRepository.findByAgeIn(ages).size()); + } + + @Test + public void whenByNameOrBirthDate() { + + assertEquals(4, userRepository.findByNameOrBirthDate(USER_NAME_ADAM, BIRTHDATE).size()); + } + + @Test + public void whenByNameOrBirthDateAndActive() { + + assertEquals(3, userRepository.findByNameOrBirthDateAndActive(USER_NAME_ADAM, BIRTHDATE, false).size()); + } + + @Test + public void whenByNameOrderByName() { + + assertEquals(2, userRepository.findByNameOrderByName(USER_NAME_ADAM).size()); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java new file mode 100644 index 0000000000..cc96b638ab --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java @@ -0,0 +1,87 @@ +package com.baeldung.like; + +import com.baeldung.like.model.Movie; +import com.baeldung.like.repository.MovieRepository; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_METHOD; + +@RunWith(SpringRunner.class) +@Sql(scripts = { "/test-movie-data.sql" }) +@SpringBootTest(classes = LikeApplication.class) +@Sql(scripts = "/test-movie-cleanup.sql", executionPhase = AFTER_TEST_METHOD) +public class MovieRepositoryIntegrationTest { + @Autowired + private MovieRepository movieRepository; + + @Test + public void givenPartialTitle_WhenFindByTitleContaining_ThenMoviesShouldReturn() { + List results = movieRepository.findByTitleContaining("in"); + assertEquals(3, results.size()); + + results = movieRepository.findByTitleLike("%in%"); + assertEquals(3, results.size()); + + results = movieRepository.findByTitleIsContaining("in"); + assertEquals(3, results.size()); + + results = movieRepository.findByTitleContains("in"); + assertEquals(3, results.size()); + } + + @Test + public void givenStartOfRating_WhenFindByRatingStartsWith_ThenMoviesShouldReturn() { + List results = movieRepository.findByRatingStartsWith("PG"); + assertEquals(6, results.size()); + } + + @Test + public void givenLastName_WhenFindByDirectorEndsWith_ThenMoviesShouldReturn() { + List results = movieRepository.findByDirectorEndsWith("Burton"); + assertEquals(1, results.size()); + } + + @Test + public void givenPartialTitle_WhenFindByTitleContainingIgnoreCase_ThenMoviesShouldReturn() { + List results = movieRepository.findByTitleContainingIgnoreCase("the"); + assertEquals(2, results.size()); + } + + @Test + public void givenPartialTitle_WhenSearchByTitleLike_ThenMoviesShouldReturn() { + List results = movieRepository.searchByTitleLike("in"); + assertEquals(3, results.size()); + } + + @Test + public void givenStartOfRating_SearchFindByRatingStartsWith_ThenMoviesShouldReturn() { + List results = movieRepository.searchByRatingStartsWith("PG"); + assertEquals(6, results.size()); + } + + @Test + public void givenLastName_WhenSearchByDirectorEndsWith_ThenMoviesShouldReturn() { + List results = movieRepository.searchByDirectorEndsWith("Burton"); + assertEquals(1, results.size()); + } + + @Test + public void givenPartialRating_findByRatingNotContaining_ThenMoviesShouldReturn() { + List results = movieRepository.findByRatingNotContaining("PG"); + assertEquals(1, results.size()); + } + + @Test + public void givenPartialDirector_WhenFindByDirectorNotLike_ThenMoviesShouldReturn() { + List results = movieRepository.findByDirectorNotLike("An%"); + assertEquals(5, results.size()); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/FruitPopulatorIntegrationTest.java b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/FruitPopulatorIntegrationTest.java new file mode 100644 index 0000000000..4d3661e717 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/FruitPopulatorIntegrationTest.java @@ -0,0 +1,38 @@ +package com.baeldung.repository; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.entity.Fruit; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class FruitPopulatorIntegrationTest { + + @Autowired + private FruitRepository fruitRepository; + + @Test + public void givenFruitJsonPopulatorThenShouldInsertRecordOnStart() { + + List fruits = fruitRepository.findAll(); + assertEquals("record count is not matching", 2, fruits.size()); + + fruits.forEach(fruit -> { + if (1 == fruit.getId()) { + assertEquals("apple", fruit.getName()); + assertEquals("red", fruit.getColor()); + } else if (2 == fruit.getId()) { + assertEquals("guava", fruit.getName()); + assertEquals("green", fruit.getColor()); + } + }); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/PassengerRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/PassengerRepositoryIntegrationTest.java new file mode 100644 index 0000000000..37fcef7dab --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/PassengerRepositoryIntegrationTest.java @@ -0,0 +1,56 @@ +package com.baeldung.repository; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.core.IsNot.not; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.entity.Passenger; + +@DataJpaTest +@RunWith(SpringRunner.class) +public class PassengerRepositoryIntegrationTest { + + @PersistenceContext + private EntityManager entityManager; + @Autowired + private PassengerRepository repository; + + @Before + public void before() { + entityManager.persist(Passenger.from("Jill", "Smith")); + entityManager.persist(Passenger.from("Eve", "Jackson")); + entityManager.persist(Passenger.from("Fred", "Bloggs")); + entityManager.persist(Passenger.from("Ricki", "Bobbie")); + entityManager.persist(Passenger.from("Siya", "Kolisi")); + } + + @Test + public void givenPassengers_whenMatchingIgnoreCase_thenExpectedReturned() { + Passenger jill = Passenger.from("Jill", "Smith"); + Passenger eve = Passenger.from("Eve", "Jackson"); + Passenger fred = Passenger.from("Fred", "Bloggs"); + Passenger siya = Passenger.from("Siya", "Kolisi"); + Passenger ricki = Passenger.from("Ricki", "Bobbie"); + + List passengers = repository.findByFirstNameIgnoreCase("FRED"); + + assertThat(passengers, contains(fred)); + assertThat(passengers, not(contains(eve))); + assertThat(passengers, not(contains(siya))); + assertThat(passengers, not(contains(jill))); + assertThat(passengers, not(contains(ricki))); + + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/SongRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/SongRepositoryIntegrationTest.java new file mode 100644 index 0000000000..19362acd44 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/java/com/baeldung/repository/SongRepositoryIntegrationTest.java @@ -0,0 +1,59 @@ +package com.baeldung.repository; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.jdbc.Sql; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import com.baeldung.entity.Song; +import com.baeldung.repository.SongRepository; + +@RunWith(SpringRunner.class) +@SpringBootTest +@Sql(scripts = { "/test-song-data.sql" }) +public class SongRepositoryIntegrationTest { + + @Autowired private SongRepository songRepository; + + @Transactional + @Test + public void givenSong_WhenFindLikeByName_ThenShouldReturnOne() { + List songs = songRepository.findByNameLike("Despacito"); + assertEquals(1, songs.size()); + } + + @Transactional + @Test + public void givenSong_WhenFindByNameNotLike_thenShouldReturn3Songs() { + List songs = songRepository.findByNameNotLike("Despacito"); + assertEquals(5, songs.size()); + } + + @Transactional + @Test + public void givenSong_WhenFindByNameStartingWith_thenShouldReturn2Songs() { + List songs = songRepository.findByNameStartingWith("Co"); + assertEquals(2, songs.size()); + } + + @Transactional + @Test + public void givenSong_WhenFindByNameEndingWith_thenShouldReturn2Songs() { + List songs = songRepository.findByNameEndingWith("Life"); + assertEquals(2, songs.size()); + } + + @Transactional + @Test + public void givenSong_WhenFindBySingerContaining_thenShouldReturn2Songs() { + List songs = songRepository.findBySingerContaining("Luis"); + assertEquals(2, songs.size()); + } +} diff --git a/persistence-modules/spring-data-jpa-repo/src/test/resources/application-test.properties b/persistence-modules/spring-data-jpa-repo/src/test/resources/application-test.properties new file mode 100644 index 0000000000..f9497c8f37 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/resources/application-test.properties @@ -0,0 +1,2 @@ +spring.jpa.hibernate.ddl-auto=update +spring.datasource.url=jdbc:h2:mem:jpa3 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/src/test/resources/test-movie-cleanup.sql b/persistence-modules/spring-data-jpa-repo/src/test/resources/test-movie-cleanup.sql new file mode 100644 index 0000000000..90aa15307c --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/resources/test-movie-cleanup.sql @@ -0,0 +1 @@ +DELETE FROM Movie; \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/src/test/resources/test-movie-data.sql b/persistence-modules/spring-data-jpa-repo/src/test/resources/test-movie-data.sql new file mode 100644 index 0000000000..37f8e4fe64 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/resources/test-movie-data.sql @@ -0,0 +1,7 @@ +INSERT INTO movie(id, title, director, rating, duration) VALUES(1, 'Godzilla: King of the Monsters', ' Michael Dougherty', 'PG-13', 132); +INSERT INTO movie(id, title, director, rating, duration) VALUES(2, 'Avengers: Endgame', 'Anthony Russo', 'PG-13', 181); +INSERT INTO movie(id, title, director, rating, duration) VALUES(3, 'Captain Marvel', 'Anna Boden', 'PG-13', 123); +INSERT INTO movie(id, title, director, rating, duration) VALUES(4, 'Dumbo', 'Tim Burton', 'PG', 112); +INSERT INTO movie(id, title, director, rating, duration) VALUES(5, 'Booksmart', 'Olivia Wilde', 'R', 102); +INSERT INTO movie(id, title, director, rating, duration) VALUES(6, 'Aladdin', 'Guy Ritchie', 'PG', 128); +INSERT INTO movie(id, title, director, rating, duration) VALUES(7, 'The Sun Is Also a Star', 'Ry Russo-Young', 'PG-13', 100); diff --git a/persistence-modules/spring-data-jpa-repo/src/test/resources/test-song-data.sql b/persistence-modules/spring-data-jpa-repo/src/test/resources/test-song-data.sql new file mode 100644 index 0000000000..5a2b1a5555 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo/src/test/resources/test-song-data.sql @@ -0,0 +1,8 @@ +INSERT INTO song(id,name,length_in_seconds,compositor,singer,released,genre) +VALUES +(1,'Despacito',209,'Luis Fonsi','Luis Fonsi, Daddy Yankee','2017-01-12','Reggaeton'), +(2,'Con calma',188,'Daddy Yankee','Daddy Yankee','2019-01-24','Reggaeton'), +(3,'It''s My Life',205,'Bon Jovi','Jon Bon Jovi','2000-05-23','Pop'), +(4,'Live is Life',242,'Opus','Opus','1985-01-01','Reggae'), +(5,'Countdown to Extinction',249,'Megadeth','Megadeth','1992-07-14','Heavy Metal'), +(6, 'Si nos dejan',139,'Luis Miguel','Luis Miguel','1995-10-17','Bolero'); \ No newline at end of file From 3bebbd4c0295740c95e6e75e17023154001bd2af Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 19 Jul 2020 14:32:35 +0530 Subject: [PATCH 0154/1862] JAVA-66: removed old modules spring-data-jpa-* --- .../spring-data-jpa-2/README.md | 12 - persistence-modules/spring-data-jpa-2/pom.xml | 48 -- .../main/java/com/baeldung/Application.java | 13 - .../baeldung/aggregation/model/Comment.java | 85 --- .../com/baeldung/aggregation/model/Post.java | 75 --- .../model/custom/CommentCount.java | 27 - .../model/custom/ICommentCount.java | 8 - .../repository/CommentRepository.java | 27 - .../com/baeldung/config/JpaPopulators.java | 35 -- .../baeldung/datajpadelete/entity/Book.java | 51 -- .../datajpadelete/entity/Category.java | 60 -- .../repository/BookRepository.java | 19 - .../repository/CategoryRepository.java | 9 - .../baeldung/embeddable/model/Company.java | 71 --- .../embeddable/model/ContactPerson.java | 38 -- .../repositories/CompanyRepository.java | 18 - .../java/com/baeldung/entity/Customer.java | 37 -- .../main/java/com/baeldung/entity/Fruit.java | 40 -- .../java/com/baeldung/entity/Passenger.java | 78 --- .../main/java/com/baeldung/entity/Song.java | 75 --- .../entitygraph/model/Characteristic.java | 43 -- .../com/baeldung/entitygraph/model/Item.java | 48 -- .../repository/CharacteristicsRepository.java | 13 - .../repository/ItemRepository.java | 13 - .../main/java/com/baeldung/exists/Car.java | 48 -- .../com/baeldung/exists/CarRepository.java | 24 - .../com/baeldung/joins/model/Department.java | 45 -- .../com/baeldung/joins/model/Employee.java | 69 --- .../java/com/baeldung/joins/model/Phone.java | 44 -- .../baeldung/projection/model/Address.java | 57 -- .../com/baeldung/projection/model/Person.java | 47 -- .../repository/AddressRepository.java | 11 - .../repository/PersonRepository.java | 14 - .../baeldung/projection/view/AddressView.java | 7 - .../baeldung/projection/view/PersonDto.java | 34 -- .../baeldung/projection/view/PersonView.java | 12 - .../repository/CustomerRepository.java | 19 - .../baeldung/repository/FruitRepository.java | 27 - .../repository/PassengerRepository.java | 14 - .../baeldung/repository/SongRepository.java | 21 - .../src/main/resources/apple-fruit-data.xml | 7 - .../resources/application-joins.properties | 1 - .../src/main/resources/application.properties | 1 - .../src/main/resources/db/import_joins.sql | 13 - .../src/main/resources/fruit-data.json | 14 - .../src/main/resources/guava-fruit-data.xml | 7 - .../SpringDataAggregateIntegrationTest.java | 107 ---- .../DeleteFromRepositoryUnitTest.java | 72 --- .../DeleteInRelationshipsUnitTest.java | 60 -- .../embeddable/EmbeddableIntegrationTest.java | 125 ---- .../EntityGraphIntegrationTest.java | 39 -- .../exists/CarRepositoryIntegrationTest.java | 87 --- .../joins/JpaJoinsIntegrationTest.java | 142 ----- .../JpaProjectionIntegrationTest.java | 63 -- .../CustomerRepositoryIntegrationTest.java | 64 -- .../FruitPopulatorIntegrationTest.java | 38 -- .../FruitRepositoryIntegrationTest.java | 75 --- .../PassengerRepositoryIntegrationTest.java | 54 -- .../SongRepositoryIntegrationTest.java | 58 -- .../src/test/resources/entitygraph-data.sql | 7 - .../resources/projection-clean-up-data.sql | 2 - .../test/resources/projection-insert-data.sql | 2 - .../test/resources/test-aggregation-data.sql | 7 - .../src/test/resources/test-fruit-data.sql | 6 - .../src/test/resources/test-song-data.sql | 8 - .../spring-data-jpa-3/README.md | 20 - persistence-modules/spring-data-jpa-3/pom.xml | 71 --- .../main/java/com/baeldung/Application.java | 14 - .../DatasourceProxyBeanPostProcessor.java | 53 -- .../baeldung/batchinserts/model/School.java | 45 -- .../baeldung/batchinserts/model/Student.java | 44 -- .../java/com/baeldung/boot/Application.java | 17 - .../boot/daos/CustomerRepository.java | 19 - .../daos/impl/PersonInsertRepository.java | 31 - .../boot/daos/user/UserRepository.java | 99 ---- .../boot/daos/user/UserRepositoryCustom.java | 14 - .../daos/user/UserRepositoryCustomImpl.java | 57 -- .../com/baeldung/boot/domain/Customer.java | 56 -- .../java/com/baeldung/boot/domain/Person.java | 47 -- .../com/baeldung/boot/domain/Possession.java | 83 --- .../java/com/baeldung/boot/domain/User.java | 132 ----- .../passenger/CustomPassengerRepository.java | 8 - .../baeldung/boot/passenger/Passenger.java | 82 --- .../boot/passenger/PassengerRepository.java | 22 - .../passenger/PassengerRepositoryImpl.java | 20 - .../web/controllers/CustomerController.java | 41 -- .../java/com/baeldung/entity/Employee.java | 36 -- .../java/com/baeldung/model/BasicUser.java | 42 -- .../multipledb/MultipleDbApplication.java | 14 - .../PersistenceProductConfiguration.java | 68 --- .../dao/product/ProductRepository.java | 13 - .../multipledb/model/product/Product.java | 67 --- .../repository/EmployeeRepository.java | 9 - .../baeldung/repository/UserRepository.java | 14 - .../src/main/resources/application.properties | 6 - .../src/main/resources/logback.xml | 13 - .../persistence-multiple-db.properties | 13 - .../java/com/baeldung/SpringContextTest.java | 17 - .../SpringJpaContextIntegrationTest.java | 19 - .../BatchInsertIntegrationTest.java | 40 -- .../JpaBatchInsertsIntegrationTest.java | 98 ---- .../JpaNoBatchInsertsIntegrationTest.java | 41 -- .../batchinserts/TestObjectHelper.java | 20 - ...PersonInsertRepositoryIntegrationTest.java | 82 --- .../boot/daos/UserRepositoryCommon.java | 545 ------------------ .../daos/UserRepositoryTCAutoLiveTest.java | 43 -- .../boot/daos/UserRepositoryTCLiveTest.java | 58 -- .../PassengerRepositoryIntegrationTest.java | 190 ------ .../ProductRepositoryIntegrationTest.java | 142 ----- .../EmployeeRepositoryIntegrationTest.java | 40 -- .../util/BaeldungPostgresqlContainer.java | 35 -- .../application-batchinserts.properties | 6 - .../resources/application-tc-auto.properties | 4 - .../test/resources/application-tc.properties | 4 - .../resources/application-test.properties | 2 - .../spring-data-jpa-4/README.md | 18 - .../spring-data-jpa-4/create.sql | 2 - persistence-modules/spring-data-jpa-4/pom.xml | 47 -- .../derivedquery/QueryApplication.java | 13 - .../baeldung/derivedquery/entity/User.java | 70 --- .../repository/UserRepository.java | 60 -- .../ElementCollectionApplication.java | 11 - .../elementcollection/model/Employee.java | 68 --- .../elementcollection/model/Phone.java | 62 -- .../repository/EmployeeRepository.java | 46 -- .../SpringBootLifecycleEventApplication.java | 11 - .../model/AuditTrailListener.java | 39 -- .../baeldung/lifecycleevents/model/User.java | 104 ---- .../repository/UserRepository.java | 9 - .../com/baeldung/like/LikeApplication.java | 13 - .../java/com/baeldung/like/model/Movie.java | 58 -- .../like/repository/MovieRepository.java | 41 -- .../com/baeldung/namingstrategy/Person.java | 35 -- .../namingstrategy/PersonRepository.java | 6 - .../QuotedLowerCaseNamingStrategy.java | 12 - .../QuotedUpperCaseNamingStrategy.java | 12 - ...ingDataJpaNamingConventionApplication.java | 7 - .../UnquotedLowerCaseNamingStrategy.java | 12 - .../UnquotedUpperCaseNamingStrategy.java | 12 - .../com/baeldung/osiv/OsivApplication.java | 13 - .../com/baeldung/osiv/model/BasicUser.java | 42 -- .../osiv/repository/BasicUserRepository.java | 19 - .../osiv/service/SimpleUserService.java | 25 - .../baeldung/osiv/service/UserService.java | 9 - .../baeldung/osiv/web/DetailedUserDto.java | 45 -- .../com/baeldung/osiv/web/UserController.java | 27 - .../StoredProcedureApplication.java | 13 - .../controller/CarController.java | 47 -- .../baeldung/storedprocedure/entity/Car.java | 41 -- .../repository/CarRepository.java | 34 -- .../storedprocedure/service/CarService.java | 39 -- .../java/com/baeldung/tx/TxApplication.java | 13 - .../java/com/baeldung/tx/model/Payment.java | 55 -- .../src/main/resources/application.properties | 5 - .../src/main/resources/car-mysql.sql | 27 - .../UserRepositoryIntegrationTest.java | 172 ------ .../ElementCollectionIntegrationTest.java | 64 -- .../like/MovieRepositoryIntegrationTest.java | 87 --- ...erCaseNamingStrategyH2IntegrationTest.java | 81 --- ...werCaseNamingStrategyPostgresLiveTest.java | 85 --- ...erCaseNamingStrategyH2IntegrationTest.java | 85 --- ...perCaseNamingStrategyPostgresLiveTest.java | 81 --- ...ysicalNamingStrategyH2IntegrationTest.java | 85 --- ...hysicalNamingStrategyPostgresLiveTest.java | 85 --- ...erCaseNamingStrategyH2IntegrationTest.java | 86 --- ...werCaseNamingStrategyPostgresLiveTest.java | 85 --- ...erCaseNamingStrategyH2IntegrationTest.java | 85 --- ...perCaseNamingStrategyPostgresLiveTest.java | 85 --- .../osiv/UserControllerIntegrationTest.java | 56 -- .../tx/ManualTransactionIntegrationTest.java | 152 ----- .../UserRepositoryIntegrationTest.java | 80 --- .../resources/application-test.properties | 2 - ...ase-naming-strategy-on-postgres.properties | 9 - ...oted-lower-case-naming-strategy.properties | 9 - ...ase-naming-strategy-on-postgres.properties | 9 - ...oted-upper-case-naming-strategy.properties | 9 - ...cal-naming-strategy-on-postgres.properties | 9 - ...spring-physical-naming-strategy.properties | 9 - ...ase-naming-strategy-on-postgres.properties | 9 - ...oted-lower-case-naming-strategy.properties | 9 - ...ase-naming-strategy-on-postgres.properties | 9 - ...oted-upper-case-naming-strategy.properties | 9 - .../src/test/resources/test-movie-cleanup.sql | 1 - .../src/test/resources/test-movie-data.sql | 7 - .../spring-data-jpa-5/README.md | 15 - persistence-modules/spring-data-jpa-5/pom.xml | 80 --- .../baeldung/composite/BookApplication.java | 12 - .../com/baeldung/composite/entity/Book.java | 47 -- .../com/baeldung/composite/entity/BookId.java | 51 -- .../composite/repository/BookRepository.java | 18 - .../PartialUpdateApplication.java | 12 - .../partialupdate/model/ContactPhone.java | 22 - .../partialupdate/model/Customer.java | 23 - .../partialupdate/model/CustomerDto.java | 31 - .../model/CustomerStructured.java | 27 - .../repository/ContactPhoneRepository.java | 12 - .../repository/CustomerRepository.java | 18 - .../CustomerStructuredRepository.java | 11 - .../service/CustomerService.java | 87 --- .../partialupdate/util/CustomerMapper.java | 15 - .../schemageneration/AccountApplication.java | 12 - .../schemageneration/HibernateUtil.java | 39 -- .../schemageneration/model/Account.java | 74 --- .../model/AccountSetting.java | 68 --- .../repository/AccountRepository.java | 8 - .../repository/AccountSettingRepository.java | 8 - .../src/main/resources/application.properties | 13 - .../BookRepositoryIntegrationTest.java | 64 -- .../partialupdate/PartialUpdateUnitTest.java | 63 -- .../AccountRepositoryIntegrationTest.java | 72 --- .../resources/application-test.properties | 3 - persistence-modules/spring-data-jpa/README.md | 25 - persistence-modules/spring-data-jpa/pom.xml | 77 --- .../java/com/baeldung/boot/Application.java | 17 - .../boot/config/PersistenceConfiguration.java | 23 - .../baeldung/boot/daos/ArticleRepository.java | 23 - .../boot/daos/CustomItemRepository.java | 16 - .../boot/daos/CustomItemTypeRepository.java | 13 - .../boot/daos/ExtendedRepository.java | 14 - .../boot/daos/ExtendedStudentRepository.java | 6 - .../boot/daos/IBarCrudRepository.java | 11 - .../java/com/baeldung/boot/daos/IFooDao.java | 13 - .../boot/daos/InventoryRepository.java | 8 - .../boot/daos/ItemTypeRepository.java | 10 - .../boot/daos/LocationRepository.java | 10 - .../boot/daos/ReadOnlyLocationRepository.java | 15 - .../baeldung/boot/daos/StoreRepository.java | 13 - .../daos/impl/CustomItemRepositoryImpl.java | 33 -- .../impl/CustomItemTypeRepositoryImpl.java | 27 - .../daos/impl/ExtendedRepositoryImpl.java | 37 -- .../boot/daos/user/PossessionRepository.java | 9 - .../boot/daos/user/UserRepository.java | 99 ---- .../boot/daos/user/UserRepositoryCustom.java | 14 - .../daos/user/UserRepositoryCustomImpl.java | 57 -- .../baeldung/boot/ddd/event/Aggregate.java | 46 -- .../baeldung/boot/ddd/event/Aggregate2.java | 44 -- .../boot/ddd/event/Aggregate2Repository.java | 10 - .../baeldung/boot/ddd/event/Aggregate3.java | 23 - .../boot/ddd/event/Aggregate3Repository.java | 14 - .../boot/ddd/event/AggregateRepository.java | 10 - .../baeldung/boot/ddd/event/DddConfig.java | 15 - .../baeldung/boot/ddd/event/DomainEvent.java | 8 - .../boot/ddd/event/DomainService.java | 31 - .../com/baeldung/boot/domain/Article.java | 23 - .../java/com/baeldung/boot/domain/Bar.java | 220 ------- .../java/com/baeldung/boot/domain/Foo.java | 94 --- .../java/com/baeldung/boot/domain/Item.java | 81 --- .../com/baeldung/boot/domain/ItemType.java | 46 -- .../java/com/baeldung/boot/domain/KVTag.java | 34 -- .../com/baeldung/boot/domain/Location.java | 55 -- .../boot/domain/MerchandiseEntity.java | 66 --- .../com/baeldung/boot/domain/Possession.java | 83 --- .../com/baeldung/boot/domain/SkillTag.java | 30 - .../java/com/baeldung/boot/domain/Store.java | 76 --- .../com/baeldung/boot/domain/Student.java | 74 --- .../java/com/baeldung/boot/domain/User.java | 132 ----- .../baeldung/boot/services/IBarService.java | 7 - .../baeldung/boot/services/IFooService.java | 14 - .../baeldung/boot/services/IOperations.java | 26 - .../boot/services/impl/AbstractService.java | 61 -- .../impl/AbstractSpringDataJpaService.java | 45 -- .../impl/BarSpringDataJpaService.java | 31 - .../boot/services/impl/FooService.java | 55 -- .../multipledb/MultipleDbApplication.java | 14 - .../PersistenceProductAutoConfiguration.java | 71 --- .../PersistenceProductConfiguration.java | 68 --- .../PersistenceUserAutoConfiguration.java | 75 --- .../PersistenceUserConfiguration.java | 69 --- .../dao/product/ProductRepository.java | 14 - .../dao/user/PossessionRepository.java | 9 - .../multipledb/dao/user/UserRepository.java | 8 - .../multipledb/model/product/Product.java | 67 --- .../model/user/PossessionMultipleDB.java | 82 --- .../multipledb/model/user/UserMultipleDB.java | 88 --- .../src/main/resources/application.properties | 6 - .../src/main/resources/ddd.properties | 1 - .../src/main/resources/import_entities.sql | 21 - .../src/main/resources/logback.xml | 13 - .../persistence-multiple-db-boot.properties | 11 - .../persistence-multiple-db.properties | 13 - .../src/main/resources/persistence.properties | 14 - .../java/com/baeldung/SpringContextTest.java | 17 - .../SpringJpaContextIntegrationTest.java | 25 - .../ArticleRepositoryIntegrationTest.java | 67 --- ...endedStudentRepositoryIntegrationTest.java | 41 -- .../InventoryRepositoryIntegrationTest.java | 61 -- .../daos/JpaRepositoriesIntegrationTest.java | 93 --- .../boot/daos/UserRepositoryCommon.java | 545 ------------------ .../daos/UserRepositoryIntegrationTest.java | 37 -- .../daos/UserRepositoryTCAutoLiveTest.java | 43 -- .../boot/daos/UserRepositoryTCLiveTest.java | 58 -- .../Aggregate2EventsIntegrationTest.java | 72 --- .../Aggregate3EventsIntegrationTest.java | 67 --- .../event/AggregateEventsIntegrationTest.java | 87 --- .../boot/ddd/event/TestEventHandler.java | 14 - ...ractServicePersistenceIntegrationTest.java | 252 -------- .../FooServicePersistenceIntegrationTest.java | 75 --- .../SpringDataJPABarAuditIntegrationTest.java | 75 --- .../JpaMultipleDBIntegrationTest.java | 96 --- .../ProductRepositoryIntegrationTest.java | 144 ----- .../util/BaeldungPostgresqlContainer.java | 35 -- .../test/java/com/baeldung/util/IDUtil.java | 33 -- .../resources/application-tc-auto.properties | 4 - .../test/resources/application-tc.properties | 4 - 304 files changed, 13445 deletions(-) delete mode 100644 persistence-modules/spring-data-jpa-2/README.md delete mode 100644 persistence-modules/spring-data-jpa-2/pom.xml delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/Application.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/Comment.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/Post.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/custom/CommentCount.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/custom/ICommentCount.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/config/JpaPopulators.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/entity/Book.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/entity/Category.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/repository/BookRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/repository/CategoryRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/model/Company.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/model/ContactPerson.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Customer.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Fruit.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Passenger.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Song.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/model/Characteristic.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/model/Item.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/repository/CharacteristicsRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/repository/ItemRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/exists/Car.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/exists/CarRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Department.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Employee.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Phone.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/model/Address.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/model/Person.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/repository/AddressRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/repository/PersonRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/AddressView.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/PersonDto.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/PersonView.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/CustomerRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/FruitRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/PassengerRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/SongRepository.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/resources/apple-fruit-data.xml delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/resources/application-joins.properties delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/resources/application.properties delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/resources/db/import_joins.sql delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/resources/fruit-data.json delete mode 100644 persistence-modules/spring-data-jpa-2/src/main/resources/guava-fruit-data.xml delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/aggregation/SpringDataAggregateIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/datajpadelete/DeleteFromRepositoryUnitTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/datajpadelete/DeleteInRelationshipsUnitTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/embeddable/EmbeddableIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/entitygraph/EntityGraphIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/exists/CarRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/joins/JpaJoinsIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/projection/JpaProjectionIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/CustomerRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/FruitPopulatorIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/FruitRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/PassengerRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/SongRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/resources/entitygraph-data.sql delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/resources/projection-clean-up-data.sql delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/resources/projection-insert-data.sql delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/resources/test-aggregation-data.sql delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/resources/test-fruit-data.sql delete mode 100644 persistence-modules/spring-data-jpa-2/src/test/resources/test-song-data.sql delete mode 100644 persistence-modules/spring-data-jpa-3/README.md delete mode 100644 persistence-modules/spring-data-jpa-3/pom.xml delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/Application.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/DatasourceProxyBeanPostProcessor.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/model/School.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/model/Student.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/Application.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/CustomerRepository.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/impl/PersonInsertRepository.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepository.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Customer.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Person.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Possession.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/User.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/CustomPassengerRepository.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/Passenger.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/PassengerRepositoryImpl.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/entity/Employee.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/model/BasicUser.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/model/product/Product.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/EmployeeRepository.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/UserRepository.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/resources/application.properties delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/resources/logback.xml delete mode 100644 persistence-modules/spring-data-jpa-3/src/main/resources/persistence-multiple-db.properties delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringContextTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/BatchInsertIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/JpaBatchInsertsIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/JpaNoBatchInsertsIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/TestObjectHelper.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/PersonInsertRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/passenger/PassengerRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/repository/EmployeeRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/resources/application-batchinserts.properties delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/resources/application-tc-auto.properties delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/resources/application-tc.properties delete mode 100644 persistence-modules/spring-data-jpa-3/src/test/resources/application-test.properties delete mode 100644 persistence-modules/spring-data-jpa-4/README.md delete mode 100644 persistence-modules/spring-data-jpa-4/create.sql delete mode 100644 persistence-modules/spring-data-jpa-4/pom.xml delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/QueryApplication.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/entity/User.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/repository/UserRepository.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/ElementCollectionApplication.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/model/Employee.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/model/Phone.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/repository/EmployeeRepository.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/SpringBootLifecycleEventApplication.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/model/AuditTrailListener.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/model/User.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/repository/UserRepository.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/LikeApplication.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/model/Movie.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/repository/MovieRepository.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/Person.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/PersonRepository.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategy.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategy.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/SpringDataJpaNamingConventionApplication.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategy.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategy.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/OsivApplication.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/model/BasicUser.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/SimpleUserService.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/UserService.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/UserController.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/controller/CarController.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/entity/Car.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/service/CarService.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/TxApplication.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/model/Payment.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/resources/application.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/main/resources/car-mysql.sql delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/elementcollection/ElementCollectionIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyH2IntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyPostgresLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyH2IntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyPostgresLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyH2IntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyPostgresLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyH2IntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyPostgresLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyH2IntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyPostgresLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/java/lifecycleevents/UserRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/application-test.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy-on-postgres.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy-on-postgres.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy-on-postgres.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy-on-postgres.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy-on-postgres.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy.properties delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/test-movie-cleanup.sql delete mode 100644 persistence-modules/spring-data-jpa-4/src/test/resources/test-movie-data.sql delete mode 100644 persistence-modules/spring-data-jpa-5/README.md delete mode 100644 persistence-modules/spring-data-jpa-5/pom.xml delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/BookApplication.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/entity/Book.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/entity/BookId.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/repository/BookRepository.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/PartialUpdateApplication.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/ContactPhone.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/Customer.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/CustomerDto.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/CustomerStructured.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/ContactPhoneRepository.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/CustomerRepository.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/CustomerStructuredRepository.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/service/CustomerService.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/util/CustomerMapper.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/AccountApplication.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/HibernateUtil.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/model/Account.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/model/AccountSetting.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/repository/AccountRepository.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/repository/AccountSettingRepository.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/main/resources/application.properties delete mode 100644 persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/composite/repository/BookRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/partialupdate/PartialUpdateUnitTest.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/schemageneration/AccountRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa-5/src/test/resources/application-test.properties delete mode 100644 persistence-modules/spring-data-jpa/README.md delete mode 100644 persistence-modules/spring-data-jpa/pom.xml delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/Application.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/config/PersistenceConfiguration.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ArticleRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/CustomItemRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/CustomItemTypeRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ExtendedRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ExtendedStudentRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/IBarCrudRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/IFooDao.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/InventoryRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ItemTypeRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/LocationRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ReadOnlyLocationRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/StoreRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/CustomItemRepositoryImpl.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/CustomItemTypeRepositoryImpl.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/ExtendedRepositoryImpl.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/PossessionRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate2.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate2Repository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate3.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate3Repository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/AggregateRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DddConfig.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DomainEvent.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DomainService.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Article.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Bar.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Foo.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Item.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/ItemType.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/KVTag.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Location.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/MerchandiseEntity.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Possession.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/SkillTag.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Store.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Student.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/User.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IBarService.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IFooService.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IOperations.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/AbstractService.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/AbstractSpringDataJpaService.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/BarSpringDataJpaService.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/FooService.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceProductAutoConfiguration.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceUserAutoConfiguration.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceUserConfiguration.java delete mode 100755 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java delete mode 100755 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/Product.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java delete mode 100644 persistence-modules/spring-data-jpa/src/main/resources/application.properties delete mode 100644 persistence-modules/spring-data-jpa/src/main/resources/ddd.properties delete mode 100644 persistence-modules/spring-data-jpa/src/main/resources/import_entities.sql delete mode 100644 persistence-modules/spring-data-jpa/src/main/resources/logback.xml delete mode 100644 persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db-boot.properties delete mode 100644 persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties delete mode 100644 persistence-modules/spring-data-jpa/src/main/resources/persistence.properties delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/SpringContextTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/ExtendedStudentRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/InventoryRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/JpaRepositoriesIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/Aggregate2EventsIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/Aggregate3EventsIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/AggregateEventsIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/TestEventHandler.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/AbstractServicePersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/FooServicePersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/SpringDataJPABarAuditIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java delete mode 100644 persistence-modules/spring-data-jpa/src/test/resources/application-tc-auto.properties delete mode 100644 persistence-modules/spring-data-jpa/src/test/resources/application-tc.properties diff --git a/persistence-modules/spring-data-jpa-2/README.md b/persistence-modules/spring-data-jpa-2/README.md deleted file mode 100644 index e59aca7c69..0000000000 --- a/persistence-modules/spring-data-jpa-2/README.md +++ /dev/null @@ -1,12 +0,0 @@ -### Relevant Articles: -- [Spring Data JPA – Derived Delete Methods](https://www.baeldung.com/spring-data-jpa-deleteby) -- [JPA Join Types](https://www.baeldung.com/jpa-join-types) -- [Case Insensitive Queries with Spring Data Repository](https://www.baeldung.com/spring-data-case-insensitive-queries) -- [The Exists Query in Spring Data](https://www.baeldung.com/spring-data-exists-query) -- [Spring Data JPA Repository Populators](https://www.baeldung.com/spring-data-jpa-repository-populators) -- [Spring Data JPA and Null Parameters](https://www.baeldung.com/spring-data-jpa-null-parameters) -- [Spring Data JPA Projections](https://www.baeldung.com/spring-data-jpa-projections) -- [JPA @Embedded And @Embeddable](https://www.baeldung.com/jpa-embedded-embeddable) -- [Spring Data JPA Delete and Relationships](https://www.baeldung.com/spring-data-jpa-delete) -- [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs) -- [Customizing the Result of JPA Queries with Aggregation Functions](https://www.baeldung.com/jpa-queries-custom-result-with-aggregation-functions) diff --git a/persistence-modules/spring-data-jpa-2/pom.xml b/persistence-modules/spring-data-jpa-2/pom.xml deleted file mode 100644 index 838327de89..0000000000 --- a/persistence-modules/spring-data-jpa-2/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - 4.0.0 - spring-data-jpa-2 - spring-data-jpa-2 - - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - com.h2database - h2 - - - - net.ttddyy - datasource-proxy - ${datasource-proxy.version} - - - - com.fasterxml.jackson.core - jackson-databind - - - - org.springframework - spring-oxm - - - - - 1.4.1 - - - \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/Application.java deleted file mode 100644 index 3ea3d113da..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/Application.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/Comment.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/Comment.java deleted file mode 100644 index 26c2373cbe..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/Comment.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.aggregation.model; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import java.util.Objects; - -@Entity -public class Comment { - @Id - private Integer id; - private Integer year; - private boolean approved; - private String content; - @ManyToOne - private Post post; - - public Comment() { - } - - public Comment(int id, int year, boolean approved, String content, Post post) { - this.id = id; - this.year = year; - this.approved = approved; - this.content = content; - this.post = post; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getYear() { - return year; - } - - public void setYear(Integer year) { - this.year = year; - } - - public boolean isApproved() { - return approved; - } - - public void setApproved(boolean approved) { - this.approved = approved; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Post getPost() { - return post; - } - - public void setPost(Post post) { - this.post = post; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Comment)) { - return false; - } - Comment comment = (Comment) o; - return getId().equals(comment.getId()); - } - - @Override - public int hashCode() { - return Objects.hash(getId()); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/Post.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/Post.java deleted file mode 100644 index f396e080ae..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/Post.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baeldung.aggregation.model; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import java.util.List; -import java.util.Objects; - -@Entity -public class Post { - @Id - private Integer id; - private String title; - private String content; - @OneToMany(mappedBy = "post") - private List comments; - - public Post() { - } - - public Post(Integer id, String title, String content) { - this.id = id; - this.title = title; - this.content = content; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public List getComments() { - return comments; - } - - public void setComments(List comments) { - this.comments = comments; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Post)) { - return false; - } - Post post = (Post) o; - return getId().equals(post.getId()); - } - - @Override - public int hashCode() { - return Objects.hash(getId()); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/custom/CommentCount.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/custom/CommentCount.java deleted file mode 100644 index 510b52a47c..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/custom/CommentCount.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.aggregation.model.custom; - -public class CommentCount { - private Integer year; - private Long total; - - public CommentCount(Integer year, Long total) { - this.year = year; - this.total = total; - } - - public Integer getYear() { - return year; - } - - public void setYear(Integer year) { - this.year = year; - } - - public Long getTotal() { - return total; - } - - public void setTotal(Long total) { - this.total = total; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/custom/ICommentCount.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/custom/ICommentCount.java deleted file mode 100644 index acb25cfd49..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/model/custom/ICommentCount.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.aggregation.model.custom; - -public interface ICommentCount { - - Integer getYearComment(); - - Long getTotalComment(); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java deleted file mode 100644 index 89e9345e94..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/aggregation/repository/CommentRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.aggregation.repository; - -import com.baeldung.aggregation.model.Comment; -import com.baeldung.aggregation.model.custom.CommentCount; -import com.baeldung.aggregation.model.custom.ICommentCount; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface CommentRepository extends JpaRepository { - - @Query("SELECT c.year, COUNT(c.year) FROM Comment AS c GROUP BY c.year ORDER BY c.year DESC") - List countTotalCommentsByYear(); - - @Query("SELECT new com.baeldung.aggregation.model.custom.CommentCount(c.year, COUNT(c.year)) FROM Comment AS c GROUP BY c.year ORDER BY c.year DESC") - List countTotalCommentsByYearClass(); - - @Query("SELECT c.year AS yearComment, COUNT(c.year) AS totalComment FROM Comment AS c GROUP BY c.year ORDER BY c.year DESC") - List countTotalCommentsByYearInterface(); - - @Query(value = "SELECT c.year AS yearComment, COUNT(c.*) AS totalComment FROM comment AS c GROUP BY c.year ORDER BY c.year DESC", nativeQuery = true) - List countTotalCommentsByYearNative(); - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/config/JpaPopulators.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/config/JpaPopulators.java deleted file mode 100644 index 24348d31c5..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/config/JpaPopulators.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.data.repository.init.Jackson2RepositoryPopulatorFactoryBean; -import org.springframework.data.repository.init.UnmarshallerRepositoryPopulatorFactoryBean; -import org.springframework.oxm.jaxb.Jaxb2Marshaller; - -import com.baeldung.entity.Fruit; - -@Configuration -public class JpaPopulators { - - @Bean - public Jackson2RepositoryPopulatorFactoryBean getRespositoryPopulator() throws Exception { - Jackson2RepositoryPopulatorFactoryBean factory = new Jackson2RepositoryPopulatorFactoryBean(); - factory.setResources(new Resource[] { new ClassPathResource("fruit-data.json") }); - return factory; - } - - @Bean - public UnmarshallerRepositoryPopulatorFactoryBean repositoryPopulator() { - - Jaxb2Marshaller unmarshaller = new Jaxb2Marshaller(); - unmarshaller.setClassesToBeBound(Fruit.class); - - UnmarshallerRepositoryPopulatorFactoryBean factory = new UnmarshallerRepositoryPopulatorFactoryBean(); - factory.setUnmarshaller(unmarshaller); - factory.setResources(new Resource[] { new ClassPathResource("apple-fruit-data.xml"), new ClassPathResource("guava-fruit-data.xml") }); - return factory; - } - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/entity/Book.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/entity/Book.java deleted file mode 100644 index deac24548a..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/entity/Book.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baeldung.datajpadelete.entity; - -import javax.persistence.*; - -@Entity -public class Book { - - @Id - @GeneratedValue - private Long id; - private String title; - - @ManyToOne - private Category category; - - public Book() { - } - - public Book(String title) { - this.title = title; - } - - public Book(String title, Category category) { - this.title = title; - this.category = category; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public Category getCategory() { - return category; - } - - public void setCategory(Category category) { - this.category = category; - } -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/entity/Category.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/entity/Category.java deleted file mode 100644 index 16f1a4157f..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/entity/Category.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.baeldung.datajpadelete.entity; - -import javax.persistence.*; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -@Entity -public class Category { - - @Id - @GeneratedValue - private Long id; - private String name; - - @OneToMany(mappedBy = "category", cascade = CascadeType.ALL, orphanRemoval = true) - private List books; - - public Category() { - } - - public Category(String name) { - this.name = name; - } - - public Category(String name, Book... books) { - this.name = name; - this.books = Stream.of(books).collect(Collectors.toList()); - this.books.forEach(x -> x.setCategory(this)); - } - - public Category(String name, List books) { - this.name = name; - this.books = books; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getBooks() { - return books; - } - - public void setBooks(List books) { - this.books = books; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/repository/BookRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/repository/BookRepository.java deleted file mode 100644 index 5d0f45f127..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/repository/BookRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.datajpadelete.repository; - -import com.baeldung.datajpadelete.entity.Book; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; - -@Repository -public interface BookRepository extends CrudRepository { - - long deleteByTitle(String title); - - @Modifying - @Query("delete from Book b where b.title=:title") - void deleteBooks(@Param("title") String title); - -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/repository/CategoryRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/repository/CategoryRepository.java deleted file mode 100644 index 6fe7058a78..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/datajpadelete/repository/CategoryRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.datajpadelete.repository; - -import com.baeldung.datajpadelete.entity.Category; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface CategoryRepository extends CrudRepository { -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/model/Company.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/model/Company.java deleted file mode 100644 index 203cff1e35..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/model/Company.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.baeldung.embeddable.model; - -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; -import javax.persistence.Column; -import javax.persistence.Embedded; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -public class Company { - - @Id - @GeneratedValue - private Integer id; - - private String name; - - private String address; - - private String phone; - - @Embedded - @AttributeOverrides(value = { - @AttributeOverride( name = "firstName", column = @Column(name = "contact_first_name")), - @AttributeOverride( name = "lastName", column = @Column(name = "contact_last_name")), - @AttributeOverride( name = "phone", column = @Column(name = "contact_phone")) - }) - private ContactPerson contactPerson; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public ContactPerson getContactPerson() { - return contactPerson; - } - - public void setContactPerson(ContactPerson contactPerson) { - this.contactPerson = contactPerson; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/model/ContactPerson.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/model/ContactPerson.java deleted file mode 100644 index 561da80878..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/model/ContactPerson.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.embeddable.model; - -import javax.persistence.Embeddable; - -@Embeddable -public class ContactPerson { - - private String firstName; - - private String lastName; - - private String phone; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java deleted file mode 100644 index f456b15652..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/embeddable/repositories/CompanyRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.embeddable.repositories; - -import com.baeldung.embeddable.model.Company; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; - -import java.util.List; - -public interface CompanyRepository extends JpaRepository { - - List findByContactPersonFirstName(String firstName); - - @Query("SELECT C FROM Company C WHERE C.contactPerson.firstName = ?1") - List findByContactPersonFirstNameWithJPQL(String firstName); - - @Query(value = "SELECT * FROM company WHERE contact_first_name = ?1", nativeQuery = true) - List findByContactPersonFirstNameWithNativeQuery(String firstName); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Customer.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Customer.java deleted file mode 100644 index efcae73853..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Customer.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.entity; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -public class Customer { - - @Id - @GeneratedValue - private long id; - private String name; - private String email; - - public Customer(String name, String email) { - this.name = name; - this.email = email; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Fruit.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Fruit.java deleted file mode 100644 index d45ac33db8..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Fruit.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.entity; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@Entity -public class Fruit { - - @Id - private long id; - private String name; - private String color; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Passenger.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Passenger.java deleted file mode 100644 index 3aafbe9afa..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Passenger.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.baeldung.entity; - -import javax.persistence.Basic; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import java.util.Objects; - -@Entity -public class Passenger { - - @Id - @GeneratedValue - @Column(nullable = false) - private Long id; - - @Basic(optional = false) - @Column(nullable = false) - private String firstName; - - @Basic(optional = false) - @Column(nullable = false) - private String lastName; - - private Passenger(String firstName, String lastName) { - this.firstName = firstName; - this.lastName = lastName; - } - - public static Passenger from(String firstName, String lastName) { - return new Passenger(firstName, lastName); - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - @Override - public String toString() { - return "Passenger{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - Passenger passenger = (Passenger) o; - return Objects.equals(firstName, passenger.firstName) && Objects.equals(lastName, passenger.lastName); - } - - @Override - public int hashCode() { - return Objects.hash(firstName, lastName); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Song.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Song.java deleted file mode 100644 index 395527c1eb..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entity/Song.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baeldung.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import java.time.LocalDateTime; - -@Entity -public class Song { - - @Id private long id; - private String name; - @Column(name = "length_in_seconds") - private int lengthInSeconds; - private String compositor; - private String singer; - private LocalDateTime released; - private String genre; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getLengthInSeconds() { - return lengthInSeconds; - } - - public void setLengthInSeconds(int lengthInSeconds) { - this.lengthInSeconds = lengthInSeconds; - } - - public String getCompositor() { - return compositor; - } - - public void setCompositor(String compositor) { - this.compositor = compositor; - } - - public String getSinger() { - return singer; - } - - public void setSinger(String singer) { - this.singer = singer; - } - - public LocalDateTime getReleased() { - return released; - } - - public void setReleased(LocalDateTime released) { - this.released = released; - } - - public String getGenre() { - return genre; - } - - public void setGenre(String genre) { - this.genre = genre; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/model/Characteristic.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/model/Characteristic.java deleted file mode 100644 index ae20375572..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/model/Characteristic.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.baeldung.entitygraph.model; - -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; - -@Entity -public class Characteristic { - - @Id - private Long id; - private String type; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn - private Item item; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Item getItem() { - return item; - } - - public void setItem(Item item) { - this.item = item; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/model/Item.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/model/Item.java deleted file mode 100644 index e90a22ef62..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/model/Item.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.baeldung.entitygraph.model; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.NamedAttributeNode; -import javax.persistence.NamedEntityGraph; -import javax.persistence.OneToMany; - -@Entity -@NamedEntityGraph(name = "Item.characteristics", - attributeNodes = @NamedAttributeNode("characteristics") -) -public class Item { - - @Id - private Long id; - private String name; - - @OneToMany(mappedBy = "item") - private List characteristics = new ArrayList<>(); - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getCharacteristics() { - return characteristics; - } - - public void setCharacteristics(List characteristics) { - this.characteristics = characteristics; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/repository/CharacteristicsRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/repository/CharacteristicsRepository.java deleted file mode 100644 index 9f923ab241..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/repository/CharacteristicsRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.entitygraph.repository; - -import org.springframework.data.jpa.repository.EntityGraph; -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.entitygraph.model.Characteristic; - -public interface CharacteristicsRepository extends JpaRepository { - - @EntityGraph(attributePaths = {"item"}) - Characteristic findByType(String type); - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/repository/ItemRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/repository/ItemRepository.java deleted file mode 100644 index b2a5f223b3..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/entitygraph/repository/ItemRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.entitygraph.repository; - -import org.springframework.data.jpa.repository.EntityGraph; -import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType; -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.entitygraph.model.Item; - -public interface ItemRepository extends JpaRepository { - - @EntityGraph(value = "Item.characteristics", type = EntityGraphType.FETCH) - Item findByName(String name); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/exists/Car.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/exists/Car.java deleted file mode 100644 index bf09caf6ff..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/exists/Car.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.baeldung.exists; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -/** - * @author paullatzelsperger - * @since 2019-03-20 - */ -@Entity -public class Car { - - @Id - @GeneratedValue - private int id; - private Integer power; - private String model; - - Car() { - - } - - public Car(int power, String model) { - this.power = power; - this.model = model; - } - - public Integer getPower() { - return power; - } - - public void setPower(Integer power) { - this.power = power; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public int getId() { - return id; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/exists/CarRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/exists/CarRepository.java deleted file mode 100644 index a54f19f4cd..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/exists/CarRepository.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.exists; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; - -/** - * @author paullatzelsperger - * @since 2019-03-20 - */ -@Repository -public interface CarRepository extends JpaRepository { - - boolean existsCarByPower(int power); - - boolean existsCarByModel(String model); - - @Query("select case when count(c)> 0 then true else false end from Car c where c.model = :model") - boolean existsCarExactCustomQuery(@Param("model") String model); - - @Query("select case when count(c)> 0 then true else false end from Car c where lower(c.model) like lower(:model)") - boolean existsCarLikeCustomQuery(@Param("model") String model); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Department.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Department.java deleted file mode 100644 index 439f7532f5..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Department.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baeldung.joins.model; - -import java.util.List; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; - -@Entity -public class Department { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - - private String name; - - @OneToMany(mappedBy = "department") - private List employees; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getEmployees() { - return employees; - } - - public void setEmployees(List employees) { - this.employees = employees; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Employee.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Employee.java deleted file mode 100644 index 277274e61c..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Employee.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.baeldung.joins.model; - -import java.util.List; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -@Entity -@Table(name = "joins_employee") -public class Employee { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private long id; - - private String name; - - private int age; - - @ManyToOne - private Department department; - - @OneToMany(mappedBy = "employee") - private List phones; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public Department getDepartment() { - return department; - } - - public void setDepartment(Department department) { - this.department = department; - } - - public List getPhones() { - return phones; - } - - public void setPhones(List phones) { - this.phones = phones; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Phone.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Phone.java deleted file mode 100644 index 41382915b1..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/joins/model/Phone.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.joins.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; - -@Entity -public class Phone { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private long id; - - private String number; - - @ManyToOne - private Employee employee; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getNumber() { - return number; - } - - public void setNumber(String number) { - this.number = number; - } - - public Employee getEmployee() { - return employee; - } - - public void setEmployee(Employee employee) { - this.employee = employee; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/model/Address.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/model/Address.java deleted file mode 100644 index 0c5a3eac60..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/model/Address.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.baeldung.projection.model; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.OneToOne; - -@Entity -public class Address { - @Id - private Long id; - @OneToOne - private Person person; - private String state; - private String city; - private String street; - private String zipCode; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getStreet() { - return street; - } - - public void setStreet(String street) { - this.street = street; - } - - public String getZipCode() { - return zipCode; - } - - public void setZipCode(String zipCode) { - this.zipCode = zipCode; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/model/Person.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/model/Person.java deleted file mode 100644 index d18bd1c72d..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/model/Person.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baeldung.projection.model; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.OneToOne; - -@Entity -public class Person { - @Id - private Long id; - private String firstName; - private String lastName; - @OneToOne(mappedBy = "person") - private Address address; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public Address getAddress() { - return address; - } - - public void setAddress(Address address) { - this.address = address; - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/repository/AddressRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/repository/AddressRepository.java deleted file mode 100644 index c1053f4867..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/repository/AddressRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.projection.repository; - -import com.baeldung.projection.view.AddressView; -import com.baeldung.projection.model.Address; -import org.springframework.data.repository.Repository; - -import java.util.List; - -public interface AddressRepository extends Repository { - List getAddressByState(String state); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/repository/PersonRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/repository/PersonRepository.java deleted file mode 100644 index 64bc7471e6..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/repository/PersonRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.projection.repository; - -import com.baeldung.projection.model.Person; -import com.baeldung.projection.view.PersonDto; -import com.baeldung.projection.view.PersonView; -import org.springframework.data.repository.Repository; - -public interface PersonRepository extends Repository { - PersonView findByLastName(String lastName); - - PersonDto findByFirstName(String firstName); - - T findByLastName(String lastName, Class type); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/AddressView.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/AddressView.java deleted file mode 100644 index 7a24a1e9b9..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/AddressView.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.projection.view; - -public interface AddressView { - String getZipCode(); - - PersonView getPerson(); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/PersonDto.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/PersonDto.java deleted file mode 100644 index 1fd924450b..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/PersonDto.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.projection.view; - -import java.util.Objects; - -public class PersonDto { - private final String firstName; - private final String lastName; - - public PersonDto(String firstName, String lastName) { - this.firstName = firstName; - this.lastName = lastName; - } - - public String getFirstName() { - return firstName; - } - - public String getLastName() { - return lastName; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - PersonDto personDto = (PersonDto) o; - return Objects.equals(firstName, personDto.firstName) && Objects.equals(lastName, personDto.lastName); - } - - @Override - public int hashCode() { - return Objects.hash(firstName, lastName); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/PersonView.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/PersonView.java deleted file mode 100644 index 36777ec26f..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/projection/view/PersonView.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.projection.view; - -import org.springframework.beans.factory.annotation.Value; - -public interface PersonView { - String getFirstName(); - - String getLastName(); - - @Value("#{target.firstName + ' ' + target.lastName}") - String getFullName(); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/CustomerRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/CustomerRepository.java deleted file mode 100644 index 65b22bbd84..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/CustomerRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.repository; - -import com.baeldung.entity.Customer; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -import java.util.List; - -public interface CustomerRepository extends JpaRepository { - - List findByName(String name); - - List findByNameAndEmail(String name, String email); - - @Query("SELECT c FROM Customer c WHERE (:name is null or c.name = :name) and (:email is null or c.email = :email)") - List findCustomerByNameAndEmail(@Param("name") String name, @Param("email") String email); - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/FruitRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/FruitRepository.java deleted file mode 100644 index 5055252adf..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/FruitRepository.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; - -import com.baeldung.entity.Fruit; - -@Repository -public interface FruitRepository extends JpaRepository { - - Long deleteByName(String name); - - List deleteByColor(String color); - - Long removeByName(String name); - - List removeByColor(String color); - - @Modifying - @Query("delete from Fruit f where f.name=:name or f.color=:color") - int deleteFruits(@Param("name") String name, @Param("color") String color); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/PassengerRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/PassengerRepository.java deleted file mode 100644 index a295a74f1b..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/PassengerRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.repository; - -import com.baeldung.entity.Passenger; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -interface PassengerRepository extends JpaRepository { - - List findByFirstNameIgnoreCase(String firstName); - -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/SongRepository.java b/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/SongRepository.java deleted file mode 100644 index ad887fe680..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/java/com/baeldung/repository/SongRepository.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.repository; - -import com.baeldung.entity.Song; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface SongRepository extends JpaRepository { - - List findByNameLike(String name); - - List findByNameNotLike(String name); - - List findByNameStartingWith(String startingWith); - - List findByNameEndingWith(String endingWith); - - List findBySingerContaining(String singer); -} diff --git a/persistence-modules/spring-data-jpa-2/src/main/resources/apple-fruit-data.xml b/persistence-modules/spring-data-jpa-2/src/main/resources/apple-fruit-data.xml deleted file mode 100644 index d87ae28f1e..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/resources/apple-fruit-data.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - 1 - apple - red - diff --git a/persistence-modules/spring-data-jpa-2/src/main/resources/application-joins.properties b/persistence-modules/spring-data-jpa-2/src/main/resources/application-joins.properties deleted file mode 100644 index fe2270293b..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/resources/application-joins.properties +++ /dev/null @@ -1 +0,0 @@ -spring.datasource.data=classpath:db/import_joins.sql diff --git a/persistence-modules/spring-data-jpa-2/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-2/src/main/resources/application.properties deleted file mode 100644 index 72fc330767..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.jpa.show-sql=true \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/main/resources/db/import_joins.sql b/persistence-modules/spring-data-jpa-2/src/main/resources/db/import_joins.sql deleted file mode 100644 index e4772d6ff2..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/resources/db/import_joins.sql +++ /dev/null @@ -1,13 +0,0 @@ -INSERT INTO department (id, name) VALUES (1, 'Infra'); -INSERT INTO department (id, name) VALUES (2, 'Accounting'); -INSERT INTO department (id, name) VALUES (3, 'Management'); - -INSERT INTO joins_employee (id, name, age, department_id) VALUES (1, 'Baeldung', '35', 1); -INSERT INTO joins_employee (id, name, age, department_id) VALUES (2, 'John', '35', 2); -INSERT INTO joins_employee (id, name, age, department_id) VALUES (3, 'Jane', '35', 2); - -INSERT INTO phone (id, number, employee_id) VALUES (1, '111', 1); -INSERT INTO phone (id, number, employee_id) VALUES (2, '222', 1); -INSERT INTO phone (id, number, employee_id) VALUES (3, '333', 1); - -COMMIT; diff --git a/persistence-modules/spring-data-jpa-2/src/main/resources/fruit-data.json b/persistence-modules/spring-data-jpa-2/src/main/resources/fruit-data.json deleted file mode 100644 index 6dc44e2586..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/resources/fruit-data.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "_class": "com.baeldung.entity.Fruit", - "name": "apple", - "color": "red", - "id": 1 - }, - { - "_class": "com.baeldung.entity.Fruit", - "name": "guava", - "color": "green", - "id": 2 - } -] \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/main/resources/guava-fruit-data.xml b/persistence-modules/spring-data-jpa-2/src/main/resources/guava-fruit-data.xml deleted file mode 100644 index ffd75bb4bb..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/main/resources/guava-fruit-data.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - 2 - guava - green - diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/aggregation/SpringDataAggregateIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/aggregation/SpringDataAggregateIntegrationTest.java deleted file mode 100644 index 779ade7a3f..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/aggregation/SpringDataAggregateIntegrationTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.baeldung.aggregation; - -import com.baeldung.aggregation.model.custom.CommentCount; -import com.baeldung.aggregation.model.custom.ICommentCount; -import com.baeldung.aggregation.repository.CommentRepository; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.List; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -@RunWith(SpringRunner.class) -@DataJpaTest - -@Sql(scripts = "/test-aggregation-data.sql") -public class SpringDataAggregateIntegrationTest { - - @Autowired - private CommentRepository commentRepository; - - @Test - public void whenQueryWithAggregation_thenReturnResult() { - List commentCountsByYear = commentRepository.countTotalCommentsByYear(); - - Object[] countYear2019 = commentCountsByYear.get(0); - - assertThat(countYear2019[0], is(Integer.valueOf(2019))); - assertThat(countYear2019[1], is(1l)); - - Object[] countYear2018 = commentCountsByYear.get(1); - - assertThat(countYear2018[0], is(Integer.valueOf(2018))); - assertThat(countYear2018[1], is(2l)); - - Object[] countYear2017 = commentCountsByYear.get(2); - - assertThat(countYear2017[0], is(Integer.valueOf(2017))); - assertThat(countYear2017[1], is(1l)); - } - - @Test - public void whenQueryWithAggregation_thenReturnCustomResult() { - List commentCountsByYear = commentRepository.countTotalCommentsByYearClass(); - - CommentCount countYear2019 = commentCountsByYear.get(0); - - assertThat(countYear2019.getYear(), is(Integer.valueOf(2019))); - assertThat(countYear2019.getTotal(), is(1l)); - - CommentCount countYear2018 = commentCountsByYear.get(1); - - assertThat(countYear2018.getYear(), is(Integer.valueOf(2018))); - assertThat(countYear2018.getTotal(), is(2l)); - - CommentCount countYear2017 = commentCountsByYear.get(2); - - assertThat(countYear2017.getYear(), is(Integer.valueOf(2017))); - assertThat(countYear2017.getTotal(), is(1l)); - } - - @Test - public void whenQueryWithAggregation_thenReturnInterfaceResult() { - List commentCountsByYear = commentRepository.countTotalCommentsByYearInterface(); - - ICommentCount countYear2019 = commentCountsByYear.get(0); - - assertThat(countYear2019.getYearComment(), is(Integer.valueOf(2019))); - assertThat(countYear2019.getTotalComment(), is(1l)); - - ICommentCount countYear2018 = commentCountsByYear.get(1); - - assertThat(countYear2018.getYearComment(), is(Integer.valueOf(2018))); - assertThat(countYear2018.getTotalComment(), is(2l)); - - ICommentCount countYear2017 = commentCountsByYear.get(2); - - assertThat(countYear2017.getYearComment(), is(Integer.valueOf(2017))); - assertThat(countYear2017.getTotalComment(), is(1l)); - } - - @Test - public void whenNativeQueryWithAggregation_thenReturnInterfaceResult() { - List commentCountsByYear = commentRepository.countTotalCommentsByYearNative(); - - ICommentCount countYear2019 = commentCountsByYear.get(0); - - assertThat(countYear2019.getYearComment(), is(Integer.valueOf(2019))); - assertThat(countYear2019.getTotalComment(), is(1l)); - - ICommentCount countYear2018 = commentCountsByYear.get(1); - - assertThat(countYear2018.getYearComment(), is(Integer.valueOf(2018))); - assertThat(countYear2018.getTotalComment(), is(2l)); - - ICommentCount countYear2017 = commentCountsByYear.get(2); - - assertThat(countYear2017.getYearComment(), is(Integer.valueOf(2017))); - assertThat(countYear2017.getTotalComment(), is(1l)); - } - -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/datajpadelete/DeleteFromRepositoryUnitTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/datajpadelete/DeleteFromRepositoryUnitTest.java deleted file mode 100644 index 5f4a36bc0e..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/datajpadelete/DeleteFromRepositoryUnitTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baeldung.datajpadelete; - -import com.baeldung.Application; -import com.baeldung.datajpadelete.entity.Book; -import com.baeldung.datajpadelete.repository.BookRepository; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Arrays; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {Application.class}) -public class DeleteFromRepositoryUnitTest { - - @Autowired - private BookRepository repository; - - Book book1; - Book book2; - - @Before - public void setup() { - book1 = new Book("The Hobbit"); - book2 = new Book("All Quiet on the Western Front"); - - repository.saveAll(Arrays.asList(book1, book2)); - } - - @After - public void teardown() { - repository.deleteAll(); - } - - @Test - public void whenDeleteByIdFromRepository_thenDeletingShouldBeSuccessful() { - repository.deleteById(book1.getId()); - - assertThat(repository.count()).isEqualTo(1); - } - - @Test - public void whenDeleteAllFromRepository_thenRepositoryShouldBeEmpty() { - repository.deleteAll(); - - assertThat(repository.count()).isEqualTo(0); - } - - @Test - @Transactional - public void whenDeleteFromDerivedQuery_thenDeletingShouldBeSuccessful() { - long deletedRecords = repository.deleteByTitle("The Hobbit"); - - assertThat(deletedRecords).isEqualTo(1); - } - - @Test - @Transactional - public void whenDeleteFromCustomQuery_thenDeletingShouldBeSuccessful() { - repository.deleteBooks("The Hobbit"); - - assertThat(repository.count()).isEqualTo(1); - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/datajpadelete/DeleteInRelationshipsUnitTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/datajpadelete/DeleteInRelationshipsUnitTest.java deleted file mode 100644 index 6275ace6e0..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/datajpadelete/DeleteInRelationshipsUnitTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.baeldung.datajpadelete; - -import com.baeldung.Application; -import com.baeldung.datajpadelete.entity.Book; -import com.baeldung.datajpadelete.entity.Category; -import com.baeldung.datajpadelete.repository.BookRepository; -import com.baeldung.datajpadelete.repository.CategoryRepository; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {Application.class}) -public class DeleteInRelationshipsUnitTest { - - @Autowired - private BookRepository bookRepository; - - @Autowired - private CategoryRepository categoryRepository; - - @Before - public void setup() { - Book book1 = new Book("The Hobbit"); - Category category1 = new Category("Cat1", book1); - categoryRepository.save(category1); - - Book book2 = new Book("All Quiet on the Western Front"); - Category category2 = new Category("Cat2", book2); - categoryRepository.save(category2); - } - - @After - public void teardown() { - bookRepository.deleteAll(); - categoryRepository.deleteAll(); - } - - @Test - public void whenDeletingCategories_thenBooksShouldAlsoBeDeleted() { - categoryRepository.deleteAll(); - - assertThat(bookRepository.count()).isEqualTo(0); - assertThat(categoryRepository.count()).isEqualTo(0); - } - - @Test - public void whenDeletingBooks_thenCategoriesShouldAlsoBeDeleted() { - bookRepository.deleteAll(); - - assertThat(bookRepository.count()).isEqualTo(0); - assertThat(categoryRepository.count()).isEqualTo(2); - } -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/embeddable/EmbeddableIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/embeddable/EmbeddableIntegrationTest.java deleted file mode 100644 index b4c365a2d9..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/embeddable/EmbeddableIntegrationTest.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.baeldung.embeddable; - -import com.baeldung.Application; -import com.baeldung.embeddable.model.Company; -import com.baeldung.embeddable.model.ContactPerson; -import com.baeldung.embeddable.repositories.CompanyRepository; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -import static org.junit.Assert.assertEquals; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {Application.class}) -public class EmbeddableIntegrationTest { - - @Autowired - private CompanyRepository companyRepository; - - @Test - @Transactional - public void whenInsertingCompany_thenEmbeddedContactPersonDetailsAreMapped() { - ContactPerson contactPerson = new ContactPerson(); - contactPerson.setFirstName("First"); - contactPerson.setLastName("Last"); - contactPerson.setPhone("123-456-789"); - - Company company = new Company(); - company.setName("Company"); - company.setAddress("1st street"); - company.setPhone("987-654-321"); - company.setContactPerson(contactPerson); - - companyRepository.save(company); - - Company result = companyRepository.getOne(company.getId()); - - assertEquals("Company", result.getName()); - assertEquals("1st street", result.getAddress()); - assertEquals("987-654-321", result.getPhone()); - assertEquals("First", result.getContactPerson().getFirstName()); - assertEquals("Last", result.getContactPerson().getLastName()); - assertEquals("123-456-789", result.getContactPerson().getPhone()); - } - - @Test - @Transactional - public void whenFindingCompanyByContactPersonAttribute_thenCompanyIsReturnedProperly() { - ContactPerson contactPerson = new ContactPerson(); - contactPerson.setFirstName("Name"); - contactPerson.setLastName("Last"); - contactPerson.setPhone("123-456-789"); - - Company company = new Company(); - company.setName("Company"); - company.setAddress("1st street"); - company.setPhone("987-654-321"); - company.setContactPerson(contactPerson); - - companyRepository.save(company); - - List result = companyRepository.findByContactPersonFirstName("Name"); - - assertEquals(1, result.size()); - - result = companyRepository.findByContactPersonFirstName("FirstName"); - - assertEquals(0, result.size()); - } - - @Test - @Transactional - public void whenFindingCompanyByContactPersonAttributeWithJPQL_thenCompanyIsReturnedProperly() { - ContactPerson contactPerson = new ContactPerson(); - contactPerson.setFirstName("@QueryName"); - contactPerson.setLastName("Last"); - contactPerson.setPhone("123-456-789"); - - Company company = new Company(); - company.setName("Company"); - company.setAddress("1st street"); - company.setPhone("987-654-321"); - company.setContactPerson(contactPerson); - - companyRepository.save(company); - - List result = companyRepository.findByContactPersonFirstNameWithJPQL("@QueryName"); - - assertEquals(1, result.size()); - - result = companyRepository.findByContactPersonFirstNameWithJPQL("FirstName"); - - assertEquals(0, result.size()); - } - - @Test - @Transactional - public void whenFindingCompanyByContactPersonAttributeWithNativeQuery_thenCompanyIsReturnedProperly() { - ContactPerson contactPerson = new ContactPerson(); - contactPerson.setFirstName("NativeQueryName"); - contactPerson.setLastName("Last"); - contactPerson.setPhone("123-456-789"); - - Company company = new Company(); - company.setName("Company"); - company.setAddress("1st street"); - company.setPhone("987-654-321"); - company.setContactPerson(contactPerson); - - companyRepository.save(company); - - List result = companyRepository.findByContactPersonFirstNameWithNativeQuery("NativeQueryName"); - - assertEquals(1, result.size()); - - result = companyRepository.findByContactPersonFirstNameWithNativeQuery("FirstName"); - - assertEquals(0, result.size()); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/entitygraph/EntityGraphIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/entitygraph/EntityGraphIntegrationTest.java deleted file mode 100644 index 24880a5dff..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/entitygraph/EntityGraphIntegrationTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.entitygraph; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.entitygraph.model.Characteristic; -import com.baeldung.entitygraph.model.Item; -import com.baeldung.entitygraph.repository.CharacteristicsRepository; -import com.baeldung.entitygraph.repository.ItemRepository; - -@DataJpaTest -@RunWith(SpringRunner.class) -@Sql(scripts = "/entitygraph-data.sql") -public class EntityGraphIntegrationTest { - - @Autowired - private ItemRepository itemRepo; - - @Autowired - private CharacteristicsRepository characteristicsRepo; - - @Test - public void givenEntityGraph_whenCalled_shouldRetrunDefinedFields() { - Item item = itemRepo.findByName("Table"); - assertThat(item.getId()).isEqualTo(1L); - } - - @Test - public void givenAdhocEntityGraph_whenCalled_shouldRetrunDefinedFields() { - Characteristic characteristic = characteristicsRepo.findByType("Rigid"); - assertThat(characteristic.getId()).isEqualTo(1L); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/exists/CarRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/exists/CarRepositoryIntegrationTest.java deleted file mode 100644 index d99f6671a3..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/exists/CarRepositoryIntegrationTest.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.baeldung.exists; - -import com.baeldung.Application; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.domain.Example; -import org.springframework.data.domain.ExampleMatcher; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.Arrays; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.ignoreCase; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {Application.class}) -public class CarRepositoryIntegrationTest { - - @Autowired - private CarRepository repository; - private int searchId; - - @Before - public void setup() { - List cars = repository.saveAll(Arrays.asList(new Car(200, "BMW"), new Car(300, "Audi"))); - searchId = cars.get(0).getId(); - } - - @After - public void teardown() { - repository.deleteAll(); - } - - @Test - public void whenIdIsCorrect_thenExistsShouldReturnTrue() { - assertThat(repository.existsById(searchId)).isTrue(); - } - - @Test - public void givenExample_whenExists_thenIsTrue() { - ExampleMatcher modelMatcher = ExampleMatcher.matching() - .withIgnorePaths("id") // must explicitly ignore -> PK - .withMatcher("model", ignoreCase()); - Car probe = new Car(); - probe.setModel("bmw"); - - Example example = Example.of(probe, modelMatcher); - - assertThat(repository.exists(example)).isTrue(); - } - - @Test - public void givenPower_whenExists_thenIsFalse() { - assertThat(repository.existsCarByPower(200)).isTrue(); - assertThat(repository.existsCarByPower(800)).isFalse(); - } - - @Test - public void existsByDerivedQuery_byModel() { - assertThat(repository.existsCarByModel("Audi")).isTrue(); - assertThat(repository.existsCarByModel("audi")).isFalse(); - assertThat(repository.existsCarByModel("AUDI")).isFalse(); - assertThat(repository.existsCarByModel("")).isFalse(); - } - - @Test - public void givenModelName_whenExistsExact_thenIsTrue() { - assertThat(repository.existsCarExactCustomQuery("BMW")).isTrue(); - assertThat(repository.existsCarExactCustomQuery("Bmw")).isFalse(); - assertThat(repository.existsCarExactCustomQuery("bmw")).isFalse(); - assertThat(repository.existsCarExactCustomQuery("")).isFalse(); - } - - @Test - public void givenModelName_whenExistsLike_thenIsTrue() { - assertThat(repository.existsCarLikeCustomQuery("BMW")).isTrue(); - assertThat(repository.existsCarLikeCustomQuery("Bmw")).isTrue(); - assertThat(repository.existsCarLikeCustomQuery("bmw")).isTrue(); - assertThat(repository.existsCarLikeCustomQuery("")).isFalse(); - } - -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/joins/JpaJoinsIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/joins/JpaJoinsIntegrationTest.java deleted file mode 100644 index 9b0d23f3e4..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/joins/JpaJoinsIntegrationTest.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.baeldung.joins; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.baeldung.joins.model.Department; -import com.baeldung.joins.model.Phone; -import java.util.Collection; -import java.util.List; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.TypedQuery; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@DataJpaTest -@ActiveProfiles("joins") -public class JpaJoinsIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Test - public void whenPathExpressionIsUsedForSingleValuedAssociation_thenCreatesImplicitInnerJoin() { - TypedQuery query = entityManager.createQuery("SELECT e.department FROM Employee e", Department.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(3); - assertThat(resultList).extracting("name") - .containsOnly("Infra", "Accounting", "Accounting"); - } - - @Test - public void whenJoinKeywordIsUsed_thenCreatesExplicitInnerJoin() { - TypedQuery query = entityManager.createQuery("SELECT d FROM Employee e JOIN e.department d", Department.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(3); - assertThat(resultList).extracting("name") - .containsOnly("Infra", "Accounting", "Accounting"); - } - - @Test - public void whenInnerJoinKeywordIsUsed_thenCreatesExplicitInnerJoin() { - TypedQuery query = entityManager.createQuery("SELECT d FROM Employee e INNER JOIN e.department d", Department.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(3); - assertThat(resultList).extracting("name") - .containsOnly("Infra", "Accounting", "Accounting"); - } - - @Test - public void whenEntitiesAreListedInFromAndMatchedInWhere_ThenCreatesJoin() { - TypedQuery query = entityManager.createQuery("SELECT d FROM Employee e, Department d WHERE e.department = d", Department.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(3); - assertThat(resultList).extracting("name") - .containsOnly("Infra", "Accounting", "Accounting"); - } - - @Test - public void whenEntitiesAreListedInFrom_ThenCreatesCartesianProduct() { - TypedQuery query = entityManager.createQuery("SELECT d FROM Employee e, Department d", Department.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(9); - assertThat(resultList).extracting("name") - .containsOnly("Infra", "Accounting", "Management", "Infra", "Accounting", "Management", "Infra", "Accounting", "Management"); - } - - @Test - public void whenCollectionValuedAssociationIsJoined_ThenCanSelect() { - TypedQuery query = entityManager.createQuery("SELECT ph FROM Employee e JOIN e.phones ph WHERE ph LIKE '1%'", Phone.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(1); - } - - @Test - public void whenMultipleEntitiesAreListedWithJoin_ThenCreatesMultipleJoins() { - TypedQuery query = entityManager.createQuery("SELECT ph FROM Employee e JOIN e.department d JOIN e.phones ph WHERE d.name IS NOT NULL", Phone.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(3); - assertThat(resultList).extracting("number") - .containsOnly("111", "222", "333"); - } - - @Test - public void whenLeftKeywordIsSpecified_thenCreatesOuterJoinAndIncludesNonMatched() { - TypedQuery query = entityManager.createQuery("SELECT DISTINCT d FROM Department d LEFT JOIN d.employees e", Department.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(3); - assertThat(resultList).extracting("name") - .containsOnly("Infra", "Accounting", "Management"); - } - - @Test - public void whenFetchKeywordIsSpecified_ThenCreatesFetchJoin() { - TypedQuery query = entityManager.createQuery("SELECT d FROM Department d JOIN FETCH d.employees", Department.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(3); - assertThat(resultList).extracting("name") - .containsOnly("Infra", "Accounting", "Accounting"); - } - - @Test - public void whenLeftAndFetchKeywordsAreSpecified_ThenCreatesOuterFetchJoin() { - TypedQuery query = entityManager.createQuery("SELECT d FROM Department d LEFT JOIN FETCH d.employees", Department.class); - - List resultList = query.getResultList(); - - assertThat(resultList).hasSize(4); - assertThat(resultList).extracting("name") - .containsOnly("Infra", "Accounting", "Accounting", "Management"); - } - - @Test - public void whenCollectionValuedAssociationIsSpecifiedInSelect_ThenReturnsCollections() { - TypedQuery query = entityManager.createQuery("SELECT e.phones FROM Employee e", Collection.class); - - List resultList = query.getResultList(); - - assertThat(resultList).extracting("number").containsOnly("111", "222", "333"); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/projection/JpaProjectionIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/projection/JpaProjectionIntegrationTest.java deleted file mode 100644 index 96eaf4ed07..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/projection/JpaProjectionIntegrationTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.baeldung.projection; - -import com.baeldung.projection.model.Person; -import com.baeldung.projection.repository.AddressRepository; -import com.baeldung.projection.repository.PersonRepository; -import com.baeldung.projection.view.AddressView; -import com.baeldung.projection.view.PersonDto; -import com.baeldung.projection.view.PersonView; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_METHOD; - -@DataJpaTest -@RunWith(SpringRunner.class) -@Sql(scripts = "/projection-insert-data.sql") -@Sql(scripts = "/projection-clean-up-data.sql", executionPhase = AFTER_TEST_METHOD) -public class JpaProjectionIntegrationTest { - @Autowired - private AddressRepository addressRepository; - - @Autowired - private PersonRepository personRepository; - - @Test - public void whenUsingClosedProjections_thenViewWithRequiredPropertiesIsReturned() { - AddressView addressView = addressRepository.getAddressByState("CA").get(0); - assertThat(addressView.getZipCode()).isEqualTo("90001"); - - PersonView personView = addressView.getPerson(); - assertThat(personView.getFirstName()).isEqualTo("John"); - assertThat(personView.getLastName()).isEqualTo("Doe"); - } - - @Test - public void whenUsingOpenProjections_thenViewWithRequiredPropertiesIsReturned() { - PersonView personView = personRepository.findByLastName("Doe"); - assertThat(personView.getFullName()).isEqualTo("John Doe"); - } - - @Test - public void whenUsingClassBasedProjections_thenDtoWithRequiredPropertiesIsReturned() { - PersonDto personDto = personRepository.findByFirstName("John"); - assertThat(personDto.getFirstName()).isEqualTo("John"); - assertThat(personDto.getLastName()).isEqualTo("Doe"); - } - - @Test - public void whenUsingDynamicProjections_thenObjectWithRequiredPropertiesIsReturned() { - Person person = personRepository.findByLastName("Doe", Person.class); - PersonView personView = personRepository.findByLastName("Doe", PersonView.class); - PersonDto personDto = personRepository.findByLastName("Doe", PersonDto.class); - - assertThat(person.getFirstName()).isEqualTo("John"); - assertThat(personView.getFirstName()).isEqualTo("John"); - assertThat(personDto.getFirstName()).isEqualTo("John"); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/CustomerRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/CustomerRepositoryIntegrationTest.java deleted file mode 100644 index 5d6457ce30..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/CustomerRepositoryIntegrationTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.baeldung.repository; - -import com.baeldung.entity.Customer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -@DataJpaTest -@RunWith(SpringRunner.class) -public class CustomerRepositoryIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private CustomerRepository repository; - - @Before - public void before() { - entityManager.persist(new Customer("A", "A@example.com")); - entityManager.persist(new Customer("D", null)); - entityManager.persist(new Customer("D", "D@example.com")); - } - - @Test - public void givenQueryMethod_whenEmailIsNull_thenFoundByNullEmail() { - List customers = repository.findByNameAndEmail("D", null); - - assertEquals(1, customers.size()); - Customer actual = customers.get(0); - - assertEquals(null, actual.getEmail()); - assertEquals("D", actual.getName()); - } - - @Test - public void givenQueryMethod_whenEmailIsAbsent_thenIgnoreEmail() { - List customers = repository.findByName("D"); - - assertEquals(2, customers.size()); - } - - @Test - public void givenQueryAnnotation_whenEmailIsNull_thenIgnoreEmail() { - List customers = repository.findCustomerByNameAndEmail("D", null); - - assertEquals(2, customers.size()); - } - - @After - public void cleanUp() { - repository.deleteAll(); - } -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/FruitPopulatorIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/FruitPopulatorIntegrationTest.java deleted file mode 100644 index 4d3661e717..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/FruitPopulatorIntegrationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.repository; - -import static org.junit.Assert.assertEquals; - -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.entity.Fruit; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class FruitPopulatorIntegrationTest { - - @Autowired - private FruitRepository fruitRepository; - - @Test - public void givenFruitJsonPopulatorThenShouldInsertRecordOnStart() { - - List fruits = fruitRepository.findAll(); - assertEquals("record count is not matching", 2, fruits.size()); - - fruits.forEach(fruit -> { - if (1 == fruit.getId()) { - assertEquals("apple", fruit.getName()); - assertEquals("red", fruit.getColor()); - } else if (2 == fruit.getId()) { - assertEquals("guava", fruit.getName()); - assertEquals("green", fruit.getColor()); - } - }); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/FruitRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/FruitRepositoryIntegrationTest.java deleted file mode 100644 index cf771dc833..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/FruitRepositoryIntegrationTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baeldung.repository; - -import static org.junit.Assert.assertEquals; - -import java.util.List; - -import org.junit.jupiter.api.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.entity.Fruit; - -@RunWith(SpringRunner.class) -@SpringBootTest -class FruitRepositoryIntegrationTest { - - @Autowired - private FruitRepository fruitRepository; - - @Transactional - @Test - @Sql(scripts = { "/test-fruit-data.sql" }) - public void givenFruits_WhenDeletedByColor_ThenDeletedFruitsShouldReturn() { - - List fruits = fruitRepository.deleteByColor("green"); - - assertEquals("number of fruits are not matching", 2, fruits.size()); - fruits.forEach(fruit -> assertEquals("Its not a green fruit", "green", fruit.getColor())); - } - - @Transactional - @Test - @Sql(scripts = { "/test-fruit-data.sql" }) - public void givenFruits_WhenDeletedByName_ThenDeletedFruitCountShouldReturn() { - - Long deletedFruitCount = fruitRepository.deleteByName("apple"); - - assertEquals("deleted fruit count is not matching", 1, deletedFruitCount.intValue()); - } - - @Transactional - @Test - @Sql(scripts = { "/test-fruit-data.sql" }) - public void givenFruits_WhenRemovedByColor_ThenDeletedFruitsShouldReturn() { - - List fruits = fruitRepository.removeByColor("green"); - - assertEquals("number of fruits are not matching", 2, fruits.size()); - fruits.forEach(fruit -> assertEquals("Its not a green fruit", "green", fruit.getColor())); - } - - @Transactional - @Test - @Sql(scripts = { "/test-fruit-data.sql" }) - public void givenFruits_WhenRemovedByName_ThenDeletedFruitCountShouldReturn() { - - Long deletedFruitCount = fruitRepository.removeByName("apple"); - - assertEquals("deleted fruit count is not matching", 1, deletedFruitCount.intValue()); - } - - @Transactional - @Test - @Sql(scripts = { "/test-fruit-data.sql" }) - public void givenFruits_WhenDeletedByColorOrName_ThenDeletedFruitsShouldReturn() { - - int deletedCount = fruitRepository.deleteFruits("apple", "green"); - - assertEquals("number of fruits are not matching", 3, deletedCount); - } -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/PassengerRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/PassengerRepositoryIntegrationTest.java deleted file mode 100644 index f96f0249d7..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/PassengerRepositoryIntegrationTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.baeldung.repository; - -import com.baeldung.entity.Passenger; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import java.util.List; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.core.IsNot.not; - -@DataJpaTest -@RunWith(SpringRunner.class) -public class PassengerRepositoryIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - @Autowired - private PassengerRepository repository; - - @Before - public void before() { - entityManager.persist(Passenger.from("Jill", "Smith")); - entityManager.persist(Passenger.from("Eve", "Jackson")); - entityManager.persist(Passenger.from("Fred", "Bloggs")); - entityManager.persist(Passenger.from("Ricki", "Bobbie")); - entityManager.persist(Passenger.from("Siya", "Kolisi")); - } - - @Test - public void givenPassengers_whenMatchingIgnoreCase_thenExpectedReturned() { - Passenger jill = Passenger.from("Jill", "Smith"); - Passenger eve = Passenger.from("Eve", "Jackson"); - Passenger fred = Passenger.from("Fred", "Bloggs"); - Passenger siya = Passenger.from("Siya", "Kolisi"); - Passenger ricki = Passenger.from("Ricki", "Bobbie"); - - List passengers = repository.findByFirstNameIgnoreCase("FRED"); - - assertThat(passengers, contains(fred)); - assertThat(passengers, not(contains(eve))); - assertThat(passengers, not(contains(siya))); - assertThat(passengers, not(contains(jill))); - assertThat(passengers, not(contains(ricki))); - - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/SongRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/SongRepositoryIntegrationTest.java deleted file mode 100644 index 14912a4ecb..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/java/com/baeldung/repository/SongRepositoryIntegrationTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baeldung.repository; - -import static org.junit.Assert.assertEquals; - -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.entity.Song; - -@RunWith(SpringRunner.class) -@SpringBootTest -@Sql(scripts = { "/test-song-data.sql" }) -public class SongRepositoryIntegrationTest { - - @Autowired private SongRepository songRepository; - - @Transactional - @Test - public void givenSong_WhenFindLikeByName_ThenShouldReturnOne() { - List songs = songRepository.findByNameLike("Despacito"); - assertEquals(1, songs.size()); - } - - @Transactional - @Test - public void givenSong_WhenFindByNameNotLike_thenShouldReturn3Songs() { - List songs = songRepository.findByNameNotLike("Despacito"); - assertEquals(5, songs.size()); - } - - @Transactional - @Test - public void givenSong_WhenFindByNameStartingWith_thenShouldReturn2Songs() { - List songs = songRepository.findByNameStartingWith("Co"); - assertEquals(2, songs.size()); - } - - @Transactional - @Test - public void givenSong_WhenFindByNameEndingWith_thenShouldReturn2Songs() { - List songs = songRepository.findByNameEndingWith("Life"); - assertEquals(2, songs.size()); - } - - @Transactional - @Test - public void givenSong_WhenFindBySingerContaining_thenShouldReturn2Songs() { - List songs = songRepository.findBySingerContaining("Luis"); - assertEquals(2, songs.size()); - } -} diff --git a/persistence-modules/spring-data-jpa-2/src/test/resources/entitygraph-data.sql b/persistence-modules/spring-data-jpa-2/src/test/resources/entitygraph-data.sql deleted file mode 100644 index 685ec2c605..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/resources/entitygraph-data.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO Item(id,name) VALUES (1,'Table'); -INSERT INTO Item(id,name) VALUES (2,'Bottle'); - -INSERT INTO Characteristic(id,item_id, type) VALUES (1,1,'Rigid'); -INSERT INTO Characteristic(id,item_id,type) VALUES (2,1,'Big'); -INSERT INTO Characteristic(id,item_id,type) VALUES (3,2,'Fragile'); -INSERT INTO Characteristic(id,item_id,type) VALUES (4,2,'Small'); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/resources/projection-clean-up-data.sql b/persistence-modules/spring-data-jpa-2/src/test/resources/projection-clean-up-data.sql deleted file mode 100644 index d34f6f0636..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/resources/projection-clean-up-data.sql +++ /dev/null @@ -1,2 +0,0 @@ -DELETE FROM address; -DELETE FROM person; \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/resources/projection-insert-data.sql b/persistence-modules/spring-data-jpa-2/src/test/resources/projection-insert-data.sql deleted file mode 100644 index 544dcc4b88..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/resources/projection-insert-data.sql +++ /dev/null @@ -1,2 +0,0 @@ -INSERT INTO person(id,first_name,last_name) VALUES (1,'John','Doe'); -INSERT INTO address(id,person_id,state,city,street,zip_code) VALUES (1,1,'CA', 'Los Angeles', 'Standford Ave', '90001'); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/resources/test-aggregation-data.sql b/persistence-modules/spring-data-jpa-2/src/test/resources/test-aggregation-data.sql deleted file mode 100644 index 12409a124e..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/resources/test-aggregation-data.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO post (id, title, content) VALUES (1, 'Comment 1', 'Content 1'); -INSERT INTO post (id, title, content) VALUES (2, 'Comment 2', 'Content 2'); -INSERT INTO post (id, title, content) VALUES (3, 'Comment 3', 'Content 3'); -INSERT INTO comment (id, year, approved, content, post_id) VALUES (1, 2019, false, 'Comment 1', 1); -INSERT INTO comment (id, year, approved, content, post_id) VALUES (2, 2018, true, 'Comment 2', 1); -INSERT INTO comment (id, year, approved, content, post_id) VALUES (3, 2018, true, 'Comment 3', 2); -INSERT INTO comment (id, year, approved, content, post_id) VALUES (4, 2017, false, 'Comment 4', 3); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/resources/test-fruit-data.sql b/persistence-modules/spring-data-jpa-2/src/test/resources/test-fruit-data.sql deleted file mode 100644 index d99f42e5a7..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/resources/test-fruit-data.sql +++ /dev/null @@ -1,6 +0,0 @@ -truncate table fruit; - -insert into fruit(id,name,color) values (1,'apple','red'); -insert into fruit(id,name,color) values (2,'custard apple','green'); -insert into fruit(id,name,color) values (3,'mango','yellow'); -insert into fruit(id,name,color) values (4,'guava','green'); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-2/src/test/resources/test-song-data.sql b/persistence-modules/spring-data-jpa-2/src/test/resources/test-song-data.sql deleted file mode 100644 index 5a2b1a5555..0000000000 --- a/persistence-modules/spring-data-jpa-2/src/test/resources/test-song-data.sql +++ /dev/null @@ -1,8 +0,0 @@ -INSERT INTO song(id,name,length_in_seconds,compositor,singer,released,genre) -VALUES -(1,'Despacito',209,'Luis Fonsi','Luis Fonsi, Daddy Yankee','2017-01-12','Reggaeton'), -(2,'Con calma',188,'Daddy Yankee','Daddy Yankee','2019-01-24','Reggaeton'), -(3,'It''s My Life',205,'Bon Jovi','Jon Bon Jovi','2000-05-23','Pop'), -(4,'Live is Life',242,'Opus','Opus','1985-01-01','Reggae'), -(5,'Countdown to Extinction',249,'Megadeth','Megadeth','1992-07-14','Heavy Metal'), -(6, 'Si nos dejan',139,'Luis Miguel','Luis Miguel','1995-10-17','Bolero'); \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-3/README.md b/persistence-modules/spring-data-jpa-3/README.md deleted file mode 100644 index bac52bf114..0000000000 --- a/persistence-modules/spring-data-jpa-3/README.md +++ /dev/null @@ -1,20 +0,0 @@ -### Relevant Articles: -- [Limiting Query Results with JPA and Spring Data JPA](https://www.baeldung.com/jpa-limit-query-results) -- [Sorting Query Results with Spring Data](https://www.baeldung.com/spring-data-sorting) -- [INSERT Statement in JPA](https://www.baeldung.com/jpa-insert) -- [Pagination and Sorting using Spring Data JPA](https://www.baeldung.com/spring-data-jpa-pagination-sorting) -- [Spring Data JPA Query by Example](https://www.baeldung.com/spring-data-query-by-example) -- [DB Integration Tests with Spring Boot and Testcontainers](https://www.baeldung.com/spring-boot-testcontainers-integration-test) -- [Spring Data JPA @Modifying Annotation](https://www.baeldung.com/spring-data-jpa-modifying-annotation) -- [Spring Data JPA Batch Inserts](https://www.baeldung.com/spring-data-jpa-batch-inserts) -- [Batch Insert/Update with Hibernate/JPA](https://www.baeldung.com/jpa-hibernate-batch-insert-update) -- [Difference Between save() and saveAndFlush() in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-save-saveandflush) - -### Eclipse Config -After importing the project into Eclipse, you may see the following error: -"No persistence xml file found in project" - -This can be ignored: -- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" -Or: -- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator diff --git a/persistence-modules/spring-data-jpa-3/pom.xml b/persistence-modules/spring-data-jpa-3/pom.xml deleted file mode 100644 index d02d089ba3..0000000000 --- a/persistence-modules/spring-data-jpa-3/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - 4.0.0 - spring-data-jpa-3 - spring-data-jpa-3 - - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - com.google.guava - guava - ${guava.version} - - - com.h2database - h2 - - - net.ttddyy - datasource-proxy - ${datasource-proxy.version} - - - org.postgresql - postgresql - - - com.h2database - h2 - runtime - - - - - org.testcontainers - postgresql - ${testcontainers.version} - test - - - - - - 1.4.1 - 21.0 - 1.12.2 - - - diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/Application.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/Application.java deleted file mode 100644 index ce10072031..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/Application.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; - -@SpringBootApplication -@EnableJpaRepositories -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/DatasourceProxyBeanPostProcessor.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/DatasourceProxyBeanPostProcessor.java deleted file mode 100644 index 504357db44..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/DatasourceProxyBeanPostProcessor.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.baeldung.batchinserts; - -import java.lang.reflect.Method; -import javax.sql.DataSource; -import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; -import org.aopalliance.intercept.MethodInterceptor; -import org.aopalliance.intercept.MethodInvocation; -import org.springframework.aop.framework.ProxyFactory; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.config.BeanPostProcessor; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; -import org.springframework.util.ReflectionUtils; - -@Component -@Profile("batchinserts") -public class DatasourceProxyBeanPostProcessor implements BeanPostProcessor { - - @Override - public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException { - return bean; - } - - @Override - public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException { - if (bean instanceof DataSource) { - ProxyFactory factory = new ProxyFactory(bean); - factory.setProxyTargetClass(true); - factory.addAdvice(new ProxyDataSourceInterceptor((DataSource) bean)); - return factory.getProxy(); - } - - return bean; - } - - private static class ProxyDataSourceInterceptor implements MethodInterceptor { - - private final DataSource dataSource; - - public ProxyDataSourceInterceptor(final DataSource dataSource) { - this.dataSource = ProxyDataSourceBuilder.create(dataSource).name("Batch-Insert-Logger").asJson().countQuery().logQueryToSysOut().build(); - } - - @Override - public Object invoke(final MethodInvocation invocation) throws Throwable { - Method proxyMethod = ReflectionUtils.findMethod(dataSource.getClass(), invocation.getMethod().getName()); - if (proxyMethod != null) { - return proxyMethod.invoke(dataSource, invocation.getArguments()); - } - return invocation.proceed(); - } - } -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/model/School.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/model/School.java deleted file mode 100644 index 6d2f333ac7..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/model/School.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baeldung.batchinserts.model; - -import java.util.List; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; - -@Entity -public class School { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE) - private long id; - - private String name; - - @OneToMany(mappedBy = "school") - private List students; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getStudents() { - return students; - } - - public void setStudents(List students) { - this.students = students; - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/model/Student.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/model/Student.java deleted file mode 100644 index d38214f122..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/batchinserts/model/Student.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.batchinserts.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.ManyToOne; - -@Entity -public class Student { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE) - private long id; - - private String name; - - @ManyToOne - private School school; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public School getSchool() { - return school; - } - - public void setSchool(School school) { - this.school = school; - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/Application.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/Application.java deleted file mode 100644 index aaca760499..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/Application.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.boot; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; - -@SpringBootApplication -@EnableJpaRepositories("com.baeldung") -@EntityScan("com.baeldung") -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/CustomerRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/CustomerRepository.java deleted file mode 100644 index 7cb7e45b27..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/CustomerRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.boot.domain.Customer; - -/** - * JPA CrudRepository interface - * - * @author ysharma2512 - * - */ -@Repository -@Transactional -public interface CustomerRepository extends CrudRepository{ - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/impl/PersonInsertRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/impl/PersonInsertRepository.java deleted file mode 100644 index 373532e1c3..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/impl/PersonInsertRepository.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.boot.daos.impl; - -import org.springframework.stereotype.Repository; - -import com.baeldung.boot.domain.Person; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.transaction.Transactional; - -@Repository -public class PersonInsertRepository { - - @PersistenceContext - private EntityManager entityManager; - - @Transactional - public void insertWithQuery(Person person) { - entityManager.createNativeQuery("INSERT INTO person (id, first_name, last_name) VALUES (?,?,?)") - .setParameter(1, person.getId()) - .setParameter(2, person.getFirstName()) - .setParameter(3, person.getLastName()) - .executeUpdate(); - } - - @Transactional - public void insertWithEntityManager(Person person) { - this.entityManager.persist(person); - } - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepository.java deleted file mode 100644 index 53f692ff28..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepository.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.baeldung.boot.daos.user; - -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.domain.Sort; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -import com.baeldung.boot.domain.User; - -import java.time.LocalDate; -import java.util.Collection; -import java.util.List; -import java.util.stream.Stream; - -public interface UserRepository extends JpaRepository , UserRepositoryCustom{ - - Stream findAllByName(String name); - - @Query("SELECT u FROM User u WHERE u.status = 1") - Collection findAllActiveUsers(); - - @Query("select u from User u where u.email like '%@gmail.com'") - List findUsersWithGmailAddress(); - - @Query(value = "SELECT * FROM Users u WHERE u.status = 1", nativeQuery = true) - Collection findAllActiveUsersNative(); - - @Query("SELECT u FROM User u WHERE u.status = ?1") - User findUserByStatus(Integer status); - - @Query(value = "SELECT * FROM Users u WHERE u.status = ?1", nativeQuery = true) - User findUserByStatusNative(Integer status); - - @Query("SELECT u FROM User u WHERE u.status = ?1 and u.name = ?2") - User findUserByStatusAndName(Integer status, String name); - - @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") - User findUserByStatusAndNameNamedParams(@Param("status") Integer status, @Param("name") String name); - - @Query(value = "SELECT * FROM Users u WHERE u.status = :status AND u.name = :name", nativeQuery = true) - User findUserByStatusAndNameNamedParamsNative(@Param("status") Integer status, @Param("name") String name); - - @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") - User findUserByUserStatusAndUserName(@Param("status") Integer userStatus, @Param("name") String userName); - - @Query("SELECT u FROM User u WHERE u.name like ?1%") - User findUserByNameLike(String name); - - @Query("SELECT u FROM User u WHERE u.name like :name%") - User findUserByNameLikeNamedParam(@Param("name") String name); - - @Query(value = "SELECT * FROM users u WHERE u.name LIKE ?1%", nativeQuery = true) - User findUserByNameLikeNative(String name); - - @Query(value = "SELECT u FROM User u") - List findAllUsers(Sort sort); - - @Query(value = "SELECT u FROM User u ORDER BY id") - Page findAllUsersWithPagination(Pageable pageable); - - @Query(value = "SELECT * FROM Users ORDER BY id", countQuery = "SELECT count(*) FROM Users", nativeQuery = true) - Page findAllUsersWithPaginationNative(Pageable pageable); - - @Modifying - @Query("update User u set u.status = :status where u.name = :name") - int updateUserSetStatusForName(@Param("status") Integer status, @Param("name") String name); - - @Modifying - @Query(value = "UPDATE Users u SET u.status = ? WHERE u.name = ?", nativeQuery = true) - int updateUserSetStatusForNameNative(Integer status, String name); - - @Query(value = "INSERT INTO Users (name, age, email, status, active) VALUES (:name, :age, :email, :status, :active)", nativeQuery = true) - @Modifying - void insertUser(@Param("name") String name, @Param("age") Integer age, @Param("email") String email, @Param("status") Integer status, @Param("active") boolean active); - - @Modifying - @Query(value = "UPDATE Users u SET status = ? WHERE u.name = ?", nativeQuery = true) - int updateUserSetStatusForNameNativePostgres(Integer status, String name); - - @Query(value = "SELECT u FROM User u WHERE u.name IN :names") - List findUserByNameList(@Param("names") Collection names); - - void deleteAllByCreationDateAfter(LocalDate date); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query("update User u set u.active = false where u.lastLoginDate < :date") - void deactivateUsersNotLoggedInSince(@Param("date") LocalDate date); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query("delete User u where u.active = false") - int deleteDeactivatedUsers(); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query(value = "alter table USERS add column deleted int(1) not null default 0", nativeQuery = true) - void addDeletedColumn(); -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java deleted file mode 100644 index c586b54027..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.boot.daos.user; - -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.function.Predicate; - -import com.baeldung.boot.domain.User; - -public interface UserRepositoryCustom { - List findUserByEmails(Set emails); - - List findAllUsersByPredicates(Collection> predicates); -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java deleted file mode 100644 index 63a743b6b5..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.baeldung.boot.daos.user; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Path; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import com.baeldung.boot.domain.User; - -public class UserRepositoryCustomImpl implements UserRepositoryCustom { - - @PersistenceContext - private EntityManager entityManager; - - @Override - public List findUserByEmails(Set emails) { - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery query = cb.createQuery(User.class); - Root user = query.from(User.class); - - Path emailPath = user.get("email"); - - List predicates = new ArrayList<>(); - for (String email : emails) { - - predicates.add(cb.like(emailPath, email)); - - } - query.select(user) - .where(cb.or(predicates.toArray(new Predicate[predicates.size()]))); - - return entityManager.createQuery(query) - .getResultList(); - } - - @Override - public List findAllUsersByPredicates(Collection> predicates) { - List allUsers = entityManager.createQuery("select u from User u", User.class).getResultList(); - Stream allUsersStream = allUsers.stream(); - for (java.util.function.Predicate predicate : predicates) { - allUsersStream = allUsersStream.filter(predicate); - } - - return allUsersStream.collect(Collectors.toList()); - } - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Customer.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Customer.java deleted file mode 100644 index af88be0be6..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Customer.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - -/** - * Customer Entity class - * @author ysharma2512 - * - */ -@Entity -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long id; - private String firstName; - private String lastName; - - public Customer(String firstName, String lastName) { - this.firstName = firstName; - this.lastName = lastName; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - @Override - public String toString() { - return String.format("Customer[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName); - } - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Person.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Person.java deleted file mode 100644 index 88894ccc72..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Person.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.Entity; -import javax.persistence.Id; - -@Entity -public class Person { - - @Id - private Long id; - private String firstName; - private String lastName; - - public Person() { - } - - public Person(Long id, String firstName, String lastName) { - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Possession.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Possession.java deleted file mode 100644 index f13491ad82..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/Possession.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.*; -import com.baeldung.boot.domain.Possession; - -@Entity -@Table -public class Possession { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private long id; - - private String name; - - public Possession() { - super(); - } - - public Possession(final String name) { - super(); - - this.name = name; - } - - public long getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = (prime * result) + (int) (id ^ (id >>> 32)); - result = (prime * result) + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final Possession other = (Possession) obj; - if (id != other.id) { - return false; - } - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Possesion [id=").append(id).append(", name=").append(name).append("]"); - return builder.toString(); - } - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/User.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/User.java deleted file mode 100644 index cca00e52a2..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/domain/User.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.*; - -import java.time.LocalDate; -import java.util.List; -import java.util.Objects; - -@Entity -@Table(name = "users") -public class User { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private int id; - private String name; - private LocalDate creationDate; - private LocalDate lastLoginDate; - private boolean active; - private int age; - @Column(unique = true, nullable = false) - private String email; - private Integer status; - @OneToMany - List possessionList; - - public User() { - super(); - } - - public User(String name, LocalDate creationDate,String email, Integer status) { - this.name = name; - this.creationDate = creationDate; - this.email = email; - this.status = status; - this.active = true; - } - - public int getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public String getEmail() { - return email; - } - - public void setEmail(final String email) { - this.email = email; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public int getAge() { - return age; - } - - public void setAge(final int age) { - this.age = age; - } - - public LocalDate getCreationDate() { - return creationDate; - } - - public List getPossessionList() { - return possessionList; - } - - public void setPossessionList(List possessionList) { - this.possessionList = possessionList; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("User [name=").append(name).append(", id=").append(id).append("]"); - return builder.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - User user = (User) o; - return id == user.id && - age == user.age && - Objects.equals(name, user.name) && - Objects.equals(creationDate, user.creationDate) && - Objects.equals(email, user.email) && - Objects.equals(status, user.status); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, creationDate, age, email, status); - } - - public LocalDate getLastLoginDate() { - return lastLoginDate; - } - - public void setLastLoginDate(LocalDate lastLoginDate) { - this.lastLoginDate = lastLoginDate; - } - - public boolean isActive() { - return active; - } - - public void setActive(boolean active) { - this.active = active; - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/CustomPassengerRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/CustomPassengerRepository.java deleted file mode 100644 index 7152286c83..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/CustomPassengerRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.boot.passenger; - -import java.util.List; - -interface CustomPassengerRepository { - - List findOrderedBySeatNumberLimitedTo(int limit); -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/Passenger.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/Passenger.java deleted file mode 100644 index c75107a783..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/Passenger.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.baeldung.boot.passenger; - -import javax.persistence.Basic; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import java.util.Objects; - -@Entity -class Passenger { - - @Id - @GeneratedValue - @Column(nullable = false) - private Long id; - - @Basic(optional = false) - @Column(nullable = false) - private String firstName; - - @Basic(optional = false) - @Column(nullable = false) - private String lastName; - - @Basic(optional = false) - @Column(nullable = false) - private Integer seatNumber; - - private Passenger(String firstName, String lastName, Integer seatNumber) { - this.firstName = firstName; - this.lastName = lastName; - this.seatNumber = seatNumber; - } - - static Passenger from(String firstName, String lastName, Integer seatNumber) { - return new Passenger(firstName, lastName, seatNumber); - } - - @Override - public boolean equals(Object object) { - if (this == object) - return true; - if (object == null || getClass() != object.getClass()) - return false; - Passenger passenger = (Passenger) object; - return getSeatNumber() == passenger.getSeatNumber() && Objects.equals(getFirstName(), passenger.getFirstName()) - && Objects.equals(getLastName(), passenger.getLastName()); - } - - @Override - public int hashCode() { - return Objects.hash(getFirstName(), getLastName(), getSeatNumber()); - } - - @Override - public String toString() { - final StringBuilder toStringBuilder = new StringBuilder(getClass().getSimpleName()); - toStringBuilder.append("{ id=").append(id); - toStringBuilder.append(", firstName='").append(firstName).append('\''); - toStringBuilder.append(", lastName='").append(lastName).append('\''); - toStringBuilder.append(", seatNumber=").append(seatNumber); - toStringBuilder.append('}'); - return toStringBuilder.toString(); - } - - Long getId() { - return id; - } - - String getFirstName() { - return firstName; - } - - String getLastName() { - return lastName; - } - - Integer getSeatNumber() { - return seatNumber; - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java deleted file mode 100644 index 14d5403cb5..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/PassengerRepository.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.boot.passenger; - -import java.util.List; - -import org.springframework.data.domain.Sort; -import org.springframework.data.jpa.repository.JpaRepository; - -interface PassengerRepository extends JpaRepository, CustomPassengerRepository { - - Passenger findFirstByOrderBySeatNumberAsc(); - - Passenger findTopByOrderBySeatNumberAsc(); - - List findByOrderBySeatNumberAsc(); - - List findByFirstNameIgnoreCase(String firstName); - - List findByLastNameOrderBySeatNumberAsc(String lastName); - - List findByLastName(String lastName, Sort sort); - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/PassengerRepositoryImpl.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/PassengerRepositoryImpl.java deleted file mode 100644 index 508c669066..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/passenger/PassengerRepositoryImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.boot.passenger; - -import org.springframework.stereotype.Repository; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import java.util.List; - -@Repository -class PassengerRepositoryImpl implements CustomPassengerRepository { - - @PersistenceContext - private EntityManager entityManager; - - @Override - public List findOrderedBySeatNumberLimitedTo(int limit) { - return entityManager.createQuery("SELECT p FROM Passenger p ORDER BY p.seatNumber", - Passenger.class).setMaxResults(limit).getResultList(); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java deleted file mode 100644 index e13afd9b45..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/boot/web/controllers/CustomerController.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.boot.web.controllers; - -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.List; - -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.boot.daos.CustomerRepository; -import com.baeldung.boot.domain.Customer; - -/** - * A simple controller to test the JPA CrudRepository operations - * controllers - * - * @author ysharma2512 - * - */ -@RestController -public class CustomerController { - - CustomerRepository customerRepository; - - public CustomerController(CustomerRepository customerRepository2) { - this.customerRepository = customerRepository2; - } - - @PostMapping("/customers") - public ResponseEntity> insertCustomers() throws URISyntaxException { - Customer c1 = new Customer("James", "Gosling"); - Customer c2 = new Customer("Doug", "Lea"); - Customer c3 = new Customer("Martin", "Fowler"); - Customer c4 = new Customer("Brian", "Goetz"); - List customers = Arrays.asList(c1, c2, c3, c4); - customerRepository.saveAll(customers); - return ResponseEntity.ok(customers); - } - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/entity/Employee.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/entity/Employee.java deleted file mode 100644 index 4c3dbd25b7..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/entity/Employee.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.entity; - -import javax.persistence.Entity; -import javax.persistence.Id; - -@Entity -public class Employee { - - @Id - private Long id; - private String name; - - public Employee() { - } - - public Employee(Long id, String name) { - this.id = id; - this.name = name; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/model/BasicUser.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/model/BasicUser.java deleted file mode 100644 index 2dc9c18cf6..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/model/BasicUser.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.model; - -import javax.persistence.*; -import java.util.Set; - -@Entity -@Table(name = "users") -public class BasicUser { - - @Id - @GeneratedValue - private Long id; - - private String username; - - @ElementCollection - private Set permissions; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public Set getPermissions() { - return permissions; - } - - public void setPermissions(Set permissions) { - this.permissions = permissions; - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java deleted file mode 100644 index 3b9aa2cc18..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.multipledb; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class MultipleDbApplication { - - public static void main(String[] args) { - SpringApplication.run(MultipleDbApplication.class, args); - } - -} - diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java deleted file mode 100644 index bcf2cd84eb..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.baeldung.multipledb; - -import com.google.common.base.Preconditions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; - -import javax.sql.DataSource; -import java.util.HashMap; - -@Configuration -@PropertySource({"classpath:persistence-multiple-db.properties"}) -@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.product", entityManagerFactoryRef = "productEntityManager", transactionManagerRef = "productTransactionManager") -@Profile("!tc") -public class PersistenceProductConfiguration { - @Autowired - private Environment env; - - public PersistenceProductConfiguration() { - super(); - } - - // - - @Bean - public LocalContainerEntityManagerFactoryBean productEntityManager() { - final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(productDataSource()); - em.setPackagesToScan("com.baeldung.multipledb.model.product"); - - final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - em.setJpaVendorAdapter(vendorAdapter); - final HashMap properties = new HashMap(); - properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); - em.setJpaPropertyMap(properties); - - return em; - } - - @Bean - public DataSource productDataSource() { - final DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("product.jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Bean - public PlatformTransactionManager productTransactionManager() { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(productEntityManager().getObject()); - return transactionManager; - } - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java deleted file mode 100644 index 6ce9bcad45..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.multipledb.dao.product; - -import java.util.List; - -import org.springframework.data.domain.Pageable; -import org.springframework.data.repository.PagingAndSortingRepository; - -import com.baeldung.multipledb.model.product.Product; - -public interface ProductRepository extends PagingAndSortingRepository { - - List findAllByPrice(double price, Pageable pageable); -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/model/product/Product.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/model/product/Product.java deleted file mode 100644 index eaf471043c..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/multipledb/model/product/Product.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.baeldung.multipledb.model.product; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(schema = "products") -public class Product { - - @Id - private int id; - - private String name; - - private double price; - - public Product() { - super(); - } - - private Product(int id, String name, double price) { - super(); - this.id = id; - this.name = name; - this.price = price; - } - - public static Product from(int id, String name, double price) { - return new Product(id, name, price); - } - - public int getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public double getPrice() { - return price; - } - - public void setPrice(final double price) { - this.price = price; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Product [name=") - .append(name) - .append(", id=") - .append(id) - .append("]"); - return builder.toString(); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/EmployeeRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/EmployeeRepository.java deleted file mode 100644 index 8f0a80814b..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/EmployeeRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.entity.Employee; - -public interface EmployeeRepository extends JpaRepository { - -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/UserRepository.java b/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/UserRepository.java deleted file mode 100644 index f683be402f..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/java/com/baeldung/repository/UserRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.model.BasicUser; - -public interface UserRepository extends JpaRepository { - - Optional findSummaryByUsername(String username); - - Optional findByUsername(String username); -} diff --git a/persistence-modules/spring-data-jpa-3/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-3/src/main/resources/application.properties deleted file mode 100644 index f127dd5e50..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/resources/application.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.main.allow-bean-definition-overriding=true - -spring.jpa.properties.hibernate.jdbc.batch_size=4 -spring.jpa.properties.hibernate.order_inserts=true -spring.jpa.properties.hibernate.order_updates=true -spring.jpa.properties.hibernate.generate_statistics=true diff --git a/persistence-modules/spring-data-jpa-3/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa-3/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-3/src/main/resources/persistence-multiple-db.properties b/persistence-modules/spring-data-jpa-3/src/main/resources/persistence-multiple-db.properties deleted file mode 100644 index 75534e8a54..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/main/resources/persistence-multiple-db.properties +++ /dev/null @@ -1,13 +0,0 @@ -# jdbc.X -jdbc.driverClassName=org.h2.Driver -user.jdbc.url=jdbc:h2:mem:spring_jpa_user;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS USERS -product.jdbc.url=jdbc:h2:mem:spring_jpa_product;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS PRODUCTS -jdbc.user=sa -jdbc.pass=sa - -# hibernate.X -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.show_sql=false -hibernate.hbm2ddl.auto=create-drop -hibernate.cache.use_second_level_cache=false -hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringContextTest.java deleted file mode 100644 index eaccf4acba..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringContextTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java deleted file mode 100644 index 27c71c5bcc..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; - -@RunWith(SpringRunner.class) -@DataJpaTest -@ContextConfiguration(classes = Application.class) -public class SpringJpaContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/BatchInsertIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/BatchInsertIntegrationTest.java deleted file mode 100644 index 7ddf36d3f0..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/BatchInsertIntegrationTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.batchinserts; - -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; - -import com.baeldung.boot.Application; -import com.baeldung.boot.daos.CustomerRepository; -import com.baeldung.boot.web.controllers.CustomerController; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes=Application.class) -@AutoConfigureMockMvc -public class BatchInsertIntegrationTest { - - @Autowired - private CustomerRepository customerRepository; - private MockMvc mockMvc; - @Before - public void setUp() throws Exception { - mockMvc = MockMvcBuilders.standaloneSetup( new CustomerController(customerRepository)) - .build(); - } - - @Test - public void whenInsertingCustomers_thenCustomersAreCreated() throws Exception { - this.mockMvc.perform(post("/customers")) - .andExpect(status().isOk()); - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/JpaBatchInsertsIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/JpaBatchInsertsIntegrationTest.java deleted file mode 100644 index 311f227322..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/JpaBatchInsertsIntegrationTest.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.baeldung.batchinserts; - -import static com.baeldung.batchinserts.TestObjectHelper.createSchool; -import static com.baeldung.batchinserts.TestObjectHelper.createStudent; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.TypedQuery; - -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.batchinserts.model.School; -import com.baeldung.batchinserts.model.Student; -import com.baeldung.boot.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@Transactional -@ActiveProfiles("batchinserts") -public class JpaBatchInsertsIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - private static final int BATCH_SIZE = 5; - - @Transactional - @Test - public void whenInsertingSingleTypeOfEntity_thenCreatesSingleBatch() { - for (int i = 0; i < 10; i++) { - School school = createSchool(i); - entityManager.persist(school); - } - } - - @Transactional - @Test - public void whenFlushingAfterBatch_ThenClearsMemory() { - for (int i = 0; i < 10; i++) { - if (i > 0 && i % BATCH_SIZE == 0) { - entityManager.flush(); - entityManager.clear(); - } - - School school = createSchool(i); - entityManager.persist(school); - } - } - - @Transactional - @Test - public void whenThereAreMultipleEntities_ThenCreatesNewBatch() { - for (int i = 0; i < 10; i++) { - if (i > 0 && i % BATCH_SIZE == 0) { - entityManager.flush(); - entityManager.clear(); - } - - School school = createSchool(i); - entityManager.persist(school); - Student firstStudent = createStudent(school); - Student secondStudent = createStudent(school); - entityManager.persist(firstStudent); - entityManager.persist(secondStudent); - } - } - - @Transactional - @Test - public void whenUpdatingEntities_thenCreatesBatch() { - for (int i = 0; i < 10; i++) { - School school = createSchool(i); - entityManager.persist(school); - } - - entityManager.flush(); - - TypedQuery schoolQuery = entityManager.createQuery("SELECT s from School s", School.class); - List allSchools = schoolQuery.getResultList(); - - for (School school : allSchools) { - school.setName("Updated_" + school.getName()); - } - } - - @After - public void tearDown() { - entityManager.flush(); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/JpaNoBatchInsertsIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/JpaNoBatchInsertsIntegrationTest.java deleted file mode 100644 index 75b3f1f3aa..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/JpaNoBatchInsertsIntegrationTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.batchinserts; - -import static com.baeldung.batchinserts.TestObjectHelper.createSchool; - -import com.baeldung.batchinserts.model.School; -import com.baeldung.boot.Application; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@Transactional -@ActiveProfiles("batchinserts") -@TestPropertySource(properties = "spring.jpa.properties.hibernate.jdbc.batch_size=-1") -public class JpaNoBatchInsertsIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Test - public void whenNotConfigured_ThenSendsInsertsSeparately() { - for (int i = 0; i < 10; i++) { - School school = createSchool(i); - entityManager.persist(school); - } - } - - @After - public void tearDown() { - entityManager.flush(); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/TestObjectHelper.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/TestObjectHelper.java deleted file mode 100644 index fcd26cb721..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/batchinserts/TestObjectHelper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.batchinserts; - -import com.baeldung.batchinserts.model.School; -import com.baeldung.batchinserts.model.Student; - -public class TestObjectHelper { - - public static School createSchool(int nameIdentifier) { - School school = new School(); - school.setName("School" + (nameIdentifier + 1)); - return school; - } - - public static Student createStudent(School school) { - Student student = new Student(); - student.setName("Student-" + school.getName()); - student.setSchool(school); - return student; - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/PersonInsertRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/PersonInsertRepositoryIntegrationTest.java deleted file mode 100644 index 9d45c17035..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/PersonInsertRepositoryIntegrationTest.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.baeldung.boot.daos; - -import com.baeldung.boot.daos.impl.PersonInsertRepository; -import com.baeldung.boot.domain.Person; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.persistence.EntityExistsException; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceException; - -import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -@RunWith(SpringRunner.class) -@DataJpaTest -@Import(PersonInsertRepository.class) -public class PersonInsertRepositoryIntegrationTest { - - private static final Long ID = 1L; - private static final String FIRST_NAME = "firstname"; - private static final String LAST_NAME = "lastname"; - private static final Person PERSON = new Person(ID, FIRST_NAME, LAST_NAME); - - @Autowired - private PersonInsertRepository personInsertRepository; - - @Autowired - private EntityManager entityManager; - - @Test - public void givenPersonEntity_whenInsertWithNativeQuery_ThenPersonIsPersisted() { - insertWithQuery(); - - assertPersonPersisted(); - } - - @Test - public void givenPersonEntity_whenInsertedTwiceWithNativeQuery_thenPersistenceExceptionExceptionIsThrown() { - assertThatExceptionOfType(PersistenceException.class).isThrownBy(() -> { - insertWithQuery(); - insertWithQuery(); - }); - } - - @Test - public void givenPersonEntity_whenInsertWithEntityManager_thenPersonIsPersisted() { - insertPersonWithEntityManager(); - - assertPersonPersisted(); - } - - @Test - public void givenPersonEntity_whenInsertedTwiceWithEntityManager_thenEntityExistsExceptionIsThrown() { - assertThatExceptionOfType(EntityExistsException.class).isThrownBy(() -> { - insertPersonWithEntityManager(); - insertPersonWithEntityManager(); - }); - } - - private void insertWithQuery() { - personInsertRepository.insertWithQuery(PERSON); - } - - private void insertPersonWithEntityManager() { - personInsertRepository.insertWithEntityManager(new Person(ID, FIRST_NAME, LAST_NAME)); - } - - private void assertPersonPersisted() { - Person person = entityManager.find(Person.class, ID); - - assertThat(person).isNotNull(); - assertThat(person.getId()).isEqualTo(PERSON.getId()); - assertThat(person.getFirstName()).isEqualTo(PERSON.getFirstName()); - assertThat(person.getLastName()).isEqualTo(PERSON.getLastName()); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java deleted file mode 100644 index b2581b8034..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java +++ /dev/null @@ -1,545 +0,0 @@ -package com.baeldung.boot.daos; - -import org.junit.After; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort; -import org.springframework.data.jpa.domain.JpaSort; -import org.springframework.data.mapping.PropertyReferenceException; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.boot.daos.user.UserRepository; -import com.baeldung.boot.domain.User; - -import javax.persistence.EntityManager; -import javax.persistence.Query; -import java.time.LocalDate; -import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.*; - -public class UserRepositoryCommon { - - final String USER_EMAIL = "email@example.com"; - final String USER_EMAIL2 = "email2@example.com"; - final String USER_EMAIL3 = "email3@example.com"; - final String USER_EMAIL4 = "email4@example.com"; - final Integer INACTIVE_STATUS = 0; - final Integer ACTIVE_STATUS = 1; - final String USER_EMAIL5 = "email5@example.com"; - final String USER_EMAIL6 = "email6@example.com"; - final String USER_NAME_ADAM = "Adam"; - final String USER_NAME_PETER = "Peter"; - - @Autowired - protected UserRepository userRepository; - @Autowired - private EntityManager entityManager; - - @Test - @Transactional - public void givenUsersWithSameNameInDB_WhenFindAllByName_ThenReturnStreamOfUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - userRepository.save(user3); - - User user4 = new User(); - user4.setName("SAMPLE"); - user4.setEmail(USER_EMAIL4); - userRepository.save(user4); - - try (Stream foundUsersStream = userRepository.findAllByName(USER_NAME_ADAM)) { - assertThat(foundUsersStream.count()).isEqualTo(3l); - } - } - - @Test - public void givenUsersInDB_WhenFindAllWithQueryAnnotation_ThenReturnCollectionWithActiveUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - user1.setStatus(ACTIVE_STATUS); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - user3.setStatus(INACTIVE_STATUS); - userRepository.save(user3); - - Collection allActiveUsers = userRepository.findAllActiveUsers(); - - assertThat(allActiveUsers.size()).isEqualTo(2); - } - - @Test - public void givenUsersInDB_WhenFindAllWithQueryAnnotationNative_ThenReturnCollectionWithActiveUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - user1.setStatus(ACTIVE_STATUS); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - user3.setStatus(INACTIVE_STATUS); - userRepository.save(user3); - - Collection allActiveUsers = userRepository.findAllActiveUsersNative(); - - assertThat(allActiveUsers.size()).isEqualTo(2); - } - - @Test - public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotation_ThenReturnActiveUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByStatus(ACTIVE_STATUS); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotationNative_ThenReturnActiveUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByStatusNative(ACTIVE_STATUS); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationIndexedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndName(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndNameNamedParams(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNativeNamedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndNameNamedParamsNative(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParamsCustomNames_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByUserStatusAndUserName(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationIndexedParams_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLike("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNamedParams_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLikeNamedParam("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNative_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLikeNative("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllWithSortByName_ThenReturnUsersSorted() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - List usersSortByName = userRepository.findAll(Sort.by(Sort.Direction.ASC, "name")); - - assertThat(usersSortByName.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test(expected = PropertyReferenceException.class) - public void givenUsersInDB_WhenFindAllSortWithFunction_ThenThrowException() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - userRepository.findAll(Sort.by(Sort.Direction.ASC, "name")); - - List usersSortByNameLength = userRepository.findAll(Sort.by("LENGTH(name)")); - - assertThat(usersSortByNameLength.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllSortWithFunctionQueryAnnotationJPQL_ThenReturnUsersSorted() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - userRepository.findAllUsers(Sort.by("name")); - - List usersSortByNameLength = userRepository.findAllUsers(JpaSort.unsafe("LENGTH(name)")); - - assertThat(usersSortByNameLength.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationJPQL_ThenReturnPageOfUsers() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL4, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE2", LocalDate.now(), USER_EMAIL5, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL6, INACTIVE_STATUS)); - - Page usersPage = userRepository.findAllUsersWithPagination(PageRequest.of(1, 3)); - - assertThat(usersPage.getContent() - .get(0) - .getName()).isEqualTo("SAMPLE1"); - } - - @Test - public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationNative_ThenReturnPageOfUsers() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL4, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE2", LocalDate.now(), USER_EMAIL5, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL6, INACTIVE_STATUS)); - - Page usersSortByNameLength = userRepository.findAllUsersWithPaginationNative(PageRequest.of(1, 3)); - - assertThat(usersSortByNameLength.getContent() - .get(0) - .getName()).isEqualTo(USER_NAME_PETER); - } - - @Test - @Transactional - public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationJPQL_ThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - - int updatedUsersSize = userRepository.updateUserSetStatusForName(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } - - @Test - public void givenUsersInDB_WhenFindByEmailsWithDynamicQuery_ThenReturnCollection() { - - User user1 = new User(); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - User user3 = new User(); - user3.setEmail(USER_EMAIL3); - userRepository.save(user3); - - Set emails = new HashSet<>(); - emails.add(USER_EMAIL2); - emails.add(USER_EMAIL3); - - Collection usersWithEmails = userRepository.findUserByEmails(emails); - - assertThat(usersWithEmails.size()).isEqualTo(2); - } - - @Test - public void givenUsersInDBWhenFindByNameListReturnCollection() { - - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - List names = Arrays.asList(USER_NAME_ADAM, USER_NAME_PETER); - - List usersWithNames = userRepository.findUserByNameList(names); - - assertThat(usersWithNames.size()).isEqualTo(2); - } - - - @Test - @Transactional - public void whenInsertedWithQuery_ThenUserIsPersisted() { - userRepository.insertUser(USER_NAME_ADAM, 1, USER_EMAIL, ACTIVE_STATUS, true); - userRepository.insertUser(USER_NAME_PETER, 1, USER_EMAIL2, ACTIVE_STATUS, true); - - User userAdam = userRepository.findUserByNameLike(USER_NAME_ADAM); - User userPeter = userRepository.findUserByNameLike(USER_NAME_PETER); - - assertThat(userAdam).isNotNull(); - assertThat(userAdam.getEmail()).isEqualTo(USER_EMAIL); - assertThat(userPeter).isNotNull(); - assertThat(userPeter.getEmail()).isEqualTo(USER_EMAIL2); - } - - - @Test - @Transactional - public void givenTwoUsers_whenFindByNameUsr01_ThenUserUsr01() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - try (Stream users = userRepository.findAllByName("usr01")) { - assertTrue(users.allMatch(usr -> usr.equals(usr01))); - } - } - - @Test - @Transactional - public void givenTwoUsers_whenFindByNameUsr00_ThenNoUsers() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - try (Stream users = userRepository.findAllByName("usr00")) { - assertEquals(0, users.count()); - } - } - - @Test - public void givenTwoUsers_whenFindUsersWithGmailAddress_ThenUserUsr02() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@gmail.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - List users = userRepository.findUsersWithGmailAddress(); - assertEquals(1, users.size()); - assertEquals(usr02, users.get(0)); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeleteAllByCreationDateAfter_ThenOneUserRemains() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.deleteAllByCreationDateAfter(LocalDate.of(2018, 5, 1)); - - List users = userRepository.findAll(); - - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - } - - @Test - public void givenTwoUsers_whenFindAllUsersByPredicates_ThenUserUsr01() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - List> predicates = new ArrayList<>(); - predicates.add(usr -> usr.getCreationDate().isAfter(LocalDate.of(2017, 12, 31))); - predicates.add(usr -> usr.getEmail().endsWith(".com")); - - List users = userRepository.findAllUsersByPredicates(predicates); - - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeactivateUsersNotLoggedInSince_ThenUserUsr02Deactivated() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.deactivateUsersNotLoggedInSince(LocalDate.of(2018, 8, 1)); - - List users = userRepository.findAllUsers(Sort.by(Sort.Order.asc("name"))); - assertTrue(users.get(0).isActive()); - assertFalse(users.get(1).isActive()); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeleteDeactivatedUsers_ThenUserUsr02Deleted() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.com", 0); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - usr02.setActive(false); - - userRepository.save(usr01); - userRepository.save(usr02); - - int deletedUsersCount = userRepository.deleteDeactivatedUsers(); - - List users = userRepository.findAll(); - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - assertEquals(1, deletedUsersCount); - } - - @Test - @Transactional - public void givenTwoUsers_whenAddDeletedColumn_ThenUsersHaveDeletedColumn() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - usr02.setActive(false); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.addDeletedColumn(); - - Query nativeQuery = entityManager.createNativeQuery("select deleted from USERS where NAME = 'usr01'"); - assertEquals(0, nativeQuery.getResultList().get(0)); - } - - @After - public void cleanUp() { - userRepository.deleteAll(); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java deleted file mode 100644 index 99eabc8271..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.baeldung.boot.daos; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.User; -import com.baeldung.util.BaeldungPostgresqlContainer; -import org.junit.ClassRule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; -import org.testcontainers.containers.PostgreSQLContainer; - -import java.time.LocalDate; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Created by adam. - */ -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@ActiveProfiles({"tc", "tc-auto"}) -public class UserRepositoryTCAutoLiveTest extends UserRepositoryCommon { - - @ClassRule - public static PostgreSQLContainer postgreSQLContainer = BaeldungPostgresqlContainer.getInstance(); - - @Test - @Transactional - public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationNativePostgres_ThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - userRepository.flush(); - - int updatedUsersSize = userRepository.updateUserSetStatusForNameNativePostgres(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java deleted file mode 100644 index be8843c166..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baeldung.boot.daos; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.User; -import org.junit.ClassRule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.util.TestPropertyValues; -import org.springframework.context.ApplicationContextInitializer; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; -import org.testcontainers.containers.PostgreSQLContainer; - -import java.time.LocalDate; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@ActiveProfiles("tc") -@ContextConfiguration(initializers = {UserRepositoryTCLiveTest.Initializer.class}) -public class UserRepositoryTCLiveTest extends UserRepositoryCommon { - - @ClassRule - public static PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer("postgres:11.1") - .withDatabaseName("integration-tests-db") - .withUsername("sa") - .withPassword("sa"); - - @Test - @Transactional - public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationNative_ThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - userRepository.flush(); - - int updatedUsersSize = userRepository.updateUserSetStatusForNameNativePostgres(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } - - static class Initializer - implements ApplicationContextInitializer { - public void initialize(ConfigurableApplicationContext configurableApplicationContext) { - TestPropertyValues.of( - "spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(), - "spring.datasource.username=" + postgreSQLContainer.getUsername(), - "spring.datasource.password=" + postgreSQLContainer.getPassword() - ).applyTo(configurableApplicationContext.getEnvironment()); - } - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/passenger/PassengerRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/passenger/PassengerRepositoryIntegrationTest.java deleted file mode 100644 index f082350019..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/boot/passenger/PassengerRepositoryIntegrationTest.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.baeldung.boot.passenger; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.data.domain.Example; -import org.springframework.data.domain.ExampleMatcher; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.passenger.Passenger; -import com.baeldung.boot.passenger.PassengerRepository; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import java.util.List; -import java.util.Optional; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.core.IsNot.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - - -@DataJpaTest -@RunWith(SpringRunner.class) -public class PassengerRepositoryIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - @Autowired - private PassengerRepository repository; - - @Before - public void before() { - entityManager.persist(Passenger.from("Jill", "Smith", 50)); - entityManager.persist(Passenger.from("Eve", "Jackson", 95)); - entityManager.persist(Passenger.from("Fred", "Bloggs", 22)); - entityManager.persist(Passenger.from("Ricki", "Bobbie", 36)); - entityManager.persist(Passenger.from("Siya", "Kolisi", 85)); - } - - @Test - public void givenSeveralPassengersWhenOrderedBySeatNumberLimitedToThenThePassengerInTheFirstFilledSeatIsReturned() { - Passenger expected = Passenger.from("Fred", "Bloggs", 22); - - List passengers = repository.findOrderedBySeatNumberLimitedTo(1); - - assertEquals(1, passengers.size()); - - Passenger actual = passengers.get(0); - assertEquals(expected, actual); - } - - @Test - public void givenSeveralPassengersWhenFindFirstByOrderBySeatNumberAscThenThePassengerInTheFirstFilledSeatIsReturned() { - Passenger expected = Passenger.from("Fred", "Bloggs", 22); - - Passenger actual = repository.findFirstByOrderBySeatNumberAsc(); - - assertEquals(expected, actual); - } - - @Test - public void givenSeveralPassengersWhenFindPageSortedByThenThePassengerInTheFirstFilledSeatIsReturned() { - Passenger expected = Passenger.from("Fred", "Bloggs", 22); - - Page page = repository.findAll(PageRequest.of(0, 1, - Sort.by(Sort.Direction.ASC, "seatNumber"))); - - assertEquals(1, page.getContent().size()); - - Passenger actual = page.getContent().get(0); - assertEquals(expected, actual); - } - - @Test - public void givenPassengers_whenOrderedBySeatNumberAsc_thenCorrectOrder() { - Passenger fred = Passenger.from("Fred", "Bloggs", 22); - Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); - Passenger jill = Passenger.from("Jill", "Smith", 50); - Passenger siya = Passenger.from("Siya", "Kolisi", 85); - Passenger eve = Passenger.from("Eve", "Jackson", 95); - - List passengers = repository.findByOrderBySeatNumberAsc(); - - assertThat(passengers, contains(fred, ricki, jill, siya, eve)); - } - - @Test - public void givenPassengers_whenFindAllWithSortBySeatNumberAsc_thenCorrectOrder() { - Passenger fred = Passenger.from("Fred", "Bloggs", 22); - Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); - Passenger jill = Passenger.from("Jill", "Smith", 50); - Passenger siya = Passenger.from("Siya", "Kolisi", 85); - Passenger eve = Passenger.from("Eve", "Jackson", 95); - - List passengers = repository.findAll(Sort.by(Sort.Direction.ASC, "seatNumber")); - - assertThat(passengers, contains(fred, ricki, jill, siya, eve)); - } - - @Test - public void givenPassengers_whenFindByExampleDefaultMatcher_thenExpectedReturned() { - Example example = Example.of(Passenger.from("Fred", "Bloggs", null)); - - Optional actual = repository.findOne(example); - - assertTrue(actual.isPresent()); - assertEquals(Passenger.from("Fred", "Bloggs", 22), actual.get()); - } - - @Test - public void givenPassengers_whenFindByExampleCaseInsensitiveMatcher_thenExpectedReturned() { - ExampleMatcher caseInsensitiveExampleMatcher = ExampleMatcher.matchingAll().withIgnoreCase(); - Example example = Example.of(Passenger.from("fred", "bloggs", null), - caseInsensitiveExampleMatcher); - - Optional actual = repository.findOne(example); - - assertTrue(actual.isPresent()); - assertEquals(Passenger.from("Fred", "Bloggs", 22), actual.get()); - } - - @Test - public void givenPassengers_whenFindByExampleCustomMatcher_thenExpectedReturned() { - Passenger jill = Passenger.from("Jill", "Smith", 50); - Passenger eve = Passenger.from("Eve", "Jackson", 95); - Passenger fred = Passenger.from("Fred", "Bloggs", 22); - Passenger siya = Passenger.from("Siya", "Kolisi", 85); - Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); - - ExampleMatcher customExampleMatcher = ExampleMatcher.matchingAny().withMatcher("firstName", - ExampleMatcher.GenericPropertyMatchers.contains().ignoreCase()).withMatcher("lastName", - ExampleMatcher.GenericPropertyMatchers.contains().ignoreCase()); - - Example example = Example.of(Passenger.from("e", "s", null), - customExampleMatcher); - - List passengers = repository.findAll(example); - - assertThat(passengers, contains(jill, eve, fred, siya)); - assertThat(passengers, not(contains(ricki))); - } - - @Test - public void givenPassengers_whenFindByIgnoringMatcher_thenExpectedReturned() { - Passenger jill = Passenger.from("Jill", "Smith", 50); - Passenger eve = Passenger.from("Eve", "Jackson", 95); - Passenger fred = Passenger.from("Fred", "Bloggs", 22); - Passenger siya = Passenger.from("Siya", "Kolisi", 85); - Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); - - ExampleMatcher ignoringExampleMatcher = ExampleMatcher.matchingAny().withMatcher("lastName", - ExampleMatcher.GenericPropertyMatchers.startsWith().ignoreCase()).withIgnorePaths("firstName", "seatNumber"); - - Example example = Example.of(Passenger.from(null, "b", null), - ignoringExampleMatcher); - - List passengers = repository.findAll(example); - - assertThat(passengers, contains(fred, ricki)); - assertThat(passengers, not(contains(jill))); - assertThat(passengers, not(contains(eve))); - assertThat(passengers, not(contains(siya))); - } - - @Test - public void givenPassengers_whenMatchingIgnoreCase_thenExpectedReturned() { - Passenger jill = Passenger.from("Jill", "Smith", 50); - Passenger eve = Passenger.from("Eve", "Jackson", 95); - Passenger fred = Passenger.from("Fred", "Bloggs", 22); - Passenger siya = Passenger.from("Siya", "Kolisi", 85); - Passenger ricki = Passenger.from("Ricki", "Bobbie", 36); - - List passengers = repository.findByFirstNameIgnoreCase("FRED"); - - assertThat(passengers, contains(fred)); - assertThat(passengers, not(contains(eve))); - assertThat(passengers, not(contains(siya))); - assertThat(passengers, not(contains(jill))); - assertThat(passengers, not(contains(ricki))); - - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java deleted file mode 100644 index 831790af95..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.baeldung.multipledb; - -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Pageable; -import org.springframework.data.domain.Sort; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.multipledb.dao.product.ProductRepository; -import com.baeldung.multipledb.model.product.Product; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes=MultipleDbApplication.class) -@EnableTransactionManagement -public class ProductRepositoryIntegrationTest { - - @Autowired - private ProductRepository productRepository; - - @Before - @Transactional("productTransactionManager") - public void setUp() { - productRepository.save(Product.from(1001, "Book", 21)); - productRepository.save(Product.from(1002, "Coffee", 10)); - productRepository.save(Product.from(1003, "Jeans", 30)); - productRepository.save(Product.from(1004, "Shirt", 32)); - productRepository.save(Product.from(1005, "Bacon", 10)); - } - - @Test - public void whenRequestingFirstPageOfSizeTwo_ThenReturnFirstPage() { - Pageable pageRequest = PageRequest.of(0, 2); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(2)); - assertTrue(result.stream() - .map(Product::getId) - .allMatch(id -> Arrays.asList(1001, 1002) - .contains(id))); - } - - @Test - public void whenRequestingSecondPageOfSizeTwo_ThenReturnSecondPage() { - Pageable pageRequest = PageRequest.of(1, 2); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(2)); - assertTrue(result.stream() - .map(Product::getId) - .allMatch(id -> Arrays.asList(1003, 1004) - .contains(id))); - } - - @Test - public void whenRequestingLastPage_ThenReturnLastPageWithRemData() { - Pageable pageRequest = PageRequest.of(2, 2); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(1)); - assertTrue(result.stream() - .map(Product::getId) - .allMatch(id -> Arrays.asList(1005) - .contains(id))); - } - - @Test - public void whenSortingByNameAscAndPaging_ThenReturnSortedPagedResult() { - Pageable pageRequest = PageRequest.of(0, 3, Sort.by("name")); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(3)); - assertThat(result.getContent() - .stream() - .map(Product::getId) - .collect(Collectors.toList()), equalTo(Arrays.asList(1005, 1001, 1002))); - - } - - @Test - public void whenSortingByPriceDescAndPaging_ThenReturnSortedPagedResult() { - Pageable pageRequest = PageRequest.of(0, 3, Sort.by("price") - .descending()); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(3)); - assertThat(result.getContent() - .stream() - .map(Product::getId) - .collect(Collectors.toList()), equalTo(Arrays.asList(1004, 1003, 1001))); - - } - - @Test - public void whenSortingByPriceDescAndNameAscAndPaging_ThenReturnSortedPagedResult() { - Pageable pageRequest = PageRequest.of(0, 5, Sort.by("price") - .descending() - .and(Sort.by("name"))); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(5)); - assertThat(result.getContent() - .stream() - .map(Product::getId) - .collect(Collectors.toList()), equalTo(Arrays.asList(1004, 1003, 1001, 1005, 1002))); - - } - - @Test - public void whenRequestingFirstPageOfSizeTwoUsingCustomMethod_ThenReturnFirstPage() { - Pageable pageRequest = PageRequest.of(0, 2); - - List result = productRepository.findAllByPrice(10, pageRequest); - - assertThat(result, hasSize(2)); - assertTrue(result.stream() - .map(Product::getId) - .allMatch(id -> Arrays.asList(1002, 1005) - .contains(id))); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/repository/EmployeeRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/repository/EmployeeRepositoryIntegrationTest.java deleted file mode 100644 index 0fc9918701..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/repository/EmployeeRepositoryIntegrationTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.repository; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; -import com.baeldung.entity.Employee; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class EmployeeRepositoryIntegrationTest { - - private static final Employee EMPLOYEE1 = new Employee(1L, "John"); - private static final Employee EMPLOYEE2 = new Employee(2L, "Alice"); - - @Autowired - private EmployeeRepository employeeRepository; - - @Test - public void givenEmployeeEntity_whenInsertWithSave_ThenEmployeeIsPersisted() { - employeeRepository.save(EMPLOYEE1); - assertEmployeePersisted(EMPLOYEE1); - } - - @Test - public void givenEmployeeEntity_whenInsertWithSaveAndFlush_ThenEmployeeIsPersisted() { - employeeRepository.saveAndFlush(EMPLOYEE2); - assertEmployeePersisted(EMPLOYEE2); - } - - private void assertEmployeePersisted(Employee input) { - Employee employee = employeeRepository.getOne(input.getId()); - assertThat(employee).isNotNull(); - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java b/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java deleted file mode 100644 index e5ad2dd448..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.util; - -import org.testcontainers.containers.PostgreSQLContainer; - -public class BaeldungPostgresqlContainer extends PostgreSQLContainer { - - private static final String IMAGE_VERSION = "postgres:11.1"; - - private static BaeldungPostgresqlContainer container; - - - private BaeldungPostgresqlContainer() { - super(IMAGE_VERSION); - } - - public static BaeldungPostgresqlContainer getInstance() { - if (container == null) { - container = new BaeldungPostgresqlContainer(); - } - return container; - } - - @Override - public void start() { - super.start(); - System.setProperty("DB_URL", container.getJdbcUrl()); - System.setProperty("DB_USERNAME", container.getUsername()); - System.setProperty("DB_PASSWORD", container.getPassword()); - } - - @Override - public void stop() { - //do nothing, JVM handles shut down - } -} diff --git a/persistence-modules/spring-data-jpa-3/src/test/resources/application-batchinserts.properties b/persistence-modules/spring-data-jpa-3/src/test/resources/application-batchinserts.properties deleted file mode 100644 index 4141f5668e..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/resources/application-batchinserts.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.jpa.show-sql=false - -spring.jpa.properties.hibernate.jdbc.batch_size=5 -spring.jpa.properties.hibernate.order_inserts=true -spring.jpa.properties.hibernate.order_updates=true -spring.jpa.properties.hibernate.batch_versioned_data=true \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-3/src/test/resources/application-tc-auto.properties b/persistence-modules/spring-data-jpa-3/src/test/resources/application-tc-auto.properties deleted file mode 100644 index c3005d861f..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/resources/application-tc-auto.properties +++ /dev/null @@ -1,4 +0,0 @@ -# configuration for test containers testing -spring.datasource.url=${DB_URL} -spring.datasource.username=${DB_USERNAME} -spring.datasource.password=${DB_PASSWORD} diff --git a/persistence-modules/spring-data-jpa-3/src/test/resources/application-tc.properties b/persistence-modules/spring-data-jpa-3/src/test/resources/application-tc.properties deleted file mode 100644 index 3bf8693d53..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/resources/application-tc.properties +++ /dev/null @@ -1,4 +0,0 @@ -# configuration for Test Containers testing -spring.datasource.driver-class-name=org.postgresql.Driver -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false diff --git a/persistence-modules/spring-data-jpa-3/src/test/resources/application-test.properties b/persistence-modules/spring-data-jpa-3/src/test/resources/application-test.properties deleted file mode 100644 index f9497c8f37..0000000000 --- a/persistence-modules/spring-data-jpa-3/src/test/resources/application-test.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.jpa.hibernate.ddl-auto=update -spring.datasource.url=jdbc:h2:mem:jpa3 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/README.md b/persistence-modules/spring-data-jpa-4/README.md deleted file mode 100644 index 085dfcb366..0000000000 --- a/persistence-modules/spring-data-jpa-4/README.md +++ /dev/null @@ -1,18 +0,0 @@ -### Relevant Articles: -- [Derived Query Methods in Spring Data JPA Repositories](https://www.baeldung.com/spring-data-derived-queries) -- [LIKE Queries in Spring JPA Repositories](https://www.baeldung.com/spring-jpa-like-queries) -- [A Guide to Spring’s Open Session In View](https://www.baeldung.com/spring-open-session-in-view) -- [Programmatic Transaction Management in Spring](https://www.baeldung.com/spring-programmatic-transaction-management) -- [JPA Entity Lifecycle Events](https://www.baeldung.com/jpa-entity-lifecycle-events) -- [Working with Lazy Element Collections in JPA](https://www.baeldung.com/java-jpa-lazy-collections) -- [Calling Stored Procedures from Spring Data JPA Repositories](https://www.baeldung.com/spring-data-jpa-stored-procedures) -- [Custom Naming Convention with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-custom-naming) - -### Eclipse Config -After importing the project into Eclipse, you may see the following error: -"No persistence xml file found in project" - -This can be ignored: -- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" -Or: -- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator diff --git a/persistence-modules/spring-data-jpa-4/create.sql b/persistence-modules/spring-data-jpa-4/create.sql deleted file mode 100644 index 1bbe1640a7..0000000000 --- a/persistence-modules/spring-data-jpa-4/create.sql +++ /dev/null @@ -1,2 +0,0 @@ -create table PERSON (ID int8 not null, FIRST_NAME varchar(255), LAST_NAME varchar(255), primary key (ID)) -create table person (id int8 not null, first_name varchar(255), last_name varchar(255), primary key (id)) diff --git a/persistence-modules/spring-data-jpa-4/pom.xml b/persistence-modules/spring-data-jpa-4/pom.xml deleted file mode 100644 index 71fc21527f..0000000000 --- a/persistence-modules/spring-data-jpa-4/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - spring-data-jpa-4 - spring-data-jpa-4 - - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - org.springframework.boot - spring-boot-starter-data-jdbc - - - - mysql - mysql-connector-java - - - - org.postgresql - postgresql - - - - com.h2database - h2 - - - - \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/QueryApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/QueryApplication.java deleted file mode 100644 index d7a1950305..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/QueryApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.derivedquery; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class QueryApplication { - - public static void main(String[] args) { - SpringApplication.run(QueryApplication.class, args); - } - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/entity/User.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/entity/User.java deleted file mode 100644 index 49e824f09f..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/entity/User.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.baeldung.derivedquery.entity; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; -import java.time.ZonedDateTime; - -@Table(name = "users") -@Entity -public class User { - - @Id - @GeneratedValue - private Integer id; - private String name; - private Integer age; - private ZonedDateTime birthDate; - private Boolean active; - - public User() { - } - - public User(String name, Integer age, ZonedDateTime birthDate, Boolean active) { - this.name = name; - this.age = age; - this.birthDate = birthDate; - this.active = active; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Integer getAge() { - return age; - } - - public void setAge(Integer age) { - this.age = age; - } - - public ZonedDateTime getBirthDate() { - return birthDate; - } - - public void setBirthDate(ZonedDateTime birthDate) { - this.birthDate = birthDate; - } - - public Boolean getActive() { - return active; - } - - public void setActive(Boolean active) { - this.active = active; - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/repository/UserRepository.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/repository/UserRepository.java deleted file mode 100644 index e613ee1531..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/derivedquery/repository/UserRepository.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.baeldung.derivedquery.repository; - -import com.baeldung.derivedquery.entity.User; -import org.springframework.data.jpa.repository.JpaRepository; - -import java.time.ZonedDateTime; -import java.util.Collection; -import java.util.List; - -public interface UserRepository extends JpaRepository { - - List findByName(String name); - - List findByNameIs(String name); - - List findByNameEquals(String name); - - List findByNameIsNull(); - - List findByNameNot(String name); - - List findByNameIsNot(String name); - - List findByNameStartingWith(String name); - - List findByNameEndingWith(String name); - - List findByNameContaining(String name); - - List findByNameLike(String name); - - List findByAgeLessThan(Integer age); - - List findByAgeLessThanEqual(Integer age); - - List findByAgeGreaterThan(Integer age); - - List findByAgeGreaterThanEqual(Integer age); - - List findByAgeBetween(Integer startAge, Integer endAge); - - List findByBirthDateAfter(ZonedDateTime birthDate); - - List findByBirthDateBefore(ZonedDateTime birthDate); - - List findByActiveTrue(); - - List findByActiveFalse(); - - List findByAgeIn(Collection ages); - - List findByNameOrBirthDate(String name, ZonedDateTime birthDate); - - List findByNameOrBirthDateAndActive(String name, ZonedDateTime birthDate, Boolean active); - - List findByNameOrderByName(String name); - - List findByNameOrderByNameDesc(String name); - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/ElementCollectionApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/ElementCollectionApplication.java deleted file mode 100644 index 3f152a6ffc..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/ElementCollectionApplication.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.elementcollection; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class ElementCollectionApplication { - public static void main(String[] args) { - SpringApplication.run(ElementCollectionApplication.class, args); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/model/Employee.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/model/Employee.java deleted file mode 100644 index 8b98164d63..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/model/Employee.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.baeldung.elementcollection.model; - -import javax.persistence.*; -import java.util.List; -import java.util.Objects; - -@Entity -public class Employee { - @Id - private int id; - private String name; - @ElementCollection - @CollectionTable(name = "employee_phone", joinColumns = @JoinColumn(name = "employee_id")) - private List phones; - - public Employee() { - } - - public Employee(int id) { - this.id = id; - } - - public Employee(int id, String name) { - this.id = id; - this.name = name; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getPhones() { - return phones; - } - - public void setPhones(List phones) { - this.phones = phones; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Employee)) { - return false; - } - Employee user = (Employee) o; - return getId() == user.getId(); - } - - @Override - public int hashCode() { - return Objects.hash(getId()); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/model/Phone.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/model/Phone.java deleted file mode 100644 index d73d30c47a..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/model/Phone.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.baeldung.elementcollection.model; - -import javax.persistence.Embeddable; -import java.util.Objects; - -@Embeddable -public class Phone { - private String type; - private String areaCode; - private String number; - - public Phone() { - } - - public Phone(String type, String areaCode, String number) { - this.type = type; - this.areaCode = areaCode; - this.number = number; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getAreaCode() { - return areaCode; - } - - public void setAreaCode(String areaCode) { - this.areaCode = areaCode; - } - - public String getNumber() { - return number; - } - - public void setNumber(String number) { - this.number = number; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof Phone)) { - return false; - } - Phone phone = (Phone) o; - return getType().equals(phone.getType()) && getAreaCode().equals(phone.getAreaCode()) - && getNumber().equals(phone.getNumber()); - } - - @Override - public int hashCode() { - return Objects.hash(getType(), getAreaCode(), getNumber()); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/repository/EmployeeRepository.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/repository/EmployeeRepository.java deleted file mode 100644 index 49180c35eb..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/elementcollection/repository/EmployeeRepository.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.elementcollection.repository; - -import com.baeldung.elementcollection.model.Employee; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -import javax.persistence.EntityGraph; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import java.util.HashMap; -import java.util.Map; - -@Repository -public class EmployeeRepository { - - @PersistenceContext - private EntityManager em; - - @Transactional - public void save(Employee employee) { - em.persist(employee); - } - - @Transactional - public void remove(int id) { - Employee employee = findById(id); - em.remove(employee); - } - - public Employee findById(int id) { - return em.find(Employee.class, id); - } - - public Employee findByJPQL(int id) { - return em.createQuery("SELECT u FROM Employee AS u JOIN FETCH u.phones WHERE u.id=:id", Employee.class) - .setParameter("id", id).getSingleResult(); - } - - public Employee findByEntityGraph(int id) { - EntityGraph entityGraph = em.createEntityGraph(Employee.class); - entityGraph.addAttributeNodes("name", "phones"); - Map properties = new HashMap<>(); - properties.put("javax.persistence.fetchgraph", entityGraph); - return em.find(Employee.class, id, properties); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/SpringBootLifecycleEventApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/SpringBootLifecycleEventApplication.java deleted file mode 100644 index fbc861c5fe..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/SpringBootLifecycleEventApplication.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.lifecycleevents; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SpringBootLifecycleEventApplication { - public static void main(String[] args) { - SpringApplication.run(SpringBootLifecycleEventApplication.class, args); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/model/AuditTrailListener.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/model/AuditTrailListener.java deleted file mode 100644 index 26ebff42e4..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/model/AuditTrailListener.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.lifecycleevents.model; - -import javax.persistence.PostLoad; -import javax.persistence.PostPersist; -import javax.persistence.PostRemove; -import javax.persistence.PostUpdate; -import javax.persistence.PrePersist; -import javax.persistence.PreRemove; -import javax.persistence.PreUpdate; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -public class AuditTrailListener { - private static Log log = LogFactory.getLog(AuditTrailListener.class); - - @PrePersist - @PreUpdate - @PreRemove - private void beforeAnyUpdate(User user) { - if (user.getId() == 0) { - log.info("[USER AUDIT] About to add a user"); - } else { - log.info("[USER AUDIT] About to update/delete user: " + user.getId()); - } - } - - @PostPersist - @PostUpdate - @PostRemove - private void afterAnyUpdate(User user) { - log.info("[USER AUDIT] add/update/delete complete for user: " + user.getId()); - } - - @PostLoad - private void afterLoad(User user) { - log.info("[USER AUDIT] user loaded from database: " + user.getId()); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/model/User.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/model/User.java deleted file mode 100644 index a080cb3bf2..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/model/User.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.baeldung.lifecycleevents.model; - -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.PostLoad; -import javax.persistence.PostPersist; -import javax.persistence.PostRemove; -import javax.persistence.PostUpdate; -import javax.persistence.PrePersist; -import javax.persistence.PreRemove; -import javax.persistence.PreUpdate; -import javax.persistence.Transient; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -@Entity -@EntityListeners(AuditTrailListener.class) -public class User { - private static Log log = LogFactory.getLog(User.class); - - @Id - @GeneratedValue - private int id; - - private String userName; - private String firstName; - private String lastName; - @Transient - private String fullName; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getFullName() { - return fullName; - } - - @PrePersist - public void logNewUserAttempt() { - log.info("Attempting to add new user with username: " + userName); - } - - @PostPersist - public void logNewUserAdded() { - log.info("Added user '" + userName + "' with ID: " + id); - } - - @PreRemove - public void logUserRemovalAttempt() { - log.info("Attempting to delete user: " + userName); - } - - @PostRemove - public void logUserRemoval() { - log.info("Deleted user: " + userName); - } - - @PreUpdate - public void logUserUpdateAttempt() { - log.info("Attempting to update user: " + userName); - } - - @PostUpdate - public void logUserUpdate() { - log.info("Updated user: " + userName); - } - - @PostLoad - public void logUserLoad() { - fullName = firstName + " " + lastName; - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/repository/UserRepository.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/repository/UserRepository.java deleted file mode 100644 index af14117ebb..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/lifecycleevents/repository/UserRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.lifecycleevents.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.lifecycleevents.model.User; - -public interface UserRepository extends JpaRepository { - public User findByUserName(String userName); -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/LikeApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/LikeApplication.java deleted file mode 100644 index 311aea3001..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/LikeApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.like; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class LikeApplication { - - public static void main(String[] args) { - SpringApplication.run(LikeApplication.class, args); - } - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/model/Movie.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/model/Movie.java deleted file mode 100644 index bba8bd35c4..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/model/Movie.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baeldung.like.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - -@Entity -public class Movie { - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE) - private Long id; - private String title; - private String director; - private String rating; - private int duration; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDirector() { - return director; - } - - public void setDirector(String director) { - this.director = director; - } - - public String getRating() { - return rating; - } - - public void setRating(String rating) { - this.rating = rating; - } - - public int getDuration() { - return duration; - } - - public void setDuration(int duration) { - this.duration = duration; - } - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/repository/MovieRepository.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/repository/MovieRepository.java deleted file mode 100644 index 241bdd3306..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/like/repository/MovieRepository.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.like.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.data.repository.query.Param; - -import com.baeldung.like.model.Movie; - -public interface MovieRepository extends CrudRepository { - - List findByTitleContaining(String title); - - List findByTitleLike(String title); - - List findByTitleContains(String title); - - List findByTitleIsContaining(String title); - - List findByRatingStartsWith(String rating); - - List findByDirectorEndsWith(String director); - - List findByTitleContainingIgnoreCase(String title); - - List findByRatingNotContaining(String rating); - - List findByDirectorNotLike(String director); - - @Query("SELECT m FROM Movie m WHERE m.title LIKE %:title%") - List searchByTitleLike(@Param("title") String title); - - @Query("SELECT m FROM Movie m WHERE m.rating LIKE ?1%") - List searchByRatingStartsWith(String rating); - - //Escaping works in SpringBoot >= 2.4.1 - //@Query("SELECT m FROM Movie m WHERE m.director LIKE %?#{escape([0])} escape ?#{escapeCharacter()}") - @Query("SELECT m FROM Movie m WHERE m.director LIKE %:#{[0]}") - List searchByDirectorEndsWith(String director); -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/Person.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/Person.java deleted file mode 100644 index cfb6e67c2c..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/Person.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.namingstrategy; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; - -@Entity -public class Person { - @Id - private Long id; - - private String firstName; - - private String lastName; - - public Person() {} - - public Person(Long id, String firstName, String lastName) { - this.id = id; - this.firstName = firstName; - this.lastName = lastName; - } - - public Long id() { - return id; - } - - public String firstName() { - return firstName; - } - - public String lastName() { - return lastName; - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/PersonRepository.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/PersonRepository.java deleted file mode 100644 index 3c7c25bbcb..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/PersonRepository.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.springframework.data.jpa.repository.JpaRepository; - -public interface PersonRepository extends JpaRepository { -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategy.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategy.java deleted file mode 100644 index 16b01e50e3..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategy.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.boot.model.naming.Identifier; -import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; -import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; - -public class QuotedLowerCaseNamingStrategy extends SpringPhysicalNamingStrategy { - @Override - protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { - return new Identifier(name.toLowerCase(), true); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategy.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategy.java deleted file mode 100644 index 3cb62aa5a2..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategy.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.boot.model.naming.Identifier; -import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; -import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; - -public class QuotedUpperCaseNamingStrategy extends SpringPhysicalNamingStrategy { - @Override - protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { - return new Identifier(name.toUpperCase(), true); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/SpringDataJpaNamingConventionApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/SpringDataJpaNamingConventionApplication.java deleted file mode 100644 index f223015db8..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/SpringDataJpaNamingConventionApplication.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SpringDataJpaNamingConventionApplication { -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategy.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategy.java deleted file mode 100644 index 69e96aee27..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategy.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.boot.model.naming.Identifier; -import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; -import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; - -public class UnquotedLowerCaseNamingStrategy extends SpringPhysicalNamingStrategy { - @Override - protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { - return new Identifier(name.toLowerCase(), false); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategy.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategy.java deleted file mode 100644 index cb87af10f4..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategy.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.boot.model.naming.Identifier; -import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; -import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; - -public class UnquotedUpperCaseNamingStrategy extends SpringPhysicalNamingStrategy { - @Override - protected Identifier getIdentifier(String name, boolean quoted, JdbcEnvironment jdbcEnvironment) { - return new Identifier(name.toUpperCase(), false); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/OsivApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/OsivApplication.java deleted file mode 100644 index 4cfcf83e56..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/OsivApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.osiv; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class OsivApplication { - - public static void main(String[] args) { - SpringApplication.run(OsivApplication.class, args); - } - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/model/BasicUser.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/model/BasicUser.java deleted file mode 100644 index 98f4e379d4..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/model/BasicUser.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.osiv.model; - -import javax.persistence.*; -import java.util.Set; - -@Entity -@Table(name = "users") -public class BasicUser { - - @Id - @GeneratedValue - private Long id; - - private String username; - - @ElementCollection - private Set permissions; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public Set getPermissions() { - return permissions; - } - - public void setPermissions(Set permissions) { - this.permissions = permissions; - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java deleted file mode 100644 index e8d5955d91..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/repository/BasicUserRepository.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.osiv.repository; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.EntityGraph; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.osiv.model.BasicUser; - -@Repository -@Transactional -public interface BasicUserRepository extends JpaRepository { - - @EntityGraph(attributePaths = "permissions") - Optional findDetailedByUsername(String username); - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/SimpleUserService.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/SimpleUserService.java deleted file mode 100644 index 1de51678d5..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/SimpleUserService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.osiv.service; - -import java.util.Optional; - -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.osiv.model.BasicUser; -import com.baeldung.osiv.repository.BasicUserRepository; - -@Service -public class SimpleUserService implements UserService { - - private final BasicUserRepository userRepository; - - public SimpleUserService(BasicUserRepository userRepository) { - this.userRepository = userRepository; - } - - @Override - @Transactional(readOnly = true) - public Optional findOne(String username) { - return userRepository.findDetailedByUsername(username); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/UserService.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/UserService.java deleted file mode 100644 index 3d089fa41b..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/service/UserService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.osiv.service; - -import com.baeldung.osiv.model.BasicUser; - -import java.util.Optional; - -public interface UserService { - Optional findOne(String username); -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java deleted file mode 100644 index fd2882c2d5..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/DetailedUserDto.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baeldung.osiv.web; - -import com.baeldung.osiv.model.BasicUser; - -import java.util.Set; - -public class DetailedUserDto { - - private Long id; - private String username; - private Set permissions; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public Set getPermissions() { - return permissions; - } - - public void setPermissions(Set permissions) { - this.permissions = permissions; - } - - public static DetailedUserDto fromEntity(BasicUser user) { - DetailedUserDto detailed = new DetailedUserDto(); - detailed.setId(user.getId()); - detailed.setUsername(user.getUsername()); - detailed.setPermissions(user.getPermissions()); - - return detailed; - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/UserController.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/UserController.java deleted file mode 100644 index 5466b95166..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/osiv/web/UserController.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.osiv.web; - -import com.baeldung.osiv.service.UserService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/users") -public class UserController { - - private final UserService userService; - - public UserController(UserService userService) { - this.userService = userService; - } - - @GetMapping("/{username}") - public ResponseEntity findOne(@PathVariable String username) { - return userService.findOne(username) - .map(DetailedUserDto::fromEntity) - .map(ResponseEntity::ok) - .orElse(ResponseEntity.notFound().build()); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java deleted file mode 100644 index 5f05764e21..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.storedprocedure; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class StoredProcedureApplication { - - public static void main(String[] args) { - SpringApplication.run(StoredProcedureApplication.class, args); - } - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/controller/CarController.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/controller/CarController.java deleted file mode 100644 index 6aef600d01..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/controller/CarController.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baeldung.storedprocedure.controller; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.storedprocedure.entity.Car; -import com.baeldung.storedprocedure.service.CarService; - -@RestController -public class CarController { - @Autowired - private CarService carService; - - @GetMapping(path = "/modelcount") - public long getTotalCarsByModel(@RequestParam("model") String model) { - return carService.getTotalCarsByModel(model); - } - - @GetMapping(path = "/modelcountP") - public long getTotalCarsByModelProcedureName(@RequestParam("model") String model) { - return carService.getTotalCarsByModelProcedureName(model); - } - - @GetMapping(path = "/modelcountV") - public long getTotalCarsByModelVaue(@RequestParam("model") String model) { - return carService.getTotalCarsByModelValue(model); - } - - @GetMapping(path = "/modelcountEx") - public long getTotalCarsByModelExplicit(@RequestParam("model") String model) { - return carService.getTotalCarsByModelExplicit(model); - } - - @GetMapping(path = "/modelcountEn") - public long getTotalCarsByModelEntity(@RequestParam("model") String model) { - return carService.getTotalCarsByModelEntity(model); - } - - @GetMapping(path = "/carsafteryear") - public List findCarsAfterYear(@RequestParam("year") Integer year) { - return carService.findCarsAfterYear(year); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/entity/Car.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/entity/Car.java deleted file mode 100644 index 2817c25ff7..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/entity/Car.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.storedprocedure.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedStoredProcedureQuery; -import javax.persistence.StoredProcedureParameter; -import javax.persistence.ParameterMode; - -@Entity -@NamedStoredProcedureQuery(name = "Car.getTotalCardsbyModelEntity", procedureName = "GET_TOTAL_CARS_BY_MODEL", parameters = { - @StoredProcedureParameter(mode = ParameterMode.IN, name = "model_in", type = String.class), - @StoredProcedureParameter(mode = ParameterMode.OUT, name = "count_out", type = Integer.class) }) - -public class Car { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column - private long id; - - @Column - private String model; - - @Column - private Integer year; - - public long getId() { - return id; - } - - public String getModel() { - return model; - } - - public Integer getYear() { - return year; - } - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java deleted file mode 100644 index 3d9428628e..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.storedprocedure.repository; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.jpa.repository.query.Procedure; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; - -import com.baeldung.storedprocedure.entity.Car; - -@Repository -public interface CarRepository extends JpaRepository { - - @Procedure - int GET_TOTAL_CARS_BY_MODEL(String model); - - @Procedure("GET_TOTAL_CARS_BY_MODEL") - int getTotalCarsByModel(String model); - - @Procedure(procedureName = "GET_TOTAL_CARS_BY_MODEL") - int getTotalCarsByModelProcedureName(String model); - - @Procedure(value = "GET_TOTAL_CARS_BY_MODEL") - int getTotalCarsByModelValue(String model); - - @Procedure(name = "Car.getTotalCardsbyModelEntity") - int getTotalCarsByModelEntiy(@Param("model_in") String model); - - @Query(value = "CALL FIND_CARS_AFTER_YEAR(:year_in);", nativeQuery = true) - List findCarsAfterYear(@Param("year_in") Integer year_in); - -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/service/CarService.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/service/CarService.java deleted file mode 100644 index 104f46e324..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/storedprocedure/service/CarService.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.storedprocedure.service; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.baeldung.storedprocedure.entity.Car; -import com.baeldung.storedprocedure.repository.CarRepository; - -@Service -public class CarService { - @Autowired - private CarRepository carRepository; - - public int getTotalCarsByModel(String model) { - return carRepository.getTotalCarsByModel(model); - } - - public int getTotalCarsByModelProcedureName(String model) { - return carRepository.getTotalCarsByModelProcedureName(model); - } - - public int getTotalCarsByModelValue(String model) { - return carRepository.getTotalCarsByModelValue(model); - } - - public int getTotalCarsByModelExplicit(String model) { - return carRepository.GET_TOTAL_CARS_BY_MODEL(model); - } - - public int getTotalCarsByModelEntity(String model) { - return carRepository.getTotalCarsByModelEntiy(model); - } - - public List findCarsAfterYear(Integer year) { - return carRepository.findCarsAfterYear(year); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/TxApplication.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/TxApplication.java deleted file mode 100644 index 4c982c91e9..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/TxApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.tx; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class TxApplication { - - public static void main(String[] args) { - SpringApplication.run(TxApplication.class, args); - } - -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/model/Payment.java b/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/model/Payment.java deleted file mode 100644 index 921a1e9275..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/java/com/baeldung/tx/model/Payment.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baeldung.tx.model; - -import javax.persistence.*; - -@Entity -public class Payment { - - @Id - @GeneratedValue - private Long id; - - private Long amount; - - @Column(unique = true) - private String referenceNumber; - - @Enumerated(EnumType.STRING) - private State state; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getAmount() { - return amount; - } - - public void setAmount(Long amount) { - this.amount = amount; - } - - public String getReferenceNumber() { - return referenceNumber; - } - - public void setReferenceNumber(String referenceNumber) { - this.referenceNumber = referenceNumber; - } - - public State getState() { - return state; - } - - public void setState(State state) { - this.state = state; - } - - public enum State { - STARTED, FAILED, SUCCESSFUL - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-4/src/main/resources/application.properties deleted file mode 100644 index 65d7b0bf29..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/resources/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -spring.jpa.show-sql=true -#MySql -#spring.datasource.url=jdbc:mysql://localhost:3306/baeldung -#spring.datasource.username=baeldung -#spring.datasource.password=baeldung \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/main/resources/car-mysql.sql b/persistence-modules/spring-data-jpa-4/src/main/resources/car-mysql.sql deleted file mode 100644 index bb4ab2a86e..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/main/resources/car-mysql.sql +++ /dev/null @@ -1,27 +0,0 @@ -DROP TABLE IF EXISTS car; - -CREATE TABLE car (id int(10) NOT NULL AUTO_INCREMENT, - model varchar(50) NOT NULL, - year int(4) NOT NULL, - PRIMARY KEY (id)); - -INSERT INTO car (model, year) VALUES ('BMW', 2000); -INSERT INTO car (model, year) VALUES ('BENZ', 2010); -INSERT INTO car (model, year) VALUES ('PORCHE', 2005); -INSERT INTO car (model, year) VALUES ('PORCHE', 2004); - -DELIMITER $$ - -DROP PROCEDURE IF EXISTS FIND_CARS_AFTER_YEAR$$ -CREATE PROCEDURE FIND_CARS_AFTER_YEAR(IN year_in INT) -BEGIN - SELECT * FROM car WHERE year >= year_in ORDER BY year; -END$$ - -DROP PROCEDURE IF EXISTS GET_TOTAL_CARS_BY_MODEL$$ -CREATE PROCEDURE GET_TOTAL_CARS_BY_MODEL(IN model_in VARCHAR(50), OUT count_out INT) -BEGIN - SELECT COUNT(*) into count_out from car WHERE model = model_in; -END$$ - -DELIMITER ; diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java deleted file mode 100644 index 2a6e166b88..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/derivedquery/repository/UserRepositoryIntegrationTest.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.baeldung.derivedquery.repository; - -import com.baeldung.derivedquery.QueryApplication; -import com.baeldung.derivedquery.entity.User; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import java.time.ZonedDateTime; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = QueryApplication.class) -public class UserRepositoryIntegrationTest { - - private static final String USER_NAME_ADAM = "Adam"; - private static final String USER_NAME_EVE = "Eve"; - private static final ZonedDateTime BIRTHDATE = ZonedDateTime.now(); - - @Autowired - private UserRepository userRepository; - - @Before - public void setUp() { - - User user1 = new User(USER_NAME_ADAM, 25, BIRTHDATE, true); - User user2 = new User(USER_NAME_ADAM, 20, BIRTHDATE, false); - User user3 = new User(USER_NAME_EVE, 20, BIRTHDATE, true); - User user4 = new User(null, 30, BIRTHDATE, false); - - userRepository.saveAll(Arrays.asList(user1, user2, user3, user4)); - } - - @After - public void tearDown() { - - userRepository.deleteAll(); - } - - @Test - public void whenFindByName_thenReturnsCorrectResult() { - - assertEquals(2, userRepository.findByName(USER_NAME_ADAM).size()); - } - - @Test - public void whenFindByNameIsNull_thenReturnsCorrectResult() { - - assertEquals(1, userRepository.findByNameIsNull().size()); - } - - @Test - public void whenFindByNameNot_thenReturnsCorrectResult() { - - assertEquals(USER_NAME_EVE, userRepository.findByNameNot(USER_NAME_ADAM).get(0).getName()); - } - - @Test - public void whenFindByNameStartingWith_thenReturnsCorrectResult() { - - assertEquals(2, userRepository.findByNameStartingWith("A").size()); - } - - @Test - public void whenFindByNameEndingWith_thenReturnsCorrectResult() { - - assertEquals(1, userRepository.findByNameEndingWith("e").size()); - } - - @Test - public void whenByNameContaining_thenReturnsCorrectResult() { - - assertEquals(1, userRepository.findByNameContaining("v").size()); - } - - - @Test - public void whenByNameLike_thenReturnsCorrectResult() { - - assertEquals(2, userRepository.findByNameEndingWith("m").size()); - } - - @Test - public void whenByAgeLessThan_thenReturnsCorrectResult() { - - assertEquals(2, userRepository.findByAgeLessThan(25).size()); - } - - - @Test - public void whenByAgeLessThanEqual_thenReturnsCorrectResult() { - - assertEquals(3, userRepository.findByAgeLessThanEqual(25).size()); - } - - @Test - public void whenByAgeGreaterThan_thenReturnsCorrectResult() { - - assertEquals(1, userRepository.findByAgeGreaterThan(25).size()); - } - - @Test - public void whenByAgeGreaterThanEqual_thenReturnsCorrectResult() { - - assertEquals(2, userRepository.findByAgeGreaterThanEqual(25).size()); - } - - @Test - public void whenByAgeBetween_thenReturnsCorrectResult() { - - assertEquals(4, userRepository.findByAgeBetween(20, 30).size()); - } - - @Test - public void whenByBirthDateAfter_thenReturnsCorrectResult() { - - final ZonedDateTime yesterday = BIRTHDATE.minusDays(1); - assertEquals(4, userRepository.findByBirthDateAfter(yesterday).size()); - } - - @Test - public void whenByBirthDateBefore_thenReturnsCorrectResult() { - - final ZonedDateTime yesterday = BIRTHDATE.minusDays(1); - assertEquals(0, userRepository.findByBirthDateBefore(yesterday).size()); - } - - @Test - public void whenByActiveTrue_thenReturnsCorrectResult() { - - assertEquals(2, userRepository.findByActiveTrue().size()); - } - - @Test - public void whenByActiveFalse_thenReturnsCorrectResult() { - - assertEquals(2, userRepository.findByActiveFalse().size()); - } - - - @Test - public void whenByAgeIn_thenReturnsCorrectResult() { - - final List ages = Arrays.asList(20, 25); - assertEquals(3, userRepository.findByAgeIn(ages).size()); - } - - @Test - public void whenByNameOrBirthDate() { - - assertEquals(4, userRepository.findByNameOrBirthDate(USER_NAME_ADAM, BIRTHDATE).size()); - } - - @Test - public void whenByNameOrBirthDateAndActive() { - - assertEquals(3, userRepository.findByNameOrBirthDateAndActive(USER_NAME_ADAM, BIRTHDATE, false).size()); - } - - @Test - public void whenByNameOrderByName() { - - assertEquals(2, userRepository.findByNameOrderByName(USER_NAME_ADAM).size()); - } -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/elementcollection/ElementCollectionIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/elementcollection/ElementCollectionIntegrationTest.java deleted file mode 100644 index 306798aa68..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/elementcollection/ElementCollectionIntegrationTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.baeldung.elementcollection; - -import com.baeldung.elementcollection.model.Employee; -import com.baeldung.elementcollection.model.Phone; -import com.baeldung.elementcollection.repository.EmployeeRepository; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Arrays; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = ElementCollectionApplication.class) -public class ElementCollectionIntegrationTest { - - @Autowired - private EmployeeRepository employeeRepository; - - @Before - public void init() { - Employee employee = new Employee(1, "Fred"); - employee.setPhones( - Arrays.asList(new Phone("work", "+55", "99999-9999"), new Phone("home", "+55", "98888-8888"))); - employeeRepository.save(employee); - } - - @After - public void clean() { - employeeRepository.remove(1); - } - - @Test(expected = org.hibernate.LazyInitializationException.class) - public void whenAccessLazyCollection_thenThrowLazyInitializationException() { - Employee employee = employeeRepository.findById(1); - assertThat(employee.getPhones().size(), is(2)); - } - - @Test - public void whenUseJPAQL_thenFetchResult() { - Employee employee = employeeRepository.findByJPQL(1); - assertThat(employee.getPhones().size(), is(2)); - } - - @Test - public void whenUseEntityGraph_thenFetchResult() { - Employee employee = employeeRepository.findByEntityGraph(1); - assertThat(employee.getPhones().size(), is(2)); - } - - @Test - @Transactional - public void whenUseTransaction_thenFetchResult() { - Employee employee = employeeRepository.findById(1); - assertThat(employee.getPhones().size(), is(2)); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java deleted file mode 100644 index cc96b638ab..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/like/MovieRepositoryIntegrationTest.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.baeldung.like; - -import com.baeldung.like.model.Movie; -import com.baeldung.like.repository.MovieRepository; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.jdbc.Sql; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.AFTER_TEST_METHOD; - -@RunWith(SpringRunner.class) -@Sql(scripts = { "/test-movie-data.sql" }) -@SpringBootTest(classes = LikeApplication.class) -@Sql(scripts = "/test-movie-cleanup.sql", executionPhase = AFTER_TEST_METHOD) -public class MovieRepositoryIntegrationTest { - @Autowired - private MovieRepository movieRepository; - - @Test - public void givenPartialTitle_WhenFindByTitleContaining_ThenMoviesShouldReturn() { - List results = movieRepository.findByTitleContaining("in"); - assertEquals(3, results.size()); - - results = movieRepository.findByTitleLike("%in%"); - assertEquals(3, results.size()); - - results = movieRepository.findByTitleIsContaining("in"); - assertEquals(3, results.size()); - - results = movieRepository.findByTitleContains("in"); - assertEquals(3, results.size()); - } - - @Test - public void givenStartOfRating_WhenFindByRatingStartsWith_ThenMoviesShouldReturn() { - List results = movieRepository.findByRatingStartsWith("PG"); - assertEquals(6, results.size()); - } - - @Test - public void givenLastName_WhenFindByDirectorEndsWith_ThenMoviesShouldReturn() { - List results = movieRepository.findByDirectorEndsWith("Burton"); - assertEquals(1, results.size()); - } - - @Test - public void givenPartialTitle_WhenFindByTitleContainingIgnoreCase_ThenMoviesShouldReturn() { - List results = movieRepository.findByTitleContainingIgnoreCase("the"); - assertEquals(2, results.size()); - } - - @Test - public void givenPartialTitle_WhenSearchByTitleLike_ThenMoviesShouldReturn() { - List results = movieRepository.searchByTitleLike("in"); - assertEquals(3, results.size()); - } - - @Test - public void givenStartOfRating_SearchFindByRatingStartsWith_ThenMoviesShouldReturn() { - List results = movieRepository.searchByRatingStartsWith("PG"); - assertEquals(6, results.size()); - } - - @Test - public void givenLastName_WhenSearchByDirectorEndsWith_ThenMoviesShouldReturn() { - List results = movieRepository.searchByDirectorEndsWith("Burton"); - assertEquals(1, results.size()); - } - - @Test - public void givenPartialRating_findByRatingNotContaining_ThenMoviesShouldReturn() { - List results = movieRepository.findByRatingNotContaining("PG"); - assertEquals(1, results.size()); - } - - @Test - public void givenPartialDirector_WhenFindByDirectorNotLike_ThenMoviesShouldReturn() { - List results = movieRepository.findByDirectorNotLike("An%"); - assertEquals(5, results.size()); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyH2IntegrationTest.java deleted file mode 100644 index 71a4dbda3f..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyH2IntegrationTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("quoted-lower-case-naming-strategy.properties") -class QuotedLowerCaseNamingStrategyH2IntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonUnquoted_thenException(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Unexpected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - @Test - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Expected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - @Test - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyPostgresLiveTest.java deleted file mode 100644 index 6b1c984600..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedLowerCaseNamingStrategyPostgresLiveTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("quoted-lower-case-naming-strategy-on-postgres.properties") -class QuotedLowerCaseNamingStrategyPostgresLiveTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Expected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - @Test - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyH2IntegrationTest.java deleted file mode 100644 index f819327a5c..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyH2IntegrationTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("quoted-upper-case-naming-strategy.properties") -class QuotedUpperCaseNamingStrategyH2IntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonUnquoted_thenException(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Expected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyPostgresLiveTest.java deleted file mode 100644 index bd23b81b4b..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/QuotedUpperCaseNamingStrategyPostgresLiveTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("quoted-upper-case-naming-strategy-on-postgres.properties") -class QuotedUpperCaseNamingStrategyPostgresLiveTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Unexpected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - @Test - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Expected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyH2IntegrationTest.java deleted file mode 100644 index 1850fea173..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyH2IntegrationTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("spring-physical-naming-strategy.properties") -class SpringPhysicalNamingStrategyH2IntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndSpringNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndSpringNamingStrategy_whenQueryPersonQuotedUpperCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Unexpected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndSpringNamingStrategy_whenQueryPersonQuotedLowerCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Unexpected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyPostgresLiveTest.java deleted file mode 100644 index e26ebb148d..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/SpringPhysicalNamingStrategyPostgresLiveTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("spring-physical-naming-strategy-on-postgres.properties") -class SpringPhysicalNamingStrategyPostgresLiveTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndSpringNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndSpringNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Expected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - @Test - void givenPeopleAndSpringNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyH2IntegrationTest.java deleted file mode 100644 index 6311c42e93..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyH2IntegrationTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("unquoted-lower-case-naming-strategy.properties") -class UnquotedLowerCaseNamingStrategyH2IntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Unexpected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Unexpected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyPostgresLiveTest.java deleted file mode 100644 index 033a213cf5..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedLowerCaseNamingStrategyPostgresLiveTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("unquoted-lower-case-naming-strategy-on-postgres.properties") -class UnquotedLowerCaseNamingStrategyPostgresLiveTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Expected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - @Test - void givenPeopleAndLowerCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyH2IntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyH2IntegrationTest.java deleted file mode 100644 index 7af8001854..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyH2IntegrationTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("unquoted-upper-case-naming-strategy.properties") -class UnquotedUpperCaseNamingStrategyH2IntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Expected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyPostgresLiveTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyPostgresLiveTest.java deleted file mode 100644 index 0151e7ece4..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/namingstrategy/UnquotedUpperCaseNamingStrategyPostgresLiveTest.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.namingstrategy; - -import org.hibernate.exception.SQLGrammarException; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.TestPropertySource; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; - -@DataJpaTest(excludeAutoConfiguration = TestDatabaseAutoConfiguration.class) -@TestPropertySource("unquoted-upper-case-naming-strategy-on-postgres.properties") -class UnquotedUpperCaseNamingStrategyPostgresLiveTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private PersonRepository personRepository; - - @BeforeEach - void insertPeople() { - personRepository.saveAll(Arrays.asList( - new Person(1L, "John", "Doe"), - new Person(2L, "Jane", "Doe"), - new Person(3L, "Ted", "Mosby") - )); - } - - @ParameterizedTest - @ValueSource(strings = {"person", "PERSON", "Person"}) - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonUnquoted_thenResult(String tableName) { - Query query = entityManager.createNativeQuery("select * from " + tableName); - - // Expected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - @Test - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedUpperCase_thenException() { - Query query = entityManager.createNativeQuery("select * from \"PERSON\""); - - // Unexpected result - assertThrows(SQLGrammarException.class, query::getResultStream); - } - - @Test - void givenPeopleAndUpperCaseNamingStrategy_whenQueryPersonQuotedLowerCase_thenResult() { - Query query = entityManager.createNativeQuery("select * from \"person\""); - - // Unexpected result - List result = (List) query.getResultStream() - .map(this::fromDatabase) - .collect(Collectors.toList()); - - assertThat(result).isNotEmpty(); - } - - public Person fromDatabase(Object databaseRow) { - Object[] typedDatabaseRow = (Object[]) databaseRow; - - return new Person( - ((BigInteger) typedDatabaseRow[0]).longValue(), - (String) typedDatabaseRow[1], - (String) typedDatabaseRow[2] - ); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java deleted file mode 100644 index 350b67e1c9..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/osiv/UserControllerIntegrationTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.baeldung.osiv; - -import com.baeldung.osiv.model.BasicUser; -import com.baeldung.osiv.repository.BasicUserRepository; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.web.servlet.MockMvc; - -import java.util.Arrays; -import java.util.HashSet; - -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@SpringBootTest -@AutoConfigureMockMvc -@ActiveProfiles("test") -@ContextConfiguration(classes = OsivApplication.class) -class UserControllerIntegrationTest { - - @Autowired - private BasicUserRepository userRepository; - - @Autowired - private MockMvc mockMvc; - - @BeforeEach - void setUp() { - BasicUser user = new BasicUser(); - user.setUsername("root"); - user.setPermissions(new HashSet<>(Arrays.asList("PERM_READ", "PERM_WRITE"))); - - userRepository.save(user); - } - - @Test - void givenTheUserExists_WhenOsivIsEnabled_ThenLazyInitWorkEverywhere() throws Exception { - mockMvc.perform(get("/users/root")) - .andExpect(status().isOk()) - .andExpect(jsonPath("$.username").value("root")) - .andExpect(jsonPath("$.permissions", containsInAnyOrder("PERM_READ", "PERM_WRITE"))); - } - - @AfterEach - void flushDb() { - userRepository.deleteAll(); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java deleted file mode 100644 index 01551348c9..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/com/baeldung/tx/ManualTransactionIntegrationTest.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.baeldung.tx; - -import com.baeldung.tx.model.Payment; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.transaction.support.DefaultTransactionDefinition; -import org.springframework.transaction.support.TransactionCallbackWithoutResult; -import org.springframework.transaction.support.TransactionTemplate; - -import javax.persistence.EntityManager; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.transaction.annotation.Propagation.NOT_SUPPORTED; - -@DataJpaTest -@ActiveProfiles("test") -@Transactional(propagation = NOT_SUPPORTED) -class ManualTransactionIntegrationTest { - - @Autowired - private PlatformTransactionManager transactionManager; - - @Autowired - private EntityManager entityManager; - - private TransactionTemplate transactionTemplate; - - @BeforeEach - void setUp() { - transactionTemplate = new TransactionTemplate(transactionManager); - } - - @AfterEach - void flushDb() { - transactionTemplate.execute(status -> entityManager - .createQuery("delete from Payment") - .executeUpdate()); - } - - @Test - void givenAPayment_WhenNotDuplicate_ThenShouldCommit() { - Long id = transactionTemplate.execute(status -> { - Payment payment = new Payment(); - payment.setAmount(1000L); - payment.setReferenceNumber("Ref-1"); - payment.setState(Payment.State.SUCCESSFUL); - - entityManager.persist(payment); - - return payment.getId(); - }); - - Payment payment = entityManager.find(Payment.class, id); - assertThat(payment).isNotNull(); - } - - @Test - void givenAPayment_WhenMarkAsRollback_ThenShouldRollback() { - transactionTemplate.execute(status -> { - Payment payment = new Payment(); - payment.setAmount(1000L); - payment.setReferenceNumber("Ref-1"); - payment.setState(Payment.State.SUCCESSFUL); - - entityManager.persist(payment); - status.setRollbackOnly(); - - return payment.getId(); - }); - - assertThat(entityManager - .createQuery("select p from Payment p", Payment.class) - .getResultList()).isEmpty(); - } - - @Test - void givenTwoPayments_WhenRefIsDuplicate_ThenShouldRollback() { - try { - transactionTemplate.execute(s -> { - Payment first = new Payment(); - first.setAmount(1000L); - first.setReferenceNumber("Ref-1"); - first.setState(Payment.State.SUCCESSFUL); - - Payment second = new Payment(); - second.setAmount(2000L); - second.setReferenceNumber("Ref-1"); - second.setState(Payment.State.SUCCESSFUL); - - entityManager.persist(first); - entityManager.persist(second); - - return "Ref-1"; - }); - } catch (Exception ignored) { - } - - assertThat(entityManager - .createQuery("select p from Payment p", Payment.class) - .getResultList()).isEmpty(); - } - - @Test - void givenAPayment_WhenNotExpectingAnyResult_ThenShouldCommit() { - transactionTemplate.execute(new TransactionCallbackWithoutResult() { - @Override - protected void doInTransactionWithoutResult(TransactionStatus status) { - Payment payment = new Payment(); - payment.setReferenceNumber("Ref-1"); - payment.setState(Payment.State.SUCCESSFUL); - - entityManager.persist(payment); - } - }); - - assertThat(entityManager - .createQuery("select p from Payment p", Payment.class) - .getResultList()).hasSize(1); - } - - @Test - void givenAPayment_WhenUsingTxManager_ThenShouldCommit() { - DefaultTransactionDefinition definition = new DefaultTransactionDefinition(); - definition.setIsolationLevel(TransactionDefinition.ISOLATION_REPEATABLE_READ); - definition.setTimeout(3); - - TransactionStatus status = transactionManager.getTransaction(definition); - try { - Payment payment = new Payment(); - payment.setReferenceNumber("Ref-1"); - payment.setState(Payment.State.SUCCESSFUL); - - entityManager.persist(payment); - transactionManager.commit(status); - } catch (Exception ex) { - transactionManager.rollback(status); - } - - assertThat(entityManager - .createQuery("select p from Payment p", Payment.class) - .getResultList()).hasSize(1); - } - -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/java/lifecycleevents/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-4/src/test/java/lifecycleevents/UserRepositoryIntegrationTest.java deleted file mode 100644 index 078f437474..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/java/lifecycleevents/UserRepositoryIntegrationTest.java +++ /dev/null @@ -1,80 +0,0 @@ -package lifecycleevents; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.lifecycleevents.SpringBootLifecycleEventApplication; -import com.baeldung.lifecycleevents.model.User; -import com.baeldung.lifecycleevents.repository.UserRepository; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootLifecycleEventApplication.class) -public class UserRepositoryIntegrationTest { - - @Autowired - private UserRepository userRepository; - - @Before - public void setup() { - User user = new User(); - user.setFirstName("Jane"); - user.setLastName("Smith"); - user.setUserName("jsmith123"); - userRepository.save(user); - } - - @After - public void cleanup() { - userRepository.deleteAll(); - } - - @Test - public void whenNewUserProvided_userIsAdded() { - User user = new User(); - user.setFirstName("John"); - user.setLastName("Doe"); - user.setUserName("jdoe123"); - user = userRepository.save(user); - assertTrue(user.getId() > 0); - } - - @Test - public void whenUserNameProvided_userIsLoaded() { - User user = userRepository.findByUserName("jsmith123"); - assertNotNull(user); - assertEquals("jsmith123", user.getUserName()); - } - - @Test - public void whenExistingUserProvided_userIsUpdated() { - User user = userRepository.findByUserName("jsmith123"); - user.setFirstName("Joe"); - user = userRepository.save(user); - assertEquals("Joe", user.getFirstName()); - } - - @Test - public void whenExistingUserDeleted_userIsDeleted() { - User user = userRepository.findByUserName("jsmith123"); - userRepository.delete(user); - user = userRepository.findByUserName("jsmith123"); - assertNull(user); - } - - @Test - public void whenExistingUserLoaded_fullNameIsAvailable() { - String expectedFullName = "Jane Smith"; - User user = userRepository.findByUserName("jsmith123"); - assertEquals(expectedFullName, user.getFullName()); - } -} diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/application-test.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/application-test.properties deleted file mode 100644 index f9497c8f37..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/application-test.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.jpa.hibernate.ddl-auto=update -spring.datasource.url=jdbc:h2:mem:jpa3 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy-on-postgres.properties deleted file mode 100644 index 04b29de41f..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy-on-postgres.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:postgresql://localhost:5432/quoted-lower-case-strategy -spring.datasource.username=postgres -spring.datasource.password=root - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.QuotedLowerCaseNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy.properties deleted file mode 100644 index 6643c12c8a..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-lower-case-naming-strategy.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:h2:mem:quoted-lower-case-strategy -spring.datasource.username=sa -spring.datasource.password= - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.QuotedLowerCaseNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy-on-postgres.properties deleted file mode 100644 index 36898d5b4f..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy-on-postgres.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:postgresql://localhost:5432/quoted-upper-case-strategy -spring.datasource.username=postgres -spring.datasource.password=root - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.QuotedUpperCaseNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy.properties deleted file mode 100644 index 6d56d58749..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/quoted-upper-case-naming-strategy.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:h2:mem:quoted-upper-case-strategy -spring.datasource.username=sa -spring.datasource.password= - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.QuotedUpperCaseNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy-on-postgres.properties deleted file mode 100644 index 706b12b1b6..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy-on-postgres.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:postgresql://localhost:5432/spring-strategy -spring.datasource.username=postgres -spring.datasource.password=root - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=default-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy.properties deleted file mode 100644 index c9a0c6f24c..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/spring-physical-naming-strategy.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:h2:mem:spring-strategy -spring.datasource.username=sa -spring.datasource.password= - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=default-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy-on-postgres.properties deleted file mode 100644 index b22472bd8f..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy-on-postgres.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:postgresql://localhost:5432/unquoted-lower-case-strategy -spring.datasource.username=postgres -spring.datasource.password=root - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.UnquotedLowerCaseNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy.properties deleted file mode 100644 index 8083515b4b..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-lower-case-naming-strategy.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:h2:mem:unquoted-lower-case-strategy -spring.datasource.username=sa -spring.datasource.password= - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.UnquotedLowerCaseNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy-on-postgres.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy-on-postgres.properties deleted file mode 100644 index da03a0d7b5..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy-on-postgres.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:postgresql://localhost:5432/unquoted-upper-case-strategy -spring.datasource.username=postgres -spring.datasource.password=root - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.UnquotedUpperCaseNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy.properties b/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy.properties deleted file mode 100644 index d1b63e008c..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/com/baeldung/namingstrategy/unquoted-upper-case-naming-strategy.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.datasource.url=jdbc:h2:mem:unquoted-upper-case-strategy -spring.datasource.username=sa -spring.datasource.password= - -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.hibernate.naming.physical-strategy=com.baeldung.namingstrategy.UnquotedUpperCaseNamingStrategy -#spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=upper-case-naming-strategy-ddl.sql \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/test-movie-cleanup.sql b/persistence-modules/spring-data-jpa-4/src/test/resources/test-movie-cleanup.sql deleted file mode 100644 index 90aa15307c..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/test-movie-cleanup.sql +++ /dev/null @@ -1 +0,0 @@ -DELETE FROM Movie; \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-4/src/test/resources/test-movie-data.sql b/persistence-modules/spring-data-jpa-4/src/test/resources/test-movie-data.sql deleted file mode 100644 index 37f8e4fe64..0000000000 --- a/persistence-modules/spring-data-jpa-4/src/test/resources/test-movie-data.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT INTO movie(id, title, director, rating, duration) VALUES(1, 'Godzilla: King of the Monsters', ' Michael Dougherty', 'PG-13', 132); -INSERT INTO movie(id, title, director, rating, duration) VALUES(2, 'Avengers: Endgame', 'Anthony Russo', 'PG-13', 181); -INSERT INTO movie(id, title, director, rating, duration) VALUES(3, 'Captain Marvel', 'Anna Boden', 'PG-13', 123); -INSERT INTO movie(id, title, director, rating, duration) VALUES(4, 'Dumbo', 'Tim Burton', 'PG', 112); -INSERT INTO movie(id, title, director, rating, duration) VALUES(5, 'Booksmart', 'Olivia Wilde', 'R', 102); -INSERT INTO movie(id, title, director, rating, duration) VALUES(6, 'Aladdin', 'Guy Ritchie', 'PG', 128); -INSERT INTO movie(id, title, director, rating, duration) VALUES(7, 'The Sun Is Also a Star', 'Ry Russo-Young', 'PG-13', 100); diff --git a/persistence-modules/spring-data-jpa-5/README.md b/persistence-modules/spring-data-jpa-5/README.md deleted file mode 100644 index 0b78ced66c..0000000000 --- a/persistence-modules/spring-data-jpa-5/README.md +++ /dev/null @@ -1,15 +0,0 @@ -### Relevant Articles: - -- [Spring JPA @Embedded and @EmbeddedId](https://www.baeldung.com/spring-jpa-embedded-method-parameters) -- [Generate Database Schema with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-generate-db-schema) -- [Partial Data Update with Spring Data](https://www.baeldung.com/spring-data-partial-update) - -### Eclipse Config -After importing the project into Eclipse, you may see the following error: -"No persistence xml file found in project" - -This can be ignored: -- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" -Or: -- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator - diff --git a/persistence-modules/spring-data-jpa-5/pom.xml b/persistence-modules/spring-data-jpa-5/pom.xml deleted file mode 100644 index db58a16062..0000000000 --- a/persistence-modules/spring-data-jpa-5/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - 4.0.0 - spring-data-jpa-5 - spring-data-jpa-5 - - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 - - - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - org.springframework.boot - spring-boot-starter-data-jdbc - - - - org.springframework.boot - spring-boot-starter-cache - - - - com.h2database - h2 - - - - org.mapstruct - mapstruct-jdk8 - ${mapstruct.version} - provided - - - - - - src/main/java - - - maven-compiler-plugin - 3.8.1 - - 1.8 - 1.8 - - - org.mapstruct - mapstruct-processor - 1.3.1.Final - - - - - - - - - 2.1.9.RELEASE - com.baeldung.springdatageode.app.ClientCacheApp - 1.1.1.RELEASE - 2.1.9.RELEASE - 1.3.1.Final - - - diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/BookApplication.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/BookApplication.java deleted file mode 100644 index 52f06058aa..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/BookApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.composite; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class BookApplication { - - public static void main(String[] args) { - SpringApplication.run(BookApplication.class); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/entity/Book.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/entity/Book.java deleted file mode 100644 index e4f1727654..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/entity/Book.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baeldung.composite.entity; - -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; - -@Entity -public class Book { - - @EmbeddedId - private BookId id; - private String genre; - private Integer price; - - public Book() { - } - - public Book(String author, String name, String genre, Integer price) { - BookId id = new BookId(author, name); - this.id = id; - this.genre = genre; - this.price = price; - } - - public BookId getId() { - return id; - } - - public void setId(BookId id) { - this.id = id; - } - - public String getGenre() { - return genre; - } - - public void setGenre(String genre) { - this.genre = genre; - } - - public Integer getPrice() { - return price; - } - - public void setPrice(Integer price) { - this.price = price; - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/entity/BookId.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/entity/BookId.java deleted file mode 100644 index 1524452412..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/entity/BookId.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baeldung.composite.entity; - -import javax.persistence.Embeddable; -import java.io.Serializable; -import java.util.Objects; - -@Embeddable -public class BookId implements Serializable { - - private String author; - private String name; - - public BookId() { - } - - public BookId(String author, String name) { - this.author = author; - this.name = name; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - BookId bookId = (BookId) o; - return Objects.equals(author, bookId.author) && Objects.equals(name, bookId.name); - } - - @Override - public int hashCode() { - return Objects.hash(author, name); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/repository/BookRepository.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/repository/BookRepository.java deleted file mode 100644 index d5993eaf79..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/composite/repository/BookRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.composite.repository; - -import com.baeldung.composite.entity.Book; -import com.baeldung.composite.entity.BookId; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface BookRepository extends JpaRepository { - - List findByIdName(String name); - - List findByIdAuthor(String author); - - List findByGenre(String genre); -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/PartialUpdateApplication.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/PartialUpdateApplication.java deleted file mode 100644 index a750fcadf7..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/PartialUpdateApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.partialupdate; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class PartialUpdateApplication { - - public static void main(String[] args) { - SpringApplication.run(PartialUpdateApplication.class, args); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/ContactPhone.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/ContactPhone.java deleted file mode 100644 index 352e361bd9..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/ContactPhone.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.partialupdate.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - -@Entity -public class ContactPhone { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - public long id; - @Column(nullable=false) - public long customerId; - public String phone; - - @Override - public String toString() { - return phone; - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/Customer.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/Customer.java deleted file mode 100644 index b19d0b7952..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/Customer.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.partialupdate.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - -@Entity -public class Customer { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - public long id; - public String name; - public String phone; - //... - public String phone99; - - @Override public String toString() { - return String.format("Customer %s, Phone: %s", - this.name, this.phone); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/CustomerDto.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/CustomerDto.java deleted file mode 100644 index 0ecf206d9a..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/CustomerDto.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.partialupdate.model; - -public class CustomerDto { - private long id; - public String name; - public String phone; - //... - private String phone99; - - public CustomerDto(long id) { - this.id = id; - } - - public CustomerDto(Customer c) { - this.id = c.id; - this.name = c.name; - this.phone = c.phone; - } - - public long getId() { - return this.id; - } - - public Customer convertToEntity() { - Customer c = new Customer(); - c.id = id; - c.name = name; - c.phone = phone; - return c; - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/CustomerStructured.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/CustomerStructured.java deleted file mode 100644 index dd053a963d..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/model/CustomerStructured.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.partialupdate.model; - -import java.util.List; - -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; - -@Entity -public class CustomerStructured { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - public long id; - public String name; - @OneToMany(fetch = FetchType.EAGER, targetEntity = ContactPhone.class, mappedBy = "customerId") - public List contactPhones; - - @Override public String toString() { - return String.format("Customer %s, Phone: %s", - this.name, this.contactPhones.stream() - .map(e -> e.toString()).reduce("", String::concat)); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/ContactPhoneRepository.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/ContactPhoneRepository.java deleted file mode 100644 index 4668181e05..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/ContactPhoneRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.partialupdate.repository; - -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -import com.baeldung.partialupdate.model.ContactPhone; - -@Repository -public interface ContactPhoneRepository extends CrudRepository { - ContactPhone findById(long id); - ContactPhone findByCustomerId(long id); -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/CustomerRepository.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/CustomerRepository.java deleted file mode 100644 index 43e61df8ab..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/CustomerRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.partialupdate.repository; - -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.data.repository.query.Param; -import org.springframework.stereotype.Repository; - -import com.baeldung.partialupdate.model.Customer; - -@Repository -public interface CustomerRepository extends CrudRepository { - Customer findById(long id); - - @Modifying - @Query("update Customer u set u.phone = :phone where u.id = :id") - void updatePhone(@Param(value = "id") long id, @Param(value = "phone") String phone); -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/CustomerStructuredRepository.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/CustomerStructuredRepository.java deleted file mode 100644 index 0f9fd1e92e..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/repository/CustomerStructuredRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.partialupdate.repository; - -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - -import com.baeldung.partialupdate.model.CustomerStructured; - -@Repository -public interface CustomerStructuredRepository extends CrudRepository { - CustomerStructured findById(long id); -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/service/CustomerService.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/service/CustomerService.java deleted file mode 100644 index 9da97a7775..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/service/CustomerService.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.baeldung.partialupdate.service; - -import javax.transaction.Transactional; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.baeldung.partialupdate.model.ContactPhone; -import com.baeldung.partialupdate.model.Customer; -import com.baeldung.partialupdate.model.CustomerDto; -import com.baeldung.partialupdate.model.CustomerStructured; -import com.baeldung.partialupdate.repository.ContactPhoneRepository; -import com.baeldung.partialupdate.repository.CustomerRepository; -import com.baeldung.partialupdate.repository.CustomerStructuredRepository; -import com.baeldung.partialupdate.util.CustomerMapper; - -@Service -@Transactional -public class CustomerService { - - @Autowired - CustomerRepository repo; - @Autowired - CustomerStructuredRepository repo2; - @Autowired - ContactPhoneRepository repo3; - @Autowired - CustomerMapper mapper; - - public Customer getCustomer(long id) { - return repo.findById(id); - } - - public void updateCustomerWithCustomQuery(long id, String phone) { - repo.updatePhone(id, phone); - } - - public Customer addCustomer(String name) { - Customer myCustomer = new Customer(); - myCustomer.name = name; - repo.save(myCustomer); - return myCustomer; - } - - public Customer updateCustomer(long id, String phone) { - Customer myCustomer = repo.findById(id); - myCustomer.phone = phone; - repo.save(myCustomer); - return myCustomer; - } - - public Customer addCustomer(CustomerDto dto) { - Customer myCustomer = new Customer(); - mapper.updateCustomerFromDto(dto, myCustomer); - repo.save(myCustomer); - return myCustomer; - } - - public Customer updateCustomer(CustomerDto dto) { - Customer myCustomer = repo.findById(dto.getId()); - mapper.updateCustomerFromDto(dto, myCustomer); - repo.save(myCustomer); - return myCustomer; - } - - public CustomerStructured addCustomerStructured(String name) { - CustomerStructured myCustomer = new CustomerStructured(); - myCustomer.name = name; - repo2.save(myCustomer); - return myCustomer; - } - - public void addCustomerPhone(long customerId, String phone) { - ContactPhone myPhone = new ContactPhone(); - myPhone.phone = phone; - myPhone.customerId = customerId; - repo3.save(myPhone); - } - - public CustomerStructured updateCustomerStructured(long id, String name) { - CustomerStructured myCustomer = repo2.findById(id); - myCustomer.name = name; - repo2.save(myCustomer); - return myCustomer; - } - -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/util/CustomerMapper.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/util/CustomerMapper.java deleted file mode 100644 index 8a666e3e6c..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/partialupdate/util/CustomerMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.partialupdate.util; - -import org.mapstruct.BeanMapping; -import org.mapstruct.Mapper; -import org.mapstruct.MappingTarget; -import org.mapstruct.NullValuePropertyMappingStrategy; - -import com.baeldung.partialupdate.model.Customer; -import com.baeldung.partialupdate.model.CustomerDto; - -@Mapper(componentModel = "spring") -public interface CustomerMapper { - @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE) - void updateCustomerFromDto(CustomerDto dto, @MappingTarget Customer entity); -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/AccountApplication.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/AccountApplication.java deleted file mode 100644 index 547992a6c1..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/AccountApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.schemageneration; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class AccountApplication { - - public static void main(String[] args) { - SpringApplication.run(AccountApplication.class, args); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/HibernateUtil.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/HibernateUtil.java deleted file mode 100644 index 7d69d65705..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/HibernateUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.schemageneration; - -import com.baeldung.schemageneration.model.Account; -import com.baeldung.schemageneration.model.AccountSetting; -import org.hibernate.boot.Metadata; -import org.hibernate.boot.MetadataSources; -import org.hibernate.boot.registry.StandardServiceRegistry; -import org.hibernate.boot.registry.StandardServiceRegistryBuilder; -import org.hibernate.cfg.Environment; -import org.hibernate.tool.hbm2ddl.SchemaExport; -import org.hibernate.tool.schema.TargetType; - -import java.util.EnumSet; -import java.util.HashMap; -import java.util.Map; - -public class HibernateUtil { - - /** - * Generates database create commands for the specified entities using Hibernate native API, SchemaExport. - * Creation commands are exported into the create.sql file. - */ - public static void generateSchema() { - Map settings = new HashMap<>(); - settings.put(Environment.URL, "jdbc:h2:mem:schema"); - - StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(settings).build(); - - MetadataSources metadataSources = new MetadataSources(serviceRegistry); - metadataSources.addAnnotatedClass(Account.class); - metadataSources.addAnnotatedClass(AccountSetting.class); - Metadata metadata = metadataSources.buildMetadata(); - - SchemaExport schemaExport = new SchemaExport(); - schemaExport.setFormat(true); - schemaExport.setOutputFile("create.sql"); - schemaExport.createOnly(EnumSet.of(TargetType.SCRIPT), metadata); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/model/Account.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/model/Account.java deleted file mode 100644 index 785e275e26..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/model/Account.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baeldung.schemageneration.model; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.Table; -import java.util.ArrayList; -import java.util.List; - -@Entity -@Table(name = "accounts") -public class Account { - - @Id - @GeneratedValue - private Long id; - - @Column(nullable = false, length = 100) - private String name; - - @Column(name = "email_address") - private String emailAddress; - - @OneToMany(mappedBy = "account", cascade = CascadeType.ALL) - private List accountSettings = new ArrayList<>(); - - public Account() { - } - - public Account(String name, String emailAddress) { - this.name = name; - this.emailAddress = emailAddress; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getEmailAddress() { - return emailAddress; - } - - public void setEmailAddress(String emailAddress) { - this.emailAddress = emailAddress; - } - - public List getAccountSettings() { - return accountSettings; - } - - public void setAccountSettings(List accountSettings) { - this.accountSettings = accountSettings; - } - - public void addAccountSetting(AccountSetting setting) { - this.accountSettings.add(setting); - setting.setAccount(this); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/model/AccountSetting.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/model/AccountSetting.java deleted file mode 100644 index 61e43894a8..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/model/AccountSetting.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.baeldung.schemageneration.model; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Entity -@Table(name = "account_settings") -public class AccountSetting { - - @Id - @GeneratedValue - private Long id; - - @Column(name = "name", nullable = false) - private String settingName; - - @Column(name = "value", nullable = false) - private String settingValue; - - @ManyToOne() - @JoinColumn(name ="account_id", nullable = false) - private Account account; - - public AccountSetting() { - } - - public AccountSetting(String settingName, String settingValue) { - this.settingName = settingName; - this.settingValue = settingValue; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getSettingName() { - return settingName; - } - - public void setSettingName(String settingName) { - this.settingName = settingName; - } - - public String getSettingValue() { - return settingValue; - } - - public void setSettingValue(String settingValue) { - this.settingValue = settingValue; - } - - public Account getAccount() { - return account; - } - - public void setAccount(Account account) { - this.account = account; - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/repository/AccountRepository.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/repository/AccountRepository.java deleted file mode 100644 index dc57ffe6d3..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/repository/AccountRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.schemageneration.repository; - -import com.baeldung.schemageneration.model.Account; -import org.springframework.data.repository.CrudRepository; - -public interface AccountRepository extends CrudRepository { - Account findByName(String name); -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/repository/AccountSettingRepository.java b/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/repository/AccountSettingRepository.java deleted file mode 100644 index c2b8ff7398..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/java/com/baeldung/schemageneration/repository/AccountSettingRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.schemageneration.repository; - -import com.baeldung.schemageneration.model.AccountSetting; -import org.springframework.data.repository.CrudRepository; - -public interface AccountSettingRepository extends CrudRepository { - AccountSetting findByAccountId(Long accountId); -} diff --git a/persistence-modules/spring-data-jpa-5/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-5/src/main/resources/application.properties deleted file mode 100644 index f55ad438ff..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/main/resources/application.properties +++ /dev/null @@ -1,13 +0,0 @@ - -spring.datasource.url=jdbc:h2:mem:baeldung - -# JPA-Schema-Generation -# Use below configuration to generate database schema create commands based on the entity models -# and export them into the create.sql file -#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql -#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-source=metadata -#spring.jpa.properties.hibernate.format_sql=true - -spring.jpa.show-sql=true - diff --git a/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/composite/repository/BookRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/composite/repository/BookRepositoryIntegrationTest.java deleted file mode 100644 index 9d25acbd96..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/composite/repository/BookRepositoryIntegrationTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.baeldung.composite.repository; - -import com.baeldung.composite.BookApplication; -import com.baeldung.composite.entity.Book; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = BookApplication.class) -public class BookRepositoryIntegrationTest { - - public static final String JAVA_101 = "Java101"; - public static final String JANE = "Jane"; - public static final String TECH = "Tech"; - @Autowired - BookRepository repository; - - @Before - public void setUp() { - Book book1 = new Book("John", JAVA_101, TECH, 20); - Book book2 = new Book(JANE, JAVA_101, "Arch", 25); - Book book3 = new Book(JANE, "Scala101", TECH, 23); - - repository.saveAll(Arrays.asList(book1, book2, book3)); - } - - @After - public void tearDown() { - repository.deleteAll(); - } - - @Test - public void testFindByName() { - List books = repository.findByIdName(JAVA_101); - - assertEquals(2, books.size()); - } - - @Test - public void testFindByAuthor() { - List books = repository.findByIdAuthor(JANE); - - assertEquals(2, books.size()); - } - - @Test - public void testFindByGenre() { - List books = repository.findByGenre(TECH); - - assertEquals(2, books.size()); - } -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/partialupdate/PartialUpdateUnitTest.java b/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/partialupdate/PartialUpdateUnitTest.java deleted file mode 100644 index 874e18c4ad..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/partialupdate/PartialUpdateUnitTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.baeldung.partialupdate; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.partialupdate.model.Customer; -import com.baeldung.partialupdate.model.CustomerDto; -import com.baeldung.partialupdate.model.CustomerStructured; -import com.baeldung.partialupdate.service.CustomerService; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = PartialUpdateApplication.class) -public class PartialUpdateUnitTest { - - @Autowired - CustomerService service; - - @Test - public void givenCustomer_whenUpdate_thenSuccess() { - Customer myCustomer = service.addCustomer("John"); - myCustomer = service.updateCustomer(myCustomer.id, "+00"); - assertEquals("+00", myCustomer.phone); - } - - @Test - public void givenCustomer_whenUpdateWithQuery_thenSuccess() { - Customer myCustomer = service.addCustomer("John"); - service.updateCustomerWithCustomQuery(myCustomer.id, "+88"); - myCustomer = service.getCustomer(myCustomer.id); - assertEquals("+88", myCustomer.phone); - } - - @Test - public void givenCustomerDto_whenUpdateWithMapper_thenSuccess() { - CustomerDto dto = new CustomerDto(new Customer()); - dto.name = "Johnny"; - Customer entity = service.addCustomer(dto); - - CustomerDto dto2 = new CustomerDto(entity.id); - dto2.phone = "+44"; - entity = service.updateCustomer(dto2); - - assertEquals("Johnny", entity.name); - } - - @Test - public void givenCustomerStructured_whenUpdateCustomerPhone_thenSuccess() { - CustomerStructured myCustomer = service.addCustomerStructured("John"); - assertEquals(null, myCustomer.contactPhones); - - service.addCustomerPhone(myCustomer.id, "+44"); - myCustomer = service.updateCustomerStructured(myCustomer.id, "Mr. John"); - - assertNotEquals(null, myCustomer.contactPhones); - assertEquals(1, myCustomer.contactPhones.size()); - } -} diff --git a/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/schemageneration/AccountRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/schemageneration/AccountRepositoryIntegrationTest.java deleted file mode 100644 index 86a7671fe4..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/test/java/com/baeldung/schemageneration/AccountRepositoryIntegrationTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baeldung.schemageneration; - -import com.baeldung.schemageneration.model.Account; -import com.baeldung.schemageneration.model.AccountSetting; -import com.baeldung.schemageneration.repository.AccountRepository; -import com.baeldung.schemageneration.repository.AccountSettingRepository; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = AccountApplication.class) -public class AccountRepositoryIntegrationTest { - - private static final String USER_NAME = "Eduard"; - private static final String USER_EMAIL_ADDRESS = "eduard@gmx.com"; - private static final String ACCOUNT_SETTING_NAME = "Timezone"; - private static final String ACCOUNT_SETTING_VALUE = "UTC+02"; - - @Autowired - private AccountRepository accountRepository; - - @Autowired - private AccountSettingRepository accountSettingRepository; - - @After - public void tearDown() { - accountRepository.deleteAll(); - } - - @Test - public void givenNewAccount_whenSave_thenSuccess() { - Account account = new Account(USER_NAME, USER_EMAIL_ADDRESS); - accountRepository.save(account); - - assertEquals(1, accountRepository.count()); - } - - @Test - public void givenSavedAccount_whenFindByName_thenFound() { - Account account = new Account(USER_NAME, USER_EMAIL_ADDRESS); - accountRepository.save(account); - - Account accountFound = accountRepository.findByName(USER_NAME); - - assertNotNull(accountFound); - assertEquals(USER_NAME, accountFound.getName()); - assertEquals(USER_EMAIL_ADDRESS, accountFound.getEmailAddress()); - } - - @Test - public void givenSavedAccount_whenAccountSettingIsAdded_thenPersisted() { - Account account = new Account(USER_NAME, USER_EMAIL_ADDRESS); - account.addAccountSetting(new AccountSetting(ACCOUNT_SETTING_NAME, ACCOUNT_SETTING_VALUE)); - accountRepository.save(account); - - Account accountFound = accountRepository.findByName(USER_NAME); - assertNotNull(accountFound); - AccountSetting accountSetting = accountSettingRepository.findByAccountId(accountFound.getId()); - - assertNotNull(accountSetting); - assertEquals(ACCOUNT_SETTING_NAME, accountSetting.getSettingName()); - assertEquals(ACCOUNT_SETTING_VALUE, accountSetting.getSettingValue()); - } - -} diff --git a/persistence-modules/spring-data-jpa-5/src/test/resources/application-test.properties b/persistence-modules/spring-data-jpa-5/src/test/resources/application-test.properties deleted file mode 100644 index e3d39fe1e2..0000000000 --- a/persistence-modules/spring-data-jpa-5/src/test/resources/application-test.properties +++ /dev/null @@ -1,3 +0,0 @@ -spring.jpa.hibernate.ddl-auto=update -spring.datasource.url=jdbc:h2:mem:baeldung - diff --git a/persistence-modules/spring-data-jpa/README.md b/persistence-modules/spring-data-jpa/README.md deleted file mode 100644 index 1c43edf42b..0000000000 --- a/persistence-modules/spring-data-jpa/README.md +++ /dev/null @@ -1,25 +0,0 @@ -========= - -## Spring Data JPA Example Project - -### Relevant Articles: -- [Spring JPA – Multiple Databases](https://www.baeldung.com/spring-data-jpa-multiple-databases) -- [Spring Data JPA – Adding a Method in All Repositories](https://www.baeldung.com/spring-data-jpa-method-in-all-repositories) -- [An Advanced Tagging Implementation with JPA](https://www.baeldung.com/jpa-tagging-advanced) -- [Spring Data Annotations](https://www.baeldung.com/spring-data-annotations) -- [Spring Data Java 8 Support](https://www.baeldung.com/spring-data-java-8) -- [A Simple Tagging Implementation with JPA](https://www.baeldung.com/jpa-tagging) -- [Spring Data Composable Repositories](https://www.baeldung.com/spring-data-composable-repositories) -- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) -- [DDD Aggregates and @DomainEvents](https://www.baeldung.com/spring-data-ddd) -- [Spring Data – CrudRepository save() Method](https://www.baeldung.com/spring-data-crud-repository-save) - -### Eclipse Config -After importing the project into Eclipse, you may see the following error: -"No persistence xml file found in project" - -This can be ignored: -- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" -Or: -- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator - diff --git a/persistence-modules/spring-data-jpa/pom.xml b/persistence-modules/spring-data-jpa/pom.xml deleted file mode 100644 index ddd7e17dcd..0000000000 --- a/persistence-modules/spring-data-jpa/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - 4.0.0 - spring-data-jpa - spring-data-jpa - - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.hibernate - hibernate-ehcache - - - org.hibernate - hibernate-envers - - - - com.h2database - h2 - - - - - org.testcontainers - postgresql - ${testcontainers.postgresql.version} - test - - - - org.postgresql - postgresql - - - - - org.springframework.security - spring-security-test - test - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - - com.google.guava - guava - ${guava.version} - - - - - com.baeldung.boot.Application - 1.10.6 - 42.2.5 - 21.0 - - - \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/Application.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/Application.java deleted file mode 100644 index c66921a3ca..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/Application.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.boot; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; - -import com.baeldung.boot.daos.impl.ExtendedRepositoryImpl; - -@SpringBootApplication -@EnableJpaRepositories(repositoryBaseClass = ExtendedRepositoryImpl.class) -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/config/PersistenceConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/config/PersistenceConfiguration.java deleted file mode 100644 index 76d5887030..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/config/PersistenceConfiguration.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.boot.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.baeldung.boot.services.IBarService; -import com.baeldung.boot.services.impl.BarSpringDataJpaService; - -@Configuration -@Profile("!tc") -@EnableTransactionManagement -@EnableJpaAuditing -public class PersistenceConfiguration { - - @Bean - public IBarService barSpringDataJpaService() { - return new BarSpringDataJpaService(); - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ArticleRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ArticleRepository.java deleted file mode 100644 index 73397ad42e..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ArticleRepository.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -import com.baeldung.boot.domain.Article; - -import java.util.Date; -import java.util.List; - -public interface ArticleRepository extends JpaRepository { - - List
    findAllByPublicationDate(Date publicationDate); - - List
    findAllByPublicationTimeBetween(Date publicationTimeStart, - Date publicationTimeEnd); - - @Query("select a from Article a where a.creationDateTime <= :creationDateTime") - List
    findAllWithCreationDateTimeBefore( - @Param("creationDateTime") Date creationDateTime); - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/CustomItemRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/CustomItemRepository.java deleted file mode 100644 index 0aebe34921..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/CustomItemRepository.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.stereotype.Repository; - -import com.baeldung.boot.domain.Item; - -@Repository -public interface CustomItemRepository { - - void deleteCustom(Item entity); - - Item findItemById(Long id); - - void findThenDelete(Long id); - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/CustomItemTypeRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/CustomItemTypeRepository.java deleted file mode 100644 index 832d61408c..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/CustomItemTypeRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.stereotype.Repository; - -import com.baeldung.boot.domain.ItemType; - -@Repository -public interface CustomItemTypeRepository { - - void deleteCustom(ItemType entity); - - void findThenDelete(Long id); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ExtendedRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ExtendedRepository.java deleted file mode 100644 index adb2af4320..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ExtendedRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.boot.daos; - -import java.io.Serializable; -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.repository.NoRepositoryBean; - -@NoRepositoryBean -public interface ExtendedRepository extends JpaRepository { - - List findByAttributeContainsText(String attributeName, String text); - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ExtendedStudentRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ExtendedStudentRepository.java deleted file mode 100644 index c9b0192536..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ExtendedStudentRepository.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.baeldung.boot.daos; - -import com.baeldung.boot.domain.Student; - -public interface ExtendedStudentRepository extends ExtendedRepository { -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/IBarCrudRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/IBarCrudRepository.java deleted file mode 100644 index 921fabe3fb..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/IBarCrudRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.data.repository.CrudRepository; - -import com.baeldung.boot.domain.Bar; - -import java.io.Serializable; - -public interface IBarCrudRepository extends CrudRepository { - // -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/IFooDao.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/IFooDao.java deleted file mode 100644 index d537772076..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/IFooDao.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -import com.baeldung.boot.domain.Foo; - -public interface IFooDao extends JpaRepository { - - @Query("SELECT f FROM Foo f WHERE LOWER(f.name) = LOWER(:name)") - Foo retrieveByName(@Param("name") String name); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/InventoryRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/InventoryRepository.java deleted file mode 100644 index 606f3993d5..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/InventoryRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.data.repository.CrudRepository; - -import com.baeldung.boot.domain.MerchandiseEntity; - -public interface InventoryRepository extends CrudRepository { -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ItemTypeRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ItemTypeRepository.java deleted file mode 100644 index 413c09e968..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ItemTypeRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import com.baeldung.boot.domain.ItemType; - -@Repository -public interface ItemTypeRepository extends JpaRepository, CustomItemTypeRepository, CustomItemRepository { -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/LocationRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/LocationRepository.java deleted file mode 100644 index 697ce295d0..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/LocationRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.boot.daos; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import com.baeldung.boot.domain.Location; - -@Repository -public interface LocationRepository extends JpaRepository { -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ReadOnlyLocationRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ReadOnlyLocationRepository.java deleted file mode 100644 index 3a2ea3cda5..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/ReadOnlyLocationRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.boot.daos; - -import java.util.Optional; - -import org.springframework.data.repository.Repository; - -import com.baeldung.boot.domain.Location; - -@org.springframework.stereotype.Repository -public interface ReadOnlyLocationRepository extends Repository { - - Optional findById(Long id); - - Location save(Location location); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/StoreRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/StoreRepository.java deleted file mode 100644 index ae13f75f66..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/StoreRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.boot.daos; - -import java.util.List; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -import com.baeldung.boot.domain.Store; - -@Repository -public interface StoreRepository extends JpaRepository { - List findStoreByLocationId(Long locationId); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/CustomItemRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/CustomItemRepositoryImpl.java deleted file mode 100644 index 820a2cdd41..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/CustomItemRepositoryImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.boot.daos.impl; - -import javax.persistence.EntityManager; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -import com.baeldung.boot.daos.CustomItemRepository; -import com.baeldung.boot.domain.Item; - -@Repository -public class CustomItemRepositoryImpl implements CustomItemRepository { - - @Autowired - private EntityManager entityManager; - - @Override - public void deleteCustom(Item item) { - entityManager.remove(item); - } - - @Override - public Item findItemById(Long id) { - return entityManager.find(Item.class, id); - } - - @Override - public void findThenDelete(Long id) { - final Item item = entityManager.find(Item.class, id); - entityManager.remove(item); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/CustomItemTypeRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/CustomItemTypeRepositoryImpl.java deleted file mode 100644 index e057f36b26..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/CustomItemTypeRepositoryImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.boot.daos.impl; - -import javax.persistence.EntityManager; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; - -import com.baeldung.boot.daos.CustomItemTypeRepository; -import com.baeldung.boot.domain.ItemType; - -@Repository -public class CustomItemTypeRepositoryImpl implements CustomItemTypeRepository { - - @Autowired - private EntityManager entityManager; - - @Override - public void deleteCustom(ItemType itemType) { - entityManager.remove(itemType); - } - - @Override - public void findThenDelete(Long id) { - ItemType itemTypeToDelete = entityManager.find(ItemType.class, id); - entityManager.remove(itemTypeToDelete); - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/ExtendedRepositoryImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/ExtendedRepositoryImpl.java deleted file mode 100644 index fbe6695844..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/impl/ExtendedRepositoryImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.boot.daos.impl; - -import java.io.Serializable; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Root; -import javax.transaction.Transactional; - -import org.springframework.data.jpa.repository.support.JpaEntityInformation; -import org.springframework.data.jpa.repository.support.SimpleJpaRepository; - -import com.baeldung.boot.daos.ExtendedRepository; - -public class ExtendedRepositoryImpl extends SimpleJpaRepository implements ExtendedRepository { - - private EntityManager entityManager; - - public ExtendedRepositoryImpl(JpaEntityInformation entityInformation, EntityManager entityManager) { - super(entityInformation, entityManager); - this.entityManager = entityManager; - } - - @Transactional - public List findByAttributeContainsText(String attributeName, String text) { - CriteriaBuilder builder = entityManager.getCriteriaBuilder(); - CriteriaQuery query = builder.createQuery(getDomainClass()); - Root root = query.from(getDomainClass()); - query.select(root).where(builder.like(root. get(attributeName), "%" + text + "%")); - TypedQuery q = entityManager.createQuery(query); - return q.getResultList(); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/PossessionRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/PossessionRepository.java deleted file mode 100644 index e102754c18..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/PossessionRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.boot.daos.user; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.boot.domain.Possession; - -public interface PossessionRepository extends JpaRepository { - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepository.java deleted file mode 100644 index 53f692ff28..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepository.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.baeldung.boot.daos.user; - -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.domain.Sort; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; - -import com.baeldung.boot.domain.User; - -import java.time.LocalDate; -import java.util.Collection; -import java.util.List; -import java.util.stream.Stream; - -public interface UserRepository extends JpaRepository , UserRepositoryCustom{ - - Stream findAllByName(String name); - - @Query("SELECT u FROM User u WHERE u.status = 1") - Collection findAllActiveUsers(); - - @Query("select u from User u where u.email like '%@gmail.com'") - List findUsersWithGmailAddress(); - - @Query(value = "SELECT * FROM Users u WHERE u.status = 1", nativeQuery = true) - Collection findAllActiveUsersNative(); - - @Query("SELECT u FROM User u WHERE u.status = ?1") - User findUserByStatus(Integer status); - - @Query(value = "SELECT * FROM Users u WHERE u.status = ?1", nativeQuery = true) - User findUserByStatusNative(Integer status); - - @Query("SELECT u FROM User u WHERE u.status = ?1 and u.name = ?2") - User findUserByStatusAndName(Integer status, String name); - - @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") - User findUserByStatusAndNameNamedParams(@Param("status") Integer status, @Param("name") String name); - - @Query(value = "SELECT * FROM Users u WHERE u.status = :status AND u.name = :name", nativeQuery = true) - User findUserByStatusAndNameNamedParamsNative(@Param("status") Integer status, @Param("name") String name); - - @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") - User findUserByUserStatusAndUserName(@Param("status") Integer userStatus, @Param("name") String userName); - - @Query("SELECT u FROM User u WHERE u.name like ?1%") - User findUserByNameLike(String name); - - @Query("SELECT u FROM User u WHERE u.name like :name%") - User findUserByNameLikeNamedParam(@Param("name") String name); - - @Query(value = "SELECT * FROM users u WHERE u.name LIKE ?1%", nativeQuery = true) - User findUserByNameLikeNative(String name); - - @Query(value = "SELECT u FROM User u") - List findAllUsers(Sort sort); - - @Query(value = "SELECT u FROM User u ORDER BY id") - Page findAllUsersWithPagination(Pageable pageable); - - @Query(value = "SELECT * FROM Users ORDER BY id", countQuery = "SELECT count(*) FROM Users", nativeQuery = true) - Page findAllUsersWithPaginationNative(Pageable pageable); - - @Modifying - @Query("update User u set u.status = :status where u.name = :name") - int updateUserSetStatusForName(@Param("status") Integer status, @Param("name") String name); - - @Modifying - @Query(value = "UPDATE Users u SET u.status = ? WHERE u.name = ?", nativeQuery = true) - int updateUserSetStatusForNameNative(Integer status, String name); - - @Query(value = "INSERT INTO Users (name, age, email, status, active) VALUES (:name, :age, :email, :status, :active)", nativeQuery = true) - @Modifying - void insertUser(@Param("name") String name, @Param("age") Integer age, @Param("email") String email, @Param("status") Integer status, @Param("active") boolean active); - - @Modifying - @Query(value = "UPDATE Users u SET status = ? WHERE u.name = ?", nativeQuery = true) - int updateUserSetStatusForNameNativePostgres(Integer status, String name); - - @Query(value = "SELECT u FROM User u WHERE u.name IN :names") - List findUserByNameList(@Param("names") Collection names); - - void deleteAllByCreationDateAfter(LocalDate date); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query("update User u set u.active = false where u.lastLoginDate < :date") - void deactivateUsersNotLoggedInSince(@Param("date") LocalDate date); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query("delete User u where u.active = false") - int deleteDeactivatedUsers(); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query(value = "alter table USERS add column deleted int(1) not null default 0", nativeQuery = true) - void addDeletedColumn(); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java deleted file mode 100644 index c586b54027..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustom.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.boot.daos.user; - -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.function.Predicate; - -import com.baeldung.boot.domain.User; - -public interface UserRepositoryCustom { - List findUserByEmails(Set emails); - - List findAllUsersByPredicates(Collection> predicates); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java deleted file mode 100644 index 63a743b6b5..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/daos/user/UserRepositoryCustomImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.baeldung.boot.daos.user; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Path; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import com.baeldung.boot.domain.User; - -public class UserRepositoryCustomImpl implements UserRepositoryCustom { - - @PersistenceContext - private EntityManager entityManager; - - @Override - public List findUserByEmails(Set emails) { - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery query = cb.createQuery(User.class); - Root user = query.from(User.class); - - Path emailPath = user.get("email"); - - List predicates = new ArrayList<>(); - for (String email : emails) { - - predicates.add(cb.like(emailPath, email)); - - } - query.select(user) - .where(cb.or(predicates.toArray(new Predicate[predicates.size()]))); - - return entityManager.createQuery(query) - .getResultList(); - } - - @Override - public List findAllUsersByPredicates(Collection> predicates) { - List allUsers = entityManager.createQuery("select u from User u", User.class).getResultList(); - Stream allUsersStream = allUsers.stream(); - for (java.util.function.Predicate predicate : predicates) { - allUsersStream = allUsersStream.filter(predicate); - } - - return allUsersStream.collect(Collectors.toList()); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate.java deleted file mode 100644 index e435f4c85c..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Transient; - -import org.springframework.context.ApplicationEventPublisher; - -@Entity -class Aggregate { - @Transient - private ApplicationEventPublisher eventPublisher; - @Id - private long id; - - private Aggregate() { - } - - Aggregate(long id, ApplicationEventPublisher eventPublisher) { - this.id = id; - this.eventPublisher = eventPublisher; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "DomainEntity [id=" + id + "]"; - } - - void domainOperation() { - // some business logic - if (eventPublisher != null) { - eventPublisher.publishEvent(new DomainEvent()); - } - } - - long getId() { - return id; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate2.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate2.java deleted file mode 100644 index 08f61db812..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate2.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import java.util.ArrayList; -import java.util.Collection; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Transient; - -import org.springframework.data.domain.AfterDomainEventPublication; -import org.springframework.data.domain.DomainEvents; - -@Entity -public class Aggregate2 { - @Transient - private final Collection domainEvents; - @Id - @GeneratedValue - private long id; - - public Aggregate2() { - domainEvents = new ArrayList<>(); - } - - @AfterDomainEventPublication - public void clearEvents() { - domainEvents.clear(); - } - - public void domainOperation() { - // some domain operation - domainEvents.add(new DomainEvent()); - } - - @DomainEvents - public Collection events() { - return domainEvents; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate2Repository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate2Repository.java deleted file mode 100644 index 7f09c410fc..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate2Repository.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import org.springframework.data.repository.CrudRepository; - -public interface Aggregate2Repository extends CrudRepository { - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate3.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate3.java deleted file mode 100644 index f664322a59..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate3.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -import org.springframework.data.domain.AbstractAggregateRoot; - -@Entity -public class Aggregate3 extends AbstractAggregateRoot { - @Id - @GeneratedValue - private long id; - - public void domainOperation() { - // some domain operation - registerEvent(new DomainEvent()); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate3Repository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate3Repository.java deleted file mode 100644 index 93f50bb5cf..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/Aggregate3Repository.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import org.springframework.data.repository.CrudRepository; - -/** - * @author goobar - * - */ -public interface Aggregate3Repository extends CrudRepository { - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/AggregateRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/AggregateRepository.java deleted file mode 100644 index 1c2d3884bf..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/AggregateRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import org.springframework.data.repository.CrudRepository; - -public interface AggregateRepository extends CrudRepository { - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DddConfig.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DddConfig.java deleted file mode 100644 index 34cf21463b..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DddConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import org.springframework.boot.SpringBootConfiguration; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.PropertySource; - -@SpringBootConfiguration -@EnableAutoConfiguration -@PropertySource("classpath:/ddd.properties") -public class DddConfig { - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DomainEvent.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DomainEvent.java deleted file mode 100644 index e7626e742d..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DomainEvent.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -class DomainEvent { - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DomainService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DomainService.java deleted file mode 100644 index 80aa5ca6cb..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/ddd/event/DomainService.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import javax.transaction.Transactional; - -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.stereotype.Service; - -@Service -public class DomainService { - private final ApplicationEventPublisher eventPublisher; - private final AggregateRepository repository; - - public DomainService(AggregateRepository repository, ApplicationEventPublisher eventPublisher) { - this.repository = repository; - this.eventPublisher = eventPublisher; - } - - @Transactional - public void serviceDomainOperation(long entityId) { - repository.findById(entityId) - .ifPresent(entity -> { - entity.domainOperation(); - repository.save(entity); - eventPublisher.publishEvent(new DomainEvent()); - }); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Article.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Article.java deleted file mode 100644 index de4dbed1a0..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Article.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.*; -import java.util.Date; - -@Entity -public class Article { - - @Id - @GeneratedValue - private Integer id; - @Temporal(TemporalType.DATE) - private Date publicationDate; - @Temporal(TemporalType.TIME) - private Date publicationTime; - @Temporal(TemporalType.TIMESTAMP) - private Date creationDateTime; - - public Integer getId() { - return id; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Bar.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Bar.java deleted file mode 100644 index 35d1903801..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Bar.java +++ /dev/null @@ -1,220 +0,0 @@ -package com.baeldung.boot.domain; - -import com.google.common.collect.Sets; -import org.hibernate.annotations.OrderBy; -import org.hibernate.envers.Audited; -import org.jboss.logging.Logger; -import org.springframework.data.annotation.CreatedBy; -import org.springframework.data.annotation.CreatedDate; -import org.springframework.data.annotation.LastModifiedBy; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.Date; -import java.util.Set; - -@Entity -@NamedQuery(name = "Bar.findAll", query = "SELECT b FROM Bar b") -@Audited -@EntityListeners(AuditingEntityListener.class) -public class Bar implements Serializable { - - private static Logger logger = Logger.getLogger(Bar.class); - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private int id; - - @Column(name = "name") - private String name; - @OneToMany(mappedBy = "bar", cascade = CascadeType.ALL, fetch = FetchType.LAZY) - @OrderBy(clause = "NAME DESC") - // @NotAudited - private Set fooSet = Sets.newHashSet(); - @Column(name = "operation") - private String operation; - @Column(name = "timestamp") - private long timestamp; - @Column(name = "created_date", updatable = false, nullable = false) - @CreatedDate - private long createdDate; - @Column(name = "modified_date") - @LastModifiedDate - private long modifiedDate; - @Column(name = "created_by") - @CreatedBy - private String createdBy; - @Column(name = "modified_by") - @LastModifiedBy - private String modifiedBy; - - public Bar() { - super(); - } - - public Bar(final String name) { - super(); - - this.name = name; - } - - public Set getFooSet() { - return fooSet; - } - - // API - - public void setFooSet(final Set fooSet) { - this.fooSet = fooSet; - } - - public int getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public OPERATION getOperation() { - return OPERATION.parse(operation); - } - - public void setOperation(final String operation) { - this.operation = operation; - } - - public void setOperation(final OPERATION operation) { - this.operation = operation.getValue(); - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(final long timestamp) { - this.timestamp = timestamp; - } - - public long getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(final long createdDate) { - this.createdDate = createdDate; - } - - public long getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(final long modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(final String createdBy) { - this.createdBy = createdBy; - } - - public String getModifiedBy() { - return modifiedBy; - } - - public void setModifiedBy(final String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final Bar other = (Bar) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Bar [name=").append(name).append("]"); - return builder.toString(); - } - - @PrePersist - public void onPrePersist() { - logger.info("@PrePersist"); - audit(OPERATION.INSERT); - } - - @PreUpdate - public void onPreUpdate() { - logger.info("@PreUpdate"); - audit(OPERATION.UPDATE); - } - - @PreRemove - public void onPreRemove() { - logger.info("@PreRemove"); - audit(OPERATION.DELETE); - } - - private void audit(final OPERATION operation) { - setOperation(operation); - setTimestamp((new Date()).getTime()); - } - - public enum OPERATION { - INSERT, UPDATE, DELETE; - private String value; - - OPERATION() { - value = toString(); - } - - public static OPERATION parse(final String value) { - OPERATION operation = null; - for (final OPERATION op : OPERATION.values()) { - if (op.getValue().equals(value)) { - operation = op; - break; - } - } - return operation; - } - - public String getValue() { - return value; - } - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Foo.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Foo.java deleted file mode 100644 index 5030e5600b..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Foo.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.baeldung.boot.domain; - -import org.hibernate.envers.Audited; - -import javax.persistence.*; -import java.io.Serializable; - -@NamedNativeQueries({@NamedNativeQuery(name = "callGetAllFoos", query = "CALL GetAllFoos()", resultClass = Foo.class), @NamedNativeQuery(name = "callGetFoosByName", query = "CALL GetFoosByName(:fooName)", resultClass = Foo.class)}) -@Entity -@Audited -// @Proxy(lazy = false) -public class Foo implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private long id; - - @Column(name = "name", nullable = false) - private String name; - - @ManyToOne(targetEntity = Bar.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER) - @JoinColumn(name = "BAR_ID") - private Bar bar = new Bar(); - - public Foo() { - super(); - } - - public Foo(final String name) { - super(); - this.name = name; - } - - // - - public Bar getBar() { - return bar; - } - - public void setBar(final Bar bar) { - this.bar = bar; - } - - public long getId() { - return id; - } - - public void setId(final long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - // - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final Foo other = (Foo) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Foo [name=").append(name).append("]"); - return builder.toString(); - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Item.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Item.java deleted file mode 100644 index 8ac06af15a..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Item.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.baeldung.boot.domain; - -import java.math.BigDecimal; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToOne; - -@Entity -public class Item { - - private String color; - private String grade; - - @Id - private Long id; - - @ManyToOne - private ItemType itemType; - - private String name; - private BigDecimal price; - @ManyToOne - private Store store; - - public String getColor() { - return color; - } - - public String getGrade() { - return grade; - } - - public Long getId() { - return id; - } - - public ItemType getItemType() { - return itemType; - } - - public String getName() { - return name; - } - - public BigDecimal getPrice() { - return price; - } - - public Store getStore() { - return store; - } - - public void setColor(String color) { - this.color = color; - } - - public void setGrade(String grade) { - this.grade = grade; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItemType(ItemType itemType) { - this.itemType = itemType; - } - - public void setName(String name) { - this.name = name; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public void setStore(Store store) { - this.store = store; - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/ItemType.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/ItemType.java deleted file mode 100644 index 8a52a9847c..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/ItemType.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.boot.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; - -@Entity -public class ItemType { - - @Id - private Long id; - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "ITEM_TYPE_ID") - private List items = new ArrayList<>(); - - private String name; - - public Long getId() { - return id; - } - - public List getItems() { - return items; - } - - public String getName() { - return name; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItems(List items) { - this.items = items; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/KVTag.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/KVTag.java deleted file mode 100644 index 1901f43c0a..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/KVTag.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.Embeddable; - -@Embeddable -public class KVTag { - private String key; - private String value; - - public KVTag() { - } - - public KVTag(String key, String value) { - super(); - this.key = key; - this.value = value; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Location.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Location.java deleted file mode 100644 index 9c1b93d551..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Location.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baeldung.boot.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToMany; - -@Entity -public class Location { - - private String city; - private String country; - @Id - private Long id; - - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "LOCATION_ID") - private List stores = new ArrayList<>(); - - public String getCity() { - return city; - } - - public String getCountry() { - return country; - } - - public Long getId() { - return id; - } - - public List getStores() { - return stores; - } - - public void setCity(String city) { - this.city = city; - } - - public void setCountry(String country) { - this.country = country; - } - - public void setId(Long id) { - this.id = id; - } - - public void setStores(List stores) { - this.stores = stores; - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/MerchandiseEntity.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/MerchandiseEntity.java deleted file mode 100644 index e94c23de86..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/MerchandiseEntity.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import java.math.BigDecimal; - -@Entity -public class MerchandiseEntity { - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long id; - - private String title; - - private BigDecimal price; - - private String brand; - - public MerchandiseEntity() { - } - - public MerchandiseEntity(String title, BigDecimal price) { - this.title = title; - this.price = price; - } - - public Long getId() { - return id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public BigDecimal getPrice() { - return price; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public String getBrand() { - return brand; - } - - public void setBrand(String brand) { - this.brand = brand; - } - - @Override - public String toString() { - return "MerchandiseEntity{" + - "id=" + id + - ", title='" + title + '\'' + - ", price=" + price + - ", brand='" + brand + '\'' + - '}'; - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Possession.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Possession.java deleted file mode 100644 index f13491ad82..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Possession.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.*; -import com.baeldung.boot.domain.Possession; - -@Entity -@Table -public class Possession { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private long id; - - private String name; - - public Possession() { - super(); - } - - public Possession(final String name) { - super(); - - this.name = name; - } - - public long getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = (prime * result) + (int) (id ^ (id >>> 32)); - result = (prime * result) + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final Possession other = (Possession) obj; - if (id != other.id) { - return false; - } - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Possesion [id=").append(id).append(", name=").append(name).append("]"); - return builder.toString(); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/SkillTag.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/SkillTag.java deleted file mode 100644 index 0933a3e6af..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/SkillTag.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.Embeddable; - -@Embeddable -public class SkillTag { - private String name; - private int value; - - public SkillTag() { - } - - public SkillTag(String name, int value) { - super(); - this.name = name; - this.value = value; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } - - public String getName() { - return name; - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Store.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Store.java deleted file mode 100644 index 5b4b831cc7..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Store.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.baeldung.boot.domain; - -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; - -@Entity -public class Store { - - private Boolean active; - @Id - private Long id; - @OneToMany(cascade = CascadeType.ALL) - @JoinColumn(name = "STORE_ID") - private List items = new ArrayList<>(); - private Long itemsSold; - - @ManyToOne - private Location location; - - private String name; - - public Boolean getActive() { - return active; - } - - public Long getId() { - return id; - } - - public List getItems() { - return items; - } - - public Long getItemsSold() { - return itemsSold; - } - - public Location getLocation() { - return location; - } - - public String getName() { - return name; - } - - public void setActive(Boolean active) { - this.active = active; - } - - public void setId(Long id) { - this.id = id; - } - - public void setItems(List items) { - this.items = items; - } - - public void setItemsSold(Long itemsSold) { - this.itemsSold = itemsSold; - } - - public void setLocation(Location location) { - this.location = location; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Student.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Student.java deleted file mode 100644 index 1003167cc7..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/Student.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.Id; -import java.util.ArrayList; -import java.util.List; - -@Entity -public class Student { - - @Id - private long id; - private String name; - - @ElementCollection - private List tags = new ArrayList<>(); - - @ElementCollection - private List skillTags = new ArrayList<>(); - - @ElementCollection - private List kvTags = new ArrayList<>(); - - public Student() { - } - - public Student(long id, String name) { - super(); - this.id = id; - this.name = name; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags.addAll(tags); - } - - public List getSkillTags() { - return skillTags; - } - - public void setSkillTags(List skillTags) { - this.skillTags.addAll(skillTags); - } - - public List getKVTags() { - return this.kvTags; - } - - public void setKVTags(List kvTags) { - this.kvTags.addAll(kvTags); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/User.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/User.java deleted file mode 100644 index cca00e52a2..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/domain/User.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.baeldung.boot.domain; - -import javax.persistence.*; - -import java.time.LocalDate; -import java.util.List; -import java.util.Objects; - -@Entity -@Table(name = "users") -public class User { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private int id; - private String name; - private LocalDate creationDate; - private LocalDate lastLoginDate; - private boolean active; - private int age; - @Column(unique = true, nullable = false) - private String email; - private Integer status; - @OneToMany - List possessionList; - - public User() { - super(); - } - - public User(String name, LocalDate creationDate,String email, Integer status) { - this.name = name; - this.creationDate = creationDate; - this.email = email; - this.status = status; - this.active = true; - } - - public int getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public String getEmail() { - return email; - } - - public void setEmail(final String email) { - this.email = email; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public int getAge() { - return age; - } - - public void setAge(final int age) { - this.age = age; - } - - public LocalDate getCreationDate() { - return creationDate; - } - - public List getPossessionList() { - return possessionList; - } - - public void setPossessionList(List possessionList) { - this.possessionList = possessionList; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("User [name=").append(name).append(", id=").append(id).append("]"); - return builder.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - User user = (User) o; - return id == user.id && - age == user.age && - Objects.equals(name, user.name) && - Objects.equals(creationDate, user.creationDate) && - Objects.equals(email, user.email) && - Objects.equals(status, user.status); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, creationDate, age, email, status); - } - - public LocalDate getLastLoginDate() { - return lastLoginDate; - } - - public void setLastLoginDate(LocalDate lastLoginDate) { - this.lastLoginDate = lastLoginDate; - } - - public boolean isActive() { - return active; - } - - public void setActive(boolean active) { - this.active = active; - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IBarService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IBarService.java deleted file mode 100644 index 8054cbba59..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IBarService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.boot.services; - -import com.baeldung.boot.domain.Bar; - -public interface IBarService extends IOperations { - // -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IFooService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IFooService.java deleted file mode 100644 index 871cccdd45..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IFooService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.boot.services; - -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; - -import com.baeldung.boot.domain.Foo; - -public interface IFooService extends IOperations { - - Foo retrieveByName(String name); - - Page findPaginated(Pageable pageable); - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IOperations.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IOperations.java deleted file mode 100644 index ec2b866b6f..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/IOperations.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.boot.services; - -import org.springframework.data.domain.Page; - -import java.io.Serializable; -import java.util.List; - -public interface IOperations { - - T findOne(final long id); - - List findAll(); - - Page findPaginated(int page, int size); - - // write - - T create(final T entity); - - T update(final T entity); - - void delete(final T entity); - - void deleteById(final long entityId); - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/AbstractService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/AbstractService.java deleted file mode 100644 index f88d018bbb..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/AbstractService.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.baeldung.boot.services.impl; - -import com.baeldung.boot.services.IOperations; -import com.google.common.collect.Lists; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.repository.PagingAndSortingRepository; -import org.springframework.transaction.annotation.Transactional; - -import java.io.Serializable; -import java.util.List; - -@Transactional -public abstract class AbstractService implements IOperations { - - // read - one - - @Override - @Transactional(readOnly = true) - public T findOne(final long id) { - return getDao().findById(id).orElse(null); - } - - // read - all - - @Override - @Transactional(readOnly = true) - public List findAll() { - return Lists.newArrayList(getDao().findAll()); - } - - @Override - public Page findPaginated(final int page, final int size) { - return getDao().findAll(PageRequest.of(page, size)); - } - - // write - - @Override - public T create(final T entity) { - return getDao().save(entity); - } - - @Override - public T update(final T entity) { - return getDao().save(entity); - } - - @Override - public void delete(final T entity) { - getDao().delete(entity); - } - - @Override - public void deleteById(final long entityId) { - getDao().deleteById(entityId); - } - - protected abstract PagingAndSortingRepository getDao(); - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/AbstractSpringDataJpaService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/AbstractSpringDataJpaService.java deleted file mode 100644 index a73a6bd7fc..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/AbstractSpringDataJpaService.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baeldung.boot.services.impl; - -import com.baeldung.boot.services.IOperations; -import com.google.common.collect.Lists; -import org.springframework.data.repository.CrudRepository; -import org.springframework.transaction.annotation.Transactional; - -import java.io.Serializable; -import java.util.List; - -@Transactional(value = "transactionManager") -public abstract class AbstractSpringDataJpaService implements IOperations { - - @Override - public T findOne(final long id) { - return getDao().findById(id).orElse(null); - } - - @Override - public List findAll() { - return Lists.newArrayList(getDao().findAll()); - } - - @Override - public T create(final T entity) { - return getDao().save(entity); - } - - @Override - public T update(final T entity) { - return getDao().save(entity); - } - - @Override - public void delete(final T entity) { - getDao().delete(entity); - } - - @Override - public void deleteById(final long entityId) { - getDao().deleteById(entityId); - } - - protected abstract CrudRepository getDao(); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/BarSpringDataJpaService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/BarSpringDataJpaService.java deleted file mode 100644 index 80568f2fd4..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/BarSpringDataJpaService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.boot.services.impl; - -import com.baeldung.boot.daos.IBarCrudRepository; -import com.baeldung.boot.domain.Bar; -import com.baeldung.boot.services.IBarService; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.repository.CrudRepository; - -import java.io.Serializable; - -public class BarSpringDataJpaService extends AbstractSpringDataJpaService implements IBarService { - - @Autowired - private IBarCrudRepository dao; - - public BarSpringDataJpaService() { - super(); - } - - @Override - protected CrudRepository getDao() { - return dao; - } - - @Override - public Page findPaginated(int page, int size) { - throw new UnsupportedOperationException("Not implemented yet"); - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/FooService.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/FooService.java deleted file mode 100644 index 04eec63854..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/boot/services/impl/FooService.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baeldung.boot.services.impl; - -import com.google.common.collect.Lists; -import com.baeldung.boot.daos.IFooDao; -import com.baeldung.boot.domain.Foo; -import com.baeldung.boot.services.IFooService; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.repository.PagingAndSortingRepository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Service -@Transactional -public class FooService extends AbstractService implements IFooService { - - @Autowired - private IFooDao dao; - - public FooService() { - super(); - } - - // API - - @Override - protected PagingAndSortingRepository getDao() { - return dao; - } - - // custom methods - - @Override - public Foo retrieveByName(final String name) { - return dao.retrieveByName(name); - } - - // overridden to be secured - - @Override - @Transactional(readOnly = true) - public List findAll() { - return Lists.newArrayList(getDao().findAll()); - } - - @Override - public Page findPaginated(Pageable pageable) { - return dao.findAll(pageable); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java deleted file mode 100644 index 3b9aa2cc18..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/MultipleDbApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.multipledb; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class MultipleDbApplication { - - public static void main(String[] args) { - SpringApplication.run(MultipleDbApplication.class, args); - } - -} - diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceProductAutoConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceProductAutoConfiguration.java deleted file mode 100644 index a6f8f0829f..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceProductAutoConfiguration.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.baeldung.multipledb; - -import java.util.HashMap; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.jdbc.DataSourceBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; - -/** - * By default, the persistence-multiple-db.properties file is read for - * non auto configuration in PersistenceProductConfiguration. - *

    - * If we need to use persistence-multiple-db-boot.properties and auto configuration - * then uncomment the below @Configuration class and comment out PersistenceProductConfiguration. - */ -//@Configuration -@PropertySource({"classpath:persistence-multiple-db-boot.properties"}) -@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.product", entityManagerFactoryRef = "productEntityManager", transactionManagerRef = "productTransactionManager") -@Profile("!tc") -public class PersistenceProductAutoConfiguration { - @Autowired - private Environment env; - - public PersistenceProductAutoConfiguration() { - super(); - } - - // - - @Bean - public LocalContainerEntityManagerFactoryBean productEntityManager() { - final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(productDataSource()); - em.setPackagesToScan("com.baeldung.multipledb.model.product"); - - final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - em.setJpaVendorAdapter(vendorAdapter); - final HashMap properties = new HashMap(); - properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); - em.setJpaPropertyMap(properties); - - return em; - } - - @Bean - @ConfigurationProperties(prefix="spring.second-datasource") - public DataSource productDataSource() { - return DataSourceBuilder.create().build(); - } - - @Bean - public PlatformTransactionManager productTransactionManager() { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(productEntityManager().getObject()); - return transactionManager; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java deleted file mode 100644 index bcf2cd84eb..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceProductConfiguration.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.baeldung.multipledb; - -import com.google.common.base.Preconditions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; - -import javax.sql.DataSource; -import java.util.HashMap; - -@Configuration -@PropertySource({"classpath:persistence-multiple-db.properties"}) -@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.product", entityManagerFactoryRef = "productEntityManager", transactionManagerRef = "productTransactionManager") -@Profile("!tc") -public class PersistenceProductConfiguration { - @Autowired - private Environment env; - - public PersistenceProductConfiguration() { - super(); - } - - // - - @Bean - public LocalContainerEntityManagerFactoryBean productEntityManager() { - final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(productDataSource()); - em.setPackagesToScan("com.baeldung.multipledb.model.product"); - - final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - em.setJpaVendorAdapter(vendorAdapter); - final HashMap properties = new HashMap(); - properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); - em.setJpaPropertyMap(properties); - - return em; - } - - @Bean - public DataSource productDataSource() { - final DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("product.jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Bean - public PlatformTransactionManager productTransactionManager() { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(productEntityManager().getObject()); - return transactionManager; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceUserAutoConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceUserAutoConfiguration.java deleted file mode 100644 index e04a1621b2..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceUserAutoConfiguration.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baeldung.multipledb; - -import java.util.HashMap; - -import javax.sql.DataSource; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.jdbc.DataSourceBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.Profile; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; - -/** - * By default, the persistence-multiple-db.properties file is read for - * non auto configuration in PersistenceUserConfiguration. - *

    - * If we need to use persistence-multiple-db-boot.properties and auto configuration - * then uncomment the below @Configuration class and comment out PersistenceUserConfiguration. - */ -//@Configuration -@PropertySource({"classpath:persistence-multiple-db-boot.properties"}) -@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.user", entityManagerFactoryRef = "userEntityManager", transactionManagerRef = "userTransactionManager") -@Profile("!tc") -public class PersistenceUserAutoConfiguration { - @Autowired - private Environment env; - - public PersistenceUserAutoConfiguration() { - super(); - } - - // - - @Primary - @Bean - public LocalContainerEntityManagerFactoryBean userEntityManager() { - final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(userDataSource()); - em.setPackagesToScan("com.baeldung.multipledb.model.user"); - - final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - em.setJpaVendorAdapter(vendorAdapter); - final HashMap properties = new HashMap(); - properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); - em.setJpaPropertyMap(properties); - - return em; - } - - @Bean - @Primary - @ConfigurationProperties(prefix="spring.datasource") - public DataSource userDataSource() { - return DataSourceBuilder.create().build(); - } - - @Primary - @Bean - public PlatformTransactionManager userTransactionManager() { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(userEntityManager().getObject()); - return transactionManager; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceUserConfiguration.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceUserConfiguration.java deleted file mode 100644 index 6b48455c0c..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/PersistenceUserConfiguration.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.baeldung.multipledb; - -import com.google.common.base.Preconditions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.*; -import org.springframework.core.env.Environment; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; - -import javax.sql.DataSource; -import java.util.HashMap; - -@Configuration -@PropertySource({"classpath:persistence-multiple-db.properties"}) -@EnableJpaRepositories(basePackages = "com.baeldung.multipledb.dao.user", entityManagerFactoryRef = "userEntityManager", transactionManagerRef = "userTransactionManager") -@Profile("!tc") -public class PersistenceUserConfiguration { - @Autowired - private Environment env; - - public PersistenceUserConfiguration() { - super(); - } - - // - - @Primary - @Bean - public LocalContainerEntityManagerFactoryBean userEntityManager() { - System.out.println("loading config"); - final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(userDataSource()); - em.setPackagesToScan("com.baeldung.multipledb.model.user"); - - final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - em.setJpaVendorAdapter(vendorAdapter); - final HashMap properties = new HashMap(); - properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); - em.setJpaPropertyMap(properties); - - return em; - } - - @Primary - @Bean - public DataSource userDataSource() { - final DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("user.jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Primary - @Bean - public PlatformTransactionManager userTransactionManager() { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(userEntityManager().getObject()); - return transactionManager; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java deleted file mode 100755 index f1256e2c72..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/product/ProductRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.multipledb.dao.product; - -import java.util.List; - -import org.springframework.data.domain.Pageable; -import org.springframework.data.repository.PagingAndSortingRepository; - -import com.baeldung.multipledb.model.product.Product; - -public interface ProductRepository extends PagingAndSortingRepository { - - - List findAllByPrice(double price, Pageable pageable); -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java deleted file mode 100644 index ae37fde20d..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.multipledb.dao.user; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.multipledb.model.user.PossessionMultipleDB; - -public interface PossessionRepository extends JpaRepository { - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java deleted file mode 100644 index 267a61a93f..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.multipledb.dao.user; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.multipledb.model.user.UserMultipleDB; - -public interface UserRepository extends JpaRepository { -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/Product.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/Product.java deleted file mode 100755 index eaf471043c..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/product/Product.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.baeldung.multipledb.model.product; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(schema = "products") -public class Product { - - @Id - private int id; - - private String name; - - private double price; - - public Product() { - super(); - } - - private Product(int id, String name, double price) { - super(); - this.id = id; - this.name = name; - this.price = price; - } - - public static Product from(int id, String name, double price) { - return new Product(id, name, price); - } - - public int getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public double getPrice() { - return price; - } - - public void setPrice(final double price) { - this.price = price; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Product [name=") - .append(name) - .append(", id=") - .append(id) - .append("]"); - return builder.toString(); - } -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java deleted file mode 100644 index a6a3c88bd0..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.baeldung.multipledb.model.user; - -import javax.persistence.*; - -@Entity -@Table -public class PossessionMultipleDB { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private long id; - - private String name; - - public PossessionMultipleDB() { - super(); - } - - public PossessionMultipleDB(final String name) { - super(); - - this.name = name; - } - - public long getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = (prime * result) + (int) (id ^ (id >>> 32)); - result = (prime * result) + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final PossessionMultipleDB other = (PossessionMultipleDB) obj; - if (id != other.id) { - return false; - } - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Possesion [id=").append(id).append(", name=").append(name).append("]"); - return builder.toString(); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java b/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java deleted file mode 100644 index c7cd07f7a1..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.baeldung.multipledb.model.user; - -import javax.persistence.*; - -import java.util.List; - -@Entity -@Table(name = "users") -public class UserMultipleDB { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private int id; - private String name; - private int age; - @Column(unique = true, nullable = false) - private String email; - private Integer status; - - @OneToMany - List possessionList; - - public UserMultipleDB() { - super(); - } - - public UserMultipleDB(String name, String email, Integer status) { - this.name = name; - this.email = email; - this.status = status; - } - - public int getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public String getEmail() { - return email; - } - - public void setEmail(final String email) { - this.email = email; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public int getAge() { - return age; - } - - public void setAge(final int age) { - this.age = age; - } - - public List getPossessionList() { - return possessionList; - } - - public void setPossessionList(List possessionList) { - this.possessionList = possessionList; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("User [name=").append(name).append(", id=").append(id).append("]"); - return builder.toString(); - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/main/resources/application.properties b/persistence-modules/spring-data-jpa/src/main/resources/application.properties deleted file mode 100644 index f127dd5e50..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/resources/application.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.main.allow-bean-definition-overriding=true - -spring.jpa.properties.hibernate.jdbc.batch_size=4 -spring.jpa.properties.hibernate.order_inserts=true -spring.jpa.properties.hibernate.order_updates=true -spring.jpa.properties.hibernate.generate_statistics=true diff --git a/persistence-modules/spring-data-jpa/src/main/resources/ddd.properties b/persistence-modules/spring-data-jpa/src/main/resources/ddd.properties deleted file mode 100644 index e5126b694b..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/resources/ddd.properties +++ /dev/null @@ -1 +0,0 @@ -spring.datasource.initialization-mode=never \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/main/resources/import_entities.sql b/persistence-modules/spring-data-jpa/src/main/resources/import_entities.sql deleted file mode 100644 index deb9d07f05..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/resources/import_entities.sql +++ /dev/null @@ -1,21 +0,0 @@ -insert into Article(id, publication_date, publication_time, creation_date_time) values(1, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:00', 'HH24:MI'), TO_DATE('31/12/2017 07:30', 'DD/MM/YYYY HH24:MI')); -insert into Article(id, publication_date, publication_time, creation_date_time) values(2, TO_DATE('01/01/2018', 'DD/MM/YYYY'), TO_DATE('15:30', 'HH24:MI'), TO_DATE('15/12/2017 08:00', 'DD/MM/YYYY HH24:MI')); -insert into Article(id, publication_date, publication_time, creation_date_time) values(3, TO_DATE('15/12/2017', 'DD/MM/YYYY'), TO_DATE('16:00', 'HH24:MI'), TO_DATE('01/12/2017 13:45', 'DD/MM/YYYY HH24:MI')); - -insert into location (id, country, city) values (1, 'Country X', 'City One'); -insert into location (id, country, city) values (2, 'Country X', 'City Two'); -insert into location (id, country, city) values (3, 'Country X', 'City Three'); - -insert into store (id, name, location_id, items_sold, active) values (1, 'Store One', 3, 130000, true); -insert into store (id, name, location_id, items_sold, active) values (2, 'Store Two', 1, 170000, false); - -insert into item_type (id, name) values (1, 'Food'); -insert into item_type (id, name) values (2, 'Furniture'); -insert into item_type (id, name) values (3, 'Electronics'); - -insert into item (id, name, store_id, item_type_id, price, grade, color) values (1, 'Food Item One', 1, 1, 100, 'A', 'Color x'); -insert into item (id, name, store_id, item_type_id, price, grade, color) values (2, 'Furniture Item One', 1, 2, 2500, 'B', 'Color y'); -insert into item (id, name, store_id, item_type_id, price, grade, color) values (3, 'Food Item Two', 1, 1, 35, 'A', 'Color z'); -insert into item (id, name, store_id, item_type_id, price, grade, color) values (5, 'Furniture Item Two', 2, 2, 1600, 'A', 'Color w'); -insert into item (id, name, store_id, item_type_id, price, grade, color) values (6, 'Food Item Three', 2, 1, 5, 'B', 'Color a'); -insert into item (id, name, store_id, item_type_id, price, grade, color) values (7, 'Electronics Item One', 2, 3, 999, 'B', 'Color b'); diff --git a/persistence-modules/spring-data-jpa/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db-boot.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db-boot.properties deleted file mode 100644 index ffca79b3f5..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db-boot.properties +++ /dev/null @@ -1,11 +0,0 @@ -hibernate.hbm2ddl.auto=create-drop -hibernate.cache.use_second_level_cache=false -hibernate.cache.use_query_cache=false - -spring.datasource.jdbcUrl=jdbc:h2:mem:spring_jpa_user;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS USERS -spring.datasource.username=sa -spring.datasource.password=sa - -spring.second-datasource.jdbcUrl=jdbc:h2:mem:spring_jpa_product;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS PRODUCTS -spring.second-datasource.username=sa -spring.second-datasource.password=sa diff --git a/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties deleted file mode 100644 index 75534e8a54..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/resources/persistence-multiple-db.properties +++ /dev/null @@ -1,13 +0,0 @@ -# jdbc.X -jdbc.driverClassName=org.h2.Driver -user.jdbc.url=jdbc:h2:mem:spring_jpa_user;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS USERS -product.jdbc.url=jdbc:h2:mem:spring_jpa_product;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS PRODUCTS -jdbc.user=sa -jdbc.pass=sa - -# hibernate.X -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.show_sql=false -hibernate.hbm2ddl.auto=create-drop -hibernate.cache.use_second_level_cache=false -hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa/src/main/resources/persistence.properties b/persistence-modules/spring-data-jpa/src/main/resources/persistence.properties deleted file mode 100644 index 6bc83edf34..0000000000 --- a/persistence-modules/spring-data-jpa/src/main/resources/persistence.properties +++ /dev/null @@ -1,14 +0,0 @@ -# jdbc.X -jdbc.driverClassName=org.h2.Driver -jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS USERS -jdbc.user=sa -jdbc.pass=sa - -# hibernate.X -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.show_sql=true -hibernate.hbm2ddl.auto=create-drop -hibernate.cache.use_second_level_cache=true -hibernate.cache.use_query_cache=true -hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory - diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/SpringContextTest.java deleted file mode 100644 index eaccf4acba..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/SpringContextTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -public class SpringContextTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java deleted file mode 100644 index f3697bf39f..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/SpringJpaContextIntegrationTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; -import com.baeldung.boot.config.PersistenceConfiguration; -import com.baeldung.multipledb.PersistenceProductConfiguration; -import com.baeldung.multipledb.PersistenceUserConfiguration; - -@RunWith(SpringRunner.class) -@DataJpaTest(excludeAutoConfiguration = { - PersistenceConfiguration.class, - PersistenceUserConfiguration.class, - PersistenceProductConfiguration.class }) -@ContextConfiguration(classes = Application.class) -public class SpringJpaContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java deleted file mode 100644 index 20fc3cbeaf..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.baeldung.boot.daos; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.domain.Article; - -@RunWith(SpringRunner.class) -@DataJpaTest(properties="spring.datasource.data=classpath:import_entities.sql") -public class ArticleRepositoryIntegrationTest { - - @Autowired - private ArticleRepository repository; - - @Test - public void givenImportedArticlesWhenFindAllByPublicationDateThenArticles1And2Returned() - throws Exception { - List

    result = repository.findAllByPublicationDate( - new SimpleDateFormat("yyyy-MM-dd").parse("2018-01-01") - ); - - assertEquals(2, result.size()); - assertTrue(result.stream() - .map(Article::getId) - .allMatch(id -> Arrays.asList(1, 2).contains(id)) - ); - } - - @Test - public void givenImportedArticlesWhenFindAllByPublicationTimeBetweenThenArticles2And3Returned() - throws Exception { - List
    result = repository.findAllByPublicationTimeBetween( - new SimpleDateFormat("HH:mm").parse("15:15"), - new SimpleDateFormat("HH:mm").parse("16:30") - ); - - assertEquals(2, result.size()); - assertTrue(result.stream() - .map(Article::getId) - .allMatch(id -> Arrays.asList(2, 3).contains(id)) - ); - } - - @Test - public void givenImportedArticlesWhenFindAllWithCreationDateTimeBeforeThenArticles2And3Returned() throws Exception { - List
    result = repository.findAllWithCreationDateTimeBefore( - new SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2017-12-15 10:00") - ); - - assertEquals(2, result.size()); - assertTrue(result.stream() - .map(Article::getId) - .allMatch(id -> Arrays.asList(2, 3).contains(id)) - ); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/ExtendedStudentRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/ExtendedStudentRepositoryIntegrationTest.java deleted file mode 100644 index 71f92c94ab..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/ExtendedStudentRepositoryIntegrationTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.boot.daos; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; - -import javax.annotation.Resource; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.Student; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {Application.class}) -@DirtiesContext -public class ExtendedStudentRepositoryIntegrationTest { - @Resource - private ExtendedStudentRepository extendedStudentRepository; - - @Before - public void setup() { - Student student = new Student(1, "john"); - extendedStudentRepository.save(student); - Student student2 = new Student(2, "johnson"); - extendedStudentRepository.save(student2); - Student student3 = new Student(3, "tom"); - extendedStudentRepository.save(student3); - } - - @Test - public void givenStudents_whenFindByName_thenGetOk() { - List students = extendedStudentRepository.findByAttributeContainsText("name", "john"); - assertThat(students.size()).isEqualTo(2); - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/InventoryRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/InventoryRepositoryIntegrationTest.java deleted file mode 100644 index 5d73e261a4..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/InventoryRepositoryIntegrationTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.baeldung.boot.daos; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import java.math.BigDecimal; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.MerchandiseEntity; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes=Application.class) -public class InventoryRepositoryIntegrationTest { - - private static final String ORIGINAL_TITLE = "Pair of Pants"; - private static final String UPDATED_TITLE = "Branded Luxury Pants"; - private static final String UPDATED_BRAND = "Armani"; - private static final String ORIGINAL_SHORTS_TITLE = "Pair of Shorts"; - - @Autowired - private InventoryRepository repository; - - @Test - public void shouldCreateNewEntryInDB() { - MerchandiseEntity pants = new MerchandiseEntity(ORIGINAL_TITLE, BigDecimal.ONE); - pants = repository.save(pants); - - MerchandiseEntity shorts = new MerchandiseEntity(ORIGINAL_SHORTS_TITLE, new BigDecimal(3)); - shorts = repository.save(shorts); - - assertNotNull(pants.getId()); - assertNotNull(shorts.getId()); - assertNotEquals(pants.getId(), shorts.getId()); - } - - @Test - public void shouldUpdateExistingEntryInDB() { - MerchandiseEntity pants = new MerchandiseEntity(ORIGINAL_TITLE, BigDecimal.ONE); - pants = repository.save(pants); - - Long originalId = pants.getId(); - - pants.setTitle(UPDATED_TITLE); - pants.setPrice(BigDecimal.TEN); - pants.setBrand(UPDATED_BRAND); - - MerchandiseEntity result = repository.save(pants); - - assertEquals(originalId, result.getId()); - assertEquals(UPDATED_TITLE, result.getTitle()); - assertEquals(BigDecimal.TEN, result.getPrice()); - assertEquals(UPDATED_BRAND, result.getBrand()); - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/JpaRepositoriesIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/JpaRepositoriesIntegrationTest.java deleted file mode 100644 index 9e4b78dce3..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/JpaRepositoriesIntegrationTest.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.baeldung.boot.daos; - -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertFalse; -import static junit.framework.TestCase.assertNotNull; -import static junit.framework.TestCase.assertNull; -import static junit.framework.TestCase.assertTrue; - -import java.util.List; -import java.util.Optional; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.domain.Item; -import com.baeldung.boot.domain.ItemType; -import com.baeldung.boot.domain.Location; -import com.baeldung.boot.domain.Store; - -@RunWith(SpringRunner.class) -@DataJpaTest(properties="spring.datasource.data=classpath:import_entities.sql") -public class JpaRepositoriesIntegrationTest { - @Autowired - private LocationRepository locationRepository; - @Autowired - private StoreRepository storeRepository; - @Autowired - private ItemTypeRepository compositeRepository; - @Autowired - private ReadOnlyLocationRepository readOnlyRepository; - - @Test - public void whenSaveLocation_ThenGetSameLocation() { - Location location = new Location(); - location.setId(100L); - location.setCountry("Country H"); - location.setCity("City Hundred"); - location = locationRepository.saveAndFlush(location); - - Location otherLocation = locationRepository.getOne(location.getId()); - assertEquals("Country H", otherLocation.getCountry()); - assertEquals("City Hundred", otherLocation.getCity()); - - locationRepository.delete(otherLocation); - } - - @Test - public void givenLocationId_whenFindStores_thenGetStores() { - List stores = storeRepository.findStoreByLocationId(1L); - assertEquals(1, stores.size()); - } - - @Test - public void givenItemTypeId_whenDeleted_ThenItemTypeDeleted() { - Optional itemType = compositeRepository.findById(1L); - assertTrue(itemType.isPresent()); - compositeRepository.deleteCustom(itemType.get()); - itemType = compositeRepository.findById(1L); - assertFalse(itemType.isPresent()); - } - - @Test - public void givenItemId_whenUsingCustomRepo_ThenDeleteAppropriateEntity() { - Item item = compositeRepository.findItemById(1L); - assertNotNull(item); - compositeRepository.deleteCustom(item); - item = compositeRepository.findItemById(1L); - assertNull(item); - } - - @Test - public void givenItemAndItemType_WhenAmbiguousDeleteCalled_ThenItemTypeDeletedAndNotItem() { - Optional itemType = compositeRepository.findById(1L); - assertTrue(itemType.isPresent()); - Item item = compositeRepository.findItemById(2L); - assertNotNull(item); - - compositeRepository.findThenDelete(1L); - Optional sameItemType = compositeRepository.findById(1L); - assertFalse(sameItemType.isPresent()); - Item sameItem = compositeRepository.findItemById(2L); - assertNotNull(sameItem); - } - - @Test - public void whenCreatingReadOnlyRepo_thenHaveOnlyReadOnlyOperationsAvailable() { - Optional location = readOnlyRepository.findById(1L); - assertNotNull(location); - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java deleted file mode 100644 index b2581b8034..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryCommon.java +++ /dev/null @@ -1,545 +0,0 @@ -package com.baeldung.boot.daos; - -import org.junit.After; -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort; -import org.springframework.data.jpa.domain.JpaSort; -import org.springframework.data.mapping.PropertyReferenceException; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.boot.daos.user.UserRepository; -import com.baeldung.boot.domain.User; - -import javax.persistence.EntityManager; -import javax.persistence.Query; -import java.time.LocalDate; -import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.*; - -public class UserRepositoryCommon { - - final String USER_EMAIL = "email@example.com"; - final String USER_EMAIL2 = "email2@example.com"; - final String USER_EMAIL3 = "email3@example.com"; - final String USER_EMAIL4 = "email4@example.com"; - final Integer INACTIVE_STATUS = 0; - final Integer ACTIVE_STATUS = 1; - final String USER_EMAIL5 = "email5@example.com"; - final String USER_EMAIL6 = "email6@example.com"; - final String USER_NAME_ADAM = "Adam"; - final String USER_NAME_PETER = "Peter"; - - @Autowired - protected UserRepository userRepository; - @Autowired - private EntityManager entityManager; - - @Test - @Transactional - public void givenUsersWithSameNameInDB_WhenFindAllByName_ThenReturnStreamOfUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - userRepository.save(user3); - - User user4 = new User(); - user4.setName("SAMPLE"); - user4.setEmail(USER_EMAIL4); - userRepository.save(user4); - - try (Stream foundUsersStream = userRepository.findAllByName(USER_NAME_ADAM)) { - assertThat(foundUsersStream.count()).isEqualTo(3l); - } - } - - @Test - public void givenUsersInDB_WhenFindAllWithQueryAnnotation_ThenReturnCollectionWithActiveUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - user1.setStatus(ACTIVE_STATUS); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - user3.setStatus(INACTIVE_STATUS); - userRepository.save(user3); - - Collection allActiveUsers = userRepository.findAllActiveUsers(); - - assertThat(allActiveUsers.size()).isEqualTo(2); - } - - @Test - public void givenUsersInDB_WhenFindAllWithQueryAnnotationNative_ThenReturnCollectionWithActiveUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - user1.setStatus(ACTIVE_STATUS); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - user3.setStatus(INACTIVE_STATUS); - userRepository.save(user3); - - Collection allActiveUsers = userRepository.findAllActiveUsersNative(); - - assertThat(allActiveUsers.size()).isEqualTo(2); - } - - @Test - public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotation_ThenReturnActiveUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByStatus(ACTIVE_STATUS); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotationNative_ThenReturnActiveUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByStatusNative(ACTIVE_STATUS); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationIndexedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndName(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndNameNamedParams(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNativeNamedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndNameNamedParamsNative(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParamsCustomNames_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByUserStatusAndUserName(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationIndexedParams_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLike("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNamedParams_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLikeNamedParam("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNative_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLikeNative("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllWithSortByName_ThenReturnUsersSorted() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - List usersSortByName = userRepository.findAll(Sort.by(Sort.Direction.ASC, "name")); - - assertThat(usersSortByName.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test(expected = PropertyReferenceException.class) - public void givenUsersInDB_WhenFindAllSortWithFunction_ThenThrowException() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - userRepository.findAll(Sort.by(Sort.Direction.ASC, "name")); - - List usersSortByNameLength = userRepository.findAll(Sort.by("LENGTH(name)")); - - assertThat(usersSortByNameLength.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllSortWithFunctionQueryAnnotationJPQL_ThenReturnUsersSorted() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - userRepository.findAllUsers(Sort.by("name")); - - List usersSortByNameLength = userRepository.findAllUsers(JpaSort.unsafe("LENGTH(name)")); - - assertThat(usersSortByNameLength.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationJPQL_ThenReturnPageOfUsers() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL4, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE2", LocalDate.now(), USER_EMAIL5, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL6, INACTIVE_STATUS)); - - Page usersPage = userRepository.findAllUsersWithPagination(PageRequest.of(1, 3)); - - assertThat(usersPage.getContent() - .get(0) - .getName()).isEqualTo("SAMPLE1"); - } - - @Test - public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationNative_ThenReturnPageOfUsers() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL4, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE2", LocalDate.now(), USER_EMAIL5, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL6, INACTIVE_STATUS)); - - Page usersSortByNameLength = userRepository.findAllUsersWithPaginationNative(PageRequest.of(1, 3)); - - assertThat(usersSortByNameLength.getContent() - .get(0) - .getName()).isEqualTo(USER_NAME_PETER); - } - - @Test - @Transactional - public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationJPQL_ThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - - int updatedUsersSize = userRepository.updateUserSetStatusForName(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } - - @Test - public void givenUsersInDB_WhenFindByEmailsWithDynamicQuery_ThenReturnCollection() { - - User user1 = new User(); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - User user3 = new User(); - user3.setEmail(USER_EMAIL3); - userRepository.save(user3); - - Set emails = new HashSet<>(); - emails.add(USER_EMAIL2); - emails.add(USER_EMAIL3); - - Collection usersWithEmails = userRepository.findUserByEmails(emails); - - assertThat(usersWithEmails.size()).isEqualTo(2); - } - - @Test - public void givenUsersInDBWhenFindByNameListReturnCollection() { - - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - List names = Arrays.asList(USER_NAME_ADAM, USER_NAME_PETER); - - List usersWithNames = userRepository.findUserByNameList(names); - - assertThat(usersWithNames.size()).isEqualTo(2); - } - - - @Test - @Transactional - public void whenInsertedWithQuery_ThenUserIsPersisted() { - userRepository.insertUser(USER_NAME_ADAM, 1, USER_EMAIL, ACTIVE_STATUS, true); - userRepository.insertUser(USER_NAME_PETER, 1, USER_EMAIL2, ACTIVE_STATUS, true); - - User userAdam = userRepository.findUserByNameLike(USER_NAME_ADAM); - User userPeter = userRepository.findUserByNameLike(USER_NAME_PETER); - - assertThat(userAdam).isNotNull(); - assertThat(userAdam.getEmail()).isEqualTo(USER_EMAIL); - assertThat(userPeter).isNotNull(); - assertThat(userPeter.getEmail()).isEqualTo(USER_EMAIL2); - } - - - @Test - @Transactional - public void givenTwoUsers_whenFindByNameUsr01_ThenUserUsr01() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - try (Stream users = userRepository.findAllByName("usr01")) { - assertTrue(users.allMatch(usr -> usr.equals(usr01))); - } - } - - @Test - @Transactional - public void givenTwoUsers_whenFindByNameUsr00_ThenNoUsers() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - try (Stream users = userRepository.findAllByName("usr00")) { - assertEquals(0, users.count()); - } - } - - @Test - public void givenTwoUsers_whenFindUsersWithGmailAddress_ThenUserUsr02() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@gmail.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - List users = userRepository.findUsersWithGmailAddress(); - assertEquals(1, users.size()); - assertEquals(usr02, users.get(0)); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeleteAllByCreationDateAfter_ThenOneUserRemains() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.deleteAllByCreationDateAfter(LocalDate.of(2018, 5, 1)); - - List users = userRepository.findAll(); - - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - } - - @Test - public void givenTwoUsers_whenFindAllUsersByPredicates_ThenUserUsr01() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - List> predicates = new ArrayList<>(); - predicates.add(usr -> usr.getCreationDate().isAfter(LocalDate.of(2017, 12, 31))); - predicates.add(usr -> usr.getEmail().endsWith(".com")); - - List users = userRepository.findAllUsersByPredicates(predicates); - - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeactivateUsersNotLoggedInSince_ThenUserUsr02Deactivated() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.deactivateUsersNotLoggedInSince(LocalDate.of(2018, 8, 1)); - - List users = userRepository.findAllUsers(Sort.by(Sort.Order.asc("name"))); - assertTrue(users.get(0).isActive()); - assertFalse(users.get(1).isActive()); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeleteDeactivatedUsers_ThenUserUsr02Deleted() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.com", 0); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - usr02.setActive(false); - - userRepository.save(usr01); - userRepository.save(usr02); - - int deletedUsersCount = userRepository.deleteDeactivatedUsers(); - - List users = userRepository.findAll(); - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - assertEquals(1, deletedUsersCount); - } - - @Test - @Transactional - public void givenTwoUsers_whenAddDeletedColumn_ThenUsersHaveDeletedColumn() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - usr02.setActive(false); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.addDeletedColumn(); - - Query nativeQuery = entityManager.createNativeQuery("select deleted from USERS where NAME = 'usr01'"); - assertEquals(0, nativeQuery.getResultList().get(0)); - } - - @After - public void cleanUp() { - userRepository.deleteAll(); - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryIntegrationTest.java deleted file mode 100644 index 1b1d264574..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryIntegrationTest.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.boot.daos; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.User; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDate; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Created by adam. - */ -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@DirtiesContext -public class UserRepositoryIntegrationTest extends UserRepositoryCommon { - - @Test - @Transactional - public void givenUsersInDBWhenUpdateStatusForNameModifyingQueryAnnotationNativeThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - userRepository.flush(); - - int updatedUsersSize = userRepository.updateUserSetStatusForNameNative(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java deleted file mode 100644 index 99eabc8271..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryTCAutoLiveTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.baeldung.boot.daos; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.User; -import com.baeldung.util.BaeldungPostgresqlContainer; -import org.junit.ClassRule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; -import org.testcontainers.containers.PostgreSQLContainer; - -import java.time.LocalDate; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Created by adam. - */ -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@ActiveProfiles({"tc", "tc-auto"}) -public class UserRepositoryTCAutoLiveTest extends UserRepositoryCommon { - - @ClassRule - public static PostgreSQLContainer postgreSQLContainer = BaeldungPostgresqlContainer.getInstance(); - - @Test - @Transactional - public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationNativePostgres_ThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - userRepository.flush(); - - int updatedUsersSize = userRepository.updateUserSetStatusForNameNativePostgres(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java deleted file mode 100644 index be8843c166..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/daos/UserRepositoryTCLiveTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baeldung.boot.daos; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.User; -import org.junit.ClassRule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.util.TestPropertyValues; -import org.springframework.context.ApplicationContextInitializer; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.Transactional; -import org.testcontainers.containers.PostgreSQLContainer; - -import java.time.LocalDate; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) -@ActiveProfiles("tc") -@ContextConfiguration(initializers = {UserRepositoryTCLiveTest.Initializer.class}) -public class UserRepositoryTCLiveTest extends UserRepositoryCommon { - - @ClassRule - public static PostgreSQLContainer postgreSQLContainer = new PostgreSQLContainer("postgres:11.1") - .withDatabaseName("integration-tests-db") - .withUsername("sa") - .withPassword("sa"); - - @Test - @Transactional - public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationNative_ThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - userRepository.flush(); - - int updatedUsersSize = userRepository.updateUserSetStatusForNameNativePostgres(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } - - static class Initializer - implements ApplicationContextInitializer { - public void initialize(ConfigurableApplicationContext configurableApplicationContext) { - TestPropertyValues.of( - "spring.datasource.url=" + postgreSQLContainer.getJdbcUrl(), - "spring.datasource.username=" + postgreSQLContainer.getUsername(), - "spring.datasource.password=" + postgreSQLContainer.getPassword() - ).applyTo(configurableApplicationContext.getEnvironment()); - } - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/Aggregate2EventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/Aggregate2EventsIntegrationTest.java deleted file mode 100644 index e76b932cb9..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/Aggregate2EventsIntegrationTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; - -import com.baeldung.boot.ddd.event.Aggregate2; -import com.baeldung.boot.ddd.event.Aggregate2Repository; -import com.baeldung.boot.ddd.event.DomainEvent; - -@SpringJUnitConfig -@SpringBootTest -class Aggregate2EventsIntegrationTest { - @MockBean - private TestEventHandler eventHandler; - @Autowired - private Aggregate2Repository repository; - - // @formatter:off - @DisplayName("given aggregate with @AfterDomainEventPublication," - + " when do domain operation and save twice," - + " then an event is published only for the first time") - // @formatter:on - @Test - void afterDomainEvents() { - // given - Aggregate2 aggregate = new Aggregate2(); - - // when - aggregate.domainOperation(); - repository.save(aggregate); - repository.save(aggregate); - - // then - verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); - } - - @BeforeEach - void beforeEach() { - repository.deleteAll(); - } - - // @formatter:off - @DisplayName("given aggregate with @DomainEvents," - + " when do domain operation and save," - + " then an event is published") - // @formatter:on - @Test - void domainEvents() { - // given - Aggregate2 aggregate = new Aggregate2(); - - // when - aggregate.domainOperation(); - repository.save(aggregate); - - // then - verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/Aggregate3EventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/Aggregate3EventsIntegrationTest.java deleted file mode 100644 index 4193e932ee..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/Aggregate3EventsIntegrationTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; - -import com.baeldung.boot.ddd.event.Aggregate3; -import com.baeldung.boot.ddd.event.Aggregate3Repository; -import com.baeldung.boot.ddd.event.DomainEvent; - -@SpringJUnitConfig -@SpringBootTest -class Aggregate3EventsIntegrationTest { - - @MockBean - private TestEventHandler eventHandler; - @Autowired - private Aggregate3Repository repository; - - // @formatter:off - @DisplayName("given aggregate extending AbstractAggregateRoot," - + " when do domain operation and save twice," - + " then an event is published only for the first time") - // @formatter:on - @Test - void afterDomainEvents() { - // given - Aggregate3 aggregate = new Aggregate3(); - - // when - aggregate.domainOperation(); - repository.save(aggregate); - repository.save(aggregate); - - // then - verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); - } - - // @formatter:off - @DisplayName("given aggregate extending AbstractAggregateRoot," - + " when do domain operation and save," - + " then an event is published") - // @formatter:on - @Test - void domainEvents() { - // given - Aggregate3 aggregate = new Aggregate3(); - - // when - aggregate.domainOperation(); - repository.save(aggregate); - - // then - verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/AggregateEventsIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/AggregateEventsIntegrationTest.java deleted file mode 100644 index ac607063b2..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/AggregateEventsIntegrationTest.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.baeldung.boot.ddd.event; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.TestConfiguration; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.context.annotation.Bean; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; - -import com.baeldung.boot.ddd.event.Aggregate; -import com.baeldung.boot.ddd.event.AggregateRepository; -import com.baeldung.boot.ddd.event.DomainEvent; -import com.baeldung.boot.ddd.event.DomainService; - -@SpringJUnitConfig -@SpringBootTest -class AggregateEventsIntegrationTest { - - @Autowired - private DomainService domainService; - - @MockBean - private TestEventHandler eventHandler; - @Autowired - private ApplicationEventPublisher eventPublisher; - @Autowired - private AggregateRepository repository; - - // @formatter:off - @DisplayName("given existing aggregate," - + " when do domain operation directly on aggregate," - + " then domain event is NOT published") - // @formatter:on - @Test - void aggregateEventsTest() { - Aggregate existingDomainEntity = new Aggregate(0, eventPublisher); - repository.save(existingDomainEntity); - - // when - repository.findById(existingDomainEntity.getId()) - .get() - .domainOperation(); - - // then - verifyZeroInteractions(eventHandler); - } - - @BeforeEach - void beforeEach() { - repository.deleteAll(); - } - - // @formatter:off - @DisplayName("given existing aggregate," - + " when do domain operation on service," - + " then domain event is published") - // @formatter:on - @Test - void serviceEventsTest() { - Aggregate existingDomainEntity = new Aggregate(1, eventPublisher); - repository.save(existingDomainEntity); - - // when - domainService.serviceDomainOperation(existingDomainEntity.getId()); - - // then - verify(eventHandler, times(1)).handleEvent(any(DomainEvent.class)); - } - - @TestConfiguration - public static class TestConfig { - @Bean - public DomainService domainService(AggregateRepository repository, ApplicationEventPublisher eventPublisher) { - return new DomainService(repository, eventPublisher); - } - } - -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/TestEventHandler.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/TestEventHandler.java deleted file mode 100644 index 0f499834eb..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/ddd/event/TestEventHandler.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * - */ -package com.baeldung.boot.ddd.event; - -import org.springframework.transaction.event.TransactionalEventListener; - -import com.baeldung.boot.ddd.event.DomainEvent; - -interface TestEventHandler { - @TransactionalEventListener - void handleEvent(DomainEvent event); - -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/AbstractServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/AbstractServicePersistenceIntegrationTest.java deleted file mode 100644 index bf0c85fca6..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/AbstractServicePersistenceIntegrationTest.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.baeldung.boot.services; - -import com.baeldung.boot.domain.Foo; -import com.baeldung.boot.services.IOperations; -import com.baeldung.util.IDUtil; -import org.hamcrest.Matchers; -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.dao.DataAccessException; - -import java.io.Serializable; -import java.util.List; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.hamcrest.Matchers.hasItem; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.*; - -public abstract class AbstractServicePersistenceIntegrationTest { - - // tests - - // find - one - - @Test - /**/public final void givenResourceDoesNotExist_whenResourceIsRetrieved_thenNoResourceIsReceived() { - // When - final Foo createdResource = getApi().findOne(IDUtil.randomPositiveLong()); - - // Then - assertNull(createdResource); - } - - @Test - public void givenResourceExists_whenResourceIsRetrieved_thenNoExceptions() { - final Foo existingResource = persistNewEntity(); - getApi().findOne(existingResource.getId()); - } - - @Test - public void givenResourceDoesNotExist_whenResourceIsRetrieved_thenNoExceptions() { - getApi().findOne(IDUtil.randomPositiveLong()); - } - - @Test - public void givenResourceExists_whenResourceIsRetrieved_thenTheResultIsNotNull() { - final Foo existingResource = persistNewEntity(); - final Foo retrievedResource = getApi().findOne(existingResource.getId()); - assertNotNull(retrievedResource); - } - - @Test - public void givenResourceExists_whenResourceIsRetrieved_thenResourceIsRetrievedCorrectly() { - final Foo existingResource = persistNewEntity(); - final Foo retrievedResource = getApi().findOne(existingResource.getId()); - assertEquals(existingResource, retrievedResource); - } - - // find - one - by name - - // find - all - - @Test - /**/public void whenAllResourcesAreRetrieved_thenNoExceptions() { - getApi().findAll(); - } - - @Test - /**/public void whenAllResourcesAreRetrieved_thenTheResultIsNotNull() { - final List resources = getApi().findAll(); - - assertNotNull(resources); - } - - @Test - /**/public void givenAtLeastOneResourceExists_whenAllResourcesAreRetrieved_thenRetrievedResourcesAreNotEmpty() { - persistNewEntity(); - - // When - final List allResources = getApi().findAll(); - - // Then - assertThat(allResources, not(Matchers. empty())); - } - - @Test - /**/public void givenAnResourceExists_whenAllResourcesAreRetrieved_thenTheExistingResourceIsIndeedAmongThem() { - final Foo existingResource = persistNewEntity(); - - final List resources = getApi().findAll(); - - assertThat(resources, hasItem(existingResource)); - } - - @Test - /**/public void whenAllResourcesAreRetrieved_thenResourcesHaveIds() { - persistNewEntity(); - - // When - final List allResources = getApi().findAll(); - - // Then - for (final Foo resource : allResources) { - assertNotNull(resource.getId()); - } - } - - // create - - @Test(expected = RuntimeException.class) - /**/public void whenNullResourceIsCreated_thenException() { - getApi().create(null); - } - - @Test - /**/public void whenResourceIsCreated_thenNoExceptions() { - persistNewEntity(); - } - - @Test - /**/public void whenResourceIsCreated_thenResourceIsRetrievable() { - final Foo existingResource = persistNewEntity(); - - assertNotNull(getApi().findOne(existingResource.getId())); - } - - @Test - /**/public void whenResourceIsCreated_thenSavedResourceIsEqualToOriginalResource() { - final Foo originalResource = createNewEntity(); - final Foo savedResource = getApi().create(originalResource); - - assertEquals(originalResource, savedResource); - } - - @Test(expected = RuntimeException.class) - public void whenResourceWithFailedConstraintsIsCreated_thenException() { - final Foo invalidResource = createNewEntity(); - invalidate(invalidResource); - - getApi().create(invalidResource); - } - - /** - * -- specific to the persistence engine - */ - @Test(expected = DataAccessException.class) - @Ignore("Hibernate simply ignores the id silently and still saved (tracking this)") - public void whenResourceWithIdIsCreated_thenDataAccessException() { - final Foo resourceWithId = createNewEntity(); - resourceWithId.setId(IDUtil.randomPositiveLong()); - - getApi().create(resourceWithId); - } - - // update - - @Test(expected = RuntimeException.class) - /**/public void whenNullResourceIsUpdated_thenException() { - getApi().update(null); - } - - @Test - /**/public void givenResourceExists_whenResourceIsUpdated_thenNoExceptions() { - // Given - final Foo existingResource = persistNewEntity(); - - // When - getApi().update(existingResource); - } - - /** - * - can also be the ConstraintViolationException which now occurs on the update operation will not be translated; as a consequence, it will be a TransactionSystemException - */ - @Test(expected = RuntimeException.class) - public void whenResourceIsUpdatedWithFailedConstraints_thenException() { - final Foo existingResource = persistNewEntity(); - invalidate(existingResource); - - getApi().update(existingResource); - } - - @Test - /**/public void givenResourceExists_whenResourceIsUpdated_thenUpdatesArePersisted() { - // Given - final Foo existingResource = persistNewEntity(); - - // When - change(existingResource); - getApi().update(existingResource); - - final Foo updatedResource = getApi().findOne(existingResource.getId()); - - // Then - assertEquals(existingResource, updatedResource); - } - - // delete - - // @Test(expected = RuntimeException.class) - // public void givenResourceDoesNotExists_whenResourceIsDeleted_thenException() { - // // When - // getApi().delete(IDUtil.randomPositiveLong()); - // } - // - // @Test(expected = RuntimeException.class) - // public void whenResourceIsDeletedByNegativeId_thenException() { - // // When - // getApi().delete(IDUtil.randomNegativeLong()); - // } - // - // @Test - // public void givenResourceExists_whenResourceIsDeleted_thenNoExceptions() { - // // Given - // final Foo existingResource = persistNewEntity(); - // - // // When - // getApi().delete(existingResource.getId()); - // } - // - // @Test - // /**/public final void givenResourceExists_whenResourceIsDeleted_thenResourceNoLongerExists() { - // // Given - // final Foo existingResource = persistNewEntity(); - // - // // When - // getApi().delete(existingResource.getId()); - // - // // Then - // assertNull(getApi().findOne(existingResource.getId())); - // } - - // template method - - protected Foo createNewEntity() { - return new Foo(randomAlphabetic(6)); - } - - protected abstract IOperations getApi(); - - private final void invalidate(final Foo entity) { - entity.setName(null); - } - - private final void change(final Foo entity) { - entity.setName(randomAlphabetic(6)); - } - - protected Foo persistNewEntity() { - return getApi().create(createNewEntity()); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/FooServicePersistenceIntegrationTest.java deleted file mode 100644 index 72de4918a2..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/FooServicePersistenceIntegrationTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baeldung.boot.services; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.junit.Assert.assertNotNull; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.dao.InvalidDataAccessApiUsageException; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.Foo; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes=Application.class) -public class FooServicePersistenceIntegrationTest extends AbstractServicePersistenceIntegrationTest { - - @Autowired - private IFooService service; - - // tests - - @Test - public final void whenContextIsBootstrapped_thenNoExceptions() { - // - } - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Foo(randomAlphabetic(6))); - } - - @Test(expected = DataIntegrityViolationException.class) - public final void whenInvalidEntityIsCreated_thenDataException() { - service.create(new Foo()); - } - - @Test(expected = DataIntegrityViolationException.class) - public final void whenEntityWithLongNameIsCreated_thenDataException() { - service.create(new Foo(randomAlphabetic(2048))); - } - - // custom Query method - - @Test - public final void givenUsingCustomQuery_whenRetrievingEntity_thenFound() { - final String name = randomAlphabetic(6); - service.create(new Foo(name)); - - final Foo retrievedByName = service.retrieveByName(name); - assertNotNull(retrievedByName); - } - - // work in progress - - @Test(expected = InvalidDataAccessApiUsageException.class) - @Ignore("Right now, persist has saveOrUpdate semantics, so this will no longer fail") - public final void whenSameEntityIsCreatedTwice_thenDataException() { - final Foo entity = new Foo(randomAlphabetic(8)); - service.create(entity); - service.create(entity); - } - - // API - - @Override - protected final IOperations getApi() { - return service; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/SpringDataJPABarAuditIntegrationTest.java deleted file mode 100644 index 644d1ec805..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/boot/services/SpringDataJPABarAuditIntegrationTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baeldung.boot.services; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.boot.Application; -import com.baeldung.boot.domain.Bar; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes=Application.class) -public class SpringDataJPABarAuditIntegrationTest { - - private static Logger logger = LoggerFactory.getLogger(SpringDataJPABarAuditIntegrationTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - logger.info("setUpBeforeClass()"); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - logger.info("tearDownAfterClass()"); - } - - @Autowired - @Qualifier("barSpringDataJpaService") - private IBarService barService; - - @Autowired - private EntityManagerFactory entityManagerFactory; - - private EntityManager em; - - @Before - public void setUp() throws Exception { - logger.info("setUp()"); - em = entityManagerFactory.createEntityManager(); - } - - @After - public void tearDown() throws Exception { - logger.info("tearDown()"); - em.close(); - } - - @Test - @WithMockUser(username = "tutorialuser") - public final void whenBarsModified_thenBarsAudited() { - Bar bar = new Bar("BAR1"); - barService.create(bar); - assertEquals(bar.getCreatedDate(), bar.getModifiedDate()); - assertEquals("tutorialuser", bar.getCreatedBy(), bar.getModifiedBy()); - bar.setName("BAR2"); - bar = barService.update(bar); - assertTrue(bar.getCreatedDate() < bar.getModifiedDate()); - assertEquals("tutorialuser", bar.getCreatedBy(), bar.getModifiedBy()); - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java deleted file mode 100644 index a1f4a3fa2c..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.baeldung.multipledb; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.Collections; -import java.util.Optional; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.multipledb.dao.product.ProductRepository; -import com.baeldung.multipledb.dao.user.PossessionRepository; -import com.baeldung.multipledb.dao.user.UserRepository; -import com.baeldung.multipledb.model.product.Product; -import com.baeldung.multipledb.model.user.PossessionMultipleDB; -import com.baeldung.multipledb.model.user.UserMultipleDB; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes=MultipleDbApplication.class) -@EnableTransactionManagement -public class JpaMultipleDBIntegrationTest { - - @Autowired - private UserRepository userRepository; - - @Autowired - private PossessionRepository possessionRepository; - - @Autowired - private ProductRepository productRepository; - - // tests - - @Test - @Transactional("userTransactionManager") - public void whenCreatingUser_thenCreated() { - UserMultipleDB user = new UserMultipleDB(); - user.setName("John"); - user.setEmail("john@test.com"); - user.setAge(20); - PossessionMultipleDB p = new PossessionMultipleDB("sample"); - p = possessionRepository.save(p); - user.setPossessionList(Collections.singletonList(p)); - user = userRepository.save(user); - final Optional result = userRepository.findById(user.getId()); - assertTrue(result.isPresent()); - System.out.println(result.get().getPossessionList()); - assertEquals(1, result.get().getPossessionList().size()); - } - - @Test - @Transactional("userTransactionManager") - public void whenCreatingUsersWithSameEmail_thenRollback() { - UserMultipleDB user1 = new UserMultipleDB(); - user1.setName("John"); - user1.setEmail("john@test.com"); - user1.setAge(20); - user1 = userRepository.save(user1); - assertTrue(userRepository.findById(user1.getId()).isPresent()); - - UserMultipleDB user2 = new UserMultipleDB(); - user2.setName("Tom"); - user2.setEmail("john@test.com"); - user2.setAge(10); - try { - user2 = userRepository.save(user2); - userRepository.flush(); - fail("DataIntegrityViolationException should be thrown!"); - } catch (final DataIntegrityViolationException e) { - // Expected - } catch (final Exception e) { - fail("DataIntegrityViolationException should be thrown, instead got: " + e); - } - } - - @Test - @Transactional("productTransactionManager") - public void whenCreatingProduct_thenCreated() { - Product product = new Product(); - product.setName("Book"); - product.setId(2); - product.setPrice(20); - product = productRepository.save(product); - - assertTrue(productRepository.findById(product.getId()).isPresent()); - } - -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java deleted file mode 100644 index 9bfba61a3b..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/multipledb/ProductRepositoryIntegrationTest.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.baeldung.multipledb; - -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Pageable; -import org.springframework.data.domain.Sort; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.multipledb.PersistenceProductConfiguration; -import com.baeldung.multipledb.dao.product.ProductRepository; -import com.baeldung.multipledb.model.product.Product; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes=MultipleDbApplication.class) -@EnableTransactionManagement -public class ProductRepositoryIntegrationTest { - - @Autowired - private ProductRepository productRepository; - - @Before - @Transactional("productTransactionManager") - public void setUp() { - productRepository.save(Product.from(1001, "Book", 21)); - productRepository.save(Product.from(1002, "Coffee", 10)); - productRepository.save(Product.from(1003, "Jeans", 30)); - productRepository.save(Product.from(1004, "Shirt", 32)); - productRepository.save(Product.from(1005, "Bacon", 10)); - } - - @Test - public void whenRequestingFirstPageOfSizeTwo_ThenReturnFirstPage() { - Pageable pageRequest = PageRequest.of(0, 2); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(2)); - assertTrue(result.stream() - .map(Product::getId) - .allMatch(id -> Arrays.asList(1001, 1002) - .contains(id))); - } - - @Test - public void whenRequestingSecondPageOfSizeTwo_ThenReturnSecondPage() { - Pageable pageRequest = PageRequest.of(1, 2); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(2)); - assertTrue(result.stream() - .map(Product::getId) - .allMatch(id -> Arrays.asList(1003, 1004) - .contains(id))); - } - - @Test - public void whenRequestingLastPage_ThenReturnLastPageWithRemData() { - Pageable pageRequest = PageRequest.of(2, 2); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(1)); - assertTrue(result.stream() - .map(Product::getId) - .allMatch(id -> Arrays.asList(1005) - .contains(id))); - } - - @Test - public void whenSortingByNameAscAndPaging_ThenReturnSortedPagedResult() { - Pageable pageRequest = PageRequest.of(0, 3, Sort.by("name")); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(3)); - assertThat(result.getContent() - .stream() - .map(Product::getId) - .collect(Collectors.toList()), equalTo(Arrays.asList(1005, 1001, 1002))); - - } - - @Test - public void whenSortingByPriceDescAndPaging_ThenReturnSortedPagedResult() { - Pageable pageRequest = PageRequest.of(0, 3, Sort.by("price") - .descending()); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(3)); - assertThat(result.getContent() - .stream() - .map(Product::getId) - .collect(Collectors.toList()), equalTo(Arrays.asList(1004, 1003, 1001))); - - } - - @Test - public void whenSortingByPriceDescAndNameAscAndPaging_ThenReturnSortedPagedResult() { - Pageable pageRequest = PageRequest.of(0, 5, Sort.by("price") - .descending() - .and(Sort.by("name"))); - - Page result = productRepository.findAll(pageRequest); - - assertThat(result.getContent(), hasSize(5)); - assertThat(result.getContent() - .stream() - .map(Product::getId) - .collect(Collectors.toList()), equalTo(Arrays.asList(1004, 1003, 1001, 1005, 1002))); - - } - - @Test - public void whenRequestingFirstPageOfSizeTwoUsingCustomMethod_ThenReturnFirstPage() { - Pageable pageRequest = PageRequest.of(0, 2); - - List result = productRepository.findAllByPrice(10, pageRequest); - - assertThat(result, hasSize(2)); - assertTrue(result.stream() - .map(Product::getId) - .allMatch(id -> Arrays.asList(1002, 1005) - .contains(id))); - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java deleted file mode 100644 index e5ad2dd448..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/BaeldungPostgresqlContainer.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.util; - -import org.testcontainers.containers.PostgreSQLContainer; - -public class BaeldungPostgresqlContainer extends PostgreSQLContainer { - - private static final String IMAGE_VERSION = "postgres:11.1"; - - private static BaeldungPostgresqlContainer container; - - - private BaeldungPostgresqlContainer() { - super(IMAGE_VERSION); - } - - public static BaeldungPostgresqlContainer getInstance() { - if (container == null) { - container = new BaeldungPostgresqlContainer(); - } - return container; - } - - @Override - public void start() { - super.start(); - System.setProperty("DB_URL", container.getJdbcUrl()); - System.setProperty("DB_USERNAME", container.getUsername()); - System.setProperty("DB_PASSWORD", container.getPassword()); - } - - @Override - public void stop() { - //do nothing, JVM handles shut down - } -} diff --git a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java b/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java deleted file mode 100644 index 45e72e046d..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/java/com/baeldung/util/IDUtil.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.util; - -import java.util.Random; - -public final class IDUtil { - - private IDUtil() { - throw new AssertionError(); - } - - // API - - public static String randomPositiveLongAsString() { - return Long.toString(randomPositiveLong()); - } - - public static String randomNegativeLongAsString() { - return Long.toString(randomNegativeLong()); - } - - public static long randomPositiveLong() { - long id = new Random().nextLong() * 10000; - id = (id < 0) ? (-1 * id) : id; - return id; - } - - private static long randomNegativeLong() { - long id = new Random().nextLong() * 10000; - id = (id > 0) ? (-1 * id) : id; - return id; - } - -} diff --git a/persistence-modules/spring-data-jpa/src/test/resources/application-tc-auto.properties b/persistence-modules/spring-data-jpa/src/test/resources/application-tc-auto.properties deleted file mode 100644 index c3005d861f..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/resources/application-tc-auto.properties +++ /dev/null @@ -1,4 +0,0 @@ -# configuration for test containers testing -spring.datasource.url=${DB_URL} -spring.datasource.username=${DB_USERNAME} -spring.datasource.password=${DB_PASSWORD} diff --git a/persistence-modules/spring-data-jpa/src/test/resources/application-tc.properties b/persistence-modules/spring-data-jpa/src/test/resources/application-tc.properties deleted file mode 100644 index 3bf8693d53..0000000000 --- a/persistence-modules/spring-data-jpa/src/test/resources/application-tc.properties +++ /dev/null @@ -1,4 +0,0 @@ -# configuration for Test Containers testing -spring.datasource.driver-class-name=org.postgresql.Driver -spring.jpa.hibernate.ddl-auto=create-drop -spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false From 6298b6b64a97090252b3b6d3a13e8ca42fb60e56 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 19 Jul 2020 14:36:21 +0530 Subject: [PATCH 0155/1862] JAVA-66: parent module pom changes corresponding to module renaming --- persistence-modules/pom.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index f1154f203b..c598ad8805 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -59,11 +59,12 @@ spring-data-elasticsearch spring-data-gemfire spring-data-geode - spring-data-jpa - spring-data-jpa-2 - spring-data-jpa-3 - spring-data-jpa-4 - spring-data-jpa-5 + spring-data-jpa-annotations + spring-data-jpa-crud + spring-data-jpa-enterprise + spring-data-jpa-filtering + spring-data-jpa-query + spring-data-jpa-repo spring-data-keyvalue spring-data-mongodb spring-data-neo4j From 2e118afd7433023d59f6b02b30b19e1df2c14ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Sun, 19 Jul 2020 14:38:02 +0200 Subject: [PATCH 0156/1862] [JAVA-1670] Follow-up fixes (#9725) * Removed junit-platform version overriding from spring-boot-client * Removed junit version overriding from spring-boot-with-starter-parent --- spring-boot-modules/spring-boot-client/pom.xml | 1 - .../spring-boot-parent/spring-boot-with-starter-parent/pom.xml | 2 -- 2 files changed, 3 deletions(-) diff --git a/spring-boot-modules/spring-boot-client/pom.xml b/spring-boot-modules/spring-boot-client/pom.xml index a7737be106..aa832497e9 100644 --- a/spring-boot-modules/spring-boot-client/pom.xml +++ b/spring-boot-modules/spring-boot-client/pom.xml @@ -116,7 +116,6 @@ 18.0 - 1.2.0 2.2.4 diff --git a/spring-boot-modules/spring-boot-parent/spring-boot-with-starter-parent/pom.xml b/spring-boot-modules/spring-boot-parent/spring-boot-with-starter-parent/pom.xml index 7413492d7f..108e66b68e 100644 --- a/spring-boot-modules/spring-boot-parent/spring-boot-with-starter-parent/pom.xml +++ b/spring-boot-modules/spring-boot-parent/spring-boot-with-starter-parent/pom.xml @@ -41,7 +41,5 @@ 1.8 2.2.5.RELEASE - 4.11 - From ca8eee9359d4b5f1a9e16c3ad009aa889a45faaf Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Sun, 19 Jul 2020 18:32:17 +0530 Subject: [PATCH 0157/1862] JAVA-2160 Add modules in main pom build (#9726) * add modules in main pom build * add modules in main pom build --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index f5409d60c4..9d9c448887 100644 --- a/pom.xml +++ b/pom.xml @@ -386,6 +386,7 @@ core-java-modules core-kotlin-modules + core-scala couchbase custom-pmd @@ -559,6 +560,7 @@ atomikos reactive-systems + slack @@ -707,6 +709,7 @@ spring-rest-shell spring-rest-simple spring-resttemplate + spring-resttemplate-2 spring-rest-testing spring-roo @@ -901,6 +904,7 @@ core-java-modules core-kotlin-modules + core-scala couchbase custom-pmd @@ -1071,6 +1075,7 @@ atomikos reactive-systems + slack @@ -1211,6 +1216,7 @@ spring-rest-shell spring-rest-simple spring-resttemplate + spring-resttemplate-2 spring-rest-testing spring-roo From cbdebb76adb9a2efe3280285dac971c41c983eac Mon Sep 17 00:00:00 2001 From: Kamlesh Kumar Date: Sun, 19 Jul 2020 20:13:14 +0530 Subject: [PATCH 0158/1862] BAEL-4094: Code example for Spring ApplicationContext article (#9656) --- spring-core-4/pom.xml | 16 +++++ .../applicationcontext/AccountConfig.java | 28 ++++++++ .../applicationcontext/AccountRepository.java | 5 ++ .../applicationcontext/AccountService.java | 32 +++++++++ .../MyWebApplicationInitializer.java | 24 +++++++ .../MyXmlWebApplicationInitializer.java | 24 +++++++ .../applicationcontext/UserService.java | 10 +++ .../ApplicationContextUnitTest.java | 71 +++++++++++++++++++ .../account-bean-config.xml | 13 ++++ .../applicationcontext/user-bean-config.xml | 15 ++++ .../test/resources/config/messages.properties | 1 + 11 files changed, 239 insertions(+) create mode 100644 spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountConfig.java create mode 100644 spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountRepository.java create mode 100644 spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountService.java create mode 100644 spring-core-4/src/main/java/com/baeldung/applicationcontext/MyWebApplicationInitializer.java create mode 100644 spring-core-4/src/main/java/com/baeldung/applicationcontext/MyXmlWebApplicationInitializer.java create mode 100644 spring-core-4/src/main/java/com/baeldung/applicationcontext/UserService.java create mode 100644 spring-core-4/src/test/java/com/baeldung/applicationcontext/ApplicationContextUnitTest.java create mode 100644 spring-core-4/src/test/resources/applicationcontext/account-bean-config.xml create mode 100644 spring-core-4/src/test/resources/applicationcontext/user-bean-config.xml create mode 100644 spring-core-4/src/test/resources/config/messages.properties diff --git a/spring-core-4/pom.xml b/spring-core-4/pom.xml index e5aee1f81d..df0b90fef2 100644 --- a/spring-core-4/pom.xml +++ b/spring-core-4/pom.xml @@ -24,6 +24,16 @@ spring-core ${spring.version} + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + org.springframework spring-expression @@ -69,6 +79,12 @@ ${assertj-core.version} test + + javax.servlet + javax.servlet-api + 4.0.0 + + diff --git a/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountConfig.java b/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountConfig.java new file mode 100644 index 0000000000..d4c960bd68 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountConfig.java @@ -0,0 +1,28 @@ +package com.baeldung.applicationcontext; + +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ResourceBundleMessageSource; + +@Configuration +public class AccountConfig { + + @Bean + public AccountService accountService() { + return new AccountService(accountRepository()); + } + + @Bean + public AccountRepository accountRepository() { + return new AccountRepository(); + } + + @Bean + public MessageSource messageSource() { + ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); + messageSource.setBasename("config/messages"); + return messageSource; + } + +} diff --git a/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountRepository.java b/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountRepository.java new file mode 100644 index 0000000000..f15475acf3 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountRepository.java @@ -0,0 +1,5 @@ +package com.baeldung.applicationcontext; + +public class AccountRepository { + +} diff --git a/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountService.java b/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountService.java new file mode 100644 index 0000000000..c8b58915a8 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/applicationcontext/AccountService.java @@ -0,0 +1,32 @@ +package com.baeldung.applicationcontext; + +import java.util.Locale; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; + +public class AccountService { + + @Autowired + private AccountRepository accountRepository; + + @Autowired + private MessageSource messageSource; + + public void setAccountRepository(AccountRepository accountRepository) { + this.accountRepository = accountRepository; + } + + public AccountRepository getAccountRepository() { + return accountRepository; + } + + public AccountService(AccountRepository accountRepository) { + this.accountRepository = accountRepository; + } + + public String getAccountName() { + return messageSource.getMessage("account.name", null, Locale.ENGLISH); + } + +} diff --git a/spring-core-4/src/main/java/com/baeldung/applicationcontext/MyWebApplicationInitializer.java b/spring-core-4/src/main/java/com/baeldung/applicationcontext/MyWebApplicationInitializer.java new file mode 100644 index 0000000000..0296910311 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/applicationcontext/MyWebApplicationInitializer.java @@ -0,0 +1,24 @@ +package com.baeldung.applicationcontext; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRegistration; + +import org.springframework.web.WebApplicationInitializer; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.web.servlet.DispatcherServlet; + +public class MyWebApplicationInitializer implements WebApplicationInitializer { + + public void onStartup(ServletContext container) throws ServletException { + AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); + context.register(AccountConfig.class); + context.setServletContext(container); + + ServletRegistration.Dynamic servlet = container.addServlet("dispatcher", new DispatcherServlet(context)); + servlet.setLoadOnStartup(1); + + servlet.addMapping("/"); + } + +} diff --git a/spring-core-4/src/main/java/com/baeldung/applicationcontext/MyXmlWebApplicationInitializer.java b/spring-core-4/src/main/java/com/baeldung/applicationcontext/MyXmlWebApplicationInitializer.java new file mode 100644 index 0000000000..fe681f1784 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/applicationcontext/MyXmlWebApplicationInitializer.java @@ -0,0 +1,24 @@ +package com.baeldung.applicationcontext; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRegistration; + +import org.springframework.web.WebApplicationInitializer; +import org.springframework.web.context.support.XmlWebApplicationContext; +import org.springframework.web.servlet.DispatcherServlet; + +public class MyXmlWebApplicationInitializer implements WebApplicationInitializer { + + public void onStartup(ServletContext container) throws ServletException { + XmlWebApplicationContext context = new XmlWebApplicationContext(); + context.setConfigLocation("/WEB-INF/spring/applicationContext.xml"); + context.setServletContext(container); + + ServletRegistration.Dynamic servlet = container.addServlet("dispatcher", new DispatcherServlet(context)); + servlet.setLoadOnStartup(1); + + servlet.addMapping("/"); + } + +} diff --git a/spring-core-4/src/main/java/com/baeldung/applicationcontext/UserService.java b/spring-core-4/src/main/java/com/baeldung/applicationcontext/UserService.java new file mode 100644 index 0000000000..b63d6828a7 --- /dev/null +++ b/spring-core-4/src/main/java/com/baeldung/applicationcontext/UserService.java @@ -0,0 +1,10 @@ +package com.baeldung.applicationcontext; + +import org.springframework.stereotype.Component; + +@Component +public class UserService { + + // user service code + +} diff --git a/spring-core-4/src/test/java/com/baeldung/applicationcontext/ApplicationContextUnitTest.java b/spring-core-4/src/test/java/com/baeldung/applicationcontext/ApplicationContextUnitTest.java new file mode 100644 index 0000000000..491d5dd9d0 --- /dev/null +++ b/spring-core-4/src/test/java/com/baeldung/applicationcontext/ApplicationContextUnitTest.java @@ -0,0 +1,71 @@ +package com.baeldung.applicationcontext; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import org.junit.Ignore; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; + +public class ApplicationContextUnitTest { + + @Test + public void givenAnnotationConfigAppContext_whenSpringConfig_thenMappingSuccess() { + ApplicationContext context = new AnnotationConfigApplicationContext(AccountConfig.class); + AccountService accountService = context.getBean(AccountService.class); + + assertNotNull(accountService); + assertNotNull(accountService.getAccountRepository()); + + ((AnnotationConfigApplicationContext) context).close(); + } + + @Test + public void givenClasspathXmlAppContext_whenAnnotationConfig_thenMappingSuccess() { + ApplicationContext context = new ClassPathXmlApplicationContext("applicationcontext/user-bean-config.xml"); + UserService userService = context.getBean(UserService.class); + + assertNotNull(userService); + + ((ClassPathXmlApplicationContext) context).close(); + } + + @Test + @Ignore + public void givenFileXmlAppContext_whenXMLConfig_thenMappingSuccess() { + String path = "D:/workspaces/Baeldung/tutorials/spring-core-4/src/test/resources/applicationcontext/account-bean-config.xml"; + + ApplicationContext context = new FileSystemXmlApplicationContext(path); + AccountService accountService = context.getBean("accountService", AccountService.class); + + assertNotNull(accountService); + assertNotNull(accountService.getAccountRepository()); + + ((FileSystemXmlApplicationContext) context).close(); + } + + @Test + public void givenClasspathXmlAppContext_whenXMLConfig_thenMappingSuccess() { + ApplicationContext context = new ClassPathXmlApplicationContext("applicationcontext/account-bean-config.xml"); + AccountService accountService = context.getBean("accountService", AccountService.class); + + assertNotNull(accountService); + assertNotNull(accountService.getAccountRepository()); + + ((ClassPathXmlApplicationContext) context).close(); + } + + @Test + public void givenMessagesInFile_whenMessageResourceUsed_thenReadMessage() { + ApplicationContext context = new AnnotationConfigApplicationContext(AccountConfig.class); + AccountService accountService = context.getBean(AccountService.class); + + assertEquals("TestAccount", accountService.getAccountName()); + + ((AnnotationConfigApplicationContext) context).close(); + } + +} diff --git a/spring-core-4/src/test/resources/applicationcontext/account-bean-config.xml b/spring-core-4/src/test/resources/applicationcontext/account-bean-config.xml new file mode 100644 index 0000000000..eef434928f --- /dev/null +++ b/spring-core-4/src/test/resources/applicationcontext/account-bean-config.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/spring-core-4/src/test/resources/applicationcontext/user-bean-config.xml b/spring-core-4/src/test/resources/applicationcontext/user-bean-config.xml new file mode 100644 index 0000000000..9779d64270 --- /dev/null +++ b/spring-core-4/src/test/resources/applicationcontext/user-bean-config.xml @@ -0,0 +1,15 @@ + + + + + + + diff --git a/spring-core-4/src/test/resources/config/messages.properties b/spring-core-4/src/test/resources/config/messages.properties new file mode 100644 index 0000000000..7d5a4baa73 --- /dev/null +++ b/spring-core-4/src/test/resources/config/messages.properties @@ -0,0 +1 @@ +account.name=TestAccount From 8309e562681e944970f2f7277d06f33258031cc7 Mon Sep 17 00:00:00 2001 From: developerDiv Date: Sun, 19 Jul 2020 15:44:48 +0100 Subject: [PATCH 0159/1862] Rename tests --- .../mockito/argumentcaptor/Credentials.java | 1 - .../argumentcaptor/EmailServiceUnitTest.java | 21 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Credentials.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Credentials.java index 5aec15505e..d5d60bb6fc 100644 --- a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Credentials.java +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/Credentials.java @@ -6,7 +6,6 @@ public class Credentials { private final String key; public Credentials(String name, String password, String key) { - this.name = name; this.password = password; this.key = key; diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java index cdae118e92..2208bc7c7b 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java @@ -32,7 +32,7 @@ public class EmailServiceUnitTest { public void whenDoesNotSupportHtml_expectTextOnlyEmailFormat() { String to = "info@baeldung.com"; String subject = "Using ArgumentCaptor"; - String body = "Article on using ArgumentCaptor"; + String body = "Hey, let'use ArgumentCaptor"; emailService.send(to, subject, body, false); @@ -42,10 +42,10 @@ public class EmailServiceUnitTest { } @Test - public void send_whenDoesSupportHtml_expectHTMLEmailFormat() { - String to = "baeldung@baeldung.com"; - String subject = "Great New Course!"; - String body = "Try out our new course."; + public void whenDoesSupportHtml_expectHTMLEmailFormat() { + String to = "info@baeldung.com"; + String subject = "Using ArgumentCaptor"; + String body = "Hey, let'use ArgumentCaptor"; emailService.send(to, subject, body, true); @@ -55,7 +55,7 @@ public class EmailServiceUnitTest { } @Test - public void getServiceStatus_whenServiceRunning_expectUpResponse() { + public void whenServiceRunning_expectUpResponse() { when(platform.getServiceStatus()).thenReturn("OK"); ServiceStatus serviceStatus = emailService.checkServiceStatus(); @@ -64,7 +64,7 @@ public class EmailServiceUnitTest { } @Test - public void getServiceStatus_whenServiceNotRunning_expectDownResponse() { + public void whenServiceNotRunning_expectDownResponse() { when(platform.getServiceStatus()).thenReturn("Error"); ServiceStatus serviceStatus = emailService.checkServiceStatus(); @@ -73,7 +73,7 @@ public class EmailServiceUnitTest { } @Test - public void usingArgumemtMatcher_whenAuthenticatedWithValidCredentials_expectTrue() { + public void usingArgumentMatcher_whenAuthenticatedWithValidCredentials_expectTrue() { Credentials credentials = new Credentials("baeldung", "correct_password", "correct_key"); when(platform.authenticate(eq(credentials))).thenReturn(AuthenticationStatus.AUTHENTICATED); @@ -90,11 +90,10 @@ public class EmailServiceUnitTest { } @Test - public void authenticate_whenNotAuthenticated_expectFalse() { + public void whenNotAuthenticated_expectFalse() { Credentials credentials = new Credentials("baeldung", "incorrect_password", "incorrect_key"); - when(platform.authenticate(credentialsCaptor.capture())).thenReturn(AuthenticationStatus.NOT_AUTHENTICATED); + when(platform.authenticate(eq(credentials))).thenReturn(AuthenticationStatus.NOT_AUTHENTICATED); assertFalse(emailService.authenticatedSuccessfully(credentials)); - assertEquals(credentials, credentialsCaptor.getValue()); } } \ No newline at end of file From 76b1717953685a4dfb72153084b4f5645527a015 Mon Sep 17 00:00:00 2001 From: Nguyen Nam Thai Date: Sun, 19 Jul 2020 22:07:57 +0700 Subject: [PATCH 0160/1862] BAEL-4113 Relocate the ExceptionBenchmark class --- performance-tests/pom.xml | 13 +++++++++++++ .../exception}/ExceptionBenchmark.java | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) rename {jmh/src/main/java/com/baeldung => performance-tests/src/main/java/com/baeldung/performancetests/exception}/ExceptionBenchmark.java (97%) diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml index 0dc38e56a4..c790dbbb16 100644 --- a/performance-tests/pom.xml +++ b/performance-tests/pom.xml @@ -120,6 +120,18 @@ + + org.apache.maven.plugins + maven-jar-plugin + ${maven-jar-plugin.version} + + + + com.baeldung.performancetests.MappingFrameworksPerformance + + + + @@ -178,6 +190,7 @@ 1.21 1.21 3.7.0 + 3.2.0 ]](../java-collections-conversions-2) \ No newline at end of file diff --git a/java-collections/pom.xml b/java-collections/pom.xml deleted file mode 100644 index 5e0ee42244..0000000000 --- a/java-collections/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - 4.0.0 - java-collections - 0.1.0-SNAPSHOT - java-collections - jar - - - com.baeldung - parent-java - 0.0.1-SNAPSHOT - ../parent-java - - - - - org.apache.commons - commons-collections4 - ${commons-collections4.version} - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - org.hamcrest - hamcrest-all - ${hamcrest-all.version} - test - - - - - java-collections - - - src/main/resources - true - - - - - - 4.1 - - diff --git a/java-collections/src/main/java/com/baeldung/comparingarrays/Plane.java b/java-collections/src/main/java/com/baeldung/comparingarrays/Plane.java deleted file mode 100644 index db61807878..0000000000 --- a/java-collections/src/main/java/com/baeldung/comparingarrays/Plane.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.comparingarrays; - -import java.util.Objects; - -public class Plane { - - private final String name; - - private final String model; - - public Plane(String name, String model) { - - this.name = name; - this.model = model; - } - - public String getName() { - return name; - } - - public String getModel() { - return model; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - Plane plane = (Plane) o; - return Objects.equals(name, plane.name) && Objects.equals(model, plane.model); - } - - @Override - public int hashCode() { - return Objects.hash(name, model); - } -} diff --git a/java-collections/src/main/resources/logback.xml b/java-collections/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/java-collections/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/java-collections/src/test/java/com/baeldung/DeepEqualsCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/DeepEqualsCompareUnitTest.java deleted file mode 100644 index f311d0e5c9..0000000000 --- a/java-collections/src/test/java/com/baeldung/DeepEqualsCompareUnitTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung; - -import com.baeldung.comparingarrays.Plane; -import org.junit.jupiter.api.Test; - -import java.util.Arrays; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class DeepEqualsCompareUnitTest { - - @Test - public void givenArray1andArray2_whenSameContent_thenDeepEquals() { - final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, - new Plane[] { new Plane("Plane 2", "B738") } }; - final Plane[][] planes2 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, - new Plane[] { new Plane("Plane 2", "B738") } }; - - boolean result = Arrays.deepEquals(planes1, planes2); - assertTrue("Result is not true", result); - } - - @Test - public void givenArray1andArray2_whenNotSameContent_thenNotDeepEquals() { - final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, - new Plane[] { new Plane("Plane 2", "B738") } }; - final Plane[][] planes2 = new Plane[][] { new Plane[] { new Plane("Plane 2", "B738") }, - new Plane[] { new Plane("Plane 1", "A320") } }; - - boolean result = Arrays.deepEquals(planes1, planes2); - assertFalse("Result is true", result); - } -} diff --git a/java-collections/src/test/java/com/baeldung/EqualsCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/EqualsCompareUnitTest.java deleted file mode 100644 index b56395a848..0000000000 --- a/java-collections/src/test/java/com/baeldung/EqualsCompareUnitTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung; - -import org.junit.jupiter.api.Test; - -import java.util.Arrays; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class EqualsCompareUnitTest { - - @Test - public void givenArray1andArray2_whenSameContent_thenEquals() { - final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - final String[] planes2 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - - boolean result = Arrays.equals(planes1, planes2); - assertTrue("Result is not true", result); - } - - @Test - public void givenArray1andArray2_whenSameContentOtherSort_thenNotEquals() { - final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - final String[] planes2 = new String[] { "B738", "A320", "A321", "A319", "B77W", "B737", "A333", "A332" }; - - boolean result = Arrays.equals(planes1, planes2); - assertFalse("Result is true", result); - } -} diff --git a/java-collections/src/test/java/com/baeldung/LengthsCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/LengthsCompareUnitTest.java deleted file mode 100644 index 8b3c90c427..0000000000 --- a/java-collections/src/test/java/com/baeldung/LengthsCompareUnitTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung; - -import org.junit.jupiter.api.Test; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.collection.IsArrayWithSize.arrayWithSize; -import static org.junit.Assert.assertThat; - -public class LengthsCompareUnitTest { - - @Test - public void givenArray1andArray2_whenSameSizes_thenSizeEqualsOk() { - final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - final Integer[] quantities = new Integer[] { 10, 12, 34, 45, 12, 43, 5, 2 }; - - assertThat(planes1, arrayWithSize(8)); - assertThat(quantities, arrayWithSize(8)); - assertThat(planes1.length, is(8)); - assertThat(quantities.length, is(8)); - } -} - diff --git a/java-collections/src/test/java/com/baeldung/OrderCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/OrderCompareUnitTest.java deleted file mode 100644 index 8be7251c05..0000000000 --- a/java-collections/src/test/java/com/baeldung/OrderCompareUnitTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung; - -import com.baeldung.comparingarrays.Plane; -import org.junit.jupiter.api.Test; - -import java.util.Arrays; -import java.util.Comparator; - -import static org.junit.Assert.assertTrue; - -public class OrderCompareUnitTest { - @Test - public void givenArray1andArray2_whenNotSameContent_thenNotDeepEquals() { - final Plane[][] planes1 = new Plane[][] { - new Plane[] { new Plane("Plane 1", "A320"), new Plane("Plane 2", "B738") } }; - final Plane[][] planes2 = new Plane[][] { - new Plane[] { new Plane("Plane 2", "B738"), new Plane("Plane 1", "A320") } }; - - Comparator planeComparator = (o1, o2) -> { - if (o1.getName() - .equals(o2.getName())) { - return o2.getModel() - .compareTo(o1.getModel()); - } - return o2.getName() - .compareTo(o1.getName()); - }; - Arrays.sort(planes1[0], planeComparator); - Arrays.sort(planes2[0], planeComparator); - - boolean result = Arrays.deepEquals(planes1, planes2); - assertTrue("Result is false", result); - } -} diff --git a/java-collections/src/test/java/com/baeldung/ReferenceCompareUnitTest.java b/java-collections/src/test/java/com/baeldung/ReferenceCompareUnitTest.java deleted file mode 100644 index 9716a34607..0000000000 --- a/java-collections/src/test/java/com/baeldung/ReferenceCompareUnitTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung; - -import org.junit.jupiter.api.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertSame; - -public class ReferenceCompareUnitTest { - - @Test - public void givenArray1andArray2_whenEquals_thenEqual() { - final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - final String[] planes2 = planes1; - - assertSame("Objects are not equal!", planes1, planes2); - - planes2[0] = "747"; - - assertSame("Objects are not same!", planes1, planes2); - assertEquals("Objects are not equal!", "747", planes2[0]); - assertEquals("Objects are not equal!", "747", planes1[0]); - } - - @Test - public void givenArray1andArray2_whenDifferentValues_thenNotEqual() { - final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - final String[] planes2 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - - assertNotSame("Objects are the same!", planes1, planes2); - assertNotEquals("Objects are equal!", planes1, planes2); - } -} From ad1d9b4b847270082314659ad2736c6ee0f2fe14 Mon Sep 17 00:00:00 2001 From: Joao Esperancinha Date: Tue, 21 Jul 2020 06:37:09 +0200 Subject: [PATCH 0167/1862] [BAEL-4281] moves example module --- .../java/com/baeldung/arraycompare/Plane.java | 39 +++++++++++++++++++ .../DeepEqualsCompareUnitTest.java | 33 ++++++++++++++++ .../arraycompare/EqualsCompareUnitTest.java | 29 ++++++++++++++ .../arraycompare/LengthsCompareUnitTest.java | 22 +++++++++++ .../arraycompare/OrderCompareUnitTest.java | 33 ++++++++++++++++ .../ReferenceCompareUnitTest.java | 34 ++++++++++++++++ 6 files changed, 190 insertions(+) create mode 100644 core-java-modules/core-java-arrays-operations-advanced/src/main/java/com/baeldung/arraycompare/Plane.java create mode 100644 core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/DeepEqualsCompareUnitTest.java create mode 100644 core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/EqualsCompareUnitTest.java create mode 100644 core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/LengthsCompareUnitTest.java create mode 100644 core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/OrderCompareUnitTest.java create mode 100644 core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/ReferenceCompareUnitTest.java diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/main/java/com/baeldung/arraycompare/Plane.java b/core-java-modules/core-java-arrays-operations-advanced/src/main/java/com/baeldung/arraycompare/Plane.java new file mode 100644 index 0000000000..1731578b76 --- /dev/null +++ b/core-java-modules/core-java-arrays-operations-advanced/src/main/java/com/baeldung/arraycompare/Plane.java @@ -0,0 +1,39 @@ +package com.baeldung.arraycompare; + +import java.util.Objects; + +public class Plane { + + private final String name; + + private final String model; + + public Plane(String name, String model) { + + this.name = name; + this.model = model; + } + + public String getName() { + return name; + } + + public String getModel() { + return model; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Plane plane = (Plane) o; + return Objects.equals(name, plane.name) && Objects.equals(model, plane.model); + } + + @Override + public int hashCode() { + return Objects.hash(name, model); + } +} diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/DeepEqualsCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/DeepEqualsCompareUnitTest.java new file mode 100644 index 0000000000..ab7eaec127 --- /dev/null +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/DeepEqualsCompareUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.arraycompare; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class DeepEqualsCompareUnitTest { + + @Test + public void givenArray1andArray2_whenSameContent_thenDeepEquals() { + final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, + new Plane[] { new Plane("Plane 2", "B738") } }; + final Plane[][] planes2 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, + new Plane[] { new Plane("Plane 2", "B738") } }; + + boolean result = Arrays.deepEquals(planes1, planes2); + assertTrue("Result is not true", result); + } + + @Test + public void givenArray1andArray2_whenNotSameContent_thenNotDeepEquals() { + final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, + new Plane[] { new Plane("Plane 2", "B738") } }; + final Plane[][] planes2 = new Plane[][] { new Plane[] { new Plane("Plane 2", "B738") }, + new Plane[] { new Plane("Plane 1", "A320") } }; + + boolean result = Arrays.deepEquals(planes1, planes2); + assertFalse("Result is true", result); + } +} diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/EqualsCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/EqualsCompareUnitTest.java new file mode 100644 index 0000000000..dd74eb8f0a --- /dev/null +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/EqualsCompareUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.arraycompare; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class EqualsCompareUnitTest { + + @Test + public void givenArray1andArray2_whenSameContent_thenEquals() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final String[] planes2 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + + boolean result = Arrays.equals(planes1, planes2); + assertTrue("Result is not true", result); + } + + @Test + public void givenArray1andArray2_whenSameContentOtherSort_thenNotEquals() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final String[] planes2 = new String[] { "B738", "A320", "A321", "A319", "B77W", "B737", "A333", "A332" }; + + boolean result = Arrays.equals(planes1, planes2); + assertFalse("Result is true", result); + } +} diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/LengthsCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/LengthsCompareUnitTest.java new file mode 100644 index 0000000000..ef22d69d90 --- /dev/null +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/LengthsCompareUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.arraycompare; + +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.is; +import static org.hamcrest.collection.IsArrayWithSize.arrayWithSize; +import static org.junit.Assert.assertThat; + +public class LengthsCompareUnitTest { + + @Test + public void givenArray1andArray2_whenSameSizes_thenSizeEqualsOk() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final Integer[] quantities = new Integer[] { 10, 12, 34, 45, 12, 43, 5, 2 }; + + assertThat(planes1, arrayWithSize(8)); + assertThat(quantities, arrayWithSize(8)); + assertThat(planes1.length, is(8)); + assertThat(quantities.length, is(8)); + } +} + diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/OrderCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/OrderCompareUnitTest.java new file mode 100644 index 0000000000..77cc91092a --- /dev/null +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/OrderCompareUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.arraycompare; + +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.Comparator; + +import static org.junit.Assert.assertTrue; + +public class OrderCompareUnitTest { + @Test + public void givenArray1andArray2_whenNotSameContent_thenNotDeepEquals() { + final Plane[][] planes1 = new Plane[][] { + new Plane[] { new Plane("Plane 1", "A320"), new Plane("Plane 2", "B738") } }; + final Plane[][] planes2 = new Plane[][] { + new Plane[] { new Plane("Plane 2", "B738"), new Plane("Plane 1", "A320") } }; + + Comparator planeComparator = (o1, o2) -> { + if (o1.getName() + .equals(o2.getName())) { + return o2.getModel() + .compareTo(o1.getModel()); + } + return o2.getName() + .compareTo(o1.getName()); + }; + Arrays.sort(planes1[0], planeComparator); + Arrays.sort(planes2[0], planeComparator); + + boolean result = Arrays.deepEquals(planes1, planes2); + assertTrue("Result is false", result); + } +} diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/ReferenceCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/ReferenceCompareUnitTest.java new file mode 100644 index 0000000000..8a26fc8e74 --- /dev/null +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/ReferenceCompareUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung.arraycompare; + +import org.junit.jupiter.api.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; + +public class ReferenceCompareUnitTest { + + @Test + public void givenArray1andArray2_whenEquals_thenEqual() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final String[] planes2 = planes1; + + assertSame("Objects are not equal!", planes1, planes2); + + planes2[0] = "747"; + + assertSame("Objects are not same!", planes1, planes2); + assertEquals("Objects are not equal!", "747", planes2[0]); + assertEquals("Objects are not equal!", "747", planes1[0]); + } + + @Test + public void givenArray1andArray2_whenDifferentValues_thenNotEqual() { + final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + final String[] planes2 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; + + assertNotSame("Objects are the same!", planes1, planes2); + assertNotEquals("Objects are equal!", planes1, planes2); + } +} From cffc591b5cd84ef056bc90d5e3a3d087d8882850 Mon Sep 17 00:00:00 2001 From: Joao Esperancinha Date: Tue, 21 Jul 2020 06:55:28 +0200 Subject: [PATCH 0168/1862] [BAEL-4281] Naming convention and conversion to assertJ --- .../DeepEqualsCompareUnitTest.java | 13 +++++------- .../arraycompare/EqualsCompareUnitTest.java | 13 +++++------- .../arraycompare/LengthsCompareUnitTest.java | 12 ++++------- .../arraycompare/OrderCompareUnitTest.java | 6 +++--- .../ReferenceCompareUnitTest.java | 20 ++++++++----------- 5 files changed, 25 insertions(+), 39 deletions(-) diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/DeepEqualsCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/DeepEqualsCompareUnitTest.java index ab7eaec127..c8ebafb26b 100644 --- a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/DeepEqualsCompareUnitTest.java +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/DeepEqualsCompareUnitTest.java @@ -4,30 +4,27 @@ import org.junit.jupiter.api.Test; import java.util.Arrays; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; public class DeepEqualsCompareUnitTest { @Test - public void givenArray1andArray2_whenSameContent_thenDeepEquals() { + public void givenSameContents_whenDeepEquals_thenTrue() { final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, new Plane[] { new Plane("Plane 2", "B738") } }; final Plane[][] planes2 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, new Plane[] { new Plane("Plane 2", "B738") } }; - boolean result = Arrays.deepEquals(planes1, planes2); - assertTrue("Result is not true", result); + assertThat(Arrays.deepEquals(planes1, planes2)).isTrue(); } @Test - public void givenArray1andArray2_whenNotSameContent_thenNotDeepEquals() { + public void givenSameContentsWithDifferentOrder_whenDeepEquals_thenFalse() { final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320") }, new Plane[] { new Plane("Plane 2", "B738") } }; final Plane[][] planes2 = new Plane[][] { new Plane[] { new Plane("Plane 2", "B738") }, new Plane[] { new Plane("Plane 1", "A320") } }; - boolean result = Arrays.deepEquals(planes1, planes2); - assertFalse("Result is true", result); + assertThat(Arrays.deepEquals(planes1, planes2)).isFalse(); } } diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/EqualsCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/EqualsCompareUnitTest.java index dd74eb8f0a..a022bf7082 100644 --- a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/EqualsCompareUnitTest.java +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/EqualsCompareUnitTest.java @@ -4,26 +4,23 @@ import org.junit.jupiter.api.Test; import java.util.Arrays; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; public class EqualsCompareUnitTest { @Test - public void givenArray1andArray2_whenSameContent_thenEquals() { + public void givenSameContents_whenEquals_thenTrue() { final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; final String[] planes2 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - boolean result = Arrays.equals(planes1, planes2); - assertTrue("Result is not true", result); + assertThat(Arrays.equals(planes1, planes2)).isTrue(); } @Test - public void givenArray1andArray2_whenSameContentOtherSort_thenNotEquals() { + public void givenSameContentsDifferentOrder_whenEquals_thenFalse() { final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; final String[] planes2 = new String[] { "B738", "A320", "A321", "A319", "B77W", "B737", "A333", "A332" }; - boolean result = Arrays.equals(planes1, planes2); - assertFalse("Result is true", result); + assertThat(Arrays.equals(planes1, planes2)).isFalse(); } } diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/LengthsCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/LengthsCompareUnitTest.java index ef22d69d90..23187b827c 100644 --- a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/LengthsCompareUnitTest.java +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/LengthsCompareUnitTest.java @@ -2,21 +2,17 @@ package com.baeldung.arraycompare; import org.junit.jupiter.api.Test; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.collection.IsArrayWithSize.arrayWithSize; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; public class LengthsCompareUnitTest { @Test - public void givenArray1andArray2_whenSameSizes_thenSizeEqualsOk() { + public void givenSameContent_whenSizeCompare_thenTrue() { final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; final Integer[] quantities = new Integer[] { 10, 12, 34, 45, 12, 43, 5, 2 }; - assertThat(planes1, arrayWithSize(8)); - assertThat(quantities, arrayWithSize(8)); - assertThat(planes1.length, is(8)); - assertThat(quantities.length, is(8)); + assertThat(planes1).hasSize(8); + assertThat(quantities).hasSize(8); } } diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/OrderCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/OrderCompareUnitTest.java index 77cc91092a..4dd7964020 100644 --- a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/OrderCompareUnitTest.java +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/OrderCompareUnitTest.java @@ -5,11 +5,12 @@ import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.Comparator; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertTrue; public class OrderCompareUnitTest { @Test - public void givenArray1andArray2_whenNotSameContent_thenNotDeepEquals() { + public void givenSameContentDifferentOrder_whenSortedAndDeepEquals_thenTrue() { final Plane[][] planes1 = new Plane[][] { new Plane[] { new Plane("Plane 1", "A320"), new Plane("Plane 2", "B738") } }; final Plane[][] planes2 = new Plane[][] { @@ -27,7 +28,6 @@ public class OrderCompareUnitTest { Arrays.sort(planes1[0], planeComparator); Arrays.sort(planes2[0], planeComparator); - boolean result = Arrays.deepEquals(planes1, planes2); - assertTrue("Result is false", result); + assertThat(Arrays.deepEquals(planes1, planes2)).isTrue(); } } diff --git a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/ReferenceCompareUnitTest.java b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/ReferenceCompareUnitTest.java index 8a26fc8e74..d8072a98e3 100644 --- a/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/ReferenceCompareUnitTest.java +++ b/core-java-modules/core-java-arrays-operations-advanced/src/test/java/com/baeldung/arraycompare/ReferenceCompareUnitTest.java @@ -2,33 +2,29 @@ package com.baeldung.arraycompare; import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertSame; +import static org.assertj.core.api.Assertions.assertThat; public class ReferenceCompareUnitTest { @Test - public void givenArray1andArray2_whenEquals_thenEqual() { + public void givenSameReferences_whenSame_thenTrue() { final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; final String[] planes2 = planes1; - assertSame("Objects are not equal!", planes1, planes2); + assertThat(planes1).isSameAs(planes2); planes2[0] = "747"; - assertSame("Objects are not same!", planes1, planes2); - assertEquals("Objects are not equal!", "747", planes2[0]); - assertEquals("Objects are not equal!", "747", planes1[0]); + assertThat(planes1).isSameAs(planes2); + assertThat(planes2[0]).isEqualTo("747"); + assertThat(planes1[0]).isEqualTo("747"); } @Test - public void givenArray1andArray2_whenDifferentValues_thenNotEqual() { + public void givenSameContentDifferentReferences_whenSame_thenFalse() { final String[] planes1 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; final String[] planes2 = new String[] { "A320", "B738", "A321", "A319", "B77W", "B737", "A333", "A332" }; - assertNotSame("Objects are the same!", planes1, planes2); - assertNotEquals("Objects are equal!", planes1, planes2); + assertThat(planes1).isNotSameAs(planes2); } } From f9917c483f3a37b1db1617f85b71c24f5095ff03 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Tue, 21 Jul 2020 12:59:14 +0530 Subject: [PATCH 0169/1862] Delete index.html --- .../http-session-example/WebContent/index.html | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 spring-session/http-session-example/WebContent/index.html diff --git a/spring-session/http-session-example/WebContent/index.html b/spring-session/http-session-example/WebContent/index.html deleted file mode 100644 index 063d330854..0000000000 --- a/spring-session/http-session-example/WebContent/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - -Insert title here - - -
    -Name:

    - -
    - - \ No newline at end of file From 75eba2fa7d17be3afe0b76b33b23c49dc1d84a4d Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Tue, 21 Jul 2020 12:59:32 +0530 Subject: [PATCH 0170/1862] Delete web.xml --- .../WebContent/WEB-INF/web.xml | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 spring-session/http-session-example/WebContent/WEB-INF/web.xml diff --git a/spring-session/http-session-example/WebContent/WEB-INF/web.xml b/spring-session/http-session-example/WebContent/WEB-INF/web.xml deleted file mode 100644 index 01b1b6f308..0000000000 --- a/spring-session/http-session-example/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - httpsessionexample - - index.html - - - -firstservlet -httpsessionexample.FirstServlet - - - -firstservlet -/firstservlet - - - -secondservlet -httpsessionexample.SecondServlet - - - -secondservlet -/secondservlet - - - - From 8b16479fd96f9888542d6a9d052fe0d5144e1b24 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Tue, 21 Jul 2020 12:59:53 +0530 Subject: [PATCH 0171/1862] Delete FirstServlet.java --- .../src/httpsessionexample/FirstServlet.java | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 spring-session/http-session-example/src/httpsessionexample/FirstServlet.java diff --git a/spring-session/http-session-example/src/httpsessionexample/FirstServlet.java b/spring-session/http-session-example/src/httpsessionexample/FirstServlet.java deleted file mode 100644 index d49c0f3e14..0000000000 --- a/spring-session/http-session-example/src/httpsessionexample/FirstServlet.java +++ /dev/null @@ -1,33 +0,0 @@ -package httpsessionexample; - -import java.io.PrintWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -public class FirstServlet extends HttpServlet { - public void doGet(HttpServletRequest request, HttpServletResponse response) { - try { - HttpSession session = request.getSession(); - response.setContentType("text/html"); - PrintWriter out = response.getWriter(); - - String name = request.getParameter("userName"); - out.print("Hi " + name); - - session.setAttribute("uname", name); - out.print("
    "); - out.print("Session Id : " + session.getId()); - out.print("
    "); - out.print("Second Servlet"); - - out.close(); - - } catch (Exception e) { - System.out.println(e); - } - } - -} From 7ff9bc6ac811d0ee2a6623d102bbb850ce09bc64 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Tue, 21 Jul 2020 13:00:09 +0530 Subject: [PATCH 0172/1862] Delete SecondServlet.java --- .../src/httpsessionexample/SecondServlet.java | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 spring-session/http-session-example/src/httpsessionexample/SecondServlet.java diff --git a/spring-session/http-session-example/src/httpsessionexample/SecondServlet.java b/spring-session/http-session-example/src/httpsessionexample/SecondServlet.java deleted file mode 100644 index ab0b9c34ad..0000000000 --- a/spring-session/http-session-example/src/httpsessionexample/SecondServlet.java +++ /dev/null @@ -1,31 +0,0 @@ -package httpsessionexample; - -import java.io.PrintWriter; - -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -public class SecondServlet extends HttpServlet { - - public void doGet(HttpServletRequest request, HttpServletResponse response) { - try { - - response.setContentType("text/html"); - PrintWriter out = response.getWriter(); - - HttpSession session = request.getSession(true); - String name = (String) session.getAttribute("uname"); - out.print("Hi " + name); - out.print("
    "); - out.print("Session Id : " + session.getId()); - out.print("
    "); - out.close(); - - } catch (Exception e) { - System.out.println(e); - } - } - -} From ccfbdd3f9c990a644e03903ab67abeadfdc7835f Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Tue, 21 Jul 2020 13:00:59 +0530 Subject: [PATCH 0173/1862] Add files via upload --- spring-session/http-session-example/README.md | 5 +++ spring-session/http-session-example/pom.xml | 26 +++++++++++++++ .../baeldung/httpsession/FirstServlet.java | 33 +++++++++++++++++++ .../baeldung/httpsession/SecondServlet.java | 31 +++++++++++++++++ .../src/main/webapp/WEB-INF/web.xml | 33 +++++++++++++++++++ .../src/main/webapp/index.html | 12 +++++++ 6 files changed, 140 insertions(+) create mode 100644 spring-session/http-session-example/README.md create mode 100644 spring-session/http-session-example/pom.xml create mode 100644 spring-session/http-session-example/src/main/java/com/baeldung/httpsession/FirstServlet.java create mode 100644 spring-session/http-session-example/src/main/java/com/baeldung/httpsession/SecondServlet.java create mode 100644 spring-session/http-session-example/src/main/webapp/WEB-INF/web.xml create mode 100644 spring-session/http-session-example/src/main/webapp/index.html diff --git a/spring-session/http-session-example/README.md b/spring-session/http-session-example/README.md new file mode 100644 index 0000000000..95c7a41e2d --- /dev/null +++ b/spring-session/http-session-example/README.md @@ -0,0 +1,5 @@ +## HttpSession + +This module contains article about Difference Between request.getSession() and request.getSession(true) + +### Relevant Articles: diff --git a/spring-session/http-session-example/pom.xml b/spring-session/http-session-example/pom.xml new file mode 100644 index 0000000000..a77176fb4b --- /dev/null +++ b/spring-session/http-session-example/pom.xml @@ -0,0 +1,26 @@ + + 4.0.0 + com.baeldung.httpsession + http-session-example + war + 0.0.1-SNAPSHOT + http-session-example Maven Webapp + http://maven.apache.org + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + javax.servlet + servlet-api + 2.5 + provided + + + diff --git a/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/FirstServlet.java b/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/FirstServlet.java new file mode 100644 index 0000000000..950bea2c07 --- /dev/null +++ b/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/FirstServlet.java @@ -0,0 +1,33 @@ +package com.baeldung.httpsession; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +public class FirstServlet extends HttpServlet { + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + try { + HttpSession session = request.getSession(); + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + + String name = request.getParameter("userName"); + session.setAttribute("uname", name); + out.println("Hi " + name + " Your Session Id is : " + session.getId() + " "); + + out.println("
    Second Servlet"); + + out.close(); + + } catch (Exception e) { + System.out.println(e); + } + } + +} diff --git a/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/SecondServlet.java b/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/SecondServlet.java new file mode 100644 index 0000000000..6a5ef7e9a8 --- /dev/null +++ b/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/SecondServlet.java @@ -0,0 +1,31 @@ +package com.baeldung.httpsession; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +public class SecondServlet extends HttpServlet { + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + try { + + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + + HttpSession session = request.getSession(true); + String name = (String) session.getAttribute("uname"); + out.println("Hi " + name + " Your Session Id is : " + session.getId()); + + out.close(); + + } catch (Exception e) { + System.out.println(e); + } + } + +} diff --git a/spring-session/http-session-example/src/main/webapp/WEB-INF/web.xml b/spring-session/http-session-example/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..2c9a4c118b --- /dev/null +++ b/spring-session/http-session-example/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,33 @@ + + + + httpsession + + index.html + + + + + FirstServlet + com.baeldung.httpsession.FirstServlet + + + SecondServlet + com.baeldung.httpsession.SecondServlet + + + + + FirstServlet + /first + + + SecondServlet + /second + + + + \ No newline at end of file diff --git a/spring-session/http-session-example/src/main/webapp/index.html b/spring-session/http-session-example/src/main/webapp/index.html new file mode 100644 index 0000000000..0e5889f21a --- /dev/null +++ b/spring-session/http-session-example/src/main/webapp/index.html @@ -0,0 +1,12 @@ + + + + + + +
    + Name:

    +
    + + \ No newline at end of file From 9d5c0637a55b6b4a762de8a9d81b31e3a5715a05 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 16:46:09 +0800 Subject: [PATCH 0174/1862] Update README.MD --- core-java-modules/core-java-reflection/README.MD | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-reflection/README.MD b/core-java-modules/core-java-reflection/README.MD index d6b3a02e6a..5d8c54414b 100644 --- a/core-java-modules/core-java-reflection/README.MD +++ b/core-java-modules/core-java-reflection/README.MD @@ -8,5 +8,4 @@ - [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params) - [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) - [What Causes java.lang.reflect.InvocationTargetException?](https://www.baeldung.com/java-lang-reflect-invocationtargetexception) -- [How to Find all Getters Returning Null](http://www.baeldung.com/java-getters-returning-null) - [How to Get a Name of a Method Being Executed?](http://www.baeldung.com/java-name-of-executing-method) From 616b82c460e3dcc95a680d49d9b1bb11b0672971 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 16:52:50 +0800 Subject: [PATCH 0175/1862] Update README.md --- guava-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guava-2/README.md b/guava-2/README.md index 634c17f0eb..32afc10916 100644 --- a/guava-2/README.md +++ b/guava-2/README.md @@ -3,5 +3,5 @@ This module contains articles a Google Guava ### Relevant Articles: -- [Introduction to Guava Throwables](https://www.baeldung.com/guava-throwables) + - [Guava CharMatcher](https://www.baeldung.com/guava-string-charmatcher) From c60c6c7c53432315dc6906bd9136bac4dbe92ac5 Mon Sep 17 00:00:00 2001 From: mikr Date: Tue, 21 Jul 2020 11:21:22 +0200 Subject: [PATCH 0176/1862] JAVA-93 Remove Page class --- .../com/baeldung/thymeleaf/model/Page.java | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/model/Page.java diff --git a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/model/Page.java b/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/model/Page.java deleted file mode 100644 index e9dd0a8135..0000000000 --- a/spring-thymeleaf/src/main/java/com/baeldung/thymeleaf/model/Page.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.baeldung.thymeleaf.model; - -import java.util.Collections; -import java.util.List; - -public class Page { - - private List list; - - private int pageSize = 0; - - private int currentPage = 0; - - private int totalPages = 0; - - public Page(List list, int pageSize, int currentPage) { - - if (list.isEmpty()) { - this.list = list; - } - - if (pageSize <= 0 || pageSize > list.size() || currentPage <= 0) { - throw new IllegalArgumentException("invalid page size or current page!"); - } - - this.pageSize = pageSize; - - this.currentPage = currentPage; - - if (list.size() % pageSize == 0) { - this.totalPages = list.size() / pageSize; - } else { - this.totalPages = list.size() / pageSize + 1; - } - - int startItem = (currentPage - 1) * pageSize; - if (list.size() < startItem) { - this.list = Collections.emptyList(); - } - - int toIndex = Math.min(startItem + pageSize, list.size()); - this.list = list.subList(startItem, toIndex); - } - - public List getList() { - return list; - } - - public int getPageSize() { - return pageSize; - } - - public int getCurrentPage() { - return currentPage; - } - - public int getTotalPages() { - return totalPages; - } - -} From f6e68ce2fdb4c800cec73c1dfc38be2c9447503c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:14:39 +0800 Subject: [PATCH 0177/1862] Update README.md --- spring-security-modules/spring-security-sso/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-sso/README.md b/spring-security-modules/spring-security-sso/README.md index 23b53521be..a9fcd88085 100644 --- a/spring-security-modules/spring-security-sso/README.md +++ b/spring-security-modules/spring-security-sso/README.md @@ -3,5 +3,5 @@ This module contains modules about single-sign-on with Spring Security ### Relevant Articles: -- [Simple Single Sign-On with Spring Security OAuth2](https://www.baeldung.com/sso-spring-security-oauth2) + - [Spring Security Kerberos Integration](https://www.baeldung.com/spring-security-kerberos-integration) From aecf8d4a4b184a630f22822e02b7e03017b10905 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:43:56 +0800 Subject: [PATCH 0178/1862] Update README.md --- core-java-modules/core-java-11/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-11/README.md b/core-java-modules/core-java-11/README.md index 70e2e66737..a3601c8339 100644 --- a/core-java-modules/core-java-11/README.md +++ b/core-java-modules/core-java-11/README.md @@ -8,7 +8,7 @@ This module contains articles about Java 11 core features - [Java 11 Local Variable Syntax for Lambda Parameters](https://www.baeldung.com/java-var-lambda-params) - [Java 11 String API Additions](https://www.baeldung.com/java-11-string-api) - [Java 11 Nest Based Access Control](https://www.baeldung.com/java-nest-based-access-control) -- [Exploring the New HTTP Client in Java 9 and 11](https://www.baeldung.com/java-9-http-client) +- [Exploring the New HTTP Client in Java](https://www.baeldung.com/java-9-http-client) - [An Introduction to Epsilon GC: A No-Op Experimental Garbage Collector](https://www.baeldung.com/jvm-epsilon-gc-garbage-collector) - [Guide to jlink](https://www.baeldung.com/jlink) - [Negate a Predicate Method Reference with Java 11](https://www.baeldung.com/java-negate-predicate-method-reference) From f8370fbcb38a2a214a9a9311fe158f08eded2be6 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:47:30 +0800 Subject: [PATCH 0179/1862] Update README.md --- core-java-modules/core-java-arrays-guides/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index 56c0c716d8..c3815a6ff0 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -5,4 +5,4 @@ This module contains complete guides about arrays in Java ### Relevant Articles: - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) -- [What is [Ljava.lang.Object;?]](https://www.baeldung.com/java-tostring-array) +- [What is [Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) From 6124a914dbf088e9baf15799e1a24bfbbf8b167a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:47:53 +0800 Subject: [PATCH 0180/1862] Update README.md --- core-java-modules/core-java-arrays-guides/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index c3815a6ff0..f0caa65604 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -5,4 +5,4 @@ This module contains complete guides about arrays in Java ### Relevant Articles: - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) -- [What is [Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) +- [[What is [Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) From f43ceb02986005ad6edf0a900b1363ab5ac5de79 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:48:51 +0800 Subject: [PATCH 0181/1862] Update README.md --- core-java-modules/core-java-arrays-guides/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index f0caa65604..56c0c716d8 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -5,4 +5,4 @@ This module contains complete guides about arrays in Java ### Relevant Articles: - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) -- [[What is [Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) +- [What is [Ljava.lang.Object;?]](https://www.baeldung.com/java-tostring-array) From 55ca9ce17a15bfe1c38681688a8d48fe7f35026c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:49:25 +0800 Subject: [PATCH 0182/1862] Update README.md --- core-java-modules/core-java-arrays-guides/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index 56c0c716d8..c3815a6ff0 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -5,4 +5,4 @@ This module contains complete guides about arrays in Java ### Relevant Articles: - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) -- [What is [Ljava.lang.Object;?]](https://www.baeldung.com/java-tostring-array) +- [What is [Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) From 9dae4a681589846c450746d66f22f4aedecc5023 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 19:56:19 +0800 Subject: [PATCH 0183/1862] Update README.md --- core-java-modules/core-java-arrays-guides/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index c3815a6ff0..56c0c716d8 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -5,4 +5,4 @@ This module contains complete guides about arrays in Java ### Relevant Articles: - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) -- [What is [Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) +- [What is [Ljava.lang.Object;?]](https://www.baeldung.com/java-tostring-array) From 363fd41ef557ed4a668b06f5b2f1f48a99c11ff2 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 20:43:23 +0800 Subject: [PATCH 0184/1862] Update README.md --- guava/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guava/README.md b/guava/README.md index 720aba274d..24beca60c3 100644 --- a/guava/README.md +++ b/guava/README.md @@ -3,6 +3,7 @@ This module contains articles a Google Guava ### Relevant Articles: + - [Guava Functional Cookbook](https://www.baeldung.com/guava-functions-predicates) - [Guide to Guava’s PreConditions](https://www.baeldung.com/guava-preconditions) - [Introduction to Guava CacheLoader](https://www.baeldung.com/guava-cacheloader) @@ -13,3 +14,4 @@ This module contains articles a Google Guava - [Bloom Filter in Java using Guava](https://www.baeldung.com/guava-bloom-filter) - [Quick Guide to the Guava RateLimiter](https://www.baeldung.com/guava-rate-limiter) - [Guava Cache](https://www.baeldung.com/guava-cache) +- [Introduction to Guava Throwables](https://www.baeldung.com/guava-throwables) From a12969fb8bea1ab49ddaeb27a3a9b3ac2d176d05 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 20:53:15 +0800 Subject: [PATCH 0185/1862] Update README.md --- spring-rest-testing/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-rest-testing/README.md b/spring-rest-testing/README.md index 18bfeddc7c..2a77b5dded 100644 --- a/spring-rest-testing/README.md +++ b/spring-rest-testing/README.md @@ -9,8 +9,10 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring The "Learn Spring Security" Classes: http://github.learnspringsecurity.com ### Relevant Articles: + - [Integration Testing with the Maven Cargo plugin](https://www.baeldung.com/integration-testing-with-the-maven-cargo-plugin) - [Metrics for your Spring REST API](https://www.baeldung.com/spring-rest-api-metrics) +- [Testing Exceptions with Spring MockMvc](https://www.baeldung.com/spring-mvc-test-exceptions) ### Build the Project ``` From 49ef33191cbfe456ee776965dd639e313c8f0eb0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 20:55:26 +0800 Subject: [PATCH 0186/1862] Update README.md --- spring-boot-modules/spring-boot-libraries/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-libraries/README.md b/spring-boot-modules/spring-boot-libraries/README.md index 3f2d349664..8cd3db9c93 100644 --- a/spring-boot-modules/spring-boot-libraries/README.md +++ b/spring-boot-modules/spring-boot-libraries/README.md @@ -11,3 +11,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [A Guide to the Problem Spring Web Library](https://www.baeldung.com/problem-spring-web) - [Generating Barcodes and QR Codes in Java](https://www.baeldung.com/java-generating-barcodes-qr-codes) - [Rate Limiting a Spring API Using Bucket4j](https://www.baeldung.com/spring-bucket4j) +- [Spring Boot and Caffeine Cache](https://www.baeldung.com/spring-boot-caffeine-cache) From 6290718aeaf48867ba78e50a4e3dc67f6c9aa264 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 20:58:35 +0800 Subject: [PATCH 0187/1862] Update README.md --- core-java-modules/core-java-concurrency-advanced-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-concurrency-advanced-3/README.md b/core-java-modules/core-java-concurrency-advanced-3/README.md index 8858760981..7d98e462d7 100644 --- a/core-java-modules/core-java-concurrency-advanced-3/README.md +++ b/core-java-modules/core-java-concurrency-advanced-3/README.md @@ -15,4 +15,5 @@ This module contains articles about advanced topics about multithreading with co - [The ABA Problem in Concurrency](https://www.baeldung.com/cs/aba-concurrency) - [Introduction to Lock-Free Data Structures](https://www.baeldung.com/lock-free-programming) - [Introduction to Exchanger in Java](https://www.baeldung.com/java-exchanger) +- [Why Not To Start A Thread In The Constructor?](https://www.baeldung.com/java-thread-constructor) - [[<-- previous]](/core-java-modules/core-java-concurrency-advanced-2) From ed6a32cfbf850577000b2c68907db25f2514fdae Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:00:14 +0800 Subject: [PATCH 0188/1862] Update README.md --- spring-security-modules/spring-security-mvc-boot-2/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-security-modules/spring-security-mvc-boot-2/README.md b/spring-security-modules/spring-security-mvc-boot-2/README.md index 7c53d03698..bbbf514c90 100644 --- a/spring-security-modules/spring-security-mvc-boot-2/README.md +++ b/spring-security-modules/spring-security-mvc-boot-2/README.md @@ -6,9 +6,11 @@ This module contains articles about Spring Security with Spring MVC in Boot appl The "REST With Spring" Classes: http://github.learnspringsecurity.com ### Relevant Articles: + - [Multiple Entry Points in Spring Security](https://www.baeldung.com/spring-security-multiple-entry-points) - [Multiple Authentication Providers in Spring Security](https://www.baeldung.com/spring-security-multiple-auth-providers) - [Two Login Pages with Spring Security](https://www.baeldung.com/spring-security-two-login-pages) - [HTTPS using Self-Signed Certificate in Spring Boot](https://www.baeldung.com/spring-boot-https-self-signed-certificate) - [Spring Security: Exploring JDBC Authentication](https://www.baeldung.com/spring-security-jdbc-authentication) - [Spring Security Custom Logout Handler](https://www.baeldung.com/spring-security-custom-logout-handler) +- [Redirecting Logged-in Users with Spring Security](https://www.baeldung.com/spring-security-redirect-logged-in) From 4d08a0b64f3235a3ba116ae6d7f1e3185b703ca9 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:01:53 +0800 Subject: [PATCH 0189/1862] Update README.MD --- spring-boot-modules/spring-boot-actuator/README.MD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-modules/spring-boot-actuator/README.MD b/spring-boot-modules/spring-boot-actuator/README.MD index c41d52c186..fbb4dfba0f 100644 --- a/spring-boot-modules/spring-boot-actuator/README.MD +++ b/spring-boot-modules/spring-boot-actuator/README.MD @@ -6,3 +6,5 @@ This module contains articles about Spring Boot Actuator The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: + +- [Liveness and Readiness Probes in Spring Boot](https://www.baeldung.com/spring-liveness-readiness-probes) From 6101e18ee9ba2332e6e3378faafbbddea622390b Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:04:41 +0800 Subject: [PATCH 0190/1862] Update README.md --- core-java-modules/core-java-exceptions-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-exceptions-2/README.md b/core-java-modules/core-java-exceptions-2/README.md index 46ffd490be..7c5db06a55 100644 --- a/core-java-modules/core-java-exceptions-2/README.md +++ b/core-java-modules/core-java-exceptions-2/README.md @@ -12,3 +12,4 @@ This module contains articles about core java exceptions - [Java – Try with Resources](https://www.baeldung.com/java-try-with-resources) - [Java Global Exception Handler](https://www.baeldung.com/java-global-exception-handler) - [How to Find an Exception’s Root Cause in Java](https://www.baeldung.com/java-exception-root-cause) +- [Java IOException “Too many open files”](https://www.baeldung.com/java-too-many-open-files) From 38250a3c4fd274d6e87cd0925481f3036a0afe85 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:07:30 +0800 Subject: [PATCH 0191/1862] Update README.md --- core-java-modules/core-java-9-new-features/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-9-new-features/README.md b/core-java-modules/core-java-9-new-features/README.md index c2ef63a530..d10d0aad2d 100644 --- a/core-java-modules/core-java-9-new-features/README.md +++ b/core-java-modules/core-java-9-new-features/README.md @@ -13,3 +13,4 @@ This module contains articles about core Java features that have been introduced - [Java 9 Platform Logging API](https://www.baeldung.com/java-9-logging-api) - [Java 9 Reactive Streams](https://www.baeldung.com/java-9-reactive-streams) - [Multi-Release JAR Files with Maven](https://www.baeldung.com/maven-multi-release-jars) +- [The Difference between RxJava API and the Java 9 Flow API](https://www.baeldung.com/rxjava-vs-java-flow-api) From 88ae1fd308115c2e7fdb5be6d7b078ebb3145658 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:09:35 +0800 Subject: [PATCH 0192/1862] Update README.md --- persistence-modules/spring-persistence-simple-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-persistence-simple-2/README.md b/persistence-modules/spring-persistence-simple-2/README.md index 477c938f89..d80c7efc57 100644 --- a/persistence-modules/spring-persistence-simple-2/README.md +++ b/persistence-modules/spring-persistence-simple-2/README.md @@ -3,3 +3,4 @@ - [Spring JdbcTemplate Unit Testing](https://www.baeldung.com/spring-jdbctemplate-testing) - [Using a List of Values in a JdbcTemplate IN Clause](https://www.baeldung.com/spring-jdbctemplate-in-list) - [Transactional Annotations: Spring vs. JTA](https://www.baeldung.com/spring-vs-jta-transactional) +- [Test a Mock JNDI Datasource with Spring](https://www.baeldung.com/spring-mock-jndi-datasource) From 802c896ad8cbbdc9dcb7786c07fcc6858d9753bc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:12:22 +0800 Subject: [PATCH 0193/1862] Update README.md --- core-java-modules/core-java-date-operations-2/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-date-operations-2/README.md b/core-java-modules/core-java-date-operations-2/README.md index 6dc1302d99..557e4c3517 100644 --- a/core-java-modules/core-java-date-operations-2/README.md +++ b/core-java-modules/core-java-date-operations-2/README.md @@ -2,6 +2,7 @@ This module contains articles about date operations in Java. ### Relevant Articles: + - [Get the Current Date Prior to Java 8](https://www.baeldung.com/java-get-the-current-date-legacy) - [Skipping Weekends While Adding Days to LocalDate in Java 8](https://www.baeldung.com/java-localdate-add-days-skip-weekends) - [Checking If Two Java Dates Are on the Same Day](https://www.baeldung.com/java-check-two-dates-on-same-day) @@ -9,4 +10,5 @@ This module contains articles about date operations in Java. - [How to Set the JVM Time Zone](https://www.baeldung.com/java-jvm-time-zone) - [How to determine day of week by passing specific date in Java?](https://www.baeldung.com/java-get-day-of-week) - [Finding Leap Years in Java](https://www.baeldung.com/java-leap-year) +- [Getting the Week Number From Any Date](https://www.baeldung.com/java-get-week-number) - [[<-- Prev]](/core-java-modules/core-java-date-operations-1) From 3c55a739476f9441f7f07eb583290454d5bb028c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:14:45 +0800 Subject: [PATCH 0194/1862] Update README.md --- spring-di-2/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-di-2/README.md b/spring-di-2/README.md index 15249efa7c..f41976c3f0 100644 --- a/spring-di-2/README.md +++ b/spring-di-2/README.md @@ -8,4 +8,5 @@ This module contains articles about dependency injection with Spring - [Injecting a Value in a Static Field in Spring](https://www.baeldung.com/spring-inject-static-field) - [Spring – Injecting Collections](https://www.baeldung.com/spring-injecting-collections) - [Wiring in Spring: @Autowired, @Resource and @Inject](https://www.baeldung.com/spring-annotations-resource-inject-autowire) -- More articles: [[<-- prev]](/spring-di) \ No newline at end of file +- [Injecting Spring Beans into Unmanaged Objects](https://www.baeldung.com/spring-inject-bean-into-unmanaged-objects) +- More articles: [[<-- prev]](/spring-di) From 18b08a36d9250a6dbe7af99f01b3956c030d377a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:20:08 +0800 Subject: [PATCH 0195/1862] Update README.md --- core-java-modules/core-java-regex/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-regex/README.md b/core-java-modules/core-java-regex/README.md index 8830af2c2d..ad8ba1e4ae 100644 --- a/core-java-modules/core-java-regex/README.md +++ b/core-java-modules/core-java-regex/README.md @@ -3,6 +3,7 @@ ## Core Java 8 Cookbooks and Examples ### Relevant Articles: + - [An Overview of Regular Expressions Performance in Java](https://www.baeldung.com/java-regex-performance) - [A Guide To Java Regular Expressions API](http://www.baeldung.com/regular-expressions-java) - [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char) @@ -11,3 +12,4 @@ - [How to Use Regular Expressions to Replace Tokens in Strings](https://www.baeldung.com/java-regex-token-replacement) - [Regular Expressions \s and \s+ in Java](https://www.baeldung.com/java-regex-s-splus) - [Validate Phone Numbers With Java Regex](https://www.baeldung.com/java-regex-validate-phone-numbers) +- [How to Count the Number of Matches for a Regex?](https://www.baeldung.com/java-count-regex-matches) From 103ccd44953c45f057c8a00a83da9a31f9985b57 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:22:07 +0800 Subject: [PATCH 0196/1862] Update README.md --- java-numbers-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-numbers-3/README.md b/java-numbers-3/README.md index f818bdb675..9c82f7c1bc 100644 --- a/java-numbers-3/README.md +++ b/java-numbers-3/README.md @@ -11,4 +11,5 @@ This module contains articles about numbers in Java. - [Listing Numbers Within a Range in Java](https://www.baeldung.com/java-listing-numbers-within-a-range) - [Fibonacci Series in Java](https://www.baeldung.com/java-fibonacci) - [Guide to the Number Class in Java](https://www.baeldung.com/java-number-class) +- [Print an Integer in Binary Format in Java](https://www.baeldung.com/java-print-integer-binary) - More articles: [[<-- prev]](/java-numbers-2) From bae29025994edc1f2a293ccd227f2be832245b33 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:23:41 +0800 Subject: [PATCH 0197/1862] Update README.md --- mapstruct/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/mapstruct/README.md b/mapstruct/README.md index 9887a7f43d..384bcbaa14 100644 --- a/mapstruct/README.md +++ b/mapstruct/README.md @@ -8,3 +8,4 @@ This module contains articles about MapStruct. - [Custom Mapper with MapStruct](https://www.baeldung.com/mapstruct-custom-mapper) - [Using Multiple Source Objects with MapStruct](https://www.baeldung.com/mapstruct-multiple-source-objects) - [Ignoring Unmapped Properties with MapStruct](https://www.baeldung.com/mapstruct-ignore-unmapped-properties) +- [Mapping Collections with MapStruct](https://www.baeldung.com/java-mapstruct-mapping-collections) From a754d77ec396f0ce01add44ba9ce029ec44ab880 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:26:52 +0800 Subject: [PATCH 0198/1862] Update README.md --- spring-aop/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-aop/README.md b/spring-aop/README.md index 4522cd63c1..91cccbd114 100644 --- a/spring-aop/README.md +++ b/spring-aop/README.md @@ -3,9 +3,11 @@ This module contains articles about Spring aspect oriented programming (AOP) ### Relevant articles + - [Implementing a Custom Spring AOP Annotation](https://www.baeldung.com/spring-aop-annotation) - [Intro to AspectJ](https://www.baeldung.com/aspectj) - [Spring Performance Logging](https://www.baeldung.com/spring-performance-logging) - [Introduction to Spring AOP](https://www.baeldung.com/spring-aop) - [Introduction to Pointcut Expressions in Spring](https://www.baeldung.com/spring-aop-pointcut-tutorial) -- [Introduction to Advice Types in Spring](https://www.baeldung.com/spring-aop-advice-tutorial) \ No newline at end of file +- [Introduction to Advice Types in Spring](https://www.baeldung.com/spring-aop-advice-tutorial) +- [When Does Java Throw UndeclaredThrowableException?](https://www.baeldung.com/java-undeclaredthrowableexception) From b8e72c86d89c55360d7ef433502f444245669d04 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:30:11 +0800 Subject: [PATCH 0199/1862] Update README.md --- spring-security-modules/spring-security-sso/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-modules/spring-security-sso/README.md b/spring-security-modules/spring-security-sso/README.md index a9fcd88085..4ff5f57a2d 100644 --- a/spring-security-modules/spring-security-sso/README.md +++ b/spring-security-modules/spring-security-sso/README.md @@ -5,3 +5,4 @@ This module contains modules about single-sign-on with Spring Security ### Relevant Articles: - [Spring Security Kerberos Integration](https://www.baeldung.com/spring-security-kerberos-integration) +- [Simple Single Sign-On with Spring Security OAuth2 (legacy stack)](https://www.baeldung.com/sso-spring-security-oauth2-legacy) From 6f5d916af7aefdb27444c9f87c4f2e47e4f6c063 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:31:47 +0800 Subject: [PATCH 0200/1862] Update README.md --- core-java-modules/core-java-jvm-2/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-modules/core-java-jvm-2/README.md b/core-java-modules/core-java-jvm-2/README.md index 1aa69e7e63..7a189ceec5 100644 --- a/core-java-modules/core-java-jvm-2/README.md +++ b/core-java-modules/core-java-jvm-2/README.md @@ -8,4 +8,5 @@ This module contains articles about working with the Java Virtual Machine (JVM). - [Measuring Object Sizes in the JVM](https://www.baeldung.com/jvm-measuring-object-sizes) - [Adding Shutdown Hooks for JVM Applications](https://www.baeldung.com/jvm-shutdown-hooks) - [boolean and boolean[] Memory Layout in the JVM](https://www.baeldung.com/jvm-boolean-memory-layout) -- More articles: [[<-- prev]](/core-java-modules/core-java-jvm) \ No newline at end of file +- [Where Is the Array Length Stored in JVM?](https://www.baeldung.com/java-jvm-array-length) +- More articles: [[<-- prev]](/core-java-modules/core-java-jvm) From 1e2440d85e2a051a20a30f7d9cad43772e426338 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:33:35 +0800 Subject: [PATCH 0201/1862] Update README.md --- spring-boot-modules/spring-boot-properties-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-properties-2/README.md b/spring-boot-modules/spring-boot-properties-2/README.md index 182115f8c4..4e03a4125c 100644 --- a/spring-boot-modules/spring-boot-properties-2/README.md +++ b/spring-boot-modules/spring-boot-properties-2/README.md @@ -9,4 +9,5 @@ This module contains articles about Properties in Spring Boot. - [How to Inject a Property Value Into a Class Not Managed by Spring?](https://www.baeldung.com/inject-properties-value-non-spring-class) - [@PropertySource with YAML Files in Spring Boot](https://www.baeldung.com/spring-yaml-propertysource) - [Inject Arrays and Lists From Spring Properties Files](https://www.baeldung.com/spring-inject-arrays-lists) +- [Inject a Map from a YAML File with Spring](https://www.baeldung.com/spring-yaml-inject-map) - More articles: [[<-- prev]](../spring-boot-properties) From 74af675f9d99b57ddb9c0ec3f08e9fd09016b7d4 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:35:34 +0800 Subject: [PATCH 0202/1862] Update README.md --- core-java-modules/core-java-networking-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-networking-2/README.md b/core-java-modules/core-java-networking-2/README.md index 662d97252e..dbda8bdc7c 100644 --- a/core-java-modules/core-java-networking-2/README.md +++ b/core-java-modules/core-java-networking-2/README.md @@ -12,4 +12,5 @@ This module contains articles about networking in Java - [Authentication with HttpUrlConnection](https://www.baeldung.com/java-http-url-connection) - [Download a File from an URL in Java](https://www.baeldung.com/java-download-file) - [Handling java.net.ConnectException](https://www.baeldung.com/java-net-connectexception) +- [Getting MAC addresses in Java](https://www.baeldung.com/java-mac-address) - [[<-- Prev]](/core-java-modules/core-java-networking) From 3825fff8683579cf3882a0f72c2528f4190e9c65 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:37:01 +0800 Subject: [PATCH 0203/1862] Update README.md --- gradle-5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle-5/README.md b/gradle-5/README.md index 7c9aeff07e..e37c100534 100644 --- a/gradle-5/README.md +++ b/gradle-5/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Run a Java main Method Using Gradle](https://www.baeldung.com/gradle-run-java-main) +- [Finding Unused Gradle Dependencies](https://www.baeldung.com/gradle-finding-unused-dependencies) From dac0a95ff65a626d390f63886e3431e4cf63896c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:38:50 +0800 Subject: [PATCH 0204/1862] Update README.md --- spring-cloud/spring-cloud-bootstrap/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-cloud/spring-cloud-bootstrap/README.md b/spring-cloud/spring-cloud-bootstrap/README.md index 223c21b762..6923e951ff 100644 --- a/spring-cloud/spring-cloud-bootstrap/README.md +++ b/spring-cloud/spring-cloud-bootstrap/README.md @@ -3,11 +3,13 @@ This module contains articles about bootstrapping Spring Cloud applications ### Relevant Articles: + - [Spring Cloud – Bootstrapping](http://www.baeldung.com/spring-cloud-bootstrapping) - [Spring Cloud – Securing Services](http://www.baeldung.com/spring-cloud-securing-services) - [Spring Cloud – Tracing Services with Zipkin](http://www.baeldung.com/tracing-services-with-zipkin) - [Spring Cloud Series – The Gateway Pattern](http://www.baeldung.com/spring-cloud-gateway-pattern) - [Spring Cloud – Adding Angular 4](http://www.baeldung.com/spring-cloud-angular) +- [How to Share DTO Across Microservices](https://www.baeldung.com/java-microservices-share-dto) ### Running the Project From 5ed024e901f062d48be442d5bad7e912a7ea95f8 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:41:25 +0800 Subject: [PATCH 0205/1862] Update README.md --- spring-mvc-java-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-mvc-java-2/README.md b/spring-mvc-java-2/README.md index 525f5a276f..a5aa88aa69 100644 --- a/spring-mvc-java-2/README.md +++ b/spring-mvc-java-2/README.md @@ -5,3 +5,4 @@ - [Spring MVC @PathVariable with a dot (.) gets truncated](https://www.baeldung.com/spring-mvc-pathvariable-dot) - [A Quick Guide to Spring MVC Matrix Variables](https://www.baeldung.com/spring-mvc-matrix-variables) - [Converting a Spring MultipartFile to a File](https://www.baeldung.com/converting-spring-multipartfile-to-a-file) +- [Testing a Spring Multipart POST Request](https://www.baeldung.com/spring-multipart-post-request-test) From dd7ea46e67834b21de54447f0ee3048238bc3b03 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:42:55 +0800 Subject: [PATCH 0206/1862] Update README.md --- core-java-modules/core-java-lang-oop-methods/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-lang-oop-methods/README.md b/core-java-modules/core-java-lang-oop-methods/README.md index fa474c9795..afceaded9a 100644 --- a/core-java-modules/core-java-lang-oop-methods/README.md +++ b/core-java-modules/core-java-lang-oop-methods/README.md @@ -3,7 +3,9 @@ This module contains articles about methods in Java ### Relevant Articles: + - [Methods in Java](https://www.baeldung.com/java-methods) - [Method Overloading and Overriding in Java](https://www.baeldung.com/java-method-overload-override) - [Java equals() and hashCode() Contracts](https://www.baeldung.com/java-equals-hashcode-contracts) - [Guide to hashCode() in Java](https://www.baeldung.com/java-hashcode) +- [The Covariant Return Type in Java](https://www.baeldung.com/java-covariant-return-type) From ca7d18619b3917ab65521f2c4681209f17d30265 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:44:57 +0800 Subject: [PATCH 0207/1862] Update README.md --- data-structures/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/data-structures/README.md b/data-structures/README.md index e3436695ce..0a29bd8964 100644 --- a/data-structures/README.md +++ b/data-structures/README.md @@ -11,3 +11,4 @@ This module contains articles about data structures in Java - [Introduction to Big Queue](https://www.baeldung.com/java-big-queue) - [Guide to AVL Trees in Java](https://www.baeldung.com/java-avl-trees) - [Graphs in Java](https://www.baeldung.com/java-graphs) +- [Implementing a Ring Buffer in Java](https://www.baeldung.com/java-ring-buffer) From 123c023b7b02f74d4b91f00b7e06835fbb372bd5 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:46:34 +0800 Subject: [PATCH 0208/1862] Create README.md --- persistence-modules/apache-bookkeeper/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 persistence-modules/apache-bookkeeper/README.md diff --git a/persistence-modules/apache-bookkeeper/README.md b/persistence-modules/apache-bookkeeper/README.md new file mode 100644 index 0000000000..aaaade6450 --- /dev/null +++ b/persistence-modules/apache-bookkeeper/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Guide to Apache BookKeeper](https://www.baeldung.com/java-apache-bookkeeper) From ff9954f92bbd6975c0c20d09528fea3e7a21df85 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:47:50 +0800 Subject: [PATCH 0209/1862] Update README.md --- core-java-modules/core-java-9/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-9/README.md b/core-java-modules/core-java-9/README.md index 0a9bf76ac4..cab02369cc 100644 --- a/core-java-modules/core-java-9/README.md +++ b/core-java-modules/core-java-9/README.md @@ -9,3 +9,4 @@ This module contains articles about Java 9 core features - [Iterate Through a Range of Dates in Java](https://www.baeldung.com/java-iterate-date-range) - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) - [Immutable ArrayList in Java](https://www.baeldung.com/java-immutable-list) +- [Easy Ways to Write a Java InputStream to an OutputStream](https://www.baeldung.com/java-inputstream-to-outputstream) From 1b6e5c641c3f75a5a993ab4749991d36b2c6a266 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:49:20 +0800 Subject: [PATCH 0210/1862] Update README.md --- java-numbers-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-numbers-3/README.md b/java-numbers-3/README.md index 9c82f7c1bc..9c323a6c6a 100644 --- a/java-numbers-3/README.md +++ b/java-numbers-3/README.md @@ -12,4 +12,5 @@ This module contains articles about numbers in Java. - [Fibonacci Series in Java](https://www.baeldung.com/java-fibonacci) - [Guide to the Number Class in Java](https://www.baeldung.com/java-number-class) - [Print an Integer in Binary Format in Java](https://www.baeldung.com/java-print-integer-binary) +- [Number Formatting in Java](https://www.baeldung.com/java-number-formatting) - More articles: [[<-- prev]](/java-numbers-2) From 2e48a758e419fa93139dc75a36b1c7c97026a7d1 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:51:02 +0800 Subject: [PATCH 0211/1862] Update README.md --- spring-mvc-java-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-java-2/README.md b/spring-mvc-java-2/README.md index a5aa88aa69..42fa056b99 100644 --- a/spring-mvc-java-2/README.md +++ b/spring-mvc-java-2/README.md @@ -4,5 +4,5 @@ - [Working with Date Parameters in Spring](https://www.baeldung.com/spring-date-parameters) - [Spring MVC @PathVariable with a dot (.) gets truncated](https://www.baeldung.com/spring-mvc-pathvariable-dot) - [A Quick Guide to Spring MVC Matrix Variables](https://www.baeldung.com/spring-mvc-matrix-variables) -- [Converting a Spring MultipartFile to a File](https://www.baeldung.com/converting-spring-multipartfile-to-a-file) +- [Converting a Spring MultipartFile to a File](https://www.baeldung.com/spring-multipartfile-to-file) - [Testing a Spring Multipart POST Request](https://www.baeldung.com/spring-multipart-post-request-test) From 3f0652ffba0c97ad670cb5c084ea32b61ff4f6ed Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:52:46 +0800 Subject: [PATCH 0212/1862] Update README.md --- core-groovy/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-groovy/README.md b/core-groovy/README.md index f852b3ccf2..70e8d262ce 100644 --- a/core-groovy/README.md +++ b/core-groovy/README.md @@ -13,4 +13,5 @@ This module contains articles about core Groovy concepts - [Converting a String to a Date in Groovy](https://www.baeldung.com/groovy-string-to-date) - [Guide to I/O in Groovy](https://www.baeldung.com/groovy-io) - [Convert String to Integer in Groovy](https://www.baeldung.com/groovy-convert-string-to-integer) +- [Groovy Variable Scope](https://www.baeldung.com/groovy/variable-scope) - [[More -->]](/core-groovy-2) From 709a18ecfee5b4ea852145afb1e1f0720f48017e Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:54:23 +0800 Subject: [PATCH 0213/1862] Update README.md --- algorithms-miscellaneous-6/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-6/README.md b/algorithms-miscellaneous-6/README.md index 22ee51530f..6e435e3741 100644 --- a/algorithms-miscellaneous-6/README.md +++ b/algorithms-miscellaneous-6/README.md @@ -7,4 +7,5 @@ - [Efficiently Merge Sorted Java Sequences](https://www.baeldung.com/java-merge-sorted-sequences) - [Introduction to Greedy Algorithms with Java](https://www.baeldung.com/java-greedy-algorithms) - [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher) +- [Implementing a 2048 Solver in Java](https://www.baeldung.com/2048-java-solver) - More articles: [[<-- prev]](/../algorithms-miscellaneous-5) From 095291998d859b5a9f9bb1c7e02aca447136c806 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:55:39 +0800 Subject: [PATCH 0214/1862] Update README.md --- spring-thymeleaf-3/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-thymeleaf-3/README.md b/spring-thymeleaf-3/README.md index 66e64e7094..34bd1b4b35 100644 --- a/spring-thymeleaf-3/README.md +++ b/spring-thymeleaf-3/README.md @@ -3,6 +3,8 @@ This module contains articles about Spring with Thymeleaf ## Relevant Articles: + - [Add CSS and JS to Thymeleaf](https://www.baeldung.com/spring-thymeleaf-css-js) - [Formatting Currencies in Spring Using Thymeleaf](https://www.baeldung.com/spring-thymeleaf-currencies) - [Working with Select and Option in Thymeleaf](https://www.baeldung.com/thymeleaf-select-option) +- [Conditional CSS Classes in Thymeleaf](https://www.baeldung.com/spring-mvc-thymeleaf-conditional-css-classes) From a1a10ad0083dd796f13a9bc9c1c1a021af012bbf Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 21:57:20 +0800 Subject: [PATCH 0215/1862] Update README.md --- linux-bash/text/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-bash/text/README.md b/linux-bash/text/README.md index 20df2a33ec..1c27abc8c6 100644 --- a/linux-bash/text/README.md +++ b/linux-bash/text/README.md @@ -1,4 +1,4 @@ ### Relevant Articles: -- [Linux Commands – Remove All Text After X](https://www.baeldung.com/linux/tr-manipulate-strings) +- [Linux Commands – Remove All Text After X](https://www.baeldung.com/linux/remove-text-after-x-in-file) - [Linux Commands for Appending Multiple Lines to a File](https://www.baeldung.com/linux/appending-multiple-lines-to-file2) From 3abe375ad2d000b568a0b81a5c9bd7d2a41b4db4 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 22:15:03 +0800 Subject: [PATCH 0216/1862] Update README.md --- maven-modules/maven-exec-plugin/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/maven-modules/maven-exec-plugin/README.md b/maven-modules/maven-exec-plugin/README.md index 411639aae1..60035b27c4 100644 --- a/maven-modules/maven-exec-plugin/README.md +++ b/maven-modules/maven-exec-plugin/README.md @@ -3,3 +3,5 @@ This module contains articles about the Maven Exec Plugin. ### Relevant Articles + +- [Run a Java Main Method in Maven](https://www.baeldung.com/maven-java-main-method) From 119c8f323fa11597299284820c52ddf404ba060c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 22:16:18 +0800 Subject: [PATCH 0217/1862] Create README.md --- core-java-modules/core-java-string-operations-3/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java-string-operations-3/README.md diff --git a/core-java-modules/core-java-string-operations-3/README.md b/core-java-modules/core-java-string-operations-3/README.md new file mode 100644 index 0000000000..4e46849c11 --- /dev/null +++ b/core-java-modules/core-java-string-operations-3/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Version Comparison in Java](https://www.baeldung.com/java-comparing-versions) From 77a82e3cccf12c3bf54be8324a3246d12578665a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 22:19:17 +0800 Subject: [PATCH 0218/1862] Update README.md --- core-java-modules/core-java-lang-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-3/README.md b/core-java-modules/core-java-lang-3/README.md index f496b74bfb..d735937a02 100644 --- a/core-java-modules/core-java-lang-3/README.md +++ b/core-java-modules/core-java-lang-3/README.md @@ -2,4 +2,5 @@ This module contains articles about core features in the Java language +- [Class.isInstance vs Class.isAssignableFrom](https://www.baeldung.com/java-isinstance-isassignablefrom) - [[<-- Prev]](/core-java-modules/core-java-lang-2) From 5d0249634011ead16bd668e9c698c7d27bc200fe Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 22:21:37 +0800 Subject: [PATCH 0219/1862] Create README.md --- core-java-modules/core-java-reflection-2/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java-reflection-2/README.md diff --git a/core-java-modules/core-java-reflection-2/README.md b/core-java-modules/core-java-reflection-2/README.md new file mode 100644 index 0000000000..342fbd73bd --- /dev/null +++ b/core-java-modules/core-java-reflection-2/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Reading the Value of ‘private’ Fields from a Different Class in Java](https://www.baeldung.com/java-reflection-read-private-field-value) From f79593c2667c45627d99aa12aecb1d87c1e18437 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 21 Jul 2020 22:25:59 +0800 Subject: [PATCH 0220/1862] Create README.md --- maven-modules/maven-plugins/maven-enforcer/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 maven-modules/maven-plugins/maven-enforcer/README.md diff --git a/maven-modules/maven-plugins/maven-enforcer/README.md b/maven-modules/maven-plugins/maven-enforcer/README.md new file mode 100644 index 0000000000..44d43050e7 --- /dev/null +++ b/maven-modules/maven-plugins/maven-enforcer/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Maven Enforcer Plugin](https://www.baeldung.com/maven-enforcer-plugin) From fa8bf5168601750a0bf85a7e9d46399f7d98d346 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Tue, 21 Jul 2020 20:23:44 +0530 Subject: [PATCH 0221/1862] BAEL-4403 --- .../com/baeldung/consoleout/ConsoleAndOut.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java diff --git a/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java new file mode 100644 index 0000000000..99f185d539 --- /dev/null +++ b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java @@ -0,0 +1,15 @@ +package com.baeldung.consoleout; + +import java.io.Console; + +public class ConsoleAndOut { + public static void main(String[] args) { + Console console = System.console(); + System.out.println(console); + + if (console != null) { + char[] password = console.readPassword("Enter password:"); + console.printf(String.valueOf(password)); + } + } +} From de2ad1bc40cd3546f35d1271a9029a30595e38e9 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Tue, 21 Jul 2020 19:24:20 +0430 Subject: [PATCH 0222/1862] How to get the current index in for each Kotlin (#9710) --- .../com/baeldung/index/IndexedIteration.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/index/IndexedIteration.kt diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/index/IndexedIteration.kt b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/index/IndexedIteration.kt new file mode 100644 index 0000000000..07fb595ede --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/index/IndexedIteration.kt @@ -0,0 +1,33 @@ +package com.baeldung.index + +fun main() { + + // Index only + val colors = listOf("Red", "Green", "Blue") + for (i in colors.indices) { + println(colors[i]) + } + + val colorArray = arrayOf("Red", "Green", "Blue") + for (i in colorArray.indices) { + println(colorArray[i]) + } + + (0 until colors.size).forEach { println(colors[it]) } + for (i in 0 until colors.size) { + println(colors[i]) + } + + // Index and Value + colors.forEachIndexed { i, v -> println("The value for index $i is $v") } + for (indexedValue in colors.withIndex()) { + println("The value for index ${indexedValue.index} is ${indexedValue.value}") + } + + for ((i, v) in colors.withIndex()) { + println("The value for index $i is $v") + } + + colors.filterIndexed { i, _ -> i % 2 == 0 } + colors.filterIndexed { _, v -> v == "RED" } +} From f673723619daeb0c4184d7b6a6af991c0e819525 Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Tue, 21 Jul 2020 17:08:30 +0200 Subject: [PATCH 0223/1862] [BAEL-4288] address comments after review --- persistence-modules/flyway-repair/README.MD | 1 - 1 file changed, 1 deletion(-) diff --git a/persistence-modules/flyway-repair/README.MD b/persistence-modules/flyway-repair/README.MD index ca029e8299..7d843af9ea 100644 --- a/persistence-modules/flyway-repair/README.MD +++ b/persistence-modules/flyway-repair/README.MD @@ -1,2 +1 @@ ### Relevant Articles: -- [Flyway Repair With Spring Boot](http://www.baeldung.com/flyway-repair-with-spring-boot) From 8c8d2f302940ec607f20db9ea4a1e625d4a455b1 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Tue, 21 Jul 2020 21:10:32 +0530 Subject: [PATCH 0224/1862] Revert "Hexagonal architecture in Java" This reverts commit 4b669dc6880a9cfb9dce1712ecf6d9637ac73259. --- hexagonal-architecture-java/README.md | 3 -- hexagonal-architecture-java/pom.xml | 19 ------------ .../java/com/baeldung/hexagonal/Main.java | 21 -------------- .../hexagonal/adapters/FileWriterAdapter.java | 21 -------------- .../adapters/InMemorySportsDataAdapter.java | 27 ----------------- .../adapters/UserRequestAdapter.java | 21 -------------- .../baeldung/hexagonal/core/SportsApp.java | 21 -------------- .../hexagonal/model/SportRevenue.java | 29 ------------------- .../hexagonal/ports/FetchSportsRevenue.java | 7 ----- .../baeldung/hexagonal/ports/UserRequest.java | 5 ---- .../hexagonal/ports/WriteSportsRevenue.java | 7 ----- pom.xml | 1 - 12 files changed, 182 deletions(-) delete mode 100644 hexagonal-architecture-java/README.md delete mode 100644 hexagonal-architecture-java/pom.xml delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/Main.java delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/FileWriterAdapter.java delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/InMemorySportsDataAdapter.java delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/UserRequestAdapter.java delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/core/SportsApp.java delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/model/SportRevenue.java delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/FetchSportsRevenue.java delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/UserRequest.java delete mode 100644 hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/WriteSportsRevenue.java diff --git a/hexagonal-architecture-java/README.md b/hexagonal-architecture-java/README.md deleted file mode 100644 index 35fe97a6ef..0000000000 --- a/hexagonal-architecture-java/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Hexagonal Architecture - -This module contains article about Hexagonal Architecture \ No newline at end of file diff --git a/hexagonal-architecture-java/pom.xml b/hexagonal-architecture-java/pom.xml deleted file mode 100644 index 24a198279d..0000000000 --- a/hexagonal-architecture-java/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - 4.0.0 - hcom.baeldung - hexagonal-architecture-java - 0.0.1-SNAPSHOT - - src - - - maven-compiler-plugin - 3.8.0 - - 1.8 - 1.8 - - - - - \ No newline at end of file diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/Main.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/Main.java deleted file mode 100644 index 9feb12e37c..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/Main.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.hexagonal; - -import com.baeldung.hexagonal.adapters.FileWriterAdapter; -import com.baeldung.hexagonal.adapters.InMemorySportsDataAdapter; -import com.baeldung.hexagonal.adapters.UserRequestAdapter; -import com.baeldung.hexagonal.ports.FetchSportsRevenue; -import com.baeldung.hexagonal.ports.UserRequest; -import com.baeldung.hexagonal.ports.WriteSportsRevenue; - -public class Main { - - public static void main(String[] args) { - FetchSportsRevenue sportsRevenue = new InMemorySportsDataAdapter(); - WriteSportsRevenue writeSportsRevenue = new FileWriterAdapter(); - UserRequest userReq = new UserRequestAdapter(sportsRevenue, writeSportsRevenue); - - userReq.processRequest("Football"); - userReq.processRequest("Cricket"); - } - -} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/FileWriterAdapter.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/FileWriterAdapter.java deleted file mode 100644 index 879cf18bc2..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/FileWriterAdapter.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.hexagonal.adapters; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - -import com.baeldung.hexagonal.model.SportRevenue; -import com.baeldung.hexagonal.ports.WriteSportsRevenue; - -public class FileWriterAdapter implements WriteSportsRevenue { - - @Override - public void writeSportsReveue(SportRevenue sportRevenue) { - try (FileWriter fw = new FileWriter(new File("revenue.txt"),true)) { - fw.write(sportRevenue.toString()); - fw.write(System.lineSeparator()); - } catch (IOException e) { - - } - } -} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/InMemorySportsDataAdapter.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/InMemorySportsDataAdapter.java deleted file mode 100644 index 1d0c8c4611..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/InMemorySportsDataAdapter.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.hexagonal.adapters; - -import java.util.Arrays; -import java.util.List; - -import com.baeldung.hexagonal.model.SportRevenue; -import com.baeldung.hexagonal.ports.FetchSportsRevenue; - -public class InMemorySportsDataAdapter implements FetchSportsRevenue { - - List data; - - public InMemorySportsDataAdapter() { - data = Arrays.asList( - new SportRevenue("Football",2200000), - new SportRevenue("Cricket", 1700000), - new SportRevenue("Baseball",1567000)); - } - - @Override - public SportRevenue retrieveSportRevenue(String sportName) { - return data.stream() - .filter(category -> sportName.equals(category.getName())) - .findAny().orElse(null); - } - -} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/UserRequestAdapter.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/UserRequestAdapter.java deleted file mode 100644 index 0158b52576..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/adapters/UserRequestAdapter.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.hexagonal.adapters; - -import com.baeldung.hexagonal.core.SportsApp; -import com.baeldung.hexagonal.ports.FetchSportsRevenue; -import com.baeldung.hexagonal.ports.UserRequest; -import com.baeldung.hexagonal.ports.WriteSportsRevenue; - -public class UserRequestAdapter implements UserRequest { - - private SportsApp sportsApp; - - public UserRequestAdapter(FetchSportsRevenue sportsRevenue, WriteSportsRevenue writeSportsRevenue) { - sportsApp = new SportsApp(sportsRevenue, writeSportsRevenue); - } - - @Override - public void processRequest(String sportName) { - sportsApp.fetchAndWrite(sportName); - } - -} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/core/SportsApp.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/core/SportsApp.java deleted file mode 100644 index fc7591aee9..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/core/SportsApp.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.hexagonal.core; - -import com.baeldung.hexagonal.model.SportRevenue; -import com.baeldung.hexagonal.ports.FetchSportsRevenue; -import com.baeldung.hexagonal.ports.WriteSportsRevenue; - -public class SportsApp { - - private FetchSportsRevenue sportsRevenue; - private WriteSportsRevenue writeSportsRevenue; - - public SportsApp(FetchSportsRevenue sportsCategories, WriteSportsRevenue writeSportsRevenue) { - this.sportsRevenue = sportsCategories; - this.writeSportsRevenue = writeSportsRevenue; - } - - public void fetchAndWrite(String sportName) { - SportRevenue sportRevenue = sportsRevenue.retrieveSportRevenue(sportName); - writeSportsRevenue.writeSportsReveue(sportRevenue); - } -} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/model/SportRevenue.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/model/SportRevenue.java deleted file mode 100644 index 62a09a738c..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/model/SportRevenue.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.hexagonal.model; - -public class SportRevenue { - private String name; - private double revenue; - - public SportRevenue(String name, double revenue) { - this.name = name; - this.revenue = revenue; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public double getRevenue() { - return revenue; - } - public void setRevenue(double revenue) { - this.revenue = revenue; - } - @Override - public String toString() { - return "SportRevenue [name=" + name + ", revenue=" + revenue + "]"; - } - -} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/FetchSportsRevenue.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/FetchSportsRevenue.java deleted file mode 100644 index ede4f2420d..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/FetchSportsRevenue.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.hexagonal.ports; - -import com.baeldung.hexagonal.model.SportRevenue; - -public interface FetchSportsRevenue { - public SportRevenue retrieveSportRevenue(String sportName); -} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/UserRequest.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/UserRequest.java deleted file mode 100644 index 1ff7d4d1c6..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/UserRequest.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.baeldung.hexagonal.ports; - -public interface UserRequest { - public void processRequest(String sportName); -} diff --git a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/WriteSportsRevenue.java b/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/WriteSportsRevenue.java deleted file mode 100644 index 2aa48d6a92..0000000000 --- a/hexagonal-architecture-java/src/main/java/com/baeldung/hexagonal/ports/WriteSportsRevenue.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.hexagonal.ports; - -import com.baeldung.hexagonal.model.SportRevenue; - -public interface WriteSportsRevenue { - public void writeSportsReveue(SportRevenue sportRevenue); -} diff --git a/pom.xml b/pom.xml index 44dd9f2467..1db715147a 100644 --- a/pom.xml +++ b/pom.xml @@ -558,7 +558,6 @@ rxjava-operators atomikos - hexagonal-architecture-java From 4c4b784d02397a299896961304dbb279160a5eaa Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Tue, 21 Jul 2020 20:24:51 +0200 Subject: [PATCH 0225/1862] JAVA-1649: Get rid of the overriden spring-boot.version property --- spring-security-modules/spring-security-oidc/pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spring-security-modules/spring-security-oidc/pom.xml b/spring-security-modules/spring-security-oidc/pom.xml index 91e4641450..b9a4b340a3 100644 --- a/spring-security-modules/spring-security-oidc/pom.xml +++ b/spring-security-modules/spring-security-oidc/pom.xml @@ -26,8 +26,4 @@ - - 2.2.1.RELEASE - - From 38ccd9faaf5ab8129e9890ac46326e253698dd0d Mon Sep 17 00:00:00 2001 From: Maciej Glowka Date: Tue, 21 Jul 2020 20:46:44 +0200 Subject: [PATCH 0226/1862] BAEL-3347: moved version collision submodule from maven-all to maven-modules --- maven-all/version-collision/pom.xml | 54 ---------------- .../version-collision/child-module/pom.xml | 21 ------ maven-modules/version-collision/pom.xml | 64 +++++++++++-------- .../version-collision/project-a/pom.xml | 0 .../version-collision/project-b/pom.xml | 0 .../project-collision/pom.xml | 0 .../collision/VersionCollisionUnitTest.java | 0 7 files changed, 37 insertions(+), 102 deletions(-) delete mode 100644 maven-all/version-collision/pom.xml delete mode 100644 maven-modules/version-collision/child-module/pom.xml rename {maven-all => maven-modules}/version-collision/project-a/pom.xml (100%) rename {maven-all => maven-modules}/version-collision/project-b/pom.xml (100%) rename {maven-all => maven-modules}/version-collision/project-collision/pom.xml (100%) rename {maven-all => maven-modules}/version-collision/project-collision/src/test/java/com/baeldung/version/collision/VersionCollisionUnitTest.java (100%) diff --git a/maven-all/version-collision/pom.xml b/maven-all/version-collision/pom.xml deleted file mode 100644 index 7bbd17a789..0000000000 --- a/maven-all/version-collision/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - maven-all - com.baeldung - 0.0.1-SNAPSHOT - - 4.0.0 - - version-collision - pom - - project-a - project-b - project-collision - - - - - - - com.google.guava - guava - 29.0-jre - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/maven-modules/version-collision/child-module/pom.xml b/maven-modules/version-collision/child-module/pom.xml deleted file mode 100644 index 7784bc5953..0000000000 --- a/maven-modules/version-collision/child-module/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - version-collision - com.baeldung - 0.0.1-SNAPSHOT - - 4.0.0 - - child-module - - - - org.apache.maven - maven-core - 3.3.9 - - - \ No newline at end of file diff --git a/maven-modules/version-collision/pom.xml b/maven-modules/version-collision/pom.xml index 9a38fd0edb..6d8441aa7b 100644 --- a/maven-modules/version-collision/pom.xml +++ b/maven-modules/version-collision/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - maven-all + maven-modules com.baeldung 0.0.1-SNAPSHOT @@ -11,34 +11,44 @@ version-collision pom - - child-module + project-a + project-b + project-collision - - - org.apache.commons - commons-configuration2 - 2.7 - - - - - - - - - + + + + + com.google.guava + guava + 29.0-jre + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/maven-all/version-collision/project-a/pom.xml b/maven-modules/version-collision/project-a/pom.xml similarity index 100% rename from maven-all/version-collision/project-a/pom.xml rename to maven-modules/version-collision/project-a/pom.xml diff --git a/maven-all/version-collision/project-b/pom.xml b/maven-modules/version-collision/project-b/pom.xml similarity index 100% rename from maven-all/version-collision/project-b/pom.xml rename to maven-modules/version-collision/project-b/pom.xml diff --git a/maven-all/version-collision/project-collision/pom.xml b/maven-modules/version-collision/project-collision/pom.xml similarity index 100% rename from maven-all/version-collision/project-collision/pom.xml rename to maven-modules/version-collision/project-collision/pom.xml diff --git a/maven-all/version-collision/project-collision/src/test/java/com/baeldung/version/collision/VersionCollisionUnitTest.java b/maven-modules/version-collision/project-collision/src/test/java/com/baeldung/version/collision/VersionCollisionUnitTest.java similarity index 100% rename from maven-all/version-collision/project-collision/src/test/java/com/baeldung/version/collision/VersionCollisionUnitTest.java rename to maven-modules/version-collision/project-collision/src/test/java/com/baeldung/version/collision/VersionCollisionUnitTest.java From ab755bf0988833e15380c4c1c8c1fb89cea1b984 Mon Sep 17 00:00:00 2001 From: developerDiv Date: Tue, 21 Jul 2020 21:32:40 +0100 Subject: [PATCH 0227/1862] Add static class to 'eq' and 'when' for greater readability. --- .../argumentcaptor/EmailServiceUnitTest.java | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java index 2208bc7c7b..9d18957b2e 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java @@ -2,16 +2,10 @@ package com.baeldung.mockito.argumentcaptor; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.InjectMocks; -import org.mockito.Mock; +import org.mockito.*; import org.mockito.junit.MockitoJUnitRunner; import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class EmailServiceUnitTest { @@ -36,7 +30,7 @@ public class EmailServiceUnitTest { emailService.send(to, subject, body, false); - verify(platform).send(emailCaptor.capture()); + Mockito.verify(platform).send(emailCaptor.capture()); Email emailCaptorValue = emailCaptor.getValue(); assertEquals(Format.TEXT_ONLY, emailCaptorValue.getFormat()); } @@ -49,14 +43,14 @@ public class EmailServiceUnitTest { emailService.send(to, subject, body, true); - verify(platform).send(emailCaptor.capture()); + Mockito.verify(platform).send(emailCaptor.capture()); Email value = emailCaptor.getValue(); assertEquals(Format.HTML, value.getFormat()); } @Test public void whenServiceRunning_expectUpResponse() { - when(platform.getServiceStatus()).thenReturn("OK"); + Mockito.when(platform.getServiceStatus()).thenReturn("OK"); ServiceStatus serviceStatus = emailService.checkServiceStatus(); @@ -65,7 +59,7 @@ public class EmailServiceUnitTest { @Test public void whenServiceNotRunning_expectDownResponse() { - when(platform.getServiceStatus()).thenReturn("Error"); + Mockito.when(platform.getServiceStatus()).thenReturn("Error"); ServiceStatus serviceStatus = emailService.checkServiceStatus(); @@ -75,15 +69,15 @@ public class EmailServiceUnitTest { @Test public void usingArgumentMatcher_whenAuthenticatedWithValidCredentials_expectTrue() { Credentials credentials = new Credentials("baeldung", "correct_password", "correct_key"); - when(platform.authenticate(eq(credentials))).thenReturn(AuthenticationStatus.AUTHENTICATED); + Mockito.when(platform.authenticate(Mockito.eq(credentials))).thenReturn(AuthenticationStatus.AUTHENTICATED); assertTrue(emailService.authenticatedSuccessfully(credentials)); } @Test - public void usingArgumentCapture_whenAuthenticatedWithValidCredentials_expectTrue() { + public void usingArgumentCaptor_whenAuthenticatedWithValidCredentials_expectTrue() { Credentials credentials = new Credentials("baeldung", "correct_password", "correct_key"); - when(platform.authenticate(credentialsCaptor.capture())).thenReturn(AuthenticationStatus.AUTHENTICATED); + Mockito.when(platform.authenticate(credentialsCaptor.capture())).thenReturn(AuthenticationStatus.AUTHENTICATED); assertTrue(emailService.authenticatedSuccessfully(credentials)); assertEquals(credentials, credentialsCaptor.getValue()); @@ -92,7 +86,7 @@ public class EmailServiceUnitTest { @Test public void whenNotAuthenticated_expectFalse() { Credentials credentials = new Credentials("baeldung", "incorrect_password", "incorrect_key"); - when(platform.authenticate(eq(credentials))).thenReturn(AuthenticationStatus.NOT_AUTHENTICATED); + Mockito.when(platform.authenticate(Mockito.eq(credentials))).thenReturn(AuthenticationStatus.NOT_AUTHENTICATED); assertFalse(emailService.authenticatedSuccessfully(credentials)); } From 7f1acd21bfa9932ca7a09d35d618b294ba112fdb Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Tue, 21 Jul 2020 21:30:17 -0500 Subject: [PATCH 0228/1862] BAEL-4387 Add files to handle Array to ArrayList convertion --- .../ArrayToListConversion.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 java-collections-conversions-2/src/main/java/com/baeldung/arrayconvertion/ArrayToListConversion.java diff --git a/java-collections-conversions-2/src/main/java/com/baeldung/arrayconvertion/ArrayToListConversion.java b/java-collections-conversions-2/src/main/java/com/baeldung/arrayconvertion/ArrayToListConversion.java new file mode 100644 index 0000000000..7e1002b22c --- /dev/null +++ b/java-collections-conversions-2/src/main/java/com/baeldung/arrayconvertion/ArrayToListConversion.java @@ -0,0 +1,33 @@ +package com.baeldung.arrayconvertion; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class ArrayToListConversion { + + public static void main(String[] args) { + System.out.println("Array.asList()"); + arrayAsList(); + System.out.println("\nArrayList<>(Arrays.asList())"); + independentArray(); + } + + private static void arrayAsList() { + String[] stringArray = new String[] { "A", "B", "C", "D" }; + List stringList = Arrays.asList(stringArray); + System.out.println(stringList); // [A, B, C, D] + stringList.set(0, "E"); + System.out.println(stringList); // [E, B, C, D] + System.out.println(Arrays.toString(stringArray)); // [E, B, C, D] + } + + private static void independentArray() { + String[] stringArray = new String[] { "A", "B", "C", "D" }; + List stringList = new ArrayList<>(Arrays.asList(stringArray)); + System.out.println(stringList); // [A, B, C, D] + stringList.set(0, "E"); + System.out.println(stringList); // [E, B, C, D] + System.out.println(Arrays.toString(stringArray)); // [A, B, C, D] + } +} \ No newline at end of file From a1e32f74888daf855f55c2b9ffc9f2362c7e12e6 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 22 Jul 2020 14:44:35 +0800 Subject: [PATCH 0229/1862] Update README.md --- core-java-modules/core-java-arrays-guides/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index 56c0c716d8..621443e4a9 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -5,4 +5,4 @@ This module contains complete guides about arrays in Java ### Relevant Articles: - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) -- [What is [Ljava.lang.Object;?]](https://www.baeldung.com/java-tostring-array) +- [What is \[Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) From feb45774c3da9022f58f1cb09f0522013cbb34bb Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 22 Jul 2020 15:21:43 +0530 Subject: [PATCH 0230/1862] JAVA-2155: Updated keycloak version to 10.0.2, and changed parent to parent-boot-2 --- .../spring-boot-keycloak/pom.xml | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/spring-boot-modules/spring-boot-keycloak/pom.xml b/spring-boot-modules/spring-boot-keycloak/pom.xml index 6208fbe305..5049cc3651 100644 --- a/spring-boot-modules/spring-boot-keycloak/pom.xml +++ b/spring-boot-modules/spring-boot-keycloak/pom.xml @@ -2,22 +2,20 @@ 4.0.0 - - - com.baeldung.spring-boot-modules - spring-boot-modules - 1.0.0-SNAPSHOT - ../ - - com.baeldung.keycloak spring-boot-keycloak 0.0.1 - jar - spring-boot-keycloak + jar This is a simple application demonstrating integration between Keycloak and Spring Boot. + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + @@ -78,7 +76,7 @@
    - 10.0.1 + 10.0.2 From 6689cbd783b6682b2e88c51e2361a06b9683ca57 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 22 Jul 2020 15:22:26 +0530 Subject: [PATCH 0231/1862] JAVA-2155: added properties alternative to spring security --- .../src/main/resources/application.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-boot-modules/spring-boot-keycloak/src/main/resources/application.properties b/spring-boot-modules/spring-boot-keycloak/src/main/resources/application.properties index 6e7da2cb90..9dfd3ea720 100644 --- a/spring-boot-modules/spring-boot-keycloak/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-keycloak/src/main/resources/application.properties @@ -6,4 +6,6 @@ keycloak.auth-server-url=http://localhost:8180/auth keycloak.realm=SpringBootKeycloak keycloak.resource=login-app keycloak.public-client=true +#keycloak.security-constraints[0].authRoles[0]=user +#keycloak.security-constraints[0].securityCollections[0].patterns[0]=/customers/* keycloak.principal-attribute=preferred_username \ No newline at end of file From debf5ce3e861f623626456fc1255a63298d3ab9c Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 22 Jul 2020 15:23:01 +0530 Subject: [PATCH 0232/1862] JAVA-2155: changed package from org.baledung to com.baeldung --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spring-boot-modules/spring-boot-keycloak/src/test/java/{org => com}/baeldung/SpringContextTest.java (100%) diff --git a/spring-boot-modules/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextTest.java b/spring-boot-modules/spring-boot-keycloak/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-boot-modules/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextTest.java rename to spring-boot-modules/spring-boot-keycloak/src/test/java/com/baeldung/SpringContextTest.java From 3af64ac7d40149ea7d8071219927c11aef952f91 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Wed, 22 Jul 2020 19:07:29 +0430 Subject: [PATCH 0233/1862] KTLN-162: Create anonymous inner class in Kotlin (#9718) * Create anonymous inner class in Kotlin * Moved to the New Module --- .../com/baeldung/anonymous/Anonymous.kt | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/anonymous/Anonymous.kt diff --git a/core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/anonymous/Anonymous.kt b/core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/anonymous/Anonymous.kt new file mode 100644 index 0000000000..ea471f5d00 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-lang-oop-2/src/main/kotlin/com/baeldung/anonymous/Anonymous.kt @@ -0,0 +1,41 @@ +package com.baeldung.anonymous + +import java.io.Serializable +import java.nio.channels.Channel + +fun main() { + val channel = object : Channel { + override fun isOpen() = false + + override fun close() { + } + } + + val maxEntries = 10 + val lruCache = object : LinkedHashMap(10, 0.75f) { + + override fun removeEldestEntry(eldest: MutableMap.MutableEntry?): Boolean { + return size > maxEntries + } + } + + val map = object : LinkedHashMap() { + // omitted + } + + val serializableChannel = object : Channel, Serializable { + override fun isOpen(): Boolean { + TODO("Not yet implemented") + } + + override fun close() { + TODO("Not yet implemented") + } + } + + val obj = object { + val question = "answer" + val answer = 42 + } + println("The ${obj.question} is ${obj.answer}") +} \ No newline at end of file From 11501b461c5e0a752b26768822173b8079020f10 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Wed, 22 Jul 2020 19:11:08 +0430 Subject: [PATCH 0234/1862] Moving to a new module (#9681) --- .../emptiness/DirectoryEmptinessUnitTest.java | 63 +++++++++++++++++++ .../src/test/resources/notDir.txt | 0 2 files changed, 63 insertions(+) create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/emptiness/DirectoryEmptinessUnitTest.java create mode 100644 core-java-modules/core-java-io-3/src/test/resources/notDir.txt diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/emptiness/DirectoryEmptinessUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/emptiness/DirectoryEmptinessUnitTest.java new file mode 100644 index 0000000000..a44aea1383 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/emptiness/DirectoryEmptinessUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.emptiness; + +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +public class DirectoryEmptinessUnitTest { + + @Test + public void givenPath_whenInvalid_thenReturnsFalse() throws IOException { + assertThat(isEmpty(Paths.get("invalid-addr"))).isFalse(); + } + + @Test + public void givenPath_whenNotDirectory_thenReturnsFalse() throws IOException { + Path aFile = Paths.get(getClass().getResource("/notDir.txt").getPath()); + assertThat(isEmpty(aFile)).isFalse(); + } + + @Test + public void givenPath_whenNotEmptyDir_thenReturnsFalse() throws IOException { + Path currentDir = new File("").toPath().toAbsolutePath(); + assertThat(isEmpty(currentDir)).isFalse(); + } + + @Test + public void givenPath_whenIsEmpty_thenReturnsTrue() throws Exception { + Path path = Files.createTempDirectory("baeldung-empty"); + assertThat(isEmpty(path)).isTrue(); + } + + private static boolean isEmpty(Path path) throws IOException { + if (Files.isDirectory(path)) { + try (DirectoryStream directory = Files.newDirectoryStream(path)) { + return !directory.iterator().hasNext(); + } + } + + return false; + } + + private static boolean isEmpty2(Path path) throws IOException { + if (Files.isDirectory(path)) { + try (Stream entries = Files.list(path)) { + return !entries.findFirst().isPresent(); + } + } + + return false; + } + + private static boolean isEmptyInefficient(Path path) { + return path.toFile().listFiles().length == 0; + } +} diff --git a/core-java-modules/core-java-io-3/src/test/resources/notDir.txt b/core-java-modules/core-java-io-3/src/test/resources/notDir.txt new file mode 100644 index 0000000000..e69de29bb2 From a72f2f144cbd2d446e16860b72995f5f048b5e2c Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Wed, 22 Jul 2020 19:43:35 +0430 Subject: [PATCH 0235/1862] Switching the For Blocks! --- .../collections/bitset/BitSetUnitTest.java | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/bitset/BitSetUnitTest.java b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/bitset/BitSetUnitTest.java index 74aa224a49..d9340f45c1 100644 --- a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/bitset/BitSetUnitTest.java +++ b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/bitset/BitSetUnitTest.java @@ -32,14 +32,18 @@ public class BitSetUnitTest { assertThat(bitSet.get(10)).isTrue(); bitSet.set(20, 30); - for (int i = 20; i <= 29; i++) assertThat(bitSet.get(i)).isTrue(); + for (int i = 20; i <= 29; i++) { + assertThat(bitSet.get(i)).isTrue(); + } assertThat(bitSet.get(30)).isFalse(); bitSet.set(10, false); assertThat(bitSet.get(10)).isFalse(); bitSet.set(20, 30, false); - for (int i = 20; i <= 30; i++) assertThat(bitSet.get(i)).isFalse(); + for (int i = 20; i <= 30; i++) { + assertThat(bitSet.get(i)).isFalse(); + } } @Test @@ -52,14 +56,20 @@ public class BitSetUnitTest { assertThat(bitSet.get(42)).isFalse(); bitSet.set(10, 20); - for (int i = 10; i < 20; i++) assertThat(bitSet.get(i)).isTrue(); + for (int i = 10; i < 20; i++) { + assertThat(bitSet.get(i)).isTrue(); + } bitSet.clear(10, 20); - for (int i = 10; i < 20; i++) assertThat(bitSet.get(i)).isFalse(); + for (int i = 10; i < 20; i++) { + assertThat(bitSet.get(i)).isFalse(); + } bitSet.set(10, 20); bitSet.clear(); - for (int i = 0; i < 100; i++) assertThat(bitSet.get(i)).isFalse(); + for (int i = 0; i < 100; i++) { + assertThat(bitSet.get(i)).isFalse(); + } } @Test @@ -72,7 +82,9 @@ public class BitSetUnitTest { bitSet.set(10, 20); BitSet newBitSet = bitSet.get(10, 20); - for (int i = 0; i < 10; i++) assertThat(newBitSet.get(i)).isTrue(); + for (int i = 0; i < 10; i++) { + assertThat(newBitSet.get(i)).isTrue(); + } } @Test @@ -86,7 +98,9 @@ public class BitSetUnitTest { assertThat(bitSet.get(12)).isTrue(); bitSet.flip(30, 40); - for (int i = 30; i < 40; i++) assertThat(bitSet.get(i)).isTrue(); + for (int i = 30; i < 40; i++) { + assertThat(bitSet.get(i)).isTrue(); + } } @Test @@ -130,8 +144,12 @@ public class BitSetUnitTest { first.set(5, 10); first.xor(second); - for (int i = 5; i < 7; i++) assertThat(first.get(i)).isTrue(); - for (int i = 10; i < 15; i++) assertThat(first.get(i)).isTrue(); + for (int i = 5; i < 7; i++) { + assertThat(first.get(i)).isTrue(); + } + for (int i = 10; i < 15; i++) { + assertThat(first.get(i)).isTrue(); + } } @Test From ae284db5ddcc3d8157fa57d5f32df7f3007c5139 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Thu, 23 Jul 2020 00:58:40 +0530 Subject: [PATCH 0236/1862] Updated code to use only Console --- .../main/java/com/baeldung/consoleout/ConsoleAndOut.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java index 99f185d539..5a327dbe62 100644 --- a/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java +++ b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java @@ -5,11 +5,9 @@ import java.io.Console; public class ConsoleAndOut { public static void main(String[] args) { Console console = System.console(); - System.out.println(console); + console.writer().print(console); - if (console != null) { - char[] password = console.readPassword("Enter password:"); - console.printf(String.valueOf(password)); - } + char[] password = console.readPassword("Enter password:"); + console.printf(String.valueOf(password)); } } From adc586c566c65f256bb9d84c25416f01c4d73e9c Mon Sep 17 00:00:00 2001 From: helga_sh Date: Tue, 21 Jul 2020 16:24:31 +0300 Subject: [PATCH 0237/1862] CNN example with Deeplearning4j in Java --- deeplearning4j/pom.xml | 10 ++ .../deeplearning4j/cnn/CnnExample.java | 21 +++ .../cnn/domain/network/CnnModel.java | 120 ++++++++++++++++++ .../domain/network/CnnModelProperties.java | 13 ++ .../service/dataset/CifarDataSetService.java | 46 +++++++ .../cnn/service/dataset/IDataSetService.java | 16 +++ 6 files changed, 226 insertions(+) create mode 100644 deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnExample.java create mode 100644 deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModel.java create mode 100644 deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModelProperties.java create mode 100644 deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/CifarDataSetService.java create mode 100644 deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/IDataSetService.java diff --git a/deeplearning4j/pom.xml b/deeplearning4j/pom.xml index c8fa18cbd4..d88c877aa4 100644 --- a/deeplearning4j/pom.xml +++ b/deeplearning4j/pom.xml @@ -37,6 +37,16 @@ deeplearning4j-nn ${dl4j.version} + + org.slf4j + slf4j-api + 1.7.5 + + + org.slf4j + slf4j-log4j12 + 1.7.5 + org.datavec diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnExample.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnExample.java new file mode 100644 index 0000000000..2e2d4392b8 --- /dev/null +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnExample.java @@ -0,0 +1,21 @@ +package com.baeldung.deeplearning4j.cnn; + + +import com.baeldung.deeplearning4j.cnn.domain.network.CnnModel; +import com.baeldung.deeplearning4j.cnn.domain.network.CnnModelProperties; +import com.baeldung.deeplearning4j.cnn.service.dataset.CifarDataSetService; +import lombok.extern.slf4j.Slf4j; +import org.deeplearning4j.eval.Evaluation; + +@Slf4j +public class CnnExample { + + public static void main(String... args) { + CnnModel network = new CnnModel(new CifarDataSetService(), new CnnModelProperties()); + + network.train(); + Evaluation evaluation = network.evaluate(); + + log.info(evaluation.stats()); + } +} diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModel.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModel.java new file mode 100644 index 0000000000..037d14529c --- /dev/null +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModel.java @@ -0,0 +1,120 @@ +package com.baeldung.deeplearning4j.cnn.domain.network; + +import com.baeldung.deeplearning4j.cnn.service.dataset.IDataSetService; +import lombok.extern.slf4j.Slf4j; +import org.deeplearning4j.eval.Evaluation; +import org.deeplearning4j.nn.api.OptimizationAlgorithm; +import org.deeplearning4j.nn.conf.MultiLayerConfiguration; +import org.deeplearning4j.nn.conf.NeuralNetConfiguration; +import org.deeplearning4j.nn.conf.layers.ConvolutionLayer; +import org.deeplearning4j.nn.conf.layers.OutputLayer; +import org.deeplearning4j.nn.conf.layers.SubsamplingLayer; +import org.deeplearning4j.nn.multilayer.MultiLayerNetwork; +import org.deeplearning4j.nn.weights.WeightInit; +import org.nd4j.linalg.activations.Activation; +import org.nd4j.linalg.lossfunctions.LossFunctions; + +import java.util.stream.IntStream; + +@Slf4j +public class CnnModel { + + private final IDataSetService dataSetService; + + private MultiLayerNetwork network; + + private final CnnModelProperties properties; + + public CnnModel(IDataSetService dataSetService, CnnModelProperties properties) { + + this.dataSetService = dataSetService; + this.properties = properties; + + MultiLayerConfiguration configuration = new NeuralNetConfiguration.Builder() + .seed(1611) + .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) + .learningRate(properties.getLearningRate()) + .regularization(true) + .updater(properties.getOptimizer()) + .list() + .layer(0, conv5x5()) + .layer(1, pooling2x2Stride2()) + .layer(2, conv3x3Stride1Padding2()) + .layer(3, pooling2x2Stride1()) + .layer(4, conv3x3Stride1Padding1()) + .layer(5, pooling2x2Stride1()) + .layer(6, dense()) + .pretrain(false) + .backprop(true) + .setInputType(dataSetService.inputType()) + .build(); + + network = new MultiLayerNetwork(configuration); + } + + public void train() { + network.init(); + int epochsNum = properties.getEpochsNum(); + IntStream.range(1, epochsNum + 1).forEach(epoch -> { + log.info(String.format("Epoch %d?%d", epoch, epochsNum)); + network.fit(dataSetService.trainIterator()); + }); + } + + public Evaluation evaluate() { + return network.evaluate(dataSetService.testIterator()); + } + + private ConvolutionLayer conv5x5() { + return new ConvolutionLayer.Builder(5, 5) + .nIn(3) + .nOut(16) + .stride(1, 1) + .padding(1, 1) + .weightInit(WeightInit.XAVIER_UNIFORM) + .activation(Activation.RELU) + .build(); + } + + private SubsamplingLayer pooling2x2Stride2() { + return new SubsamplingLayer.Builder(SubsamplingLayer.PoolingType.MAX) + .kernelSize(2, 2) + .stride(2, 2) + .build(); + } + + private ConvolutionLayer conv3x3Stride1Padding2() { + return new ConvolutionLayer.Builder(3, 3) + .nOut(32) + .stride(1, 1) + .padding(2, 2) + .weightInit(WeightInit.XAVIER_UNIFORM) + .activation(Activation.RELU) + .build(); + } + + private SubsamplingLayer pooling2x2Stride1() { + return new SubsamplingLayer.Builder(SubsamplingLayer.PoolingType.MAX) + .kernelSize(2,2) + .stride(1, 1) + .build(); + } + + private ConvolutionLayer conv3x3Stride1Padding1() { + return new ConvolutionLayer.Builder(3, 3) + .nOut(64) + .stride(1, 1) + .padding(1, 1) + .weightInit(WeightInit.XAVIER_UNIFORM) + .activation(Activation.RELU) + .build(); + } + + private OutputLayer dense() { + return new OutputLayer.Builder(LossFunctions.LossFunction.MEAN_SQUARED_LOGARITHMIC_ERROR) + .activation(Activation.SOFTMAX) + .weightInit(WeightInit.XAVIER_UNIFORM) + .nOut(dataSetService.labels().size() - 1) + .build(); + } +} diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModelProperties.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModelProperties.java new file mode 100644 index 0000000000..7ea3a71363 --- /dev/null +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModelProperties.java @@ -0,0 +1,13 @@ +package com.baeldung.deeplearning4j.cnn.domain.network; + +import lombok.Value; +import org.deeplearning4j.nn.conf.Updater; + +@Value +public class CnnModelProperties { + private final int epochsNum = 512; + + private final double learningRate = 0.001; + + private final Updater optimizer = Updater.ADAM; +} diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/CifarDataSetService.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/CifarDataSetService.java new file mode 100644 index 0000000000..cb69d0c818 --- /dev/null +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/CifarDataSetService.java @@ -0,0 +1,46 @@ +package com.baeldung.deeplearning4j.cnn.service.dataset; + +import lombok.Getter; +import org.deeplearning4j.datasets.iterator.impl.CifarDataSetIterator; +import org.deeplearning4j.nn.conf.inputs.InputType; +import org.nd4j.linalg.dataset.api.iterator.DataSetIterator; + +import java.util.List; + +@Getter +public class CifarDataSetService implements IDataSetService { + + private CifarDataSetIterator trainIterator; + private CifarDataSetIterator testIterator; + + private final InputType inputType = InputType.convolutional(32,32,3); + private final int trainImagesNum = 512; + private final int testImagesNum = 128; + private final int trainBatch = 16; + private final int testBatch = 8; + + public CifarDataSetService() { + trainIterator = new CifarDataSetIterator(trainBatch, trainImagesNum, true); + testIterator = new CifarDataSetIterator(testBatch, testImagesNum, false); + } + + @Override + public DataSetIterator trainIterator() { + return trainIterator; + } + + @Override + public DataSetIterator testIterator() { + return testIterator; + } + + @Override + public InputType inputType() { + return inputType; + } + + @Override + public List labels() { + return trainIterator.getLabels(); + } +} diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/IDataSetService.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/IDataSetService.java new file mode 100644 index 0000000000..c27e566076 --- /dev/null +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/IDataSetService.java @@ -0,0 +1,16 @@ +package com.baeldung.deeplearning4j.cnn.service.dataset; + +import org.deeplearning4j.nn.conf.inputs.InputType; +import org.nd4j.linalg.dataset.api.iterator.DataSetIterator; + +import java.util.List; + +public interface IDataSetService { + DataSetIterator trainIterator(); + + DataSetIterator testIterator(); + + InputType inputType(); + + List labels(); +} From 0df52dda7ca2109906fcbc49390be76275e825c0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:03:11 +0800 Subject: [PATCH 0238/1862] Update README.md --- core-java-modules/core-java-exceptions-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-exceptions-2/README.md b/core-java-modules/core-java-exceptions-2/README.md index 7c5db06a55..e6441c2c12 100644 --- a/core-java-modules/core-java-exceptions-2/README.md +++ b/core-java-modules/core-java-exceptions-2/README.md @@ -13,3 +13,4 @@ This module contains articles about core java exceptions - [Java Global Exception Handler](https://www.baeldung.com/java-global-exception-handler) - [How to Find an Exception’s Root Cause in Java](https://www.baeldung.com/java-exception-root-cause) - [Java IOException “Too many open files”](https://www.baeldung.com/java-too-many-open-files) +- [When Does Java Throw the ExceptionInInitializerError?](https://www.baeldung.com/java-exceptionininitializererror) From 2bc4c93e7b29c96eb91d8d66a0026949a3509fff Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:06:51 +0800 Subject: [PATCH 0239/1862] Update README.md --- testing-modules/selenium-junit-testng/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/selenium-junit-testng/README.md b/testing-modules/selenium-junit-testng/README.md index 8baddd3449..aa3f0e8005 100644 --- a/testing-modules/selenium-junit-testng/README.md +++ b/testing-modules/selenium-junit-testng/README.md @@ -4,3 +4,4 @@ - [Testing with Selenium/WebDriver and the Page Object Pattern](http://www.baeldung.com/selenium-webdriver-page-object) - [Using Cookies With Selenium WebDriver in Java](https://www.baeldung.com/java-selenium-webdriver-cookies) - [Clicking Elements in Selenium using JavaScript](https://www.baeldung.com/java-selenium-javascript) +- [Taking Screenshots With Selenium WebDriver](https://www.baeldung.com/java-selenium-screenshots) From 9bee8e34ec397aa6bdff9366c9ac9a44d01e2943 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:09:08 +0800 Subject: [PATCH 0240/1862] Update README.md --- java-numbers-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-numbers-3/README.md b/java-numbers-3/README.md index 9c323a6c6a..ab0bbd995d 100644 --- a/java-numbers-3/README.md +++ b/java-numbers-3/README.md @@ -13,4 +13,5 @@ This module contains articles about numbers in Java. - [Guide to the Number Class in Java](https://www.baeldung.com/java-number-class) - [Print an Integer in Binary Format in Java](https://www.baeldung.com/java-print-integer-binary) - [Number Formatting in Java](https://www.baeldung.com/java-number-formatting) +- [Division by Zero in Java: Exception, Infinity, or Not a Number](https://www.baeldung.com/java-division-by-zero) - More articles: [[<-- prev]](/java-numbers-2) From 5be7937077fb270bb812cafa1edfb734c0799197 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:12:46 +0800 Subject: [PATCH 0241/1862] Update README.md --- image-processing/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/image-processing/README.md b/image-processing/README.md index 50129bb994..afe92466c1 100644 --- a/image-processing/README.md +++ b/image-processing/README.md @@ -6,3 +6,4 @@ This module contains articles about image processing. - [Working with Images in Java](https://www.baeldung.com/java-images) - [Intro to OpenCV with Java](https://www.baeldung.com/java-opencv) - [Optical Character Recognition with Tesseract](https://www.baeldung.com/java-ocr-tesseract) +- [How Can I Resize an Image Using Java?](https://www.baeldung.com/java-resize-image) From 51f1fc9b1e07d5bd342b583b750b66bcabf13838 Mon Sep 17 00:00:00 2001 From: helga_sh Date: Thu, 23 Jul 2020 16:17:04 +0300 Subject: [PATCH 0242/1862] CNN example with Deeplearning4j in Java: refactor --- deeplearning4j/pom.xml | 5 +++-- .../dataset => }/CifarDataSetService.java | 15 ++++++------- .../deeplearning4j/cnn/CnnExample.java | 5 +---- .../cnn/{domain/network => }/CnnModel.java | 21 +++++++++---------- .../network => }/CnnModelProperties.java | 4 ++-- .../dataset => }/IDataSetService.java | 4 ++-- 6 files changed, 26 insertions(+), 28 deletions(-) rename deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/{service/dataset => }/CifarDataSetService.java (79%) rename deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/{domain/network => }/CnnModel.java (86%) rename deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/{domain/network => }/CnnModelProperties.java (70%) rename deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/{service/dataset => }/IDataSetService.java (74%) diff --git a/deeplearning4j/pom.xml b/deeplearning4j/pom.xml index d88c877aa4..e1e4998c98 100644 --- a/deeplearning4j/pom.xml +++ b/deeplearning4j/pom.xml @@ -40,12 +40,12 @@ org.slf4j slf4j-api - 1.7.5 + ${sl4j.version} org.slf4j slf4j-log4j12 - 1.7.5 + ${sl4j.version} @@ -63,6 +63,7 @@ 0.9.1 4.3.5 + 1.7.5 diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/CifarDataSetService.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CifarDataSetService.java similarity index 79% rename from deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/CifarDataSetService.java rename to deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CifarDataSetService.java index cb69d0c818..70348a6d9e 100644 --- a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/CifarDataSetService.java +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CifarDataSetService.java @@ -1,4 +1,4 @@ -package com.baeldung.deeplearning4j.cnn.service.dataset; +package com.baeldung.deeplearning4j.cnn; import lombok.Getter; import org.deeplearning4j.datasets.iterator.impl.CifarDataSetIterator; @@ -8,18 +8,19 @@ import org.nd4j.linalg.dataset.api.iterator.DataSetIterator; import java.util.List; @Getter -public class CifarDataSetService implements IDataSetService { +class CifarDataSetService implements IDataSetService { - private CifarDataSetIterator trainIterator; - private CifarDataSetIterator testIterator; - - private final InputType inputType = InputType.convolutional(32,32,3); + private final InputType inputType = InputType.convolutional(32, 32, 3); private final int trainImagesNum = 512; private final int testImagesNum = 128; private final int trainBatch = 16; private final int testBatch = 8; - public CifarDataSetService() { + private final CifarDataSetIterator trainIterator; + + private final CifarDataSetIterator testIterator; + + CifarDataSetService() { trainIterator = new CifarDataSetIterator(trainBatch, trainImagesNum, true); testIterator = new CifarDataSetIterator(testBatch, testImagesNum, false); } diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnExample.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnExample.java index 2e2d4392b8..224062c388 100644 --- a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnExample.java +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnExample.java @@ -1,14 +1,11 @@ package com.baeldung.deeplearning4j.cnn; -import com.baeldung.deeplearning4j.cnn.domain.network.CnnModel; -import com.baeldung.deeplearning4j.cnn.domain.network.CnnModelProperties; -import com.baeldung.deeplearning4j.cnn.service.dataset.CifarDataSetService; import lombok.extern.slf4j.Slf4j; import org.deeplearning4j.eval.Evaluation; @Slf4j -public class CnnExample { +class CnnExample { public static void main(String... args) { CnnModel network = new CnnModel(new CifarDataSetService(), new CnnModelProperties()); diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModel.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModel.java similarity index 86% rename from deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModel.java rename to deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModel.java index 037d14529c..bd87709c0e 100644 --- a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModel.java +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModel.java @@ -1,6 +1,5 @@ -package com.baeldung.deeplearning4j.cnn.domain.network; +package com.baeldung.deeplearning4j.cnn; -import com.baeldung.deeplearning4j.cnn.service.dataset.IDataSetService; import lombok.extern.slf4j.Slf4j; import org.deeplearning4j.eval.Evaluation; import org.deeplearning4j.nn.api.OptimizationAlgorithm; @@ -17,15 +16,15 @@ import org.nd4j.linalg.lossfunctions.LossFunctions; import java.util.stream.IntStream; @Slf4j -public class CnnModel { +class CnnModel { private final IDataSetService dataSetService; - private MultiLayerNetwork network; + private final MultiLayerNetwork network; private final CnnModelProperties properties; - public CnnModel(IDataSetService dataSetService, CnnModelProperties properties) { + CnnModel(IDataSetService dataSetService, CnnModelProperties properties) { this.dataSetService = dataSetService; this.properties = properties; @@ -52,17 +51,17 @@ public class CnnModel { network = new MultiLayerNetwork(configuration); } - public void train() { + void train() { network.init(); int epochsNum = properties.getEpochsNum(); IntStream.range(1, epochsNum + 1).forEach(epoch -> { - log.info(String.format("Epoch %d?%d", epoch, epochsNum)); + log.info("Epoch {} / {}", epoch, epochsNum); network.fit(dataSetService.trainIterator()); }); } - public Evaluation evaluate() { - return network.evaluate(dataSetService.testIterator()); + Evaluation evaluate() { + return network.evaluate(dataSetService.testIterator()); } private ConvolutionLayer conv5x5() { @@ -84,7 +83,7 @@ public class CnnModel { } private ConvolutionLayer conv3x3Stride1Padding2() { - return new ConvolutionLayer.Builder(3, 3) + return new ConvolutionLayer.Builder(3, 3) .nOut(32) .stride(1, 1) .padding(2, 2) @@ -95,7 +94,7 @@ public class CnnModel { private SubsamplingLayer pooling2x2Stride1() { return new SubsamplingLayer.Builder(SubsamplingLayer.PoolingType.MAX) - .kernelSize(2,2) + .kernelSize(2, 2) .stride(1, 1) .build(); } diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModelProperties.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModelProperties.java similarity index 70% rename from deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModelProperties.java rename to deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModelProperties.java index 7ea3a71363..d010d789c8 100644 --- a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/domain/network/CnnModelProperties.java +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModelProperties.java @@ -1,10 +1,10 @@ -package com.baeldung.deeplearning4j.cnn.domain.network; +package com.baeldung.deeplearning4j.cnn; import lombok.Value; import org.deeplearning4j.nn.conf.Updater; @Value -public class CnnModelProperties { +class CnnModelProperties { private final int epochsNum = 512; private final double learningRate = 0.001; diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/IDataSetService.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/IDataSetService.java similarity index 74% rename from deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/IDataSetService.java rename to deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/IDataSetService.java index c27e566076..ea88bf550c 100644 --- a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/service/dataset/IDataSetService.java +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/IDataSetService.java @@ -1,11 +1,11 @@ -package com.baeldung.deeplearning4j.cnn.service.dataset; +package com.baeldung.deeplearning4j.cnn; import org.deeplearning4j.nn.conf.inputs.InputType; import org.nd4j.linalg.dataset.api.iterator.DataSetIterator; import java.util.List; -public interface IDataSetService { +interface IDataSetService { DataSetIterator trainIterator(); DataSetIterator testIterator(); From 8d04aa3205dc308dd58e745c55057054d3be3438 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:18:07 +0800 Subject: [PATCH 0243/1862] Create README.md --- maven-modules/version-collision/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 maven-modules/version-collision/README.md diff --git a/maven-modules/version-collision/README.md b/maven-modules/version-collision/README.md new file mode 100644 index 0000000000..a71cfdb0b4 --- /dev/null +++ b/maven-modules/version-collision/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [How to Resolve a Version Collision of Artifacts in Maven](https://www.baeldung.com/maven-version-collision) From 38af7ca655a60b80aaaea15facefc2ddc2490ec9 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:21:28 +0800 Subject: [PATCH 0244/1862] Update README.md --- core-java-modules/core-java-lang-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-3/README.md b/core-java-modules/core-java-lang-3/README.md index d735937a02..9ce49da868 100644 --- a/core-java-modules/core-java-lang-3/README.md +++ b/core-java-modules/core-java-lang-3/README.md @@ -3,4 +3,5 @@ This module contains articles about core features in the Java language - [Class.isInstance vs Class.isAssignableFrom](https://www.baeldung.com/java-isinstance-isassignablefrom) +- [Converting a Java String Into a Boolean](https://www.baeldung.com/java-string-to-boolean) - [[<-- Prev]](/core-java-modules/core-java-lang-2) From 0423acd0d2a231bb6bc6f1f7522c3906f6e46816 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:24:48 +0800 Subject: [PATCH 0245/1862] Update README.md --- core-java-modules/core-java-concurrency-basic-2/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-concurrency-basic-2/README.md b/core-java-modules/core-java-concurrency-basic-2/README.md index c7143baf36..a8daf14ea9 100644 --- a/core-java-modules/core-java-concurrency-basic-2/README.md +++ b/core-java-modules/core-java-concurrency-basic-2/README.md @@ -3,10 +3,12 @@ This module contains articles about basic Java concurrency ### Relevant Articles: + - [How to Delay Code Execution in Java](https://www.baeldung.com/java-delay-code-execution) - [wait and notify() Methods in Java](https://www.baeldung.com/java-wait-notify) - [Difference Between Wait and Sleep in Java](https://www.baeldung.com/java-wait-and-sleep) - [Guide to the Synchronized Keyword in Java](https://www.baeldung.com/java-synchronized) - [Life Cycle of a Thread in Java](https://www.baeldung.com/java-thread-lifecycle) - [Guide to AtomicMarkableReference](https://www.baeldung.com/java-atomicmarkablereference) +- [Why are Local Variables Thread-Safe in Java](https://www.baeldung.com/java-local-variables-thread-safe) - [[<-- Prev]](/core-java-modules/core-java-concurrency-basic) From 5b354924745fdbf2a011f6f3791cff27dc27e9a6 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:28:59 +0800 Subject: [PATCH 0246/1862] Update README.md --- image-processing/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/image-processing/README.md b/image-processing/README.md index afe92466c1..eba23f83eb 100644 --- a/image-processing/README.md +++ b/image-processing/README.md @@ -7,3 +7,4 @@ This module contains articles about image processing. - [Intro to OpenCV with Java](https://www.baeldung.com/java-opencv) - [Optical Character Recognition with Tesseract](https://www.baeldung.com/java-ocr-tesseract) - [How Can I Resize an Image Using Java?](https://www.baeldung.com/java-resize-image) +- [Adding Text to an Image in Java](https://www.baeldung.com/java-add-text-to-image) From 60ca1bc31b28c5a33c8e7d2eb7d541bf4340dda1 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:31:26 +0800 Subject: [PATCH 0247/1862] Update README.md --- spring-boot-modules/spring-boot-properties-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-properties-2/README.md b/spring-boot-modules/spring-boot-properties-2/README.md index 4e03a4125c..c81ad50e40 100644 --- a/spring-boot-modules/spring-boot-properties-2/README.md +++ b/spring-boot-modules/spring-boot-properties-2/README.md @@ -10,4 +10,5 @@ This module contains articles about Properties in Spring Boot. - [@PropertySource with YAML Files in Spring Boot](https://www.baeldung.com/spring-yaml-propertysource) - [Inject Arrays and Lists From Spring Properties Files](https://www.baeldung.com/spring-inject-arrays-lists) - [Inject a Map from a YAML File with Spring](https://www.baeldung.com/spring-yaml-inject-map) +- [YAML to List of Objects in Spring Boot](https://www.baeldung.com/spring-boot-yaml-list) - More articles: [[<-- prev]](../spring-boot-properties) From 88b1d2661a29a448abadf27c60b8ffc25d0a1e07 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:33:56 +0800 Subject: [PATCH 0248/1862] Update README.md --- persistence-modules/core-java-persistence/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/core-java-persistence/README.md b/persistence-modules/core-java-persistence/README.md index f5d3f12d7a..88442a94c8 100644 --- a/persistence-modules/core-java-persistence/README.md +++ b/persistence-modules/core-java-persistence/README.md @@ -10,3 +10,4 @@ - [Guide to the JDBC ResultSet Interface](https://www.baeldung.com/jdbc-resultset) - [Types of SQL Joins](https://www.baeldung.com/sql-joins) - [Returning the Generated Keys in JDBC](https://www.baeldung.com/jdbc-returning-generated-keys) +- [Loading JDBC Drivers](https://www.baeldung.com/java-jdbc-loading-drivers) From 09441449d7997956a22feadff459b761c96f495e Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:36:52 +0800 Subject: [PATCH 0249/1862] Update README.md --- apache-shiro/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apache-shiro/README.md b/apache-shiro/README.md index ed63c569da..3a0088072f 100644 --- a/apache-shiro/README.md +++ b/apache-shiro/README.md @@ -6,4 +6,4 @@ This module contains articles about Apache Shiro - [Introduction to Apache Shiro](https://www.baeldung.com/apache-shiro) - [Permissions-Based Access Control with Apache Shiro](https://www.baeldung.com/apache-shiro-access-control) - +- [Spring Security vs Apache Shiro](https://www.baeldung.com/spring-security-vs-apache-shiro) From bf922cb955eedc299360667fef4d2e23ce018bd6 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:39:16 +0800 Subject: [PATCH 0250/1862] Update README.md --- core-java-modules/core-java-collections-3/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-collections-3/README.md b/core-java-modules/core-java-collections-3/README.md index fb983d9abc..4349ef6be3 100644 --- a/core-java-modules/core-java-collections-3/README.md +++ b/core-java-modules/core-java-collections-3/README.md @@ -3,6 +3,7 @@ ## Core Java Collections Cookbooks and Examples ### Relevant Articles: + - [Time Comparison of Arrays.sort(Object[]) and Arrays.sort(int[])](https://www.baeldung.com/arrays-sortobject-vs-sortint) - [Java ArrayList vs Vector](https://www.baeldung.com/java-arraylist-vs-vector) - [Differences Between HashMap and Hashtable](https://www.baeldung.com/hashmap-hashtable-differences) @@ -10,3 +11,4 @@ - [Performance of contains() in a HashSet vs ArrayList](https://www.baeldung.com/java-hashset-arraylist-contains-performance) - [Fail-Safe Iterator vs Fail-Fast Iterator](https://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator) - [Quick Guide to the Java Stack](https://www.baeldung.com/java-stack) +- [Convert an Array of Primitives to a List](https://www.baeldung.com/java-primitive-array-to-list) From 19a50da589b381ed9311c4d2980fe94b77967367 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:48:24 +0800 Subject: [PATCH 0251/1862] Update README.md --- core-java-modules/core-java-jvm-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-jvm-2/README.md b/core-java-modules/core-java-jvm-2/README.md index 7a189ceec5..7206a9eef7 100644 --- a/core-java-modules/core-java-jvm-2/README.md +++ b/core-java-modules/core-java-jvm-2/README.md @@ -9,4 +9,5 @@ This module contains articles about working with the Java Virtual Machine (JVM). - [Adding Shutdown Hooks for JVM Applications](https://www.baeldung.com/jvm-shutdown-hooks) - [boolean and boolean[] Memory Layout in the JVM](https://www.baeldung.com/jvm-boolean-memory-layout) - [Where Is the Array Length Stored in JVM?](https://www.baeldung.com/java-jvm-array-length) +- [Memory Address of Objects in Java](https://www.baeldung.com/java-object-memory-address) - More articles: [[<-- prev]](/core-java-modules/core-java-jvm) From 95c6b906211f862c762810eb72ee4719373ddf42 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 21:57:49 +0800 Subject: [PATCH 0252/1862] Update README.md --- algorithms-miscellaneous-6/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-6/README.md b/algorithms-miscellaneous-6/README.md index 6e435e3741..6ddae75f43 100644 --- a/algorithms-miscellaneous-6/README.md +++ b/algorithms-miscellaneous-6/README.md @@ -8,4 +8,5 @@ - [Introduction to Greedy Algorithms with Java](https://www.baeldung.com/java-greedy-algorithms) - [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher) - [Implementing a 2048 Solver in Java](https://www.baeldung.com/2048-java-solver) +- [Finding Top K Elements in an Array](https://www.baeldung.com/java-array-top-elements) - More articles: [[<-- prev]](/../algorithms-miscellaneous-5) From af79698c0bc19d157d7d0c69f4f35182e0554af3 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:02:12 +0800 Subject: [PATCH 0253/1862] Update README.md --- patterns/solid/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/patterns/solid/README.md b/patterns/solid/README.md index f5146732a0..41e986f544 100644 --- a/patterns/solid/README.md +++ b/patterns/solid/README.md @@ -3,3 +3,4 @@ - [A Solid Guide to Solid Principles](https://www.baeldung.com/solid-principles) - [Single Responsibility Principle in Java](https://www.baeldung.com/java-single-responsibility-principle) - [Open/Closed Principle in Java](https://www.baeldung.com/java-open-closed-principle) +- [Interface Segregation Principle in Java](https://www.baeldung.com/java-interface-segregation) From 66ac0239bd165bfdacd7da1ff7d3b0264701e393 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:04:14 +0800 Subject: [PATCH 0254/1862] Update README.md --- persistence-modules/core-java-persistence/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persistence-modules/core-java-persistence/README.md b/persistence-modules/core-java-persistence/README.md index 88442a94c8..a760489480 100644 --- a/persistence-modules/core-java-persistence/README.md +++ b/persistence-modules/core-java-persistence/README.md @@ -3,6 +3,7 @@ ## Core Java Persistence Examples ### Relevant Articles: + - [Introduction to JDBC](http://www.baeldung.com/java-jdbc) - [Batch Processing in JDBC](http://www.baeldung.com/jdbc-batch-processing) - [Introduction to the JDBC RowSet Interface in Java](http://www.baeldung.com/java-jdbc-rowset) @@ -11,3 +12,4 @@ - [Types of SQL Joins](https://www.baeldung.com/sql-joins) - [Returning the Generated Keys in JDBC](https://www.baeldung.com/jdbc-returning-generated-keys) - [Loading JDBC Drivers](https://www.baeldung.com/java-jdbc-loading-drivers) +- [Difference Between Statement and PreparedStatement](https://www.baeldung.com/java-statement-preparedstatement) From daae6b63eecca1b7929fcf5ebd7f295bc36245fc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:06:39 +0800 Subject: [PATCH 0255/1862] Update README.md --- spring-core-4/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-core-4/README.md b/spring-core-4/README.md index 706c330f39..83b5c4933d 100644 --- a/spring-core-4/README.md +++ b/spring-core-4/README.md @@ -11,4 +11,5 @@ This module contains articles about core Spring functionality - [Using @Autowired in Abstract Classes](https://www.baeldung.com/spring-autowired-abstract-class) - [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring) - [Constructor Injection in Spring with Lombok](https://www.baeldung.com/spring-injection-lombok) +- [The Spring ApplicationContext](https://www.baeldung.com/spring-application-context) - More articles: [[<-- prev]](/spring-core-3) From 6427ac176edd94377058d01d97283917e3f88289 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:10:10 +0800 Subject: [PATCH 0256/1862] Update README.md --- jmh/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jmh/README.md b/jmh/README.md index 3a5370c9f2..41bf16d6bb 100644 --- a/jmh/README.md +++ b/jmh/README.md @@ -5,4 +5,4 @@ This module contains articles about the Java Microbenchmark Harness (JMH). ### Relevant articles: - [Microbenchmarking with Java](https://www.baeldung.com/java-microbenchmark-harness) - +- [A Guide to False Sharing and @Contended](https://www.baeldung.com/java-false-sharing-contended) From cb9e7920a0651cd7c0dc3f5a6e0f92b4ce0fb17a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:11:49 +0800 Subject: [PATCH 0257/1862] Update README.md --- testing-modules/testing-libraries/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/testing-libraries/README.md b/testing-modules/testing-libraries/README.md index b1e1575e63..4db7fb8e7a 100644 --- a/testing-modules/testing-libraries/README.md +++ b/testing-modules/testing-libraries/README.md @@ -10,3 +10,4 @@ - [Cucumber Data Tables](https://www.baeldung.com/cucumber-data-tables) - [Cucumber Background](https://www.baeldung.com/java-cucumber-background) - [Cucumber Hooks](https://www.baeldung.com/java-cucumber-hooks) +- [Unit Testing of System.out.println() with JUnit](https://www.baeldung.com/java-testing-system-out-println) From 77f89e8b5b9f49bc4e9acbd4cbf8a6306d123aa8 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:17:28 +0800 Subject: [PATCH 0258/1862] Update README.md --- maven-modules/maven-properties/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-modules/maven-properties/README.md b/maven-modules/maven-properties/README.md index 65d976189c..52ac8506b3 100644 --- a/maven-modules/maven-properties/README.md +++ b/maven-modules/maven-properties/README.md @@ -5,4 +5,4 @@ have their own dedicated modules. ### Relevant Articles -- [Accessing Maven Properties in Java] \ No newline at end of file +- [Accessing Maven Properties in Java](https://www.baeldung.com/java-accessing-maven-properties) From 43d6584d8bb50d6937fdf9e0cb27fca9bab963a6 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:19:29 +0800 Subject: [PATCH 0259/1862] Update README.md --- core-java-modules/core-java-io-3/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md index 39752346d3..61a040c1ce 100644 --- a/core-java-modules/core-java-io-3/README.md +++ b/core-java-modules/core-java-io-3/README.md @@ -3,5 +3,7 @@ This module contains articles about core Java input and output (IO) ### Relevant Articles: + - [Java – Create a File](https://www.baeldung.com/java-how-to-create-a-file) +- [Check If a Directory Is Empty in Java](https://www.baeldung.com/java-check-empty-directory) - [[<-- Prev]](/core-java-modules/core-java-io-2) From 06a10e83536d815e2775944a11780051a8d2dcaf Mon Sep 17 00:00:00 2001 From: helga_sh Date: Thu, 23 Jul 2020 17:33:06 +0300 Subject: [PATCH 0260/1862] CNN example with Deeplearning4j in Java: add missing letter in pom --- deeplearning4j/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deeplearning4j/pom.xml b/deeplearning4j/pom.xml index e1e4998c98..8ec335b184 100644 --- a/deeplearning4j/pom.xml +++ b/deeplearning4j/pom.xml @@ -63,7 +63,7 @@ 0.9.1 4.3.5 - 1.7.5 + 1.7.5 From c67658322b281f5eff5ff9b7556f0119df607b20 Mon Sep 17 00:00:00 2001 From: helga_sh Date: Thu, 23 Jul 2020 17:33:31 +0300 Subject: [PATCH 0261/1862] CNN example with Deeplearning4j in Java: add missing letter in pom --- deeplearning4j/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deeplearning4j/pom.xml b/deeplearning4j/pom.xml index 8ec335b184..af65aa7e03 100644 --- a/deeplearning4j/pom.xml +++ b/deeplearning4j/pom.xml @@ -40,12 +40,12 @@ org.slf4j slf4j-api - ${sl4j.version} + ${slf4j.version} org.slf4j slf4j-log4j12 - ${sl4j.version} + ${slf4j.version} From 9af44b328372b1d33474feaa2a46dc6092500f19 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:41:33 +0800 Subject: [PATCH 0262/1862] Update README.md --- core-kotlin-modules/core-kotlin-collections/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-kotlin-modules/core-kotlin-collections/README.md b/core-kotlin-modules/core-kotlin-collections/README.md index dcf2743577..2ebb748cba 100644 --- a/core-kotlin-modules/core-kotlin-collections/README.md +++ b/core-kotlin-modules/core-kotlin-collections/README.md @@ -3,6 +3,7 @@ This module contains articles about core Kotlin collections. ### Relevant articles: + - [Split a List Into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts) - [Finding an Element in a List Using Kotlin](https://www.baeldung.com/kotlin-finding-element-in-list) - [Overview of Kotlin Collections API](https://www.baeldung.com/kotlin-collections-api) @@ -12,3 +13,4 @@ This module contains articles about core Kotlin collections. - [Difference between fold and reduce in Kotlin](https://www.baeldung.com/kotlin/fold-vs-reduce) - [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort) - [Working With Lists in Kotlin](https://www.baeldung.com/kotlin/lists) +- [Iterating Collections by Index in Kotlin](https://www.baeldung.com/kotlin/iterating-collections-by-index) From 04d72f9b0bbc064f69cf95a065c5c442d4578a94 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:42:52 +0800 Subject: [PATCH 0263/1862] Update README.md --- core-kotlin-modules/core-kotlin-lang-oop-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-kotlin-modules/core-kotlin-lang-oop-2/README.md b/core-kotlin-modules/core-kotlin-lang-oop-2/README.md index 27536273dc..a62a25c01d 100644 --- a/core-kotlin-modules/core-kotlin-lang-oop-2/README.md +++ b/core-kotlin-modules/core-kotlin-lang-oop-2/README.md @@ -7,4 +7,5 @@ This module contains articles about Object-Oriented Programming in Kotlin - [Generics in Kotlin](https://www.baeldung.com/kotlin-generics) - [Delegated Properties in Kotlin](https://www.baeldung.com/kotlin-delegated-properties) - [Delegation Pattern in Kotlin](https://www.baeldung.com/kotlin-delegation-pattern) +- [Anonymous Inner Classes in Kotlin](https://www.baeldung.com/kotlin/anonymous-inner-classes) - [[<-- Prev]](/core-kotlin-modules/core-kotlin-lang-oop) From d8d00f117eb341479d7294c26d2a3dd1434745a4 Mon Sep 17 00:00:00 2001 From: Cavero Barca Date: Thu, 23 Jul 2020 17:03:16 +0200 Subject: [PATCH 0264/1862] Include the following changes: - Upgrade Spring Cloud Consul to latest version - Deploy the Spring Boot version as web as described in the article - Add leadership-consul dependendencies --- spring-cloud/spring-cloud-consul/pom.xml | 29 ++++++++++++++++--- .../discovery/DiscoveryClientApplication.java | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/spring-cloud/spring-cloud-consul/pom.xml b/spring-cloud/spring-cloud-consul/pom.xml index f7f5f84c56..4d4ac0aa01 100644 --- a/spring-cloud/spring-cloud-consul/pom.xml +++ b/spring-cloud/spring-cloud-consul/pom.xml @@ -12,6 +12,13 @@ spring-cloud 1.0.0-SNAPSHOT + + + + jitpack.io + https://jitpack.io + + @@ -25,18 +32,32 @@ spring-cloud-starter-consul-config ${spring-cloud-starter-consul.version} - + + org.springframework.boot + spring-boot-starter-web + org.springframework.boot spring-boot-starter-test - ${spring-boot-starter-test.version} test + + com.github.kinguinltdhk + leadership-consul + ${kinguinltdhk.version} + + + com.ecwid.consul + consul-api + + + - 1.3.0.RELEASE - 1.5.10.RELEASE + 2.2.3.RELEASE + 0.3.1 + com.baeldung.spring.cloud.consul.discovery.DiscoveryClientApplication diff --git a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/discovery/DiscoveryClientApplication.java b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/discovery/DiscoveryClientApplication.java index e01799b8d9..e27aaf09ae 100644 --- a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/discovery/DiscoveryClientApplication.java +++ b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/discovery/DiscoveryClientApplication.java @@ -11,7 +11,7 @@ import static org.springframework.boot.WebApplicationType.NONE; public class DiscoveryClientApplication { public static void main(String[] args) { - new SpringApplicationBuilder(DiscoveryClientApplication.class).web(NONE) + new SpringApplicationBuilder(DiscoveryClientApplication.class) .run(args); } From 1441609020d1998143ecc9e9abbf43e1ac8d10e3 Mon Sep 17 00:00:00 2001 From: Cavero Barca Date: Thu, 23 Jul 2020 17:04:30 +0200 Subject: [PATCH 0265/1862] Add Leadership Election example and configuration --- .../consul/leadership/LeadershipElection.java | 16 ++++++++++++++++ .../src/main/resources/application.yml | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/leadership/LeadershipElection.java diff --git a/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/leadership/LeadershipElection.java b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/leadership/LeadershipElection.java new file mode 100644 index 0000000000..184a1e2213 --- /dev/null +++ b/spring-cloud/spring-cloud-consul/src/main/java/com/baeldung/spring/cloud/consul/leadership/LeadershipElection.java @@ -0,0 +1,16 @@ +package com.baeldung.spring.cloud.consul.leadership; + +import java.util.concurrent.ExecutionException; + +import net.kinguin.leadership.consul.factory.SimpleConsulClusterFactory; + +public class LeadershipElection { + public static void main(String[] args) throws ExecutionException, InterruptedException { + new SimpleConsulClusterFactory() + .mode(SimpleConsulClusterFactory.MODE_MULTI) + .debug(true) + .build() + .asObservable() + .subscribe(i -> System.out.println(i)); + } +} diff --git a/spring-cloud/spring-cloud-consul/src/main/resources/application.yml b/spring-cloud/spring-cloud-consul/src/main/resources/application.yml index ccdc3fdeee..85cfb35685 100644 --- a/spring-cloud/spring-cloud-consul/src/main/resources/application.yml +++ b/spring-cloud/spring-cloud-consul/src/main/resources/application.yml @@ -11,4 +11,19 @@ spring: enabled: true instanceId: ${spring.application.name}:${random.value} server: - port: 0 \ No newline at end of file + port: 0 + +cluster: + leader: + serviceName: cluster + serviceId: node-1 + consul: + host: localhost + port: 8500 + discovery: + enabled: false + session: + ttl: 15 + refresh: 7 + election: + envelopeTemplate: services/%s/leader \ No newline at end of file From 2127c7935452ca7556b65f913c598bcf36513f24 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Thu, 23 Jul 2020 19:00:08 +0200 Subject: [PATCH 0266/1862] BAEL-4289 --- .../baeldung/screenshot/ScreenshotTest.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java new file mode 100644 index 0000000000..3df31897e1 --- /dev/null +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java @@ -0,0 +1,54 @@ +import javax.imageio.ImageIO; +import java.awt.Component; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.io.File; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +public class ScreenshotTest { + + @Test + public void takeScreenshotOfMainScreen() throws Exception { + Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); + BufferedImage capture = new Robot().createScreenCapture(screenRect); + File imageFile = new File("single-screen.bmp"); + ImageIO.write(capture, "bmp", imageFile); + assertTrue(imageFile.exists()); + imageFile.delete(); + } + + @Test + public void takeScreenshotOfAllScreens() throws Exception { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] screens = ge.getScreenDevices(); + Rectangle allScreenBounds = new Rectangle(); + for (GraphicsDevice screen : screens) { + Rectangle screenBounds = screen.getDefaultConfiguration().getBounds(); + allScreenBounds.width += screenBounds.width; + allScreenBounds.height = Math.max(allScreenBounds.height, screenBounds.height); + } + BufferedImage capture = new Robot().createScreenCapture(allScreenBounds); + File imageFile = new File("all-screens.bmp"); + ImageIO.write(capture, "bmp", imageFile); + assertTrue(imageFile.exists()); + imageFile.delete(); + } + + @Test + public void makeScreenshot(Component component) throws Exception { + Rectangle componentRect = component.getBounds(); + BufferedImage bufferedImage = new BufferedImage(componentRect.width, componentRect.height, BufferedImage.TYPE_INT_ARGB); + component.paint(bufferedImage.getGraphics()); + File imageFile = new File("component-screenshot.bmp"); + ImageIO.write(bufferedImage, "bmp", imageFile); + assertTrue(imageFile.exists()); + imageFile.delete(); + } + +} \ No newline at end of file From 9c0eba409e86db1e7b609bb53db075b914cd5ec6 Mon Sep 17 00:00:00 2001 From: mdabrowski-eu Date: Thu, 23 Jul 2020 19:29:59 +0200 Subject: [PATCH 0267/1862] BAEL-4405 Probability in Java --- .../probability/MaleHeightGenerator.java | 17 +++++++++++++ .../baeldung/probability/RandomInvoker.java | 19 +++++++++++++++ .../probability/RandomInvokerUnitTest.java | 24 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 java-numbers-3/src/main/java/com/baeldung/probability/MaleHeightGenerator.java create mode 100644 java-numbers-3/src/main/java/com/baeldung/probability/RandomInvoker.java create mode 100644 java-numbers-3/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java diff --git a/java-numbers-3/src/main/java/com/baeldung/probability/MaleHeightGenerator.java b/java-numbers-3/src/main/java/com/baeldung/probability/MaleHeightGenerator.java new file mode 100644 index 0000000000..ed3fb8a578 --- /dev/null +++ b/java-numbers-3/src/main/java/com/baeldung/probability/MaleHeightGenerator.java @@ -0,0 +1,17 @@ +package com.baeldung.probability; + +import org.apache.commons.math3.distribution.NormalDistribution; + +public class MaleHeightGenerator { + private static final double MEAN_HEIGHT = 176.02; + private static final double STANDARD_DEVIATION = 7.11; + private static NormalDistribution distribution = new NormalDistribution(MEAN_HEIGHT, STANDARD_DEVIATION); + + public static double generateNormalHeight() { + return distribution.sample(); + } + + public static double probabilityOfHeightBetween(double heightLowerExclusive, double heightUpperInclusive) { + return distribution.probability(heightLowerExclusive, heightUpperInclusive); + } +} diff --git a/java-numbers-3/src/main/java/com/baeldung/probability/RandomInvoker.java b/java-numbers-3/src/main/java/com/baeldung/probability/RandomInvoker.java new file mode 100644 index 0000000000..30be5725ab --- /dev/null +++ b/java-numbers-3/src/main/java/com/baeldung/probability/RandomInvoker.java @@ -0,0 +1,19 @@ +package com.baeldung.probability; + +import io.vavr.Lazy; + +import java.util.SplittableRandom; +import java.util.function.Supplier; + +public class RandomInvoker { + private final Lazy random = Lazy.of(SplittableRandom::new); + + public T withProbability(Supplier supplier1, Supplier supplier2, int probability) { + SplittableRandom random = this.random.get(); + if (random.nextInt(1, 101) <= probability) { + return supplier1.get(); + } else { + return supplier2.get(); + } + } +} diff --git a/java-numbers-3/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java b/java-numbers-3/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java new file mode 100644 index 0000000000..b08c086e30 --- /dev/null +++ b/java-numbers-3/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.probability; + +import org.assertj.core.data.Offset; +import org.junit.Test; + +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +public class RandomInvokerUnitTest { + @Test + public void givenProbability_whenInvoked_invokeWithProbability() { + RandomInvoker randomInvoker = new RandomInvoker(); + + int numberOfSamples = 1_000_000; + int probability = 10; + int howManyTimesInvoked = Stream.generate(() -> randomInvoker.withProbability(() -> 1, () -> 0, probability)) + .limit(numberOfSamples) + .mapToInt(e -> e).sum(); + int monteCarloProbability = (howManyTimesInvoked * 100) / numberOfSamples; + + assertThat(monteCarloProbability).isCloseTo(probability, Offset.offset(1)); + } +} From c4770ac40f83ee773426004fd8a4168b57a37aa5 Mon Sep 17 00:00:00 2001 From: karan Date: Fri, 24 Jul 2020 01:08:45 -0400 Subject: [PATCH 0268/1862] add another defaultpathvariable method --- .../pathvariable/PathVariableAnnotationController.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java b/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java index 624ba2d105..37e104f354 100644 --- a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java +++ b/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java @@ -66,6 +66,16 @@ public class PathVariableAnnotationController { } } + @GetMapping(value = { "/api/defaultemployeeswithoptional", "/api/defaultemployeeswithoptional/{id}" }) + @ResponseBody + public String getDefaultEmployeesByIdWithOptional(@PathVariable Optional id) { + if (id.isPresent()) { + return "ID: " + id.get(); + } else { + return "ID: Default Employee"; + } + } + @GetMapping(value = { "/api/employeeswithmap/{id}", "/api/employeeswithmap" }) @ResponseBody public String getEmployeesByIdWithMap(@PathVariable Map pathVarsMap) { From 9057d216f25eeee3dccf7c839ba212bd480136f0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 24 Jul 2020 13:24:43 +0800 Subject: [PATCH 0269/1862] Update README.md --- core-java-modules/core-java-security-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-security-2/README.md b/core-java-modules/core-java-security-2/README.md index 24a821bd4d..ba8cce46a0 100644 --- a/core-java-modules/core-java-security-2/README.md +++ b/core-java-modules/core-java-security-2/README.md @@ -9,4 +9,5 @@ This module contains articles about core Java Security - [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing) - [SHA-256 and SHA3-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java) - [Checksums in Java](https://www.baeldung.com/java-checksums) +- [How to Read PEM File to Get Public and Private Keys](https://www.baeldung.com/java-read-pem-file-keys) - More articles: [[<-- prev]](/core-java-modules/core-java-security) From b1a9ee6282ff3f4661b415325880568d293d67c0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 24 Jul 2020 13:26:05 +0800 Subject: [PATCH 0270/1862] Update README.md --- libraries-security/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-security/README.md b/libraries-security/README.md index 580ebdeab0..5ec85a15e9 100644 --- a/libraries-security/README.md +++ b/libraries-security/README.md @@ -10,3 +10,4 @@ This module contains articles about security libraries. - [Introduction to BouncyCastle with Java](https://www.baeldung.com/java-bouncy-castle) - [Intro to Jasypt](https://www.baeldung.com/jasypt) - [Digital Signatures in Java](https://www.baeldung.com/java-digital-signature) +- [How to Read PEM File to Get Public and Private Keys](https://www.baeldung.com/java-read-pem-file-keys) From 0a2f6a4615f6f751942e1f8a6da477c02a42316c Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Fri, 24 Jul 2020 20:13:23 +0530 Subject: [PATCH 0271/1862] Added code to set a field using Reflection. --- .../reflection/set/fields/Person.java | 87 +++++++++ .../SetFieldsUsingReflectionUnitTest.java | 182 ++++++++++++++++++ 2 files changed, 269 insertions(+) create mode 100644 core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/set/fields/Person.java create mode 100644 core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java diff --git a/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/set/fields/Person.java b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/set/fields/Person.java new file mode 100644 index 0000000000..6bdfc58d78 --- /dev/null +++ b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/set/fields/Person.java @@ -0,0 +1,87 @@ +package com.baeldung.reflection.set.fields; + +public class Person { + + private String name; + private byte age; + private short uidNumber; + private int pinCode; + private long contactNumber; + private float height; + private double weight; + private char gender; + private boolean active; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public byte getAge() { + return age; + } + + public void setAge(byte age) { + this.age = age; + } + + public short getUidNumber() { + return uidNumber; + } + + public void setUidNumber(short uidNumber) { + this.uidNumber = uidNumber; + } + + public int getPinCode() { + return pinCode; + } + + public void setPinCode(int pinCode) { + this.pinCode = pinCode; + } + + public long getContactNumber() { + return contactNumber; + } + + public void setContactNumber(long contactNumber) { + this.contactNumber = contactNumber; + } + + public float getHeight() { + return height; + } + + public void setHeight(float height) { + this.height = height; + } + + public double getWeight() { + return weight; + } + + public void setWeight(double weight) { + this.weight = weight; + } + + public char getGender() { + return gender; + } + + public void setGender(char gender) { + this.gender = gender; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + +} diff --git a/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java new file mode 100644 index 0000000000..18a378cf07 --- /dev/null +++ b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java @@ -0,0 +1,182 @@ +package com.baeldung.reflection.set.fields; + +import java.lang.reflect.Field; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class SetFieldsUsingReflectionUnitTest { + + @Test + public void whenSetIntegerFields_thenSuccess() throws Exception { + Person person = new Person(); + + Field ageField = person.getClass() + .getDeclaredField("age"); + ageField.setAccessible(true); + + byte age = 26; + ageField.setByte(person, age); + Assertions.assertEquals(26, person.getAge()); + + Field uidNumberField = person.getClass() + .getDeclaredField("uidNumber"); + uidNumberField.setAccessible(true); + + short uidNumber = 5555; + uidNumberField.setShort(person, uidNumber); + Assertions.assertEquals(5555, person.getUidNumber()); + + Field pinCodeField = person.getClass() + .getDeclaredField("pinCode"); + pinCodeField.setAccessible(true); + + int pinCode = 411057; + pinCodeField.setInt(person, pinCode); + Assertions.assertEquals(411057, person.getPinCode()); + + Field contactNumberField = person.getClass() + .getDeclaredField("contactNumber"); + contactNumberField.setAccessible(true); + + long contactNumber = 123456789L; + contactNumberField.setLong(person, contactNumber); + Assertions.assertEquals(123456789L, person.getContactNumber()); + + } + + @Test + public void whenDoUnboxing_thenSuccess() throws Exception { + Person person = new Person(); + + Field pinCodeField = person.getClass() + .getDeclaredField("pinCode"); + pinCodeField.setAccessible(true); + + Integer pinCode = 411057; + pinCodeField.setInt(person, pinCode); + Assertions.assertEquals(411057, person.getPinCode()); + } + + @Test + public void whenDoNarrowing_thenSuccess() throws Exception { + Person person = new Person(); + + Field pinCodeField = person.getClass() + .getDeclaredField("pinCode"); + pinCodeField.setAccessible(true); + + Short pinCode = 4110; + pinCodeField.setInt(person, pinCode); + Assertions.assertEquals(4110, person.getPinCode()); + } + + @Test + public void whenSetFloatingTypeFields_thenSuccess() throws Exception { + Person person = new Person(); + + Field heightField = person.getClass() + .getDeclaredField("height"); + heightField.setAccessible(true); + + float height = 6.1242f; + heightField.setFloat(person, height); + Assertions.assertEquals(6.1242f, person.getHeight()); + + Field weightField = person.getClass() + .getDeclaredField("weight"); + weightField.setAccessible(true); + + double weight = 75.2564; + weightField.setDouble(person, weight); + Assertions.assertEquals(75.2564, person.getWeight()); + } + + @Test + public void whenSetCharacterFields_thenSuccess() throws Exception { + Person person = new Person(); + + Field genderField = person.getClass() + .getDeclaredField("gender"); + genderField.setAccessible(true); + + char gender = 'M'; + genderField.setChar(person, gender); + Assertions.assertEquals('M', person.getGender()); + } + + @Test + public void whenSetBooleanFields_thenSuccess() throws Exception { + Person person = new Person(); + + Field activeField = person.getClass() + .getDeclaredField("active"); + activeField.setAccessible(true); + + boolean active = true; + activeField.setBoolean(person, active); + Assertions.assertTrue(person.isActive()); + } + + @Test + public void whenSetObjectFields_thenSuccess() throws Exception { + Person person = new Person(); + + Field nameField = person.getClass() + .getDeclaredField("name"); + nameField.setAccessible(true); + + String name = "Umang Budhwar"; + nameField.set(person, name); + Assertions.assertEquals("Umang Budhwar", person.getName()); + } + + @Test + public void givenInt_whenSetStringField_thenIllegalArgumentException() throws Exception { + Person person = new Person(); + Field nameField = person.getClass() + .getDeclaredField("name"); + nameField.setAccessible(true); + + Assertions.assertThrows(IllegalArgumentException.class, () -> nameField.setInt(person, 26)); + } + + @Test + public void givenInt_whenSetLongField_thenIllegalArgumentException() throws Exception { + Person person = new Person(); + + Field pinCodeField = person.getClass() + .getDeclaredField("pinCode"); + pinCodeField.setAccessible(true); + + long pinCode = 411057L; + + Assertions.assertThrows(IllegalArgumentException.class, () -> pinCodeField.setLong(person, pinCode)); + } + + @Test + public void whenFieldNotSetAccessible_thenIllegalAccessException() throws Exception { + Person person = new Person(); + Field nameField = person.getClass() + .getDeclaredField("name"); + + Assertions.assertThrows(IllegalAccessException.class, () -> nameField.set(person, "Umang Budhwar")); + } + + @Test + public void whenAccessingWrongProperty_thenNoSuchFieldException() throws Exception { + Person person = new Person(); + + Assertions.assertThrows(NoSuchFieldException.class, () -> person.getClass() + .getDeclaredField("firstName")); + } + + @Test + public void whenAccessingNullProperty_thenNullPointerException() throws Exception { + Person person = new Person(); + + Assertions.assertThrows(NullPointerException.class, () -> person.getClass() + .getDeclaredField(null)); + } + +} From a6929d1cab9680b528c647cc5988d4cf07040923 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Sat, 25 Jul 2020 01:15:42 +0530 Subject: [PATCH 0272/1862] Added System.out --- .../src/main/java/com/baeldung/consoleout/ConsoleAndOut.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java index 5a327dbe62..70711cacec 100644 --- a/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java +++ b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java @@ -9,5 +9,7 @@ public class ConsoleAndOut { char[] password = console.readPassword("Enter password:"); console.printf(String.valueOf(password)); + + System.out.println(System.out); } } From 41c8fa83ef69a11fa8d5ba63d03e1cd6e0a6e825 Mon Sep 17 00:00:00 2001 From: rdevarakonda Date: Sat, 25 Jul 2020 10:43:52 +0100 Subject: [PATCH 0273/1862] BAEL-4006 | Liskov Substitution Principle in Java (#9431) * BAEL-4006 | Liskov Substitution Principle in Java * BAEL-4006 | UNDO unintentional commit to pom.xml * BAEL-4006 | Code review feedback implementation * BAEL-4006 | Changes made to support the article review feedback implementation * BAEL-4006 | Minor change to a comment --- .../java/com/baeldung/l/advanced/Account.java | 17 +++++++++++ .../advanced/BankingAppWithdrawalService.java | 15 ++++++++++ .../java/com/baeldung/l/advanced/Bar.java | 27 ++++++++++++++++++ .../java/com/baeldung/l/advanced/Car.java | 26 +++++++++++++++++ .../baeldung/l/advanced/CurrentAccount.java | 15 ++++++++++ .../com/baeldung/l/advanced/ElectricCar.java | 23 +++++++++++++++ .../baeldung/l/advanced/FilePurgingJob.java | 18 ++++++++++++ .../com/baeldung/l/advanced/FileSystem.java | 10 +++++++ .../l/advanced/FixedTermDepositAccount.java | 15 ++++++++++ .../java/com/baeldung/l/advanced/Foo.java | 22 +++++++++++++++ .../com/baeldung/l/advanced/HybridCar.java | 28 +++++++++++++++++++ .../com/baeldung/l/advanced/MotorCar.java | 25 +++++++++++++++++ .../l/advanced/ReadOnlyFileSystem.java | 16 +++++++++++ .../baeldung/l/advanced/SavingsAccount.java | 15 ++++++++++ .../java/com/baeldung/l/advanced/ToyCar.java | 24 ++++++++++++++++ .../l/advanced/refactored/Account.java | 7 +++++ .../BankingAppWithdrawalService.java | 17 +++++++++++ .../l/advanced/refactored/CurrentAccount.java | 13 +++++++++ .../refactored/FixedTermDepositAccount.java | 9 ++++++ .../l/advanced/refactored/SavingsAccount.java | 13 +++++++++ .../refactored/WithdrawableAccount.java | 14 ++++++++++ 21 files changed, 369 insertions(+) create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/Account.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/BankingAppWithdrawalService.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/Bar.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/Car.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/CurrentAccount.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/ElectricCar.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/FilePurgingJob.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/FileSystem.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/FixedTermDepositAccount.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/Foo.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/HybridCar.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/MotorCar.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/ReadOnlyFileSystem.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/SavingsAccount.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/ToyCar.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/Account.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/BankingAppWithdrawalService.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/CurrentAccount.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/FixedTermDepositAccount.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/SavingsAccount.java create mode 100644 patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/WithdrawableAccount.java diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/Account.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/Account.java new file mode 100644 index 0000000000..3a8260924b --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/Account.java @@ -0,0 +1,17 @@ +package com.baeldung.l.advanced; + +import java.math.BigDecimal; + +public abstract class Account { + protected abstract void deposit(BigDecimal amount); + + /** + * Reduces the account balance by the specified amount + * provided given amount > 0 and account meets minimum available + * balance criteria. + * + * @param amount + */ + protected abstract void withdraw(BigDecimal amount); + +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/BankingAppWithdrawalService.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/BankingAppWithdrawalService.java new file mode 100644 index 0000000000..6689b1dc8c --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/BankingAppWithdrawalService.java @@ -0,0 +1,15 @@ +package com.baeldung.l.advanced; + +import java.math.BigDecimal; + +public class BankingAppWithdrawalService { + private Account account; + + public BankingAppWithdrawalService(Account account) { + this.account = account; + } + + public void withdraw(BigDecimal amount) { + account.withdraw(amount); + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/Bar.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/Bar.java new file mode 100644 index 0000000000..8f421cebaa --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/Bar.java @@ -0,0 +1,27 @@ +package com.baeldung.l.advanced; + +public class Bar extends Foo { + + @Override + // precondition: 0 < num <= 10 + public void doStuff(int num) { + if (num <= 0 || num > 10) { + throw new IllegalArgumentException("Input out of range 1-10"); + } + // some logic here... + } + + @Override + // precondition: 0 < num <= 3 + public void doOtherStuff(int num) { + if (num <= 0 || num > 3) { + throw new IllegalArgumentException("Input out of range 1-3"); + } + // some logic here... + } + + @Override + public Integer generateNumber() { + return new Integer(10); + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/Car.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/Car.java new file mode 100644 index 0000000000..48688d9a45 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/Car.java @@ -0,0 +1,26 @@ +package com.baeldung.l.advanced; + +public abstract class Car { + protected int limit; + + // invariant: speed < limit; + protected int speed; + + // Allowed to be set once at the time of creation. + // Value can only increment thereafter. + // Value cannot be reset. + protected int mileage; + + public Car(int mileage) { + this.mileage = mileage; + } + + protected abstract void turnOnEngine(); + + // postcondition: speed < limit + protected abstract void accelerate(); + + // postcondition: speed must reduce + protected abstract void brake(); + +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/CurrentAccount.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/CurrentAccount.java new file mode 100644 index 0000000000..7187582126 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/CurrentAccount.java @@ -0,0 +1,15 @@ +package com.baeldung.l.advanced; + +import java.math.BigDecimal; + +public class CurrentAccount extends Account { + @Override + protected void deposit(BigDecimal amount) { + // Deposit into CurrentAccount + } + + @Override + protected void withdraw(BigDecimal amount) { + // Withdraw from CurrentAccount + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/ElectricCar.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/ElectricCar.java new file mode 100644 index 0000000000..ca78af633f --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/ElectricCar.java @@ -0,0 +1,23 @@ +package com.baeldung.l.advanced; + +public class ElectricCar extends Car { + + public ElectricCar(int mileage) { + super(mileage); + } + + @Override + protected void turnOnEngine() { + throw new AssertionError("I am an Electric Car. I don't have an engine!"); + } + + @Override + protected void accelerate() { + // this acceleration is crazy! + } + + @Override + protected void brake() { + // Apply ElectricCar brake + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/FilePurgingJob.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/FilePurgingJob.java new file mode 100644 index 0000000000..57334696b0 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/FilePurgingJob.java @@ -0,0 +1,18 @@ +package com.baeldung.l.advanced; + +import java.io.IOException; + +public class FilePurgingJob { + private FileSystem fileSystem; + + public FilePurgingJob(FileSystem fileSystem) { + this.fileSystem = fileSystem; + } + + public void purgeOldestFile(String path) throws IOException { + if (!(fileSystem instanceof ReadOnlyFileSystem)) { + // code to detect oldest file + fileSystem.deleteFile(path); + } + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/FileSystem.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/FileSystem.java new file mode 100644 index 0000000000..00a8fb8ec7 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/FileSystem.java @@ -0,0 +1,10 @@ +package com.baeldung.l.advanced; + +import java.io.File; +import java.io.IOException; + +public interface FileSystem { + File[] listFiles(String path); + + void deleteFile(String path) throws IOException; +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/FixedTermDepositAccount.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/FixedTermDepositAccount.java new file mode 100644 index 0000000000..50dd4f3d17 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/FixedTermDepositAccount.java @@ -0,0 +1,15 @@ +package com.baeldung.l.advanced; + +import java.math.BigDecimal; + +public class FixedTermDepositAccount extends Account { + @Override + protected void deposit(BigDecimal amount) { + // Deposit into this account + } + + @Override + protected void withdraw(BigDecimal amount) { + throw new UnsupportedOperationException("Withdrawals are not supported by FixedTermDepositAccount!!"); + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/Foo.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/Foo.java new file mode 100644 index 0000000000..f61577c18f --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/Foo.java @@ -0,0 +1,22 @@ +package com.baeldung.l.advanced; + +public abstract class Foo { + + // precondition: 0 < num <=5 + public void doStuff(int num) { + if (num <= 0 || num > 5) { + throw new IllegalArgumentException("Input out of range 1-5"); + } + // some logic here... + } + + // precondition: 0 < num <=5 + public void doOtherStuff(int num) { + if (num <= 0 || num > 5) { + throw new IllegalArgumentException("Input out of range 1-5"); + } + // some logic here... + } + + public abstract Number generateNumber(); +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/HybridCar.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/HybridCar.java new file mode 100644 index 0000000000..ea643a7419 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/HybridCar.java @@ -0,0 +1,28 @@ +package com.baeldung.l.advanced; + +public class HybridCar extends Car { + // invariant: charge >= 0; + private int charge; + + public HybridCar(int mileage) { + super(mileage); + } + + @Override + protected void turnOnEngine() { + // Start HybridCar + } + + @Override + // postcondition: speed < limit + protected void accelerate() { + // Accelerate HybridCar speed < limit + } + + @Override + // postcondition: speed must reduce + // postcondition: charge must increase + protected void brake() { + // Apply HybridCar brake + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/MotorCar.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/MotorCar.java new file mode 100644 index 0000000000..68a54966cc --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/MotorCar.java @@ -0,0 +1,25 @@ +package com.baeldung.l.advanced; + +public class MotorCar extends Car { + + public MotorCar(int mileage) { + super(mileage); + } + + @Override + protected void turnOnEngine() { + // Start MotorCar + } + + @Override + // postcondition: speed < limit + protected void accelerate() { + // Accelerate MotorCar + } + + @Override + // postcondition: speed must reduce + protected void brake() { + // Apply MotorCar brake + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/ReadOnlyFileSystem.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/ReadOnlyFileSystem.java new file mode 100644 index 0000000000..6ba3d9770d --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/ReadOnlyFileSystem.java @@ -0,0 +1,16 @@ +package com.baeldung.l.advanced; + +import java.io.File; +import java.io.IOException; + +public class ReadOnlyFileSystem implements FileSystem { + public File[] listFiles(String path) { + // code to list files + return new File[0]; + } + + public void deleteFile(String path) throws IOException { + // Do nothing. + // deleteFile operation is not supported on a read-only file system + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/SavingsAccount.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/SavingsAccount.java new file mode 100644 index 0000000000..8dbb5eb4d4 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/SavingsAccount.java @@ -0,0 +1,15 @@ +package com.baeldung.l.advanced; + +import java.math.BigDecimal; + +public class SavingsAccount extends Account { + @Override + protected void deposit(BigDecimal amount) { + // Deposit into SavingsAccount + } + + @Override + protected void withdraw(BigDecimal amount) { + // Withdraw from SavingsAccount + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/ToyCar.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/ToyCar.java new file mode 100644 index 0000000000..a41694deef --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/ToyCar.java @@ -0,0 +1,24 @@ +package com.baeldung.l.advanced; + +public class ToyCar extends Car { + + public ToyCar(int mileage) { + super(mileage); + } + + protected void turnOnEngine() { + + } + + protected void accelerate() { + + } + + protected void brake() { + + } + + public void reset() { + mileage = 0; + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/Account.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/Account.java new file mode 100644 index 0000000000..cb950df164 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/Account.java @@ -0,0 +1,7 @@ +package com.baeldung.l.advanced.refactored; + +import java.math.BigDecimal; + +public abstract class Account { + protected abstract void deposit(BigDecimal amount); +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/BankingAppWithdrawalService.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/BankingAppWithdrawalService.java new file mode 100644 index 0000000000..cbb375dd52 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/BankingAppWithdrawalService.java @@ -0,0 +1,17 @@ +package com.baeldung.l.advanced.refactored; + +import com.baeldung.l.advanced.Account; + +import java.math.BigDecimal; + +public class BankingAppWithdrawalService { + private WithdrawableAccount withdrawableAccount; + + public BankingAppWithdrawalService(WithdrawableAccount withdrawableAccount) { + this.withdrawableAccount = withdrawableAccount; + } + + public void withdraw(BigDecimal amount) { + withdrawableAccount.withdraw(amount); + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/CurrentAccount.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/CurrentAccount.java new file mode 100644 index 0000000000..5b5b9efe04 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/CurrentAccount.java @@ -0,0 +1,13 @@ +package com.baeldung.l.advanced.refactored; + +import java.math.BigDecimal; + +public class CurrentAccount extends WithdrawableAccount { + protected void deposit(BigDecimal amount) { + // Deposit into CurrentAccount + } + + protected void withdraw(BigDecimal amount) { + // Withdraw from CurrentAccount + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/FixedTermDepositAccount.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/FixedTermDepositAccount.java new file mode 100644 index 0000000000..14461b85a3 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/FixedTermDepositAccount.java @@ -0,0 +1,9 @@ +package com.baeldung.l.advanced.refactored; + +import java.math.BigDecimal; + +public class FixedTermDepositAccount extends Account { + protected void deposit(BigDecimal amount) { + // Deposit into this account + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/SavingsAccount.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/SavingsAccount.java new file mode 100644 index 0000000000..45c50079bf --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/SavingsAccount.java @@ -0,0 +1,13 @@ +package com.baeldung.l.advanced.refactored; + +import java.math.BigDecimal; + +public class SavingsAccount extends WithdrawableAccount { + protected void deposit(BigDecimal amount) { + // Deposit into SavingsAccount + } + + protected void withdraw(BigDecimal amount) { + // Withdraw from SavingsAccount + } +} diff --git a/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/WithdrawableAccount.java b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/WithdrawableAccount.java new file mode 100644 index 0000000000..b3c7606cb7 --- /dev/null +++ b/patterns/solid/src/main/java/com/baeldung/l/advanced/refactored/WithdrawableAccount.java @@ -0,0 +1,14 @@ +package com.baeldung.l.advanced.refactored; + +import java.math.BigDecimal; + +public abstract class WithdrawableAccount extends Account { + /** + * Reduces the account balance by the specified amount + * provided given amount > 0 and account meets minimum available + * balance criteria. + * + * @param amount + */ + protected abstract void withdraw(BigDecimal amount); +} From 4128525f001c44f716d67971e3a6ff746a6cd7b0 Mon Sep 17 00:00:00 2001 From: Roger <587230+rojyates@users.noreply.github.com> Date: Sat, 25 Jul 2020 23:45:41 +1000 Subject: [PATCH 0274/1862] BAEL-1258 Added example code for Jess and JSR94 (#9693) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * BAEL-1258 Added example code for Jess and JSR94 * BAEL-1258 Relocate to rule-modules * BAEL-1258 Remove README as per PR review * šBAEL-1258 Declared exceptions and replace System.out.println with log statements * BAEL-1258 Removed Lombok * BAEL-1258 Removed Lombok * BAEL-1258 Rename artifactId to match directory name --- rule-engines/jess/pom.xml | 25 +++++ .../com/baeldung/rules/jess/JessHello.java | 17 ++++ .../com/baeldung/rules/jess/JessWithData.java | 42 ++++++++ .../baeldung/rules/jess/JessWithJsr94.java | 98 +++++++++++++++++++ .../com/baeldung/rules/jess/model/Answer.java | 31 ++++++ .../baeldung/rules/jess/model/Question.java | 32 ++++++ .../jess/src/main/resources/bonus.clp | 8 ++ .../jess/src/main/resources/helloJess.clp | 3 + 8 files changed, 256 insertions(+) create mode 100644 rule-engines/jess/pom.xml create mode 100644 rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessHello.java create mode 100644 rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessWithData.java create mode 100644 rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessWithJsr94.java create mode 100644 rule-engines/jess/src/main/java/com/baeldung/rules/jess/model/Answer.java create mode 100644 rule-engines/jess/src/main/java/com/baeldung/rules/jess/model/Question.java create mode 100644 rule-engines/jess/src/main/resources/bonus.clp create mode 100644 rule-engines/jess/src/main/resources/helloJess.clp diff --git a/rule-engines/jess/pom.xml b/rule-engines/jess/pom.xml new file mode 100644 index 0000000000..40d50fae70 --- /dev/null +++ b/rule-engines/jess/pom.xml @@ -0,0 +1,25 @@ + + + 4.0.0 + + com.baeldung.rules.jess + jess + 1.0-SNAPSHOT + + + + + jsr94 + jsr94 + 1.1 + + + gov.sandia + jess + 7.1p2 + + + + \ No newline at end of file diff --git a/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessHello.java b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessHello.java new file mode 100644 index 0000000000..1462996a4c --- /dev/null +++ b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessHello.java @@ -0,0 +1,17 @@ +package com.baeldung.rules.jess; + +import jess.JessException; +import jess.Rete; + +public class JessHello { + public static final String RULES_FILE = "helloJess.clp"; + + public static void main(String[] args) throws JessException { + Rete engine = new Rete(); + engine.reset(); + + engine.batch(RULES_FILE); + + engine.run(); + } +} diff --git a/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessWithData.java b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessWithData.java new file mode 100644 index 0000000000..5d5dc9b983 --- /dev/null +++ b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessWithData.java @@ -0,0 +1,42 @@ +package com.baeldung.rules.jess; + +import com.baeldung.rules.jess.model.Answer; +import com.baeldung.rules.jess.model.Question; +import jess.Filter; +import jess.JessException; +import jess.Rete; + +import java.util.Iterator; +import java.util.logging.Logger; + +public class JessWithData { + public static final String RULES_BONUS_FILE = "bonus.clp"; + private static Logger log = Logger.getLogger("JessWithData"); + + public static void main(String[] args) throws JessException { + Rete engine = new Rete(); + engine.reset(); + + engine.batch(RULES_BONUS_FILE); + + prepareData(engine); + + engine.run(); + + checkResults(engine); + } + + private static void checkResults(Rete engine) { + Iterator results = engine.getObjects(new Filter.ByClass(Answer.class)); + while (results.hasNext()) { + Answer answer = (Answer) results.next(); + log.info(answer.toString()); + } + } + + private static void prepareData(Rete engine) throws JessException { + Question question = new Question("Can I have a bonus?", -5); + log.info(question.toString()); + engine.add(question); + } +} diff --git a/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessWithJsr94.java b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessWithJsr94.java new file mode 100644 index 0000000000..f07bf10a7a --- /dev/null +++ b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/JessWithJsr94.java @@ -0,0 +1,98 @@ +package com.baeldung.rules.jess; + +import com.baeldung.rules.jess.model.Answer; +import com.baeldung.rules.jess.model.Question; + +import javax.rules.*; +import javax.rules.admin.RuleAdministrator; +import javax.rules.admin.RuleExecutionSet; +import javax.rules.admin.RuleExecutionSetCreateException; +import javax.rules.admin.RuleExecutionSetRegisterException; +import java.io.IOException; +import java.io.InputStream; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Logger; + +public class JessWithJsr94 { + public static final String RULES_BONUS_FILE = "/bonus.clp"; + public static final String RULES_URI = "com/baeldung/rules/bonus"; + private static final String RULE_SERVICE_PROVIDER = "jess.jsr94"; + private static Logger log = Logger.getLogger("JessWithData"); + + public static void main(String[] args) throws Exception { + RuleServiceProvider ruleServiceProvider = instantiateJessInstance(); + + // load our rules and register them with the rules provider + registerRules(RULES_BONUS_FILE, RULES_URI, ruleServiceProvider); + + runRules(RULES_URI, ruleServiceProvider); + } + + private static RuleServiceProvider instantiateJessInstance() throws ClassNotFoundException, ConfigurationException { + // Load the rule service provider of the reference implementation. + // Loading this class will automatically register this provider with the provider manager. + Class.forName(RULE_SERVICE_PROVIDER + ".RuleServiceProviderImpl"); + + // Get the rule service provider from the provider manager. + return RuleServiceProviderManager.getRuleServiceProvider(RULE_SERVICE_PROVIDER); + } + + private static void runRules(String rulesURI, RuleServiceProvider ruleServiceProvider) + throws ConfigurationException, RuleSessionTypeUnsupportedException, RuleSessionCreateException, RuleExecutionSetNotFoundException, RemoteException, InvalidRuleSessionException { + // Get a RuleRuntime and invoke the rule engine. + RuleRuntime ruleRuntime = ruleServiceProvider.getRuleRuntime(); + + //Create a statelessRuleSession. + StatelessRuleSession statelessRuleSession = (StatelessRuleSession) ruleRuntime.createRuleSession(rulesURI, new HashMap(), RuleRuntime.STATELESS_SESSION_TYPE); + + calculateResults(statelessRuleSession); + + statelessRuleSession.release(); + } + + private static void calculateResults(StatelessRuleSession statelessRuleSession) throws InvalidRuleSessionException, RemoteException { + List data = prepareData(); + + // execute the rules + List results = statelessRuleSession.executeRules(data); + + checkResults(results); + } + + private static List prepareData() { + List data = new ArrayList(); + data.add(new Question("Can I have a bonus?", -5)); + return data; + } + + private static void checkResults(List results) { + Iterator itr = results.iterator(); + while (itr.hasNext()) { + Object obj = itr.next(); + if (obj instanceof Answer) { + log.info(obj.toString()); + } + } + } + + private static void registerRules(String rulesFile, String rulesURI, RuleServiceProvider serviceProvider) throws ConfigurationException, RuleExecutionSetCreateException, IOException, RuleExecutionSetRegisterException { + // Get the rule administrator. + RuleAdministrator ruleAdministrator = serviceProvider.getRuleAdministrator(); + + // load the rules + InputStream ruleInput = JessWithJsr94.class.getResourceAsStream(rulesFile); + HashMap vendorProperties = new HashMap(); + + // Create the RuleExecutionSet + RuleExecutionSet ruleExecutionSet = ruleAdministrator + .getLocalRuleExecutionSetProvider(vendorProperties) + .createRuleExecutionSet(ruleInput, vendorProperties); + + // Register the rule execution set. + ruleAdministrator.registerRuleExecutionSet(rulesURI, ruleExecutionSet, vendorProperties); + } +} \ No newline at end of file diff --git a/rule-engines/jess/src/main/java/com/baeldung/rules/jess/model/Answer.java b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/model/Answer.java new file mode 100644 index 0000000000..d690d04e13 --- /dev/null +++ b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/model/Answer.java @@ -0,0 +1,31 @@ +package com.baeldung.rules.jess.model; + +public class Answer { + private String answer; + private int newBalance; + + public Answer(String answer, int newBalance) { + this.answer = answer; + this.newBalance = newBalance; + } + + public int getNewBalance() { + return newBalance; + } + + public void setNewBalance(int newBalance) { + this.newBalance = newBalance; + } + + public String getAnswer() { + return answer; + } + + public void setAnswer(String answer) { + this.answer = answer; + } + + public String toString() { + return "Answer(answer=" + answer + ", newBalance=" + newBalance + ")"; + } +} diff --git a/rule-engines/jess/src/main/java/com/baeldung/rules/jess/model/Question.java b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/model/Question.java new file mode 100644 index 0000000000..499113d0fc --- /dev/null +++ b/rule-engines/jess/src/main/java/com/baeldung/rules/jess/model/Question.java @@ -0,0 +1,32 @@ +package com.baeldung.rules.jess.model; + +public class Question { + private String question; + private int balance; + + public Question(String question, int balance) { + this.question = question; + this.balance = balance; + } + + public String getQuestion() { + return question; + } + + public void setQuestion(String question) { + this.question = question; + } + + public int getBalance() { + return balance; + } + + public void setBalance(int balance) { + this.balance = balance; + } + + public String toString() { + return "Question(question=" + question + ", balance=" + balance + ")"; + } + +} diff --git a/rule-engines/jess/src/main/resources/bonus.clp b/rule-engines/jess/src/main/resources/bonus.clp new file mode 100644 index 0000000000..7f430bc43f --- /dev/null +++ b/rule-engines/jess/src/main/resources/bonus.clp @@ -0,0 +1,8 @@ +(import com.baeldung.rules.jess.model.*) +(deftemplate Question (declare (from-class Question))) +(deftemplate Answer (declare (from-class Answer))) + +(defrule avoid-overdraft "Give $50 to anyone overdrawn" + ?q <- (Question { balance < 0 }) + => + (add (new Answer "Overdrawn bonus" (+ ?q.balance 50)))) diff --git a/rule-engines/jess/src/main/resources/helloJess.clp b/rule-engines/jess/src/main/resources/helloJess.clp new file mode 100644 index 0000000000..547294eca6 --- /dev/null +++ b/rule-engines/jess/src/main/resources/helloJess.clp @@ -0,0 +1,3 @@ +;; Hello, world in Jess! + +(printout t "Hello from Jess!" crlf) From d52bb494e113a545faaf657d81531ae6c9fa0f7e Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Sat, 25 Jul 2020 11:41:20 -0500 Subject: [PATCH 0275/1862] Added project hierarchy to exemplify the tag. --- maven-modules/optional-dependencies/README.md | 3 +++ .../main-project/pom.xml | 18 ++++++++++++++++++ .../optional-project/pom.xml | 10 ++++++++++ maven-modules/optional-dependencies/pom.xml | 18 ++++++++++++++++++ .../project-with-optionals/pom.xml | 19 +++++++++++++++++++ maven-modules/pom.xml | 1 + 6 files changed, 69 insertions(+) create mode 100644 maven-modules/optional-dependencies/README.md create mode 100644 maven-modules/optional-dependencies/main-project/pom.xml create mode 100644 maven-modules/optional-dependencies/optional-project/pom.xml create mode 100644 maven-modules/optional-dependencies/pom.xml create mode 100644 maven-modules/optional-dependencies/project-with-optionals/pom.xml diff --git a/maven-modules/optional-dependencies/README.md b/maven-modules/optional-dependencies/README.md new file mode 100644 index 0000000000..6b4d3e7647 --- /dev/null +++ b/maven-modules/optional-dependencies/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- Optional Dependency in Maven \ No newline at end of file diff --git a/maven-modules/optional-dependencies/main-project/pom.xml b/maven-modules/optional-dependencies/main-project/pom.xml new file mode 100644 index 0000000000..6a42683779 --- /dev/null +++ b/maven-modules/optional-dependencies/main-project/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + com.baeldung + main-project + 0.0.1-SNAPSHOT + pom + + + + com.baeldung + project-with-optionals + 0.0.1-SNAPSHOT + + + \ No newline at end of file diff --git a/maven-modules/optional-dependencies/optional-project/pom.xml b/maven-modules/optional-dependencies/optional-project/pom.xml new file mode 100644 index 0000000000..9ad4376c8d --- /dev/null +++ b/maven-modules/optional-dependencies/optional-project/pom.xml @@ -0,0 +1,10 @@ + + + 4.0.0 + com.baeldung + optional-project + 0.0.1-SNAPSHOT + pom + \ No newline at end of file diff --git a/maven-modules/optional-dependencies/pom.xml b/maven-modules/optional-dependencies/pom.xml new file mode 100644 index 0000000000..c1bfc6fb59 --- /dev/null +++ b/maven-modules/optional-dependencies/pom.xml @@ -0,0 +1,18 @@ + + + + maven-modules + com.baeldung + 0.0.1-SNAPSHOT + + 4.0.0 + + optional-dependencies + + optional-project + project-with-optionals + main-project + + \ No newline at end of file diff --git a/maven-modules/optional-dependencies/project-with-optionals/pom.xml b/maven-modules/optional-dependencies/project-with-optionals/pom.xml new file mode 100644 index 0000000000..6a14f3260d --- /dev/null +++ b/maven-modules/optional-dependencies/project-with-optionals/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + com.baeldung + project-with-optionals + 0.0.1-SNAPSHOT + pom + + + + com.baeldung + optional-project + 0.0.1-SNAPSHOT + true + + + \ No newline at end of file diff --git a/maven-modules/pom.xml b/maven-modules/pom.xml index 528f44bddc..86a7d5756c 100644 --- a/maven-modules/pom.xml +++ b/maven-modules/pom.xml @@ -26,6 +26,7 @@ maven-properties versions-maven-plugin version-collision + optional-dependencies From c1a9c42194d7945b8c5162de41d6c92410437247 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 25 Jul 2020 18:23:39 +0000 Subject: [PATCH 0276/1862] Review - II Kevin Gilmore --- .../customLoader/ClassLoaderInfo.java | 11 ------- .../customLoader/CustomClassLoader.java | 32 ------------------- 2 files changed, 43 deletions(-) delete mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java delete mode 100644 core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java deleted file mode 100644 index 2574394c13..0000000000 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/ClassLoaderInfo.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.loadedclasslisting.customLoader; - -import java.util.ArrayList; - -public class ClassLoaderInfo { - - public void printClassLoaders() throws ClassNotFoundException { - System.out.println("Classloader of this class:" + ClassLoaderInfo.class.getClassLoader()); - System.out.println("Classloader of ArrayList:" + ArrayList.class.getClassLoader()); - } -} diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java deleted file mode 100644 index a5f293f605..0000000000 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/customLoader/CustomClassLoader.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.loadedclasslisting.customLoader; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -public class CustomClassLoader extends ClassLoader { - - @Override - public Class findClass(String name) throws ClassNotFoundException { - byte[] b = loadClassFromFile(name); - return defineClass(name, b, 0, b.length); - } - - private byte[] loadClassFromFile(String fileName) { - InputStream inputStream = getClass().getClassLoader() - .getResourceAsStream(fileName.replace('.', File.separatorChar) + ".class"); - byte[] buffer; - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - int nextValue = 0; - try { - while ((nextValue = inputStream.read()) != -1) { - byteStream.write(nextValue); - } - } catch (IOException e) { - e.printStackTrace(); - } - buffer = byteStream.toByteArray(); - return buffer; - } -} From 1299a22eb52b302b9585e369e5109d552a11ef44 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 25 Jul 2020 18:28:28 +0000 Subject: [PATCH 0277/1862] Review - II Kevin Gilmore Changes --- .../baeldung/loadedclasslisting/Launcher.java | 39 +++---------------- .../ListLoadedClassesAgent.java | 24 ++++-------- 2 files changed, 12 insertions(+), 51 deletions(-) diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java index e1851275c9..30db6b0bb7 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java @@ -1,48 +1,19 @@ package com.baeldung.loadedclasslisting; -import java.lang.reflect.Method; import java.util.Arrays; -import com.baeldung.loadedclasslisting.ListLoadedClassesAgent.ClassLoaderType; -import com.baeldung.loadedclasslisting.customLoader.ClassLoaderInfo; -import com.baeldung.loadedclasslisting.customLoader.CustomClassLoader; - public class Launcher { - private static ClassLoader customClassLoader; - public static void main(String[] args) { - printClassesLoadedBy(ClassLoaderType.BOOTSTRAP); - printClassesLoadedBy(ClassLoaderType.SYSTEM); - printClassesLoadedBy(ClassLoaderType.EXTENSION); - printClassesLoadedBy(ClassLoaderType.CUSTOM); + printClassesLoadedBy("BOOTSTRAP"); + printClassesLoadedBy("SYSTEM"); + printClassesLoadedBy("EXTENSION"); } - private static void printClassesLoadedBy(ClassLoaderType classLoaderType) { - Class[] classes; - if (classLoaderType.equals(ClassLoaderType.CUSTOM)) { - customClassLoader = customClassLoading(); - classes = ListLoadedClassesAgent.listLoadedClasses(customClassLoader); - } else { - classes = ListLoadedClassesAgent.listLoadedClasses(classLoaderType); - } + private static void printClassesLoadedBy(String classLoaderType) { + Class[] classes = ListLoadedClassesAgent.listLoadedClasses(classLoaderType); Arrays.asList(classes) .forEach(clazz -> System.out.println( classLoaderType + " ClassLoader : " + clazz.getCanonicalName())); } - - private static CustomClassLoader customClassLoading() { - CustomClassLoader customClassLoader = new CustomClassLoader(); - Class c; - try { - c = customClassLoader.findClass(ClassLoaderInfo.class.getName()); - Object ob = c.getDeclaredConstructor() - .newInstance(); - Method md = c.getMethod("printClassLoaders"); - md.invoke(ob); - } catch (Exception e) { - e.printStackTrace(); - } - return customClassLoader; - } } diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java index 8f4b8ebd41..337214a664 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/ListLoadedClassesAgent.java @@ -4,17 +4,13 @@ import java.lang.instrument.Instrumentation; public class ListLoadedClassesAgent { - public enum ClassLoaderType { - SYSTEM, EXTENSION, BOOTSTRAP, CUSTOM , PLATFORM - } - private static Instrumentation instrumentation; public static void premain(String agentArgs, Instrumentation instrumentation) { ListLoadedClassesAgent.instrumentation = instrumentation; } - public static Class[] listLoadedClasses(ClassLoaderType classLoaderType) { + public static Class[] listLoadedClasses(String classLoaderType) { if (instrumentation == null) { throw new IllegalStateException( "ListLoadedClassesAgent is not initialized."); @@ -23,24 +19,18 @@ public class ListLoadedClassesAgent { getClassLoader(classLoaderType)); } - public static Class[] listLoadedClasses(ClassLoader classLoader) { - if (instrumentation == null) { - throw new IllegalStateException( - "ListLoadedClassesAgent is not initialized."); - } - return instrumentation.getInitiatedClasses(classLoader); - } - - private static ClassLoader getClassLoader(ClassLoaderType classLoaderType) { + private static ClassLoader getClassLoader(String classLoaderType) { ClassLoader classLoader = null; switch (classLoaderType) { - case SYSTEM: + case "SYSTEM": classLoader = ClassLoader.getSystemClassLoader(); break; - case EXTENSION: + case "EXTENSION": classLoader = ClassLoader.getSystemClassLoader().getParent(); break; - case BOOTSTRAP: + // passing a null value to the Instrumentation : getInitiatedClasses method + // defaults to the bootstrap class loader + case "BOOTSTRAP": break; default: break; From e9e98ecc8e41fe02a68771448464ca982c81659e Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Sun, 26 Jul 2020 02:21:02 +0530 Subject: [PATCH 0278/1862] Created seaprate method for each functionality --- .../baeldung/consoleout/ConsoleAndOut.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java index 70711cacec..082a5219c9 100644 --- a/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java +++ b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java @@ -4,12 +4,28 @@ import java.io.Console; public class ConsoleAndOut { public static void main(String[] args) { + try { + printConsoleObject(); + readPasswordFromConsole(); + } catch (Exception ex) { + // Eating NullPointerExcpetion which will occur when this + // program will be run from mediums other than console + } + printSysOut(); + } + + static void printConsoleObject() { Console console = System.console(); console.writer().print(console); - - char[] password = console.readPassword("Enter password:"); + } + + static void readPasswordFromConsole() { + Console console = System.console(); + char[] password = console.readPassword("Enter password: "); console.printf(String.valueOf(password)); - + } + + static void printSysOut() { System.out.println(System.out); } } From efd17051367c4b37f19fc6acfabfc7de583136a0 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Sun, 26 Jul 2020 02:46:59 +0530 Subject: [PATCH 0279/1862] Added Unit Test Case for ConsoleAndOut class --- .../consoleout/ConsoleAndOutUnitTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 core-java-modules/core-java-console/src/test/java/com/baeldung/consoleout/ConsoleAndOutUnitTest.java diff --git a/core-java-modules/core-java-console/src/test/java/com/baeldung/consoleout/ConsoleAndOutUnitTest.java b/core-java-modules/core-java-console/src/test/java/com/baeldung/consoleout/ConsoleAndOutUnitTest.java new file mode 100644 index 0000000000..619a65a1fc --- /dev/null +++ b/core-java-modules/core-java-console/src/test/java/com/baeldung/consoleout/ConsoleAndOutUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.consoleout; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +class ConsoleAndOutUnitTest { + + @Test + void whenRetreivingConsole_thenPrintConsoleObject() { + assertThrows(NullPointerException.class, () -> { + ConsoleAndOut.printConsoleObject(); + }); + } + + @Test + void whenReadingPassword_thenReadPassword() { + assertThrows(NullPointerException.class, () -> { + ConsoleAndOut.readPasswordFromConsole(); + }); + } + + @Test + void whenRetrievingSysOut_thenPrintSysOutObject() { + ConsoleAndOut.printSysOut(); + } +} From 3718d15004400f35fa2d8802e2c9510b2eb5e5f4 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 25 Jul 2020 23:24:14 +0200 Subject: [PATCH 0280/1862] Update SHACommonUtils.java Replace StringBuffer with StringBuilder and add initial capacity. StringBuilder is faster because it is not synchronized. --- .../src/main/java/com/baeldung/hashing/SHACommonUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-security-2/src/main/java/com/baeldung/hashing/SHACommonUtils.java b/core-java-modules/core-java-security-2/src/main/java/com/baeldung/hashing/SHACommonUtils.java index 0f28408083..699e9141a4 100644 --- a/core-java-modules/core-java-security-2/src/main/java/com/baeldung/hashing/SHACommonUtils.java +++ b/core-java-modules/core-java-security-2/src/main/java/com/baeldung/hashing/SHACommonUtils.java @@ -3,7 +3,7 @@ package com.baeldung.hashing; class SHACommonUtils { public static String bytesToHex(byte[] hash) { - StringBuffer hexString = new StringBuffer(); + StringBuilder hexString = new StringBuilder(2 * hash.length); for (byte h : hash) { String hex = Integer.toHexString(0xff & h); if (hex.length() == 1) From cd4f74779a383e131bc9d2a234c0f07ab637fef3 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 26 Jul 2020 06:43:57 +0300 Subject: [PATCH 0281/1862] Update pom.xml (#9767) --- rule-engines/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/rule-engines/pom.xml b/rule-engines/pom.xml index d3d3127ce0..27748a5c3e 100644 --- a/rule-engines/pom.xml +++ b/rule-engines/pom.xml @@ -16,6 +16,7 @@ easy-rules openl-tablets rulebook + From 94555a4510b8bd3f7e19dd3a91ce943fed092c29 Mon Sep 17 00:00:00 2001 From: TJ Date: Sun, 26 Jul 2020 09:29:54 +0530 Subject: [PATCH 0282/1862] BAEL-4403 (#9740) * Hexagonal architecture in Java * BAEL-4403 * Revert "Hexagonal architecture in Java" This reverts commit 7ba4c9dcbd99ca418c070a73bd9ab9f6c956d185. * Updated code to use only Console * Added System.out * Created seaprate method for each functionality * Added Unit Test Case for ConsoleAndOut class Co-authored-by: Tarun Jain --- .../baeldung/consoleout/ConsoleAndOut.java | 31 +++++++++++++++++++ .../consoleout/ConsoleAndOutUnitTest.java | 27 ++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java create mode 100644 core-java-modules/core-java-console/src/test/java/com/baeldung/consoleout/ConsoleAndOutUnitTest.java diff --git a/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java new file mode 100644 index 0000000000..082a5219c9 --- /dev/null +++ b/core-java-modules/core-java-console/src/main/java/com/baeldung/consoleout/ConsoleAndOut.java @@ -0,0 +1,31 @@ +package com.baeldung.consoleout; + +import java.io.Console; + +public class ConsoleAndOut { + public static void main(String[] args) { + try { + printConsoleObject(); + readPasswordFromConsole(); + } catch (Exception ex) { + // Eating NullPointerExcpetion which will occur when this + // program will be run from mediums other than console + } + printSysOut(); + } + + static void printConsoleObject() { + Console console = System.console(); + console.writer().print(console); + } + + static void readPasswordFromConsole() { + Console console = System.console(); + char[] password = console.readPassword("Enter password: "); + console.printf(String.valueOf(password)); + } + + static void printSysOut() { + System.out.println(System.out); + } +} diff --git a/core-java-modules/core-java-console/src/test/java/com/baeldung/consoleout/ConsoleAndOutUnitTest.java b/core-java-modules/core-java-console/src/test/java/com/baeldung/consoleout/ConsoleAndOutUnitTest.java new file mode 100644 index 0000000000..619a65a1fc --- /dev/null +++ b/core-java-modules/core-java-console/src/test/java/com/baeldung/consoleout/ConsoleAndOutUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.consoleout; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +class ConsoleAndOutUnitTest { + + @Test + void whenRetreivingConsole_thenPrintConsoleObject() { + assertThrows(NullPointerException.class, () -> { + ConsoleAndOut.printConsoleObject(); + }); + } + + @Test + void whenReadingPassword_thenReadPassword() { + assertThrows(NullPointerException.class, () -> { + ConsoleAndOut.readPasswordFromConsole(); + }); + } + + @Test + void whenRetrievingSysOut_thenPrintSysOutObject() { + ConsoleAndOut.printSysOut(); + } +} From e3999c9112a8aa46173aa7c09ea72626a44f1113 Mon Sep 17 00:00:00 2001 From: mdhtr Date: Mon, 20 Jul 2020 21:14:49 +0200 Subject: [PATCH 0283/1862] Changes based on editor review - extract Person classes from test classes - shorten test name of one test - fix one warning --- .../JacksonDeserializationUnitTest.java | 4 ++-- .../HydraJsonldSerializationUnitTest.java | 12 ------------ .../serialization/hydrajsonld/Person.java | 15 +++++++++++++++ .../JacksonJsonLdSerializationUnitTest.java | 17 ----------------- .../serialization/jacksonjsonld/Person.java | 19 +++++++++++++++++++ 5 files changed, 36 insertions(+), 31 deletions(-) create mode 100644 json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java create mode 100644 json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java diff --git a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java index 35a2613957..df09a98f76 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java @@ -16,11 +16,11 @@ import com.github.jsonldjava.utils.JsonUtils; public class JacksonDeserializationUnitTest { @Test - void givenAJsonLdObject_whenCompactIsUsedWithEmptyContext_thenItCanBeDeserializedIntoAJacksonAnnotatedJavaObject() throws IOException { + void givenAJsonLdObject_whenCompactIsUsedWithEmptyContext_thenItCanBeDeserializedWithJackson() throws IOException { String inputJsonLd = "{\"@context\":{\"@vocab\":\"http://schema.org/\",\"knows\":{\"@type\":\"@id\"}},\"@type\":\"Person\",\"@id\":\"http://example.com/person/1234\",\"name\":\"Example Name\",\"knows\":\"http://example.com/person/2345\"}"; Object jsonObject = JsonUtils.fromString(inputJsonLd); - Object compact = JsonLdProcessor.compact(jsonObject, new HashMap(), new JsonLdOptions()); + Object compact = JsonLdProcessor.compact(jsonObject, new HashMap<>(), new JsonLdOptions()); String compactContent = JsonUtils.toString(compact); assertEquals("{\"@id\":\"http://example.com/person/1234\",\"@type\":\"http://schema.org/Person\",\"http://schema.org/knows\":{\"@id\":\"http://example.com/person/2345\"},\"http://schema.org/name\":\"Example Name\"}", compactContent); diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java index e5d1e35236..308987a0bd 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.JsonSerializer; @@ -15,20 +14,9 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.ser.BeanSerializerModifier; import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; -import de.escalon.hypermedia.hydra.mapping.Expose; -import de.escalon.hypermedia.hydra.mapping.Vocab; import de.escalon.hypermedia.hydra.serialize.JacksonHydraSerializer; public class HydraJsonldSerializationUnitTest { - @Vocab("http://example.com/vocab/") - @Expose("person") - static class Person { - @JsonProperty("@id") - public String id; - @Expose("fullName") - public String name; - } - @Test void givenAHydraJsonldAnnotatedObject_whenJacksonHydraSerializerIsUsed_thenAJsonLdDocumentIsGenerated() throws JsonProcessingException { ObjectMapper objectMapper = new ObjectMapper(); diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java new file mode 100644 index 0000000000..87587d02ac --- /dev/null +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java @@ -0,0 +1,15 @@ +package com.baeldung.jsonld.serialization.hydrajsonld; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import de.escalon.hypermedia.hydra.mapping.Expose; +import de.escalon.hypermedia.hydra.mapping.Vocab; + +@Vocab("http://example.com/vocab/") +@Expose("person") +public class Person { + @JsonProperty("@id") + public String id; + @Expose("fullName") + public String name; +} diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java index b539c73608..07e44b4981 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java @@ -8,25 +8,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import ioinformarics.oss.jackson.module.jsonld.JsonldModule; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldId; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldLink; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldNamespace; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldProperty; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldResource; -import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldType; public class JacksonJsonLdSerializationUnitTest { - @JsonldResource - @JsonldNamespace(name = "s", uri = "http://schema.org/") - @JsonldType("s:Person") - @JsonldLink(rel = "s:knows", name = "knows", href = "http://example.com/person/2345") - static class Person { - @JsonldId - public String id = "http://example.com/person/1234"; - @JsonldProperty("s:name") - public String name = "Example Name"; - } - @Test void givenAJacksonJsonldAnnotatedObject_whenJsonldModuleIsUsed_thenAJsonLdDocumentIsGenerated() throws JsonProcessingException { ObjectMapper objectMapper = new ObjectMapper(); diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java new file mode 100644 index 0000000000..d0c9e4f111 --- /dev/null +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java @@ -0,0 +1,19 @@ +package com.baeldung.jsonld.serialization.jacksonjsonld; + +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldId; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldLink; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldNamespace; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldProperty; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldResource; +import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldType; + +@JsonldResource +@JsonldNamespace(name = "s", uri = "http://schema.org/") +@JsonldType("s:Person") +@JsonldLink(rel = "s:knows", name = "knows", href = "http://example.com/person/2345") +public class Person { + @JsonldId + public String id = "http://example.com/person/1234"; + @JsonldProperty("s:name") + public String name = "Example Name"; +} From f83f670bf757954f82f5ee688a025d9302656242 Mon Sep 17 00:00:00 2001 From: mdhtr Date: Sun, 26 Jul 2020 09:44:17 +0200 Subject: [PATCH 0284/1862] Format inline JSON objects by hand --- .../JacksonDeserializationUnitTest.java | 18 ++++++++++++++++-- .../HydraJsonldSerializationUnitTest.java | 10 +++++++++- .../JacksonJsonLdSerializationUnitTest.java | 14 +++++++++++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java index df09a98f76..9c6b6f976a 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java @@ -17,13 +17,27 @@ public class JacksonDeserializationUnitTest { @Test void givenAJsonLdObject_whenCompactIsUsedWithEmptyContext_thenItCanBeDeserializedWithJackson() throws IOException { - String inputJsonLd = "{\"@context\":{\"@vocab\":\"http://schema.org/\",\"knows\":{\"@type\":\"@id\"}},\"@type\":\"Person\",\"@id\":\"http://example.com/person/1234\",\"name\":\"Example Name\",\"knows\":\"http://example.com/person/2345\"}"; + String inputJsonLd = "{" + + "\"@context\":{" + + "\"@vocab\":\"http://schema.org/\"," + + "\"knows\":{\"@type\":\"@id\"}" + + "}," + + "\"@type\":\"Person\"," + + "\"@id\":\"http://example.com/person/1234\"," + + "\"name\":\"Example Name\"," + + "\"knows\":\"http://example.com/person/2345\"" + + "}"; Object jsonObject = JsonUtils.fromString(inputJsonLd); Object compact = JsonLdProcessor.compact(jsonObject, new HashMap<>(), new JsonLdOptions()); String compactContent = JsonUtils.toString(compact); - assertEquals("{\"@id\":\"http://example.com/person/1234\",\"@type\":\"http://schema.org/Person\",\"http://schema.org/knows\":{\"@id\":\"http://example.com/person/2345\"},\"http://schema.org/name\":\"Example Name\"}", compactContent); + assertEquals("{" + + "\"@id\":\"http://example.com/person/1234\"," + + "\"@type\":\"http://schema.org/Person\"," + + "\"http://schema.org/knows\":{\"@id\":\"http://example.com/person/2345\"}," + + "\"http://schema.org/name\":\"Example Name\"" + + "}", compactContent); ObjectMapper objectMapper = new ObjectMapper(); Person person = objectMapper.readValue(compactContent, Person.class); diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java index 308987a0bd..06105d579e 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java @@ -29,7 +29,15 @@ public class HydraJsonldSerializationUnitTest { String personJsonLd = objectMapper.writeValueAsString(person); - assertEquals("{\"@context\":{\"@vocab\":\"http://example.com/vocab/\",\"name\":\"fullName\"},\"@type\":\"person\",\"name\":\"Example Name\",\"@id\":\"http://example.com/person/1234\"}", personJsonLd); + assertEquals("{" + + "\"@context\":{" + + "\"@vocab\":\"http://example.com/vocab/\"," + + "\"name\":\"fullName\"" + + "}," + + "\"@type\":\"person\"," + + "\"name\":\"Example Name\"," + + "\"@id\":\"http://example.com/person/1234\"" + + "}", personJsonLd); } static SimpleModule getJacksonHydraSerializerModule() { diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java index 07e44b4981..cd41989a53 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java @@ -18,8 +18,16 @@ public class JacksonJsonLdSerializationUnitTest { Person person = new Person(); String personJsonLd = objectMapper.writeValueAsString(person); - assertEquals( - "{\"@type\":\"s:Person\",\"@context\":{\"s\":\"http://schema.org/\",\"name\":\"s:name\",\"knows\":{\"@id\":\"s:knows\",\"@type\":\"@id\"}},\"name\":\"Example Name\",\"@id\":\"http://example.com/person/1234\",\"knows\":\"http://example.com/person/2345\"}", - personJsonLd); + assertEquals("{" + + "\"@type\":\"s:Person\"," + + "\"@context\":{" + + "\"s\":\"http://schema.org/\"," + + "\"name\":\"s:name\"," + + "\"knows\":{\"@id\":\"s:knows\",\"@type\":\"@id\"}" + + "}," + + "\"name\":\"Example Name\"," + + "\"@id\":\"http://example.com/person/1234\"," + + "\"knows\":\"http://example.com/person/2345\"" + + "}", personJsonLd); } } From c95dbf8135c7eb1cd42a3f28d13be22978a0a5c7 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sun, 26 Jul 2020 16:51:40 +0530 Subject: [PATCH 0285/1862] BAEL-4025:Spring Data Azure Cosmos DB --- .../spring-data-cosmosdb/pom.xml | 48 +++++++++++++++ .../cosmosdb/AzurecosmodbApplication.java | 44 ++++++++++++++ .../controller/ProductController.java | 54 +++++++++++++++++ .../spring/data/cosmosdb/entity/Product.java | 58 +++++++++++++++++++ .../repository/ProductRepository.java | 15 +++++ .../data/cosmosdb/service/ProductService.java | 39 +++++++++++++ .../src/main/resources/application.properties | 4 ++ ...zurecosmodbApplicationIntegrationTest.java | 40 +++++++++++++ 8 files changed, 302 insertions(+) create mode 100644 persistence-modules/spring-data-cosmosdb/pom.xml create mode 100644 persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplication.java create mode 100644 persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java create mode 100644 persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/entity/Product.java create mode 100644 persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/repository/ProductRepository.java create mode 100644 persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java create mode 100644 persistence-modules/spring-data-cosmosdb/src/main/resources/application.properties create mode 100644 persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationIntegrationTest.java diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml new file mode 100644 index 0000000000..8bb103879d --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + spring-data-cosmosdb + spring-data-cosmos-db + tutorial for spring-data-cosmosdb + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + com.microsoft.azure + spring-data-cosmosdb + 2.3.0 + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplication.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplication.java new file mode 100644 index 0000000000..2b145d14cd --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplication.java @@ -0,0 +1,44 @@ +package com.baeldung.spring.data.cosmosdb; + +import com.azure.data.cosmos.CosmosKeyCredential; +import com.baeldung.spring.data.cosmosdb.repository.ProductRepository; +import com.microsoft.azure.spring.data.cosmosdb.config.AbstractCosmosConfiguration; +import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; +import com.microsoft.azure.spring.data.cosmosdb.repository.config.EnableCosmosRepositories; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +@EnableCosmosRepositories(basePackageClasses = ProductRepository.class) +public class AzurecosmodbApplication extends AbstractCosmosConfiguration { + + public static void main(String[] args) { + SpringApplication.run(AzurecosmodbApplication.class, args); + } + + @Value("${azure.cosmosdb.uri}") + private String uri; + + @Value("${azure.cosmosdb.key}") + private String key; + + @Value("${azure.cosmosdb.secondaryKey}") + private String secondaryKey; + + @Value("${azure.cosmosdb.database}") + private String dbName; + + private CosmosKeyCredential cosmosKeyCredential; + + @Bean + public CosmosDBConfig getConfig() { + this.cosmosKeyCredential = new CosmosKeyCredential(key); + CosmosDBConfig cosmosdbConfig = CosmosDBConfig.builder(uri, this.cosmosKeyCredential, dbName) + .build(); + return cosmosdbConfig; + } + +} diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java new file mode 100644 index 0000000000..c1e38c9601 --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java @@ -0,0 +1,54 @@ +package com.baeldung.spring.data.cosmosdb.controller; + +import com.baeldung.spring.data.cosmosdb.entity.Product; +import com.baeldung.spring.data.cosmosdb.service.ProductService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Optional; + +@RestController +@RequestMapping("/products") +public class ProductController { + + @Autowired + private ProductService productService; + + @PostMapping + @ResponseStatus(HttpStatus.CREATED) + public void create(@RequestBody Product product) { + productService.saveProduct(product); + } + + @GetMapping(value = "/{id}/category/{category}") + public Optional get(@PathVariable String id, @PathVariable String category) { + return productService.findById(id, category); + } + + @DeleteMapping(value = "/{id}/category/{category}") + public void delete(@PathVariable String id, @PathVariable String category) { + productService.delete(id, category); + } + + @GetMapping + public List getByName(@RequestParam String name) { + return productService.findProductByName(name); + } + + @GetMapping(value = "/category/{category}") + public List getByCategory(@PathVariable String category) { + return productService.getProductsOfCategory(category); + } + +} diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/entity/Product.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/entity/Product.java new file mode 100644 index 0000000000..07bb8889f5 --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/entity/Product.java @@ -0,0 +1,58 @@ +package com.baeldung.spring.data.cosmosdb.entity; + +import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document; +import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; + +import org.springframework.data.annotation.Id; + +@Document(collection = "products") +public class Product { + + @Id + private String productid; + + private String productName; + + private double price; + + @PartitionKey + private String productCategory; + + public String getProductid() { + return productid; + } + + public void setProductid(String productid) { + this.productid = productid; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getProductCategory() { + return productCategory; + } + + public void setProductCategory(String productCategory) { + this.productCategory = productCategory; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + + @Override + public String toString() { + return "Product [productid=" + productid + ", productName=" + productName + ", price=" + price + ", productCategory=" + productCategory + "]"; + } + +} diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/repository/ProductRepository.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/repository/ProductRepository.java new file mode 100644 index 0000000000..29dc85a2cf --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/repository/ProductRepository.java @@ -0,0 +1,15 @@ +package com.baeldung.spring.data.cosmosdb.repository; + +import com.baeldung.spring.data.cosmosdb.entity.Product; +import com.microsoft.azure.spring.data.cosmosdb.repository.CosmosRepository; + +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface ProductRepository extends CosmosRepository { + List findByProductName(String productName); + + List findByProductCategory(String category); +} diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java new file mode 100644 index 0000000000..6846d5205c --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java @@ -0,0 +1,39 @@ +package com.baeldung.spring.data.cosmosdb.service; + +import com.azure.data.cosmos.PartitionKey; +import com.baeldung.spring.data.cosmosdb.entity.Product; +import com.baeldung.spring.data.cosmosdb.repository.ProductRepository; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Optional; + +@Component +public class ProductService { + + @Autowired + private ProductRepository repository; + + public List findProductByName(String productName) { + return repository.findByProductName(productName); + } + + public Optional findById(String productId, String category) { + return repository.findById(productId, new PartitionKey(category)); + } + + public List getProductsOfCategory(String category) { + List products = repository.findByProductCategory(category); + return products; + } + + public void saveProduct(Product product) { + repository.save(product); + } + + public void delete(String productId, String category) { + repository.deleteById(productId, new PartitionKey(category)); + } +} diff --git a/persistence-modules/spring-data-cosmosdb/src/main/resources/application.properties b/persistence-modules/spring-data-cosmosdb/src/main/resources/application.properties new file mode 100644 index 0000000000..ba99ea2e6e --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/src/main/resources/application.properties @@ -0,0 +1,4 @@ +azure.cosmosdb.uri=cosmodb-uri +azure.cosmosdb.key=cosmodb-primary-key +azure.cosmosdb.secondaryKey=cosmodb-second-key +azure.cosmosdb.database=cosmodb-name \ No newline at end of file diff --git a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationIntegrationTest.java b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationIntegrationTest.java new file mode 100644 index 0000000000..0ef6af15e1 --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationIntegrationTest.java @@ -0,0 +1,40 @@ +package com.baeldung.spring.data.cosmosdb; + +import com.azure.data.cosmos.PartitionKey; +import com.baeldung.spring.data.cosmosdb.entity.Product; +import com.baeldung.spring.data.cosmosdb.repository.ProductRepository; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.util.Assert; + +import java.util.Optional; + +//Uncomment this when configured URI and keys for Azure Cosmos DB in application.properties +//to run the integration test +//@SpringBootTest +public class AzurecosmodbApplicationIntegrationTest { + + @Autowired + ProductRepository productRepository; + + // Uncomment this when configured URI and keys for Azure Cosmos DB in application.properties + // to run the integration test + // @Test + public void givenProductIsCreated_whenCallFindById_thenProductIsFound() { + Product product = new Product(); + product.setProductid("1001"); + product.setProductCategory("Shirt"); + product.setPrice(110.0); + product.setProductName("Blue Shirt"); + + // Uncomment these lines when configured URI and keys for Azure Cosmos DB in application.properties + // to run the integration test + // productRepository.save(product); + // Optional retrievedProduct = productRepository.findById("1001", new PartitionKey("Shirt")); + // Assert.notNull(retrievedProduct, "Retrieved Product is Null"); + + } + +} From b5eef05476b6c946c9f4c97fe9b8eef9dfb5f28b Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sun, 26 Jul 2020 16:59:27 +0530 Subject: [PATCH 0286/1862] cleaning up unnecessary changes --- spring-caching/src/main/resources/schema.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-caching/src/main/resources/schema.sql b/spring-caching/src/main/resources/schema.sql index 7d5cb36d66..35d02bb916 100644 --- a/spring-caching/src/main/resources/schema.sql +++ b/spring-caching/src/main/resources/schema.sql @@ -1,6 +1,7 @@ DROP TABLE ORDERDETAIL IF EXISTS; DROP TABLE ITEM IF EXISTS; DROP TABLE CUSTOMER IF EXISTS; + CREATE TABLE CUSTOMER( CUSTOMERID INT PRIMARY KEY, CUSTOMERNAME VARCHAR(250) NOT NULL From 55d15037c0825efd94e48048a8d1889bdbbf4563 Mon Sep 17 00:00:00 2001 From: developerDiv Date: Sun, 26 Jul 2020 17:08:44 +0100 Subject: [PATCH 0287/1862] Rename DeliveryPlatform send method to 'deliver' to aid readability and avoiding confusion with EmailService.send method Re-arrange order of mocks and inject mocks Rename argument matcher and captor tests --- .../mockito/argumentcaptor/DeliveryPlatform.java | 2 +- .../mockito/argumentcaptor/EmailService.java | 2 +- .../argumentcaptor/EmailServiceUnitTest.java | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/DeliveryPlatform.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/DeliveryPlatform.java index dbad1e1bcf..6cbaf7b97c 100644 --- a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/DeliveryPlatform.java +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/DeliveryPlatform.java @@ -2,7 +2,7 @@ package com.baeldung.mockito.argumentcaptor; public interface DeliveryPlatform { - void send(Email email); + void deliver(Email email); String getServiceStatus(); diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/EmailService.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/EmailService.java index c368f41d2f..d22feaf8a4 100644 --- a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/EmailService.java +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/argumentcaptor/EmailService.java @@ -15,7 +15,7 @@ public class EmailService { } Email email = new Email(to, subject, body); email.setFormat(format); - platform.send(email); + platform.deliver(email); } public ServiceStatus checkServiceStatus() { diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java index 9d18957b2e..5ed7be7d6e 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/argumentcaptor/EmailServiceUnitTest.java @@ -10,12 +10,12 @@ import static org.junit.Assert.*; @RunWith(MockitoJUnitRunner.class) public class EmailServiceUnitTest { - @InjectMocks - EmailService emailService; - @Mock DeliveryPlatform platform; + @InjectMocks + EmailService emailService; + @Captor ArgumentCaptor emailCaptor; @@ -30,7 +30,7 @@ public class EmailServiceUnitTest { emailService.send(to, subject, body, false); - Mockito.verify(platform).send(emailCaptor.capture()); + Mockito.verify(platform).deliver(emailCaptor.capture()); Email emailCaptorValue = emailCaptor.getValue(); assertEquals(Format.TEXT_ONLY, emailCaptorValue.getFormat()); } @@ -43,7 +43,7 @@ public class EmailServiceUnitTest { emailService.send(to, subject, body, true); - Mockito.verify(platform).send(emailCaptor.capture()); + Mockito.verify(platform).deliver(emailCaptor.capture()); Email value = emailCaptor.getValue(); assertEquals(Format.HTML, value.getFormat()); } @@ -67,7 +67,7 @@ public class EmailServiceUnitTest { } @Test - public void usingArgumentMatcher_whenAuthenticatedWithValidCredentials_expectTrue() { + public void whenUsingArgumentMatcherForValidCredentials_expectTrue() { Credentials credentials = new Credentials("baeldung", "correct_password", "correct_key"); Mockito.when(platform.authenticate(Mockito.eq(credentials))).thenReturn(AuthenticationStatus.AUTHENTICATED); @@ -75,7 +75,7 @@ public class EmailServiceUnitTest { } @Test - public void usingArgumentCaptor_whenAuthenticatedWithValidCredentials_expectTrue() { + public void whenUsingArgumentCaptorForValidCredentials_expectTrue() { Credentials credentials = new Credentials("baeldung", "correct_password", "correct_key"); Mockito.when(platform.authenticate(credentialsCaptor.capture())).thenReturn(AuthenticationStatus.AUTHENTICATED); From 48ea32d583dd5fd5d45aa60516476c3e2096d300 Mon Sep 17 00:00:00 2001 From: STS Date: Sun, 26 Jul 2020 20:01:42 +0200 Subject: [PATCH 0288/1862] change test class name, add blank line and swap assert method parameter --- .../baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java b/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java index 45314519d4..b3f6949216 100644 --- a/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java +++ b/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java @@ -25,7 +25,7 @@ class ExcelFormulaUnitTest { } @Test - void givenExcelData_whenSetAndEvaluateFormula() throws IOException { + void givenExcelData_whenSetFormula_thenSuccess() throws IOException { FileInputStream inputStream = new FileInputStream(new File(fileLocation)); XSSFWorkbook wb = new XSSFWorkbook(inputStream); XSSFSheet sheet = wb.getSheetAt(0); @@ -43,7 +43,9 @@ class ExcelFormulaUnitTest { String startCellB = colNameB + 1; String stopCellB = colNameB + (sheet.getLastRowNum() + 1); String sumFormulaForColumnB = String.format("SUM(%s:%s)", startCellB, stopCellB); + double resultValue = excelFormula.setFormula(fileLocation, wb, sumFormulaForColumnA + "-" + sumFormulaForColumnB); - Assert.assertEquals(resultValue, resultColumnA - resultColumnB, 0d); + + Assert.assertEquals(resultColumnA - resultColumnB, resultValue, 0d); } } From 78d44e5a6010aecdb209855f1854ad017b2ac89c Mon Sep 17 00:00:00 2001 From: STS Date: Mon, 27 Jul 2020 10:07:30 +0200 Subject: [PATCH 0289/1862] change baeldung spell --- .../poi/excel/setformula/SetFormulaTest.xlsx | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename apache-poi/src/main/resources/com/{bealdung => baeldung}/poi/excel/setformula/SetFormulaTest.xlsx (100%) diff --git a/apache-poi/src/main/resources/com/bealdung/poi/excel/setformula/SetFormulaTest.xlsx b/apache-poi/src/main/resources/com/baeldung/poi/excel/setformula/SetFormulaTest.xlsx similarity index 100% rename from apache-poi/src/main/resources/com/bealdung/poi/excel/setformula/SetFormulaTest.xlsx rename to apache-poi/src/main/resources/com/baeldung/poi/excel/setformula/SetFormulaTest.xlsx From 2dbb667128e3f370bc68b5d1dd4269d8cc6861ef Mon Sep 17 00:00:00 2001 From: Loredana Date: Mon, 27 Jul 2020 12:01:55 +0300 Subject: [PATCH 0290/1862] article was moved to mockito-2; remove duplicate methods from mockito module --- testing-modules/mockito-2/README.md | 3 +- testing-modules/mockito/README.md | 1 - .../mockito/MockitoAnnotationUnitTest.java | 46 ------------------- 3 files changed, 2 insertions(+), 48 deletions(-) diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md index 1a013f5de3..bb7235c2cc 100644 --- a/testing-modules/mockito-2/README.md +++ b/testing-modules/mockito-2/README.md @@ -5,4 +5,5 @@ - [Mockito Strict Stubbing and The UnnecessaryStubbingException](https://www.baeldung.com/mockito-unnecessary-stubbing-exception) - [Mockito and Fluent APIs](https://www.baeldung.com/mockito-fluent-apis) - [Mocking the ObjectMapper readValue() Method](https://www.baeldung.com/mockito-mock-jackson-read-value) -- [Introduction to Mockito’s AdditionalAnswers](https://www.baeldung.com/mockito-additionalanswers) \ No newline at end of file +- [Introduction to Mockito’s AdditionalAnswers](https://www.baeldung.com/mockito-additionalanswers) +- [Mockito – Using Spies](https://www.baeldung.com/mockito-spy) diff --git a/testing-modules/mockito/README.md b/testing-modules/mockito/README.md index 5f307c2f0b..38fb8225a6 100644 --- a/testing-modules/mockito/README.md +++ b/testing-modules/mockito/README.md @@ -12,5 +12,4 @@ - [Mocking Void Methods with Mockito](https://www.baeldung.com/mockito-void-methods) - [Mock Final Classes and Methods with Mockito](https://www.baeldung.com/mockito-final) - [Testing Callbacks with Mockito](https://www.baeldung.com/mockito-callbacks) -- [Mockito – Using Spies](https://www.baeldung.com/mockito-spy) - [Quick Guide to BDDMockito](https://www.baeldung.com/bdd-mockito) diff --git a/testing-modules/mockito/src/test/java/com/baeldung/mockito/MockitoAnnotationUnitTest.java b/testing-modules/mockito/src/test/java/com/baeldung/mockito/MockitoAnnotationUnitTest.java index 27e3258efb..1d3d6b1428 100644 --- a/testing-modules/mockito/src/test/java/com/baeldung/mockito/MockitoAnnotationUnitTest.java +++ b/testing-modules/mockito/src/test/java/com/baeldung/mockito/MockitoAnnotationUnitTest.java @@ -76,52 +76,6 @@ public class MockitoAnnotationUnitTest { assertEquals(100, spiedList.size()); } - @Test - public void whenSpyingOnList_thenCorrect() { - List list = new ArrayList(); - List spyList = Mockito.spy(list); - - spyList.add("one"); - spyList.add("two"); - - Mockito.verify(spyList).add("one"); - Mockito.verify(spyList).add("two"); - - assertEquals(2, spyList.size()); - } - - @Test - public void whenUsingTheSpyAnnotation_thenObjectIsSpied() { - spiedList.add("one"); - spiedList.add("two"); - - Mockito.verify(spiedList).add("one"); - Mockito.verify(spiedList).add("two"); - - assertEquals(2, spiedList.size()); - } - - @Test - public void whenStubASpy_thenStubbed() { - List list = new ArrayList(); - List spyList = Mockito.spy(list); - - assertEquals(0, spyList.size()); - - Mockito.doReturn(100).when(spyList).size(); - assertEquals(100, spyList.size()); - } - - @Test - public void whenCreateSpy_thenCreate() { - List spyList = Mockito.spy(new ArrayList<>()); - - spyList.add("one"); - Mockito.verify(spyList).add("one"); - - assertEquals(1, spyList.size()); - } - @Test public void whenNotUseCaptorAnnotation_thenCorrect() { final List mockList = Mockito.mock(List.class); From 8ee84bbc4aa5ad94af7b66315d1776ab9faf28f1 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 27 Jul 2020 22:13:05 +0200 Subject: [PATCH 0291/1862] JAVA-1650: Get rid of the overriden spring-boot.version property --- spring-5-reactive-security/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-5-reactive-security/pom.xml b/spring-5-reactive-security/pom.xml index 58c993bda5..2024cb5138 100644 --- a/spring-5-reactive-security/pom.xml +++ b/spring-5-reactive-security/pom.xml @@ -128,7 +128,6 @@ 1.0 4.1 3.1.6.RELEASE - 2.2.2.RELEASE From 2a58dcf29d8bf5ae716347d7d879536b747ee6a3 Mon Sep 17 00:00:00 2001 From: Maja Joksovic Date: Tue, 28 Jul 2020 01:33:43 +0200 Subject: [PATCH 0292/1862] initial commit --- .../baeldung/copyfolder/ApacheCommons.java | 15 +++++ .../java/com/baeldung/copyfolder/CoreOld.java | 38 +++++++++++ .../java/com/baeldung/copyfolder/JavaNio.java | 22 +++++++ .../copyfolder/ApacheCommonsUnitTest.java | 59 +++++++++++++++++ .../baeldung/copyfolder/CoreOldUnitTest.java | 63 +++++++++++++++++++ .../baeldung/copyfolder/JavaNioUnitTest.java | 59 +++++++++++++++++ 6 files changed, 256 insertions(+) create mode 100644 core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/ApacheCommons.java create mode 100644 core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/CoreOld.java create mode 100644 core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/JavaNio.java create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/ApacheCommonsUnitTest.java create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/CoreOldUnitTest.java create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/JavaNioUnitTest.java diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/ApacheCommons.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/ApacheCommons.java new file mode 100644 index 0000000000..67af0594a4 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/ApacheCommons.java @@ -0,0 +1,15 @@ +package com.baeldung.copyfolder; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.FileUtils; + +public class ApacheCommons { + + public static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException { + File sourceFolder = new File(sourceDirectoryLocation); + File destinationFolder = new File(destinationDirectoryLocation); + FileUtils.copyDirectory(sourceFolder, destinationFolder); + } +} diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/CoreOld.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/CoreOld.java new file mode 100644 index 0000000000..d1a0158db3 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/CoreOld.java @@ -0,0 +1,38 @@ +package com.baeldung.copyfolder; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class CoreOld { + + public static void copyDirectoryJavaUnder7(File source, File destination) throws IOException { + if (source.isDirectory()) { + copyDirectory(source, destination); + } else { + copyFile(source, destination); + } + } + + private static void copyDirectory(File sourceFolder, File destinationFolder) throws IOException { + if (!destinationFolder.exists()) { + destinationFolder.mkdir(); + } + for (String f : sourceFolder.list()) { + copyDirectoryJavaUnder7(new File(sourceFolder, f), new File(destinationFolder, f)); + } + } + + private static void copyFile(File sourceFile, File destinationFile) throws IOException { + try (InputStream in = new FileInputStream(sourceFile); OutputStream out = new FileOutputStream(destinationFile)) { + byte[] buf = new byte[1024]; + int length; + while ((length = in.read(buf)) > 0) { + out.write(buf, 0, length); + } + } + } +} diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/JavaNio.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/JavaNio.java new file mode 100644 index 0000000000..368118a943 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/JavaNio.java @@ -0,0 +1,22 @@ +package com.baeldung.copyfolder; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class JavaNio { + + public static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException { + Files.walk(Paths.get(sourceDirectoryLocation)) + .forEach(a -> { + Path b = Paths.get(destinationDirectoryLocation, a.toString() + .substring(sourceDirectoryLocation.length())); + try { + Files.copy(a, b); + } catch (IOException e) { + e.printStackTrace(); + } + }); + } +} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/ApacheCommonsUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/ApacheCommonsUnitTest.java new file mode 100644 index 0000000000..71e4c52104 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/ApacheCommonsUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.copyfolder; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Comparator; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class ApacheCommonsUnitTest { + + private final String sourceFolderLocation = "src/test/resources/sourceFolder"; + private final String subFolderName = "/childFolder"; + private final String fileName = "/file.txt"; + private final String destinationFolderLocation = "src/test/resources/destinationFolder"; + + @BeforeEach + public void createFolderWithSubfolderAndFile() throws IOException { + Files.createDirectories(Paths.get(sourceFolderLocation)); + Files.createDirectories(Paths.get(sourceFolderLocation + subFolderName)); + Files.createFile(Paths.get(sourceFolderLocation + subFolderName + fileName)); + } + + @Test + public void whenSourceFolderExists_thenFolderIsFullyCopied() throws IOException { + ApacheCommons.copyDirectory(sourceFolderLocation, destinationFolderLocation); + + assertTrue(new File(destinationFolderLocation).exists()); + assertTrue(new File(destinationFolderLocation + subFolderName).exists()); + assertTrue(new File(destinationFolderLocation + subFolderName + fileName).exists()); + } + + @Test + public void whenSourceFolderDoesNotExist_thenExceptionIsThrown() { + assertThrows(Exception.class, () -> ApacheCommons.copyDirectory("nonExistingFolder", destinationFolderLocation)); + } + + @AfterEach + public void cleanUp() throws IOException { + Files.walk(Paths.get(sourceFolderLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + if (new File(destinationFolderLocation).exists()) { + Files.walk(Paths.get(destinationFolderLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } + } + +} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/CoreOldUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/CoreOldUnitTest.java new file mode 100644 index 0000000000..ba45fd3cd0 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/CoreOldUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.copyfolder; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Comparator; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class CoreOldUnitTest { + + private final String sourceFolderLocation = "src/test/resources/sourceFolder"; + private final String subFolderName = "/childFolder"; + private final String fileName = "/file.txt"; + private final String destinationFolderLocation = "src/test/resources/destinationFolder"; + + @BeforeEach + public void createFolderWithSubfolderAndFile() throws IOException { + Files.createDirectories(Paths.get(sourceFolderLocation)); + Files.createDirectories(Paths.get(sourceFolderLocation + subFolderName)); + Files.createFile(Paths.get(sourceFolderLocation + subFolderName + fileName)); + } + + @Test + public void whenSourceFolderExists_thenFolderIsFullyCopied() throws IOException { + File sourceFolder = new File(sourceFolderLocation); + File destinationFolder = new File(destinationFolderLocation); + CoreOld.copyDirectoryJavaUnder7(sourceFolder, destinationFolder); + + assertTrue(new File(destinationFolderLocation).exists()); + assertTrue(new File(destinationFolderLocation + subFolderName).exists()); + assertTrue(new File(destinationFolderLocation + subFolderName + fileName).exists()); + } + + @Test + public void whenSourceFolderDoesNotExist_thenExceptionIsThrown() throws IOException { + File sourceFolder = new File("nonExistingFolder"); + File destinationFolder = new File(destinationFolderLocation); + assertThrows(IOException.class, () -> CoreOld.copyDirectoryJavaUnder7(sourceFolder, destinationFolder)); + } + + @AfterEach + public void cleanUp() throws IOException { + Files.walk(Paths.get(sourceFolderLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + if (new File(destinationFolderLocation).exists()) { + Files.walk(Paths.get(destinationFolderLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } + } + +} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/JavaNioUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/JavaNioUnitTest.java new file mode 100644 index 0000000000..162811912c --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/JavaNioUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.copyfolder; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Comparator; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class JavaNioUnitTest { + + private final String sourceFolderLocation = "src/test/resources/sourceFolder"; + private final String subFolderName = "/childFolder"; + private final String fileName = "/file.txt"; + private final String destinationFolderLocation = "src/test/resources/destinationFolder"; + + @BeforeEach + public void createFolderWithSubfolderAndFile() throws IOException { + Files.createDirectories(Paths.get(sourceFolderLocation)); + Files.createDirectories(Paths.get(sourceFolderLocation + subFolderName)); + Files.createFile(Paths.get(sourceFolderLocation + subFolderName + fileName)); + } + + @Test + public void whenSourceFolderExists_thenFolderIsFullyCopied() throws IOException { + JavaNio.copyDirectory(sourceFolderLocation, destinationFolderLocation); + + assertTrue(new File(destinationFolderLocation).exists()); + assertTrue(new File(destinationFolderLocation + subFolderName).exists()); + assertTrue(new File(destinationFolderLocation + subFolderName + fileName).exists()); + } + + @Test + public void whenSourceFolderDoesNotExist_thenExceptionIsThrown() { + assertThrows(IOException.class, () -> JavaNio.copyDirectory("nonExistingFolder", destinationFolderLocation)); + } + + @AfterEach + public void cleanUp() throws IOException { + Files.walk(Paths.get(sourceFolderLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + if (new File(destinationFolderLocation).exists()) { + Files.walk(Paths.get(destinationFolderLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } + } + +} From 0423536cf417fdbd1c380b5ae4b6fb685d6b1b4f Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 28 Jul 2020 06:01:54 +0200 Subject: [PATCH 0293/1862] JAVA-2113: Split or move spring-resttemplate module (#9753) * JAVA-2113: Move Proxies With RestTemplate to spring-resttemplate-2 * JAVA-2113: Move A Custom Media Type for a Spring REST API to spring-resttemplate-2 * JAVA-2113: Move RestTemplate Post Request with JSON to spring-resttemplate-2 * JAVA-2113: Move Download an Image or a File with Spring MVC to spring-boot-mvc-3 * JAVA-2113: Fix the test --- spring-boot-modules/spring-boot-mvc-3/README.md | 1 + spring-boot-modules/spring-boot-mvc-3/pom.xml | 9 +++++++++ .../baeldung/produceimage/ImageApplication.java | 0 .../controller/DataProducerController.java | 0 spring-resttemplate-2/README.md | 3 +++ .../RestTemplateConfigurationApplication.java | 13 +++++++++++++ .../resttemplate/web/controller/PersonAPI.java | 0 .../baeldung/resttemplate/web/dto/Person.java | 0 .../resttemplate/web/service/PersonService.java | 0 .../web/service/PersonServiceImpl.java | 0 .../baeldung/sampleapp/config/WebConfig.java | 17 +++++++++++++++++ .../mediatypes/CustomMediaTypeController.java | 0 .../sampleapp/web/dto/BaeldungItem.java | 0 .../sampleapp/web/dto/BaeldungItemV2.java | 0 .../postjson/PersonAPILiveTest.java | 0 .../proxy/RequestFactoryLiveTest.java | 0 .../proxy/RestTemplateCustomizerLiveTest.java | 0 ...ustomMediaTypeControllerIntegrationTest.java | 0 .../CustomMediaTypeControllerLiveTest.java | 0 .../web/controller/mediatypes/TestConfig.java | 0 spring-resttemplate/README.md | 5 ----- .../java/com/baeldung/SpringContextTest.java | 4 +--- 22 files changed, 44 insertions(+), 8 deletions(-) rename {spring-resttemplate => spring-boot-modules/spring-boot-mvc-3}/src/main/java/com/baeldung/produceimage/ImageApplication.java (100%) rename {spring-resttemplate => spring-boot-modules/spring-boot-mvc-3}/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java (100%) create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java rename {spring-resttemplate => spring-resttemplate-2}/src/main/java/com/baeldung/resttemplate/web/controller/PersonAPI.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/main/java/com/baeldung/resttemplate/web/dto/Person.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/main/java/com/baeldung/resttemplate/web/service/PersonService.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/main/java/com/baeldung/resttemplate/web/service/PersonServiceImpl.java (100%) create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/config/WebConfig.java rename {spring-resttemplate => spring-resttemplate-2}/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/test/java/com/baeldung/resttemplate/postjson/PersonAPILiveTest.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerIntegrationTest.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java (100%) rename {spring-resttemplate => spring-resttemplate-2}/src/test/java/com/baeldung/web/controller/mediatypes/TestConfig.java (100%) diff --git a/spring-boot-modules/spring-boot-mvc-3/README.md b/spring-boot-modules/spring-boot-mvc-3/README.md index 58a3008966..0562224337 100644 --- a/spring-boot-modules/spring-boot-mvc-3/README.md +++ b/spring-boot-modules/spring-boot-mvc-3/README.md @@ -5,4 +5,5 @@ This module contains articles about Spring Web MVC in Spring Boot projects. ### Relevant Articles: - [Circular View Path Error](https://www.baeldung.com/spring-circular-view-path-error) +- [Download an Image or a File with Spring MVC](https://www.baeldung.com/spring-controller-return-image-file) - More articles: [[prev -->]](/spring-boot-modules/spring-boot-mvc-2) diff --git a/spring-boot-modules/spring-boot-mvc-3/pom.xml b/spring-boot-modules/spring-boot-mvc-3/pom.xml index 71b7383ef4..31c43461d2 100644 --- a/spring-boot-modules/spring-boot-mvc-3/pom.xml +++ b/spring-boot-modules/spring-boot-mvc-3/pom.xml @@ -26,6 +26,15 @@ org.springframework.boot spring-boot-starter-thymeleaf + + commons-io + commons-io + ${commons-io.version} + + + 2.7 + + \ No newline at end of file diff --git a/spring-resttemplate/src/main/java/com/baeldung/produceimage/ImageApplication.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/produceimage/ImageApplication.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/produceimage/ImageApplication.java rename to spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/produceimage/ImageApplication.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java rename to spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java diff --git a/spring-resttemplate-2/README.md b/spring-resttemplate-2/README.md index d7a8a8633a..e1e0ba40b0 100644 --- a/spring-resttemplate-2/README.md +++ b/spring-resttemplate-2/README.md @@ -5,3 +5,6 @@ This module contains articles about Spring RestTemplate ### Relevant Articles: - [Spring RestTemplate Request/Response Logging](https://www.baeldung.com/spring-resttemplate-logging) +- [Proxies With RestTemplate](https://www.baeldung.com/java-resttemplate-proxy) +- [A Custom Media Type for a Spring REST API](https://www.baeldung.com/spring-rest-custom-media-type) +- [RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json) diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java new file mode 100644 index 0000000000..8df3c13d7b --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.resttemplate; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class RestTemplateConfigurationApplication { + + public static void main(String[] args) { + SpringApplication.run(RestTemplateConfigurationApplication.class, args); + } +} diff --git a/spring-resttemplate/src/main/java/com/baeldung/resttemplate/web/controller/PersonAPI.java b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/web/controller/PersonAPI.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/resttemplate/web/controller/PersonAPI.java rename to spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/web/controller/PersonAPI.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/resttemplate/web/dto/Person.java b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/web/dto/Person.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/resttemplate/web/dto/Person.java rename to spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/web/dto/Person.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/resttemplate/web/service/PersonService.java b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/web/service/PersonService.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/resttemplate/web/service/PersonService.java rename to spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/web/service/PersonService.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/resttemplate/web/service/PersonServiceImpl.java b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/web/service/PersonServiceImpl.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/resttemplate/web/service/PersonServiceImpl.java rename to spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/web/service/PersonServiceImpl.java diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/config/WebConfig.java b/spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/config/WebConfig.java new file mode 100644 index 0000000000..cac12c6978 --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/config/WebConfig.java @@ -0,0 +1,17 @@ +package com.baeldung.sampleapp.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +@EnableWebMvc +@ComponentScan({ "com.baeldung.sampleapp.web" }) +public class WebConfig implements WebMvcConfigurer { + + public WebConfig() { + super(); + } + +} diff --git a/spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java b/spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java rename to spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/web/controller/mediatypes/CustomMediaTypeController.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java b/spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java rename to spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItem.java diff --git a/spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java b/spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java similarity index 100% rename from spring-resttemplate/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java rename to spring-resttemplate-2/src/main/java/com/baeldung/sampleapp/web/dto/BaeldungItemV2.java diff --git a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/postjson/PersonAPILiveTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/postjson/PersonAPILiveTest.java similarity index 100% rename from spring-resttemplate/src/test/java/com/baeldung/resttemplate/postjson/PersonAPILiveTest.java rename to spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/postjson/PersonAPILiveTest.java diff --git a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java similarity index 100% rename from spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java rename to spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/proxy/RequestFactoryLiveTest.java diff --git a/spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java similarity index 100% rename from spring-resttemplate/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java rename to spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/proxy/RestTemplateCustomizerLiveTest.java diff --git a/spring-resttemplate/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerIntegrationTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerIntegrationTest.java similarity index 100% rename from spring-resttemplate/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerIntegrationTest.java rename to spring-resttemplate-2/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerIntegrationTest.java diff --git a/spring-resttemplate/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java similarity index 100% rename from spring-resttemplate/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java rename to spring-resttemplate-2/src/test/java/com/baeldung/web/controller/mediatypes/CustomMediaTypeControllerLiveTest.java diff --git a/spring-resttemplate/src/test/java/com/baeldung/web/controller/mediatypes/TestConfig.java b/spring-resttemplate-2/src/test/java/com/baeldung/web/controller/mediatypes/TestConfig.java similarity index 100% rename from spring-resttemplate/src/test/java/com/baeldung/web/controller/mediatypes/TestConfig.java rename to spring-resttemplate-2/src/test/java/com/baeldung/web/controller/mediatypes/TestConfig.java diff --git a/spring-resttemplate/README.md b/spring-resttemplate/README.md index bbfda4f6b8..952f35e90b 100644 --- a/spring-resttemplate/README.md +++ b/spring-resttemplate/README.md @@ -11,16 +11,11 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring RestTemplate Error Handling](https://www.baeldung.com/spring-rest-template-error-handling) - [Configure a RestTemplate with RestTemplateBuilder](https://www.baeldung.com/spring-rest-template-builder) - [Mocking a RestTemplate in Spring](https://www.baeldung.com/spring-mock-rest-template) -- [RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json) - [Download a Large File Through a Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-download-large-file) - [Using the Spring RestTemplate Interceptor](https://www.baeldung.com/spring-rest-template-interceptor) - [Uploading MultipartFile with Spring RestTemplate](https://www.baeldung.com/spring-rest-template-multipart-upload) - [Get and Post Lists of Objects with RestTemplate](https://www.baeldung.com/spring-rest-template-list) -- [Copy of RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json-test) - [HTTP PUT vs HTTP PATCH in a REST API](https://www.baeldung.com/http-put-patch-difference-spring) -- [A Custom Media Type for a Spring REST API](https://www.baeldung.com/spring-rest-custom-media-type) -- [Download an Image or a File with Spring MVC](https://www.baeldung.com/spring-controller-return-image-file) -- [Proxies With RestTemplate](https://www.baeldung.com/java-resttemplate-proxy) ### NOTE: diff --git a/spring-resttemplate/src/test/java/com/baeldung/SpringContextTest.java b/spring-resttemplate/src/test/java/com/baeldung/SpringContextTest.java index 19d5eabd2b..43901cf37f 100644 --- a/spring-resttemplate/src/test/java/com/baeldung/SpringContextTest.java +++ b/spring-resttemplate/src/test/java/com/baeldung/SpringContextTest.java @@ -5,12 +5,10 @@ import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.produceimage.ImageApplication; import com.baeldung.responseheaders.ResponseHeadersApplication; @RunWith(SpringRunner.class) -@SpringBootTest(classes = { ImageApplication.class, - ResponseHeadersApplication.class, +@SpringBootTest(classes = { ResponseHeadersApplication.class, com.baeldung.web.upload.app.UploadApplication.class, }) public class SpringContextTest { From 784ea2b061cf91622131eb6c0b50d75908f055fe Mon Sep 17 00:00:00 2001 From: Maja Joksovic Date: Tue, 28 Jul 2020 08:26:32 +0200 Subject: [PATCH 0294/1862] clean-up --- .../ApacheCommons.java | 8 +-- .../CoreOld.java | 12 ++-- .../JavaNio.java | 2 +- .../copydirectory/ApacheCommonsUnitTest.java | 59 +++++++++++++++++ .../copydirectory/CoreOldUnitTest.java | 63 +++++++++++++++++++ .../copydirectory/JavaNioUnitTest.java | 59 +++++++++++++++++ .../copyfolder/ApacheCommonsUnitTest.java | 59 ----------------- .../baeldung/copyfolder/CoreOldUnitTest.java | 63 ------------------- .../baeldung/copyfolder/JavaNioUnitTest.java | 59 ----------------- 9 files changed, 192 insertions(+), 192 deletions(-) rename core-java-modules/core-java-io-3/src/main/java/com/baeldung/{copyfolder => copydirectory}/ApacheCommons.java (51%) rename core-java-modules/core-java-io-3/src/main/java/com/baeldung/{copyfolder => copydirectory}/CoreOld.java (69%) rename core-java-modules/core-java-io-3/src/main/java/com/baeldung/{copyfolder => copydirectory}/JavaNio.java (94%) create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/ApacheCommonsUnitTest.java create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/CoreOldUnitTest.java create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/JavaNioUnitTest.java delete mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/ApacheCommonsUnitTest.java delete mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/CoreOldUnitTest.java delete mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/JavaNioUnitTest.java diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/ApacheCommons.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/ApacheCommons.java similarity index 51% rename from core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/ApacheCommons.java rename to core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/ApacheCommons.java index 67af0594a4..b8aa283b48 100644 --- a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/ApacheCommons.java +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/ApacheCommons.java @@ -1,4 +1,4 @@ -package com.baeldung.copyfolder; +package com.baeldung.copydirectory; import java.io.File; import java.io.IOException; @@ -8,8 +8,8 @@ import org.apache.commons.io.FileUtils; public class ApacheCommons { public static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException { - File sourceFolder = new File(sourceDirectoryLocation); - File destinationFolder = new File(destinationDirectoryLocation); - FileUtils.copyDirectory(sourceFolder, destinationFolder); + File sourceDirectory = new File(sourceDirectoryLocation); + File destinationDirectory = new File(destinationDirectoryLocation); + FileUtils.copyDirectory(sourceDirectory, destinationDirectory); } } diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/CoreOld.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/CoreOld.java similarity index 69% rename from core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/CoreOld.java rename to core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/CoreOld.java index d1a0158db3..2070977534 100644 --- a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/CoreOld.java +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/CoreOld.java @@ -1,4 +1,4 @@ -package com.baeldung.copyfolder; +package com.baeldung.copydirectory; import java.io.File; import java.io.FileInputStream; @@ -17,12 +17,12 @@ public class CoreOld { } } - private static void copyDirectory(File sourceFolder, File destinationFolder) throws IOException { - if (!destinationFolder.exists()) { - destinationFolder.mkdir(); + private static void copyDirectory(File sourceDirectory, File destinationDirectory) throws IOException { + if (!destinationDirectory.exists()) { + destinationDirectory.mkdir(); } - for (String f : sourceFolder.list()) { - copyDirectoryJavaUnder7(new File(sourceFolder, f), new File(destinationFolder, f)); + for (String f : sourceDirectory.list()) { + copyDirectoryJavaUnder7(new File(sourceDirectory, f), new File(destinationDirectory, f)); } } diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/JavaNio.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java similarity index 94% rename from core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/JavaNio.java rename to core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java index 368118a943..3f28bf0c9d 100644 --- a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copyfolder/JavaNio.java +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java @@ -1,4 +1,4 @@ -package com.baeldung.copyfolder; +package com.baeldung.copydirectory; import java.io.IOException; import java.nio.file.Files; diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/ApacheCommonsUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/ApacheCommonsUnitTest.java new file mode 100644 index 0000000000..3486a9af9d --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/ApacheCommonsUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.copydirectory; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Comparator; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class ApacheCommonsUnitTest { + + private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory"; + private final String subDirectoryName = "/childDirectory"; + private final String fileName = "/file.txt"; + private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory"; + + @BeforeEach + public void createDirectoryWithSubdirectoryAndFile() throws IOException { + Files.createDirectories(Paths.get(sourceDirectoryLocation)); + Files.createDirectories(Paths.get(sourceDirectoryLocation + subDirectoryName)); + Files.createFile(Paths.get(sourceDirectoryLocation + subDirectoryName + fileName)); + } + + @Test + public void whenSourceDirectoryExists_thenDirectoryIsFullyCopied() throws IOException { + ApacheCommons.copyDirectory(sourceDirectoryLocation, destinationDirectoryLocation); + + assertTrue(new File(destinationDirectoryLocation).exists()); + assertTrue(new File(destinationDirectoryLocation + subDirectoryName).exists()); + assertTrue(new File(destinationDirectoryLocation + subDirectoryName + fileName).exists()); + } + + @Test + public void whenSourceDirectoryDoesNotExist_thenExceptionIsThrown() { + assertThrows(Exception.class, () -> ApacheCommons.copyDirectory("nonExistingDirectory", destinationDirectoryLocation)); + } + + @AfterEach + public void cleanUp() throws IOException { + Files.walk(Paths.get(sourceDirectoryLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + if (new File(destinationDirectoryLocation).exists()) { + Files.walk(Paths.get(destinationDirectoryLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } + } + +} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/CoreOldUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/CoreOldUnitTest.java new file mode 100644 index 0000000000..53ae216399 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/CoreOldUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.copydirectory; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Comparator; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class CoreOldUnitTest { + + private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory"; + private final String subDirectoryName = "/childDirectory"; + private final String fileName = "/file.txt"; + private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory"; + + @BeforeEach + public void createDirectoryWithSubdirectoryAndFile() throws IOException { + Files.createDirectories(Paths.get(sourceDirectoryLocation)); + Files.createDirectories(Paths.get(sourceDirectoryLocation + subDirectoryName)); + Files.createFile(Paths.get(sourceDirectoryLocation + subDirectoryName + fileName)); + } + + @Test + public void whenSourceDirectoryExists_thenDirectoryIsFullyCopied() throws IOException { + File sourceDirectory = new File(sourceDirectoryLocation); + File destinationDirectory = new File(destinationDirectoryLocation); + CoreOld.copyDirectoryJavaUnder7(sourceDirectory, destinationDirectory); + + assertTrue(new File(destinationDirectoryLocation).exists()); + assertTrue(new File(destinationDirectoryLocation + subDirectoryName).exists()); + assertTrue(new File(destinationDirectoryLocation + subDirectoryName + fileName).exists()); + } + + @Test + public void whenSourceDirectoryDoesNotExist_thenExceptionIsThrown() throws IOException { + File sourceDirectory = new File("nonExistingDirectory"); + File destinationDirectory = new File(destinationDirectoryLocation); + assertThrows(IOException.class, () -> CoreOld.copyDirectoryJavaUnder7(sourceDirectory, destinationDirectory)); + } + + @AfterEach + public void cleanUp() throws IOException { + Files.walk(Paths.get(sourceDirectoryLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + if (new File(destinationDirectoryLocation).exists()) { + Files.walk(Paths.get(destinationDirectoryLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } + } + +} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/JavaNioUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/JavaNioUnitTest.java new file mode 100644 index 0000000000..8d1eea53c9 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/JavaNioUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.copydirectory; + +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Comparator; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +public class JavaNioUnitTest { + + private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory"; + private final String subDirectoryName = "/childDirectory"; + private final String fileName = "/file.txt"; + private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory"; + + @BeforeEach + public void createDirectoryWithSubdirectoryAndFile() throws IOException { + Files.createDirectories(Paths.get(sourceDirectoryLocation)); + Files.createDirectories(Paths.get(sourceDirectoryLocation + subDirectoryName)); + Files.createFile(Paths.get(sourceDirectoryLocation + subDirectoryName + fileName)); + } + + @Test + public void whenSourceDirectoryExists_thenDirectoryIsFullyCopied() throws IOException { + JavaNio.copyDirectory(sourceDirectoryLocation, destinationDirectoryLocation); + + assertTrue(new File(destinationDirectoryLocation).exists()); + assertTrue(new File(destinationDirectoryLocation + subDirectoryName).exists()); + assertTrue(new File(destinationDirectoryLocation + subDirectoryName + fileName).exists()); + } + + @Test + public void whenSourceDirectoryDoesNotExist_thenExceptionIsThrown() { + assertThrows(IOException.class, () -> JavaNio.copyDirectory("nonExistingDirectory", destinationDirectoryLocation)); + } + + @AfterEach + public void cleanUp() throws IOException { + Files.walk(Paths.get(sourceDirectoryLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + if (new File(destinationDirectoryLocation).exists()) { + Files.walk(Paths.get(destinationDirectoryLocation)) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } + } + +} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/ApacheCommonsUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/ApacheCommonsUnitTest.java deleted file mode 100644 index 71e4c52104..0000000000 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/ApacheCommonsUnitTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.baeldung.copyfolder; - -import static org.junit.Assert.assertTrue; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Comparator; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class ApacheCommonsUnitTest { - - private final String sourceFolderLocation = "src/test/resources/sourceFolder"; - private final String subFolderName = "/childFolder"; - private final String fileName = "/file.txt"; - private final String destinationFolderLocation = "src/test/resources/destinationFolder"; - - @BeforeEach - public void createFolderWithSubfolderAndFile() throws IOException { - Files.createDirectories(Paths.get(sourceFolderLocation)); - Files.createDirectories(Paths.get(sourceFolderLocation + subFolderName)); - Files.createFile(Paths.get(sourceFolderLocation + subFolderName + fileName)); - } - - @Test - public void whenSourceFolderExists_thenFolderIsFullyCopied() throws IOException { - ApacheCommons.copyDirectory(sourceFolderLocation, destinationFolderLocation); - - assertTrue(new File(destinationFolderLocation).exists()); - assertTrue(new File(destinationFolderLocation + subFolderName).exists()); - assertTrue(new File(destinationFolderLocation + subFolderName + fileName).exists()); - } - - @Test - public void whenSourceFolderDoesNotExist_thenExceptionIsThrown() { - assertThrows(Exception.class, () -> ApacheCommons.copyDirectory("nonExistingFolder", destinationFolderLocation)); - } - - @AfterEach - public void cleanUp() throws IOException { - Files.walk(Paths.get(sourceFolderLocation)) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - if (new File(destinationFolderLocation).exists()) { - Files.walk(Paths.get(destinationFolderLocation)) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - } - -} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/CoreOldUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/CoreOldUnitTest.java deleted file mode 100644 index ba45fd3cd0..0000000000 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/CoreOldUnitTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.baeldung.copyfolder; - -import static org.junit.Assert.assertTrue; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Comparator; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class CoreOldUnitTest { - - private final String sourceFolderLocation = "src/test/resources/sourceFolder"; - private final String subFolderName = "/childFolder"; - private final String fileName = "/file.txt"; - private final String destinationFolderLocation = "src/test/resources/destinationFolder"; - - @BeforeEach - public void createFolderWithSubfolderAndFile() throws IOException { - Files.createDirectories(Paths.get(sourceFolderLocation)); - Files.createDirectories(Paths.get(sourceFolderLocation + subFolderName)); - Files.createFile(Paths.get(sourceFolderLocation + subFolderName + fileName)); - } - - @Test - public void whenSourceFolderExists_thenFolderIsFullyCopied() throws IOException { - File sourceFolder = new File(sourceFolderLocation); - File destinationFolder = new File(destinationFolderLocation); - CoreOld.copyDirectoryJavaUnder7(sourceFolder, destinationFolder); - - assertTrue(new File(destinationFolderLocation).exists()); - assertTrue(new File(destinationFolderLocation + subFolderName).exists()); - assertTrue(new File(destinationFolderLocation + subFolderName + fileName).exists()); - } - - @Test - public void whenSourceFolderDoesNotExist_thenExceptionIsThrown() throws IOException { - File sourceFolder = new File("nonExistingFolder"); - File destinationFolder = new File(destinationFolderLocation); - assertThrows(IOException.class, () -> CoreOld.copyDirectoryJavaUnder7(sourceFolder, destinationFolder)); - } - - @AfterEach - public void cleanUp() throws IOException { - Files.walk(Paths.get(sourceFolderLocation)) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - if (new File(destinationFolderLocation).exists()) { - Files.walk(Paths.get(destinationFolderLocation)) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - } - -} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/JavaNioUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/JavaNioUnitTest.java deleted file mode 100644 index 162811912c..0000000000 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copyfolder/JavaNioUnitTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.baeldung.copyfolder; - -import static org.junit.Assert.assertTrue; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Comparator; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class JavaNioUnitTest { - - private final String sourceFolderLocation = "src/test/resources/sourceFolder"; - private final String subFolderName = "/childFolder"; - private final String fileName = "/file.txt"; - private final String destinationFolderLocation = "src/test/resources/destinationFolder"; - - @BeforeEach - public void createFolderWithSubfolderAndFile() throws IOException { - Files.createDirectories(Paths.get(sourceFolderLocation)); - Files.createDirectories(Paths.get(sourceFolderLocation + subFolderName)); - Files.createFile(Paths.get(sourceFolderLocation + subFolderName + fileName)); - } - - @Test - public void whenSourceFolderExists_thenFolderIsFullyCopied() throws IOException { - JavaNio.copyDirectory(sourceFolderLocation, destinationFolderLocation); - - assertTrue(new File(destinationFolderLocation).exists()); - assertTrue(new File(destinationFolderLocation + subFolderName).exists()); - assertTrue(new File(destinationFolderLocation + subFolderName + fileName).exists()); - } - - @Test - public void whenSourceFolderDoesNotExist_thenExceptionIsThrown() { - assertThrows(IOException.class, () -> JavaNio.copyDirectory("nonExistingFolder", destinationFolderLocation)); - } - - @AfterEach - public void cleanUp() throws IOException { - Files.walk(Paths.get(sourceFolderLocation)) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - if (new File(destinationFolderLocation).exists()) { - Files.walk(Paths.get(destinationFolderLocation)) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - } - -} From 000ce564ffe3e9191285d56854b23b8b4ea9455e Mon Sep 17 00:00:00 2001 From: Maja Joksovic Date: Tue, 28 Jul 2020 10:03:46 +0200 Subject: [PATCH 0295/1862] changed variable names --- .../src/main/java/com/baeldung/copydirectory/JavaNio.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java index 3f28bf0c9d..fe1eb59c64 100644 --- a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java @@ -9,11 +9,11 @@ public class JavaNio { public static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException { Files.walk(Paths.get(sourceDirectoryLocation)) - .forEach(a -> { - Path b = Paths.get(destinationDirectoryLocation, a.toString() + .forEach(source -> { + Path destination = Paths.get(destinationDirectoryLocation, source.toString() .substring(sourceDirectoryLocation.length())); try { - Files.copy(a, b); + Files.copy(source, destination); } catch (IOException e) { e.printStackTrace(); } From 0cade733ca1f44f2d726dff8290708820fbd3ccd Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Tue, 28 Jul 2020 17:34:46 +0530 Subject: [PATCH 0296/1862] JAVA-2154: Create guava-parent module and organize guava modules (#9782) * JAVA-2154: Removed module, now split into guava-utilities and guava-core * JAVA-2154: Removed module, articles moved to new module guava-core * JAVA-2154: Moved module inside guava-modules * JAVA-2154: Moved module inside guava-modules * JAVA-2154: Moved module inside guava-modules * JAVA-2154: Moved module inside guava-modules * JAVA-2154: Moved 1 article to guava-collections * JAVA-2154: New module guava-collections-list * JAVA-2154: New module guava-core * JAVA-2154: New module guava-utilities * JAVA-2154: Updated README, removed extra article reference * JAVA-2154: parent module pom changes * JAVA-2154: main pom changes - removed guava related modules as they have been shifted inside guava-modules * JAVA-2154: rearranged and moved module inside guava-modules folder --- guava-2/README.md | 7 -- guava-modules/guava-18/README.md | 5 +- guava-modules/guava-19/README.md | 2 - guava-modules/guava-21/README.md | 4 +- guava-modules/guava-21/pom.xml | 9 -- .../guava-collections-list/README.md | 8 ++ .../guava-collections-list}/pom.xml | 8 +- .../src/main/resources/logback.xml | 0 .../guava/lists/GuavaListsUnitTest.java | 0 .../CollectionApachePartitionUnitTest.java | 0 .../CollectionGuavaPartitionUnitTest.java | 0 .../CollectionJavaPartitionUnitTest.java | 0 .../guava-collections-map}/README.md | 0 .../guava-collections-map}/pom.xml | 4 +- .../com/baeldung/guava/mapmaker/Profile.java | 0 .../com/baeldung/guava/mapmaker/Session.java | 0 .../com/baeldung/guava/mapmaker/User.java | 0 .../ClassToInstanceMapUnitTest.java | 0 .../GuavaMapInitializeUnitTest.java | 0 .../guava/mapmaker/GuavaMapMakerUnitTest.java | 0 .../guava/maps/GuavaMapsUnitTest.java | 0 .../guava/multimap/GuavaMultiMapUnitTest.java | 0 .../guava/rangemap/GuavaRangeMapUnitTest.java | 0 .../guava-collections-set}/.gitignore | 0 .../guava-collections-set}/README.md | 0 .../guava-collections-set}/pom.xml | 4 +- .../com/baeldung/guava/GuavaMapFromSet.java | 0 .../guava/GuavaMapFromSetUnitTest.java | 0 .../baeldung/guava/GuavaMultiSetUnitTest.java | 0 .../baeldung/guava/GuavaRangeSetUnitTest.java | 0 .../guava/GuavaSetOperationsUnitTest.java | 0 .../guava-collections}/README.md | 3 +- guava-modules/guava-collections/pom.xml | 95 ++++++++++++++++++ .../src/main/resources/logback.xml | 0 .../GuavaCollectionsExamplesUnitTest.java | 0 ...avaFilterTransformCollectionsUnitTest.java | 0 .../guava/joinsplit/GuavaStringUnitTest.java | 0 .../GuavaOrderingExamplesUnitTest.java | 0 .../guava/ordering/GuavaOrderingUnitTest.java | 0 .../guava/queues/EvictingQueueUnitTest.java | 0 .../queues/MinMaxPriorityQueueUnitTest.java | 0 .../guava/table/GuavaTableUnitTest.java | 0 .../guava/zip/ZipCollectionUnitTest.java | 0 .../hamcrest/HamcrestExamplesUnitTest.java | 0 .../src/test/resources/test.out | 0 .../src/test/resources/test1.in | 0 .../src/test/resources/test1_1.in | 0 .../src/test/resources/test2.in | 0 .../src/test/resources/test_copy.in | 0 .../src/test/resources/test_le.txt | Bin guava-modules/guava-core/README.md | 10 ++ {guava-2 => guava-modules/guava-core}/pom.xml | 8 +- .../guava/memoizer/CostlySupplier.java | 0 .../baeldung/guava/memoizer/Factorial.java | 0 .../guava/memoizer/FibonacciSequence.java | 0 .../charmatcher/GuavaCharMatcherUnitTest.java | 0 .../GuavaFunctionalExamplesUnitTest.java | 2 +- .../memoizer}/GuavaMemoizerUnitTest.java | 2 +- .../GuavaPreConditionsUnitTest.java | 2 +- .../guava/throwables/ThrowablesUnitTest.java | 0 .../guava-core/src/test/resources}/.gitignore | 0 .../guava-core}/src/test/resources/test.out | 0 .../guava-core}/src/test/resources/test1.in | 0 .../guava-core}/src/test/resources/test1_1.in | 0 .../guava-core}/src/test/resources/test2.in | 0 .../src/test/resources/test_copy.in | 0 .../src/test/resources/test_le.txt | Bin .../guava-io}/README.md | 0 {guava-io => guava-modules/guava-io}/pom.xml | 4 +- .../GuavaCountingOutputStreamUnitTest.java | 0 .../com/baeldung/guava/GuavaIOUnitTest.java | 0 .../guava-io}/src/test/resources/test1.in | 0 .../guava-io}/src/test/resources/test1_1.in | 0 .../guava-io}/src/test/resources/test2.in | 0 .../guava-utilities}/.gitignore | 0 .../guava-utilities}/README.md | 9 +- .../guava-utilities}/pom.xml | 8 +- .../baeldung/guava/eventbus}/CustomEvent.java | 2 +- .../guava/eventbus}/EventListener.java | 2 +- .../src/main/resources/logback.xml | 19 ++++ .../bloomfilter}/BloomFilterUnitTest.java | 2 +- .../guava/cache}/GuavaCacheUnitTest.java | 2 +- .../GuavaCacheLoaderUnitTest.java | 2 +- .../eventbus}/GuavaEventBusUnitTest.java | 4 +- .../GuavaBigIntegerMathUnitTest.java | 2 +- .../mathutils}/GuavaDoubleMathUnitTest.java | 2 +- .../mathutils}/GuavaIntMathUnitTest.java | 2 +- .../mathutils}/GuavaLongMathUnitTest.java | 2 +- .../guava/mathutils}/GuavaMathUnitTest.java | 2 +- .../RateLimiterLongRunningUnitTest.java | 2 +- .../GuavaReflectionUtilsUnitTest.java | 2 +- .../src/test/resources/.gitignore | 0 .../src/test/resources/test.out | 0 .../src/test/resources/test1.in | 0 .../src/test/resources/test1_1.in | 0 .../src/test/resources/test2.in | 0 .../src/test/resources/test_copy.in | 0 .../src/test/resources/test_le.txt | Bin guava-modules/pom.xml | 7 ++ pom.xml | 15 +-- 100 files changed, 184 insertions(+), 79 deletions(-) delete mode 100644 guava-2/README.md create mode 100644 guava-modules/guava-collections-list/README.md rename {guava-collections => guava-modules/guava-collections-list}/pom.xml (93%) rename {guava-collections => guava-modules/guava-collections-list}/src/main/resources/logback.xml (100%) rename {guava-collections => guava-modules/guava-collections-list}/src/test/java/com/baeldung/guava/lists/GuavaListsUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections-list}/src/test/java/com/baeldung/guava/partition/CollectionApachePartitionUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections-list}/src/test/java/com/baeldung/guava/partition/CollectionGuavaPartitionUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections-list}/src/test/java/com/baeldung/guava/partition/CollectionJavaPartitionUnitTest.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/README.md (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/pom.xml (94%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/main/java/com/baeldung/guava/mapmaker/Profile.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/main/java/com/baeldung/guava/mapmaker/Session.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/main/java/com/baeldung/guava/mapmaker/User.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/test/java/com/baeldung/guava/classtoinstancemap/ClassToInstanceMapUnitTest.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/test/java/com/baeldung/guava/initializemaps/GuavaMapInitializeUnitTest.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/test/java/com/baeldung/guava/mapmaker/GuavaMapMakerUnitTest.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/test/java/com/baeldung/guava/maps/GuavaMapsUnitTest.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/test/java/com/baeldung/guava/multimap/GuavaMultiMapUnitTest.java (100%) rename {guava-collections-map => guava-modules/guava-collections-map}/src/test/java/com/baeldung/guava/rangemap/GuavaRangeMapUnitTest.java (100%) rename {guava-2/src/test/resources => guava-modules/guava-collections-set}/.gitignore (100%) rename {guava-collections-set => guava-modules/guava-collections-set}/README.md (100%) rename {guava-collections-set => guava-modules/guava-collections-set}/pom.xml (94%) rename {guava-collections-set => guava-modules/guava-collections-set}/src/test/java/com/baeldung/guava/GuavaMapFromSet.java (100%) rename {guava-collections-set => guava-modules/guava-collections-set}/src/test/java/com/baeldung/guava/GuavaMapFromSetUnitTest.java (100%) rename {guava-collections-set => guava-modules/guava-collections-set}/src/test/java/com/baeldung/guava/GuavaMultiSetUnitTest.java (100%) rename {guava-collections-set => guava-modules/guava-collections-set}/src/test/java/com/baeldung/guava/GuavaRangeSetUnitTest.java (100%) rename {guava-collections-set => guava-modules/guava-collections-set}/src/test/java/com/baeldung/guava/GuavaSetOperationsUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/README.md (86%) create mode 100644 guava-modules/guava-collections/pom.xml rename {guava => guava-modules/guava-collections}/src/main/resources/logback.xml (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/guava/collections/GuavaCollectionsExamplesUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/guava/filtertransform/GuavaFilterTransformCollectionsUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/guava/joinsplit/GuavaStringUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/guava/ordering/GuavaOrderingExamplesUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/guava/ordering/GuavaOrderingUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/guava/queues/EvictingQueueUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/guava/queues/MinMaxPriorityQueueUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/guava/table/GuavaTableUnitTest.java (100%) rename guava-modules/{guava-21 => guava-collections}/src/test/java/com/baeldung/guava/zip/ZipCollectionUnitTest.java (100%) rename {guava-collections => guava-modules/guava-collections}/src/test/java/com/baeldung/hamcrest/HamcrestExamplesUnitTest.java (100%) rename {guava-2 => guava-modules/guava-collections}/src/test/resources/test.out (100%) rename {guava-2 => guava-modules/guava-collections}/src/test/resources/test1.in (100%) rename {guava-2 => guava-modules/guava-collections}/src/test/resources/test1_1.in (100%) rename {guava-2 => guava-modules/guava-collections}/src/test/resources/test2.in (100%) rename {guava-2 => guava-modules/guava-collections}/src/test/resources/test_copy.in (100%) rename {guava-2 => guava-modules/guava-collections}/src/test/resources/test_le.txt (100%) create mode 100644 guava-modules/guava-core/README.md rename {guava-2 => guava-modules/guava-core}/pom.xml (89%) rename {guava => guava-modules/guava-core}/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java (100%) rename {guava => guava-modules/guava-core}/src/main/java/com/baeldung/guava/memoizer/Factorial.java (100%) rename {guava => guava-modules/guava-core}/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java (100%) rename {guava-2 => guava-modules/guava-core}/src/test/java/com/baeldung/guava/charmatcher/GuavaCharMatcherUnitTest.java (100%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-core/src/test/java/com/baeldung/guava/functional}/GuavaFunctionalExamplesUnitTest.java (99%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-core/src/test/java/com/baeldung/guava/memoizer}/GuavaMemoizerUnitTest.java (98%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-core/src/test/java/com/baeldung/guava/preconditions}/GuavaPreConditionsUnitTest.java (99%) rename {guava-2 => guava-modules/guava-core}/src/test/java/com/baeldung/guava/throwables/ThrowablesUnitTest.java (100%) rename {guava-collections-set => guava-modules/guava-core/src/test/resources}/.gitignore (100%) rename {guava-collections => guava-modules/guava-core}/src/test/resources/test.out (100%) rename {guava-collections => guava-modules/guava-core}/src/test/resources/test1.in (100%) rename {guava-collections => guava-modules/guava-core}/src/test/resources/test1_1.in (100%) rename {guava-collections => guava-modules/guava-core}/src/test/resources/test2.in (100%) rename {guava-collections => guava-modules/guava-core}/src/test/resources/test_copy.in (100%) rename {guava-collections => guava-modules/guava-core}/src/test/resources/test_le.txt (100%) rename {guava-io => guava-modules/guava-io}/README.md (100%) rename {guava-io => guava-modules/guava-io}/pom.xml (93%) rename {guava-io => guava-modules/guava-io}/src/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java (100%) rename {guava-io => guava-modules/guava-io}/src/test/java/com/baeldung/guava/GuavaIOUnitTest.java (100%) rename {guava-io => guava-modules/guava-io}/src/test/resources/test1.in (100%) rename {guava-io => guava-modules/guava-io}/src/test/resources/test1_1.in (100%) rename {guava-io => guava-modules/guava-io}/src/test/resources/test2.in (100%) rename {guava => guava-modules/guava-utilities}/.gitignore (100%) rename {guava => guava-modules/guava-utilities}/README.md (60%) rename {guava => guava-modules/guava-utilities}/pom.xml (92%) rename {guava/src/main/java/com/baeldung/guava => guava-modules/guava-utilities/src/main/java/com/baeldung/guava/eventbus}/CustomEvent.java (87%) rename {guava/src/main/java/com/baeldung/guava => guava-modules/guava-utilities/src/main/java/com/baeldung/guava/eventbus}/EventListener.java (96%) create mode 100644 guava-modules/guava-utilities/src/main/resources/logback.xml rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/bloomfilter}/BloomFilterUnitTest.java (97%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/cache}/GuavaCacheUnitTest.java (99%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/cacheloader}/GuavaCacheLoaderUnitTest.java (98%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/eventbus}/GuavaEventBusUnitTest.java (90%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils}/GuavaBigIntegerMathUnitTest.java (99%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils}/GuavaDoubleMathUnitTest.java (98%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils}/GuavaIntMathUnitTest.java (99%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils}/GuavaLongMathUnitTest.java (99%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils}/GuavaMathUnitTest.java (99%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/ratelimiter}/RateLimiterLongRunningUnitTest.java (98%) rename {guava/src/test/java/com/baeldung/guava => guava-modules/guava-utilities/src/test/java/com/baeldung/guava/reflectionutils}/GuavaReflectionUtilsUnitTest.java (99%) rename {guava => guava-modules/guava-utilities}/src/test/resources/.gitignore (100%) rename {guava => guava-modules/guava-utilities}/src/test/resources/test.out (100%) rename {guava => guava-modules/guava-utilities}/src/test/resources/test1.in (100%) rename {guava => guava-modules/guava-utilities}/src/test/resources/test1_1.in (100%) rename {guava => guava-modules/guava-utilities}/src/test/resources/test2.in (100%) rename {guava => guava-modules/guava-utilities}/src/test/resources/test_copy.in (100%) rename {guava => guava-modules/guava-utilities}/src/test/resources/test_le.txt (100%) diff --git a/guava-2/README.md b/guava-2/README.md deleted file mode 100644 index 32afc10916..0000000000 --- a/guava-2/README.md +++ /dev/null @@ -1,7 +0,0 @@ -## Guava - -This module contains articles a Google Guava - -### Relevant Articles: - -- [Guava CharMatcher](https://www.baeldung.com/guava-string-charmatcher) diff --git a/guava-modules/guava-18/README.md b/guava-modules/guava-18/README.md index fd5de4170a..bdd289b86f 100644 --- a/guava-modules/guava-18/README.md +++ b/guava-modules/guava-18/README.md @@ -1,8 +1,5 @@ -========= - -## Guava and Hamcrest Cookbooks and Examples +## Guava 18 ### Relevant Articles: -- [Guava Functional Cookbook](http://www.baeldung.com/guava-functions-predicates) - [Guava 18: What’s New?](http://www.baeldung.com/whats-new-in-guava-18) diff --git a/guava-modules/guava-19/README.md b/guava-modules/guava-19/README.md index be9f2d72a4..6508410ba2 100644 --- a/guava-modules/guava-19/README.md +++ b/guava-modules/guava-19/README.md @@ -1,5 +1,3 @@ -========= - ## Guava 19 diff --git a/guava-modules/guava-21/README.md b/guava-modules/guava-21/README.md index 4e897325b6..ad70a180b0 100644 --- a/guava-modules/guava-21/README.md +++ b/guava-modules/guava-21/README.md @@ -1,4 +1,6 @@ +## Guava 21 + ### Relevant articles: + - [New Stream, Comparator and Collector in Guava 21](http://www.baeldung.com/guava-21-new) - [New in Guava 21 common.util.concurrent](http://www.baeldung.com/guava-21-util-concurrent) -- [Zipping Collections in Java](http://www.baeldung.com/java-collections-zip) diff --git a/guava-modules/guava-21/pom.xml b/guava-modules/guava-21/pom.xml index b126df99cb..b793f11a7f 100644 --- a/guava-modules/guava-21/pom.xml +++ b/guava-modules/guava-21/pom.xml @@ -13,17 +13,8 @@ ../ - - - org.jooq - jool - ${jool.version} - - - 21.0 - 0.9.12 \ No newline at end of file diff --git a/guava-modules/guava-collections-list/README.md b/guava-modules/guava-collections-list/README.md new file mode 100644 index 0000000000..d7f9ce2e32 --- /dev/null +++ b/guava-modules/guava-collections-list/README.md @@ -0,0 +1,8 @@ +## Guava Collections List examples + +This module contains articles about list collections in Guava + +### Relevant Articles: + +- [Partition a List in Java](https://www.baeldung.com/java-list-split) +- [Guava – Lists](https://www.baeldung.com/guava-lists) \ No newline at end of file diff --git a/guava-collections/pom.xml b/guava-modules/guava-collections-list/pom.xml similarity index 93% rename from guava-collections/pom.xml rename to guava-modules/guava-collections-list/pom.xml index 238ab60f84..cc52a5d48b 100644 --- a/guava-collections/pom.xml +++ b/guava-modules/guava-collections-list/pom.xml @@ -4,15 +4,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - guava-collections + guava-collections-list 0.1.0-SNAPSHOT - guava-collections + guava-collections-list com.baeldung - parent-java + guava-modules 0.0.1-SNAPSHOT - ../parent-java + ../ diff --git a/guava-collections/src/main/resources/logback.xml b/guava-modules/guava-collections-list/src/main/resources/logback.xml similarity index 100% rename from guava-collections/src/main/resources/logback.xml rename to guava-modules/guava-collections-list/src/main/resources/logback.xml diff --git a/guava-collections/src/test/java/com/baeldung/guava/lists/GuavaListsUnitTest.java b/guava-modules/guava-collections-list/src/test/java/com/baeldung/guava/lists/GuavaListsUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/lists/GuavaListsUnitTest.java rename to guava-modules/guava-collections-list/src/test/java/com/baeldung/guava/lists/GuavaListsUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/partition/CollectionApachePartitionUnitTest.java b/guava-modules/guava-collections-list/src/test/java/com/baeldung/guava/partition/CollectionApachePartitionUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/partition/CollectionApachePartitionUnitTest.java rename to guava-modules/guava-collections-list/src/test/java/com/baeldung/guava/partition/CollectionApachePartitionUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/partition/CollectionGuavaPartitionUnitTest.java b/guava-modules/guava-collections-list/src/test/java/com/baeldung/guava/partition/CollectionGuavaPartitionUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/partition/CollectionGuavaPartitionUnitTest.java rename to guava-modules/guava-collections-list/src/test/java/com/baeldung/guava/partition/CollectionGuavaPartitionUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/partition/CollectionJavaPartitionUnitTest.java b/guava-modules/guava-collections-list/src/test/java/com/baeldung/guava/partition/CollectionJavaPartitionUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/partition/CollectionJavaPartitionUnitTest.java rename to guava-modules/guava-collections-list/src/test/java/com/baeldung/guava/partition/CollectionJavaPartitionUnitTest.java diff --git a/guava-collections-map/README.md b/guava-modules/guava-collections-map/README.md similarity index 100% rename from guava-collections-map/README.md rename to guava-modules/guava-collections-map/README.md diff --git a/guava-collections-map/pom.xml b/guava-modules/guava-collections-map/pom.xml similarity index 94% rename from guava-collections-map/pom.xml rename to guava-modules/guava-collections-map/pom.xml index 4a95234d5c..82d634265b 100644 --- a/guava-collections-map/pom.xml +++ b/guava-modules/guava-collections-map/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-java + guava-modules 0.0.1-SNAPSHOT - ../parent-java + ../ diff --git a/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/Profile.java b/guava-modules/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/Profile.java similarity index 100% rename from guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/Profile.java rename to guava-modules/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/Profile.java diff --git a/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/Session.java b/guava-modules/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/Session.java similarity index 100% rename from guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/Session.java rename to guava-modules/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/Session.java diff --git a/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/User.java b/guava-modules/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/User.java similarity index 100% rename from guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/User.java rename to guava-modules/guava-collections-map/src/main/java/com/baeldung/guava/mapmaker/User.java diff --git a/guava-collections-map/src/test/java/com/baeldung/guava/classtoinstancemap/ClassToInstanceMapUnitTest.java b/guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/classtoinstancemap/ClassToInstanceMapUnitTest.java similarity index 100% rename from guava-collections-map/src/test/java/com/baeldung/guava/classtoinstancemap/ClassToInstanceMapUnitTest.java rename to guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/classtoinstancemap/ClassToInstanceMapUnitTest.java diff --git a/guava-collections-map/src/test/java/com/baeldung/guava/initializemaps/GuavaMapInitializeUnitTest.java b/guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/initializemaps/GuavaMapInitializeUnitTest.java similarity index 100% rename from guava-collections-map/src/test/java/com/baeldung/guava/initializemaps/GuavaMapInitializeUnitTest.java rename to guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/initializemaps/GuavaMapInitializeUnitTest.java diff --git a/guava-collections-map/src/test/java/com/baeldung/guava/mapmaker/GuavaMapMakerUnitTest.java b/guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/mapmaker/GuavaMapMakerUnitTest.java similarity index 100% rename from guava-collections-map/src/test/java/com/baeldung/guava/mapmaker/GuavaMapMakerUnitTest.java rename to guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/mapmaker/GuavaMapMakerUnitTest.java diff --git a/guava-collections-map/src/test/java/com/baeldung/guava/maps/GuavaMapsUnitTest.java b/guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/maps/GuavaMapsUnitTest.java similarity index 100% rename from guava-collections-map/src/test/java/com/baeldung/guava/maps/GuavaMapsUnitTest.java rename to guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/maps/GuavaMapsUnitTest.java diff --git a/guava-collections-map/src/test/java/com/baeldung/guava/multimap/GuavaMultiMapUnitTest.java b/guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/multimap/GuavaMultiMapUnitTest.java similarity index 100% rename from guava-collections-map/src/test/java/com/baeldung/guava/multimap/GuavaMultiMapUnitTest.java rename to guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/multimap/GuavaMultiMapUnitTest.java diff --git a/guava-collections-map/src/test/java/com/baeldung/guava/rangemap/GuavaRangeMapUnitTest.java b/guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/rangemap/GuavaRangeMapUnitTest.java similarity index 100% rename from guava-collections-map/src/test/java/com/baeldung/guava/rangemap/GuavaRangeMapUnitTest.java rename to guava-modules/guava-collections-map/src/test/java/com/baeldung/guava/rangemap/GuavaRangeMapUnitTest.java diff --git a/guava-2/src/test/resources/.gitignore b/guava-modules/guava-collections-set/.gitignore similarity index 100% rename from guava-2/src/test/resources/.gitignore rename to guava-modules/guava-collections-set/.gitignore diff --git a/guava-collections-set/README.md b/guava-modules/guava-collections-set/README.md similarity index 100% rename from guava-collections-set/README.md rename to guava-modules/guava-collections-set/README.md diff --git a/guava-collections-set/pom.xml b/guava-modules/guava-collections-set/pom.xml similarity index 94% rename from guava-collections-set/pom.xml rename to guava-modules/guava-collections-set/pom.xml index af46400555..8f58148e41 100644 --- a/guava-collections-set/pom.xml +++ b/guava-modules/guava-collections-set/pom.xml @@ -8,9 +8,9 @@ com.baeldung - parent-java + guava-modules 0.0.1-SNAPSHOT - ../parent-java + ../ diff --git a/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSet.java b/guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSet.java similarity index 100% rename from guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSet.java rename to guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSet.java diff --git a/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSetUnitTest.java b/guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSetUnitTest.java similarity index 100% rename from guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSetUnitTest.java rename to guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMapFromSetUnitTest.java diff --git a/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMultiSetUnitTest.java b/guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMultiSetUnitTest.java similarity index 100% rename from guava-collections-set/src/test/java/com/baeldung/guava/GuavaMultiSetUnitTest.java rename to guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaMultiSetUnitTest.java diff --git a/guava-collections-set/src/test/java/com/baeldung/guava/GuavaRangeSetUnitTest.java b/guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaRangeSetUnitTest.java similarity index 100% rename from guava-collections-set/src/test/java/com/baeldung/guava/GuavaRangeSetUnitTest.java rename to guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaRangeSetUnitTest.java diff --git a/guava-collections-set/src/test/java/com/baeldung/guava/GuavaSetOperationsUnitTest.java b/guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaSetOperationsUnitTest.java similarity index 100% rename from guava-collections-set/src/test/java/com/baeldung/guava/GuavaSetOperationsUnitTest.java rename to guava-modules/guava-collections-set/src/test/java/com/baeldung/guava/GuavaSetOperationsUnitTest.java diff --git a/guava-collections/README.md b/guava-modules/guava-collections/README.md similarity index 86% rename from guava-collections/README.md rename to guava-modules/guava-collections/README.md index 51731d7db7..474ded6f33 100644 --- a/guava-collections/README.md +++ b/guava-modules/guava-collections/README.md @@ -8,9 +8,8 @@ This module contains articles about Google Guava collections - [Guava Ordering Cookbook](https://www.baeldung.com/guava-order) - [Guide to Guava’s Ordering](https://www.baeldung.com/guava-ordering) - [Hamcrest Collections Cookbook](https://www.baeldung.com/hamcrest-collections-arrays) -- [Partition a List in Java](https://www.baeldung.com/java-list-split) - [Filtering and Transforming Collections in Guava](https://www.baeldung.com/guava-filter-and-transform-a-collection) - [Guava – Join and Split Collections](https://www.baeldung.com/guava-joiner-and-splitter-tutorial) -- [Guava – Lists](https://www.baeldung.com/guava-lists) - [Guide to Guava MinMaxPriorityQueue and EvictingQueue](https://www.baeldung.com/guava-minmax-priority-queue-and-evicting-queue) - [Guide to Guava Table](https://www.baeldung.com/guava-table) +- [Zipping Collections in Java](http://www.baeldung.com/java-collections-zip) diff --git a/guava-modules/guava-collections/pom.xml b/guava-modules/guava-collections/pom.xml new file mode 100644 index 0000000000..53c55dc655 --- /dev/null +++ b/guava-modules/guava-collections/pom.xml @@ -0,0 +1,95 @@ + + + 4.0.0 + guava-collections + 0.1.0-SNAPSHOT + guava-collections + + + com.baeldung + guava-modules + 0.0.1-SNAPSHOT + ../ + + + + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + org.jooq + jool + ${jool.version} + + + + + org.junit.jupiter + junit-jupiter + ${junit-jupiter.version} + test + + + org.junit.vintage + junit-vintage-engine + ${junit-jupiter.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + org.hamcrest + java-hamcrest + ${java-hamcrest.version} + test + + + + + guava-collections + + + + src/main/resources + true + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + + + + 4.1 + 0.9.12 + + + 3.6.1 + 2.0.0.0 + 5.6.2 + + + \ No newline at end of file diff --git a/guava/src/main/resources/logback.xml b/guava-modules/guava-collections/src/main/resources/logback.xml similarity index 100% rename from guava/src/main/resources/logback.xml rename to guava-modules/guava-collections/src/main/resources/logback.xml diff --git a/guava-collections/src/test/java/com/baeldung/guava/collections/GuavaCollectionsExamplesUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/collections/GuavaCollectionsExamplesUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/collections/GuavaCollectionsExamplesUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/collections/GuavaCollectionsExamplesUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/filtertransform/GuavaFilterTransformCollectionsUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/filtertransform/GuavaFilterTransformCollectionsUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/filtertransform/GuavaFilterTransformCollectionsUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/filtertransform/GuavaFilterTransformCollectionsUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/joinsplit/GuavaStringUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/joinsplit/GuavaStringUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/joinsplit/GuavaStringUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/joinsplit/GuavaStringUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/ordering/GuavaOrderingExamplesUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/ordering/GuavaOrderingExamplesUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/ordering/GuavaOrderingExamplesUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/ordering/GuavaOrderingExamplesUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/ordering/GuavaOrderingUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/ordering/GuavaOrderingUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/ordering/GuavaOrderingUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/ordering/GuavaOrderingUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/queues/EvictingQueueUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/queues/EvictingQueueUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/queues/EvictingQueueUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/queues/EvictingQueueUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/queues/MinMaxPriorityQueueUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/queues/MinMaxPriorityQueueUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/queues/MinMaxPriorityQueueUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/queues/MinMaxPriorityQueueUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/guava/table/GuavaTableUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/table/GuavaTableUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/guava/table/GuavaTableUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/table/GuavaTableUnitTest.java diff --git a/guava-modules/guava-21/src/test/java/com/baeldung/guava/zip/ZipCollectionUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/guava/zip/ZipCollectionUnitTest.java similarity index 100% rename from guava-modules/guava-21/src/test/java/com/baeldung/guava/zip/ZipCollectionUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/guava/zip/ZipCollectionUnitTest.java diff --git a/guava-collections/src/test/java/com/baeldung/hamcrest/HamcrestExamplesUnitTest.java b/guava-modules/guava-collections/src/test/java/com/baeldung/hamcrest/HamcrestExamplesUnitTest.java similarity index 100% rename from guava-collections/src/test/java/com/baeldung/hamcrest/HamcrestExamplesUnitTest.java rename to guava-modules/guava-collections/src/test/java/com/baeldung/hamcrest/HamcrestExamplesUnitTest.java diff --git a/guava-2/src/test/resources/test.out b/guava-modules/guava-collections/src/test/resources/test.out similarity index 100% rename from guava-2/src/test/resources/test.out rename to guava-modules/guava-collections/src/test/resources/test.out diff --git a/guava-2/src/test/resources/test1.in b/guava-modules/guava-collections/src/test/resources/test1.in similarity index 100% rename from guava-2/src/test/resources/test1.in rename to guava-modules/guava-collections/src/test/resources/test1.in diff --git a/guava-2/src/test/resources/test1_1.in b/guava-modules/guava-collections/src/test/resources/test1_1.in similarity index 100% rename from guava-2/src/test/resources/test1_1.in rename to guava-modules/guava-collections/src/test/resources/test1_1.in diff --git a/guava-2/src/test/resources/test2.in b/guava-modules/guava-collections/src/test/resources/test2.in similarity index 100% rename from guava-2/src/test/resources/test2.in rename to guava-modules/guava-collections/src/test/resources/test2.in diff --git a/guava-2/src/test/resources/test_copy.in b/guava-modules/guava-collections/src/test/resources/test_copy.in similarity index 100% rename from guava-2/src/test/resources/test_copy.in rename to guava-modules/guava-collections/src/test/resources/test_copy.in diff --git a/guava-2/src/test/resources/test_le.txt b/guava-modules/guava-collections/src/test/resources/test_le.txt similarity index 100% rename from guava-2/src/test/resources/test_le.txt rename to guava-modules/guava-collections/src/test/resources/test_le.txt diff --git a/guava-modules/guava-core/README.md b/guava-modules/guava-core/README.md new file mode 100644 index 0000000000..59391ca076 --- /dev/null +++ b/guava-modules/guava-core/README.md @@ -0,0 +1,10 @@ +## Guava Core + +This module contains articles about core or base functionality provided by Google Guava + +### Relevant Articles: +- [Introduction to Guava Throwables](https://www.baeldung.com/guava-throwables) +- [Guava CharMatcher](https://www.baeldung.com/guava-string-charmatcher) +- [Guide to Guava’s PreConditions](https://www.baeldung.com/guava-preconditions) +- [Introduction to Guava Memoizer](https://www.baeldung.com/guava-memoizer) +- [Guava Functional Cookbook](https://www.baeldung.com/guava-functions-predicates) diff --git a/guava-2/pom.xml b/guava-modules/guava-core/pom.xml similarity index 89% rename from guava-2/pom.xml rename to guava-modules/guava-core/pom.xml index b19f59a9b4..5224148cb8 100644 --- a/guava-2/pom.xml +++ b/guava-modules/guava-core/pom.xml @@ -4,15 +4,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - guava-2 + guava-core 0.1.0-SNAPSHOT - guava-2 + guava-core com.baeldung - parent-java + guava-modules 0.0.1-SNAPSHOT - ../parent-java + ../ diff --git a/guava/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java b/guava-modules/guava-core/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java similarity index 100% rename from guava/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java rename to guava-modules/guava-core/src/main/java/com/baeldung/guava/memoizer/CostlySupplier.java diff --git a/guava/src/main/java/com/baeldung/guava/memoizer/Factorial.java b/guava-modules/guava-core/src/main/java/com/baeldung/guava/memoizer/Factorial.java similarity index 100% rename from guava/src/main/java/com/baeldung/guava/memoizer/Factorial.java rename to guava-modules/guava-core/src/main/java/com/baeldung/guava/memoizer/Factorial.java diff --git a/guava/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java b/guava-modules/guava-core/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java similarity index 100% rename from guava/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java rename to guava-modules/guava-core/src/main/java/com/baeldung/guava/memoizer/FibonacciSequence.java diff --git a/guava-2/src/test/java/com/baeldung/guava/charmatcher/GuavaCharMatcherUnitTest.java b/guava-modules/guava-core/src/test/java/com/baeldung/guava/charmatcher/GuavaCharMatcherUnitTest.java similarity index 100% rename from guava-2/src/test/java/com/baeldung/guava/charmatcher/GuavaCharMatcherUnitTest.java rename to guava-modules/guava-core/src/test/java/com/baeldung/guava/charmatcher/GuavaCharMatcherUnitTest.java diff --git a/guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java b/guava-modules/guava-core/src/test/java/com/baeldung/guava/functional/GuavaFunctionalExamplesUnitTest.java similarity index 99% rename from guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java rename to guava-modules/guava-core/src/test/java/com/baeldung/guava/functional/GuavaFunctionalExamplesUnitTest.java index b54a7c951a..0177f4f13e 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaFunctionalExamplesUnitTest.java +++ b/guava-modules/guava-core/src/test/java/com/baeldung/guava/functional/GuavaFunctionalExamplesUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.functional; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java b/guava-modules/guava-core/src/test/java/com/baeldung/guava/memoizer/GuavaMemoizerUnitTest.java similarity index 98% rename from guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java rename to guava-modules/guava-core/src/test/java/com/baeldung/guava/memoizer/GuavaMemoizerUnitTest.java index 9bafb7ad3f..9af9462e56 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaMemoizerUnitTest.java +++ b/guava-modules/guava-core/src/test/java/com/baeldung/guava/memoizer/GuavaMemoizerUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.memoizer; import com.google.common.base.Suppliers; import com.baeldung.guava.memoizer.CostlySupplier; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java b/guava-modules/guava-core/src/test/java/com/baeldung/guava/preconditions/GuavaPreConditionsUnitTest.java similarity index 99% rename from guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java rename to guava-modules/guava-core/src/test/java/com/baeldung/guava/preconditions/GuavaPreConditionsUnitTest.java index fe3be9abf0..1f7111b12f 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaPreConditionsUnitTest.java +++ b/guava-modules/guava-core/src/test/java/com/baeldung/guava/preconditions/GuavaPreConditionsUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.preconditions; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.Arrays; diff --git a/guava-2/src/test/java/com/baeldung/guava/throwables/ThrowablesUnitTest.java b/guava-modules/guava-core/src/test/java/com/baeldung/guava/throwables/ThrowablesUnitTest.java similarity index 100% rename from guava-2/src/test/java/com/baeldung/guava/throwables/ThrowablesUnitTest.java rename to guava-modules/guava-core/src/test/java/com/baeldung/guava/throwables/ThrowablesUnitTest.java diff --git a/guava-collections-set/.gitignore b/guava-modules/guava-core/src/test/resources/.gitignore similarity index 100% rename from guava-collections-set/.gitignore rename to guava-modules/guava-core/src/test/resources/.gitignore diff --git a/guava-collections/src/test/resources/test.out b/guava-modules/guava-core/src/test/resources/test.out similarity index 100% rename from guava-collections/src/test/resources/test.out rename to guava-modules/guava-core/src/test/resources/test.out diff --git a/guava-collections/src/test/resources/test1.in b/guava-modules/guava-core/src/test/resources/test1.in similarity index 100% rename from guava-collections/src/test/resources/test1.in rename to guava-modules/guava-core/src/test/resources/test1.in diff --git a/guava-collections/src/test/resources/test1_1.in b/guava-modules/guava-core/src/test/resources/test1_1.in similarity index 100% rename from guava-collections/src/test/resources/test1_1.in rename to guava-modules/guava-core/src/test/resources/test1_1.in diff --git a/guava-collections/src/test/resources/test2.in b/guava-modules/guava-core/src/test/resources/test2.in similarity index 100% rename from guava-collections/src/test/resources/test2.in rename to guava-modules/guava-core/src/test/resources/test2.in diff --git a/guava-collections/src/test/resources/test_copy.in b/guava-modules/guava-core/src/test/resources/test_copy.in similarity index 100% rename from guava-collections/src/test/resources/test_copy.in rename to guava-modules/guava-core/src/test/resources/test_copy.in diff --git a/guava-collections/src/test/resources/test_le.txt b/guava-modules/guava-core/src/test/resources/test_le.txt similarity index 100% rename from guava-collections/src/test/resources/test_le.txt rename to guava-modules/guava-core/src/test/resources/test_le.txt diff --git a/guava-io/README.md b/guava-modules/guava-io/README.md similarity index 100% rename from guava-io/README.md rename to guava-modules/guava-io/README.md diff --git a/guava-io/pom.xml b/guava-modules/guava-io/pom.xml similarity index 93% rename from guava-io/pom.xml rename to guava-modules/guava-io/pom.xml index e01f76e2e3..6b3280755c 100644 --- a/guava-io/pom.xml +++ b/guava-modules/guava-io/pom.xml @@ -11,9 +11,9 @@ com.baeldung - parent-java + guava-modules 0.0.1-SNAPSHOT - ../parent-java + ../ diff --git a/guava-io/src/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java b/guava-modules/guava-io/src/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java similarity index 100% rename from guava-io/src/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java rename to guava-modules/guava-io/src/test/java/com/baeldung/guava/GuavaCountingOutputStreamUnitTest.java diff --git a/guava-io/src/test/java/com/baeldung/guava/GuavaIOUnitTest.java b/guava-modules/guava-io/src/test/java/com/baeldung/guava/GuavaIOUnitTest.java similarity index 100% rename from guava-io/src/test/java/com/baeldung/guava/GuavaIOUnitTest.java rename to guava-modules/guava-io/src/test/java/com/baeldung/guava/GuavaIOUnitTest.java diff --git a/guava-io/src/test/resources/test1.in b/guava-modules/guava-io/src/test/resources/test1.in similarity index 100% rename from guava-io/src/test/resources/test1.in rename to guava-modules/guava-io/src/test/resources/test1.in diff --git a/guava-io/src/test/resources/test1_1.in b/guava-modules/guava-io/src/test/resources/test1_1.in similarity index 100% rename from guava-io/src/test/resources/test1_1.in rename to guava-modules/guava-io/src/test/resources/test1_1.in diff --git a/guava-io/src/test/resources/test2.in b/guava-modules/guava-io/src/test/resources/test2.in similarity index 100% rename from guava-io/src/test/resources/test2.in rename to guava-modules/guava-io/src/test/resources/test2.in diff --git a/guava/.gitignore b/guava-modules/guava-utilities/.gitignore similarity index 100% rename from guava/.gitignore rename to guava-modules/guava-utilities/.gitignore diff --git a/guava/README.md b/guava-modules/guava-utilities/README.md similarity index 60% rename from guava/README.md rename to guava-modules/guava-utilities/README.md index 24beca60c3..e2caa1a145 100644 --- a/guava/README.md +++ b/guava-modules/guava-utilities/README.md @@ -1,17 +1,12 @@ -## Guava +## Guava Utilities -This module contains articles a Google Guava +This module contains articles about utilities provided by Google Guava ### Relevant Articles: - -- [Guava Functional Cookbook](https://www.baeldung.com/guava-functions-predicates) -- [Guide to Guava’s PreConditions](https://www.baeldung.com/guava-preconditions) - [Introduction to Guava CacheLoader](https://www.baeldung.com/guava-cacheloader) -- [Introduction to Guava Memoizer](https://www.baeldung.com/guava-memoizer) - [Guide to Guava’s EventBus](https://www.baeldung.com/guava-eventbus) - [Guide to Guava’s Reflection Utilities](https://www.baeldung.com/guava-reflection) - [Guide to Mathematical Utilities in Guava](https://www.baeldung.com/guava-math) - [Bloom Filter in Java using Guava](https://www.baeldung.com/guava-bloom-filter) - [Quick Guide to the Guava RateLimiter](https://www.baeldung.com/guava-rate-limiter) - [Guava Cache](https://www.baeldung.com/guava-cache) -- [Introduction to Guava Throwables](https://www.baeldung.com/guava-throwables) diff --git a/guava/pom.xml b/guava-modules/guava-utilities/pom.xml similarity index 92% rename from guava/pom.xml rename to guava-modules/guava-utilities/pom.xml index 2c4ff07c84..0496f5b2e8 100644 --- a/guava/pom.xml +++ b/guava-modules/guava-utilities/pom.xml @@ -4,15 +4,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - guava + guava-utilities 0.1.0-SNAPSHOT - guava + guava-utilities com.baeldung - parent-java + guava-modules 0.0.1-SNAPSHOT - ../parent-java + ../ diff --git a/guava/src/main/java/com/baeldung/guava/CustomEvent.java b/guava-modules/guava-utilities/src/main/java/com/baeldung/guava/eventbus/CustomEvent.java similarity index 87% rename from guava/src/main/java/com/baeldung/guava/CustomEvent.java rename to guava-modules/guava-utilities/src/main/java/com/baeldung/guava/eventbus/CustomEvent.java index a154790374..55112b5cb3 100644 --- a/guava/src/main/java/com/baeldung/guava/CustomEvent.java +++ b/guava-modules/guava-utilities/src/main/java/com/baeldung/guava/eventbus/CustomEvent.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.eventbus; public class CustomEvent { private String action; diff --git a/guava/src/main/java/com/baeldung/guava/EventListener.java b/guava-modules/guava-utilities/src/main/java/com/baeldung/guava/eventbus/EventListener.java similarity index 96% rename from guava/src/main/java/com/baeldung/guava/EventListener.java rename to guava-modules/guava-utilities/src/main/java/com/baeldung/guava/eventbus/EventListener.java index 7bcfbcb8e9..404501b578 100644 --- a/guava/src/main/java/com/baeldung/guava/EventListener.java +++ b/guava-modules/guava-utilities/src/main/java/com/baeldung/guava/eventbus/EventListener.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.eventbus; import com.google.common.eventbus.DeadEvent; import com.google.common.eventbus.Subscribe; diff --git a/guava-modules/guava-utilities/src/main/resources/logback.xml b/guava-modules/guava-utilities/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/guava-modules/guava-utilities/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/bloomfilter/BloomFilterUnitTest.java similarity index 97% rename from guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/bloomfilter/BloomFilterUnitTest.java index c11bf27256..96cc8ac1d9 100644 --- a/guava/src/test/java/com/baeldung/guava/BloomFilterUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/bloomfilter/BloomFilterUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.bloomfilter; import com.google.common.hash.BloomFilter; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/cache/GuavaCacheUnitTest.java similarity index 99% rename from guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/cache/GuavaCacheUnitTest.java index 8aa56c7c52..0129d661fc 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaCacheUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/cache/GuavaCacheUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.cache; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/cacheloader/GuavaCacheLoaderUnitTest.java similarity index 98% rename from guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/cacheloader/GuavaCacheLoaderUnitTest.java index bf9747ec18..7157c76494 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaCacheLoaderUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/cacheloader/GuavaCacheLoaderUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.cacheloader; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/eventbus/GuavaEventBusUnitTest.java similarity index 90% rename from guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/eventbus/GuavaEventBusUnitTest.java index bb9d26fcce..a6967d18f7 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaEventBusUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/eventbus/GuavaEventBusUnitTest.java @@ -1,5 +1,7 @@ -package com.baeldung.guava; +package com.baeldung.guava.eventbus; +import com.baeldung.guava.eventbus.CustomEvent; +import com.baeldung.guava.eventbus.EventListener; import com.google.common.eventbus.EventBus; import org.junit.After; import org.junit.Before; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaBigIntegerMathUnitTest.java similarity index 99% rename from guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaBigIntegerMathUnitTest.java index cca42a688f..d890ef0bf0 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaBigIntegerMathUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaBigIntegerMathUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.mathutils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaDoubleMathUnitTest.java similarity index 98% rename from guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaDoubleMathUnitTest.java index 9c78fb36fa..05a70e3654 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaDoubleMathUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaDoubleMathUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.mathutils; import static org.junit.Assert.*; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaIntMathUnitTest.java similarity index 99% rename from guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaIntMathUnitTest.java index 547f423396..4ac3c93518 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaIntMathUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaIntMathUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.mathutils; import static org.junit.Assert.*; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaLongMathUnitTest.java similarity index 99% rename from guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaLongMathUnitTest.java index 33c28d4594..41358b081b 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaLongMathUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaLongMathUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.mathutils; import static org.junit.Assert.*; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaMathUnitTest.java similarity index 99% rename from guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaMathUnitTest.java index fce0fec13b..0d21a6f4ae 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaMathUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/mathutils/GuavaMathUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.mathutils; import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.*; diff --git a/guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/ratelimiter/RateLimiterLongRunningUnitTest.java similarity index 98% rename from guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/ratelimiter/RateLimiterLongRunningUnitTest.java index 7372e9f6e9..cb06e6ff85 100644 --- a/guava/src/test/java/com/baeldung/guava/RateLimiterLongRunningUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/ratelimiter/RateLimiterLongRunningUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.ratelimiter; import com.google.common.util.concurrent.RateLimiter; diff --git a/guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/reflectionutils/GuavaReflectionUtilsUnitTest.java similarity index 99% rename from guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java rename to guava-modules/guava-utilities/src/test/java/com/baeldung/guava/reflectionutils/GuavaReflectionUtilsUnitTest.java index 36df241711..8060191bdc 100644 --- a/guava/src/test/java/com/baeldung/guava/GuavaReflectionUtilsUnitTest.java +++ b/guava-modules/guava-utilities/src/test/java/com/baeldung/guava/reflectionutils/GuavaReflectionUtilsUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.guava; +package com.baeldung.guava.reflectionutils; import com.google.common.collect.Lists; diff --git a/guava/src/test/resources/.gitignore b/guava-modules/guava-utilities/src/test/resources/.gitignore similarity index 100% rename from guava/src/test/resources/.gitignore rename to guava-modules/guava-utilities/src/test/resources/.gitignore diff --git a/guava/src/test/resources/test.out b/guava-modules/guava-utilities/src/test/resources/test.out similarity index 100% rename from guava/src/test/resources/test.out rename to guava-modules/guava-utilities/src/test/resources/test.out diff --git a/guava/src/test/resources/test1.in b/guava-modules/guava-utilities/src/test/resources/test1.in similarity index 100% rename from guava/src/test/resources/test1.in rename to guava-modules/guava-utilities/src/test/resources/test1.in diff --git a/guava/src/test/resources/test1_1.in b/guava-modules/guava-utilities/src/test/resources/test1_1.in similarity index 100% rename from guava/src/test/resources/test1_1.in rename to guava-modules/guava-utilities/src/test/resources/test1_1.in diff --git a/guava/src/test/resources/test2.in b/guava-modules/guava-utilities/src/test/resources/test2.in similarity index 100% rename from guava/src/test/resources/test2.in rename to guava-modules/guava-utilities/src/test/resources/test2.in diff --git a/guava/src/test/resources/test_copy.in b/guava-modules/guava-utilities/src/test/resources/test_copy.in similarity index 100% rename from guava/src/test/resources/test_copy.in rename to guava-modules/guava-utilities/src/test/resources/test_copy.in diff --git a/guava/src/test/resources/test_le.txt b/guava-modules/guava-utilities/src/test/resources/test_le.txt similarity index 100% rename from guava/src/test/resources/test_le.txt rename to guava-modules/guava-utilities/src/test/resources/test_le.txt diff --git a/guava-modules/pom.xml b/guava-modules/pom.xml index d1a2bbc16e..2d0bf68183 100644 --- a/guava-modules/pom.xml +++ b/guava-modules/pom.xml @@ -17,9 +17,16 @@ + guava-utilities + guava-core guava-18 guava-19 guava-21 + guava-collections + guava-collections-list + guava-collections-map + guava-collections-set + guava-io diff --git a/pom.xml b/pom.xml index 9d9c448887..5ed3791760 100644 --- a/pom.xml +++ b/pom.xml @@ -415,13 +415,7 @@ graphql/graphql-java grpc - gson - guava - guava-2 - guava-collections - guava-collections-map - guava-collections-set - guava-io + gson guava-modules guice @@ -933,12 +927,7 @@ graphql/graphql-java grpc - gson - guava - guava-collections - guava-collections-map - guava-collections-set - guava-io + gson guava-modules guice From a0bfc4c72a95983736c8bbf226bfa22ae24795a3 Mon Sep 17 00:00:00 2001 From: STS Date: Tue, 28 Jul 2020 14:23:08 +0200 Subject: [PATCH 0297/1862] change address --- .../com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java b/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java index b3f6949216..fa5baa37fa 100644 --- a/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java +++ b/apache-poi/src/test/java/com/baeldung/poi/excel/setformula/ExcelFormulaUnitTest.java @@ -14,7 +14,7 @@ import java.net.URISyntaxException; import java.nio.file.Paths; class ExcelFormulaUnitTest { - private static String FILE_NAME = "com/bealdung/poi/excel/setformula/SetFormulaTest.xlsx"; + private static String FILE_NAME = "com/baeldung/poi/excel/setformula/SetFormulaTest.xlsx"; private String fileLocation; private ExcelFormula excelFormula; From 45be1b60457eaa89e2dca7bbbc928154a2596a40 Mon Sep 17 00:00:00 2001 From: joe zhang Date: Tue, 28 Jul 2020 21:12:15 +0800 Subject: [PATCH 0298/1862] Add primitive type check method and unit tests --- .../core-java-lang-oop-types/pom.xml | 8 ++++ .../primitivetype/PrimitiveTypeUtil.java | 38 +++++++++++++++++ .../primitivetype/PrimitiveTypeUtilTest.java | 41 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java create mode 100644 core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java diff --git a/core-java-modules/core-java-lang-oop-types/pom.xml b/core-java-modules/core-java-lang-oop-types/pom.xml index 5555df4818..ee167bbae2 100644 --- a/core-java-modules/core-java-lang-oop-types/pom.xml +++ b/core-java-modules/core-java-lang-oop-types/pom.xml @@ -12,4 +12,12 @@ core-java-lang-oop-types core-java-lang-oop-types jar + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + \ No newline at end of file diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java new file mode 100644 index 0000000000..c749ed9dcd --- /dev/null +++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java @@ -0,0 +1,38 @@ +package com.baeldung.primitivetype; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.lang3.ClassUtils; + +import com.google.common.primitives.Primitives; + +public class PrimitiveTypeUtil { + + private static final Map, Class> WRAPPER_TYPE_MAP; + static { + WRAPPER_TYPE_MAP = new HashMap, Class>(16); + WRAPPER_TYPE_MAP.put(Integer.class, int.class); + WRAPPER_TYPE_MAP.put(Byte.class, byte.class); + WRAPPER_TYPE_MAP.put(Character.class, char.class); + WRAPPER_TYPE_MAP.put(Boolean.class, boolean.class); + WRAPPER_TYPE_MAP.put(Double.class, double.class); + WRAPPER_TYPE_MAP.put(Float.class, float.class); + WRAPPER_TYPE_MAP.put(Long.class, long.class); + WRAPPER_TYPE_MAP.put(Short.class, short.class); + WRAPPER_TYPE_MAP.put(Void.class, void.class); + } + + public boolean isPrimitiveTypeByCommansLang(Object source) { + return ClassUtils.isPrimitiveOrWrapper(source.getClass()); + } + + public boolean isPrimitiveTypeByGuava(Object source) { + return Primitives.isWrapperType(source.getClass()); + } + + public boolean isPrimitiveType(Object source) { + return WRAPPER_TYPE_MAP.containsKey(source.getClass()); + } + +} diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java new file mode 100644 index 0000000000..7d3c2964d4 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java @@ -0,0 +1,41 @@ +package com.baeldung.primitivetype; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Before; +import org.junit.Test; + +public class PrimitiveTypeUtilTest { + + private PrimitiveTypeUtil primitiveTypeUtil; + private boolean booleanVal = false; + private Long longWrapper = 1L; + private String nonPrimitiveVal = "Test"; + + @Before + public void setup() { + primitiveTypeUtil = new PrimitiveTypeUtil(); + } + + @Test + public void givenObjectWhenCheckWithGuavaShouldValidate() { + assertTrue(primitiveTypeUtil.isPrimitiveTypeByGuava(booleanVal)); + assertTrue(primitiveTypeUtil.isPrimitiveTypeByGuava(longWrapper)); + assertFalse(primitiveTypeUtil.isPrimitiveTypeByGuava(nonPrimitiveVal)); + } + + @Test + public void givenObjectWhenCheckWithCommansLangShouldValidate() { + assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommansLang(booleanVal)); + assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommansLang(longWrapper)); + assertFalse(primitiveTypeUtil.isPrimitiveTypeByCommansLang(nonPrimitiveVal)); + } + + @Test + public void givenPrimitiveOrWrapperWhenCheckWithCustomMethodShouldReturnTrue() { + assertTrue(primitiveTypeUtil.isPrimitiveType(booleanVal)); + assertTrue(primitiveTypeUtil.isPrimitiveType(longWrapper)); + assertFalse(primitiveTypeUtil.isPrimitiveType(nonPrimitiveVal)); + } +} From 29112018323dc0d52ab616490979bd8fdde9641f Mon Sep 17 00:00:00 2001 From: Philippe Date: Tue, 28 Jul 2020 10:26:00 -0300 Subject: [PATCH 0299/1862] [BAEL-4381] Intro to ArchUnit --- .../article-resources/archunit/figure1.drawio | 1 + .../article-resources/archunit/figure1.png | Bin 0 -> 15103 bytes libraries-testing/pom.xml | 14 ++- .../smurfs/persistence/SmurfsRepository.java | 49 ++++++++++ .../smurfs/persistence/domain/Smurf.java | 64 ++++++++++++ .../smurfs/presentation/SmurfsController.java | 27 +++++ .../smurfs/service/SmurfsService.java | 41 ++++++++ .../archunit/smurfs/service/dto/SmurfDTO.java | 64 ++++++++++++ .../archunit/smurfs/SmurfsArchUnitTest.java | 92 ++++++++++++++++++ 9 files changed, 349 insertions(+), 3 deletions(-) create mode 100644 libraries-testing/article-resources/archunit/figure1.drawio create mode 100644 libraries-testing/article-resources/archunit/figure1.png create mode 100644 libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/SmurfsRepository.java create mode 100644 libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/domain/Smurf.java create mode 100644 libraries-testing/src/main/java/com/baldung/archunit/smurfs/presentation/SmurfsController.java create mode 100644 libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/SmurfsService.java create mode 100644 libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/dto/SmurfDTO.java create mode 100644 libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java diff --git a/libraries-testing/article-resources/archunit/figure1.drawio b/libraries-testing/article-resources/archunit/figure1.drawio new file mode 100644 index 0000000000..859d9946a1 --- /dev/null +++ b/libraries-testing/article-resources/archunit/figure1.drawio @@ -0,0 +1 @@ +7VjbctowEP0aP9LBNgb3sSa3BzJNJ+2kk5eMsBdbrax1ZUEgX1/Jlm84YWgbKL3wwFhHa3l99pyVwHKn6fpSkCy5xgiY5QyjteWeWY7jj331rYFNCXjOsARiQaMSshvglj6BAauwJY0g7wRKRCZp1gVD5BxC2cGIEPjYDVsg6z41IzH0gNuQsD56RyOZGNQev20mroDGiXm070zKiTkJv8YCl9w8jyOHciYl1TLmHfOERPjYgtxzy50KRFlepespMM1qxVh538ULs3XKArjc54YrsrkffLj+Bp8ePr+/GTw409XdwKyyImxpqEg3JMsYDYmkyE3mclMRpV4i05eaYRCWGyyQy1szb6txnpGQ8vgjZhoYKkSSecXpyIxrKu1RCdxgTovnuWcMFmomSGTKzJIrEFLlw94xGusIqdcOiBmZeJ3HBUkp0wqcLUMaEZX5FHmOOreAkTmwoK7WFBmK4pXcRfHRS1DGWvhF8VF4n+iKNZUYrFuQIf4SMAUpNiqkmvWMCIw/7EoUj43aJr7BkpbQRq4BiVF4XK/dlFpdmGr/QOUnvcpbzpikmlomi7dujyLIgEd5DcadEDPa0gpEymNmiEImGCMn7LxBg6IUoLPUwmhiZljKR4FfQMqNaRhkKbErjYjkSXG//ToSeLHUOS5FCDvodE3XIiIGuSPOK+M0NzuFI4ApB666/enVReD2RJCDWNEQTsL4bUMWjbXn+udbwyGFsL/nPX/L837f8874Gc/bB/P8+N/26GhPj7on5VH/KI16ponvFq7yWqiILiy/7baURlGpEcjpE5kX62mVZEi5LHjwAss7O1Tdd2m859P68Gjy7JzCnvPvYPhG7dOmX+9darPcjWagtf9POq1gYHvdFXCxyJUkt6VSJ/Xz6hn11JOpaikKT+d892e3eXuyR5v3jtrmvX7NQeQ0l8BPZGc/Vn0PeKTf3t5Hw9++vVe/pk/Z7P+d/UsV7v9eP6UD+19o64Oe2tWw+f+n3PGbv9fc8+8= \ No newline at end of file diff --git a/libraries-testing/article-resources/archunit/figure1.png b/libraries-testing/article-resources/archunit/figure1.png new file mode 100644 index 0000000000000000000000000000000000000000..8bd8e9647b07a46e7d8e363ba750fa838c07debb GIT binary patch literal 15103 zcmeHuc{tQ<`!|!aCCZxaiWU??4JzA2%1$bhEV+xUlZdQi?(QfQg)oDmP*PO3vW;$~ z&DcivF)eq)*hXd;X3Wg*`l9qa@AEvzd%W-OIDW@_y!|=X_xnAs>pZV>|D1Ep&gQU~ zh`b0NAD@`H*+F|gz7=A8eEg+CtH8?o2m93c_!Rie4<0yn$#tA`;Qq$$Fuspk7LRJ}y$E9$XWZVd&If0KKCLkoCfQUg%!;;|ELCgtKO^VC# z)+GH~N_%_fGUdKM=R^0cgo{;p^{^IRU-(XKN3QpYb#48^5P^l2&Rx0Q_YE4m4ln)$ z>+a_K){VDf25o+<7{LiC)xPwV69wcjaAoUlg_ zA8*U8lKio9-vvRmi->)c^n;0pTQE%QcK*8TA1jD)u+q23FKUrXX#KWS8(d9zczk)q zNA}Vg_RM%Fa0%yppJw$MP$?g~rHueCB*w?CMdtzz?DD!^C$?zS){| zPJUBIOaHQD9{w3qczSz>-_2zTn_P3R7Jh2Z+(Wn~sq9&-fBqvP=+j?UJV(18m62q5BiB<{}tNSjg5Y)G{vRMk+^T}ZcR)Mn47D?vuh}__*v7MrlFjO zl6~Qfb8IqoCYN~6wu+}0JwMx=t9R@knf&DU!$E()xv6bP8YTA7YUws9+_}!6p%#K` z(DcX$&+ZbJ@$rMU`ri%)eSMckVNH*Yo%wdVL&`t^2j!`sthCz#dD{O$rRpjUbc zf#ZD@p5*!{(IIWr=+W>a)en*>`*=A4F>r3Be}7-`rqNe*K|?k{V?9r_eaE}#bR4fX z3OU7jYa6|LL*s`;4A;j=bV>HPo6r%M*x+H*NYTAMX)cG%i|XGNEM~&0vrONmEvw<` z7cwyr)~d*@V-ETnau~$QqTw}kssVL+a}=ZfVV+ss1cO(T>`^czIT%SNP_D?jp2HnB z6C8DP4J!zn>Gh(88GeecQl1v4atiZ&h2j_X3wxiV|d^Y zxf@whKm7XTZ1nt=VT{0gog(U{nhBW7Zz`)3O; za~<)l4>K}%7(~*Ilz_51ATrKOKYQY1tt&BkO$#Y4*3{aBcRPE)+64cWO1{vEYGa)) zfuEEAto!up4?S)a);~|wL}{OHKOW2F*SD@iMc6adqpQ=6NHeMRfwqJ}QL|GZ(ekHH%7ND;wj}i~J2E-owlu>W$aRmsnTyy$P0aaJMGN{1kgV#-eL`#lcCR0Rk3y>2S0@HiEOfgOfOB@hA7S^|a9Dmd1B)0@l;0ijg&TyGUU zl&39tk|veG%8MMKJHNI5y^Z953-@vT@WoVc$>7j1rb&k(P5K}m@pb{2%?cP+SH z5QN>guUw?(aDjLN4q~`4h~b~`y1Y4^+;PYKbjsqRZ zn?YJy`@PZSQIK3p{*dn9eb=oO(i>W`^{~L@Z|gqaq&SIy8G3EH`aVJUnEFS$ic;NW zxLEz^YvwsB0!>nr%t))KC*wvDK;||GgR8xwm{>WlBSOcNbIlynJMPGw;Yp|MO4+V? zKPFsLh30qO+9a_|Mc{#?U4F5p_Yu*jym*WBx9jANAq?bF9f=Z+HGAJ(5tYSkJ$wT$ zxaPNW9VjHJ`eHNns`bY_0V!&n2ffe=cC;52Ix*mVW20VImR@Mdz9?33(ERK-D^>Vv zei&9d!@{6vEYdP6TUAVScj%X<>y)-U6T+7yBW^<+>+GQOh|+G_2PwOJ$33*8P8A&8 zG^-3j^tY9rmot7lCl43X(z8w-0eg+upX~f&41cHN>{EeN(stsjzGjOVo+F+IX%%Ji zQzJprR=@q!^9u#fqdDOlW{2DF5_-$Lu%YCrs<5H#(7yiQdNzqxiK>iXPEbC-O0Z@P zm36dc?(xD%D%&(G4b(B|twzY#^^tQ^W33b<(}`Axto?R~-pZSAC8XCg3MkXvZb&k2 zkUi6ntoqh*mNJLiHPMRV(r0!athy~2hK#Q{r|w+o=iTU16Y{9H3Q5MaIhMNm&rFc| zTYTHINP|*zS<}>rl~Ud{9#&{BcQjybtaWI9jy~>nkVP%wV~&PAcvKTI?&Fp+f?}yr z4Q)I8549RFPqDrFtB^>eQv2))L!u#jtZXLe^WSe%d<`$Nw7QF_By}rJKc+gYrp~*0 z^-8(B5R z1H6mO!Rh!h&LH-4a2&IjwsG>6MmBRlZJy8@${61wg67HE<&Vc|t*qvB8@*xT&yP?lUHz@A zaP@N(EJ0MGwk=wzph?jnX>y+4sw*hI$&Xj#d#G9iS>0#Ad%lMkMnuX{@IscTE~H#X zkK5ckM^D^#mxo&ZuaxXCF|Btq60g9;sLq)s8KJMVrAZt0LdvZh?_5SP547QLwefT) z&SX{>2072Z5^|SW7-&y?e1E+;SaTg}#1d+6a|C;{5=gq(=T9=!k9FITkS$vM zrcyA>st9*^7{|mIuf!bn!BFoMOHi4_)Acnc+jxm1r6p`NbH@#?5#tq5nB< zmk-x5Yeb&3zreHkMhr8mop0Q(>&W%K+B=v^dXB0$i3 zt!}l&P1h7djgAk)!8P^|*mP@iCWf27pF?(L%ynstQ7zEBJ+`wf%rcLc{9VU z+_BcKIs@rk-2CSo#h-<9=pS4-+!057pJ759YK=eFGM@k!qdTtDp_?AN zK-JZx)4sKq-*_JMvgAm^&=D(#MocXCLiJ_ZeAQ^e?b>07Tn53KMKwB>6i--;y{O0(%&XDrU{~`{ai+MW#<%M; z5mAtNT#)a8GkDY2GR|Hzj%jFv#WULeYQp1UI9@0Tg*M^)f?5#=h!S7aM9}}i^GK8l z9DxE6;^rn37b~(_-wFYtX3<&w_+H8X(a(pM05u=wD*=jx}=&bSFX?LG|Cf{h%=Dih56{h_I%U0Tc*m*e{r zoD(^Yr`}m*G`Pb?UbvV0t_q2;|Mvmq|7Kq=d5`~>_kHMdvmR97^l>DrCT#kHBQ{$v z^v11jz0e8x>l+(=bD~*PPugJJ-R9F{xy9AIrVv?NgA^14AD)x<$N~b-Zg?Q$ZQTg3 zoO&>U_a4TsM0-PeI@bn&xi`T$cRyM_KA6?S1#y7@%A=sxEPw*|R>!M6R z5%TN%bgVKi@+oIJDVlM2#(-4C9csz;Me#;H6pvT&WOto97d>6k%b~f&*=`_iJNqy*HG{avU+w=hkIBfOK{JcU@JfGrPB9y1+6W zlOU^6;w@L*I7h(h_Fv|J(i6+*gZz9PGx#I7CA5BzuRKeT&hVmE7E}#}7l+a6n3!%i zRNY42dpGWd2)*|1`k9K5MBnZbZ6glVw*OEbs<<7r05B$TYqS?4j#}MBcIcot_Bxaz z%rS_z{bXA)Yk6f3v&5ywlVFV*oo@{vwF(-4z0?2l?RuUCUB?Y}RK`x+i7Zn8ztYeaosS^?qRAAp$tF*w{ z-Dx%AMTY1d2_ID4*hyqp_v5OWkGkRcs^TD#YErWa^=(f=&3}o=am+wE4CEXmxfzIV zLAZmRTJPSvRphO*!+qCnSbhRYl6F0B%W^QO}AS)7z&y0|eDX=_o6 zzwp(9T|d{4Vu>5yD<7oIv$4wIuH?|$tNGy_2 z(9A%H;SOK^bmq4c#N@R^I{^oC#LaqC#nY~6aSpG*&9Ov&C$>@)6`nO z)KyzFo%m6$%2-TVMh2&9op+@f47<)wT<29eBLPHacpksd!$J@SF=0t3r^TZuFH@3u zvq@Nu=x+(4CVi+QnG$ggjDSTvjmnlq$GS_IkGHJn-yfe~aQ?Ww!h z!|sXz_UHd0fSIcg#~IC^rhiV*(BaXIc*Oj=5U7DhxXjTl3eH@OJ_2@;i~erKP$@zE zTc-TtXcxteH|^FR7WGNg?F3Ojl4|K@A^ycWphf9m45Ah!a&kf6KQeoDm%ZQ@Qj-^CrN6#C^otx++ zm-bc(Mx_^iI`FDChY#(5xLLV2R;H)Y-#G|W2s(+XVkW*DaERv%;s4%u1C9^AxFfss zkB&WJWFD8N z8DM!LljCT7yZI&}5fC04%Z!!t1?A*+P)??`e3tp0C!M}qQb{udl#_Df7&PhEzCYKe zzvTRr#{bf*Uv~7%Z~Xu1Ck3AycmphtaD9WWhl7F$KkTm1*ue9$xxZ6v4_#AN;m7S+ zj9s9&Q>ST0l-P3-l-3Y1i9RkfDMsJvMee%`V2<|BpO;V$Cjq#albo2b`%%zovDOM( zyNI}GYNL z&AI^^+xwquN-iSCANd9Jg*bdCTrK_yZcf~q>n-=%rSk*8d>?uaKEf;zmeTk*lmGeX zIsTPkI}wZ9MeBZ`te{~))QqhL4e|vB!MR1&wZWxQ)sAil{DPlcw}x@^kQL~?0L0F! zFk5^Nafn~s*y|-+3M~dWuM}Ej*DfD)u-}wt2Im1jjU~PMvfd8p@bSr4L$d%2AG&{7 z339~|y$04+AitY^9?K|^iX8yA-8-xnI^zq6K>%`!_ReaHEGuAR`coE~5V3%|*tOav z%qinej9}iq4C$Z;#{mIf&qs?8|1k)d*MD(acL#vu^E*!OUOae%Cv*U(9i>|z*8+)# znQZ;ewvfdAlYqd*aP=EME~8-zZ1q*_`l2L+5*2_L*S1|bqhKYwh+hh~GB06&Sv z*A{q#i$Pilo!brvz8ZO7ByH{3kQPg&G&L`&BU|W_MBj{p1V}iqmdPw>(HoUq?>ASy zRbU&00L8V76m!jhCP`=Nr0hBdxIFjS>IZ5Xg8-n3qQ%MImbbnFjv`{6<-IU^fIcpJ zKBD6Rjc+swDAhrq1k**ypOKtY2-dM!v9<@?++)R?vP+UY3f{8PQl%U#2IA;yJ}JA% z17tl`K%7>|u|M#61-pNECnL9EyuS*IM6vq`#ijLqz$SxI*AG4qy0;xSY#k!zf zzVYmuKh~*O11?TBHK#8~NJpQ>(X*T#*iwBRBH6!=n^uwNpQ8K+Ip8F(Y zE~mRiKMxzP=wQ`f<-(!^7^0jP#bQt?v){fz&ID6Mj;@)b=;HS!1aar* zbV7_;Km~<;y(!}1zQE5f)f{vkP;0zevb;eD0yz+*eJ3G>`?fp4P`q?FTi~5U8$9)< za@n>8ZA)2aCOEQ$?4KfP2FKB{y2wgFHt2BcP%HF8#?Fb;s12NKTBH|f>xxsTtsVZB z$hv6<`d|c2yA;n2*W;$+=fBQ`+$oJ3_Z^o5{?0d=MZ{HJH|9Cq_3y9Lj$5`}LF(SpK0;casc#P^z3TmU&=}2`WCN zWE}(5A$`RlVy4_tzFL)!B#oAJi+mDBElBrl)oeB*wq5UbNy}&@-8pnW!rI4bX1u@q zA#?B~6MgYf4lvp23jwbdY#Bg4)hjN9KBgJH8PJvla8QQJX|n@5KJr}=D*LbNlHtMl z3Ag9N8fX4pvmx$}86}t`q^+7e3J)$Qb)j0@&s_#{x^3L#VbC_oaZboVap!v3_A8R3 zJ02NxaEw75XUuE-ktq(WkA>V})SB$Se~)>w%IG4^xzyXtansX&MgA3ihiey7(yu;nM;hmIG}VJk2o;DXI7b;A!Dw#`F5qZt6x8wru{20QAw@6uGq z*%Ty?Y9y3xMhlIw_mQt|+G>!<={#y%;bi8xuX;$qK9NDh-}-o9I9{i?Kn-A>CopY% zi#`t#fSyCn2PGl(VFH`15X4D$S6Ayr8x{Z_0+xJ5VUiCRj$p%-{jv`z243XEtB1~e zmd#fXXsABl?eyj7al#aM!kwNZ%%Ue;38T81?hl(fvr_em0E{RLL~C@|(`<1sH3_r0 z4A4z}s)$fPAczt%YD;59$!-W@GP(1rK$m12yl2DGp>M(hY?K05FF&k!7jVD@*Cv@ZsF}SNaDbA3 z8I$2+*tDtru=fCMzpV?0Es9$64{!yC5V9A}0xGK5a8cz2d7l-Y|0rm5&Nb|78U<>< zV2wCLqik#LkERgnn=Gmw>LscA9`Uryl>pbOcx|`!f~X&lz<695Z_tlaT`^bT#;%~W zAKvUAO=Cuv&b>y>zor0en}FhUqqG5H8c;v`N~2_d%Cw~1L7)Ue#RnESMk@-`^EfnJ z6kQiZoF77Qhx}$WB0q@|Lh)=8rIb5T8Y|>&1rxv&w!?c?ElFPsM)hfg5OrPNx6M2) zEFC%DgaoZb4c_OSCR$GL_H}^E?Vg0Jg*_TXL>Z+z&)z-$Yr~5U6YwN&;E$!teJ`^3 zb|A_UNi4yhD8NX6`!NNrx#9<>xvGp_>{yQ zPQu_h{rG7$lREFpr@}y;l~Pw9g~BqLARNgVbwe7?e!NVmyY#2yIG6$q<8hdWuc~bW z*Alz74Ziw|&oM}ta&`()mq?(;-XQc|%wT#>y=p&A3E?gcPFtLD(H9sa;uGwsQL1fJ z^p$&LhOmU(0U$+Kbux68$5{=X;$M&A$QM|HU@T%M$T%FdM!Ud}5c;pBISUb6JXKNw zXhGp=U^0+c-1jXFXMAPUVL>tuCAl75kD!$Cil`OG&Tx88IwzW_jBpnKDk?N=40)=C z3rmN1PmRz8-r*;|CL+5yfT60-DYT7g5CXCS=^Ye+(O;K_M{X0D0bm~E2(Z_9rz&XJ zLu!}iw8>oOkmDtmHI5Ix7FgcaTv2n#^Sl>cJcRl^8c9It;T>>t>9PO<;8*3;;y_2~ zBm-;658Dd-F3{|S2zpy`X&A+ZTq7*;vq!ai)y!=m3P{0(1bf(%m9^x1E7< z_P?MutN>_$fUZ6CNg`~G@OmvV)7F%-NVosYr!Z5 z==3#`To@CZh<#zFs$myypt2nt!G8DI97sr7EK467tgCr`>6-_8H2BKr z=R-NZ(Nih7=C1xE1KuDP!>T%Z@p8?hcWw_mfXZvF?_B7hLVB=%B?TKBe91O$;`?xA ze`Dl+Ga48HA^0Pz0!SDRi=a#PbG`KG%1lMkdb8H8`n-8M;l*Xaex42C#m%jUbs`A($7)oiMmIi`)fVC)*|Hly(z@ZnUkI)Hv~}*; zWcy&ROgLSQmQ2ND1y3t#YbKOzQmbaQzZ%xnUr#)v0#gJQCP6v00A@o@{)|))m}6Y? z7gbqXjN^=|_71Mv3_zOT(ovKN{yzUR^6@KNbsN$nYiiyQfb^Mqvl>Kr{>6)84o#_Y z@eStyIl1t~rajP=|9*-5RxCW8IRiT(cajMeQvPB<<$ws z;Dm+c?h!6(dl&s(hLXuzA>c;;)T}Ys5er~%pyqFOXp-T6U{ZLdbopy{2M5N_fFhdZq}(B0zGr92Ue+2F$mRnF%5e`S{pcE zx=h&){Esd#<5;H3_gDDPfuO+s@+@JQa;_XmMYW1{A6cRT$bA9zY*V0Y+7HSIEkN1B z{_LH_jiB`=kn<*f*|l?-vIn62D*xTVWj2=JtA+LgI3M`z6`&k%o_1}S4Y|Xhi*Tdn z{xaowK>7bfK@s%uQ_$ JmKeML@n88 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 libraries-testing libraries-testing @@ -158,6 +158,13 @@ test + + com.tngtech.archunit + archunit-junit5 + ${archunit.version} + test + + @@ -193,7 +200,7 @@ 1.5.7.1 - 1.9.9 + 1.9.9 1.9.0 1.9.0 1.9.27 @@ -210,6 +217,7 @@ 1.8 1.8 3.8.1 + 0.14.1 diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/SmurfsRepository.java b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/SmurfsRepository.java new file mode 100644 index 0000000000..8107e6317a --- /dev/null +++ b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/SmurfsRepository.java @@ -0,0 +1,49 @@ +/** + * + */ +package com.baldung.archunit.smurfs.persistence; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.TreeMap; + +import com.baldung.archunit.smurfs.persistence.domain.Smurf; + +import static java.util.stream.Collectors.toList; + +/** + * @author Philippe + * + */ +public class SmurfsRepository { + + private static Map smurfs = Collections.synchronizedMap(new TreeMap<>()); + + static { + // Just a few here. A full list can be found + // at https://smurfs.fandom.com/wiki/List_of_Smurf_characters + smurfs.put("Papa", new Smurf("Papa", true, true)); + smurfs.put("Actor", new Smurf("Actor", true, true)); + smurfs.put("Alchemist", new Smurf("Alchemist", true, true)); + smurfs.put("Archeologist", new Smurf("Archeologist", true, true)); + smurfs.put("Architect", new Smurf("Architect", true, true)); + smurfs.put("Baby", new Smurf("Baby", true, true)); + smurfs.put("Baker", new Smurf("Baker", true, true)); + smurfs.put("Baker", new Smurf("Baker", true, true)); + } + + public SmurfsRepository() { + + } + + public List findAll() { + return Collections.unmodifiableList(smurfs.values().stream().collect(toList())); + } + + public Optional findByName(String name) { + return Optional.of(smurfs.get(name)); + } + +} diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/domain/Smurf.java b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/domain/Smurf.java new file mode 100644 index 0000000000..468266cf9a --- /dev/null +++ b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/domain/Smurf.java @@ -0,0 +1,64 @@ +/** + * + */ +package com.baldung.archunit.smurfs.persistence.domain; + +/** + * @author Philippe + * + */ +public class Smurf { + private String name; + private boolean comic; + private boolean cartoon; + + public Smurf() {} + + public Smurf(String name, boolean comic, boolean cartoon) { + this.name = name; + this.comic = comic; + this.cartoon = cartoon; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the commic + */ + public boolean isComic() { + return comic; + } + + /** + * @param commic the commic to set + */ + public void setCommic(boolean comic) { + this.comic = comic; + } + + /** + * @return the cartoon + */ + public boolean isCartoon() { + return cartoon; + } + + /** + * @param cartoon the cartoon to set + */ + public void setCartoon(boolean cartoon) { + this.cartoon = cartoon; + } +} diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/presentation/SmurfsController.java b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/presentation/SmurfsController.java new file mode 100644 index 0000000000..c0aff4ec03 --- /dev/null +++ b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/presentation/SmurfsController.java @@ -0,0 +1,27 @@ +package com.baldung.archunit.smurfs.presentation; + +import java.util.List; + +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baldung.archunit.smurfs.service.SmurfsService; +import com.baldung.archunit.smurfs.service.dto.SmurfDTO; + +@RequestMapping(value = "/smurfs", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) +@RestController +public class SmurfsController { + + private SmurfsService smurfs; + + public SmurfsController(SmurfsService smurfs) { + this.smurfs = smurfs; + } + + @GetMapping + public List getSmurfs() { + return smurfs.findAll(); + } +} diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/SmurfsService.java b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/SmurfsService.java new file mode 100644 index 0000000000..40ffcc955c --- /dev/null +++ b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/SmurfsService.java @@ -0,0 +1,41 @@ +/** + * + */ +package com.baldung.archunit.smurfs.service; + +import java.util.List; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Component; + +import com.baldung.archunit.smurfs.persistence.SmurfsRepository; +import com.baldung.archunit.smurfs.persistence.domain.Smurf; +import com.baldung.archunit.smurfs.service.dto.SmurfDTO; + +/** + * @author Philippe + * + */ +@Component +public class SmurfsService { + + private SmurfsRepository repository; + + public SmurfsService(SmurfsRepository repository) { + this.repository = repository; + } + + public List findAll() { + + return repository.findAll() + .stream() + .map(SmurfsService::toDTO) + .collect(Collectors.toList()); + } + + + public static SmurfDTO toDTO(Smurf smurf) { + return new SmurfDTO(smurf.getName(),smurf.isComic(), smurf.isCartoon()); + } + +} diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/dto/SmurfDTO.java b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/dto/SmurfDTO.java new file mode 100644 index 0000000000..3c49262f9d --- /dev/null +++ b/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/dto/SmurfDTO.java @@ -0,0 +1,64 @@ +/** + * + */ +package com.baldung.archunit.smurfs.service.dto; + +import com.baldung.archunit.smurfs.persistence.domain.Smurf; + +/** + * @author Philippe + * + */ +public class SmurfDTO { + private String name; + private boolean comic; + private boolean cartoon; + + public SmurfDTO() {} + + public SmurfDTO(String name, boolean comic, boolean cartoon) { + this.name = name; + this.comic = comic; + this.cartoon = cartoon; + } + + + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + /** + * @return the commic + */ + public boolean isComic() { + return comic; + } + /** + * @param commic the commic to set + */ + public void setCommic(boolean comic) { + this.comic = comic; + } + /** + * @return the cartoon + */ + public boolean isCartoon() { + return cartoon; + } + /** + * @param cartoon the cartoon to set + */ + public void setCartoon(boolean cartoon) { + this.cartoon = cartoon; + } + + +} diff --git a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java new file mode 100644 index 0000000000..b0c4397794 --- /dev/null +++ b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java @@ -0,0 +1,92 @@ +/** + * + */ +package com.baeldung.archunit.smurfs; + + +import com.tngtech.archunit.core.domain.JavaClasses; +import com.tngtech.archunit.core.importer.ClassFileImporter; +import com.tngtech.archunit.lang.ArchRule; +import com.tngtech.archunit.library.Architectures.LayeredArchitecture; + +import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; +import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; +import static com.tngtech.archunit.library.Architectures.layeredArchitecture; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.junit.jupiter.api.Test; + +/** + * @author Philippe + * + */ +public class SmurfsArchUnitTest { + + @Test + public void givenPresentationLayerClasses_thenWrongCheckFails() { + JavaClasses jc = new ClassFileImporter().importPackages("com.baldung.archunit.smurfs"); + + ArchRule r1 = classes() + .that() + .resideInAPackage("..presentation..") + .should() + .onlyDependOnClassesThat() + .resideInAPackage("..service.."); + + assertThrows(AssertionError.class, ()-> r1.check(jc)) ; + } + + + @Test + public void givenPresentationLayerClasses_thenCheckWithFrameworkDependenciesSuccess() { + JavaClasses jc = new ClassFileImporter().importPackages("com.baldung.archunit.smurfs"); + + ArchRule r1 = classes() + .that() + .resideInAPackage("..presentation..") + .should() + .onlyDependOnClassesThat() + .resideInAnyPackage("..service..", "java..", "javax..", "org.springframework.."); + + r1.check(jc); + } + + @Test + public void givenPresentationLayerClasses_thenNoPersistenceLayerAccess() { + JavaClasses jc = new ClassFileImporter().importPackages("com.baldung.archunit.smurfs"); + + ArchRule r1 = noClasses() + .that() + .resideInAPackage("..presentation..") + .should() + .dependOnClassesThat() + .resideInAPackage("..persistence.."); + + + r1.check(jc); + } + + @Test + public void givenApplicationClasses_thenNoLayerViolationsShouldExist() { + + JavaClasses jc = new ClassFileImporter().importPackages("com.baldung.archunit.smurfs"); + + LayeredArchitecture arch = layeredArchitecture() + // Define layers + .layer("Presentation").definedBy("..presentation..") + .layer("Service").definedBy("..service..") + .layer("Persistence").definedBy("..persistence..") + // Add constraints + .whereLayer("Presentation").mayNotBeAccessedByAnyLayer() + .whereLayer("Service").mayOnlyBeAccessedByLayers("Presentation") + .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service"); + + + arch.check(jc); + + } + + + +} From 4dcdc5964600b721eddc4947ec0190197a9ae50b Mon Sep 17 00:00:00 2001 From: Philippe Date: Tue, 28 Jul 2020 10:30:33 -0300 Subject: [PATCH 0300/1862] [BAEL-4381] Intro to ArchUnit Code formatting --- .../java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java index b0c4397794..a89716fe9c 100644 --- a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java +++ b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java @@ -62,7 +62,6 @@ public class SmurfsArchUnitTest { .should() .dependOnClassesThat() .resideInAPackage("..persistence.."); - r1.check(jc); } @@ -81,10 +80,8 @@ public class SmurfsArchUnitTest { .whereLayer("Presentation").mayNotBeAccessedByAnyLayer() .whereLayer("Service").mayOnlyBeAccessedByLayers("Presentation") .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service"); - arch.check(jc); - } From 2355ccfb5e8bb4f7a886b7a8c12fe7b9fa37177a Mon Sep 17 00:00:00 2001 From: Philippe Date: Tue, 28 Jul 2020 10:31:18 -0300 Subject: [PATCH 0301/1862] [BAEL-4381] Intro to ArchUnit Code formatting --- .../java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java index a89716fe9c..fa4428e599 100644 --- a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java +++ b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java @@ -83,7 +83,4 @@ public class SmurfsArchUnitTest { arch.check(jc); } - - - } From 751c60fb71266be15120d45871f7b00efac8e53f Mon Sep 17 00:00:00 2001 From: Philippe Date: Tue, 28 Jul 2020 10:44:32 -0300 Subject: [PATCH 0302/1862] [BAEL-4381] Intro to ArchUnit Package typo --- .../archunit/smurfs/persistence/SmurfsRepository.java | 4 ++-- .../archunit/smurfs/persistence/domain/Smurf.java | 2 +- .../archunit/smurfs/presentation/SmurfsController.java | 6 +++--- .../archunit/smurfs/service/SmurfsService.java | 8 ++++---- .../archunit/smurfs/service/dto/SmurfDTO.java | 4 ++-- .../com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) rename libraries-testing/src/main/java/com/{baldung => baeldung}/archunit/smurfs/persistence/SmurfsRepository.java (92%) rename libraries-testing/src/main/java/com/{baldung => baeldung}/archunit/smurfs/persistence/domain/Smurf.java (94%) rename libraries-testing/src/main/java/com/{baldung => baeldung}/archunit/smurfs/presentation/SmurfsController.java (78%) rename libraries-testing/src/main/java/com/{baldung => baeldung}/archunit/smurfs/service/SmurfsService.java (74%) rename libraries-testing/src/main/java/com/{baldung => baeldung}/archunit/smurfs/service/dto/SmurfDTO.java (90%) diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/SmurfsRepository.java b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java similarity index 92% rename from libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/SmurfsRepository.java rename to libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java index 8107e6317a..1dee45087a 100644 --- a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/SmurfsRepository.java +++ b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java @@ -1,7 +1,7 @@ /** * */ -package com.baldung.archunit.smurfs.persistence; +package com.baeldung.archunit.smurfs.persistence; import java.util.Collections; import java.util.List; @@ -9,7 +9,7 @@ import java.util.Map; import java.util.Optional; import java.util.TreeMap; -import com.baldung.archunit.smurfs.persistence.domain.Smurf; +import com.baeldung.archunit.smurfs.persistence.domain.Smurf; import static java.util.stream.Collectors.toList; diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/domain/Smurf.java b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/domain/Smurf.java similarity index 94% rename from libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/domain/Smurf.java rename to libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/domain/Smurf.java index 468266cf9a..6e0f586a5b 100644 --- a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/persistence/domain/Smurf.java +++ b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/domain/Smurf.java @@ -1,7 +1,7 @@ /** * */ -package com.baldung.archunit.smurfs.persistence.domain; +package com.baeldung.archunit.smurfs.persistence.domain; /** * @author Philippe diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/presentation/SmurfsController.java b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/presentation/SmurfsController.java similarity index 78% rename from libraries-testing/src/main/java/com/baldung/archunit/smurfs/presentation/SmurfsController.java rename to libraries-testing/src/main/java/com/baeldung/archunit/smurfs/presentation/SmurfsController.java index c0aff4ec03..7e31980d89 100644 --- a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/presentation/SmurfsController.java +++ b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/presentation/SmurfsController.java @@ -1,4 +1,4 @@ -package com.baldung.archunit.smurfs.presentation; +package com.baeldung.archunit.smurfs.presentation; import java.util.List; @@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.baldung.archunit.smurfs.service.SmurfsService; -import com.baldung.archunit.smurfs.service.dto.SmurfDTO; +import com.baeldung.archunit.smurfs.service.SmurfsService; +import com.baeldung.archunit.smurfs.service.dto.SmurfDTO; @RequestMapping(value = "/smurfs", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RestController diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/SmurfsService.java b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/service/SmurfsService.java similarity index 74% rename from libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/SmurfsService.java rename to libraries-testing/src/main/java/com/baeldung/archunit/smurfs/service/SmurfsService.java index 40ffcc955c..e2c73ef77e 100644 --- a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/SmurfsService.java +++ b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/service/SmurfsService.java @@ -1,16 +1,16 @@ /** * */ -package com.baldung.archunit.smurfs.service; +package com.baeldung.archunit.smurfs.service; import java.util.List; import java.util.stream.Collectors; import org.springframework.stereotype.Component; -import com.baldung.archunit.smurfs.persistence.SmurfsRepository; -import com.baldung.archunit.smurfs.persistence.domain.Smurf; -import com.baldung.archunit.smurfs.service.dto.SmurfDTO; +import com.baeldung.archunit.smurfs.persistence.SmurfsRepository; +import com.baeldung.archunit.smurfs.persistence.domain.Smurf; +import com.baeldung.archunit.smurfs.service.dto.SmurfDTO; /** * @author Philippe diff --git a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/dto/SmurfDTO.java b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/service/dto/SmurfDTO.java similarity index 90% rename from libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/dto/SmurfDTO.java rename to libraries-testing/src/main/java/com/baeldung/archunit/smurfs/service/dto/SmurfDTO.java index 3c49262f9d..948d0b349a 100644 --- a/libraries-testing/src/main/java/com/baldung/archunit/smurfs/service/dto/SmurfDTO.java +++ b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/service/dto/SmurfDTO.java @@ -1,9 +1,9 @@ /** * */ -package com.baldung.archunit.smurfs.service.dto; +package com.baeldung.archunit.smurfs.service.dto; -import com.baldung.archunit.smurfs.persistence.domain.Smurf; +import com.baeldung.archunit.smurfs.persistence.domain.Smurf; /** * @author Philippe diff --git a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java index fa4428e599..0231a2c51a 100644 --- a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java +++ b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java @@ -25,7 +25,7 @@ public class SmurfsArchUnitTest { @Test public void givenPresentationLayerClasses_thenWrongCheckFails() { - JavaClasses jc = new ClassFileImporter().importPackages("com.baldung.archunit.smurfs"); + JavaClasses jc = new ClassFileImporter().importPackages("com.baeldung.archunit.smurfs"); ArchRule r1 = classes() .that() @@ -40,7 +40,7 @@ public class SmurfsArchUnitTest { @Test public void givenPresentationLayerClasses_thenCheckWithFrameworkDependenciesSuccess() { - JavaClasses jc = new ClassFileImporter().importPackages("com.baldung.archunit.smurfs"); + JavaClasses jc = new ClassFileImporter().importPackages("com.baeldung.archunit.smurfs"); ArchRule r1 = classes() .that() @@ -54,7 +54,7 @@ public class SmurfsArchUnitTest { @Test public void givenPresentationLayerClasses_thenNoPersistenceLayerAccess() { - JavaClasses jc = new ClassFileImporter().importPackages("com.baldung.archunit.smurfs"); + JavaClasses jc = new ClassFileImporter().importPackages("com.baeldung.archunit.smurfs"); ArchRule r1 = noClasses() .that() @@ -69,7 +69,7 @@ public class SmurfsArchUnitTest { @Test public void givenApplicationClasses_thenNoLayerViolationsShouldExist() { - JavaClasses jc = new ClassFileImporter().importPackages("com.baldung.archunit.smurfs"); + JavaClasses jc = new ClassFileImporter().importPackages("com.baeldung.archunit.smurfs"); LayeredArchitecture arch = layeredArchitecture() // Define layers From 011b56d158f8bfa4b9bfc34e3e7a90975e5491b9 Mon Sep 17 00:00:00 2001 From: STS Date: Tue, 28 Jul 2020 20:17:02 +0200 Subject: [PATCH 0303/1862] Trigger Test From 92b315a3a6cf07165f5f9e0e96eff1c22ba52c59 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 28 Jul 2020 22:08:52 +0200 Subject: [PATCH 0304/1862] BAEL-3905: Mark test ctx as dirty after each test method (#9784) --- .../com/baeldung/testloglevel/TestLogLevelApplication.java | 4 +--- .../LogbackMultiProfileTestLogLevelIntegrationTest.java | 4 ++-- .../testloglevel/LogbackTestLogLevelIntegrationTest.java | 4 ++-- .../testloglevel/TestLogLevelWithProfileIntegrationTest.java | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/testloglevel/TestLogLevelApplication.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/testloglevel/TestLogLevelApplication.java index ed8218c6a3..ef4534938b 100644 --- a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/testloglevel/TestLogLevelApplication.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/testloglevel/TestLogLevelApplication.java @@ -3,13 +3,11 @@ package com.baeldung.testloglevel; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import com.baeldung.boot.Application; - @SpringBootApplication(scanBasePackages = {"com.baeldung.testloglevel", "com.baeldung.component"}) public class TestLogLevelApplication { public static void main(String[] args) { - SpringApplication.run(Application.class, args); + SpringApplication.run(TestLogLevelApplication.class, args); } } diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackMultiProfileTestLogLevelIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackMultiProfileTestLogLevelIntegrationTest.java index f8bd61e5c7..ffe99672be 100644 --- a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackMultiProfileTestLogLevelIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackMultiProfileTestLogLevelIntegrationTest.java @@ -16,9 +16,9 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS; +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; -@DirtiesContext(classMode = AFTER_CLASS) +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = TestLogLevelApplication.class) @EnableAutoConfiguration(exclude = SecurityAutoConfiguration.class) diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackTestLogLevelIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackTestLogLevelIntegrationTest.java index ffe9d400ed..cbd22e8087 100644 --- a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackTestLogLevelIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackTestLogLevelIntegrationTest.java @@ -16,9 +16,9 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS; +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; -@DirtiesContext(classMode = AFTER_CLASS) +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = TestLogLevelApplication.class) @EnableAutoConfiguration(exclude = SecurityAutoConfiguration.class) diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/TestLogLevelWithProfileIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/TestLogLevelWithProfileIntegrationTest.java index 6e80f50c00..571b826b80 100644 --- a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/TestLogLevelWithProfileIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/TestLogLevelWithProfileIntegrationTest.java @@ -16,10 +16,10 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_CLASS; +import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD; @RunWith(SpringRunner.class) -@DirtiesContext(classMode = AFTER_CLASS) +@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = TestLogLevelApplication.class) @EnableAutoConfiguration(exclude = SecurityAutoConfiguration.class) @ActiveProfiles("logging-test") From eadd24ad5de2567d7dca6365715340b8c5258b05 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Tue, 28 Jul 2020 18:03:57 -0400 Subject: [PATCH 0305/1862] Simplify hashcode example --- .../java/com/baeldung/jpa/equality/EqualByBusinessKey.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java index 3e34f97d77..78ba1ad1e9 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java @@ -32,10 +32,7 @@ public class EqualByBusinessKey { @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((email == null) ? 0 : email.hashCode()); - return result; + return java.util.Objects.hashCode(email); } @Override From da07a30a00cf92b2b251714f56684dd4a94d57fa Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Tue, 28 Jul 2020 18:40:29 -0400 Subject: [PATCH 0306/1862] Remove metamodel plugin --- persistence-modules/java-jpa-3/pom.xml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/persistence-modules/java-jpa-3/pom.xml b/persistence-modules/java-jpa-3/pom.xml index 562f337215..57791f474e 100644 --- a/persistence-modules/java-jpa-3/pom.xml +++ b/persistence-modules/java-jpa-3/pom.xml @@ -66,26 +66,6 @@ -proc:none - - org.bsc.maven - maven-processor-plugin - ${maven-processor-plugin.version} - - - process - - process - - generate-sources - - target/metamodel - - org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor - - - - - org.codehaus.mojo build-helper-maven-plugin From 12322ff46b265ccf3b58aac62c5d197bc495bda4 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Wed, 29 Jul 2020 08:59:06 +0200 Subject: [PATCH 0307/1862] update test --- .../java/com/baeldung/screenshot/ScreenshotTest.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java index 3df31897e1..20d2d333a3 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java @@ -17,10 +17,9 @@ public class ScreenshotTest { public void takeScreenshotOfMainScreen() throws Exception { Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage capture = new Robot().createScreenCapture(screenRect); - File imageFile = new File("single-screen.bmp"); + File imageFile = File.createTempFile("single-screen", "bmp"); ImageIO.write(capture, "bmp", imageFile); assertTrue(imageFile.exists()); - imageFile.delete(); } @Test @@ -34,10 +33,9 @@ public class ScreenshotTest { allScreenBounds.height = Math.max(allScreenBounds.height, screenBounds.height); } BufferedImage capture = new Robot().createScreenCapture(allScreenBounds); - File imageFile = new File("all-screens.bmp"); + File imageFile = File.createTempFile("all-screens", "bmp"); ImageIO.write(capture, "bmp", imageFile); assertTrue(imageFile.exists()); - imageFile.delete(); } @Test @@ -45,10 +43,9 @@ public class ScreenshotTest { Rectangle componentRect = component.getBounds(); BufferedImage bufferedImage = new BufferedImage(componentRect.width, componentRect.height, BufferedImage.TYPE_INT_ARGB); component.paint(bufferedImage.getGraphics()); - File imageFile = new File("component-screenshot.bmp"); + File imageFile = File.createTempFile("component-screenshot", "bmp"); ImageIO.write(bufferedImage, "bmp", imageFile); assertTrue(imageFile.exists()); - imageFile.delete(); } } \ No newline at end of file From 768658cfc8ab0ad9a9df6fca9574f72ac1905576 Mon Sep 17 00:00:00 2001 From: helga_sh Date: Wed, 29 Jul 2020 11:36:09 +0300 Subject: [PATCH 0308/1862] Fixed builder formatting --- .../baeldung/deeplearning4j/cnn/CnnModel.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModel.java b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModel.java index bd87709c0e..efa7f828ed 100644 --- a/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModel.java +++ b/deeplearning4j/src/main/java/com/baeldung/deeplearning4j/cnn/CnnModel.java @@ -30,23 +30,23 @@ class CnnModel { this.properties = properties; MultiLayerConfiguration configuration = new NeuralNetConfiguration.Builder() - .seed(1611) - .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) - .learningRate(properties.getLearningRate()) - .regularization(true) - .updater(properties.getOptimizer()) - .list() - .layer(0, conv5x5()) - .layer(1, pooling2x2Stride2()) - .layer(2, conv3x3Stride1Padding2()) - .layer(3, pooling2x2Stride1()) - .layer(4, conv3x3Stride1Padding1()) - .layer(5, pooling2x2Stride1()) - .layer(6, dense()) - .pretrain(false) - .backprop(true) - .setInputType(dataSetService.inputType()) - .build(); + .seed(1611) + .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT) + .learningRate(properties.getLearningRate()) + .regularization(true) + .updater(properties.getOptimizer()) + .list() + .layer(0, conv5x5()) + .layer(1, pooling2x2Stride2()) + .layer(2, conv3x3Stride1Padding2()) + .layer(3, pooling2x2Stride1()) + .layer(4, conv3x3Stride1Padding1()) + .layer(5, pooling2x2Stride1()) + .layer(6, dense()) + .pretrain(false) + .backprop(true) + .setInputType(dataSetService.inputType()) + .build(); network = new MultiLayerNetwork(configuration); } From 23f1333aaaca15c8bc662ef873c5b5f494284b9f Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Thu, 30 Jul 2020 01:43:57 +0530 Subject: [PATCH 0309/1862] Implementing Code Review comments --- .../spring-data-cosmosdb/pom.xml | 84 ++++++++++--------- .../controller/ProductController.java | 10 ++- .../spring/data/cosmosdb/entity/Product.java | 42 ++-------- .../data/cosmosdb/service/ProductService.java | 3 +- ...=> AzurecosmodbApplicationManualTest.java} | 12 ++- 5 files changed, 62 insertions(+), 89 deletions(-) rename persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/{AzurecosmodbApplicationIntegrationTest.java => AzurecosmodbApplicationManualTest.java} (70%) diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml index 8bb103879d..7de135cdb6 100644 --- a/persistence-modules/spring-data-cosmosdb/pom.xml +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -1,48 +1,52 @@ - 4.0.0 - spring-data-cosmosdb - spring-data-cosmos-db - tutorial for spring-data-cosmosdb + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + spring-data-cosmosdb + spring-data-cosmos-db + tutorial for spring-data-cosmosdb - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 - + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + - - 1.8 - + + 1.8 + 2.3.0 + - - - org.springframework.boot - spring-boot-starter-web - - - com.microsoft.azure - spring-data-cosmosdb - 2.3.0 - + + + org.springframework.boot + spring-boot-starter-web + + + com.microsoft.azure + spring-data-cosmosdb + ${cosmodb.version} + + + org.springframework.boot + spring-boot-starter-test + test + + + org.projectlombok + lombok + + - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java index c1e38c9601..fe02be88ff 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java @@ -22,9 +22,13 @@ import java.util.Optional; @RequestMapping("/products") public class ProductController { - @Autowired private ProductService productService; + @Autowired + public ProductController(ProductService productService) { + this.productService = productService; + } + @PostMapping @ResponseStatus(HttpStatus.CREATED) public void create(@RequestBody Product product) { @@ -46,8 +50,8 @@ public class ProductController { return productService.findProductByName(name); } - @GetMapping(value = "/category/{category}") - public List getByCategory(@PathVariable String category) { + @GetMapping(value = "/category") + public List getByCategory(@RequestParam String category) { return productService.getProductsOfCategory(category); } diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/entity/Product.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/entity/Product.java index 07bb8889f5..10bbe1b9ae 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/entity/Product.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/entity/Product.java @@ -5,6 +5,11 @@ import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey; import org.springframework.data.annotation.Id; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter @Document(collection = "products") public class Product { @@ -18,41 +23,4 @@ public class Product { @PartitionKey private String productCategory; - public String getProductid() { - return productid; - } - - public void setProductid(String productid) { - this.productid = productid; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public String getProductCategory() { - return productCategory; - } - - public void setProductCategory(String productCategory) { - this.productCategory = productCategory; - } - - public double getPrice() { - return price; - } - - public void setPrice(double price) { - this.price = price; - } - - @Override - public String toString() { - return "Product [productid=" + productid + ", productName=" + productName + ", price=" + price + ", productCategory=" + productCategory + "]"; - } - } diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java index 6846d5205c..03f3ba39cd 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java @@ -25,8 +25,7 @@ public class ProductService { } public List getProductsOfCategory(String category) { - List products = repository.findByProductCategory(category); - return products; + return repository.findByProductCategory(category); } public void saveProduct(Product product) { diff --git a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationIntegrationTest.java b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java similarity index 70% rename from persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationIntegrationTest.java rename to persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java index 0ef6af15e1..80cf17284a 100644 --- a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationIntegrationTest.java +++ b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java @@ -14,14 +14,14 @@ import java.util.Optional; //Uncomment this when configured URI and keys for Azure Cosmos DB in application.properties //to run the integration test //@SpringBootTest -public class AzurecosmodbApplicationIntegrationTest { +public class AzurecosmodbApplicationManualTest { @Autowired ProductRepository productRepository; // Uncomment this when configured URI and keys for Azure Cosmos DB in application.properties // to run the integration test - // @Test + //@Test public void givenProductIsCreated_whenCallFindById_thenProductIsFound() { Product product = new Product(); product.setProductid("1001"); @@ -29,11 +29,9 @@ public class AzurecosmodbApplicationIntegrationTest { product.setPrice(110.0); product.setProductName("Blue Shirt"); - // Uncomment these lines when configured URI and keys for Azure Cosmos DB in application.properties - // to run the integration test - // productRepository.save(product); - // Optional retrievedProduct = productRepository.findById("1001", new PartitionKey("Shirt")); - // Assert.notNull(retrievedProduct, "Retrieved Product is Null"); + productRepository.save(product); + Optional retrievedProduct = productRepository.findById("1001", new PartitionKey("Shirt")); + Assert.notNull(retrievedProduct, "Retrieved Product is Null"); } From bb391a389f9fe800f76d94ddc3c13f2c4716b819 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Thu, 30 Jul 2020 01:49:05 +0530 Subject: [PATCH 0310/1862] Implementing Code Review comments-2 --- .../spring/data/cosmosdb/service/ProductService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java index 03f3ba39cd..49d07ca5a2 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java @@ -13,8 +13,12 @@ import java.util.Optional; @Component public class ProductService { - @Autowired private ProductRepository repository; + + @Autowired + public ProductService(ProductRepository repository) { + this.repository = repository; + } public List findProductByName(String productName) { return repository.findByProductName(productName); From 7693cbd8fe05a8c365e52c3cfa93c6d9a2f5a009 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Thu, 30 Jul 2020 01:54:23 +0530 Subject: [PATCH 0311/1862] Fixing indentation Issue in pom.xml --- .../spring-data-cosmosdb/pom.xml | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml index 7de135cdb6..3bf19575dd 100644 --- a/persistence-modules/spring-data-cosmosdb/pom.xml +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -1,52 +1,52 @@ - 4.0.0 - spring-data-cosmosdb - spring-data-cosmos-db - tutorial for spring-data-cosmosdb + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + spring-data-cosmosdb + spring-data-cosmos-db + tutorial for spring-data-cosmosdb - - com.baeldung + + com.baeldung parent-boot-2 0.0.1-SNAPSHOT ../../parent-boot-2 - + - + 1.8 2.3.0 - + - + - org.springframework.boot - spring-boot-starter-web + org.springframework.boot + spring-boot-starter-web - com.microsoft.azure - spring-data-cosmosdb - ${cosmodb.version} + com.microsoft.azure + spring-data-cosmosdb + ${cosmodb.version} - - org.springframework.boot - spring-boot-starter-test - test + + org.springframework.boot + spring-boot-starter-test + test - org.projectlombok - lombok + org.projectlombok + lombok - + - + - + org.springframework.boot spring-boot-maven-plugin - + - + From 251466b0a6a5b154b6e0f62ea42ec9a65eb927e1 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Thu, 30 Jul 2020 02:03:32 +0530 Subject: [PATCH 0312/1862] Fixing indentation issues --- .../spring-data-cosmosdb/pom.xml | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml index 3bf19575dd..91fb53286a 100644 --- a/persistence-modules/spring-data-cosmosdb/pom.xml +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -6,47 +6,47 @@ spring-data-cosmosdb spring-data-cosmos-db tutorial for spring-data-cosmosdb - + com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 - 1.8 - 2.3.0 + 1.8 + 2.3.0 - - org.springframework.boot - spring-boot-starter-web - - - com.microsoft.azure - spring-data-cosmosdb - ${cosmodb.version} - + + org.springframework.boot + spring-boot-starter-web + + + com.microsoft.azure + spring-data-cosmosdb + ${cosmodb.version} + - org.springframework.boot - spring-boot-starter-test - test - - - org.projectlombok - lombok - + org.springframework.boot + spring-boot-starter-test + test + + + org.projectlombok + lombok + - - - org.springframework.boot - spring-boot-maven-plugin - - + + + org.springframework.boot + spring-boot-maven-plugin + + From 929ec03e4b603119b47df93ef1924aeabff16053 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Thu, 30 Jul 2020 02:09:15 +0530 Subject: [PATCH 0313/1862] Fixing Indentation Issues - 2 --- .../spring-data-cosmosdb/pom.xml | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml index 91fb53286a..1b21c6dd71 100644 --- a/persistence-modules/spring-data-cosmosdb/pom.xml +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -9,35 +9,35 @@ com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 - 1.8 - 2.3.0 + 1.8 + 2.3.0 - - org.springframework.boot - spring-boot-starter-web - - - com.microsoft.azure - spring-data-cosmosdb - ${cosmodb.version} - + + org.springframework.boot + spring-boot-starter-web + + + com.microsoft.azure + spring-data-cosmosdb + ${cosmodb.version} + - org.springframework.boot - spring-boot-starter-test - test - - - org.projectlombok - lombok - + org.springframework.boot + spring-boot-starter-test + test + + + org.projectlombok + lombok + From 36279b05b48e78f50a8735adf38b458fa3b6ef16 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Thu, 30 Jul 2020 02:14:27 +0530 Subject: [PATCH 0314/1862] Fixing Indentation Issue -3 --- .../spring-data-cosmosdb/pom.xml | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml index 1b21c6dd71..75cc830578 100644 --- a/persistence-modules/spring-data-cosmosdb/pom.xml +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -6,40 +6,39 @@ spring-data-cosmosdb spring-data-cosmos-db tutorial for spring-data-cosmosdb - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 - + - 1.8 - 2.3.0 + 1.8 + 2.3.0 - + - - org.springframework.boot - spring-boot-starter-web - - - com.microsoft.azure - spring-data-cosmosdb - ${cosmodb.version} - - org.springframework.boot - spring-boot-starter-test - test - - - org.projectlombok - lombok - + org.springframework.boot + spring-boot-starter-web + + + com.microsoft.azure + spring-data-cosmosdb + ${cosmodb.version} + + + org.springframework.boot + spring-boot-starter-test + test + + + org.projectlombok + lombok + - + From 204caa3219e220245475d699d89fd03a2200ea38 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Thu, 30 Jul 2020 02:44:25 +0530 Subject: [PATCH 0315/1862] uncommenting the @SpringBootTest and @Test annotation --- .../data/cosmosdb/AzurecosmodbApplicationManualTest.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java index 80cf17284a..0f42aadc6f 100644 --- a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java +++ b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java @@ -11,17 +11,13 @@ import org.springframework.util.Assert; import java.util.Optional; -//Uncomment this when configured URI and keys for Azure Cosmos DB in application.properties -//to run the integration test -//@SpringBootTest +@SpringBootTest public class AzurecosmodbApplicationManualTest { @Autowired ProductRepository productRepository; - // Uncomment this when configured URI and keys for Azure Cosmos DB in application.properties - // to run the integration test - //@Test + @Test public void givenProductIsCreated_whenCallFindById_thenProductIsFound() { Product product = new Product(); product.setProductid("1001"); From 75df0b0778cdfd6e13c6ef34290d22c41a2c42ac Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Thu, 30 Jul 2020 03:05:16 +0530 Subject: [PATCH 0316/1862] retrieving the object from optional object --- .../spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java index 0f42aadc6f..786b578501 100644 --- a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java +++ b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java @@ -27,7 +27,7 @@ public class AzurecosmodbApplicationManualTest { productRepository.save(product); Optional retrievedProduct = productRepository.findById("1001", new PartitionKey("Shirt")); - Assert.notNull(retrievedProduct, "Retrieved Product is Null"); + Assert.notNull(retrievedProduct.get(), "Retrieved Product is Null"); } From a4b9016d6cbdea0b74d1754fbcabf8c5b988d5b5 Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Thu, 30 Jul 2020 08:23:43 +0530 Subject: [PATCH 0317/1862] JAVA-2154: Added guava dependency to module pom directly (#9789) instead of inheriting from parent --- guava-modules/pom.xml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/guava-modules/pom.xml b/guava-modules/pom.xml index 2d0bf68183..b625f9fd0f 100644 --- a/guava-modules/pom.xml +++ b/guava-modules/pom.xml @@ -4,9 +4,6 @@ 4.0.0 guava-modules guava-modules - - 5.6.2 - pom @@ -30,6 +27,11 @@ + + com.google.guava + guava + ${guava.version} + org.junit.jupiter junit-jupiter @@ -54,4 +56,9 @@ + + 5.6.2 + 29.0-jre + + From 6889e238ff978ab3ed3175b011bcc0309fccc60d Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 30 Jul 2020 07:50:21 +0200 Subject: [PATCH 0318/1862] BAEL-3415: Get rid of the MockitoAnnotations.initMocks (#9787) --- .../fluentapi/PizzaServiceUnitTest.java | 29 ++++++++----------- .../ArgumentMatcherWithLambdaUnitTest.java | 25 +++++++--------- .../ArgumentMatcherWithoutLambdaUnitTest.java | 14 ++++----- .../java8/CustomAnswerWithLambdaUnitTest.java | 6 ++-- .../CustomAnswerWithoutLambdaUnitTest.java | 7 ++--- .../mockito/java8/JobServiceUnitTest.java | 22 ++++++-------- .../UnemploymentServiceImplUnitTest.java | 24 +++++++-------- .../MockitoUnecessaryStubUnitTest.java | 28 ++++++++---------- 8 files changed, 66 insertions(+), 89 deletions(-) diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/fluentapi/PizzaServiceUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/fluentapi/PizzaServiceUnitTest.java index b5dd10b1d4..5993d1968c 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/fluentapi/PizzaServiceUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/fluentapi/PizzaServiceUnitTest.java @@ -1,5 +1,16 @@ package com.baeldung.mockito.fluentapi; +import com.baeldung.mockito.fluentapi.Pizza.PizzaBuilder; +import com.baeldung.mockito.fluentapi.Pizza.PizzaSize; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Answers; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; @@ -8,18 +19,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Answers; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; - -import com.baeldung.mockito.fluentapi.Pizza.PizzaBuilder; -import com.baeldung.mockito.fluentapi.Pizza.PizzaSize; - +@RunWith(MockitoJUnitRunner.class) public class PizzaServiceUnitTest { @Mock @@ -33,11 +33,6 @@ public class PizzaServiceUnitTest { @Captor private ArgumentCaptor sizeCaptor; - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - } - @Test public void givenTraditonalMocking_whenServiceInvoked_thenPizzaIsBuilt() { PizzaBuilder nameBuilder = Mockito.mock(Pizza.PizzaBuilder.class); diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/ArgumentMatcherWithLambdaUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/ArgumentMatcherWithLambdaUnitTest.java index 2efac513b7..8d6d4bade1 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/ArgumentMatcherWithLambdaUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/ArgumentMatcherWithLambdaUnitTest.java @@ -1,19 +1,19 @@ package com.baeldung.mockito.java8; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.Optional; + import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; -import java.util.Optional; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentMatchers; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - - +@RunWith(MockitoJUnitRunner.class) public class ArgumentMatcherWithLambdaUnitTest { @InjectMocks @@ -36,9 +36,4 @@ public class ArgumentMatcherWithLambdaUnitTest { assertTrue(unemploymentService.personIsEntitledToUnemploymentSupport(linda)); assertFalse(unemploymentService.personIsEntitledToUnemploymentSupport(peter)); } - - @Before - public void init() { - MockitoAnnotations.initMocks(this); - } } diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/ArgumentMatcherWithoutLambdaUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/ArgumentMatcherWithoutLambdaUnitTest.java index aaa8d03585..3b003d0a87 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/ArgumentMatcherWithoutLambdaUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/ArgumentMatcherWithoutLambdaUnitTest.java @@ -1,8 +1,12 @@ package com.baeldung.mockito.java8; -import org.junit.Before; import org.junit.Test; -import org.mockito.*; +import org.junit.runner.RunWith; +import org.mockito.ArgumentMatcher; +import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import java.util.Optional; @@ -11,6 +15,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; +@RunWith(MockitoJUnitRunner.class) public class ArgumentMatcherWithoutLambdaUnitTest { private class PeterArgumentMatcher implements ArgumentMatcher { @@ -43,9 +48,4 @@ public class ArgumentMatcherWithoutLambdaUnitTest { assertTrue(unemploymentService.personIsEntitledToUnemploymentSupport(linda)); assertFalse(unemploymentService.personIsEntitledToUnemploymentSupport(peter)); } - - @Before - public void init() { - MockitoAnnotations.initMocks(this); - } } diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java index 06e9bca6d3..8886d1325c 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithLambdaUnitTest.java @@ -2,9 +2,10 @@ package com.baeldung.mockito.java8; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; +import org.mockito.junit.MockitoJUnitRunner; import java.util.stream.Stream; @@ -13,6 +14,7 @@ import static org.junit.Assert.assertFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; +@RunWith(MockitoJUnitRunner.class) public class CustomAnswerWithLambdaUnitTest { @InjectMocks @@ -37,8 +39,6 @@ public class CustomAnswerWithLambdaUnitTest { @Before public void init() { - MockitoAnnotations.initMocks(this); - when(jobService.listJobs(any(Person.class))).then((i) -> Stream.of(new JobPosition("Teacher")) .filter(p -> ((Person) i.getArgument(0)).getName().equals("Peter"))); diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithoutLambdaUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithoutLambdaUnitTest.java index d5b9d6d1ce..f75a62fea5 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithoutLambdaUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/CustomAnswerWithoutLambdaUnitTest.java @@ -2,10 +2,11 @@ package com.baeldung.mockito.java8; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import java.util.stream.Stream; @@ -15,7 +16,7 @@ import static org.junit.Assert.assertFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; - +@RunWith(MockitoJUnitRunner.class) public class CustomAnswerWithoutLambdaUnitTest { private class PersonAnswer implements Answer> { @@ -54,8 +55,6 @@ public class CustomAnswerWithoutLambdaUnitTest { @Before public void init() { - MockitoAnnotations.initMocks(this); - when(jobService.listJobs(any(Person.class))).then(new PersonAnswer()); } } diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/JobServiceUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/JobServiceUnitTest.java index 9ea5c1db47..5b3bc5e3d5 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/JobServiceUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/JobServiceUnitTest.java @@ -1,18 +1,19 @@ package com.baeldung.mockito.java8; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.Optional; + import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.when; -import java.util.Optional; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; - +@RunWith(MockitoJUnitRunner.class) public class JobServiceUnitTest { @Mock private JobService jobService; @@ -36,9 +37,4 @@ public class JobServiceUnitTest { assertTrue(jobService.assignJobPosition(person, new JobPosition())); } - - @Before - public void init() { - MockitoAnnotations.initMocks(this); - } } diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/UnemploymentServiceImplUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/UnemploymentServiceImplUnitTest.java index b3b71e5bf9..87093fc1ba 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/UnemploymentServiceImplUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/java8/UnemploymentServiceImplUnitTest.java @@ -1,19 +1,20 @@ package com.baeldung.mockito.java8; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.Optional; +import java.util.stream.Stream; + import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; -import java.util.Optional; -import java.util.stream.Stream; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - +@RunWith(MockitoJUnitRunner.class) public class UnemploymentServiceImplUnitTest { @Mock private JobService jobService; @@ -54,9 +55,4 @@ public class UnemploymentServiceImplUnitTest { // This will fail when Mockito 1 is used assertFalse(unemploymentService.searchJob(person, "").isPresent()); } - - @Before - public void init() { - MockitoAnnotations.initMocks(this); - } } diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/misusing/MockitoUnecessaryStubUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/misusing/MockitoUnecessaryStubUnitTest.java index 00edb699de..828d31f6f9 100644 --- a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/misusing/MockitoUnecessaryStubUnitTest.java +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/misusing/MockitoUnecessaryStubUnitTest.java @@ -1,21 +1,22 @@ package com.baeldung.mockito.misusing; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.exceptions.misusing.UnnecessaryStubbingException; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.quality.Strictness; + +import java.util.ArrayList; + import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.when; -import java.util.ArrayList; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.exceptions.misusing.UnnecessaryStubbingException; -import org.mockito.junit.MockitoJUnit; -import org.mockito.quality.Strictness; - +@RunWith(MockitoJUnitRunner.class) public class MockitoUnecessaryStubUnitTest { @Rule @@ -25,11 +26,6 @@ public class MockitoUnecessaryStubUnitTest { @Mock private ArrayList mockList; - @Before - public void setUp() { - MockitoAnnotations.initMocks(this); - } - @Test public void givenUnusedStub_whenInvokingGetThenThrowUnnecessaryStubbingException() { rule.expectedFailure(UnnecessaryStubbingException.class); From a623d1714fa8611dd5e9d630ca6686290072f316 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 30 Jul 2020 07:57:02 +0200 Subject: [PATCH 0319/1862] BAEL-4468: Fix nullSafeSet method (#9791) --- .../com/baeldung/hibernate/customtypes/PhoneNumberType.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persistence-modules/hibernate-annotations/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java b/persistence-modules/hibernate-annotations/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java index 9f09352bec..79caa3d6fd 100644 --- a/persistence-modules/hibernate-annotations/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java +++ b/persistence-modules/hibernate-annotations/src/main/java/com/baeldung/hibernate/customtypes/PhoneNumberType.java @@ -57,6 +57,8 @@ public class PhoneNumberType implements UserType { if (Objects.isNull(value)) { st.setNull(index, Types.INTEGER); + st.setNull(index+1, Types.INTEGER); + st.setNull(index+2, Types.INTEGER); } else { PhoneNumber employeeNumber = (PhoneNumber) value; st.setInt(index,employeeNumber.getCountryCode()); From baa46f6f4fb4ede1cb89893dacde69cbbf9baef1 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Thu, 30 Jul 2020 11:26:57 +0200 Subject: [PATCH 0320/1862] rename --- .../{ScreenshotTest.java => ScreenshotUnitTest.java} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/{ScreenshotTest.java => ScreenshotUnitTest.java} (85%) diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java similarity index 85% rename from core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java rename to core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java index 20d2d333a3..6bd0e7dff7 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java @@ -11,10 +11,10 @@ import org.junit.Test; import static org.junit.Assert.assertTrue; -public class ScreenshotTest { +public class ScreenshotUnitTest { @Test - public void takeScreenshotOfMainScreen() throws Exception { + public void givenMainScreen_whenTakeScreenshot_thenSaveToFile() throws Exception { Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage capture = new Robot().createScreenCapture(screenRect); File imageFile = File.createTempFile("single-screen", "bmp"); @@ -23,7 +23,7 @@ public class ScreenshotTest { } @Test - public void takeScreenshotOfAllScreens() throws Exception { + public void givenMultipleScreens_whenTakeScreenshot_thenSaveToFile() throws Exception { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] screens = ge.getScreenDevices(); Rectangle allScreenBounds = new Rectangle(); @@ -39,7 +39,7 @@ public class ScreenshotTest { } @Test - public void makeScreenshot(Component component) throws Exception { + public void givenComponent_whenTakeScreenshot_thenSaveToFile(Component component) throws Exception { Rectangle componentRect = component.getBounds(); BufferedImage bufferedImage = new BufferedImage(componentRect.width, componentRect.height, BufferedImage.TYPE_INT_ARGB); component.paint(bufferedImage.getGraphics()); From 06ac0b5589d6ff198b10c5ff411e1f09d64a18bd Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 30 Jul 2020 18:06:42 +0530 Subject: [PATCH 0321/1862] JAVA-1525: Moved 1 article to security module --- spring-5-reactive-security/README.md | 1 + .../cors/annotated/CorsOnAnnotatedElementsApplication.java | 0 .../cors/annotated/controllers/CorsOnClassController.java | 0 .../cors/annotated/controllers/CorsOnMethodsController.java | 0 .../reactive/cors/global/CorsGlobalConfigApplication.java | 0 .../reactive/cors/global/config/CorsGlobalConfiguration.java | 0 .../cors/global/controllers/FurtherCorsConfigsController.java | 0 .../cors/global/controllers/RegularRestController.java | 0 .../functional/handlers/CorsGlobalFunctionalHandler.java | 0 .../cors/global/functional/routers/CorsRouterFunctions.java | 0 .../reactive/cors/webfilter/CorsWebFilterApplication.java | 0 .../reactive/cors/webfilter/config/CorsWebFilterConfig.java | 0 .../webfilter/controllers/FurtherCorsConfigsController.java | 0 .../cors/webfilter/controllers/RegularRestController.java | 0 .../functional/handlers/CorsWithWebFilterHandler.java | 0 .../functional/routers/CorsWithWebFilterRouterFunctions.java | 0 .../reactive/cors/CorsOnAnnotatedElementsLiveTest.java | 4 +++- .../baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java | 4 +++- .../com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java | 4 +++- 19 files changed, 10 insertions(+), 3 deletions(-) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnClassController.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnMethodsController.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/global/config/CorsGlobalConfiguration.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/webfilter/config/CorsWebFilterConfig.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/FurtherCorsConfigsController.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/RegularRestController.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/webfilter/functional/handlers/CorsWithWebFilterHandler.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java (100%) rename {spring-5-reactive => spring-5-reactive-security}/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java (96%) rename {spring-5-reactive => spring-5-reactive-security}/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java (94%) rename {spring-5-reactive => spring-5-reactive-security}/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java (94%) diff --git a/spring-5-reactive-security/README.md b/spring-5-reactive-security/README.md index a0f47a503d..915f74cd78 100644 --- a/spring-5-reactive-security/README.md +++ b/spring-5-reactive-security/README.md @@ -12,3 +12,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Guide to Spring 5 WebFlux](https://www.baeldung.com/spring-webflux) - [Introduction to the Functional Web Framework in Spring 5](https://www.baeldung.com/spring-5-functional-web) - [Guide to the AuthenticationManagerResolver in Spring Security](https://www.baeldung.com/spring-security-authenticationmanagerresolver) +- [Spring Webflux and CORS](https://www.baeldung.com/spring-webflux-cors) diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/annotated/CorsOnAnnotatedElementsApplication.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnClassController.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnClassController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnClassController.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnClassController.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnMethodsController.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnMethodsController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnMethodsController.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/annotated/controllers/CorsOnMethodsController.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/CorsGlobalConfigApplication.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/config/CorsGlobalConfiguration.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/config/CorsGlobalConfiguration.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/config/CorsGlobalConfiguration.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/config/CorsGlobalConfiguration.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/controllers/FurtherCorsConfigsController.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/controllers/RegularRestController.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/functional/handlers/CorsGlobalFunctionalHandler.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/global/functional/routers/CorsRouterFunctions.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/CorsWebFilterApplication.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/config/CorsWebFilterConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/config/CorsWebFilterConfig.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/config/CorsWebFilterConfig.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/config/CorsWebFilterConfig.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/FurtherCorsConfigsController.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/FurtherCorsConfigsController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/FurtherCorsConfigsController.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/FurtherCorsConfigsController.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/RegularRestController.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/RegularRestController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/RegularRestController.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/controllers/RegularRestController.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/handlers/CorsWithWebFilterHandler.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/functional/handlers/CorsWithWebFilterHandler.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/handlers/CorsWithWebFilterHandler.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/functional/handlers/CorsWithWebFilterHandler.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java rename to spring-5-reactive-security/src/main/java/com/baeldung/reactive/cors/webfilter/functional/routers/CorsWithWebFilterRouterFunctions.java diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java similarity index 96% rename from spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java rename to spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java index e6847e63da..5fd20eedfd 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnAnnotatedElementsLiveTest.java @@ -6,7 +6,9 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +import com.baeldung.reactive.cors.annotated.CorsOnAnnotatedElementsApplication; + +@SpringBootTest(classes = CorsOnAnnotatedElementsApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class CorsOnAnnotatedElementsLiveTest { private static final String BASE_URL = "http://localhost:8081"; diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java similarity index 94% rename from spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java rename to spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java index 008f1a16f2..5c6582c127 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnGlobalConfigLiveTest.java @@ -6,7 +6,9 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +import com.baeldung.reactive.cors.global.CorsGlobalConfigApplication; + +@SpringBootTest(classes = CorsGlobalConfigApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class CorsOnGlobalConfigLiveTest { private static final String BASE_URL = "http://localhost:8082"; diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java similarity index 94% rename from spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java rename to spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java index f8a4f34e29..7cc44454ec 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/reactive/cors/CorsOnWebFilterLiveTest.java @@ -6,7 +6,9 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.test.web.reactive.server.WebTestClient.ResponseSpec; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +import com.baeldung.reactive.cors.webfilter.CorsWebFilterApplication; + +@SpringBootTest(classes = CorsWebFilterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class CorsOnWebFilterLiveTest { private static final String BASE_URL = "http://localhost:8083"; From 4dc2535bc5361493c305a1834b7c6ad90210ef3c Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 30 Jul 2020 18:07:49 +0530 Subject: [PATCH 0322/1862] JAVA-1525: Moved 1 article to reactive-2 module --- .../serversentevents/consumer/ConsumerSSEApplication.java | 0 .../consumer/controller/ClientController.java | 0 .../serversentevents/server/ServerSSEApplication.java | 0 .../serversentevents/server/controllers/ServerController.java | 0 .../reactive/serversentsevents/ServiceSentEventLiveTest.java | 4 +++- 5 files changed, 3 insertions(+), 1 deletion(-) rename {spring-5-reactive => spring-5-reactive-2}/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java (100%) rename {spring-5-reactive => spring-5-reactive-2}/src/main/java/com/baeldung/reactive/serversentevents/consumer/controller/ClientController.java (100%) rename {spring-5-reactive => spring-5-reactive-2}/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java (100%) rename {spring-5-reactive => spring-5-reactive-2}/src/main/java/com/baeldung/reactive/serversentevents/server/controllers/ServerController.java (100%) rename {spring-5-reactive => spring-5-reactive-2}/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java (92%) diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java b/spring-5-reactive-2/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java rename to spring-5-reactive-2/src/main/java/com/baeldung/reactive/serversentevents/consumer/ConsumerSSEApplication.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/controller/ClientController.java b/spring-5-reactive-2/src/main/java/com/baeldung/reactive/serversentevents/consumer/controller/ClientController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/consumer/controller/ClientController.java rename to spring-5-reactive-2/src/main/java/com/baeldung/reactive/serversentevents/consumer/controller/ClientController.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java b/spring-5-reactive-2/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java rename to spring-5-reactive-2/src/main/java/com/baeldung/reactive/serversentevents/server/ServerSSEApplication.java diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/controllers/ServerController.java b/spring-5-reactive-2/src/main/java/com/baeldung/reactive/serversentevents/server/controllers/ServerController.java similarity index 100% rename from spring-5-reactive/src/main/java/com/baeldung/reactive/serversentevents/server/controllers/ServerController.java rename to spring-5-reactive-2/src/main/java/com/baeldung/reactive/serversentevents/server/controllers/ServerController.java diff --git a/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java b/spring-5-reactive-2/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java similarity index 92% rename from spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java rename to spring-5-reactive-2/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java index 547cd99034..946a038763 100644 --- a/spring-5-reactive/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java +++ b/spring-5-reactive-2/src/test/java/com/baeldung/reactive/serversentsevents/ServiceSentEventLiveTest.java @@ -8,7 +8,9 @@ import org.springframework.http.MediaType; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.reactive.server.WebTestClient; -@SpringBootTest +import com.baeldung.reactive.serversentevents.server.ServerSSEApplication; + +@SpringBootTest(classes = ServerSSEApplication.class) @WithMockUser public class ServiceSentEventLiveTest { From efbd00fdde4246cd6ccf9b955f4cb59c511a6f37 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 30 Jul 2020 18:09:10 +0530 Subject: [PATCH 0323/1862] JAVA-1525: Moved 1 article to -client module to make space for 1 from reactive module --- spring-5-reactive-2/pom.xml | 5 +++++ spring-5-reactive-client/pom.xml | 4 ++++ .../java/com/baeldung/webclient/filter/WebClientFilters.java | 0 .../baeldung/webclient/filter/FilteredWebClientUnitTest.java | 0 4 files changed, 9 insertions(+) rename {spring-5-reactive-2 => spring-5-reactive-client}/src/main/java/com/baeldung/webclient/filter/WebClientFilters.java (100%) rename {spring-5-reactive-2 => spring-5-reactive-client}/src/test/java/com/baeldung/webclient/filter/FilteredWebClientUnitTest.java (100%) diff --git a/spring-5-reactive-2/pom.xml b/spring-5-reactive-2/pom.xml index fdeebd1dfd..4cb85d879e 100644 --- a/spring-5-reactive-2/pom.xml +++ b/spring-5-reactive-2/pom.xml @@ -53,6 +53,11 @@ reactor-test test + + org.springframework.security + spring-security-test + test + diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index 0b5efd1a47..7ae7ba6edd 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -33,6 +33,10 @@ org.springframework.boot spring-boot-starter-webflux + + org.springframework.boot + spring-boot-starter-security + org.projectreactor reactor-spring diff --git a/spring-5-reactive-2/src/main/java/com/baeldung/webclient/filter/WebClientFilters.java b/spring-5-reactive-client/src/main/java/com/baeldung/webclient/filter/WebClientFilters.java similarity index 100% rename from spring-5-reactive-2/src/main/java/com/baeldung/webclient/filter/WebClientFilters.java rename to spring-5-reactive-client/src/main/java/com/baeldung/webclient/filter/WebClientFilters.java diff --git a/spring-5-reactive-2/src/test/java/com/baeldung/webclient/filter/FilteredWebClientUnitTest.java b/spring-5-reactive-client/src/test/java/com/baeldung/webclient/filter/FilteredWebClientUnitTest.java similarity index 100% rename from spring-5-reactive-2/src/test/java/com/baeldung/webclient/filter/FilteredWebClientUnitTest.java rename to spring-5-reactive-client/src/test/java/com/baeldung/webclient/filter/FilteredWebClientUnitTest.java From a788fa2751dbfbbdd93eca96551e494726174806 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 30 Jul 2020 18:09:51 +0530 Subject: [PATCH 0324/1862] JAVA-1525: README updates --- spring-5-reactive-2/README.md | 2 +- spring-5-reactive-client/README.md | 1 + spring-5-reactive/README.md | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/spring-5-reactive-2/README.md b/spring-5-reactive-2/README.md index 061c15b148..54f7ad35b1 100644 --- a/spring-5-reactive-2/README.md +++ b/spring-5-reactive-2/README.md @@ -8,5 +8,5 @@ This module contains articles about reactive Spring 5 - [Testing Reactive Streams Using StepVerifier and TestPublisher](https://www.baeldung.com/reactive-streams-step-verifier-test-publisher) - [Debugging Reactive Streams in Spring 5](https://www.baeldung.com/spring-debugging-reactive-streams) - [Static Content in Spring WebFlux](https://www.baeldung.com/spring-webflux-static-content) -- [Spring WebClient Filters](https://www.baeldung.com/spring-webclient-filters) +- [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events) - More articles: [[<-- prev]](/spring-5-reactive) diff --git a/spring-5-reactive-client/README.md b/spring-5-reactive-client/README.md index bb308ae330..eebdc23aed 100644 --- a/spring-5-reactive-client/README.md +++ b/spring-5-reactive-client/README.md @@ -10,3 +10,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Simultaneous Spring WebClient Calls](https://www.baeldung.com/spring-webclient-simultaneous-calls) - [Logging Spring WebClient Calls](https://www.baeldung.com/spring-log-webclient-calls) - [Mocking a WebClient in Spring](https://www.baeldung.com/spring-mocking-webclient) +- [Spring WebClient Filters](https://www.baeldung.com/spring-webclient-filters) diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md index 41d831632a..1945b7ea33 100644 --- a/spring-5-reactive/README.md +++ b/spring-5-reactive/README.md @@ -7,14 +7,11 @@ The "REST With Spring" Classes: https://bit.ly/restwithspring ### Relevant Articles -- [Introduction to the Functional Web Framework in Spring 5](https://www.baeldung.com/spring-5-functional-web) - [Spring 5 WebClient](https://www.baeldung.com/spring-5-webclient) - [Exploring the Spring 5 WebFlux URL Matching](https://www.baeldung.com/spring-5-mvc-url-matching) - [Reactive WebSockets with Spring 5](https://www.baeldung.com/spring-5-reactive-websockets) - [Spring Webflux Filters](https://www.baeldung.com/spring-webflux-filters) - [How to Set a Header on a Response with Spring 5](https://www.baeldung.com/spring-response-header) -- [Spring Webflux and CORS](https://www.baeldung.com/spring-webflux-cors) - [Handling Errors in Spring WebFlux](https://www.baeldung.com/spring-webflux-errors) -- [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events) - [A Guide to Spring Session Reactive Support: WebSession](https://www.baeldung.com/spring-session-reactive) - More articles: [[next -->]](/spring-5-reactive-2) From 1deeca3b47f97b31fc8cd0417175d840b9b9537c Mon Sep 17 00:00:00 2001 From: joe zhang Date: Thu, 30 Jul 2020 21:00:51 +0800 Subject: [PATCH 0325/1862] determine if an Object is of primitive type --- .../java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java index 7d3c2964d4..ff532520c2 100644 --- a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java +++ b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java @@ -11,7 +11,7 @@ public class PrimitiveTypeUtilTest { private PrimitiveTypeUtil primitiveTypeUtil; private boolean booleanVal = false; private Long longWrapper = 1L; - private String nonPrimitiveVal = "Test"; + private String nonPrimitiveVal = "non primitive string"; @Before public void setup() { From f29c757e18aff1a9da058768857bcfd3f24bf0ef Mon Sep 17 00:00:00 2001 From: joe zhang Date: Thu, 30 Jul 2020 21:09:33 +0800 Subject: [PATCH 0326/1862] determine if an Object is of primitive type --- .../java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java index ff532520c2..411bc422e5 100644 --- a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java +++ b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java @@ -26,7 +26,7 @@ public class PrimitiveTypeUtilTest { } @Test - public void givenObjectWhenCheckWithCommansLangShouldValidate() { + public void givenObjectWhenCheckWithCommonsLangShouldValidate() { assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommansLang(booleanVal)); assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommansLang(longWrapper)); assertFalse(primitiveTypeUtil.isPrimitiveTypeByCommansLang(nonPrimitiveVal)); From 6e43adc10748a9dcaf05acbe11ec0f6ca6961506 Mon Sep 17 00:00:00 2001 From: joe zhang Date: Thu, 30 Jul 2020 21:15:06 +0800 Subject: [PATCH 0327/1862] determine if an Object is of primitive type --- .../java/com/baeldung/primitivetype/PrimitiveTypeUtil.java | 2 +- .../com/baeldung/primitivetype/PrimitiveTypeUtilTest.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java index c749ed9dcd..1b2083b548 100644 --- a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java +++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java @@ -23,7 +23,7 @@ public class PrimitiveTypeUtil { WRAPPER_TYPE_MAP.put(Void.class, void.class); } - public boolean isPrimitiveTypeByCommansLang(Object source) { + public boolean isPrimitiveTypeByCommonsLang(Object source) { return ClassUtils.isPrimitiveOrWrapper(source.getClass()); } diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java index 411bc422e5..79b58967dd 100644 --- a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java +++ b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java @@ -27,9 +27,9 @@ public class PrimitiveTypeUtilTest { @Test public void givenObjectWhenCheckWithCommonsLangShouldValidate() { - assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommansLang(booleanVal)); - assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommansLang(longWrapper)); - assertFalse(primitiveTypeUtil.isPrimitiveTypeByCommansLang(nonPrimitiveVal)); + assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(booleanVal)); + assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(longWrapper)); + assertFalse(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(nonPrimitiveVal)); } @Test From ae479954f48ae784e1c7e66a19b03e60cd0b31b7 Mon Sep 17 00:00:00 2001 From: joe zhang Date: Fri, 31 Jul 2020 00:33:26 +0800 Subject: [PATCH 0328/1862] refactor unit test name --- ...rimitiveTypeUtilTest.java => PrimitiveTypeUtilUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/{PrimitiveTypeUtilTest.java => PrimitiveTypeUtilUnitTest.java} (97%) diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilUnitTest.java similarity index 97% rename from core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java rename to core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilUnitTest.java index 79b58967dd..5cd1b9f9d7 100644 --- a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilTest.java +++ b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilUnitTest.java @@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; -public class PrimitiveTypeUtilTest { +public class PrimitiveTypeUtilUnitTest { private PrimitiveTypeUtil primitiveTypeUtil; private boolean booleanVal = false; From 79b9df98a2c588bc1270ca788bb48f0d802bafc6 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Thu, 30 Jul 2020 21:52:53 +0430 Subject: [PATCH 0329/1862] boolean[] vs. BitSet: Which is more efficient? --- jmh/pom.xml | 32 ++ .../java/com/baeldung/bitset/Plotter.java | 36 ++ .../main/java/com/baeldung/bitset/Sizing.java | 17 + .../bitset/VectorOfBitsBenchmark.java | 75 +++ jmh/src/main/resources/bitset/cardinal.csv | 449 ++++++++++++++++++ jmh/src/main/resources/bitset/get.csv | 449 ++++++++++++++++++ jmh/src/main/resources/bitset/set.csv | 449 ++++++++++++++++++ 7 files changed, 1507 insertions(+) create mode 100644 jmh/src/main/java/com/baeldung/bitset/Plotter.java create mode 100644 jmh/src/main/java/com/baeldung/bitset/Sizing.java create mode 100644 jmh/src/main/java/com/baeldung/bitset/VectorOfBitsBenchmark.java create mode 100644 jmh/src/main/resources/bitset/cardinal.csv create mode 100644 jmh/src/main/resources/bitset/get.csv create mode 100644 jmh/src/main/resources/bitset/set.csv diff --git a/jmh/pom.xml b/jmh/pom.xml index 735198036e..16a5bc54a4 100644 --- a/jmh/pom.xml +++ b/jmh/pom.xml @@ -26,6 +26,11 @@ jmh-generator-annprocess ${openjdk.jmh.version} + + org.openjdk.jol + jol-core + ${jol-core.version} + @@ -42,12 +47,39 @@ + + + org.apache.maven.plugins + maven-assembly-plugin + ${maven-assembly-plugin.version} + + + jar-with-dependencies + + + + com.baeldung.BenchmarkRunner + + + + + + make-assembly + package + + single + + + + 1.19 3.0.2 + 0.10 + 3.2.0 \ No newline at end of file diff --git a/jmh/src/main/java/com/baeldung/bitset/Plotter.java b/jmh/src/main/java/com/baeldung/bitset/Plotter.java new file mode 100644 index 0000000000..beb136f515 --- /dev/null +++ b/jmh/src/main/java/com/baeldung/bitset/Plotter.java @@ -0,0 +1,36 @@ +package com.baeldung.bitset; + +import org.openjdk.jol.info.ClassLayout; +import org.openjdk.jol.info.GraphLayout; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.util.BitSet; + +public class Plotter { + + public static void main(String[] args) throws IOException { + Path path = Paths.get("footprint.csv"); + try (BufferedWriter stream = Files.newBufferedWriter(path, StandardOpenOption.CREATE)) { + stream.write("bits,bool,bitset\n"); + + for (int i = 0; i <= 10_000_000; i += 500) { + System.out.println("Number of bits => " + i); + + boolean[] ba = new boolean[i]; + BitSet bitSet = new BitSet(i); + + long baSize = ClassLayout.parseInstance(ba).instanceSize(); + long bitSetSize = GraphLayout.parseInstance(bitSet).totalSize(); + + stream.write((i + "," + baSize + "," + bitSetSize + "\n")); + + if (i % 10_000 == 0) stream.flush(); + } + } + } +} diff --git a/jmh/src/main/java/com/baeldung/bitset/Sizing.java b/jmh/src/main/java/com/baeldung/bitset/Sizing.java new file mode 100644 index 0000000000..58c9061c07 --- /dev/null +++ b/jmh/src/main/java/com/baeldung/bitset/Sizing.java @@ -0,0 +1,17 @@ +package com.baeldung.bitset; + +import org.openjdk.jol.info.ClassLayout; +import org.openjdk.jol.info.GraphLayout; + +import java.util.BitSet; + +public class Sizing { + + public static void main(String[] args) { + boolean[] ba = new boolean[10_000]; + System.out.println(ClassLayout.parseInstance(ba).toPrintable()); + + BitSet bitSet = new BitSet(10_000); + System.out.println(GraphLayout.parseInstance(bitSet).toPrintable()); + } +} diff --git a/jmh/src/main/java/com/baeldung/bitset/VectorOfBitsBenchmark.java b/jmh/src/main/java/com/baeldung/bitset/VectorOfBitsBenchmark.java new file mode 100644 index 0000000000..8949d4e117 --- /dev/null +++ b/jmh/src/main/java/com/baeldung/bitset/VectorOfBitsBenchmark.java @@ -0,0 +1,75 @@ +package com.baeldung.bitset; + +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; + +import java.util.BitSet; +import java.util.concurrent.ThreadLocalRandom; + +@State(Scope.Benchmark) +@BenchmarkMode(Mode.Throughput) +public class VectorOfBitsBenchmark { + + private boolean[] array; + private BitSet bitSet; + + @Param({"100", "1000", "5000", "50000", "100000", "1000000", "2000000", "3000000", + "5000000", "7000000", "10000000", "20000000", "30000000", "50000000", "70000000", "1000000000"}) + public int size; + + @Setup(Level.Trial) + public void setUp() { + array = new boolean[size]; + for (int i = 0; i < array.length; i++) { + array[i] = ThreadLocalRandom.current().nextBoolean(); + } + + bitSet = new BitSet(size); + for (int i = 0; i < size; i++) { + bitSet.set(i, ThreadLocalRandom.current().nextBoolean()); + } + } + + @Benchmark + public boolean getBoolArray() { + return array[ThreadLocalRandom.current().nextInt(size)]; + } + + @Benchmark + public boolean getBitSet() { + return bitSet.get(ThreadLocalRandom.current().nextInt(size)); + } + + @Benchmark + public void setBoolArray() { + int index = ThreadLocalRandom.current().nextInt(size); + array[index] = true; + } + + @Benchmark + public void setBitSet() { + int index = ThreadLocalRandom.current().nextInt(size); + bitSet.set(index); + } + + @Benchmark + public int cardinalityBoolArray() { + int sum = 0; + for (boolean b : array) { + if (b) sum++; + } + + return sum; + } + + @Benchmark + public int cardinalityBitSet() { + return bitSet.cardinality(); + } +} diff --git a/jmh/src/main/resources/bitset/cardinal.csv b/jmh/src/main/resources/bitset/cardinal.csv new file mode 100644 index 0000000000..1e6f0731f4 --- /dev/null +++ b/jmh/src/main/resources/bitset/cardinal.csv @@ -0,0 +1,449 @@ +"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: size" +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,393747573.686833,8176258.509541,"ops/s",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,0.001142,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,16.019285,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,3.525011,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,0.001011,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,0.000227,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,9.978252,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.000084,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,16.085984,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.000016,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,3.515332,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.000104,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.000187,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,51.807801,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,200028477.639536,1655942.004821,"ops/s",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,0.002157,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,30.037472,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,4.035148,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,0.002133,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,0.000533,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,14.964408,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.000209,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,30.189211,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.000035,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,4.026334,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.000222,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.000400,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,99.619362,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,63020698.220022,301117.329336,"ops/s",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,0.006739,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,92.968547,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,4.051628,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,0.005924,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,0.002165,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,29.892853,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.000582,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,93.493939,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.000109,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,4.051385,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.000724,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.001279,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,285.417873,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,7204008.548800,26777.006550,"ops/s",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,0.085737,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,796.749450,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,4.282982,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,0.055282,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,1.012529,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,110.884225,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.004487,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,801.165820,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.000784,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,4.226255,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.006024,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.010046,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,2006.941407,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,3629991.817907,11097.373770,"ops/s",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,0.243416,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,1577.873015,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,4.557042,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,0.106117,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,1.025199,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,205.866839,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.011796,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,1584.735453,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.002335,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,4.653284,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.012223,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.020736,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,3947.152509,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,363285.637971,1381.431204,"ops/s",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,1712.185003,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,15660.070795,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,9.441652,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,1.200677,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,1.744812,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,1963.525342,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.452116,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,15734.050011,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.023238,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,9.519313,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.190122,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.208191,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,38999.133661,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,180844.028528,610.040837,"ops/s",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,3664.111553,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,31271.600037,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,14.435729,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,2.610217,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,1.649819,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,3910.476252,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.217432,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,31408.622718,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.040256,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,14.601374,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.260903,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.422715,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,77788.657874,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,118548.730143,468.823226,"ops/s",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,5639.799222,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,47006.741115,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,19.832762,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,4.059959,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,2.278006,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,5874.367510,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.324499,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,47272.836745,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.064460,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,22.600079,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.467719,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.642886,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,116927.646081,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,70086.673236,563.669183,"ops/s",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,9560.498477,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,78198.576932,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,34.810483,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,6.905933,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,2.660745,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,9767.014432,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,0.616113,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,78630.286046,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.101142,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,31.958140,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,0.716475,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,0.975224,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,194453.814959,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,50185.268564,354.561055,"ops/s",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,13480.043453,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,109488.725728,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,45.881465,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,9.602892,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,2.750373,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,13686.896942,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,1.079668,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,110066.269505,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.186638,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,50.867881,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,1.087789,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,1.401113,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,272641.291312,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,34908.512595,116.418990,"ops/s",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,19358.228821,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,156380.208163,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,52.083219,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,13.328039,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,14.661694,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,19522.637780,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,2.203013,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,156928.984801,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,0.273531,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,67.026094,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,1.900268,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,1.929660,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,388765.349238,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,17317.558001,100.005388,"ops/s",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,38984.617172,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,312761.798113,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,110.924669,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,27.027104,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,11.114591,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,39043.188700,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,16.408157,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,314387.564881,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,1.315988,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,121.913794,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,7.243860,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,2.181325,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,778038.560011,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,11501.959917,57.124269,"ops/s",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,58960.217967,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,469304.081395,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,184.289676,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,48.075359,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,9.470284,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,58590.395636,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,110.391626,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,471624.463912,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,5.747181,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,162.875573,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,13.870816,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,1.683658,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,1168184.932237,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,6853.662641,34.907898,"ops/s",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,98396.707621,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,782412.601151,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,276.504336,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,62.269039,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,14.744583,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,97655.835705,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,463.063389,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,785788.480539,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,9.752381,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,309.916361,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,23.524244,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,3.349640,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,1946858.485637,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,4879.613096,31.364409,"ops/s",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,137967.751689,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,1096110.204019,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,460.349614,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,100.554744,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,21.779339,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,136829.273899,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,651.277926,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,1102431.584828,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,11.249848,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,520.978240,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,32.792037,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,3.967967,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,2727814.788476,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet","thrpt",4,40,224.865509,9.210752,"ops/s",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-load-misses","thrpt",4,2,1190415.055459,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-loads","thrpt",4,2,15632200.467402,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-dcache-stores","thrpt",4,2,19441.575768,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:L1-icache-load-misses","thrpt",4,2,2047.756107,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branch-misses","thrpt",4,2,485.442180,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:branches","thrpt",4,2,1965043.175621,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-load-misses","thrpt",4,2,31032.470870,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-loads","thrpt",4,2,15667116.799869,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-store-misses","thrpt",4,2,143.428283,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:dTLB-stores","thrpt",4,2,11595.673237,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-load-misses","thrpt",4,2,742.352246,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:iTLB-loads","thrpt",4,2,98.480752,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBitSet:instructions","thrpt",4,2,39048358.021105,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,37049279.373531,704963.020277,"ops/s",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,0.011099,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,112.064045,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,4.073352,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,0.009620,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,0.002608,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,29.947392,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,0.001015,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,112.623597,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,0.000228,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,4.075249,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,0.001286,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,0.002188,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,622.445960,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,4096591.017375,15272.062456,"ops/s",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,0.131963,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,1012.474032,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,4.586741,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,0.104217,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,1.022211,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,139.987103,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,0.008928,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,1017.535338,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,0.001594,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,4.600783,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,0.010615,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,0.018421,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,5536.843608,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,832334.798376,3074.911358,"ops/s",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,0.766809,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,5030.987321,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,7.002736,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,0.498173,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,1.086794,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,641.641634,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,0.047561,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,5051.582231,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,0.008993,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,6.752675,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,0.050431,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,0.092294,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,27529.642459,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,83377.631077,255.122714,"ops/s",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,539.461053,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,50020.851413,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,29.937221,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,5.092867,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,4.842983,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,6261.566122,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,0.422246,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,50255.455914,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,0.078430,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,24.798375,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,0.559565,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,0.902338,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,273680.241982,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,41408.544806,165.347056,"ops/s",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,1322.755020,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,99955.008469,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,55.552771,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,10.390631,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,5.861952,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,12500.640365,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,0.769535,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,100406.515812,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,0.150189,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,44.164416,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,1.117459,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,1.825801,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,546990.292774,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,4129.742795,17.898464,"ops/s",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,15349.951857,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,1002365.863265,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,499.940618,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,122.631357,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,28.242979,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,125323.009142,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,13.650726,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,1007023.362826,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,1.912985,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,505.608704,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,14.288697,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,17.956474,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,5484912.917616,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,2077.577519,7.337211,"ops/s",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,31292.588903,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,2001841.397596,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,966.586187,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,238.822058,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,46.510032,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,250019.595282,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,68.527514,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,2009528.999936,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,7.098600,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,950.622751,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,53.292000,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,24.529932,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,10953197.041140,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,1382.303027,4.169656,"ops/s",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,47056.390407,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,3000801.315529,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,1470.047881,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,357.378786,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,60.820713,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,374783.769835,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,252.896052,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,3015767.599869,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,21.872987,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,1524.876162,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,112.567929,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,23.688984,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,16425272.638241,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,829.757845,2.907395,"ops/s",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,79794.283301,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,4999110.374252,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,2878.569713,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,600.944033,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,117.854523,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,624380.185108,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,625.032361,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,5023239.665880,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,32.290537,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,1952.720560,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,194.797679,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,26.471072,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,27353169.238296,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,593.611980,2.520324,"ops/s",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,111485.949371,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,7025474.793043,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,3672.457662,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,817.906535,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,116.322549,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,877217.619856,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,957.823851,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,7057039.698064,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,50.812805,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,3850.388980,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,280.996635,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,55.292762,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,38432075.289421,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,414.148792,1.531335,"ops/s",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,158517.772914,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,10012879.292064,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,5067.772968,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,1159.247229,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,219.525384,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,1250534.640040,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,1355.116322,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,10051566.656711,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,68.965296,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,5208.287470,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,369.777199,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,56.291391,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,54776223.581884,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,207.806128,0.628873,"ops/s",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,304113.485355,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,20023501.895517,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,9779.441786,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,2487.972260,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,400.329711,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,2501297.068694,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,2937.078221,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,20089328.718289,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,131.879427,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,10912.262719,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,707.654814,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,108.177862,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,109579830.457931,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,138.119711,0.500755,"ops/s",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,443956.723054,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,30008750.271844,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,14759.175750,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,3431.902326,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,569.840892,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,3747872.534933,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,4806.051229,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,30144733.769549,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,201.619836,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,17338.732113,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,1098.261594,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,195.410627,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,164166517.089861,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,82.709149,0.295436,"ops/s",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,747996.211010,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,50109102.392841,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,37525.937305,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,6197.904618,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,1079.041011,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,6265857.125983,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,7401.558857,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,50190387.111098,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,343.424195,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,30593.259958,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,1746.881433,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,263.036555,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,274256325.159847,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,59.202337,0.381593,"ops/s",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,1049088.662627,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,70094037.559522,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,70850.762444,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,8257.515781,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,1934.286962,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,8780399.271839,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,10142.237142,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,70255089.174523,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,568.459880,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,60618.442280,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,2578.542787,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,369.873390,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,383542921.407972,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray","thrpt",4,40,4.164406,0.021372,"ops/s",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-load-misses","thrpt",4,2,14724055.231818,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-loads","thrpt",4,2,1002251097.850000,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-dcache-stores","thrpt",4,2,1304484.515909,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:L1-icache-load-misses","thrpt",4,2,94383.129545,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branch-misses","thrpt",4,2,29678.675000,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:branches","thrpt",4,2,126027016.040909,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-load-misses","thrpt",4,2,149098.588636,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-loads","thrpt",4,2,1005716183.827273,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-store-misses","thrpt",4,2,9554.579545,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:dTLB-stores","thrpt",4,2,1637043.229545,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-load-misses","thrpt",4,2,36110.963636,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:iTLB-loads","thrpt",4,2,5566.793182,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.cardinalityBoolArray:instructions","thrpt",4,2,5481003131.631819,NaN,"#/op",1000000000 diff --git a/jmh/src/main/resources/bitset/get.csv b/jmh/src/main/resources/bitset/get.csv new file mode 100644 index 0000000000..2d929d927d --- /dev/null +++ b/jmh/src/main/resources/bitset/get.csv @@ -0,0 +1,449 @@ +"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: size" +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,184790139.562014,2667066.521846,"ops/s",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.002467,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.050243,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.042285,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.002206,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.000451,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.985709,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000194,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.132320,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000034,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.035930,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000246,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000417,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.781944,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,189890949.805559,659556.001166,"ops/s",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.002317,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.036584,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.044334,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.002032,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.000437,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.964305,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000185,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.148063,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000034,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.029343,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000246,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000403,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.597453,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,189507179.833915,629754.953530,"ops/s",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.002466,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.010134,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.029958,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.002275,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.000384,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.962285,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000216,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.086110,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000033,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.018705,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000208,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000400,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.611799,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,185398269.303855,1908706.853646,"ops/s",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.003713,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.039282,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.044589,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.002108,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.000501,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.976543,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000183,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.144876,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000032,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.036796,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000226,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000391,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.713651,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,187470455.311201,2138324.325624,"ops/s",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.005740,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.045473,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.049532,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.002233,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.000559,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.975216,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000182,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.153817,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000042,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.032749,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000279,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000413,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.694265,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,187899335.193431,1227338.646447,"ops/s",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.757697,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.019129,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.035645,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.002595,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.000815,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.962763,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000243,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.079796,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000043,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.018714,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000220,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000400,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.618577,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,181042070.478268,1034313.105183,"ops/s",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.882631,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.055692,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.046466,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.002913,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.001525,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.993797,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000303,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.145567,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000040,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.036471,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000231,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000414,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.837563,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,157845998.770241,1327029.686173,"ops/s",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.923265,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.039213,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.037515,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.003060,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.002237,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.989144,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000377,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.101674,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000044,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.029822,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000275,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000463,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.821119,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,140194241.226829,586052.963759,"ops/s",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.958165,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.065759,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.052019,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.003590,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.002185,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.995694,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000446,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.147433,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000054,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.039960,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000352,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000494,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.850007,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,134363547.905898,817872.600380,"ops/s",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.973091,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.083157,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.060888,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.003270,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.003700,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,13.012286,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.000645,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.162932,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000064,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.039776,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000402,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000526,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.956471,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,129938742.625757,565110.729002,"ops/s",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,0.982322,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.053334,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.051753,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.003960,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.004344,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,12.996532,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.001074,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.146765,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000087,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.040650,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000515,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000530,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.866671,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,125187585.586497,523512.098380,"ops/s",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,1.004652,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.080247,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.054714,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.003770,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.004486,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,13.010171,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.010580,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.154110,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000215,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.041480,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.000953,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000317,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.947671,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,115627724.299332,638665.572272,"ops/s",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,1.227419,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.079678,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.058129,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.004521,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.009050,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,13.012617,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,0.347392,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.142634,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000659,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.040588,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.001420,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000171,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,90.988720,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,103507035.990670,372081.425396,"ops/s",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,1.490488,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.059971,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.061928,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.004491,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.023517,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,13.022696,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,1.014237,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.140833,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000542,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.047774,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.001546,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000198,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,91.179548,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,100061443.949078,900762.613103,"ops/s",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,1.636879,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.089365,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.066827,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.004394,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.023939,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,13.054928,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,1.300501,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.169242,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.000755,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.059205,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.001714,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000271,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,91.429385,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet","thrpt",4,40,30732326.196764,1902855.641551,"ops/s",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-load-misses","thrpt",4,2,2.010809,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-loads","thrpt",4,2,19.363151,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-dcache-stores","thrpt",4,2,6.239644,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:L1-icache-load-misses","thrpt",4,2,0.014491,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branch-misses","thrpt",4,2,0.079687,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:branches","thrpt",4,2,13.302302,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-load-misses","thrpt",4,2,2.698668,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-loads","thrpt",4,2,19.522360,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-store-misses","thrpt",4,2,0.001826,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:dTLB-stores","thrpt",4,2,6.235821,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-load-misses","thrpt",4,2,0.004974,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:iTLB-loads","thrpt",4,2,0.000684,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBitSet:instructions","thrpt",4,2,93.483709,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,227276865.931318,1065421.113528,"ops/s",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,0.001953,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.036393,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.041004,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.001677,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.000390,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,10.983478,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.000158,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.114167,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000029,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.030073,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.000194,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000334,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.747475,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,227967057.968084,1094391.643063,"ops/s",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,0.002196,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.038155,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.046080,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.001821,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.000377,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,10.983017,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.000151,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.121232,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000027,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.026809,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.000171,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000319,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.269538,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,227488094.016039,1165579.055001,"ops/s",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,0.002484,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.046268,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.048022,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.001649,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.000417,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,10.993480,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.000191,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.116395,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000037,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.030824,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.000201,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000356,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.847281,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,220590635.826749,3222316.343407,"ops/s",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,0.386152,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.014363,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.030620,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.001837,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.000445,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,10.970352,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.000175,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.071899,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000033,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.015771,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.000197,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000347,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.159399,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,221812217.619440,1882356.038621,"ops/s",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,0.694581,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.036224,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.045287,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.002024,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.000413,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,10.985217,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.000159,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.113544,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000035,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.028587,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.000209,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000352,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.781018,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,155300972.624227,1052925.157790,"ops/s",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,0.974041,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.024109,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.040972,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.002724,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.000890,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,10.983857,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.000635,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.114472,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000067,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.029008,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.000370,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000485,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.276632,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,150139628.673692,671406.901317,"ops/s",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,0.991759,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.029834,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.039387,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.002965,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.001613,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,10.986406,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.002364,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.083273,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000157,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.020146,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.000647,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000345,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.274963,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,146544479.291686,722153.242446,"ops/s",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,1.019540,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.022684,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.043253,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.003449,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.002115,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,10.981744,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.025108,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.105318,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000364,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.024680,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.001022,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000151,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.769956,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,131610185.610556,544416.522700,"ops/s",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,1.450890,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.061835,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.056745,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.003605,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.002344,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,11.003703,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,0.764601,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.121742,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000585,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.033532,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.001213,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000137,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.911556,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,125543684.587399,707062.210707,"ops/s",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,1.681832,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.067818,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.051900,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.003963,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.003560,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,11.013663,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,1.126490,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.114877,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000538,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.039862,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.001300,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000148,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.996294,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,120883159.006800,459519.176985,"ops/s",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,1.941920,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.066701,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.057961,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.004200,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.004289,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,11.012477,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,1.402314,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.140748,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000749,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.049852,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.001377,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000179,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,74.017988,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,108406186.294073,582406.851629,"ops/s",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,2.395980,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.064172,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.058329,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.004261,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.004518,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,11.010508,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,1.726519,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.136526,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.000984,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.045655,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.001481,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000179,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.482638,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,87529931.443741,1955927.694142,"ops/s",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,2.594962,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.073273,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.063886,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.005067,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.009322,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,11.027283,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,1.845592,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.149139,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.001220,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.059616,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.001915,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000267,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,74.146192,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,52236198.372609,491642.796386,"ops/s",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,2.846910,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.152230,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.113607,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.009109,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.024525,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,11.088285,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,2.268730,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.251743,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.001259,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.092143,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.003064,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000363,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,73.596518,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,44791183.851884,214906.900295,"ops/s",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,2.967552,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.120575,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.109277,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.009707,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.024510,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,11.064747,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,2.499734,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.227798,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.001357,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.088992,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.003500,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000441,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,74.451386,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray","thrpt",4,40,37389103.890299,90477.383580,"ops/s",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-load-misses","thrpt",4,2,2.804161,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-loads","thrpt",4,2,18.310702,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-dcache-stores","thrpt",4,2,7.181002,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:L1-icache-load-misses","thrpt",4,2,0.011265,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branch-misses","thrpt",4,2,0.078800,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:branches","thrpt",4,2,11.274916,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-load-misses","thrpt",4,2,3.060411,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-loads","thrpt",4,2,18.390751,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-store-misses","thrpt",4,2,0.001505,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:dTLB-stores","thrpt",4,2,7.194463,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-load-misses","thrpt",4,2,0.004221,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:iTLB-loads","thrpt",4,2,0.000530,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.getBoolArray:instructions","thrpt",4,2,75.278465,NaN,"#/op",1000000000 diff --git a/jmh/src/main/resources/bitset/set.csv b/jmh/src/main/resources/bitset/set.csv new file mode 100644 index 0000000000..18b73bf989 --- /dev/null +++ b/jmh/src/main/resources/bitset/set.csv @@ -0,0 +1,449 @@ +"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: size" +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,51896464.026542,75862.136758,"ops/s",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,0.455765,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,12.076844,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.058151,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.007209,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.001604,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,9.997170,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000671,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,12.155867,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000133,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.044563,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000883,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.001497,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,63.823169,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,70106741.257282,5675561.652157,"ops/s",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,0.701408,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,13.051907,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.038773,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.005106,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.001640,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,9.981827,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000487,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,13.108384,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000085,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.035609,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000635,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.001048,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,66.690961,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,95463073.139209,1113608.612106,"ops/s",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.081256,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,13.019534,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.030687,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003994,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.000999,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.961847,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000316,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,13.096411,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000053,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.025559,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000408,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000741,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,67.633459,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,118050031.787664,869821.142403,"ops/s",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.354826,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,11.035931,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.028466,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003085,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.000714,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.968244,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000300,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,11.094508,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000058,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.027209,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000403,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000643,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,66.685716,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,126298073.981831,369299.481879,"ops/s",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.310261,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,13.051825,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.033383,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003348,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.000801,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,9.997344,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000286,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,13.113142,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000045,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.022306,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000356,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000579,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,65.864528,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,130991668.121281,644042.215866,"ops/s",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.331196,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,12.047450,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.028621,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003152,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.001000,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.485817,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000319,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,12.101103,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000064,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.024312,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000369,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000587,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,66.301371,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,128165315.820896,496869.372046,"ops/s",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.377167,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,13.042081,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.031912,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003844,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.001726,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,9.984710,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000382,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,13.099182,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000066,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.020885,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000347,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000563,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,65.795765,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,125195342.161850,1957938.686648,"ops/s",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.384964,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,12.054831,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.031343,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003650,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.002185,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.499255,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000428,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,12.112498,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000084,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.027300,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000379,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000600,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,66.403520,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,133354250.565847,1255106.085613,"ops/s",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.320524,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,12.048234,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.028165,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003275,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.002304,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.488182,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000489,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,12.094041,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000097,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.023713,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000585,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000521,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,66.335488,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,137232624.452804,636350.199734,"ops/s",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.246943,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,13.025392,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.028421,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003476,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.003316,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,9.976549,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000551,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,13.085655,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000081,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.022321,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000476,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000522,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,65.766839,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,143989207.138248,756270.794340,"ops/s",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.182833,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,12.044035,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.027349,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003071,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.004236,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.491392,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.000717,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,12.088728,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.000137,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.026174,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000380,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000468,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,66.391401,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,151241501.714891,916836.288585,"ops/s",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.107189,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,12.041025,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.031621,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.002955,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.004243,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.497239,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.009641,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,12.098803,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.001624,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.024783,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.000804,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000269,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,66.415849,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,144263237.497241,732977.702789,"ops/s",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.295403,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,12.050585,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.033163,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003160,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.008815,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.508266,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.278706,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,12.108627,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.071757,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.030249,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.001102,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000163,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,66.538307,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,135443772.106893,604312.063062,"ops/s",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.597651,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,12.088824,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.049898,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003236,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.023795,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.565162,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,0.822377,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,12.127978,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.217013,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.047233,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.001227,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000186,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,67.051735,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,131423130.250911,685419.143744,"ops/s",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,1.830028,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,11.075647,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.048544,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.003294,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.023619,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,11.044497,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,1.021551,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,11.121959,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.318409,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.047471,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.001220,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000154,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,67.422027,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet","thrpt",4,40,50126275.321495,128366.907520,"ops/s",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-load-misses","thrpt",4,2,2.007914,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-loads","thrpt",4,2,13.283731,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-dcache-stores","thrpt",4,2,2.158816,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:L1-icache-load-misses","thrpt",4,2,0.009154,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branch-misses","thrpt",4,2,0.077561,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:branches","thrpt",4,2,10.255507,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-load-misses","thrpt",4,2,2.580432,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-loads","thrpt",4,2,13.332989,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-store-misses","thrpt",4,2,0.240555,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:dTLB-stores","thrpt",4,2,2.141680,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-load-misses","thrpt",4,2,0.003075,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:iTLB-loads","thrpt",4,2,0.000400,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBitSet:instructions","thrpt",4,2,68.183448,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,103190024.246958,1465075.410304,"ops/s",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,0.387288,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.061946,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.041483,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003577,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.001007,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.999897,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.000288,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.121073,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.000058,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.034064,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.000424,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000703,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.880071,NaN,"#/op",100 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,139443098.218536,1499104.709607,"ops/s",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,0.646658,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.016290,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.026692,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.002577,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.000566,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.966181,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.000281,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.090556,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.000053,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.025779,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.000324,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000544,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.677854,NaN,"#/op",1000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,141884743.566510,786570.828615,"ops/s",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,0.721487,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.046555,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.030607,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.002780,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.000635,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.999213,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.000238,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.100109,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.000048,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.027592,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.000322,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000530,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.883150,NaN,"#/op",5000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,141434121.940795,678907.202147,"ops/s",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,0.737588,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.009752,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.025647,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.002709,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.000564,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.966167,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.000248,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.084263,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.000061,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.022513,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.000310,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000559,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.676130,NaN,"#/op",50000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,141443758.907874,627442.604356,"ops/s",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,0.778842,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.031381,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.028014,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003220,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.000652,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.979226,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.000287,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.089836,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.000071,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.023236,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.000286,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000507,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.734083,NaN,"#/op",100000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,147240354.620049,715098.421473,"ops/s",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,0.974563,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.031177,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.024039,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003099,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.000948,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.989072,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.000372,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.069719,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.000330,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.020618,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.000355,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000477,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.839884,NaN,"#/op",1000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,153622403.885271,1327782.331450,"ops/s",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,0.991925,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.032598,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.024720,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003245,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.001456,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.991914,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.000825,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.079811,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.001852,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.024947,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.000643,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000377,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.870424,NaN,"#/op",2000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,156527596.524201,795077.911203,"ops/s",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,1.014728,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.027806,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.024255,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003058,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.001984,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.990123,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.002815,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.076875,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.018651,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.022515,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.000962,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000127,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.871439,NaN,"#/op",3000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,158079426.644001,913191.923219,"ops/s",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,1.472277,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.052808,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.029994,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003121,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.002145,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,8.011432,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.004486,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.093163,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,0.766815,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.025713,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.001161,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000105,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,53.016947,NaN,"#/op",5000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,157390156.667728,672584.777681,"ops/s",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,1.695306,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.053664,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.031368,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003326,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.003155,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,8.010168,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.005645,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.095965,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,1.128123,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.028504,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.001011,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000110,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,53.003675,NaN,"#/op",7000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,157798980.940213,764697.250786,"ops/s",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,1.952853,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.022777,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.023807,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003257,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.004008,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,7.990682,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.004266,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.059754,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,1.397186,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.019997,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.001003,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000129,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.896245,NaN,"#/op",10000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,150330975.246741,1605620.715961,"ops/s",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,2.378773,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.036047,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.030046,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003117,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.004204,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,8.001242,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.005145,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.078731,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,1.708955,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.023010,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.001044,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000128,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,52.933174,NaN,"#/op",20000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,114316055.929498,3553753.935720,"ops/s",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,2.573253,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.049313,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.038018,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.003989,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.008927,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,8.014444,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.008533,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.094540,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,1.824349,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.033037,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.001348,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000178,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,53.081475,NaN,"#/op",30000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,62800524.051547,1844174.328399,"ops/s",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,2.806845,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.118333,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.069840,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.007308,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.024665,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,8.083796,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.010630,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.175443,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,2.245008,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.067306,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.002569,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000342,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,53.626962,NaN,"#/op",50000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,51085547.708493,526048.863875,"ops/s",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,2.914760,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.140406,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.094680,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.010137,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.024495,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,8.083728,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.010755,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.191453,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,2.472813,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.075312,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.002962,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000380,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,53.631291,NaN,"#/op",70000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray","thrpt",4,40,35331072.282690,115127.559672,"ops/s",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-load-misses","thrpt",4,2,2.877579,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-loads","thrpt",4,2,10.331614,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-dcache-stores","thrpt",4,2,2.181433,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:L1-icache-load-misses","thrpt",4,2,0.013025,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branch-misses","thrpt",4,2,0.078282,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:branches","thrpt",4,2,8.293426,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-load-misses","thrpt",4,2,0.014965,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-loads","thrpt",4,2,10.351742,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-store-misses","thrpt",4,2,3.067687,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:dTLB-stores","thrpt",4,2,2.142323,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-load-misses","thrpt",4,2,0.004301,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:iTLB-loads","thrpt",4,2,0.000614,NaN,"#/op",1000000000 +"com.baeldung.bitset.VectorOfBitsBenchmark.setBoolArray:instructions","thrpt",4,2,55.399010,NaN,"#/op",1000000000 From ed51104e26ff61c9c245ccfbe53998cb41a2c768 Mon Sep 17 00:00:00 2001 From: vatsalgosar Date: Fri, 31 Jul 2020 01:26:27 +0530 Subject: [PATCH 0330/1862] BAEL-3941 (#9499) * BAEL-3941 - Code snippets for preserving line breaks using Jsoup while parsing HTML strings * BAEL-3941 - swapped the order of arguments in assertEquals --- .../jsoup/PreservingLineBreaksUnitTest.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 jsoup/src/test/java/com/baeldung/jsoup/PreservingLineBreaksUnitTest.java diff --git a/jsoup/src/test/java/com/baeldung/jsoup/PreservingLineBreaksUnitTest.java b/jsoup/src/test/java/com/baeldung/jsoup/PreservingLineBreaksUnitTest.java new file mode 100644 index 0000000000..0958fa96e2 --- /dev/null +++ b/jsoup/src/test/java/com/baeldung/jsoup/PreservingLineBreaksUnitTest.java @@ -0,0 +1,39 @@ +package com.baeldung.jsoup; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.safety.Whitelist; +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +public class PreservingLineBreaksUnitTest { + + @Test + public void whenBackSlashNNewLineCharacter_thenPreserveLineBreak() { + String strHTML = "Hello\nworld"; + Document.OutputSettings outputSettings = new Document.OutputSettings(); + outputSettings.prettyPrint(false); + String strWithNewLines = Jsoup.clean(strHTML, "", Whitelist.none(), outputSettings); + assertEquals("Hello\nworld", strWithNewLines); + } + + @Test + public void whenHTMLNewLineCharacters_thenPreserveLineBreak() { + String strHTML = "" + + "Hello" + + "
    " + + "World" + + "

    Paragraph

    " + + ""; + Document jsoupDoc = Jsoup.parse(strHTML); + Document.OutputSettings outputSettings = new Document.OutputSettings(); + outputSettings.prettyPrint(false); + jsoupDoc.outputSettings(outputSettings); + jsoupDoc.select("br").before("\\n"); + jsoupDoc.select("p").before("\\n"); + String str = jsoupDoc.html().replaceAll("\\\\n", "\n"); + String strWithNewLines = + Jsoup.clean(str, "", Whitelist.none(), outputSettings); + assertEquals("Hello\nWorld\nParagraph", strWithNewLines); + } +} From 749bd7e99a5e25124434b8cba97d8bcc2f425459 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Fri, 31 Jul 2020 15:26:27 +0430 Subject: [PATCH 0331/1862] Improve the Kotlin Jackson module --- .../kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt b/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt index 84171d9019..95df57fb1e 100644 --- a/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt +++ b/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt @@ -59,7 +59,11 @@ class JacksonUnitTest { val aMap: Map = mapper.readValue(json) assertEquals(aMap[1], "one") - assertEquals(aMap[2], "two") + assertEquals(aMap[2], "two") + + val sameMap = mapper.readValue>(json) + assertEquals(sameMap[1], "one") + assertEquals(sameMap[2], "two") } @Test From 508b4a2939cb8170a75c51ac20a3b3c65c6519f9 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Fri, 31 Jul 2020 15:31:51 +0430 Subject: [PATCH 0332/1862] Added Reified Style to the List Example --- .../kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt b/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt index 95df57fb1e..0c72edc2fd 100644 --- a/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt +++ b/kotlin-libraries-2/src/test/kotlin/com/baeldung/kotlin/jackson/JacksonUnitTest.kt @@ -85,7 +85,11 @@ class JacksonUnitTest { val movie1 = Movie("Endgame", "Marvel", 9.2f) val movie2 = Movie("Shazam", "Warner Bros", 7.6f) assertTrue(movieList.contains(movie1)) - assertTrue(movieList.contains(movie2)) + assertTrue(movieList.contains(movie2)) + + val sameList = mapper.readValue>(json) + assertTrue(sameList.contains(movie1)) + assertTrue(sameList.contains(movie2)) } @Test From c748e8172352f8e65401048c6d668e1cdac4f102 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Fri, 31 Jul 2020 22:02:44 +0200 Subject: [PATCH 0333/1862] JAVA-17: Move Running Setup Data on Startup in Spring into spring-boot-data --- spring-boot-modules/spring-boot-data/README.md | 1 + .../com/baeldung/startup/AllStrategiesExampleBean.java | 1 - .../com/baeldung/startup/EventListenerExampleBean.java | 1 - .../java/com/baeldung/startup/InitMethodExampleBean.java | 4 ++-- .../com/baeldung/startup/InitializingBeanExampleBean.java | 4 ++-- .../java/com/baeldung/startup/InvalidInitExampleBean.java | 0 .../baeldung/startup/LogicInConstructorExampleBean.java | 4 ++-- .../com/baeldung/startup/PostConstructExampleBean.java | 7 +++---- .../java/com/baeldung/startup/SpringStartupConfig.java | 0 .../startup/StartupApplicationListenerExample.java | 1 - .../spring-boot-data}/src/main/resources/startupConfig.xml | 0 .../com/baeldung/startup/SpringStartupIntegrationTest.java | 0 .../startup/SpringStartupXMLConfigIntegrationTest.java | 0 spring-boot-modules/spring-boot/README.MD | 1 - spring-core-4/README.md | 1 - 15 files changed, 10 insertions(+), 15 deletions(-) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java (99%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/EventListenerExampleBean.java (99%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/InitMethodExampleBean.java (100%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java (100%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java (100%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java (100%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/PostConstructExampleBean.java (99%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/SpringStartupConfig.java (100%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java (99%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/main/resources/startupConfig.xml (100%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java (100%) rename {spring-core-4 => spring-boot-modules/spring-boot-data}/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java (100%) diff --git a/spring-boot-modules/spring-boot-data/README.md b/spring-boot-modules/spring-boot-data/README.md index faa38d475e..98589cf2d2 100644 --- a/spring-boot-modules/spring-boot-data/README.md +++ b/spring-boot-modules/spring-boot-data/README.md @@ -10,3 +10,4 @@ This module contains articles about Spring Boot with Spring Data - [Repositories with Multiple Spring Data Modules](https://www.baeldung.com/spring-multiple-data-modules) - [Spring Custom Property Editor](https://www.baeldung.com/spring-mvc-custom-property-editor) - [Using @JsonComponent in Spring Boot](https://www.baeldung.com/spring-boot-jsoncomponent) +- [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring) diff --git a/spring-core-4/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java similarity index 99% rename from spring-core-4/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java index e08309d474..53b81da340 100644 --- a/spring-core-4/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java +++ b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/AllStrategiesExampleBean.java @@ -2,7 +2,6 @@ package com.baeldung.startup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.springframework.beans.factory.InitializingBean; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; diff --git a/spring-core-4/src/main/java/com/baeldung/startup/EventListenerExampleBean.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/EventListenerExampleBean.java similarity index 99% rename from spring-core-4/src/main/java/com/baeldung/startup/EventListenerExampleBean.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/EventListenerExampleBean.java index a76fc6a2b2..8a2e36ed8e 100644 --- a/spring-core-4/src/main/java/com/baeldung/startup/EventListenerExampleBean.java +++ b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/EventListenerExampleBean.java @@ -2,7 +2,6 @@ package com.baeldung.startup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; diff --git a/spring-core-4/src/main/java/com/baeldung/startup/InitMethodExampleBean.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/InitMethodExampleBean.java similarity index 100% rename from spring-core-4/src/main/java/com/baeldung/startup/InitMethodExampleBean.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/InitMethodExampleBean.java index a3b12028d1..86f61dd395 100644 --- a/spring-core-4/src/main/java/com/baeldung/startup/InitMethodExampleBean.java +++ b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/InitMethodExampleBean.java @@ -1,7 +1,5 @@ package com.baeldung.startup; -import java.util.Arrays; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -9,6 +7,8 @@ import org.springframework.context.annotation.Scope; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import java.util.Arrays; + @Component @Scope(value = "prototype") public class InitMethodExampleBean { diff --git a/spring-core-4/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java similarity index 100% rename from spring-core-4/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java index c625a172fd..8fef3bf8b7 100644 --- a/spring-core-4/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java +++ b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/InitializingBeanExampleBean.java @@ -1,7 +1,5 @@ package com.baeldung.startup; -import java.util.Arrays; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; @@ -10,6 +8,8 @@ import org.springframework.context.annotation.Scope; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import java.util.Arrays; + @Component @Scope(value = "prototype") public class InitializingBeanExampleBean implements InitializingBean { diff --git a/spring-core-4/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java similarity index 100% rename from spring-core-4/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/InvalidInitExampleBean.java diff --git a/spring-core-4/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java similarity index 100% rename from spring-core-4/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java index ade7573bbe..b4a102b09d 100644 --- a/spring-core-4/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java +++ b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/LogicInConstructorExampleBean.java @@ -1,7 +1,5 @@ package com.baeldung.startup; -import java.util.Arrays; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -9,6 +7,8 @@ import org.springframework.context.annotation.Scope; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import java.util.Arrays; + @Component @Scope(value = "prototype") public class LogicInConstructorExampleBean { diff --git a/spring-core-4/src/main/java/com/baeldung/startup/PostConstructExampleBean.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/PostConstructExampleBean.java similarity index 99% rename from spring-core-4/src/main/java/com/baeldung/startup/PostConstructExampleBean.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/PostConstructExampleBean.java index 1001043d86..337aa1520a 100644 --- a/spring-core-4/src/main/java/com/baeldung/startup/PostConstructExampleBean.java +++ b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/PostConstructExampleBean.java @@ -1,9 +1,5 @@ package com.baeldung.startup; -import java.util.Arrays; - -import javax.annotation.PostConstruct; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -11,6 +7,9 @@ import org.springframework.context.annotation.Scope; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import javax.annotation.PostConstruct; +import java.util.Arrays; + @Component @Scope(value = "prototype") public class PostConstructExampleBean { diff --git a/spring-core-4/src/main/java/com/baeldung/startup/SpringStartupConfig.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/SpringStartupConfig.java similarity index 100% rename from spring-core-4/src/main/java/com/baeldung/startup/SpringStartupConfig.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/SpringStartupConfig.java diff --git a/spring-core-4/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java similarity index 99% rename from spring-core-4/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java rename to spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java index 2cc5e6abcb..345fb3a625 100644 --- a/spring-core-4/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java +++ b/spring-boot-modules/spring-boot-data/src/main/java/com/baeldung/startup/StartupApplicationListenerExample.java @@ -2,7 +2,6 @@ package com.baeldung.startup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.stereotype.Component; diff --git a/spring-core-4/src/main/resources/startupConfig.xml b/spring-boot-modules/spring-boot-data/src/main/resources/startupConfig.xml similarity index 100% rename from spring-core-4/src/main/resources/startupConfig.xml rename to spring-boot-modules/spring-boot-data/src/main/resources/startupConfig.xml diff --git a/spring-core-4/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java b/spring-boot-modules/spring-boot-data/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java similarity index 100% rename from spring-core-4/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java rename to spring-boot-modules/spring-boot-data/src/test/java/com/baeldung/startup/SpringStartupIntegrationTest.java diff --git a/spring-core-4/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java b/spring-boot-modules/spring-boot-data/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java similarity index 100% rename from spring-core-4/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java rename to spring-boot-modules/spring-boot-data/src/test/java/com/baeldung/startup/SpringStartupXMLConfigIntegrationTest.java diff --git a/spring-boot-modules/spring-boot/README.MD b/spring-boot-modules/spring-boot/README.MD index fb1c20e988..c95fe51842 100644 --- a/spring-boot-modules/spring-boot/README.MD +++ b/spring-boot-modules/spring-boot/README.MD @@ -25,4 +25,3 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Shutdown Callbacks](https://www.baeldung.com/spring-shutdown-callbacks) - [Container Configuration in Spring Boot 2](https://www.baeldung.com/embeddedservletcontainercustomizer-configurableembeddedservletcontainer-spring-boot) - [Validation in Spring Boot](https://www.baeldung.com/spring-boot-bean-validation) -- [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring) diff --git a/spring-core-4/README.md b/spring-core-4/README.md index 83b5c4933d..03a6747c1d 100644 --- a/spring-core-4/README.md +++ b/spring-core-4/README.md @@ -9,7 +9,6 @@ This module contains articles about core Spring functionality - [Spring @Import Annotation](https://www.baeldung.com/spring-import-annotation) - [Spring BeanPostProcessor](https://www.baeldung.com/spring-beanpostprocessor) - [Using @Autowired in Abstract Classes](https://www.baeldung.com/spring-autowired-abstract-class) -- [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring) - [Constructor Injection in Spring with Lombok](https://www.baeldung.com/spring-injection-lombok) - [The Spring ApplicationContext](https://www.baeldung.com/spring-application-context) - More articles: [[<-- prev]](/spring-core-3) From 21342c2f46c08e54b8bc3cf259f78e99b34e1f4a Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Sat, 1 Aug 2020 20:40:45 +0430 Subject: [PATCH 0334/1862] Resolved the Comments --- jmh/src/main/java/com/baeldung/bitset/Plotter.java | 4 +++- .../java/com/baeldung/bitset/VectorOfBitsBenchmark.java | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jmh/src/main/java/com/baeldung/bitset/Plotter.java b/jmh/src/main/java/com/baeldung/bitset/Plotter.java index beb136f515..0d065ea185 100644 --- a/jmh/src/main/java/com/baeldung/bitset/Plotter.java +++ b/jmh/src/main/java/com/baeldung/bitset/Plotter.java @@ -29,7 +29,9 @@ public class Plotter { stream.write((i + "," + baSize + "," + bitSetSize + "\n")); - if (i % 10_000 == 0) stream.flush(); + if (i % 10_000 == 0) { + stream.flush(); + } } } } diff --git a/jmh/src/main/java/com/baeldung/bitset/VectorOfBitsBenchmark.java b/jmh/src/main/java/com/baeldung/bitset/VectorOfBitsBenchmark.java index 8949d4e117..7bbf00f36c 100644 --- a/jmh/src/main/java/com/baeldung/bitset/VectorOfBitsBenchmark.java +++ b/jmh/src/main/java/com/baeldung/bitset/VectorOfBitsBenchmark.java @@ -19,8 +19,8 @@ public class VectorOfBitsBenchmark { private boolean[] array; private BitSet bitSet; - @Param({"100", "1000", "5000", "50000", "100000", "1000000", "2000000", "3000000", - "5000000", "7000000", "10000000", "20000000", "30000000", "50000000", "70000000", "1000000000"}) + @Param({"100", "1000", "5000", "50000", "100000", "1000000", "2000000", "3000000", "5000000", + "7000000", "10000000", "20000000", "30000000", "50000000", "70000000", "1000000000"}) public int size; @Setup(Level.Trial) @@ -62,7 +62,9 @@ public class VectorOfBitsBenchmark { public int cardinalityBoolArray() { int sum = 0; for (boolean b : array) { - if (b) sum++; + if (b) { + sum++; + } } return sum; From 6092afb60a41d696ce0b838de7493269093ba58a Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sat, 1 Aug 2020 22:41:28 +0530 Subject: [PATCH 0335/1862] Implementing Code Review comments -3 --- .../spring/data/cosmosdb/controller/ProductController.java | 5 ----- .../spring/data/cosmosdb/repository/ProductRepository.java | 1 - .../spring/data/cosmosdb/service/ProductService.java | 6 +----- .../data/cosmosdb/AzurecosmodbApplicationManualTest.java | 7 +++---- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java index fe02be88ff..25f88bac72 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/controller/ProductController.java @@ -50,9 +50,4 @@ public class ProductController { return productService.findProductByName(name); } - @GetMapping(value = "/category") - public List getByCategory(@RequestParam String category) { - return productService.getProductsOfCategory(category); - } - } diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/repository/ProductRepository.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/repository/ProductRepository.java index 29dc85a2cf..1e4a2987a1 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/repository/ProductRepository.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/repository/ProductRepository.java @@ -11,5 +11,4 @@ import java.util.List; public interface ProductRepository extends CosmosRepository { List findByProductName(String productName); - List findByProductCategory(String category); } diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java index 49d07ca5a2..0d1cf7c6a6 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/service/ProductService.java @@ -14,7 +14,7 @@ import java.util.Optional; public class ProductService { private ProductRepository repository; - + @Autowired public ProductService(ProductRepository repository) { this.repository = repository; @@ -28,10 +28,6 @@ public class ProductService { return repository.findById(productId, new PartitionKey(category)); } - public List getProductsOfCategory(String category) { - return repository.findByProductCategory(category); - } - public void saveProduct(Product product) { repository.save(product); } diff --git a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java index 786b578501..7ebdce279b 100644 --- a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java +++ b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java @@ -9,8 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.util.Assert; -import java.util.Optional; - @SpringBootTest public class AzurecosmodbApplicationManualTest { @@ -26,8 +24,9 @@ public class AzurecosmodbApplicationManualTest { product.setProductName("Blue Shirt"); productRepository.save(product); - Optional retrievedProduct = productRepository.findById("1001", new PartitionKey("Shirt")); - Assert.notNull(retrievedProduct.get(), "Retrieved Product is Null"); + Product retrievedProduct = productRepository.findById("1001", new PartitionKey("Shirt")) + .orElse(null); + Assert.notNull(retrievedProduct, "Retrieved Product is Null"); } From 623eaff91dae4c40d79588d350d0869f8bf53208 Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 2 Aug 2020 00:55:58 +0530 Subject: [PATCH 0336/1862] ingore files generated after build --- .gitignore | 1 + spring-soap/.gitignore | 1 + spring-soap/pom.xml | 1 + .../java/com/baeldung/springsoap/client/gen/Country.java | 7 ------- .../java/com/baeldung/springsoap/client/gen/Currency.java | 7 ------- .../baeldung/springsoap/client/gen/GetCountryRequest.java | 7 ------- .../baeldung/springsoap/client/gen/GetCountryResponse.java | 7 ------- .../com/baeldung/springsoap/client/gen/ObjectFactory.java | 7 ------- .../com/baeldung/springsoap/client/gen/package-info.java | 7 ------- 9 files changed, 3 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index c54117203f..fe56746dfd 100644 --- a/.gitignore +++ b/.gitignore @@ -85,5 +85,6 @@ transaction.log *-shell.log apache-cxf/cxf-aegis/baeldung.xml +testing-modules/report-*.json libraries-2/*.db \ No newline at end of file diff --git a/spring-soap/.gitignore b/spring-soap/.gitignore index b83d22266a..cce17abdb9 100644 --- a/spring-soap/.gitignore +++ b/spring-soap/.gitignore @@ -1 +1,2 @@ /target/ +sun-jaxb.episode diff --git a/spring-soap/pom.xml b/spring-soap/pom.xml index 137ff03c31..bea3d033e6 100644 --- a/spring-soap/pom.xml +++ b/spring-soap/pom.xml @@ -75,6 +75,7 @@ ${project.basedir}/src/main/java com.baeldung.springsoap.client.gen ${project.basedir}/src/main/resources + true countries.wsdl diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/Country.java b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/Country.java index e17dce55f9..bb196d625d 100644 --- a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/Country.java +++ b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/Country.java @@ -1,10 +1,3 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 -// See https://javaee.github.io/jaxb-v2/ -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2020.04.25 at 03:18:49 PM IST -// - package com.baeldung.springsoap.client.gen; diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/Currency.java b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/Currency.java index 12fdef58c2..023a8103e5 100644 --- a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/Currency.java +++ b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/Currency.java @@ -1,10 +1,3 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 -// See https://javaee.github.io/jaxb-v2/ -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2020.04.25 at 03:18:49 PM IST -// - package com.baeldung.springsoap.client.gen; diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/GetCountryRequest.java b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/GetCountryRequest.java index 5739ee3b96..dcd5b1f08b 100644 --- a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/GetCountryRequest.java +++ b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/GetCountryRequest.java @@ -1,10 +1,3 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 -// See https://javaee.github.io/jaxb-v2/ -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2020.04.25 at 03:18:49 PM IST -// - package com.baeldung.springsoap.client.gen; diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/GetCountryResponse.java b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/GetCountryResponse.java index ba1ab56cf8..11135c32e1 100644 --- a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/GetCountryResponse.java +++ b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/GetCountryResponse.java @@ -1,10 +1,3 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 -// See https://javaee.github.io/jaxb-v2/ -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2020.04.25 at 03:18:49 PM IST -// - package com.baeldung.springsoap.client.gen; diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/ObjectFactory.java b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/ObjectFactory.java index 88b27245be..e6d56d5aba 100644 --- a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/ObjectFactory.java +++ b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/ObjectFactory.java @@ -1,10 +1,3 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 -// See https://javaee.github.io/jaxb-v2/ -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2020.04.25 at 03:18:49 PM IST -// - package com.baeldung.springsoap.client.gen; diff --git a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/package-info.java b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/package-info.java index eefed169a8..9432e0c328 100644 --- a/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/package-info.java +++ b/spring-soap/src/main/java/com/baeldung/springsoap/client/gen/package-info.java @@ -1,9 +1,2 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0 -// See https://javaee.github.io/jaxb-v2/ -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2020.04.25 at 03:18:49 PM IST -// - @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/springsoap/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.baeldung.springsoap.client.gen; From f18d4dfa987399981d3c4e9dddaaf4cd5588d7f6 Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Sun, 2 Aug 2020 01:39:35 +0530 Subject: [PATCH 0337/1862] BAEL-3836: Fix failing test in core-java-concurrency-advanced-3 (#9806) * BAEL-3836: Fix failing test in core-java-concurrency-advanced-3 * BAEL-3836: Fix failing test in core-java-concurrency-advanced-3 --- ...UnitManualTest.java => PrimeNumbersManualTest.java} | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) rename core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/workstealing/{PrimeNumbersUnitManualTest.java => PrimeNumbersManualTest.java} (93%) diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/workstealing/PrimeNumbersUnitManualTest.java b/core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/workstealing/PrimeNumbersManualTest.java similarity index 93% rename from core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/workstealing/PrimeNumbersUnitManualTest.java rename to core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/workstealing/PrimeNumbersManualTest.java index 4fbbef4e61..8d12218c05 100644 --- a/core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/workstealing/PrimeNumbersUnitManualTest.java +++ b/core-java-modules/core-java-concurrency-advanced-3/src/test/java/com/baeldung/workstealing/PrimeNumbersManualTest.java @@ -15,7 +15,15 @@ import java.util.logging.Logger; import static org.junit.Assert.fail; -public class PrimeNumbersUnitManualTest { +/** + * This test expects the file target/test-classes/META-INF/BenchmarkList to be present. + * + * Before running the test ensure that the file is present. + * If not, please run mvn install on the module. + * + */ + +public class PrimeNumbersManualTest { private static Logger logger = Logger.getAnonymousLogger(); From 71cd51e85fe028784c1a7c936289fa88f30214ff Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 2 Aug 2020 02:07:30 +0530 Subject: [PATCH 0338/1862] align module name & artifactId --- persistence-modules/flyway-repair/pom.xml | 2 +- persistence-modules/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/persistence-modules/flyway-repair/pom.xml b/persistence-modules/flyway-repair/pom.xml index 4d61bd5c0e..5a5c4103f6 100644 --- a/persistence-modules/flyway-repair/pom.xml +++ b/persistence-modules/flyway-repair/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - flyway + flyway-repair flyway-repair jar Flyway Repair Demo diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index c598ad8805..31b9aaaf6d 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -19,7 +19,7 @@ core-java-persistence deltaspike elasticsearch - flyway + flyway-repair hbase hibernate5 hibernate-mapping From 6fc0c42586e2c85390a5d58cfbf43cc994482083 Mon Sep 17 00:00:00 2001 From: Maja Joksovic Date: Sat, 1 Aug 2020 22:58:00 +0200 Subject: [PATCH 0339/1862] fixed indentation --- .../com/baeldung/copydirectory/JavaNio.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java index fe1eb59c64..b574042ee5 100644 --- a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/copydirectory/JavaNio.java @@ -9,14 +9,14 @@ public class JavaNio { public static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException { Files.walk(Paths.get(sourceDirectoryLocation)) - .forEach(source -> { - Path destination = Paths.get(destinationDirectoryLocation, source.toString() - .substring(sourceDirectoryLocation.length())); - try { - Files.copy(source, destination); - } catch (IOException e) { - e.printStackTrace(); - } - }); + .forEach(source -> { + Path destination = Paths.get(destinationDirectoryLocation, source.toString() + .substring(sourceDirectoryLocation.length())); + try { + Files.copy(source, destination); + } catch (IOException e) { + e.printStackTrace(); + } + }); } } From 314910468f9981eb884bb4279526eaccb68b146b Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 2 Aug 2020 03:47:35 +0530 Subject: [PATCH 0340/1862] used release repository --- maven-modules/versions-maven-plugin/original/pom.xml | 6 +++--- maven-modules/versions-maven-plugin/pom.xml | 6 +++--- parent-kotlin/pom.xml | 4 ++-- spring-boot-modules/spring-boot-mvc-2/pom.xml | 6 +++--- spring-boot-modules/spring-boot-mvc/pom.xml | 6 +++--- spring-mobile/pom.xml | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/maven-modules/versions-maven-plugin/original/pom.xml b/maven-modules/versions-maven-plugin/original/pom.xml index f81596661e..f705dae5c5 100644 --- a/maven-modules/versions-maven-plugin/original/pom.xml +++ b/maven-modules/versions-maven-plugin/original/pom.xml @@ -58,9 +58,9 @@ - apache.snapshots - Apache Development Snapshot Repository - https://repository.apache.org/content/repositories/snapshots/ + apache.releases + Apache Development Release Repository + https://repository.apache.org/content/repositories/releases/ false diff --git a/maven-modules/versions-maven-plugin/pom.xml b/maven-modules/versions-maven-plugin/pom.xml index 9793f55b28..3a9134ff40 100644 --- a/maven-modules/versions-maven-plugin/pom.xml +++ b/maven-modules/versions-maven-plugin/pom.xml @@ -57,9 +57,9 @@ - apache.snapshots - Apache Development Snapshot Repository - https://repository.apache.org/content/repositories/snapshots/ + apache.releases + Apache Development Release Repository + https://repository.apache.org/content/repositories/releases/ false diff --git a/parent-kotlin/pom.xml b/parent-kotlin/pom.xml index 947dd20483..f8a95e235a 100644 --- a/parent-kotlin/pom.xml +++ b/parent-kotlin/pom.xml @@ -30,8 +30,8 @@ spring-milestone - Spring Milestone Repository - https://repo.spring.io/milestone + Spring Release Repository + https://repo.spring.io/release diff --git a/spring-boot-modules/spring-boot-mvc-2/pom.xml b/spring-boot-modules/spring-boot-mvc-2/pom.xml index 73a75f020c..0b9213a7ea 100644 --- a/spring-boot-modules/spring-boot-mvc-2/pom.xml +++ b/spring-boot-modules/spring-boot-mvc-2/pom.xml @@ -90,15 +90,15 @@ - jcenter-snapshots + jcenter-release jcenter - http://oss.jfrog.org/artifactory/oss-snapshot-local/ + http://oss.jfrog.org/artifactory/oss-release-local/ - 3.0.0-SNAPSHOT + 3.0.0 com.baeldung.swagger2boot.SpringBootSwaggerApplication 1.4.11.1 diff --git a/spring-boot-modules/spring-boot-mvc/pom.xml b/spring-boot-modules/spring-boot-mvc/pom.xml index fd6f1b0a8a..9ae6d8341a 100644 --- a/spring-boot-modules/spring-boot-mvc/pom.xml +++ b/spring-boot-modules/spring-boot-mvc/pom.xml @@ -20,9 +20,9 @@ - jcenter-snapshots + jcenter-release jcenter - http://oss.jfrog.org/artifactory/oss-snapshot-local/ + http://oss.jfrog.org/artifactory/oss-release-local/ @@ -148,7 +148,7 @@
    - 3.0.0-SNAPSHOT + 3.0.0 1.10.0 2.3.7 diff --git a/spring-mobile/pom.xml b/spring-mobile/pom.xml index 465458ba49..bb2b418a55 100644 --- a/spring-mobile/pom.xml +++ b/spring-mobile/pom.xml @@ -33,8 +33,8 @@ spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone + Spring Release + https://repo.spring.io/libs-release false From bff407ca059e733f1aea457e78a5c477a3654255 Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 2 Aug 2020 03:51:32 +0530 Subject: [PATCH 0341/1862] used release repository --- parent-kotlin/pom.xml | 4 ++-- spring-mobile/pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/parent-kotlin/pom.xml b/parent-kotlin/pom.xml index f8a95e235a..947dd20483 100644 --- a/parent-kotlin/pom.xml +++ b/parent-kotlin/pom.xml @@ -30,8 +30,8 @@ spring-milestone - Spring Release Repository - https://repo.spring.io/release + Spring Milestone Repository + https://repo.spring.io/milestone diff --git a/spring-mobile/pom.xml b/spring-mobile/pom.xml index bb2b418a55..465458ba49 100644 --- a/spring-mobile/pom.xml +++ b/spring-mobile/pom.xml @@ -33,8 +33,8 @@ spring-milestones - Spring Release - https://repo.spring.io/libs-release + Spring Milestones + https://repo.spring.io/libs-milestone false From 80091e154ad6b6d0293ccb7997e26af601dafc01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Sun, 2 Aug 2020 13:27:31 +0200 Subject: [PATCH 0342/1862] [JAVA-2276] Upgraded maven-assembly-plugin version to 3.3.0 (#9801) --- spring-boot-modules/spring-boot-crud/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-crud/pom.xml b/spring-boot-modules/spring-boot-crud/pom.xml index 8ba7bab171..a4be360b0f 100644 --- a/spring-boot-modules/spring-boot-crud/pom.xml +++ b/spring-boot-modules/spring-boot-crud/pom.xml @@ -63,6 +63,7 @@ org.apache.maven.plugins maven-assembly-plugin + 3.3.0 jar-with-dependencies From 8527d5806334d266ac13e91acd0f6cf34a02bae9 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Sun, 2 Aug 2020 20:00:53 +0430 Subject: [PATCH 0343/1862] BAEL-4391: Check if a file exists in Java (#9748) * Check if a file exists in Java * Simple Assertions --- core-java-modules/core-java-io-3/.gitignore | 2 + .../baeldung/existence/ExistenceUnitTest.java | 91 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 core-java-modules/core-java-io-3/.gitignore create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/existence/ExistenceUnitTest.java diff --git a/core-java-modules/core-java-io-3/.gitignore b/core-java-modules/core-java-io-3/.gitignore new file mode 100644 index 0000000000..0c0cd871c5 --- /dev/null +++ b/core-java-modules/core-java-io-3/.gitignore @@ -0,0 +1,2 @@ +test-link* +0.* \ No newline at end of file diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/existence/ExistenceUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/existence/ExistenceUnitTest.java new file mode 100644 index 0000000000..c52e46e8c1 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/existence/ExistenceUnitTest.java @@ -0,0 +1,91 @@ +package com.baeldung.existence; + +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.ThreadLocalRandom; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class ExistenceUnitTest { + + @Test + public void givenFile_whenDoesNotExist_thenFilesReturnsFalse() { + Path path = Paths.get("does-not-exist.txt"); + + assertFalse(Files.exists(path)); + assertTrue(Files.notExists(path)); + } + + @Test + public void givenFile_whenExists_thenFilesShouldReturnTrue() throws IOException { + Path tempFile = Files.createTempFile("baeldung", "exist-nio"); + assertTrue(Files.exists(tempFile)); + assertFalse(Files.notExists(tempFile)); + + Path tempDirectory = Files.createTempDirectory("baeldung-exists"); + assertTrue(Files.exists(tempDirectory)); + assertFalse(Files.notExists(tempDirectory)); + + assertTrue(Files.isDirectory(tempDirectory)); + assertFalse(Files.isDirectory(tempFile)); + assertTrue(Files.isRegularFile(tempFile)); + + assertTrue(Files.isReadable(tempFile)); + + Files.deleteIfExists(tempFile); + Files.deleteIfExists(tempDirectory); + } + + @Test + public void givenSymbolicLink_whenTargetDoesNotExists_thenFollowOrNotBasedOnTheOptions() throws IOException { + Path target = Files.createTempFile("baeldung", "target"); + Path symbol = Paths.get("test-link-" + ThreadLocalRandom.current().nextInt()); + + Path symbolicLink = Files.createSymbolicLink(symbol, target); + assertTrue(Files.exists(symbolicLink)); + assertTrue(Files.isSymbolicLink(symbolicLink)); + assertFalse(Files.isSymbolicLink(target)); + + Files.deleteIfExists(target); + assertFalse(Files.exists(symbolicLink)); + assertTrue(Files.exists(symbolicLink, LinkOption.NOFOLLOW_LINKS)); + + Files.deleteIfExists(symbolicLink); + } + + @Test + public void givenFile_whenDoesNotExist_thenFileReturnsFalse() { + assertFalse(new File("invalid").exists()); + assertFalse(new File("invalid").isFile()); + } + + @Test + public void givenFile_whenExist_thenShouldReturnTrue() throws IOException { + Path tempFilePath = Files.createTempFile("baeldung", "exist-io"); + Path tempDirectoryPath = Files.createTempDirectory("baeldung-exists-io"); + + File tempFile = new File(tempFilePath.toString()); + File tempDirectory = new File(tempDirectoryPath.toString()); + + assertTrue(tempFile.exists()); + assertTrue(tempDirectory.exists()); + + assertTrue(tempFile.isFile()); + assertFalse(tempDirectory.isFile()); + + assertTrue(tempDirectory.isDirectory()); + assertFalse(tempFile.isDirectory()); + + assertTrue(tempFile.canRead()); + + Files.deleteIfExists(tempFilePath); + Files.deleteIfExists(tempDirectoryPath); + } +} From 353f454fe0488399998996ca82144509988a03f3 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Sun, 2 Aug 2020 20:06:13 +0430 Subject: [PATCH 0344/1862] Improve How to Count the Number of Matches for a Regex? (#9788) --- .../baeldung/regex/countmatches/CountMatchesUnitTest.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core-java-modules/core-java-regex/src/test/java/com/baeldung/regex/countmatches/CountMatchesUnitTest.java b/core-java-modules/core-java-regex/src/test/java/com/baeldung/regex/countmatches/CountMatchesUnitTest.java index 6427d11dd6..3e601a7828 100644 --- a/core-java-modules/core-java-regex/src/test/java/com/baeldung/regex/countmatches/CountMatchesUnitTest.java +++ b/core-java-modules/core-java-regex/src/test/java/com/baeldung/regex/countmatches/CountMatchesUnitTest.java @@ -1,12 +1,11 @@ package com.baeldung.regex.countmatches; -import static org.junit.Assert.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.Test; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.junit.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Unit Test intended to count number of matches of a RegEx using Java 8 and 9. @@ -65,7 +64,7 @@ public class CountMatchesUnitTest { count++; } - assertNotEquals(3, count); + assertEquals(2, count); } @Test From 7ec5e6824e7dfcaf3022fe4a0f4bc9d43a4a497e Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sun, 2 Aug 2020 22:36:02 +0530 Subject: [PATCH 0345/1862] Refactored code to use short primitive instead of Short wrapper class. --- .../reflection/set/fields/Person.java | 87 ------------------- .../SetFieldsUsingReflectionUnitTest.java | 4 +- 2 files changed, 3 insertions(+), 88 deletions(-) delete mode 100644 core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/set/fields/Person.java diff --git a/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/set/fields/Person.java b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/set/fields/Person.java deleted file mode 100644 index 6bdfc58d78..0000000000 --- a/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/set/fields/Person.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.baeldung.reflection.set.fields; - -public class Person { - - private String name; - private byte age; - private short uidNumber; - private int pinCode; - private long contactNumber; - private float height; - private double weight; - private char gender; - private boolean active; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public byte getAge() { - return age; - } - - public void setAge(byte age) { - this.age = age; - } - - public short getUidNumber() { - return uidNumber; - } - - public void setUidNumber(short uidNumber) { - this.uidNumber = uidNumber; - } - - public int getPinCode() { - return pinCode; - } - - public void setPinCode(int pinCode) { - this.pinCode = pinCode; - } - - public long getContactNumber() { - return contactNumber; - } - - public void setContactNumber(long contactNumber) { - this.contactNumber = contactNumber; - } - - public float getHeight() { - return height; - } - - public void setHeight(float height) { - this.height = height; - } - - public double getWeight() { - return weight; - } - - public void setWeight(double weight) { - this.weight = weight; - } - - public char getGender() { - return gender; - } - - public void setGender(char gender) { - this.gender = gender; - } - - public boolean isActive() { - return active; - } - - public void setActive(boolean active) { - this.active = active; - } - -} diff --git a/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java index 18a378cf07..8931d22160 100644 --- a/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java +++ b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java @@ -5,6 +5,8 @@ import java.lang.reflect.Field; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import com.baeldung.reflection.access.privatefields.Person; + public class SetFieldsUsingReflectionUnitTest { @Test @@ -66,7 +68,7 @@ public class SetFieldsUsingReflectionUnitTest { .getDeclaredField("pinCode"); pinCodeField.setAccessible(true); - Short pinCode = 4110; + short pinCode = 4110; pinCodeField.setInt(person, pinCode); Assertions.assertEquals(4110, person.getPinCode()); } From 254319fb306b3e4595751ca67d3bec1a2658c933 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 2 Aug 2020 23:17:57 +0530 Subject: [PATCH 0346/1862] JAVA-2297: Update "Spring Boot custom error page" article --- .../spring-boot-basic-customization/pom.xml | 10 ++++++---- .../errorhandling/controllers/MyErrorController.java | 2 +- .../src/main/resources/application.properties | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/spring-boot-modules/spring-boot-basic-customization/pom.xml b/spring-boot-modules/spring-boot-basic-customization/pom.xml index fc34994a85..2a4b321c5f 100644 --- a/spring-boot-modules/spring-boot-basic-customization/pom.xml +++ b/spring-boot-modules/spring-boot-basic-customization/pom.xml @@ -4,11 +4,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + - com.baeldung.spring-boot-modules - spring-boot-modules - 1.0.0-SNAPSHOT - ../ + org.springframework.boot + spring-boot-starter-parent + 2.3.2.RELEASE + spring-boot-basic-customization diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/errorhandling/controllers/MyErrorController.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/errorhandling/controllers/MyErrorController.java index e002ac045d..8a7a3d6e45 100644 --- a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/errorhandling/controllers/MyErrorController.java +++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/errorhandling/controllers/MyErrorController.java @@ -34,7 +34,7 @@ public class MyErrorController implements ErrorController { @Override public String getErrorPath() { - return "/error"; + return null; } } diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application.properties b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application.properties index 4d4a6ec7bd..53f13c4767 100644 --- a/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-basic-customization/src/main/resources/application.properties @@ -5,3 +5,4 @@ #spring.banner.image.height= //TODO #spring.banner.image.margin= //TODO #spring.banner.image.invert= //TODO +server.error.path=/error From 8c0fc4830c736ba3300f42d2b71d0b943fb84ff4 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Mon, 3 Aug 2020 01:00:01 +0530 Subject: [PATCH 0347/1862] Fixing Capitalization Issue in class names --- ...ecosmodbApplication.java => AzureCosmosDbApplication.java} | 4 ++-- ...anualTest.java => AzureCosmosDbApplicationManualTest.java} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/{AzurecosmodbApplication.java => AzureCosmosDbApplication.java} (90%) rename persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/{AzurecosmodbApplicationManualTest.java => AzureCosmosDbApplicationManualTest.java} (95%) diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplication.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplication.java similarity index 90% rename from persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplication.java rename to persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplication.java index 2b145d14cd..7a91cd7d33 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplication.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplication.java @@ -13,10 +13,10 @@ import org.springframework.context.annotation.Bean; @SpringBootApplication @EnableCosmosRepositories(basePackageClasses = ProductRepository.class) -public class AzurecosmodbApplication extends AbstractCosmosConfiguration { +public class AzureCosmosDbApplication extends AbstractCosmosConfiguration { public static void main(String[] args) { - SpringApplication.run(AzurecosmodbApplication.class, args); + SpringApplication.run(AzureCosmosDbApplication.class, args); } @Value("${azure.cosmosdb.uri}") diff --git a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplicationManualTest.java similarity index 95% rename from persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java rename to persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplicationManualTest.java index 7ebdce279b..9170068173 100644 --- a/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzurecosmodbApplicationManualTest.java +++ b/persistence-modules/spring-data-cosmosdb/src/test/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplicationManualTest.java @@ -10,7 +10,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.util.Assert; @SpringBootTest -public class AzurecosmodbApplicationManualTest { +public class AzureCosmosDbApplicationManualTest { @Autowired ProductRepository productRepository; From ebb836524dfee18e3493f360a6c3fe17c36d3c7d Mon Sep 17 00:00:00 2001 From: azhwani <> Date: Mon, 3 Aug 2020 12:46:26 +0100 Subject: [PATCH 0348/1862] first commit --- .../logoutredirects/LogoutApplication.java | 13 +++++++ .../controller/RestApiController.java | 20 ++++++++++ .../securityconfig/SpringSecurityConfig.java | 27 +++++++++++++ .../src/main/resources/application.properties | 4 +- .../LogoutApplicationUnitTest.java | 38 +++++++++++++++++++ 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 spring-5-security/src/main/java/com/baeldung/logoutredirects/LogoutApplication.java create mode 100644 spring-5-security/src/main/java/com/baeldung/logoutredirects/controller/RestApiController.java create mode 100644 spring-5-security/src/main/java/com/baeldung/logoutredirects/securityconfig/SpringSecurityConfig.java create mode 100644 spring-5-security/src/test/java/com/baeldung/authresolver/logoutredirects/LogoutApplicationUnitTest.java diff --git a/spring-5-security/src/main/java/com/baeldung/logoutredirects/LogoutApplication.java b/spring-5-security/src/main/java/com/baeldung/logoutredirects/LogoutApplication.java new file mode 100644 index 0000000000..ef8175ffb2 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/logoutredirects/LogoutApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.logoutredirects; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class LogoutApplication { + + public static void main(String[] args) { + SpringApplication.run(LogoutApplication.class, args); + } + +} diff --git a/spring-5-security/src/main/java/com/baeldung/logoutredirects/controller/RestApiController.java b/spring-5-security/src/main/java/com/baeldung/logoutredirects/controller/RestApiController.java new file mode 100644 index 0000000000..7d5b3ebbaa --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/logoutredirects/controller/RestApiController.java @@ -0,0 +1,20 @@ +package com.baeldung.logoutredirects.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class RestApiController { + + @GetMapping("/login") + public String login() { + return "login"; + } + + @PostMapping("/logout") + public String logout() { + return "redirect:/login"; + } + +} diff --git a/spring-5-security/src/main/java/com/baeldung/logoutredirects/securityconfig/SpringSecurityConfig.java b/spring-5-security/src/main/java/com/baeldung/logoutredirects/securityconfig/SpringSecurityConfig.java new file mode 100644 index 0000000000..64141f63d8 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/logoutredirects/securityconfig/SpringSecurityConfig.java @@ -0,0 +1,27 @@ +package com.baeldung.logoutredirects.securityconfig; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +@EnableWebSecurity +public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests(authz -> authz.mvcMatchers("/login") + .permitAll() + .anyRequest() + .authenticated()) + .logout(logout -> logout.permitAll() + .logoutSuccessHandler((request, response, authentication) -> { + response.setStatus(HttpServletResponse.SC_OK); + })); + + } + +} diff --git a/spring-5-security/src/main/resources/application.properties b/spring-5-security/src/main/resources/application.properties index 5912b0f755..8159ace060 100644 --- a/spring-5-security/src/main/resources/application.properties +++ b/spring-5-security/src/main/resources/application.properties @@ -2,4 +2,6 @@ server.port=8081 logging.level.root=INFO -logging.level.com.baeldung.dsl.ClientErrorLoggingFilter=DEBUG \ No newline at end of file +logging.level.com.baeldung.dsl.ClientErrorLoggingFilter=DEBUG + +logging.level.org.springframework.security=DEBUG \ No newline at end of file diff --git a/spring-5-security/src/test/java/com/baeldung/authresolver/logoutredirects/LogoutApplicationUnitTest.java b/spring-5-security/src/test/java/com/baeldung/authresolver/logoutredirects/LogoutApplicationUnitTest.java new file mode 100644 index 0000000000..22ec67dea1 --- /dev/null +++ b/spring-5-security/src/test/java/com/baeldung/authresolver/logoutredirects/LogoutApplicationUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.authresolver.logoutredirects; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import com.baeldung.logoutredirects.securityconfig.SpringSecurityConfig; + +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; +import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +@RunWith(SpringRunner.class) +@WebMvcTest() +@ContextConfiguration(classes = { SpringSecurityConfig.class }) +public class LogoutApplicationUnitTest { + + @Autowired + private MockMvc mockMvc; + + @WithMockUser(value = "spring") + @Test + public void whenLogout_thenDisableRedirect() throws Exception { + + this.mockMvc.perform(post("/logout").with(csrf())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$").doesNotExist()) + .andExpect(unauthenticated()) + .andReturn(); + } + +} \ No newline at end of file From 1cd7cca2cabd30d36c9dbef35fc8fbfd319cd8c0 Mon Sep 17 00:00:00 2001 From: azhwani <> Date: Mon, 3 Aug 2020 12:57:37 +0100 Subject: [PATCH 0349/1862] quick fix --- .../logoutredirects/LogoutApplicationUnitTest.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) rename spring-5-security/src/test/java/com/baeldung/{authresolver => }/logoutredirects/LogoutApplicationUnitTest.java (83%) diff --git a/spring-5-security/src/test/java/com/baeldung/authresolver/logoutredirects/LogoutApplicationUnitTest.java b/spring-5-security/src/test/java/com/baeldung/logoutredirects/LogoutApplicationUnitTest.java similarity index 83% rename from spring-5-security/src/test/java/com/baeldung/authresolver/logoutredirects/LogoutApplicationUnitTest.java rename to spring-5-security/src/test/java/com/baeldung/logoutredirects/LogoutApplicationUnitTest.java index 22ec67dea1..519a6bdc99 100644 --- a/spring-5-security/src/test/java/com/baeldung/authresolver/logoutredirects/LogoutApplicationUnitTest.java +++ b/spring-5-security/src/test/java/com/baeldung/logoutredirects/LogoutApplicationUnitTest.java @@ -1,16 +1,13 @@ -package com.baeldung.authresolver.logoutredirects; +package com.baeldung.logoutredirects; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; -import com.baeldung.logoutredirects.securityconfig.SpringSecurityConfig; - import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.unauthenticated; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; @@ -18,7 +15,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @WebMvcTest() -@ContextConfiguration(classes = { SpringSecurityConfig.class }) public class LogoutApplicationUnitTest { @Autowired From 33841c2034a82feb31714f986d4cb3441f56ceda Mon Sep 17 00:00:00 2001 From: joe zhang Date: Mon, 3 Aug 2020 22:52:22 +0800 Subject: [PATCH 0350/1862] use utility class directly --- .../primitivetype/PrimitiveTypeUtil.java | 16 +------- .../primitivetype/PrimitiveTypeUnitTest.java | 40 ++++++++++++++++++ .../PrimitiveTypeUtilUnitTest.java | 41 ------------------- 3 files changed, 42 insertions(+), 55 deletions(-) create mode 100644 core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUnitTest.java delete mode 100644 core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilUnitTest.java diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java index 1b2083b548..9607a0008f 100644 --- a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java +++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java @@ -3,10 +3,6 @@ package com.baeldung.primitivetype; import java.util.HashMap; import java.util.Map; -import org.apache.commons.lang3.ClassUtils; - -import com.google.common.primitives.Primitives; - public class PrimitiveTypeUtil { private static final Map, Class> WRAPPER_TYPE_MAP; @@ -23,16 +19,8 @@ public class PrimitiveTypeUtil { WRAPPER_TYPE_MAP.put(Void.class, void.class); } - public boolean isPrimitiveTypeByCommonsLang(Object source) { - return ClassUtils.isPrimitiveOrWrapper(source.getClass()); - } - - public boolean isPrimitiveTypeByGuava(Object source) { - return Primitives.isWrapperType(source.getClass()); - } - - public boolean isPrimitiveType(Object source) { - return WRAPPER_TYPE_MAP.containsKey(source.getClass()); + public boolean isPrimitiveType(Class sourceClass) { + return WRAPPER_TYPE_MAP.containsKey(sourceClass); } } diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUnitTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUnitTest.java new file mode 100644 index 0000000000..5bbededbb3 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUnitTest.java @@ -0,0 +1,40 @@ +package com.baeldung.primitivetype; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.lang3.ClassUtils; +import org.junit.Before; +import org.junit.Test; + +import com.google.common.primitives.Primitives; + +public class PrimitiveTypeUnitTest { + + private PrimitiveTypeUtil primitiveTypeUtil; + + @Before + public void setup() { + primitiveTypeUtil = new PrimitiveTypeUtil(); + } + + @Test + public void givenAClass_whenCheckWithPrimitiveTypeUtil_thenShouldValidate() { + assertTrue(primitiveTypeUtil.isPrimitiveType(Boolean.class)); + assertFalse(primitiveTypeUtil.isPrimitiveType(String.class)); + } + + @Test + public void givenAClass_whenCheckWithCommonsLang_thenShouldValidate() { + assertTrue(ClassUtils.isPrimitiveOrWrapper(Boolean.class)); + assertTrue(ClassUtils.isPrimitiveOrWrapper(boolean.class)); + assertFalse(ClassUtils.isPrimitiveOrWrapper(String.class)); + } + + @Test + public void givenAClass_whenCheckWithGuava_thenShouldValidate() { + assertTrue(Primitives.isWrapperType(Boolean.class)); + assertFalse(Primitives.isWrapperType(String.class)); + assertFalse(Primitives.isWrapperType(boolean.class)); + } +} diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilUnitTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilUnitTest.java deleted file mode 100644 index 5cd1b9f9d7..0000000000 --- a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUtilUnitTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.primitivetype; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.junit.Before; -import org.junit.Test; - -public class PrimitiveTypeUtilUnitTest { - - private PrimitiveTypeUtil primitiveTypeUtil; - private boolean booleanVal = false; - private Long longWrapper = 1L; - private String nonPrimitiveVal = "non primitive string"; - - @Before - public void setup() { - primitiveTypeUtil = new PrimitiveTypeUtil(); - } - - @Test - public void givenObjectWhenCheckWithGuavaShouldValidate() { - assertTrue(primitiveTypeUtil.isPrimitiveTypeByGuava(booleanVal)); - assertTrue(primitiveTypeUtil.isPrimitiveTypeByGuava(longWrapper)); - assertFalse(primitiveTypeUtil.isPrimitiveTypeByGuava(nonPrimitiveVal)); - } - - @Test - public void givenObjectWhenCheckWithCommonsLangShouldValidate() { - assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(booleanVal)); - assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(longWrapper)); - assertFalse(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(nonPrimitiveVal)); - } - - @Test - public void givenPrimitiveOrWrapperWhenCheckWithCustomMethodShouldReturnTrue() { - assertTrue(primitiveTypeUtil.isPrimitiveType(booleanVal)); - assertTrue(primitiveTypeUtil.isPrimitiveType(longWrapper)); - assertFalse(primitiveTypeUtil.isPrimitiveType(nonPrimitiveVal)); - } -} From a27969cc707f4883f2737027cf0240ebce2d06ae Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Mon, 3 Aug 2020 21:01:57 +0530 Subject: [PATCH 0351/1862] Refactored code to use existing variables. --- .../SetFieldsUsingReflectionUnitTest.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java index 8931d22160..3fe6994041 100644 --- a/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java +++ b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/set/fields/SetFieldsUsingReflectionUnitTest.java @@ -19,7 +19,7 @@ public class SetFieldsUsingReflectionUnitTest { byte age = 26; ageField.setByte(person, age); - Assertions.assertEquals(26, person.getAge()); + Assertions.assertEquals(age, person.getAge()); Field uidNumberField = person.getClass() .getDeclaredField("uidNumber"); @@ -27,7 +27,7 @@ public class SetFieldsUsingReflectionUnitTest { short uidNumber = 5555; uidNumberField.setShort(person, uidNumber); - Assertions.assertEquals(5555, person.getUidNumber()); + Assertions.assertEquals(uidNumber, person.getUidNumber()); Field pinCodeField = person.getClass() .getDeclaredField("pinCode"); @@ -35,7 +35,7 @@ public class SetFieldsUsingReflectionUnitTest { int pinCode = 411057; pinCodeField.setInt(person, pinCode); - Assertions.assertEquals(411057, person.getPinCode()); + Assertions.assertEquals(pinCode, person.getPinCode()); Field contactNumberField = person.getClass() .getDeclaredField("contactNumber"); @@ -43,7 +43,7 @@ public class SetFieldsUsingReflectionUnitTest { long contactNumber = 123456789L; contactNumberField.setLong(person, contactNumber); - Assertions.assertEquals(123456789L, person.getContactNumber()); + Assertions.assertEquals(contactNumber, person.getContactNumber()); } @@ -57,7 +57,7 @@ public class SetFieldsUsingReflectionUnitTest { Integer pinCode = 411057; pinCodeField.setInt(person, pinCode); - Assertions.assertEquals(411057, person.getPinCode()); + Assertions.assertEquals(pinCode, person.getPinCode()); } @Test @@ -70,7 +70,7 @@ public class SetFieldsUsingReflectionUnitTest { short pinCode = 4110; pinCodeField.setInt(person, pinCode); - Assertions.assertEquals(4110, person.getPinCode()); + Assertions.assertEquals(pinCode, person.getPinCode()); } @Test @@ -83,7 +83,7 @@ public class SetFieldsUsingReflectionUnitTest { float height = 6.1242f; heightField.setFloat(person, height); - Assertions.assertEquals(6.1242f, person.getHeight()); + Assertions.assertEquals(height, person.getHeight()); Field weightField = person.getClass() .getDeclaredField("weight"); @@ -91,7 +91,7 @@ public class SetFieldsUsingReflectionUnitTest { double weight = 75.2564; weightField.setDouble(person, weight); - Assertions.assertEquals(75.2564, person.getWeight()); + Assertions.assertEquals(weight, person.getWeight()); } @Test @@ -104,7 +104,7 @@ public class SetFieldsUsingReflectionUnitTest { char gender = 'M'; genderField.setChar(person, gender); - Assertions.assertEquals('M', person.getGender()); + Assertions.assertEquals(gender, person.getGender()); } @Test @@ -115,8 +115,7 @@ public class SetFieldsUsingReflectionUnitTest { .getDeclaredField("active"); activeField.setAccessible(true); - boolean active = true; - activeField.setBoolean(person, active); + activeField.setBoolean(person, true); Assertions.assertTrue(person.isActive()); } @@ -130,7 +129,7 @@ public class SetFieldsUsingReflectionUnitTest { String name = "Umang Budhwar"; nameField.set(person, name); - Assertions.assertEquals("Umang Budhwar", person.getName()); + Assertions.assertEquals(name, person.getName()); } @Test From 021c119be4ffcc8a028eab5bdc93f60491d71fbf Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 3 Aug 2020 21:22:23 +0200 Subject: [PATCH 0352/1862] JAVA-2300: Upgrade Spring Core to 5.2.8 in parent-spring-5 --- parent-spring-5/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parent-spring-5/pom.xml b/parent-spring-5/pom.xml index 949e40b021..5893701c68 100644 --- a/parent-spring-5/pom.xml +++ b/parent-spring-5/pom.xml @@ -31,7 +31,7 @@ - 5.2.5.RELEASE + 5.2.8.RELEASE 5.2.3.RELEASE 1.5.10.RELEASE From 3ac4049caee949f692185dd9b33245a4b8938e9a Mon Sep 17 00:00:00 2001 From: mikr Date: Tue, 4 Aug 2020 22:39:30 +0200 Subject: [PATCH 0353/1862] Java-65 split persistence-modules/spring-jpa --- persistence-modules/spring-jpa-2/.gitignore | 13 ++ persistence-modules/spring-jpa-2/README.md | 19 +++ persistence-modules/spring-jpa-2/pom.xml | 152 ++++++++++++++++++ .../baeldung/config/PersistenceJPAConfig.java | 85 ++++++++++ .../config/PersistenceJPAConfigXml.java | 17 ++ .../com/baeldung/config/SpringWebConfig.java | 24 +++ .../com/baeldung/config/StudentJpaConfig.java | 67 ++++++++ .../com/baeldung/config/WebInitializer.java | 20 +++ .../com/baeldung/manytomany/model/Course.java | 0 .../manytomany/model/CourseRating.java | 0 .../manytomany/model/CourseRatingKey.java | 0 .../manytomany/model/CourseRegistration.java | 0 .../baeldung/manytomany/model/Student.java | 0 .../src/main/resources/context.xml | 1 + .../src/main/resources/logback.xml | 19 +++ .../main/resources/persistence-h2.properties | 10 ++ .../resources/persistence-student.properties | 11 ++ .../src/main/resources/persistence.xml | 42 +++++ .../src/main/resources/server.xml | 6 + .../src/main/resources/sqlfiles.properties | 1 + .../src/test/java/META-INF/persistence.xml | 20 +++ .../java/com/baeldung/SpringContextTest.java | 21 +++ .../manytomany/ManyToManyIntegrationTest.java | 0 .../ManyToManyTestConfiguration.java | 2 +- .../src/test/resources/.gitignore | 13 ++ .../src/test/resources/manytomany/db.sql | 0 .../test/resources/manytomany/test.properties | 0 .../resources/persistence-student.properties | 9 ++ persistence-modules/spring-jpa/README.md | 4 +- 29 files changed, 552 insertions(+), 4 deletions(-) create mode 100644 persistence-modules/spring-jpa-2/.gitignore create mode 100644 persistence-modules/spring-jpa-2/README.md create mode 100644 persistence-modules/spring-jpa-2/pom.xml create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfig.java create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/SpringWebConfig.java create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/StudentJpaConfig.java create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/WebInitializer.java rename persistence-modules/{spring-jpa => spring-jpa-2}/src/main/java/com/baeldung/manytomany/model/Course.java (100%) rename persistence-modules/{spring-jpa => spring-jpa-2}/src/main/java/com/baeldung/manytomany/model/CourseRating.java (100%) rename persistence-modules/{spring-jpa => spring-jpa-2}/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java (100%) rename persistence-modules/{spring-jpa => spring-jpa-2}/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java (100%) rename persistence-modules/{spring-jpa => spring-jpa-2}/src/main/java/com/baeldung/manytomany/model/Student.java (100%) create mode 100644 persistence-modules/spring-jpa-2/src/main/resources/context.xml create mode 100644 persistence-modules/spring-jpa-2/src/main/resources/logback.xml create mode 100644 persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties create mode 100644 persistence-modules/spring-jpa-2/src/main/resources/persistence-student.properties create mode 100644 persistence-modules/spring-jpa-2/src/main/resources/persistence.xml create mode 100644 persistence-modules/spring-jpa-2/src/main/resources/server.xml create mode 100644 persistence-modules/spring-jpa-2/src/main/resources/sqlfiles.properties create mode 100644 persistence-modules/spring-jpa-2/src/test/java/META-INF/persistence.xml create mode 100644 persistence-modules/spring-jpa-2/src/test/java/com/baeldung/SpringContextTest.java rename persistence-modules/{spring-jpa => spring-jpa-2}/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java (100%) rename persistence-modules/{spring-jpa => spring-jpa-2}/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java (97%) create mode 100644 persistence-modules/spring-jpa-2/src/test/resources/.gitignore rename persistence-modules/{spring-jpa => spring-jpa-2}/src/test/resources/manytomany/db.sql (100%) rename persistence-modules/{spring-jpa => spring-jpa-2}/src/test/resources/manytomany/test.properties (100%) create mode 100644 persistence-modules/spring-jpa-2/src/test/resources/persistence-student.properties diff --git a/persistence-modules/spring-jpa-2/.gitignore b/persistence-modules/spring-jpa-2/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/persistence-modules/spring-jpa-2/.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/persistence-modules/spring-jpa-2/README.md b/persistence-modules/spring-jpa-2/README.md new file mode 100644 index 0000000000..71b368b44a --- /dev/null +++ b/persistence-modules/spring-jpa-2/README.md @@ -0,0 +1,19 @@ +========= + +## Spring JPA Example Project + + +### Relevant Articles: +- [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many) +- More articles: [[<-- prev]](/spring-jpa) + + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator + diff --git a/persistence-modules/spring-jpa-2/pom.xml b/persistence-modules/spring-jpa-2/pom.xml new file mode 100644 index 0000000000..410ed592b0 --- /dev/null +++ b/persistence-modules/spring-jpa-2/pom.xml @@ -0,0 +1,152 @@ + + + 4.0.0 + spring-jpa + 0.1-SNAPSHOT + spring-jpa + war + + + com.baeldung + persistence-modules + 1.0.0-SNAPSHOT + + + + + + org.springframework + spring-orm + ${org.springframework.version} + + + commons-logging + commons-logging + + + + + org.springframework + spring-context + ${org.springframework.version} + + + org.springframework + spring-webmvc + ${org.springframework.version} + + + + + + org.hibernate + hibernate-entitymanager + ${hibernate.version} + + + xml-apis + xml-apis + ${xml-apis.version} + + + org.javassist + javassist + ${javassist.version} + + + mysql + mysql-connector-java + ${mysql-connector-java.version} + runtime + + + org.springframework.data + spring-data-jpa + ${spring-data-jpa.version} + + + com.h2database + h2 + ${h2.version} + + + + + + org.hibernate + hibernate-validator + ${hibernate-validator.version} + + + javax.el + javax.el-api + ${javax.el-api.version} + + + + + javax.servlet + jstl + ${jstl.version} + + + javax.servlet + servlet-api + provided + ${javax.servlet.servlet-api.version} + + + + + + com.google.guava + guava + ${guava.version} + + + org.assertj + assertj-core + ${assertj.version} + + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + test + + + + org.springframework + spring-test + ${org.springframework.version} + test + + + + + + + 5.1.5.RELEASE + 3.21.0-GA + + 6.0.6 + 2.1.5.RELEASE + + + 2.5 + + + 6.0.15.Final + 1.4.01 + 2.2.5 + + + 21.0 + 3.8.0 + + + \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfig.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfig.java new file mode 100644 index 0000000000..c489321122 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfig.java @@ -0,0 +1,85 @@ +package com.baeldung.config; + +import com.google.common.base.Preconditions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; +import java.util.Properties; + +@Configuration +@EnableTransactionManagement +@PropertySource({ "classpath:persistence-h2.properties" }) +@ComponentScan({ "com.baeldung.persistence" }) +@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao") +public class PersistenceJPAConfig { + + @Autowired + private Environment env; + + public PersistenceJPAConfig() { + super(); + } + + // beans + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource()); + em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); + + final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + em.setJpaVendorAdapter(vendorAdapter); + em.setJpaProperties(additionalProperties()); + + return em; + } + + @Bean + public DataSource dataSource() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); + + return dataSource; + } + + @Bean + public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(emf); + return transactionManager; + } + + @Bean + public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { + return new PersistenceExceptionTranslationPostProcessor(); + } + + final Properties additionalProperties() { + final Properties hibernateProperties = new Properties(); + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", "false"); + + + return hibernateProperties; + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java new file mode 100644 index 0000000000..95224a4662 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java @@ -0,0 +1,17 @@ +package com.baeldung.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ImportResource; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +// @Configuration +@EnableTransactionManagement +@ComponentScan({ "com.baeldung.persistence" }) +@ImportResource({ "classpath:jpaConfig.xml" }) +public class PersistenceJPAConfigXml { + + public PersistenceJPAConfigXml() { + super(); + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/SpringWebConfig.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/SpringWebConfig.java new file mode 100644 index 0000000000..475970d1f0 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/SpringWebConfig.java @@ -0,0 +1,24 @@ +package com.baeldung.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.view.JstlView; + +@EnableWebMvc +@Configuration +@ComponentScan({ "com.baeldung.web" }) +public class SpringWebConfig extends WebMvcConfigurerAdapter { + + @Bean + public InternalResourceViewResolver viewResolver() { + InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); + viewResolver.setViewClass(JstlView.class); + viewResolver.setPrefix("/WEB-INF/views/jsp/"); + viewResolver.setSuffix(".jsp"); + return viewResolver; + } +} diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/StudentJpaConfig.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/StudentJpaConfig.java new file mode 100644 index 0000000000..54ced72dd1 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/StudentJpaConfig.java @@ -0,0 +1,67 @@ +package com.baeldung.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; +import java.util.Properties; + +@Configuration +@EnableJpaRepositories(basePackages = "com.baeldung.inmemory.persistence.dao") +@PropertySource("persistence-student.properties") +@EnableTransactionManagement +public class StudentJpaConfig { + + @Autowired + private Environment env; + + @Bean + public DataSource dataSource() { + final DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); + dataSource.setUrl(env.getProperty("jdbc.url")); + dataSource.setUsername(env.getProperty("jdbc.user")); + dataSource.setPassword(env.getProperty("jdbc.pass")); + + return dataSource; + } + + @Bean + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource()); + em.setPackagesToScan(new String[] { "com.baeldung.inmemory.persistence.model" }); + em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); + em.setJpaProperties(additionalProperties()); + return em; + } + + @Bean + JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { + JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory); + return transactionManager; + } + + final Properties additionalProperties() { + final Properties hibernateProperties = new Properties(); + + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql")); + hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache")); + hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache")); + + return hibernateProperties; + } +} diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/WebInitializer.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/WebInitializer.java new file mode 100644 index 0000000000..be81cca76b --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/WebInitializer.java @@ -0,0 +1,20 @@ +package com.baeldung.config; + +import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; + +public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { + @Override + protected Class[] getRootConfigClasses() { + return new Class[] { PersistenceJPAConfig.class }; + } + + @Override + protected Class[] getServletConfigClasses() { + return new Class[] { SpringWebConfig.class }; + } + + @Override + protected String[] getServletMappings() { + return new String[] { "/" }; + } +} diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Course.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Course.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Course.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Course.java diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRating.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRating.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRating.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRating.java diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Student.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Student.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/manytomany/model/Student.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Student.java diff --git a/persistence-modules/spring-jpa-2/src/main/resources/context.xml b/persistence-modules/spring-jpa-2/src/main/resources/context.xml new file mode 100644 index 0000000000..a64dfe9a61 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/resources/context.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/logback.xml b/persistence-modules/spring-jpa-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..ec0dc2469a --- /dev/null +++ b/persistence-modules/spring-jpa-2/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/persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties b/persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties new file mode 100644 index 0000000000..a3060cc796 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties @@ -0,0 +1,10 @@ +# jdbc.X +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 +jdbc.user=sa +jdbc.pass= + +# hibernate.X +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/persistence-student.properties b/persistence-modules/spring-jpa-2/src/main/resources/persistence-student.properties new file mode 100644 index 0000000000..d4c82420de --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/resources/persistence-student.properties @@ -0,0 +1,11 @@ +jdbc.driverClassName=com.mysql.cj.jdbc.Driver +jdbc.url=jdbc:mysql://localhost:3306/myDb +jdbc.user=tutorialuser +jdbc.pass=tutorialpass + +hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop + +hibernate.cache.use_second_level_cache=false +hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/persistence.xml b/persistence-modules/spring-jpa-2/src/main/resources/persistence.xml new file mode 100644 index 0000000000..57687c306d --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/resources/persistence.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + ${hibernate.hbm2ddl.auto} + ${hibernate.dialect} + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/server.xml b/persistence-modules/spring-jpa-2/src/main/resources/server.xml new file mode 100644 index 0000000000..5c61659018 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/resources/server.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/sqlfiles.properties b/persistence-modules/spring-jpa-2/src/main/resources/sqlfiles.properties new file mode 100644 index 0000000000..0bea6adad1 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/resources/sqlfiles.properties @@ -0,0 +1 @@ +spring.jpa.hibernate.ddl-auto=none \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/test/java/META-INF/persistence.xml b/persistence-modules/spring-jpa-2/src/test/java/META-INF/persistence.xml new file mode 100644 index 0000000000..495f076fef --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/test/java/META-INF/persistence.xml @@ -0,0 +1,20 @@ + + + + com.baeldung.persistence.model.Foo + com.baeldung.persistence.model.Bar + + + + + + + + + + + + + diff --git a/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/SpringContextTest.java new file mode 100644 index 0000000000..abc73e250d --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/SpringContextTest.java @@ -0,0 +1,21 @@ +package com.baeldung; + +import com.baeldung.config.PersistenceJPAConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class) +@WebAppConfiguration +@DirtiesContext +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java similarity index 100% rename from persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java rename to persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java diff --git a/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java similarity index 97% rename from persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java rename to persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java index f4635b563a..1cc3621f0d 100644 --- a/persistence-modules/spring-jpa/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java +++ b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java @@ -16,7 +16,7 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; @Configuration -@PropertySource("classpath:/manytomany/test.properties") +@PropertySource("manytomany/test.properties") public class ManyToManyTestConfiguration { @Bean diff --git a/persistence-modules/spring-jpa-2/src/test/resources/.gitignore b/persistence-modules/spring-jpa-2/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/persistence-modules/spring-jpa-2/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/persistence-modules/spring-jpa/src/test/resources/manytomany/db.sql b/persistence-modules/spring-jpa-2/src/test/resources/manytomany/db.sql similarity index 100% rename from persistence-modules/spring-jpa/src/test/resources/manytomany/db.sql rename to persistence-modules/spring-jpa-2/src/test/resources/manytomany/db.sql diff --git a/persistence-modules/spring-jpa/src/test/resources/manytomany/test.properties b/persistence-modules/spring-jpa-2/src/test/resources/manytomany/test.properties similarity index 100% rename from persistence-modules/spring-jpa/src/test/resources/manytomany/test.properties rename to persistence-modules/spring-jpa-2/src/test/resources/manytomany/test.properties diff --git a/persistence-modules/spring-jpa-2/src/test/resources/persistence-student.properties b/persistence-modules/spring-jpa-2/src/test/resources/persistence-student.properties new file mode 100644 index 0000000000..3b6b580630 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/test/resources/persistence-student.properties @@ -0,0 +1,9 @@ +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1 + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create + +hibernate.cache.use_second_level_cache=false +hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-jpa/README.md b/persistence-modules/spring-jpa/README.md index 94a1e1f575..3eb8ae8d55 100644 --- a/persistence-modules/spring-jpa/README.md +++ b/persistence-modules/spring-jpa/README.md @@ -11,9 +11,7 @@ - [A Guide to Spring AbstractRoutingDatasource](https://www.baeldung.com/spring-abstract-routing-data-source) - [Obtaining Auto-generated Keys in Spring JDBC](https://www.baeldung.com/spring-jdbc-autogenerated-keys) - [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries) -- [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many) -- [Spring Persistence (Hibernate and JPA) with a JNDI datasource](https://www.baeldung.com/spring-persistence-hibernate-and-jpa-with-a-jndi-datasource-2) - +- More articles: [[next -->]](/spring-jpa-2) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From e176cc2d4226943d8c132fe3ca4f462bd5283747 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Tue, 4 Aug 2020 23:06:05 +0200 Subject: [PATCH 0354/1862] JAVA-1652: Get rid of the overriden spring-boot.version property --- spring-cloud/spring-cloud-zuul/pom.xml | 3 +-- .../spring-cloud-zuul/spring-zuul-post-filter/pom.xml | 4 ---- .../spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml | 2 -- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/spring-cloud/spring-cloud-zuul/pom.xml b/spring-cloud/spring-cloud-zuul/pom.xml index 140a1337b3..b3c66dd1c6 100644 --- a/spring-cloud/spring-cloud-zuul/pom.xml +++ b/spring-cloud/spring-cloud-zuul/pom.xml @@ -72,8 +72,7 @@
    - Hoxton.RELEASE - 2.2.2.RELEASE + Hoxton.SR4 diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-post-filter/pom.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-post-filter/pom.xml index 8643309645..0ca9f0d050 100644 --- a/spring-cloud/spring-cloud-zuul/spring-zuul-post-filter/pom.xml +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-post-filter/pom.xml @@ -18,8 +18,4 @@ - - Hoxton.SR1 - - \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml index fd6d18fc09..8873282d1e 100644 --- a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml @@ -48,8 +48,6 @@ - Finchley.SR1 - 2.0.6.RELEASE 2.2.0.RELEASE From e7ec3ff7bcfd8114b83aae8bb40735bd9bb90f14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Wed, 5 Aug 2020 03:45:26 +0200 Subject: [PATCH 0355/1862] [JAVA-2276] Disabled frontend-maven-plugin for default-first and default-second profiles (#9820) * [JAVA-2276] Upgraded maven-assembly-plugin version to 3.3.0 * [JAVA-2276] Disabling frontend-maven-plugin for default-first and default-second profiles --- jhipster-5/bookstore-monolith/pom.xml | 62 +++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/jhipster-5/bookstore-monolith/pom.xml b/jhipster-5/bookstore-monolith/pom.xml index 4e4c82f327..03395e47ed 100644 --- a/jhipster-5/bookstore-monolith/pom.xml +++ b/jhipster-5/bookstore-monolith/pom.xml @@ -1008,6 +1008,68 @@ + + default-first + + + + + com.github.eirslett + frontend-maven-plugin + + + + install node and npm + none + + + npm install + none + + + webpack build dev + none + + + webpack build test + none + + + + + + + + default-second + + + + + com.github.eirslett + frontend-maven-plugin + + + + install node and npm + none + + + npm install + none + + + webpack build dev + none + + + webpack build test + none + + + + + + From 5db4e332b91e64a967fd7042021a225ce6df3f3a Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Wed, 5 Aug 2020 15:07:34 +0530 Subject: [PATCH 0356/1862] Added New Classes BAEL-4193 NoSuchMethodError --- .../nosuchmethoderror/MainMenu.java | 20 +++++++++++++++++++ .../nosuchmethoderror/SpecialToday.java | 14 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java create mode 100644 core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java new file mode 100644 index 0000000000..aec70cb843 --- /dev/null +++ b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java @@ -0,0 +1,20 @@ +package com.baeldung.exceptions.nosuchmethoderror; + +import java.util.StringJoiner; + +public class MainMenu { + public static void main(String[] args) { + System.out.println("Today's Specials: " + getSpecials()); + } + + public static StringJoiner getSpecials() { + StringJoiner specials = new StringJoiner(", "); + try { + specials.add(SpecialToday.getStarter()); + specials.add(SpecialToday.getDesert()); + } catch (Exception e) { + e.printStackTrace(); + } + return specials; + } +} diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java new file mode 100644 index 0000000000..1f47a8934e --- /dev/null +++ b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java @@ -0,0 +1,14 @@ +package com.baeldung.exceptions.nosuchmethoderror; + +public class SpecialToday { + private static String desert = "Chocolate Cake"; + private static String starter = "Caesar Salad"; + + public static String getDesert() { + return desert; + } + + public static String getStarter() { + return starter; + } +} From 4c4cafde1eb732837f86fbb68581795cee758ac2 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Wed, 5 Aug 2020 15:16:51 +0530 Subject: [PATCH 0357/1862] Added New File(s) - BAEL-4193 NoSuchMethodError --- .../nosuchmethoderror/MainMenuUnitTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java diff --git a/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java new file mode 100644 index 0000000000..e9aef1b484 --- /dev/null +++ b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java @@ -0,0 +1,14 @@ +package com.baeldung.exceptions.nosuchmethoderror; + +import static org.junit.Assert.assertNotNull; + +import org.junit.jupiter.api.Test; + +class MainMenuUnitTest { + + @Test + void testgetSpecials() { + assertNotNull(MainMenu.getSpecials()); + } + +} From 4367410910e05cf1ad513bff1f720b6d55069eb3 Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Wed, 5 Aug 2020 10:47:13 -0500 Subject: [PATCH 0358/1862] Added pom packaging to module's pom --- maven-modules/optional-dependencies/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/maven-modules/optional-dependencies/pom.xml b/maven-modules/optional-dependencies/pom.xml index c1bfc6fb59..12d028b2d7 100644 --- a/maven-modules/optional-dependencies/pom.xml +++ b/maven-modules/optional-dependencies/pom.xml @@ -10,6 +10,7 @@ 4.0.0 optional-dependencies + pom optional-project project-with-optionals From f3740c95c333c5b01c1f8c59f494a1cd43c67eae Mon Sep 17 00:00:00 2001 From: mdhtr Date: Wed, 5 Aug 2020 18:53:22 +0200 Subject: [PATCH 0359/1862] Make fields private and use getters/setters/constructors instead --- .../JacksonDeserializationUnitTest.java | 12 ++-- .../jsonldjava/jackson/Person.java | 56 +++++++++++++++++-- .../HydraJsonldSerializationUnitTest.java | 4 +- .../serialization/hydrajsonld/Person.java | 17 +++++- .../JacksonJsonLdSerializationUnitTest.java | 2 +- .../serialization/jacksonjsonld/Person.java | 17 +++++- 6 files changed, 88 insertions(+), 20 deletions(-) diff --git a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java index 9c6b6f976a..24968f3847 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/JacksonDeserializationUnitTest.java @@ -42,14 +42,10 @@ public class JacksonDeserializationUnitTest { ObjectMapper objectMapper = new ObjectMapper(); Person person = objectMapper.readValue(compactContent, Person.class); - Person expectedPerson = new Person(); - expectedPerson.id = "http://example.com/person/1234"; - expectedPerson.name = "Example Name"; - expectedPerson.knows = new Link(); - expectedPerson.knows.id = "http://example.com/person/2345"; + Person expectedPerson = new Person("http://example.com/person/1234", "Example Name", new Link("http://example.com/person/2345")); - assertEquals(expectedPerson.id, person.id); - assertEquals(expectedPerson.name, person.name); - assertEquals(expectedPerson.knows.id, person.knows.id); + assertEquals(expectedPerson.getId(), person.getId()); + assertEquals(expectedPerson.getName(), person.getName()); + assertEquals(expectedPerson.getKnows().getId(), person.getKnows().getId()); } } diff --git a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java index 0cb6d43336..fefa676817 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java +++ b/json-2/src/test/java/com/baeldung/jsonld/deserialization/jsonldjava/jackson/Person.java @@ -6,14 +6,62 @@ import com.fasterxml.jackson.annotation.JsonProperty; @JsonIgnoreProperties(ignoreUnknown = true) public class Person { @JsonProperty("@id") - public String id; + private String id; @JsonProperty("http://schema.org/name") - public String name; + private String name; @JsonProperty("http://schema.org/knows") - public Link knows; + private Link knows; + + public Person() { + } + + public Person(String id, String name, Link knows) { + this.id = id; + this.name = name; + this.knows = knows; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Link getKnows() { + return knows; + } + + public void setKnows(Link knows) { + this.knows = knows; + } public static class Link { @JsonProperty("@id") - public String id; + private String id; + + public Link() { + } + + public Link(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } } } diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java index 06105d579e..33395cc438 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/HydraJsonldSerializationUnitTest.java @@ -23,9 +23,7 @@ public class HydraJsonldSerializationUnitTest { objectMapper.registerModule(getJacksonHydraSerializerModule()); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - Person person = new Person(); - person.id = "http://example.com/person/1234"; - person.name = "Example Name"; + Person person = new Person("http://example.com/person/1234", "Example Name"); String personJsonLd = objectMapper.writeValueAsString(person); diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java index 87587d02ac..3d8573c965 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/hydrajsonld/Person.java @@ -8,8 +8,21 @@ import de.escalon.hypermedia.hydra.mapping.Vocab; @Vocab("http://example.com/vocab/") @Expose("person") public class Person { + private String id; + private String name; + + public Person(String id, String name) { + this.id = id; + this.name = name; + } + @JsonProperty("@id") - public String id; + public String getId() { + return id; + } + @Expose("fullName") - public String name; + public String getName() { + return name; + } } diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java index cd41989a53..9679426acb 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/JacksonJsonLdSerializationUnitTest.java @@ -15,7 +15,7 @@ public class JacksonJsonLdSerializationUnitTest { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JsonldModule()); - Person person = new Person(); + Person person = new Person("http://example.com/person/1234", "Example Name"); String personJsonLd = objectMapper.writeValueAsString(person); assertEquals("{" diff --git a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java index d0c9e4f111..b63f49840c 100644 --- a/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java +++ b/json-2/src/test/java/com/baeldung/jsonld/serialization/jacksonjsonld/Person.java @@ -13,7 +13,20 @@ import ioinformarics.oss.jackson.module.jsonld.annotation.JsonldType; @JsonldLink(rel = "s:knows", name = "knows", href = "http://example.com/person/2345") public class Person { @JsonldId - public String id = "http://example.com/person/1234"; + private String id; @JsonldProperty("s:name") - public String name = "Example Name"; + private String name; + + public Person(String id, String name) { + this.id = id; + this.name = name; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } } From 18c7b3000e34bdd847cb1ef3eb8ece9f3d1eca08 Mon Sep 17 00:00:00 2001 From: mdabrowski-eu Date: Thu, 6 Aug 2020 00:08:27 +0200 Subject: [PATCH 0360/1862] BAEL-4405 move probability examples to java-numbers-4 --- java-numbers-4/pom.xml | 52 +++++++++++++++++++ .../probability/MaleHeightGenerator.java | 0 .../baeldung/probability/RandomInvoker.java | 0 .../probability/RandomInvokerUnitTest.java | 0 4 files changed, 52 insertions(+) create mode 100644 java-numbers-4/pom.xml rename {java-numbers-3 => java-numbers-4}/src/main/java/com/baeldung/probability/MaleHeightGenerator.java (100%) rename {java-numbers-3 => java-numbers-4}/src/main/java/com/baeldung/probability/RandomInvoker.java (100%) rename {java-numbers-3 => java-numbers-4}/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java (100%) diff --git a/java-numbers-4/pom.xml b/java-numbers-4/pom.xml new file mode 100644 index 0000000000..e1722fb039 --- /dev/null +++ b/java-numbers-4/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + java-numbers-4 + java-numbers-4 + jar + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + io.vavr + vavr + ${vavr.version} + + + org.apache.commons + commons-lang3 + ${commons.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + java-numbers-4 + + + src/main/resources + true + + + + + + 0.10.2 + 3.9 + 3.6.1 + + + diff --git a/java-numbers-3/src/main/java/com/baeldung/probability/MaleHeightGenerator.java b/java-numbers-4/src/main/java/com/baeldung/probability/MaleHeightGenerator.java similarity index 100% rename from java-numbers-3/src/main/java/com/baeldung/probability/MaleHeightGenerator.java rename to java-numbers-4/src/main/java/com/baeldung/probability/MaleHeightGenerator.java diff --git a/java-numbers-3/src/main/java/com/baeldung/probability/RandomInvoker.java b/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java similarity index 100% rename from java-numbers-3/src/main/java/com/baeldung/probability/RandomInvoker.java rename to java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java diff --git a/java-numbers-3/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java b/java-numbers-4/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java similarity index 100% rename from java-numbers-3/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java rename to java-numbers-4/src/test/java/com/baeldung/probability/RandomInvokerUnitTest.java From ca8dd7dbc7e56091f554ff98657cb9d7ab67c045 Mon Sep 17 00:00:00 2001 From: mdabrowski-eu Date: Thu, 6 Aug 2020 00:11:13 +0200 Subject: [PATCH 0361/1862] BAEL-4405 better names for parameters --- .../main/java/com/baeldung/probability/RandomInvoker.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java b/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java index 30be5725ab..66f82022ea 100644 --- a/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java +++ b/java-numbers-4/src/main/java/com/baeldung/probability/RandomInvoker.java @@ -8,12 +8,12 @@ import java.util.function.Supplier; public class RandomInvoker { private final Lazy random = Lazy.of(SplittableRandom::new); - public T withProbability(Supplier supplier1, Supplier supplier2, int probability) { + public T withProbability(Supplier positiveCase, Supplier negativeCase, int probability) { SplittableRandom random = this.random.get(); if (random.nextInt(1, 101) <= probability) { - return supplier1.get(); + return positiveCase.get(); } else { - return supplier2.get(); + return negativeCase.get(); } } } From 54796738f8d478c07358a11802e94715ff729b4b Mon Sep 17 00:00:00 2001 From: joe zhang Date: Thu, 6 Aug 2020 23:14:19 +0800 Subject: [PATCH 0362/1862] update unit test --- .../primitivetype/PrimitiveTypeUtil.java | 4 ++-- .../primitivetype/PrimitiveTypeUnitTest.java | 24 +++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java index 9607a0008f..ff70da1839 100644 --- a/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java +++ b/core-java-modules/core-java-lang-oop-types/src/main/java/com/baeldung/primitivetype/PrimitiveTypeUtil.java @@ -19,8 +19,8 @@ public class PrimitiveTypeUtil { WRAPPER_TYPE_MAP.put(Void.class, void.class); } - public boolean isPrimitiveType(Class sourceClass) { - return WRAPPER_TYPE_MAP.containsKey(sourceClass); + public static boolean isPrimitiveType(Object source) { + return WRAPPER_TYPE_MAP.containsKey(source.getClass()); } } diff --git a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUnitTest.java b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUnitTest.java index 5bbededbb3..b9152d3674 100644 --- a/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUnitTest.java +++ b/core-java-modules/core-java-lang-oop-types/src/test/java/com/baeldung/primitivetype/PrimitiveTypeUnitTest.java @@ -4,37 +4,31 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import org.apache.commons.lang3.ClassUtils; -import org.junit.Before; +import org.apache.commons.lang3.StringUtils; import org.junit.Test; import com.google.common.primitives.Primitives; public class PrimitiveTypeUnitTest { - private PrimitiveTypeUtil primitiveTypeUtil; - - @Before - public void setup() { - primitiveTypeUtil = new PrimitiveTypeUtil(); - } - @Test public void givenAClass_whenCheckWithPrimitiveTypeUtil_thenShouldValidate() { - assertTrue(primitiveTypeUtil.isPrimitiveType(Boolean.class)); - assertFalse(primitiveTypeUtil.isPrimitiveType(String.class)); + assertTrue(PrimitiveTypeUtil.isPrimitiveType(false)); + assertTrue(PrimitiveTypeUtil.isPrimitiveType(1L)); + assertFalse(PrimitiveTypeUtil.isPrimitiveType(StringUtils.EMPTY)); } @Test public void givenAClass_whenCheckWithCommonsLang_thenShouldValidate() { - assertTrue(ClassUtils.isPrimitiveOrWrapper(Boolean.class)); + assertTrue(ClassUtils.isPrimitiveOrWrapper(Boolean.FALSE.getClass())); assertTrue(ClassUtils.isPrimitiveOrWrapper(boolean.class)); - assertFalse(ClassUtils.isPrimitiveOrWrapper(String.class)); + assertFalse(ClassUtils.isPrimitiveOrWrapper(StringUtils.EMPTY.getClass())); } @Test public void givenAClass_whenCheckWithGuava_thenShouldValidate() { - assertTrue(Primitives.isWrapperType(Boolean.class)); - assertFalse(Primitives.isWrapperType(String.class)); - assertFalse(Primitives.isWrapperType(boolean.class)); + assertTrue(Primitives.isWrapperType(Boolean.FALSE.getClass())); + assertFalse(Primitives.isWrapperType(StringUtils.EMPTY.getClass())); + assertFalse(Primitives.isWrapperType(Boolean.TYPE.getClass())); } } From d444ab4d54a8aed35cc6be8cc5731df98d7388f7 Mon Sep 17 00:00:00 2001 From: karan Date: Thu, 6 Aug 2020 13:40:44 -0400 Subject: [PATCH 0363/1862] Fix formatting --- .../PathVariableAnnotationController.java | 136 +++++++++--------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java b/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java index 37e104f354..0cbd852095 100644 --- a/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java +++ b/spring-mvc-java-2/src/main/java/com/baeldung/pathvariable/PathVariableAnnotationController.java @@ -10,80 +10,80 @@ import java.util.Optional; @RestController public class PathVariableAnnotationController { - @GetMapping("/api/employees/{id}") - @ResponseBody - public String getEmployeesById(@PathVariable String id) { - return "ID: " + id; - } + @GetMapping("/api/employees/{id}") + @ResponseBody + public String getEmployeesById(@PathVariable String id) { + return "ID: " + id; + } - @GetMapping("/api/employeeswithvariable/{id}") - @ResponseBody - public String getEmployeesByIdWithVariableName(@PathVariable("id") String employeeId) { - return "ID: " + employeeId; - } + @GetMapping("/api/employeeswithvariable/{id}") + @ResponseBody + public String getEmployeesByIdWithVariableName(@PathVariable("id") String employeeId) { + return "ID: " + employeeId; + } - @GetMapping("/api/employees/{id}/{name}") - @ResponseBody - public String getEmployeesByIdAndName(@PathVariable String id, @PathVariable String name) { - return "ID: " + id + ", name: " + name; - } + @GetMapping("/api/employees/{id}/{name}") + @ResponseBody + public String getEmployeesByIdAndName(@PathVariable String id, @PathVariable String name) { + return "ID: " + id + ", name: " + name; + } - @GetMapping("/api/employeeswithmapvariable/{id}/{name}") - @ResponseBody - public String getEmployeesByIdAndNameWithMapVariable(@PathVariable Map pathVarsMap) { - String id = pathVarsMap.get("id"); - String name = pathVarsMap.get("name"); - if (id != null && name != null) { - return "ID: " + id + ", name: " + name; - } else { - return "Missing Parameters"; - } - } + @GetMapping("/api/employeeswithmapvariable/{id}/{name}") + @ResponseBody + public String getEmployeesByIdAndNameWithMapVariable(@PathVariable Map pathVarsMap) { + String id = pathVarsMap.get("id"); + String name = pathVarsMap.get("name"); + if (id != null && name != null) { + return "ID: " + id + ", name: " + name; + } else { + return "Missing Parameters"; + } + } - @GetMapping(value = { "/api/employeeswithrequired", "/api/employeeswithrequired/{id}" }) - @ResponseBody - public String getEmployeesByIdWithRequired(@PathVariable String id) { - return "ID: " + id; - } + @GetMapping(value = { "/api/employeeswithrequired", "/api/employeeswithrequired/{id}" }) + @ResponseBody + public String getEmployeesByIdWithRequired(@PathVariable String id) { + return "ID: " + id; + } - @GetMapping(value = { "/api/employeeswithrequiredfalse", "/api/employeeswithrequiredfalse/{id}" }) - @ResponseBody - public String getEmployeesByIdWithRequiredFalse(@PathVariable(required = false) String id) { - if (id != null) { - return "ID: " + id; - } else { - return "ID missing"; - } - } + @GetMapping(value = { "/api/employeeswithrequiredfalse", "/api/employeeswithrequiredfalse/{id}" }) + @ResponseBody + public String getEmployeesByIdWithRequiredFalse(@PathVariable(required = false) String id) { + if (id != null) { + return "ID: " + id; + } else { + return "ID missing"; + } + } - @GetMapping(value = { "/api/employeeswithoptional", "/api/employeeswithoptional/{id}" }) - @ResponseBody - public String getEmployeesByIdWithOptional(@PathVariable Optional id) { - if (id.isPresent()) { - return "ID: " + id.get(); - } else { - return "ID missing"; - } - } + @GetMapping(value = { "/api/employeeswithoptional", "/api/employeeswithoptional/{id}" }) + @ResponseBody + public String getEmployeesByIdWithOptional(@PathVariable Optional id) { + if (id.isPresent()) { + return "ID: " + id.get(); + } else { + return "ID missing"; + } + } - @GetMapping(value = { "/api/defaultemployeeswithoptional", "/api/defaultemployeeswithoptional/{id}" }) - @ResponseBody - public String getDefaultEmployeesByIdWithOptional(@PathVariable Optional id) { - if (id.isPresent()) { - return "ID: " + id.get(); - } else { - return "ID: Default Employee"; - } - } + @GetMapping(value = { "/api/defaultemployeeswithoptional", "/api/defaultemployeeswithoptional/{id}" }) + @ResponseBody + public String getDefaultEmployeesByIdWithOptional(@PathVariable Optional id) { + if (id.isPresent()) { + return "ID: " + id.get(); + } else { + return "ID: Default Employee"; + } + } - @GetMapping(value = { "/api/employeeswithmap/{id}", "/api/employeeswithmap" }) - @ResponseBody - public String getEmployeesByIdWithMap(@PathVariable Map pathVarsMap) { - String id = pathVarsMap.get("id"); - if (id != null) { - return "ID: " + id; - } else { - return "ID missing"; - } - } + @GetMapping(value = { "/api/employeeswithmap/{id}", "/api/employeeswithmap" }) + @ResponseBody + public String getEmployeesByIdWithMap(@PathVariable Map pathVarsMap) { + String id = pathVarsMap.get("id"); + if (id != null) { + return "ID: " + id; + } else { + return "ID missing"; + } + } } From d821719314e3d86cacb5bbb43eedb36fb5890e3e Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 6 Aug 2020 21:23:59 +0200 Subject: [PATCH 0364/1862] BAEL-4492: Use the prefered List.toArray() approach (#9831) --- .../java/collections/JavaCollectionConversionUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java index 4977c122e7..2fd31ab609 100644 --- a/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java +++ b/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java @@ -32,7 +32,7 @@ public class JavaCollectionConversionUnitTest { @Test public final void givenUsingCoreJava_whenListConvertedToArray_thenCorrect() { final List sourceList = Arrays.asList(0, 1, 2, 3, 4, 5); - final Integer[] targetArray = sourceList.toArray(new Integer[sourceList.size()]); + final Integer[] targetArray = sourceList.toArray(new Integer[0]); } @Test From fce53395e1ab473bbf486e68ac33bf927cc16fbf Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Fri, 7 Aug 2020 03:00:34 +0430 Subject: [PATCH 0365/1862] Applying TRW Blocks --- .../java/com/baeldung/jdbc/JdbcLiveTest.java | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java index da0c6bffe5..89fd3af864 100644 --- a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java @@ -1,26 +1,18 @@ package com.baeldung.jdbc; -import static org.junit.Assert.*; - -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Types; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.IntStream; - import org.apache.log4j.Logger; import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.sql.*; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.IntStream; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + public class JdbcLiveTest { private static final Logger LOG = Logger.getLogger(JdbcLiveTest.class); @@ -33,10 +25,11 @@ public class JdbcLiveTest { con = DriverManager.getConnection("jdbc:mysql://localhost:3306/myDb?noAccessToProcedureBodies=true", "user1", "pass"); - Statement stmt = con.createStatement(); + try (Statement stmt = con.createStatement()) { - String tableSql = "CREATE TABLE IF NOT EXISTS employees (emp_id int PRIMARY KEY AUTO_INCREMENT, name varchar(30), position varchar(30), salary double)"; - stmt.execute(tableSql); + String tableSql = "CREATE TABLE IF NOT EXISTS employees (emp_id int PRIMARY KEY AUTO_INCREMENT, name varchar(30), position varchar(30), salary double)"; + stmt.execute(tableSql); + } } @@ -101,10 +94,8 @@ public class JdbcLiveTest { @Test public void whenCallProcedure_thenCorrect() { - - try { - String preparedSql = "{call insertEmployee(?,?,?,?)}"; - CallableStatement cstmt = con.prepareCall(preparedSql); + String preparedSql = "{call insertEmployee(?,?,?,?)}"; + try(CallableStatement cstmt = con.prepareCall(preparedSql)) { cstmt.setString(2, "ana"); cstmt.setString(3, "tester"); cstmt.setDouble(4, 2000); @@ -121,9 +112,10 @@ public class JdbcLiveTest { public void whenReadMetadata_thenCorrect() throws SQLException { DatabaseMetaData dbmd = con.getMetaData(); - ResultSet tablesResultSet = dbmd.getTables(null, null, "%", null); - while (tablesResultSet.next()) { - LOG.info(tablesResultSet.getString("TABLE_NAME")); + try (ResultSet tablesResultSet = dbmd.getTables(null, null, "%", null)) { + while (tablesResultSet.next()) { + LOG.info(tablesResultSet.getString("TABLE_NAME")); + } } String selectSql = "SELECT * FROM employees"; From 2ca30645e8c95d1d0acd4db2573247adea883da3 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Fri, 7 Aug 2020 03:04:25 +0430 Subject: [PATCH 0366/1862] Polish --- .../test/java/com/baeldung/jdbc/JdbcLiveTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java index 89fd3af864..81179aade9 100644 --- a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java @@ -5,7 +5,16 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import java.sql.*; +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Types; import java.util.ArrayList; import java.util.List; import java.util.stream.IntStream; @@ -95,7 +104,7 @@ public class JdbcLiveTest { @Test public void whenCallProcedure_thenCorrect() { String preparedSql = "{call insertEmployee(?,?,?,?)}"; - try(CallableStatement cstmt = con.prepareCall(preparedSql)) { + try (CallableStatement cstmt = con.prepareCall(preparedSql)) { cstmt.setString(2, "ana"); cstmt.setString(3, "tester"); cstmt.setDouble(4, 2000); From 1b2f33e4d43cde6e3a411f0ada73dc398a94bffe Mon Sep 17 00:00:00 2001 From: mdabrowski-eu Date: Fri, 7 Aug 2020 20:55:22 +0200 Subject: [PATCH 0367/1862] BAEL-4405 add java-numbers-4 to main pom --- pom.xml | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 1db715147a..6b8e69080f 100644 --- a/pom.xml +++ b/pom.xml @@ -343,18 +343,18 @@ animal-sniffer-mvn-plugin annotations antlr - - apache-cxf - apache-libraries - apache-olingo/olingo2 - apache-poi + + apache-cxf + apache-libraries + apache-olingo/olingo2 + apache-poi apache-rocketmq - apache-shiro + apache-shiro apache-spark apache-tapestry apache-thrift apache-tika - apache-velocity + apache-velocity asciidoctor asm @@ -448,7 +448,8 @@ java-lite java-numbers java-numbers-2 - java-numbers-3 + java-numbers-3 + java-numbers-4 java-rmi java-spi java-vavr-stream @@ -858,18 +859,18 @@ animal-sniffer-mvn-plugin annotations antlr - - apache-cxf - apache-libraries - apache-olingo/olingo2 - apache-poi + + apache-cxf + apache-libraries + apache-olingo/olingo2 + apache-poi apache-rocketmq - apache-shiro + apache-shiro apache-spark apache-tapestry apache-thrift apache-tika - apache-velocity + apache-velocity asciidoctor asm @@ -962,6 +963,7 @@ java-numbers java-numbers-2 java-numbers-3 + java-numbers-4 java-rmi java-spi java-vavr-stream From 2679498f32546dfd50d0a04896a83a3ed07548ba Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Fri, 7 Aug 2020 22:13:33 -0500 Subject: [PATCH 0368/1862] BAEL-4387 Add the code inside a test --- .../ArrayToListConversion.java | 33 ------------------- .../ArrayToListConvertion.java | 32 ++++++++++++++++++ 2 files changed, 32 insertions(+), 33 deletions(-) delete mode 100644 java-collections-conversions-2/src/main/java/com/baeldung/arrayconvertion/ArrayToListConversion.java create mode 100644 java-collections-conversions-2/src/test/java/com/baeldung/arrayconvertion/ArrayToListConvertion.java diff --git a/java-collections-conversions-2/src/main/java/com/baeldung/arrayconvertion/ArrayToListConversion.java b/java-collections-conversions-2/src/main/java/com/baeldung/arrayconvertion/ArrayToListConversion.java deleted file mode 100644 index 7e1002b22c..0000000000 --- a/java-collections-conversions-2/src/main/java/com/baeldung/arrayconvertion/ArrayToListConversion.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.arrayconvertion; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class ArrayToListConversion { - - public static void main(String[] args) { - System.out.println("Array.asList()"); - arrayAsList(); - System.out.println("\nArrayList<>(Arrays.asList())"); - independentArray(); - } - - private static void arrayAsList() { - String[] stringArray = new String[] { "A", "B", "C", "D" }; - List stringList = Arrays.asList(stringArray); - System.out.println(stringList); // [A, B, C, D] - stringList.set(0, "E"); - System.out.println(stringList); // [E, B, C, D] - System.out.println(Arrays.toString(stringArray)); // [E, B, C, D] - } - - private static void independentArray() { - String[] stringArray = new String[] { "A", "B", "C", "D" }; - List stringList = new ArrayList<>(Arrays.asList(stringArray)); - System.out.println(stringList); // [A, B, C, D] - stringList.set(0, "E"); - System.out.println(stringList); // [E, B, C, D] - System.out.println(Arrays.toString(stringArray)); // [A, B, C, D] - } -} \ No newline at end of file diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconvertion/ArrayToListConvertion.java b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconvertion/ArrayToListConvertion.java new file mode 100644 index 0000000000..f0f3fda42e --- /dev/null +++ b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconvertion/ArrayToListConvertion.java @@ -0,0 +1,32 @@ +package com.baeldung.arrayconvertion; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class ArrayToListConvertion { + + @Test(expected = UnsupportedOperationException.class) + public void givenAnArray_whenConvertToList_returnUnmodifiableList() { + String[] stringArray = new String[] { "A", "B", "C", "D" }; + List stringList = Arrays.asList(stringArray); + System.out.println(stringList); + stringList.set(0, "E"); + System.out.println(stringList); + System.out.println(Arrays.toString(stringArray)); + stringList.add("F"); + } + + @Test + public void givenAnArray_whenConvertToList_returnModifiableList() { + String[] stringArray = new String[] { "A", "B", "C", "D" }; + List stringList = new ArrayList<>(Arrays.asList(stringArray)); + System.out.println(stringList); + stringList.set(0, "E"); + System.out.println(stringList); + System.out.println(Arrays.toString(stringArray)); + stringList.add("F"); + } +} From c5326ca2e81eb37864b4afb802df6e6815faceef Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:02:52 +0530 Subject: [PATCH 0369/1862] BAEL-4408 Adding files for BAEL-4408 --- .../src/main/webapp/WEB-INF/jsp/main.jsp | 15 +++++++++++++++ .../src/main/webapp/WEB-INF/jsp/update.jsp | 17 +++++++++++++++++ .../src/main/webapp/WEB-INF/jsp/userlogin.jsp | 18 ++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 javax-servlets/src/main/webapp/WEB-INF/jsp/main.jsp create mode 100644 javax-servlets/src/main/webapp/WEB-INF/jsp/update.jsp create mode 100644 javax-servlets/src/main/webapp/WEB-INF/jsp/userlogin.jsp diff --git a/javax-servlets/src/main/webapp/WEB-INF/jsp/main.jsp b/javax-servlets/src/main/webapp/WEB-INF/jsp/main.jsp new file mode 100644 index 0000000000..cbbb578770 --- /dev/null +++ b/javax-servlets/src/main/webapp/WEB-INF/jsp/main.jsp @@ -0,0 +1,15 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + +
    +

    Enter your User Id and Password

    + User ID:
    + Password:
    +
    + + \ No newline at end of file diff --git a/javax-servlets/src/main/webapp/WEB-INF/jsp/update.jsp b/javax-servlets/src/main/webapp/WEB-INF/jsp/update.jsp new file mode 100644 index 0000000000..36ac2d277b --- /dev/null +++ b/javax-servlets/src/main/webapp/WEB-INF/jsp/update.jsp @@ -0,0 +1,17 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + Hi, User : ${sessionData.getAttribute("userId")} + +
    Your User Data has been updated as below : +
    User Name: ${sessionData.getAttribute("userName")} +
    Age : ${sessionData.getAttribute("age")} + + + \ No newline at end of file diff --git a/javax-servlets/src/main/webapp/WEB-INF/jsp/userlogin.jsp b/javax-servlets/src/main/webapp/WEB-INF/jsp/userlogin.jsp new file mode 100644 index 0000000000..f181222f39 --- /dev/null +++ b/javax-servlets/src/main/webapp/WEB-INF/jsp/userlogin.jsp @@ -0,0 +1,18 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + +

    Update your User Details:

    + +
    + User ID:
    User Name: + Age:
    +
    + + \ No newline at end of file From b81350cfae15e523f9673c410182e68ce6f858aa Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:05:45 +0530 Subject: [PATCH 0370/1862] BAEL-4408 BAEL-4408 files added --- .../com/baeldung/servlets/MainServlet.java | 22 ++++++++++++++ .../com/baeldung/servlets/UpdateServlet.java | 30 +++++++++++++++++++ .../baeldung/servlets/UserLoginServlet.java | 30 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 javax-servlets/src/main/java/com/baeldung/servlets/MainServlet.java create mode 100644 javax-servlets/src/main/java/com/baeldung/servlets/UpdateServlet.java create mode 100644 javax-servlets/src/main/java/com/baeldung/servlets/UserLoginServlet.java diff --git a/javax-servlets/src/main/java/com/baeldung/servlets/MainServlet.java b/javax-servlets/src/main/java/com/baeldung/servlets/MainServlet.java new file mode 100644 index 0000000000..d4417b0b4e --- /dev/null +++ b/javax-servlets/src/main/java/com/baeldung/servlets/MainServlet.java @@ -0,0 +1,22 @@ +package com.baeldung.servlets; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet("/main") +public class MainServlet extends HttpServlet { + + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + response.sendRedirect("main.jsp"); + } + + + + +} diff --git a/javax-servlets/src/main/java/com/baeldung/servlets/UpdateServlet.java b/javax-servlets/src/main/java/com/baeldung/servlets/UpdateServlet.java new file mode 100644 index 0000000000..d0404d0cd4 --- /dev/null +++ b/javax-servlets/src/main/java/com/baeldung/servlets/UpdateServlet.java @@ -0,0 +1,30 @@ +package com.baeldung.servlets; + + +import java.io.IOException; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +@WebServlet("/update") +public class UpdateServlet extends HttpServlet { + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + + HttpSession session = request.getSession(false); + + session.setAttribute("userName", request.getParameter("userName")); + session.setAttribute("age", request.getParameter("age")); + + request.setAttribute("sessionData", session); + RequestDispatcher requestDispather = request.getRequestDispatcher("update.jsp"); + + requestDispather.forward(request, response); + } + +} diff --git a/javax-servlets/src/main/java/com/baeldung/servlets/UserLoginServlet.java b/javax-servlets/src/main/java/com/baeldung/servlets/UserLoginServlet.java new file mode 100644 index 0000000000..6becf04a0c --- /dev/null +++ b/javax-servlets/src/main/java/com/baeldung/servlets/UserLoginServlet.java @@ -0,0 +1,30 @@ +package com.baeldung.servlets; + + +import java.io.IOException; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +@WebServlet("/u_login") +public class UserLoginServlet extends HttpServlet { + + protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + HttpSession session = request.getSession(); + + session.setAttribute("userId", request.getParameter("userId")); + + request.setAttribute("id", session.getAttribute("userId")); + + RequestDispatcher requestDispather = request.getRequestDispatcher("userlogin.jsp"); + + requestDispather.forward(request, response); + + } + +} From 93bbd7881c09ea97c91cdcced2cae6cbbf920f97 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:06:35 +0530 Subject: [PATCH 0371/1862] README.md updated with BAEL-4408 --- javax-servlets/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/javax-servlets/README.md b/javax-servlets/README.md index 7dbe1a02ad..54f92064a0 100644 --- a/javax-servlets/README.md +++ b/javax-servlets/README.md @@ -12,3 +12,4 @@ This module contains articles about Servlets. - [Jakarta EE Servlet Exception Handling](https://www.baeldung.com/servlet-exceptions) - [Context and Servlet Initialization Parameters](https://www.baeldung.com/context-servlet-initialization-param) - [The Difference between getRequestURI and getPathInfo in HttpServletRequest](https://www.baeldung.com/http-servlet-request-requesturi-pathinfo) +- Difference between request.getSession() and request.getSession(true) From a904f90ffcc1b0678236313cebf06d4b8994c008 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:10:20 +0530 Subject: [PATCH 0372/1862] Delete FirstServlet.java --- .../baeldung/httpsession/FirstServlet.java | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 spring-session/http-session-example/src/main/java/com/baeldung/httpsession/FirstServlet.java diff --git a/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/FirstServlet.java b/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/FirstServlet.java deleted file mode 100644 index 950bea2c07..0000000000 --- a/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/FirstServlet.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.httpsession; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -public class FirstServlet extends HttpServlet { - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - try { - HttpSession session = request.getSession(); - response.setContentType("text/html"); - PrintWriter out = response.getWriter(); - - String name = request.getParameter("userName"); - session.setAttribute("uname", name); - out.println("Hi " + name + " Your Session Id is : " + session.getId() + " "); - - out.println("
    Second Servlet"); - - out.close(); - - } catch (Exception e) { - System.out.println(e); - } - } - -} From 2db04e302f98867c2902a5dc26fcddcfe4af74b6 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:10:35 +0530 Subject: [PATCH 0373/1862] Delete SecondServlet.java --- .../baeldung/httpsession/SecondServlet.java | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 spring-session/http-session-example/src/main/java/com/baeldung/httpsession/SecondServlet.java diff --git a/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/SecondServlet.java b/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/SecondServlet.java deleted file mode 100644 index 6a5ef7e9a8..0000000000 --- a/spring-session/http-session-example/src/main/java/com/baeldung/httpsession/SecondServlet.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.httpsession; - -import java.io.IOException; -import java.io.PrintWriter; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -public class SecondServlet extends HttpServlet { - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - try { - - response.setContentType("text/html"); - PrintWriter out = response.getWriter(); - - HttpSession session = request.getSession(true); - String name = (String) session.getAttribute("uname"); - out.println("Hi " + name + " Your Session Id is : " + session.getId()); - - out.close(); - - } catch (Exception e) { - System.out.println(e); - } - } - -} From 3c3b38df33f1102f6c7b9cb632096f6d4adb0d1d Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:11:04 +0530 Subject: [PATCH 0374/1862] Delete index.html --- .../http-session-example/src/main/webapp/index.html | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 spring-session/http-session-example/src/main/webapp/index.html diff --git a/spring-session/http-session-example/src/main/webapp/index.html b/spring-session/http-session-example/src/main/webapp/index.html deleted file mode 100644 index 0e5889f21a..0000000000 --- a/spring-session/http-session-example/src/main/webapp/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -
    - Name:

    -
    - - \ No newline at end of file From efac1811a34ca78fcb1320a123bfa07761fc03dc Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:11:30 +0530 Subject: [PATCH 0375/1862] Delete web.xml --- .../src/main/webapp/WEB-INF/web.xml | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 spring-session/http-session-example/src/main/webapp/WEB-INF/web.xml diff --git a/spring-session/http-session-example/src/main/webapp/WEB-INF/web.xml b/spring-session/http-session-example/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 2c9a4c118b..0000000000 --- a/spring-session/http-session-example/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - httpsession - - index.html - - - - - FirstServlet - com.baeldung.httpsession.FirstServlet - - - SecondServlet - com.baeldung.httpsession.SecondServlet - - - - - FirstServlet - /first - - - SecondServlet - /second - - - - \ No newline at end of file From 14d522372d6099aa4e92524cffd89ff0eca92732 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:12:12 +0530 Subject: [PATCH 0376/1862] Delete README.md --- spring-session/http-session-example/README.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 spring-session/http-session-example/README.md diff --git a/spring-session/http-session-example/README.md b/spring-session/http-session-example/README.md deleted file mode 100644 index 95c7a41e2d..0000000000 --- a/spring-session/http-session-example/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## HttpSession - -This module contains article about Difference Between request.getSession() and request.getSession(true) - -### Relevant Articles: From 257b130ec2667fc18da4eb33a801f284b408f348 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:12:25 +0530 Subject: [PATCH 0377/1862] Delete pom.xml --- spring-session/http-session-example/pom.xml | 26 --------------------- 1 file changed, 26 deletions(-) delete mode 100644 spring-session/http-session-example/pom.xml diff --git a/spring-session/http-session-example/pom.xml b/spring-session/http-session-example/pom.xml deleted file mode 100644 index a77176fb4b..0000000000 --- a/spring-session/http-session-example/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - 4.0.0 - com.baeldung.httpsession - http-session-example - war - 0.0.1-SNAPSHOT - http-session-example Maven Webapp - http://maven.apache.org - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 - - - - javax.servlet - servlet-api - 2.5 - provided - - - From 82651842c78debe7be84f9101c529d6ac1ff4477 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:13:05 +0530 Subject: [PATCH 0378/1862] Update README.md Removing BAEL-4408 from Readme.md --- spring-session/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-session/README.md b/spring-session/README.md index 47125a6032..65040ec734 100644 --- a/spring-session/README.md +++ b/spring-session/README.md @@ -6,4 +6,3 @@ This module contains articles about Spring Session - [Guide to Spring Session](https://www.baeldung.com/spring-session) - [Spring Session with JDBC](https://www.baeldung.com/spring-session-jdbc) - [Spring Session with MongoDB](https://www.baeldung.com/spring-session-mongodb) -- Difference Between request.getSession() and request.getSession(true) From 5e0e587888663d5972cd556707290901e64d1ce0 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 8 Aug 2020 15:15:01 +0530 Subject: [PATCH 0379/1862] Update pom.xml Removing BAEL-4408 module from pom --- spring-session/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-session/pom.xml b/spring-session/pom.xml index d5dbe28a2b..6616a0d1f3 100644 --- a/spring-session/pom.xml +++ b/spring-session/pom.xml @@ -19,7 +19,6 @@ spring-session-jdbc spring-session-redis spring-session-mongodb - http-session-example
    From 15e94bb577c8895f1ed720284c95c3b3a0609da5 Mon Sep 17 00:00:00 2001 From: Rando Shtishi <42577665+rshtishi@users.noreply.github.com> Date: Sat, 8 Aug 2020 22:21:57 +0200 Subject: [PATCH 0380/1862] BAEL-4230 - Adding Introduction to Spring Data JDBC Project (#9665) --- persistence-modules/pom.xml | 4 ++ persistence-modules/spring-data-jdbc/pom.xml | 29 +++++++++ .../springdatajdbcintro/Application.java | 59 +++++++++++++++++++ .../springdatajdbcintro/DatabaseSeeder.java | 26 ++++++++ .../springdatajdbcintro/entity/Person.java | 57 ++++++++++++++++++ .../repository/PersonRepository.java | 23 ++++++++ .../src/main/resources/application.properties | 8 +++ .../src/main/resources/schema.sql | 5 ++ pom.xml | 2 +- 9 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 persistence-modules/spring-data-jdbc/pom.xml create mode 100644 persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/Application.java create mode 100644 persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/DatabaseSeeder.java create mode 100644 persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/entity/Person.java create mode 100644 persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/repository/PersonRepository.java create mode 100644 persistence-modules/spring-data-jdbc/src/main/resources/application.properties create mode 100644 persistence-modules/spring-data-jdbc/src/main/resources/schema.sql diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 31b9aaaf6d..78f1afd39a 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -59,12 +59,16 @@ spring-data-elasticsearch spring-data-gemfire spring-data-geode + spring-data-jpa-annotations spring-data-jpa-crud spring-data-jpa-enterprise spring-data-jpa-filtering spring-data-jpa-query spring-data-jpa-repo + + spring-data-jdbc + spring-data-keyvalue spring-data-mongodb spring-data-neo4j diff --git a/persistence-modules/spring-data-jdbc/pom.xml b/persistence-modules/spring-data-jdbc/pom.xml new file mode 100644 index 0000000000..ff034104d7 --- /dev/null +++ b/persistence-modules/spring-data-jdbc/pom.xml @@ -0,0 +1,29 @@ + + 4.0.0 + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + spring-data-jdbc + spring-data-jdbc + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-data-jdbc + + + com.h2database + h2 + runtime + + + diff --git a/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/Application.java b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/Application.java new file mode 100644 index 0000000000..7f50aa87f1 --- /dev/null +++ b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/Application.java @@ -0,0 +1,59 @@ +package com.baeldung.springdatajdbcintro; + +import java.util.Optional; + +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +import com.baeldung.springdatajdbcintro.entity.Person; +import com.baeldung.springdatajdbcintro.repository.PersonRepository; + +import ch.qos.logback.classic.Logger; + +@SpringBootApplication +public class Application implements CommandLineRunner { + + private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(Application.class); + + @Autowired + private PersonRepository repository; + @Autowired + private DatabaseSeeder dbSeeder; + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + + @Override + public void run(String... arg0) throws Exception { + + LOGGER.info("@@ Inserting Data...."); + dbSeeder.insertData(); + LOGGER.info("@@ findAll() call..."); + repository.findAll() + .forEach(person -> LOGGER.info(person.toString())); + LOGGER.info("@@ findById() call..."); + Optional optionalPerson = repository.findById(1L); + optionalPerson.ifPresent(person -> LOGGER.info(person.toString())); + LOGGER.info("@@ save() call..."); + Person newPerson = new Person("Franz", "Kafka"); + Person result = repository.save(newPerson); + LOGGER.info(result.toString()); + LOGGER.info("@@ delete"); + optionalPerson.ifPresent(person -> repository.delete(person)); + LOGGER.info("@@ findAll() call..."); + repository.findAll() + .forEach(person -> LOGGER.info(person.toString())); + LOGGER.info("@@ findByFirstName() call..."); + repository.findByFirstName("Franz") + .forEach(person -> LOGGER.info(person.toString())); + LOGGER.info("@@ findByFirstName() call..."); + repository.updateByFirstName(2L, "Date Inferno"); + repository.findAll() + .forEach(person -> LOGGER.info(person.toString())); + + } +} diff --git a/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/DatabaseSeeder.java b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/DatabaseSeeder.java new file mode 100644 index 0000000000..97055fd7ac --- /dev/null +++ b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/DatabaseSeeder.java @@ -0,0 +1,26 @@ +package com.baeldung.springdatajdbcintro; + +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Component; + +import ch.qos.logback.classic.Logger; + +@Component +public class DatabaseSeeder { + + private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(DatabaseSeeder.class); + + @Autowired + private JdbcTemplate jdbcTemplate; + + public void insertData() { + LOGGER.info("> Inserting data..."); + jdbcTemplate.execute("INSERT INTO Person(first_name,last_name) VALUES('Victor', 'Hygo')"); + jdbcTemplate.execute("INSERT INTO Person(first_name,last_name) VALUES('Dante', 'Alighieri')"); + jdbcTemplate.execute("INSERT INTO Person(first_name,last_name) VALUES('Stefan', 'Zweig')"); + jdbcTemplate.execute("INSERT INTO Person(first_name,last_name) VALUES('Oscar', 'Wilde')"); + } + +} diff --git a/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/entity/Person.java b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/entity/Person.java new file mode 100644 index 0000000000..7c4c1eec73 --- /dev/null +++ b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/entity/Person.java @@ -0,0 +1,57 @@ +package com.baeldung.springdatajdbcintro.entity; + +import org.springframework.data.annotation.Id; + +public class Person { + + @Id + private long id; + private String firstName; + private String lastName; + + public Person() { + super(); + } + + public Person(long id, String firstName, String lastName) { + super(); + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + } + + public Person(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @Override + public String toString() { + return "Person [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + "]"; + } + +} diff --git a/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/repository/PersonRepository.java b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/repository/PersonRepository.java new file mode 100644 index 0000000000..2f2329caec --- /dev/null +++ b/persistence-modules/spring-data-jdbc/src/main/java/com/baeldung/springdatajdbcintro/repository/PersonRepository.java @@ -0,0 +1,23 @@ +package com.baeldung.springdatajdbcintro.repository; + +import java.util.List; + +import org.springframework.data.jdbc.repository.query.Modifying; +import org.springframework.data.jdbc.repository.query.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +import com.baeldung.springdatajdbcintro.entity.Person; + +@Repository +public interface PersonRepository extends CrudRepository { + + @Query("select * from person where first_name=:firstName") + List findByFirstName(@Param("firstName") String firstName); + + @Modifying + @Query("UPDATE person SET first_name = :name WHERE id = :id") + boolean updateByFirstName(@Param("id") Long id, @Param("name") String name); + +} diff --git a/persistence-modules/spring-data-jdbc/src/main/resources/application.properties b/persistence-modules/spring-data-jdbc/src/main/resources/application.properties new file mode 100644 index 0000000000..45099222fc --- /dev/null +++ b/persistence-modules/spring-data-jdbc/src/main/resources/application.properties @@ -0,0 +1,8 @@ +#H2 DB +spring.jpa.hibernate.ddl-auto=none +spring.h2.console.enabled=true +spring.datasource.url=jdbc:h2:mem:persondb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=test +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect \ No newline at end of file diff --git a/persistence-modules/spring-data-jdbc/src/main/resources/schema.sql b/persistence-modules/spring-data-jdbc/src/main/resources/schema.sql new file mode 100644 index 0000000000..5618822bf9 --- /dev/null +++ b/persistence-modules/spring-data-jdbc/src/main/resources/schema.sql @@ -0,0 +1,5 @@ +create table person ( + id integer identity primary key, + first_name varchar(30), + last_name varchar(30) +); \ No newline at end of file diff --git a/pom.xml b/pom.xml index b110cb0fe0..a69ffa2798 100644 --- a/pom.xml +++ b/pom.xml @@ -1407,4 +1407,4 @@ 1.4.197
    - + \ No newline at end of file From 87111ea998379a1e94b76304b77f0aabab59cfd5 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Sat, 8 Aug 2020 22:41:01 +0200 Subject: [PATCH 0381/1862] BAEL-4493: Use the prefered Set.toArray() approach (#9837) --- .../collections/JavaCollectionConversionUnitTest.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java index 2fd31ab609..ba640f3fb2 100644 --- a/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java +++ b/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java @@ -72,7 +72,7 @@ public class JavaCollectionConversionUnitTest { @Test public final void givenUsingCoreJava_whenSetConvertedToArray_thenCorrect() { final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); - final Integer[] targetArray = sourceSet.toArray(new Integer[sourceSet.size()]); + final Integer[] targetArray = sourceSet.toArray(new Integer[0]); } @Test @@ -94,16 +94,10 @@ public class JavaCollectionConversionUnitTest { CollectionUtils.addAll(targetSet, sourceArray); } - @Test - public final void givenUsingCommonsCollections_whenSetConvertedToArray_thenCorrect() { - final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); - final Integer[] targetArray = sourceSet.toArray(new Integer[sourceSet.size()]); - } - @Test public final void givenUsingCommonsCollections_whenSetConvertedToArrayOfPrimitives_thenCorrect() { final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); - final Integer[] targetArray = sourceSet.toArray(new Integer[sourceSet.size()]); + final Integer[] targetArray = sourceSet.toArray(new Integer[0]); final int[] primitiveTargetArray = ArrayUtils.toPrimitive(targetArray); } From 099b9e9121b7f180fe00697624019cf18720cdbc Mon Sep 17 00:00:00 2001 From: Oussama BEN MAHMOUD Date: Sun, 9 Aug 2020 02:05:27 +0200 Subject: [PATCH 0382/1862] BAEL-4392: Java Files Open Options --- .../openoptions/OpenOptionsUnitTest.java | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/openoptions/OpenOptionsUnitTest.java diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/openoptions/OpenOptionsUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/openoptions/OpenOptionsUnitTest.java new file mode 100644 index 0000000000..323c965edf --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/openoptions/OpenOptionsUnitTest.java @@ -0,0 +1,96 @@ +package com.baeldung.openoptions; + +import org.hamcrest.CoreMatchers; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; + +import static org.junit.Assert.*; + +public class OpenOptionsUnitTest { + + private static final String HOME = System.getProperty("user.home"); + private static final String DUMMY_FILE_NAME = "sample.txt"; + private static final String EXISTING_FILE_NAME = "existingFile.txt"; + + private static final String DUMMY_TEXT = "This is a sample text."; + private static final String ANOTHER_DUMMY_TEXT = "This is a another text."; + + @BeforeClass + public static void beforeAll() throws IOException { + Path path = Paths.get(HOME, DUMMY_FILE_NAME); + + try (OutputStream out = Files.newOutputStream(path)) { + out.write(DUMMY_TEXT.getBytes()); + } + + Files.createFile(Paths.get(HOME, EXISTING_FILE_NAME)); + } + + @AfterClass + public static void afterAll() throws IOException { + Files.delete(Paths.get(HOME, "newfile.txt")); + Files.delete(Paths.get(HOME, "sparse.txt")); + Files.delete(Paths.get(HOME, DUMMY_FILE_NAME)); + } + + @Test + public void givenExistingPath_whenCreateNewFile_thenCorrect() throws IOException { + Path path = Paths.get(HOME, "newfile.txt"); + assertFalse(Files.exists(path)); + + Files.write(path, DUMMY_TEXT.getBytes(), StandardOpenOption.CREATE); + assertTrue(Files.exists(path)); + } + + @Test + public void givenExistingPath_whenReadExistingFile_thenCorrect() throws IOException { + Path path = Paths.get(HOME, DUMMY_FILE_NAME); + + try (InputStream in = Files.newInputStream(path); BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { + String line; + while ((line = reader.readLine()) != null) { + assertThat(line, CoreMatchers.containsString(DUMMY_TEXT)); + } + } + } + + @Test + public void givenExistingPath_whenWriteToExistingFile_thenCorrect() throws IOException { + Path path = Paths.get(HOME, DUMMY_FILE_NAME); + + try (OutputStream out = Files.newOutputStream(path, StandardOpenOption.APPEND, StandardOpenOption.WRITE)) { + out.write(ANOTHER_DUMMY_TEXT.getBytes()); + } + } + + @Test + public void givenExistingPath_whenCreateSparseFile_thenCorrect() throws IOException { + Path path = Paths.get(HOME, "sparse.txt"); + Files.write(path, DUMMY_TEXT.getBytes(), StandardOpenOption.CREATE_NEW, StandardOpenOption.SPARSE); + } + + @Test + public void givenExistingPath_whenDeleteOnClose_thenCorrect() throws IOException { + Path path = Paths.get(HOME, EXISTING_FILE_NAME); + assertTrue(Files.exists(path)); // file was already created and exists + + try (OutputStream out = Files.newOutputStream(path, StandardOpenOption.APPEND, StandardOpenOption.WRITE, StandardOpenOption.DELETE_ON_CLOSE)) { + out.write(ANOTHER_DUMMY_TEXT.getBytes()); + } + + assertFalse(Files.exists(path)); // file is deleted + } + + @Test + public void givenExistingPath_whenWriteAndSync_thenCorrect() throws IOException { + Path path = Paths.get(HOME, DUMMY_FILE_NAME); + Files.write(path, ANOTHER_DUMMY_TEXT.getBytes(), StandardOpenOption.APPEND, StandardOpenOption.WRITE, StandardOpenOption.SYNC); + } +} From d50a83197279a0fda143ac3f1bc66025c5873b42 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Sat, 8 Aug 2020 21:05:32 -0400 Subject: [PATCH 0383/1862] BAEL-4077 Fixup styling --- .../baeldung/jpa/equality/EqualByBusinessKey.java | 14 ++++++++------ .../java/com/baeldung/jpa/equality/EqualById.java | 13 +++++++------ .../baeldung/jpa/equality/EqualByJavaDefault.java | 4 +--- .../baeldung/jpa/equality/EqualityUnitTest.java | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java index 3e34f97d77..655db4e575 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java @@ -40,15 +40,17 @@ public class EqualByBusinessKey { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (obj instanceof EqualByBusinessKey) - if (((EqualByBusinessKey) obj).getEmail() == getEmail()) + } + if (obj instanceof EqualByBusinessKey) { + if (((EqualByBusinessKey) obj).getEmail() == getEmail()) { return true; - + } + } return false; } - } diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java index f29a152f3e..cebfb5fcec 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java @@ -41,14 +41,15 @@ public class EqualById { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (obj instanceof EqualById) - return ((EqualById) obj).getId() == getId(); - + } + if (obj instanceof EqualById) { + return ((EqualById) obj).getId().equals(getId()); + } return false; } - } diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java index 04a81865c6..b312845b61 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java @@ -30,9 +30,7 @@ public class EqualByJavaDefault implements Cloneable{ this.email = email; } - public Object clone() throws - CloneNotSupportedException - { + public Object clone() throws CloneNotSupportedException { return super.clone(); } } diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java index c672c9e460..03ac11b6fd 100644 --- a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java +++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java @@ -71,4 +71,4 @@ public class EqualityUnitTest { Assert.assertEquals(object1, object2); Assert.assertNotEquals(object1.getId(), object2.getId()); } -} \ No newline at end of file +} From 18d7fc0bdc5b9b6b7f3de538a0a91485008df700 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Sat, 8 Aug 2020 21:05:32 -0400 Subject: [PATCH 0384/1862] BAEL-4077 Fixup styling --- persistence-modules/java-jpa-3/pom.xml | 56 ------------------- .../jpa/equality/EqualByBusinessKey.java | 14 +++-- .../com/baeldung/jpa/equality/EqualById.java | 13 +++-- .../jpa/equality/EqualByJavaDefault.java | 4 +- .../jpa/equality/EqualityUnitTest.java | 2 +- 5 files changed, 17 insertions(+), 72 deletions(-) diff --git a/persistence-modules/java-jpa-3/pom.xml b/persistence-modules/java-jpa-3/pom.xml index 562f337215..da18ae3046 100644 --- a/persistence-modules/java-jpa-3/pom.xml +++ b/persistence-modules/java-jpa-3/pom.xml @@ -66,62 +66,6 @@ -proc:none - - org.bsc.maven - maven-processor-plugin - ${maven-processor-plugin.version} - - - process - - process - - generate-sources - - target/metamodel - - org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - ${build-helper-maven-plugin.version} - - - add-source - generate-sources - - add-source - - - - target/metamodel - ${project.build.directory}/generated-sources/java/ - - - - - - - com.mysema.maven - apt-maven-plugin - 1.1.3 - - - - process - - - target/generated-sources/java - com.querydsl.apt.jpa.JPAAnnotationProcessor - - - - diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java index 3e34f97d77..655db4e575 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java @@ -40,15 +40,17 @@ public class EqualByBusinessKey { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (obj instanceof EqualByBusinessKey) - if (((EqualByBusinessKey) obj).getEmail() == getEmail()) + } + if (obj instanceof EqualByBusinessKey) { + if (((EqualByBusinessKey) obj).getEmail() == getEmail()) { return true; - + } + } return false; } - } diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java index f29a152f3e..cebfb5fcec 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualById.java @@ -41,14 +41,15 @@ public class EqualById { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (obj instanceof EqualById) - return ((EqualById) obj).getId() == getId(); - + } + if (obj instanceof EqualById) { + return ((EqualById) obj).getId().equals(getId()); + } return false; } - } diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java index 04a81865c6..b312845b61 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByJavaDefault.java @@ -30,9 +30,7 @@ public class EqualByJavaDefault implements Cloneable{ this.email = email; } - public Object clone() throws - CloneNotSupportedException - { + public Object clone() throws CloneNotSupportedException { return super.clone(); } } diff --git a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java index c672c9e460..03ac11b6fd 100644 --- a/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java +++ b/persistence-modules/java-jpa-3/src/test/java/com/baeldung/jpa/equality/EqualityUnitTest.java @@ -71,4 +71,4 @@ public class EqualityUnitTest { Assert.assertEquals(object1, object2); Assert.assertNotEquals(object1.getId(), object2.getId()); } -} \ No newline at end of file +} From 164957ad0ab5baf72a686ef26851b15f6aaeb161 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Sun, 9 Aug 2020 11:38:50 +0430 Subject: [PATCH 0385/1862] Improvement for Spring Boot Exit Codes --- ...ExceptionExitCodeGeneratorApplication.java | 21 +++++++++++++++++++ .../FailedToStartException.java | 11 ++++++++++ 2 files changed, 32 insertions(+) create mode 100644 spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exceptionexitgen/ExceptionExitCodeGeneratorApplication.java create mode 100644 spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exceptionexitgen/FailedToStartException.java diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exceptionexitgen/ExceptionExitCodeGeneratorApplication.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exceptionexitgen/ExceptionExitCodeGeneratorApplication.java new file mode 100644 index 0000000000..a4ccb61dbb --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exceptionexitgen/ExceptionExitCodeGeneratorApplication.java @@ -0,0 +1,21 @@ +package com.baeldung.exitcode.exceptionexitgen; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class ExceptionExitCodeGeneratorApplication { + + public static void main(String[] args) { + SpringApplication.run(ExceptionExitCodeGeneratorApplication.class, args); + } + + @Bean + CommandLineRunner failApplication() { + return args -> { + throw new FailedToStartException(); + }; + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exceptionexitgen/FailedToStartException.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exceptionexitgen/FailedToStartException.java new file mode 100644 index 0000000000..04ac553153 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exceptionexitgen/FailedToStartException.java @@ -0,0 +1,11 @@ +package com.baeldung.exitcode.exceptionexitgen; + +import org.springframework.boot.ExitCodeGenerator; + +public class FailedToStartException extends RuntimeException implements ExitCodeGenerator { + + @Override + public int getExitCode() { + return 127; + } +} From 2453a731ca25192bb116554faf1d3cb133f33760 Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 9 Aug 2020 19:35:21 +0530 Subject: [PATCH 0386/1862] make folder name and artifactId same --- jhipster-5/bookstore-monolith/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jhipster-5/bookstore-monolith/pom.xml b/jhipster-5/bookstore-monolith/pom.xml index 03395e47ed..c965fd962d 100644 --- a/jhipster-5/bookstore-monolith/pom.xml +++ b/jhipster-5/bookstore-monolith/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.baeldung.jhipster5 - bookstore + bookstore-monolith 0.0.1-SNAPSHOT war Bookstore From e23d7f8efb72c694509d3f05c6114bce2b784ba7 Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Sun, 9 Aug 2020 18:46:32 +0100 Subject: [PATCH 0387/1862] BAEL-4321 demo app for yaml to pojo --- configuration/yaml-to-pojo/README.md | 9 ++++ configuration/yaml-to-pojo/pom.xml | 54 +++++++++++++++++++ .../java/yamltopojo/demo/DemoApplication.java | 16 ++++++ .../demo/config/TshirtSizeConfig.java | 27 ++++++++++ .../demo/controller/TshirtSizeController.java | 22 ++++++++ .../demo/service/SizeConverterImpl.java | 22 ++++++++ .../demo/service/SizeConverterService.java | 8 +++ .../src/main/resources/application.yml | 30 +++++++++++ .../yamltopojo/demo/DemoApplicationTests.java | 13 +++++ .../controller/TshirtSizeControllerTest.java | 38 +++++++++++++ 10 files changed, 239 insertions(+) create mode 100644 configuration/yaml-to-pojo/README.md create mode 100644 configuration/yaml-to-pojo/pom.xml create mode 100644 configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/DemoApplication.java create mode 100644 configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java create mode 100644 configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java create mode 100644 configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java create mode 100644 configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterService.java create mode 100644 configuration/yaml-to-pojo/src/main/resources/application.yml create mode 100644 configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/DemoApplicationTests.java create mode 100644 configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java diff --git a/configuration/yaml-to-pojo/README.md b/configuration/yaml-to-pojo/README.md new file mode 100644 index 0000000000..9dba74a7e5 --- /dev/null +++ b/configuration/yaml-to-pojo/README.md @@ -0,0 +1,9 @@ +This is a demo application for using YAML configuration for defining values in a POJO class. + +The application has an endpoint to provide T-shirt size conversion for label and countrycode. + +If you run this service locally you can call this endpoint on: + +`localhost:8080/convertSize?label=M&countryCode=fr` + +It should return the size as int. \ No newline at end of file diff --git a/configuration/yaml-to-pojo/pom.xml b/configuration/yaml-to-pojo/pom.xml new file mode 100644 index 0000000000..f6b55718be --- /dev/null +++ b/configuration/yaml-to-pojo/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.2.RELEASE + + + yaml-to-pojo + demo + 0.0.1-SNAPSHOT + demo + Demo project for YAML into POJO + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.springframework.boot + spring-boot-starter-web + RELEASE + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/DemoApplication.java b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/DemoApplication.java new file mode 100644 index 0000000000..ec8df793c2 --- /dev/null +++ b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/DemoApplication.java @@ -0,0 +1,16 @@ +package yamltopojo.demo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import yamltopojo.demo.config.TshirtSizeConfig; + +@SpringBootApplication +@EnableConfigurationProperties(TshirtSizeConfig.class) +public class DemoApplication { + + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } + +} diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java new file mode 100644 index 0000000000..8f8d2e5b39 --- /dev/null +++ b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java @@ -0,0 +1,27 @@ +package yamltopojo.demo.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.Map; + +@ConfigurationProperties(prefix = "t-shirt-size") +public class TshirtSizeConfig { + + private final Map simpleMapping; + + private final Map> complexMapping; + + + public TshirtSizeConfig(Map simpleMapping, Map> complexMapping) { + this.simpleMapping = simpleMapping; + this.complexMapping = complexMapping; + } + + public Map getSimpleMapping() { + return simpleMapping; + } + + public Map> getComplexMapping() { + return complexMapping; + } +} diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java new file mode 100644 index 0000000000..d555549bd4 --- /dev/null +++ b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java @@ -0,0 +1,22 @@ +package yamltopojo.demo.controller; + +import org.springframework.web.bind.annotation.*; +import yamltopojo.demo.service.SizeConverterService; + +@RestController +@RequestMapping(value = "/") +public class TshirtSizeController { + + private SizeConverterService service; + + public TshirtSizeController(SizeConverterService service) { + this.service = service; + } + + @RequestMapping(value ="convertSize", method = RequestMethod.GET) + public int convertSize(@RequestParam(value = "label") final String label, + @RequestParam(value = "countryCode", required = false) final String countryCode) { + return service.convertSize(label, countryCode); + } + +} diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java new file mode 100644 index 0000000000..8f95e4253b --- /dev/null +++ b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java @@ -0,0 +1,22 @@ +package yamltopojo.demo.service; + +import org.springframework.stereotype.Service; +import yamltopojo.demo.config.TshirtSizeConfig; + + +@Service +public class SizeConverterImpl implements SizeConverterService { + + private TshirtSizeConfig tshirtSizeConfig; + + public SizeConverterImpl(TshirtSizeConfig tshirtSizeConfig) { + this.tshirtSizeConfig = tshirtSizeConfig; + } + + public int convertSize(String label, String countryCode) { + if(countryCode == null) { + return tshirtSizeConfig.getSimpleMapping().get(label); + } + return tshirtSizeConfig.getComplexMapping().get(label).get(countryCode); + } +} diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterService.java b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterService.java new file mode 100644 index 0000000000..3e24681cbe --- /dev/null +++ b/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterService.java @@ -0,0 +1,8 @@ +package yamltopojo.demo.service; + + +public interface SizeConverterService { + + int convertSize(String label, String countryCode); + +} diff --git a/configuration/yaml-to-pojo/src/main/resources/application.yml b/configuration/yaml-to-pojo/src/main/resources/application.yml new file mode 100644 index 0000000000..edd200389e --- /dev/null +++ b/configuration/yaml-to-pojo/src/main/resources/application.yml @@ -0,0 +1,30 @@ +t-shirt-size: + simple-mapping: + XS: 6 + S: 8 + M: 10 + L: 12 + XL: 14 + + + complex-mapping: + XS: + uk: 6 + fr: 34 + us: 2 + S: + uk: 8 + fr: 36 + us: 4 + M: + uk: 10 + fr: 38 + us: 6 + L: + uk: 12 + fr: 40 + us: 8 + XL: + uk: 14 + fr: 42 + us: 10 diff --git a/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/DemoApplicationTests.java b/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/DemoApplicationTests.java new file mode 100644 index 0000000000..dfe980c05c --- /dev/null +++ b/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/DemoApplicationTests.java @@ -0,0 +1,13 @@ +package yamltopojo.demo; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DemoApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java b/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java new file mode 100644 index 0000000000..3c1ef6dff5 --- /dev/null +++ b/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java @@ -0,0 +1,38 @@ +package yamltopojo.demo.controller; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import yamltopojo.demo.service.SizeConverterService; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class TshirtSizeControllerTest { + + @Mock + private SizeConverterService service; + + @InjectMocks + private TshirtSizeController tested; + + @Test + void convertSize() { + + // Given + String label = "S"; + String countryCode = "fr"; + int result = 36; + + // + when(service.convertSize(label, countryCode)).thenReturn(result); + int actual = tested.convertSize(label, countryCode); + + // Then + assertEquals(actual, result); + + } +} \ No newline at end of file From 0c413754437cb84e3f024802683e8528d8f0a2ff Mon Sep 17 00:00:00 2001 From: azhwani <> Date: Mon, 10 Aug 2020 13:58:50 +0100 Subject: [PATCH 0388/1862] quick fix --- .../controller/RestApiController.java | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 spring-5-security/src/main/java/com/baeldung/logoutredirects/controller/RestApiController.java diff --git a/spring-5-security/src/main/java/com/baeldung/logoutredirects/controller/RestApiController.java b/spring-5-security/src/main/java/com/baeldung/logoutredirects/controller/RestApiController.java deleted file mode 100644 index 7d5b3ebbaa..0000000000 --- a/spring-5-security/src/main/java/com/baeldung/logoutredirects/controller/RestApiController.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.logoutredirects.controller; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class RestApiController { - - @GetMapping("/login") - public String login() { - return "login"; - } - - @PostMapping("/logout") - public String logout() { - return "redirect:/login"; - } - -} From d8bfa4af436719ca98da73c8f7ff8c28cdc6cc9a Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 10 Aug 2020 21:55:24 +0200 Subject: [PATCH 0389/1862] JAVA-2305: Move Use Criteria Queries in a Spring Data Application to spring-data-jpa-query-2 --- .../spring-data-jpa-query-2/README.md | 16 +++++++++ .../spring-data-jpa-query-2/pom.xml | 33 +++++++++++++++++++ .../persistence/dao/BookRepository.java | 0 .../persistence/dao/BookRepositoryCustom.java | 4 +-- .../persistence/dao/BookRepositoryImpl.java | 9 +++-- .../baeldung/persistence/dao/BookService.java | 12 +++---- .../persistence/dao/BookSpecifications.java | 0 .../com/baeldung/persistence/model/Book.java | 0 .../spring-data-jpa-query/README.md | 1 + persistence-modules/spring-jpa/README.md | 1 - 10 files changed, 62 insertions(+), 14 deletions(-) create mode 100644 persistence-modules/spring-data-jpa-query-2/README.md create mode 100644 persistence-modules/spring-data-jpa-query-2/pom.xml rename persistence-modules/{spring-jpa => spring-data-jpa-query-2}/src/main/java/com/baeldung/persistence/dao/BookRepository.java (100%) rename persistence-modules/{spring-jpa => spring-data-jpa-query-2}/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java (100%) rename persistence-modules/{spring-jpa => spring-data-jpa-query-2}/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java (99%) rename persistence-modules/{spring-jpa => spring-data-jpa-query-2}/src/main/java/com/baeldung/persistence/dao/BookService.java (90%) rename persistence-modules/{spring-jpa => spring-data-jpa-query-2}/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java (100%) rename persistence-modules/{spring-jpa => spring-data-jpa-query-2}/src/main/java/com/baeldung/persistence/model/Book.java (100%) diff --git a/persistence-modules/spring-data-jpa-query-2/README.md b/persistence-modules/spring-data-jpa-query-2/README.md new file mode 100644 index 0000000000..a4d657d4c6 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/README.md @@ -0,0 +1,16 @@ +## Spring Data JPA - Query + +This module contains articles about querying data using Spring Data JPA + +### Relevant Articles: +- [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries) +- More articles: [[<-- prev]](../spring-data-jpa-query) + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator diff --git a/persistence-modules/spring-data-jpa-query-2/pom.xml b/persistence-modules/spring-data-jpa-query-2/pom.xml new file mode 100644 index 0000000000..b9e5120543 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + spring-data-jpa-query + spring-data-jpa-query-2 + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + com.h2database + h2 + + + + com.fasterxml.jackson.core + jackson-databind + + + + \ No newline at end of file diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepository.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepository.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java index 1b46d0ecc3..eda34542df 100644 --- a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java @@ -1,9 +1,9 @@ package com.baeldung.persistence.dao; -import java.util.List; - import com.baeldung.persistence.model.Book; +import java.util.List; + public interface BookRepositoryCustom { List findBooksByAuthorNameAndTitle(String authorName, String title); diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java similarity index 99% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java index 241a4c05aa..7f5bedd018 100644 --- a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java @@ -1,7 +1,7 @@ package com.baeldung.persistence.dao; -import java.util.ArrayList; -import java.util.List; +import com.baeldung.persistence.model.Book; +import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; @@ -9,9 +9,8 @@ import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; - -import com.baeldung.persistence.model.Book; -import org.springframework.stereotype.Repository; +import java.util.ArrayList; +import java.util.List; @Repository public class BookRepositoryImpl implements BookRepositoryCustom { diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java similarity index 90% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookService.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java index f02f9daa11..4165cd8eb9 100644 --- a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookService.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java @@ -1,14 +1,14 @@ package com.baeldung.persistence.dao; -import static com.baeldung.persistence.dao.BookSpecifications.hasAuthor; -import static com.baeldung.persistence.dao.BookSpecifications.titleContains; -import static org.springframework.data.jpa.domain.Specifications.where; - -import java.util.List; - import com.baeldung.persistence.model.Book; import org.springframework.stereotype.Service; +import java.util.List; + +import static com.baeldung.persistence.dao.BookSpecifications.hasAuthor; +import static com.baeldung.persistence.dao.BookSpecifications.titleContains; +import static org.springframework.data.jpa.domain.Specification.where; + @Service public class BookService { diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Book.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/persistence/model/Book.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java diff --git a/persistence-modules/spring-data-jpa-query/README.md b/persistence-modules/spring-data-jpa-query/README.md index bfff3c0ef3..34e397394b 100644 --- a/persistence-modules/spring-data-jpa-query/README.md +++ b/persistence-modules/spring-data-jpa-query/README.md @@ -11,6 +11,7 @@ This module contains articles about querying data using Spring Data JPA - [Spring Data JPA Query by Example](https://www.baeldung.com/spring-data-query-by-example) - [JPA Join Types](https://www.baeldung.com/jpa-join-types) - [Spring Data JPA and Named Entity Graphs](https://www.baeldung.com/spring-data-jpa-named-entity-graphs) +- More articles: [[more -->]](../spring-data-jpa-query-2) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/persistence-modules/spring-jpa/README.md b/persistence-modules/spring-jpa/README.md index 94a1e1f575..cd7e090e09 100644 --- a/persistence-modules/spring-jpa/README.md +++ b/persistence-modules/spring-jpa/README.md @@ -10,7 +10,6 @@ - [Self-Contained Testing Using an In-Memory Database](https://www.baeldung.com/spring-jpa-test-in-memory-database) - [A Guide to Spring AbstractRoutingDatasource](https://www.baeldung.com/spring-abstract-routing-data-source) - [Obtaining Auto-generated Keys in Spring JDBC](https://www.baeldung.com/spring-jdbc-autogenerated-keys) -- [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries) - [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many) - [Spring Persistence (Hibernate and JPA) with a JNDI datasource](https://www.baeldung.com/spring-persistence-hibernate-and-jpa-with-a-jndi-datasource-2) From e7d193055062b58f5ac91235d79b91042dd652eb Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 11:19:00 +0800 Subject: [PATCH 0390/1862] Update README.md --- java-numbers-3/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-numbers-3/README.md b/java-numbers-3/README.md index ab0bbd995d..2cec5d52cd 100644 --- a/java-numbers-3/README.md +++ b/java-numbers-3/README.md @@ -4,7 +4,7 @@ This module contains articles about numbers in Java. ### Relevant Articles: -- [Generating Random Numbers](https://www.baeldung.com/java-generating-random-numbers) +- [Generating Random Numbers in Java](https://www.baeldung.com/java-generating-random-numbers) - [Convert Double to Long in Java](https://www.baeldung.com/java-convert-double-long) - [Check for null Before Calling Parse in Double.parseDouble](https://www.baeldung.com/java-check-null-parse-double) - [Generating Random Numbers in a Range in Java](https://www.baeldung.com/java-generating-random-numbers-in-range) From fffbcfc2c082b6f7b1469864b47c9316ca185ab5 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 11:24:33 +0800 Subject: [PATCH 0391/1862] Update README.md --- core-java-modules/core-java-9-new-features/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-9-new-features/README.md b/core-java-modules/core-java-9-new-features/README.md index d10d0aad2d..5af069c6f0 100644 --- a/core-java-modules/core-java-9-new-features/README.md +++ b/core-java-modules/core-java-9-new-features/README.md @@ -14,3 +14,4 @@ This module contains articles about core Java features that have been introduced - [Java 9 Reactive Streams](https://www.baeldung.com/java-9-reactive-streams) - [Multi-Release JAR Files with Maven](https://www.baeldung.com/maven-multi-release-jars) - [The Difference between RxJava API and the Java 9 Flow API](https://www.baeldung.com/rxjava-vs-java-flow-api) +- [How to Get a Name of a Method Being Executed?](https://www.baeldung.com/java-name-of-executing-method) From 03229bced14a817ff5f865143a9c7673fbbdadf4 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 11:40:49 +0800 Subject: [PATCH 0392/1862] Update README.md --- spring-boot-modules/spring-boot-mvc-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-mvc-2/README.md b/spring-boot-modules/spring-boot-mvc-2/README.md index c42730f9cc..f9becb721f 100644 --- a/spring-boot-modules/spring-boot-mvc-2/README.md +++ b/spring-boot-modules/spring-boot-mvc-2/README.md @@ -11,4 +11,5 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Testing REST with multiple MIME types](https://www.baeldung.com/testing-rest-api-with-multiple-media-types) - [Testing Web APIs with Postman Collections](https://www.baeldung.com/postman-testing-collections) - [Spring Boot Consuming and Producing JSON](https://www.baeldung.com/spring-boot-json) +- [Serve Static Resources with Spring](https://www.baeldung.com/spring-mvc-static-resources) - More articles: [[prev -->]](/spring-boot-modules/spring-boot-mvc) From ccaeb55319f22eb457a5450fccb07cc5c9f58c28 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 12:32:27 +0800 Subject: [PATCH 0393/1862] Update README.md --- reactive-systems/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactive-systems/README.md b/reactive-systems/README.md index 0558dd141e..b23f4e4dc4 100644 --- a/reactive-systems/README.md +++ b/reactive-systems/README.md @@ -4,4 +4,4 @@ This module contains services for article about reactive systems in Java. Please ### Relevant Articles -- [Reactive Systems in Java](https://www.baeldung.com/) +- [Reactive Systems in Java](https://www.baeldung.com/java-reactive-systems) From bb267b5d64eef65c5fa6adf789c70a32f1d8d05e Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 12:45:54 +0800 Subject: [PATCH 0394/1862] Update README.md --- algorithms-searching/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-searching/README.md b/algorithms-searching/README.md index aed3c7d21f..260a4ea714 100644 --- a/algorithms-searching/README.md +++ b/algorithms-searching/README.md @@ -11,3 +11,4 @@ This module contains articles about searching algorithms. - [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search) - [Range Search Algorithm in Java](https://www.baeldung.com/java-range-search) - [Fast Pattern Matching of Strings Using Suffix Tree](https://www.baeldung.com/java-pattern-matching-suffix-tree) +- [Topological Sort of Directed Acyclic Graph](https://www.baeldung.com/cs/dag-topological-sort) From 009308131f46a10537245afc853eafb10b3603cc Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 11 Aug 2020 12:17:02 +0530 Subject: [PATCH 0395/1862] JAVA-2344: Update "Dockerizing with Jib" article --- jib/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jib/pom.xml b/jib/pom.xml index 1d7413cc18..15e7e44e7c 100644 --- a/jib/pom.xml +++ b/jib/pom.xml @@ -40,6 +40,6 @@ - 0.9.10 + 2.5.0 From b09abfc0bf564d74a10ba11be2e25bc5080da630 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 11 Aug 2020 13:05:01 +0530 Subject: [PATCH 0396/1862] JAVA-1089: Move the OAuth related lesson code from spring-boot-modules/spring-boot-security --- .../SpringBootOAuth2ResourceApplication.java | 30 ------- ...ingBootAuthorizationServerApplication.java | 47 ---------- .../config/AuthenticationMananagerConfig.java | 18 ---- .../config/AuthorizationServerConfig.java | 46 ---------- .../config/WebSecurityConfiguration.java | 17 ---- .../SpringBootOAuth2SsoApplication.java | 19 ---- ...figAuthorizationServerIntegrationTest.java | 89 ------------------- ...figAuthorizationServerIntegrationTest.java | 32 ------- .../OAuth2IntegrationTestSupport.java | 53 ----------- 9 files changed, 351 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2resource/SpringBootOAuth2ResourceApplication.java delete mode 100644 spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/SpringBootAuthorizationServerApplication.java delete mode 100644 spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/AuthenticationMananagerConfig.java delete mode 100644 spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/AuthorizationServerConfig.java delete mode 100644 spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/WebSecurityConfiguration.java delete mode 100644 spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2sso/SpringBootOAuth2SsoApplication.java delete mode 100644 spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/CustomConfigAuthorizationServerIntegrationTest.java delete mode 100644 spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/DefaultConfigAuthorizationServerIntegrationTest.java delete mode 100644 spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/OAuth2IntegrationTestSupport.java diff --git a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2resource/SpringBootOAuth2ResourceApplication.java b/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2resource/SpringBootOAuth2ResourceApplication.java deleted file mode 100644 index 56231a28bd..0000000000 --- a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2resource/SpringBootOAuth2ResourceApplication.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2resource; - -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -@EnableResourceServer -@SpringBootApplication(scanBasePackages = "com.baeldung.springbootsecurity.oauth2resource") -public class SpringBootOAuth2ResourceApplication { - - public static void main(String[] args) { - new SpringApplicationBuilder() - .profiles("resource") - .sources(SpringBootOAuth2ResourceApplication.class) - .build() - .run(args); - } - - @RestController - class SecuredResourceController { - - @GetMapping("/securedResource") - public String securedResource() { - return "Baeldung Secured Resource OK"; - } - - } -} diff --git a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/SpringBootAuthorizationServerApplication.java b/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/SpringBootAuthorizationServerApplication.java deleted file mode 100644 index 04f046ff78..0000000000 --- a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/SpringBootAuthorizationServerApplication.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2server; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.annotation.CurrentSecurityContext; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.security.Principal; - -@EnableResourceServer -@EnableAuthorizationServer -@SpringBootApplication(scanBasePackages = "com.baeldung.springbootsecurity.oauth2server") -public class SpringBootAuthorizationServerApplication { - - private static final Logger logger = LoggerFactory.getLogger(SpringBootAuthorizationServerApplication.class); - - public static void main(String[] args) { - SpringApplication.run(SpringBootAuthorizationServerApplication.class, args); - } - - @RestController - class UserController { - - @GetMapping("/user") - public Principal user(Principal user) { - return user; - } - - @GetMapping("/authentication") - public Object getAuthentication(@CurrentSecurityContext(expression = "authentication") Authentication authentication) { - logger.info("authentication -> {}", authentication); - return authentication.getDetails(); - } - - @GetMapping("/principal") - public String getPrincipal(@CurrentSecurityContext(expression = "authentication.principal") Principal principal) { - logger.info("principal -> {}", principal); - return principal.getName(); - } - } -} diff --git a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/AuthenticationMananagerConfig.java b/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/AuthenticationMananagerConfig.java deleted file mode 100644 index 2b4135f36d..0000000000 --- a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/AuthenticationMananagerConfig.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2server.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - -@Configuration -@Profile("authz") -public class AuthenticationMananagerConfig extends WebSecurityConfigurerAdapter { - - @Bean - @Override - public AuthenticationManager authenticationManagerBean() throws Exception { - return super.authenticationManagerBean(); - } -} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/AuthorizationServerConfig.java b/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/AuthorizationServerConfig.java deleted file mode 100644 index 6e21987a89..0000000000 --- a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/AuthorizationServerConfig.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2server.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; -import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; -import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; - -@Configuration -@Profile("authz") -public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { - - @Autowired - private AuthenticationManager authenticationManager; - - @Override - public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { - endpoints.authenticationManager(authenticationManager); - } - - @Override - public void configure(ClientDetailsServiceConfigurer clients) throws Exception { - clients - .inMemory() - .withClient("baeldung") - .secret(passwordEncoder().encode("baeldung")) - .authorizedGrantTypes("client_credentials", "password", "authorization_code") - .scopes("openid", "read") - .autoApprove(true) - .and() - .withClient("baeldung-admin") - .secret(passwordEncoder().encode("baeldung")) - .authorizedGrantTypes("authorization_code", "client_credentials", "refresh_token") - .scopes("read", "write") - .autoApprove(true); - } - - @Bean - public BCryptPasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); - } -} diff --git a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/WebSecurityConfiguration.java b/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/WebSecurityConfiguration.java deleted file mode 100644 index 3a8c073870..0000000000 --- a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2server/config/WebSecurityConfiguration.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2server.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - -@Configuration -@Profile("!authz") -public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { - - @Bean - public AuthenticationManager customAuthenticationManager() throws Exception { - return authenticationManager(); - } -} diff --git a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2sso/SpringBootOAuth2SsoApplication.java b/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2sso/SpringBootOAuth2SsoApplication.java deleted file mode 100644 index 342c246e66..0000000000 --- a/spring-boot-modules/spring-boot-security/src/main/java/com/baeldung/springbootsecurity/oauth2sso/SpringBootOAuth2SsoApplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2sso; - -import org.springframework.boot.autoconfigure.SpringBootApplication; - -import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; -import org.springframework.boot.builder.SpringApplicationBuilder; - -@EnableOAuth2Sso -@SpringBootApplication(scanBasePackages = "com.baeldung.springbootsecurity.oauth2sso") -public class SpringBootOAuth2SsoApplication { - - public static void main(String[] args) { - new SpringApplicationBuilder() - .profiles("sso") - .sources(SpringBootOAuth2SsoApplication.class) - .build() - .run(args); - } -} diff --git a/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/CustomConfigAuthorizationServerIntegrationTest.java b/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/CustomConfigAuthorizationServerIntegrationTest.java deleted file mode 100644 index 104e115b18..0000000000 --- a/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/CustomConfigAuthorizationServerIntegrationTest.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2server; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; -import org.springframework.security.oauth2.client.OAuth2RestTemplate; -import org.springframework.security.oauth2.client.resource.OAuth2AccessDeniedException; -import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails; -import org.springframework.security.oauth2.common.OAuth2AccessToken; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -import java.net.URL; -import java.util.regex.Pattern; - -import static java.util.Collections.singletonList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = RANDOM_PORT, classes = SpringBootAuthorizationServerApplication.class) -@ActiveProfiles("authz") -public class CustomConfigAuthorizationServerIntegrationTest extends OAuth2IntegrationTestSupport { - - @LocalServerPort - private int port; - - @Before - public void setUp() throws Exception { - base = new URL("http://localhost:" + port); - } - - @Test - public void givenOAuth2Context_whenAccessTokenIsRequested_ThenAccessTokenValueIsNotNull() { - ClientCredentialsResourceDetails resourceDetails = getClientCredentialsResourceDetails("baeldung", singletonList("read")); - OAuth2RestTemplate restTemplate = getOAuth2RestTemplate(resourceDetails); - - OAuth2AccessToken accessToken = restTemplate.getAccessToken(); - - assertNotNull(accessToken); - } - - @Test - public void givenOAuth2Context_whenAccessingAuthentication_ThenRespondTokenDetails() { - ClientCredentialsResourceDetails resourceDetails = getClientCredentialsResourceDetails("baeldung", singletonList("read")); - OAuth2RestTemplate restTemplate = getOAuth2RestTemplate(resourceDetails); - - String authentication = executeGetRequest(restTemplate, "/authentication"); - - Pattern pattern = Pattern.compile("\\{\"remoteAddress\":\".*" + - "\",\"sessionId\":null,\"tokenValue\":\".*" + - "\",\"tokenType\":\"Bearer\",\"decodedDetails\":null}"); - assertTrue("authentication", pattern.matcher(authentication).matches()); - } - - @Test - public void givenOAuth2Context_whenAccessingPrincipal_ThenRespondBaeldung() { - ClientCredentialsResourceDetails resourceDetails = getClientCredentialsResourceDetails("baeldung", singletonList("read")); - OAuth2RestTemplate restTemplate = getOAuth2RestTemplate(resourceDetails); - - String principal = executeGetRequest(restTemplate, "/principal"); - - assertEquals("baeldung", principal); - } - - @Test(expected = OAuth2AccessDeniedException.class) - public void givenOAuth2Context_whenAccessTokenIsRequestedWithInvalidException_ThenExceptionIsThrown() { - ClientCredentialsResourceDetails resourceDetails = getClientCredentialsResourceDetails("baeldung", singletonList("write")); - OAuth2RestTemplate restTemplate = getOAuth2RestTemplate(resourceDetails); - - restTemplate.getAccessToken(); - } - - @Test - public void givenOAuth2Context_whenAccessTokenIsRequestedByClientWithWriteScope_ThenAccessTokenIsNotNull() { - ClientCredentialsResourceDetails resourceDetails = getClientCredentialsResourceDetails("baeldung-admin", singletonList("write")); - OAuth2RestTemplate restTemplate = getOAuth2RestTemplate(resourceDetails); - - OAuth2AccessToken accessToken = restTemplate.getAccessToken(); - - assertNotNull(accessToken); - } - -} - diff --git a/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/DefaultConfigAuthorizationServerIntegrationTest.java b/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/DefaultConfigAuthorizationServerIntegrationTest.java deleted file mode 100644 index 4d7b449380..0000000000 --- a/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/DefaultConfigAuthorizationServerIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2server; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.security.oauth2.client.OAuth2RestTemplate; -import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails; -import org.springframework.security.oauth2.common.OAuth2AccessToken; -import org.springframework.test.context.junit4.SpringRunner; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertNotNull; -import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; - -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = RANDOM_PORT, classes = SpringBootAuthorizationServerApplication.class, - properties = { "security.oauth2.client.client-id=client", "security.oauth2.client.client-secret=baeldung" }) -public class DefaultConfigAuthorizationServerIntegrationTest extends OAuth2IntegrationTestSupport { - - @Test - public void givenOAuth2Context_whenAccessTokenIsRequested_ThenAccessTokenValueIsNotNull() { - ClientCredentialsResourceDetails resourceDetails = getClientCredentialsResourceDetails("client", asList("read", "write")); - OAuth2RestTemplate restTemplate = getOAuth2RestTemplate(resourceDetails); - - OAuth2AccessToken accessToken = restTemplate.getAccessToken(); - - assertNotNull(accessToken); - - } - -} - diff --git a/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/OAuth2IntegrationTestSupport.java b/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/OAuth2IntegrationTestSupport.java deleted file mode 100644 index a005965998..0000000000 --- a/spring-boot-modules/spring-boot-security/src/test/java/com/baeldung/springbootsecurity/oauth2server/OAuth2IntegrationTestSupport.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.baeldung.springbootsecurity.oauth2server; - -import org.apache.commons.io.IOUtils; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; -import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext; -import org.springframework.security.oauth2.client.OAuth2RestTemplate; -import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails; -import org.springframework.web.client.RequestCallback; -import org.springframework.web.client.ResponseExtractor; - -import java.net.URL; -import java.nio.charset.Charset; -import java.util.List; - -import static java.lang.String.format; -import static java.util.Collections.singletonList; -import static org.springframework.http.HttpMethod.GET; - -public class OAuth2IntegrationTestSupport { - - public static final ResponseExtractor EXTRACT_BODY_AS_STRING = clientHttpResponse -> - IOUtils.toString(clientHttpResponse.getBody(), Charset.defaultCharset()); - private static final RequestCallback DO_NOTHING_CALLBACK = request -> { - }; - - @Value("${local.server.port}") - protected int port; - - protected URL base; - - protected ClientCredentialsResourceDetails getClientCredentialsResourceDetails(final String clientId, final List scopes) { - ClientCredentialsResourceDetails resourceDetails = new ClientCredentialsResourceDetails(); - resourceDetails.setAccessTokenUri(format("http://localhost:%d/oauth/token", port)); - resourceDetails.setClientId(clientId); - resourceDetails.setClientSecret("baeldung"); - resourceDetails.setScope(scopes); - resourceDetails.setGrantType("client_credentials"); - return resourceDetails; - } - - protected OAuth2RestTemplate getOAuth2RestTemplate(final ClientCredentialsResourceDetails resourceDetails) { - DefaultOAuth2ClientContext clientContext = new DefaultOAuth2ClientContext(); - OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(resourceDetails, clientContext); - restTemplate.setMessageConverters(singletonList(new MappingJackson2HttpMessageConverter())); - return restTemplate; - } - - protected String executeGetRequest(OAuth2RestTemplate restTemplate, String path) { - return restTemplate.execute(base.toString() + path, GET, DO_NOTHING_CALLBACK, EXTRACT_BODY_AS_STRING); - } - -} From 972db91cd9b8ceecc45da5044c8273df82e5cc7b Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 18:38:42 +0800 Subject: [PATCH 0397/1862] Delete README.md --- maven-modules/maven-plugins/maven-enforcer/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 maven-modules/maven-plugins/maven-enforcer/README.md diff --git a/maven-modules/maven-plugins/maven-enforcer/README.md b/maven-modules/maven-plugins/maven-enforcer/README.md deleted file mode 100644 index 44d43050e7..0000000000 --- a/maven-modules/maven-plugins/maven-enforcer/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: - -- [Maven Enforcer Plugin](https://www.baeldung.com/maven-enforcer-plugin) From 9e17f8f8a587884630e83d80ffdaab0232ed5739 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 19:09:19 +0800 Subject: [PATCH 0398/1862] Update README.md --- apache-cxf/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/apache-cxf/README.md b/apache-cxf/README.md index bedd19a91a..88edaf4e13 100644 --- a/apache-cxf/README.md +++ b/apache-cxf/README.md @@ -7,4 +7,3 @@ This module contains articles about Apache CXF - [Apache CXF Support for RESTful Web Services](https://www.baeldung.com/apache-cxf-rest-api) - [A Guide to Apache CXF with Spring](https://www.baeldung.com/apache-cxf-with-spring) - [Introduction to Apache CXF](https://www.baeldung.com/introduction-to-apache-cxf) -- [Server-Sent Events (SSE) In JAX-RS](https://www.baeldung.com/java-ee-jax-rs-sse) From be2e853fd3437caeb99b2a24ef66bf81d2e90b74 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 19:11:30 +0800 Subject: [PATCH 0399/1862] Create README.md --- apache-cxf/sse-jaxrs/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 apache-cxf/sse-jaxrs/README.md diff --git a/apache-cxf/sse-jaxrs/README.md b/apache-cxf/sse-jaxrs/README.md new file mode 100644 index 0000000000..4d39560b46 --- /dev/null +++ b/apache-cxf/sse-jaxrs/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Server-Sent Events (SSE) In JAX-RS](https://www.baeldung.com/java-ee-jax-rs-sse) From f130f7fcbfd97272afd4362536d8b0d65d1ac255 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 19:34:04 +0800 Subject: [PATCH 0400/1862] Update README.md --- persistence-modules/spring-data-elasticsearch/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/persistence-modules/spring-data-elasticsearch/README.md b/persistence-modules/spring-data-elasticsearch/README.md index 9f68a25243..22126c2f00 100644 --- a/persistence-modules/spring-data-elasticsearch/README.md +++ b/persistence-modules/spring-data-elasticsearch/README.md @@ -6,7 +6,6 @@ - [Guide to Elasticsearch in Java](https://www.baeldung.com/elasticsearch-java) - [Geospatial Support in ElasticSearch](https://www.baeldung.com/elasticsearch-geo-spatial) - [A Simple Tagging Implementation with Elasticsearch](https://www.baeldung.com/elasticsearch-tagging) -- [Introduction to Spring Data Elasticsearch (evaluation)](https://www.baeldung.com/spring-data-elasticsearch-test-2) ### Build the Project with Tests Running ``` From 90feaa94ecb838a371571c228bfffb7bdc8b2367 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 19:40:24 +0800 Subject: [PATCH 0401/1862] Update README.md --- excelformula/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/excelformula/README.md b/excelformula/README.md index 86ddaba413..90826cabee 100644 --- a/excelformula/README.md +++ b/excelformula/README.md @@ -3,6 +3,6 @@ This module contains articles about Apache POI ### Relevant Articles: -- [Working with Microsoft Excel in Java](https://www.baeldung.com/java-microsoft-excel) + - [Read Excel Cell Value Rather Than Formula With Apache POI](https://www.baeldung.com/apache-poi-read-cell-value-formula) - [Upload and Display Excel Files with Spring MVC](https://www.baeldung.com/spring-mvc-excel-files) From 0ec048cf985e1eddad03107cbb8ca7b58451bdfc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 19:43:49 +0800 Subject: [PATCH 0402/1862] Update README.md --- excelformula/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/excelformula/README.md b/excelformula/README.md index 90826cabee..a43b3148be 100644 --- a/excelformula/README.md +++ b/excelformula/README.md @@ -4,5 +4,4 @@ This module contains articles about Apache POI ### Relevant Articles: -- [Read Excel Cell Value Rather Than Formula With Apache POI](https://www.baeldung.com/apache-poi-read-cell-value-formula) - [Upload and Display Excel Files with Spring MVC](https://www.baeldung.com/spring-mvc-excel-files) From fae529d8544070adfa0da731d8a80f8767d6bb9a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 19:45:09 +0800 Subject: [PATCH 0403/1862] Update README.md --- excelformula/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/excelformula/README.md b/excelformula/README.md index a43b3148be..24560525cd 100644 --- a/excelformula/README.md +++ b/excelformula/README.md @@ -3,5 +3,3 @@ This module contains articles about Apache POI ### Relevant Articles: - -- [Upload and Display Excel Files with Spring MVC](https://www.baeldung.com/spring-mvc-excel-files) From 6a662c10dfc573bbd38dbc26eda0710b70c05f8a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 11 Aug 2020 19:49:05 +0800 Subject: [PATCH 0404/1862] Create README.md --- docker/docker-spring-boot/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docker/docker-spring-boot/README.md diff --git a/docker/docker-spring-boot/README.md b/docker/docker-spring-boot/README.md new file mode 100644 index 0000000000..78f13a3652 --- /dev/null +++ b/docker/docker-spring-boot/README.md @@ -0,0 +1,3 @@ +### Relevant Article: + +- [Creating Docker Images with Spring Boot](https://www.baeldung.com/spring-boot-docker-images) From 96502d8626ad700c89927e3e4efa896d4b332b12 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Tue, 11 Aug 2020 15:09:34 +0200 Subject: [PATCH 0405/1862] JAVA-2380: Fix failing integration tests in the spring-data-jpa-enterprise --- .../src/main/java/com/baeldung/boot/Application.java | 4 ++-- .../src/main/java/com/baeldung/osiv/model/BasicUser.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/Application.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/Application.java index aaca760499..d9da2c53b6 100644 --- a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/Application.java +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/boot/Application.java @@ -6,8 +6,8 @@ import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; @SpringBootApplication -@EnableJpaRepositories("com.baeldung") -@EntityScan("com.baeldung") +@EnableJpaRepositories("com.baeldung.boot") +@EntityScan("com.baeldung.boot") public class Application { public static void main(String[] args) { diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/model/BasicUser.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/model/BasicUser.java index 98f4e379d4..a4f8e4e5f2 100644 --- a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/model/BasicUser.java +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/osiv/model/BasicUser.java @@ -4,7 +4,7 @@ import javax.persistence.*; import java.util.Set; @Entity -@Table(name = "users") +@Table(name = "basic_users") public class BasicUser { @Id From ded13f14b22653a8448b62b731a28ce22110d912 Mon Sep 17 00:00:00 2001 From: Daniel Strmecki Date: Tue, 11 Aug 2020 19:29:46 +0200 Subject: [PATCH 0406/1862] Feature/bael 4280 diff between lists (#9600) * BAEL-4280: Initial commit for finding diff between lists * BAEL-4280: Format * BAEL-4280: Refactor * BAEL-4280: Refactor not to use private methods * BAEL-4280: Refactor based on editor comments * BAEL-4280: Review round 2 * BAEL-4280: Use assertj * BAEL-4280: Use assertj * BAEL-4280: Shorter names for tests * BAEL-4280: Remove HashSet as its not used anymore * BAEL-4280: Use containsExactlyInAnyOrder for Set example * BAEL-4280: Remove distinct method call * BAEL-4280: Move impl to test * BAEL-4280: Use containsExactlyInAnyOrder * BAEL-4280: Rename test methods --- .../core-java-collections-list-3/pom.xml | 6 ++ .../FindDifferencesBetweenListsUnitTest.java | 96 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 core-java-modules/core-java-collections-list-3/src/test/java/com/baeldung/list/difference/FindDifferencesBetweenListsUnitTest.java diff --git a/core-java-modules/core-java-collections-list-3/pom.xml b/core-java-modules/core-java-collections-list-3/pom.xml index 373190a130..e1cf645c8a 100644 --- a/core-java-modules/core-java-collections-list-3/pom.xml +++ b/core-java-modules/core-java-collections-list-3/pom.xml @@ -21,6 +21,12 @@ commons-collections4 ${commons-collections4.version} + + com.google.guava + guava + ${guava.version} + compile + org.assertj assertj-core diff --git a/core-java-modules/core-java-collections-list-3/src/test/java/com/baeldung/list/difference/FindDifferencesBetweenListsUnitTest.java b/core-java-modules/core-java-collections-list-3/src/test/java/com/baeldung/list/difference/FindDifferencesBetweenListsUnitTest.java new file mode 100644 index 0000000000..ceeff5e442 --- /dev/null +++ b/core-java-modules/core-java-collections-list-3/src/test/java/com/baeldung/list/difference/FindDifferencesBetweenListsUnitTest.java @@ -0,0 +1,96 @@ +package com.baeldung.list.difference; + +import com.google.common.collect.Sets; +import org.apache.commons.collections4.CollectionUtils; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.*; +import static org.assertj.core.api.Assertions.*; + +public class FindDifferencesBetweenListsUnitTest { + + private static final List listOne = Arrays.asList("Jack", "Tom", "Sam", "John", "James", "Jack"); + private static final List listTwo = Arrays.asList("Jack", "Daniel", "Sam", "Alan", "James", "George"); + + @Test + public void givenLists_whenUsingPlainJavaImpl_thenDifferencesAreFound() { + List differences = new ArrayList<>(listOne); + differences.removeAll(listTwo); + assertEquals(2, differences.size()); + assertThat(differences).containsExactly("Tom", "John"); + } + + @Test + public void givenReverseLists_whenUsingPlainJavaImpl_thenDifferencesAreFound() { + List differences = new ArrayList<>(listTwo); + differences.removeAll(listOne); + assertEquals(3, differences.size()); + assertThat(differences).containsExactly("Daniel", "Alan", "George"); + } + + @Test + public void givenLists_whenUsingJavaStreams_thenDifferencesAreFound() { + List differences = listOne.stream() + .filter(element -> !listTwo.contains(element)) + .collect(Collectors.toList()); + assertEquals(2, differences.size()); + assertThat(differences).containsExactly("Tom", "John"); + } + + @Test + public void givenReverseLists_whenUsingJavaStreams_thenDifferencesAreFound() { + List differences = listTwo.stream() + .filter(element -> !listOne.contains(element)) + .collect(Collectors.toList()); + assertEquals(3, differences.size()); + assertThat(differences).containsExactly("Daniel", "Alan", "George"); + } + + @Test + public void givenLists_whenUsingGoogleGuava_thenDifferencesAreFound() { + List differences = new ArrayList<>(Sets.difference(Sets.newHashSet(listOne), Sets.newHashSet(listTwo))); + assertEquals(2, differences.size()); + assertThat(differences).containsExactlyInAnyOrder("Tom", "John"); + } + + @Test + public void givenReverseLists_whenUsingGoogleGuava_thenDifferencesAreFound() { + List differences = new ArrayList<>(Sets.difference(Sets.newHashSet(listTwo), Sets.newHashSet(listOne))); + assertEquals(3, differences.size()); + assertThat(differences).containsExactlyInAnyOrder("Daniel", "Alan", "George"); + } + + @Test + public void givenLists_whenUsingApacheCommons_thenDifferencesAreFound() { + List differences = new ArrayList<>((CollectionUtils.removeAll(listOne, listTwo))); + assertEquals(2, differences.size()); + assertThat(differences).containsExactly("Tom", "John"); + } + + @Test + public void givenReverseLists_whenUsingApacheCommons_thenDifferencesAreFound() { + List differences = new ArrayList<>((CollectionUtils.removeAll(listTwo, listOne))); + assertEquals(3, differences.size()); + assertThat(differences).containsExactly("Daniel", "Alan", "George"); + } + + @Test + public void givenLists_whenUsingPlainJavaImpl_thenDifferencesWithDuplicatesAreFound() { + List differences = new ArrayList<>(listOne); + listTwo.forEach(differences::remove); + assertThat(differences).containsExactly("Tom", "John", "Jack"); + } + + @Test + public void givenLists_whenUsingApacheCommons_thenDifferencesWithDuplicatesAreFound() { + List differences = new ArrayList<>(CollectionUtils.subtract(listOne, listTwo)); + assertEquals(3, differences.size()); + assertThat(differences).containsExactly("Tom", "John", "Jack"); + } + +} From 94f50e785ee122b1f31310a5b6f518990841fda6 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Tue, 11 Aug 2020 22:50:22 +0430 Subject: [PATCH 0407/1862] ThreadLocals and Thread Pools (#9592) --- .../ThreadLocalAwareThreadPool.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 core-java-modules/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/ThreadLocalAwareThreadPool.java diff --git a/core-java-modules/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/ThreadLocalAwareThreadPool.java b/core-java-modules/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/ThreadLocalAwareThreadPool.java new file mode 100644 index 0000000000..5a41cd9dbf --- /dev/null +++ b/core-java-modules/core-java-concurrency-advanced/src/main/java/com/baeldung/threadlocal/ThreadLocalAwareThreadPool.java @@ -0,0 +1,25 @@ +package com.baeldung.threadlocal; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.RejectedExecutionHandler; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +public class ThreadLocalAwareThreadPool extends ThreadPoolExecutor { + + public ThreadLocalAwareThreadPool(int corePoolSize, + int maximumPoolSize, + long keepAliveTime, + TimeUnit unit, + BlockingQueue workQueue, + ThreadFactory threadFactory, + RejectedExecutionHandler handler) { + super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler); + } + + @Override + protected void afterExecute(Runnable r, Throwable t) { + // Call remove on each ThreadLocal + } +} From e52c8269680c821a2aa612dee9ab9f67de119588 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Tue, 11 Aug 2020 22:14:45 +0200 Subject: [PATCH 0408/1862] JAVA-1648: Get rid of the overriden spring-boot.version property in spring-5-security --- spring-5-security/pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index 3fd31c8bc5..c486d5346b 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -60,8 +60,5 @@ - - 2.2.1.RELEASE - From 41964ef72e4a54bff1e79ff10592b92838af5f41 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Wed, 12 Aug 2020 00:58:10 +0430 Subject: [PATCH 0409/1862] Fixed the "Comparator and Comparable in Java" Article --- .../java/com/baeldung/comparable/Player.java | 2 +- .../comparator/PlayerAgeComparator.java | 2 +- .../comparator/PlayerRankingComparator.java | 2 +- .../AvoidingSubtractionUnitTest.java | 26 +++++++++++++++++++ .../comparator/Java8ComparatorUnitTest.java | 8 +++--- 5 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 core-java-modules/core-java-lang/src/test/java/com/baeldung/comparator/AvoidingSubtractionUnitTest.java diff --git a/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparable/Player.java b/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparable/Player.java index 68a78980f3..74d9a7577e 100644 --- a/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparable/Player.java +++ b/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparable/Player.java @@ -45,7 +45,7 @@ public class Player implements Comparable { @Override public int compareTo(Player otherPlayer) { - return (this.getRanking() - otherPlayer.getRanking()); + return Integer.compare(getRanking(), otherPlayer.getRanking()); } } diff --git a/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparator/PlayerAgeComparator.java b/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparator/PlayerAgeComparator.java index d2e7ca1f42..56e2163f3c 100644 --- a/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparator/PlayerAgeComparator.java +++ b/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparator/PlayerAgeComparator.java @@ -6,7 +6,7 @@ public class PlayerAgeComparator implements Comparator { @Override public int compare(Player firstPlayer, Player secondPlayer) { - return (firstPlayer.getAge() - secondPlayer.getAge()); + return Integer.compare(firstPlayer.getAge(), secondPlayer.getAge()); } } diff --git a/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparator/PlayerRankingComparator.java b/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparator/PlayerRankingComparator.java index 2d42698843..56aa38d11a 100644 --- a/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparator/PlayerRankingComparator.java +++ b/core-java-modules/core-java-lang/src/main/java/com/baeldung/comparator/PlayerRankingComparator.java @@ -6,7 +6,7 @@ public class PlayerRankingComparator implements Comparator { @Override public int compare(Player firstPlayer, Player secondPlayer) { - return (firstPlayer.getRanking() - secondPlayer.getRanking()); + return Integer.compare(firstPlayer.getRanking(), secondPlayer.getRanking()); } } diff --git a/core-java-modules/core-java-lang/src/test/java/com/baeldung/comparator/AvoidingSubtractionUnitTest.java b/core-java-modules/core-java-lang/src/test/java/com/baeldung/comparator/AvoidingSubtractionUnitTest.java new file mode 100644 index 0000000000..fcca743ca1 --- /dev/null +++ b/core-java-modules/core-java-lang/src/test/java/com/baeldung/comparator/AvoidingSubtractionUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.comparator; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; + +import static org.junit.Assert.assertEquals; + +public class AvoidingSubtractionUnitTest { + + @Test + public void givenTwoPlayers_whenUsingSubtraction_thenOverflow() { + Comparator comparator = (p1, p2) -> p1.getRanking() - p2.getRanking(); + Player player1 = new Player(59, "John", Integer.MAX_VALUE); + Player player2 = new Player(67, "Roger", -1); + + List players = Arrays.asList(player1, player2); + players.sort(comparator); + System.out.println(players); + + assertEquals("John", players.get(0).getName()); + assertEquals("Roger", players.get(1).getName()); + } +} diff --git a/core-java-modules/core-java-lang/src/test/java/com/baeldung/comparator/Java8ComparatorUnitTest.java b/core-java-modules/core-java-lang/src/test/java/com/baeldung/comparator/Java8ComparatorUnitTest.java index 49c8749309..dac05a85b1 100644 --- a/core-java-modules/core-java-lang/src/test/java/com/baeldung/comparator/Java8ComparatorUnitTest.java +++ b/core-java-modules/core-java-lang/src/test/java/com/baeldung/comparator/Java8ComparatorUnitTest.java @@ -1,14 +1,14 @@ package com.baeldung.comparator; -import static org.junit.Assert.assertEquals; +import org.junit.Before; +import org.junit.Test; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import static org.junit.Assert.assertEquals; public class Java8ComparatorUnitTest { @@ -28,7 +28,7 @@ public class Java8ComparatorUnitTest { @Test public void whenComparing_UsingLambda_thenSorted() { System.out.println("************** Java 8 Comaparator **************"); - Comparator byRanking = (Player player1, Player player2) -> player1.getRanking() - player2.getRanking(); + Comparator byRanking = (Player player1, Player player2) -> Integer.compare(player1.getRanking(), player2.getRanking()); System.out.println("Before Sorting : " + footballTeam); Collections.sort(footballTeam, byRanking); From e7d3347960fc47ee8e3ceb6ada579aec57d1064c Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Wed, 12 Aug 2020 01:41:12 +0430 Subject: [PATCH 0410/1862] Fixed the "Sorting in Java" Article --- .../collections/sorting/JavaSortingUnitTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-collections-2/src/test/java/com/baeldung/collections/sorting/JavaSortingUnitTest.java b/core-java-modules/core-java-collections-2/src/test/java/com/baeldung/collections/sorting/JavaSortingUnitTest.java index 2505adcea7..d474e95cb2 100644 --- a/core-java-modules/core-java-collections-2/src/test/java/com/baeldung/collections/sorting/JavaSortingUnitTest.java +++ b/core-java-modules/core-java-collections-2/src/test/java/com/baeldung/collections/sorting/JavaSortingUnitTest.java @@ -5,7 +5,16 @@ import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; import static org.junit.Assert.assertTrue; @@ -138,7 +147,7 @@ public class JavaSortingUnitTest { HashSet descSortedIntegersSet = new LinkedHashSet<>(Arrays.asList(255, 200, 123, 89, 88, 66, 7, 5, 1)); ArrayList list = new ArrayList<>(integersSet); - list.sort((i1, i2) -> i2 - i1); + list.sort(Comparator.reverseOrder()); integersSet = new LinkedHashSet<>(list); assertTrue(Arrays.equals(integersSet.toArray(), descSortedIntegersSet.toArray())); From 1945c8a3124f5d7c7d8a27f976453a934595e015 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Wed, 12 Aug 2020 01:50:52 +0430 Subject: [PATCH 0411/1862] Fixed the "Lambda Sort" Article --- .../src/main/java/com/baeldung/java8/entity/Human.java | 2 +- .../src/test/java/com/baeldung/java8/Java8SortUnitTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/entity/Human.java b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/entity/Human.java index cab8546129..98e35d0af2 100644 --- a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/entity/Human.java +++ b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/entity/Human.java @@ -37,7 +37,7 @@ public class Human { public static int compareByNameThenAge(final Human lhs, final Human rhs) { if (lhs.name.equals(rhs.name)) { - return lhs.age - rhs.age; + return Integer.compare(lhs.age, rhs.age); } else { return lhs.name.compareTo(rhs.name); } diff --git a/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/Java8SortUnitTest.java b/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/Java8SortUnitTest.java index 9e510575fc..e5f876c84b 100644 --- a/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/Java8SortUnitTest.java +++ b/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/Java8SortUnitTest.java @@ -54,7 +54,7 @@ public class Java8SortUnitTest { final List humans = Lists.newArrayList(new Human("Sarah", 12), new Human("Sarah", 10), new Human("Zack", 12)); humans.sort((lhs, rhs) -> { if (lhs.getName().equals(rhs.getName())) { - return lhs.getAge() - rhs.getAge(); + return Integer.compare(lhs.getAge(), rhs.getAge()); } else { return lhs.getName().compareTo(rhs.getName()); } From ea9c64147ba4734719ee3ae4bddbcff904fa5514 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Wed, 12 Aug 2020 07:24:44 +0530 Subject: [PATCH 0412/1862] BAEL-4193 (updated files) - removed not needed fields --- .../nosuchmethoderror/MainMenu.java | 21 ++++++------------- .../nosuchmethoderror/SpecialToday.java | 14 ++++--------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java index aec70cb843..f12cbe1897 100644 --- a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java +++ b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java @@ -1,20 +1,11 @@ package com.baeldung.exceptions.nosuchmethoderror; -import java.util.StringJoiner; - public class MainMenu { - public static void main(String[] args) { - System.out.println("Today's Specials: " + getSpecials()); - } + public static void main(String[] args) { + System.out.println("Today's Specials: " + getSpecials()); + } - public static StringJoiner getSpecials() { - StringJoiner specials = new StringJoiner(", "); - try { - specials.add(SpecialToday.getStarter()); - specials.add(SpecialToday.getDesert()); - } catch (Exception e) { - e.printStackTrace(); - } - return specials; - } + public static String getSpecials() { + return SpecialToday.getDesert(); + } } diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java index 1f47a8934e..1b0dea9784 100644 --- a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java +++ b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java @@ -1,14 +1,8 @@ package com.baeldung.exceptions.nosuchmethoderror; - public class SpecialToday { - private static String desert = "Chocolate Cake"; - private static String starter = "Caesar Salad"; + private static String desert = "Chocolate Cake"; - public static String getDesert() { - return desert; - } - - public static String getStarter() { - return starter; - } + public static String getDesert() { + return desert; + } } From 6a2fcd54c33f583e28b6bd379948066a18171a05 Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 12 Aug 2020 09:57:39 +0530 Subject: [PATCH 0413/1862] Add unit test to assert two list equality without considering order of elements in it. --- testing-modules/testing-assertions/pom.xml | 12 +++++ .../OrderAgnosticListComparison.java | 46 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparison.java diff --git a/testing-modules/testing-assertions/pom.xml b/testing-modules/testing-assertions/pom.xml index 0a7c4b0860..fe8c86d058 100644 --- a/testing-modules/testing-assertions/pom.xml +++ b/testing-modules/testing-assertions/pom.xml @@ -24,5 +24,17 @@ 3.15.0 test + + org.hamcrest + hamcrest-all + 1.3 + test + + + org.apache.commons + commons-collections4 + 4.4 + test + diff --git a/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparison.java b/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparison.java new file mode 100644 index 0000000000..b03723e5bd --- /dev/null +++ b/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparison.java @@ -0,0 +1,46 @@ +package com.baeldung.listassert; + +import org.hamcrest.Matchers; +import org.apache.commons.collections4.CollectionUtils; +import org.junit.Test; + + +import java.util.Arrays; +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class OrderAgnosticListComparison { + + private final List first = Arrays.asList(1, 3, 4, 6, 8); + private final List second = Arrays.asList(8, 1, 6, 3, 4); + private final List third = Arrays.asList(1, 3, 3, 6, 6); + + //In this test using simple JUnit assertion + @Test + public void whenTestingForOrderAgnosticEqualityShouldBeTrue() { + assertTrue(first.size() == second.size() && + first.containsAll(second) && second.containsAll(first)); + } + + @Test + public void whenTestingForOrderAgnosticEqualityShouldBeFalse() { + assertFalse(first.size() == third.size() && + first.containsAll(third) && third.containsAll(first)); + } + + //In this test using Hamcrest lib apis for assertion + @Test + public void whenTestingForOrderAgnosticEqualityShouldBeEqual() { + assertThat(first, Matchers.containsInAnyOrder(second.toArray())); + } + + //In this test asserting lists using Apache Commons apis + @Test + public void whenTestingForOrderAgnosticEqualityShouldBeTrueIfEqualOtherwiseFalse() { + assertTrue(CollectionUtils.isEqualCollection(first, second)); + assertFalse(CollectionUtils.isEqualCollection(first, third)); + } +} From b532f998db741ffe7200cfee2fdf467bbb4eef57 Mon Sep 17 00:00:00 2001 From: Loredana Date: Wed, 12 Aug 2020 19:32:27 +0300 Subject: [PATCH 0414/1862] BAEL-4395 fix test --- .../com/baeldung/copydirectory/ApacheCommonsUnitTest.java | 4 ++-- .../test/java/com/baeldung/copydirectory/CoreOldUnitTest.java | 4 ++-- .../test/java/com/baeldung/copydirectory/JavaNioUnitTest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/ApacheCommonsUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/ApacheCommonsUnitTest.java index 3486a9af9d..eee49a37d7 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/ApacheCommonsUnitTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/ApacheCommonsUnitTest.java @@ -16,10 +16,10 @@ import org.junit.jupiter.api.Test; public class ApacheCommonsUnitTest { - private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory"; + private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory3"; private final String subDirectoryName = "/childDirectory"; private final String fileName = "/file.txt"; - private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory"; + private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory3"; @BeforeEach public void createDirectoryWithSubdirectoryAndFile() throws IOException { diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/CoreOldUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/CoreOldUnitTest.java index 53ae216399..1aaca066a0 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/CoreOldUnitTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/CoreOldUnitTest.java @@ -16,10 +16,10 @@ import org.junit.jupiter.api.Test; public class CoreOldUnitTest { - private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory"; + private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory1"; private final String subDirectoryName = "/childDirectory"; private final String fileName = "/file.txt"; - private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory"; + private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory1"; @BeforeEach public void createDirectoryWithSubdirectoryAndFile() throws IOException { diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/JavaNioUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/JavaNioUnitTest.java index 8d1eea53c9..3293e90c0c 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/JavaNioUnitTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/copydirectory/JavaNioUnitTest.java @@ -16,10 +16,10 @@ import org.junit.jupiter.api.Test; public class JavaNioUnitTest { - private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory"; + private final String sourceDirectoryLocation = "src/test/resources/sourceDirectory2"; private final String subDirectoryName = "/childDirectory"; private final String fileName = "/file.txt"; - private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory"; + private final String destinationDirectoryLocation = "src/test/resources/destinationDirectory2"; @BeforeEach public void createDirectoryWithSubdirectoryAndFile() throws IOException { From dbe203e40aaab48257567e017d664bcda8ff6e5e Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Wed, 12 Aug 2020 19:22:31 +0100 Subject: [PATCH 0415/1862] BAEL-4321 move to new module and use BDD for test names --- .../java/yamltopojo/demo/DemoApplicationTests.java | 13 ------------- .../spring-boot-data-2}/README.md | 0 .../spring-boot-data-2}/pom.xml | 0 .../main/java/yamltopojo/demo/DemoApplication.java | 0 .../yamltopojo/demo/config/TshirtSizeConfig.java | 0 .../demo/controller/TshirtSizeController.java | 2 +- .../yamltopojo/demo/service/SizeConverterImpl.java | 4 ++-- .../demo/service/SizeConverterService.java | 0 .../src/main/resources/application.yml | 0 .../demo/controller/TshirtSizeControllerTest.java | 4 ++-- 10 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/DemoApplicationTests.java rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/README.md (100%) rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/pom.xml (100%) rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/src/main/java/yamltopojo/demo/DemoApplication.java (100%) rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java (100%) rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java (93%) rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java (87%) rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/src/main/java/yamltopojo/demo/service/SizeConverterService.java (100%) rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/src/main/resources/application.yml (100%) rename {configuration/yaml-to-pojo => spring-boot-modules/spring-boot-data-2}/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java (89%) diff --git a/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/DemoApplicationTests.java b/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/DemoApplicationTests.java deleted file mode 100644 index dfe980c05c..0000000000 --- a/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/DemoApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package yamltopojo.demo; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class DemoApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/configuration/yaml-to-pojo/README.md b/spring-boot-modules/spring-boot-data-2/README.md similarity index 100% rename from configuration/yaml-to-pojo/README.md rename to spring-boot-modules/spring-boot-data-2/README.md diff --git a/configuration/yaml-to-pojo/pom.xml b/spring-boot-modules/spring-boot-data-2/pom.xml similarity index 100% rename from configuration/yaml-to-pojo/pom.xml rename to spring-boot-modules/spring-boot-data-2/pom.xml diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/DemoApplication.java b/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/DemoApplication.java similarity index 100% rename from configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/DemoApplication.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/DemoApplication.java diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java b/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java similarity index 100% rename from configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java similarity index 93% rename from configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java index d555549bd4..3504579504 100644 --- a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java +++ b/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java @@ -7,7 +7,7 @@ import yamltopojo.demo.service.SizeConverterService; @RequestMapping(value = "/") public class TshirtSizeController { - private SizeConverterService service; + private final SizeConverterService service; public TshirtSizeController(SizeConverterService service) { this.service = service; diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java b/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java similarity index 87% rename from configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java index 8f95e4253b..829950433e 100644 --- a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java +++ b/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java @@ -7,7 +7,7 @@ import yamltopojo.demo.config.TshirtSizeConfig; @Service public class SizeConverterImpl implements SizeConverterService { - private TshirtSizeConfig tshirtSizeConfig; + private final TshirtSizeConfig tshirtSizeConfig; public SizeConverterImpl(TshirtSizeConfig tshirtSizeConfig) { this.tshirtSizeConfig = tshirtSizeConfig; @@ -17,6 +17,6 @@ public class SizeConverterImpl implements SizeConverterService { if(countryCode == null) { return tshirtSizeConfig.getSimpleMapping().get(label); } - return tshirtSizeConfig.getComplexMapping().get(label).get(countryCode); + return tshirtSizeConfig.getComplexMapping().get(label).get(countryCode.toLowerCase()); } } diff --git a/configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterService.java b/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterService.java similarity index 100% rename from configuration/yaml-to-pojo/src/main/java/yamltopojo/demo/service/SizeConverterService.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterService.java diff --git a/configuration/yaml-to-pojo/src/main/resources/application.yml b/spring-boot-modules/spring-boot-data-2/src/main/resources/application.yml similarity index 100% rename from configuration/yaml-to-pojo/src/main/resources/application.yml rename to spring-boot-modules/spring-boot-data-2/src/main/resources/application.yml diff --git a/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java similarity index 89% rename from configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java rename to spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java index 3c1ef6dff5..ae92d7d57f 100644 --- a/configuration/yaml-to-pojo/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java +++ b/spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java @@ -20,14 +20,14 @@ class TshirtSizeControllerTest { private TshirtSizeController tested; @Test - void convertSize() { + void givenSizeConverter_whenLabelIsSandCountryCodeIsFr_thenReturnCorrectSize() { // Given String label = "S"; String countryCode = "fr"; int result = 36; - // + // When when(service.convertSize(label, countryCode)).thenReturn(result); int actual = tested.convertSize(label, countryCode); From 986566727c3d4ee908271c5978de246140525e83 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Wed, 12 Aug 2020 21:40:45 +0200 Subject: [PATCH 0416/1862] JAVA-1640: Get rid of the overriden spring-boot.version property --- spring-5-security-oauth/pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spring-5-security-oauth/pom.xml b/spring-5-security-oauth/pom.xml index 40d54bf668..325aacea86 100644 --- a/spring-5-security-oauth/pom.xml +++ b/spring-5-security-oauth/pom.xml @@ -37,7 +37,7 @@ org.springframework.security.oauth.boot spring-security-oauth2-autoconfigure - ${oauth-auto.version} + ${spring-boot.version} org.springframework.security @@ -65,8 +65,6 @@ - 2.1.0.RELEASE - 2.1.0.RELEASE com.baeldung.oauth2.SpringOAuthApplication From 5b3ffa4424ac1af6df151dc6ff77cc6a64dfa4ef Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Wed, 12 Aug 2020 21:16:32 +0100 Subject: [PATCH 0417/1862] BAEL-4321 correct parent in pom and follow test naming convention --- spring-boot-modules/spring-boot-data-2/pom.xml | 16 ++++++++-------- .../controller/TshirtSizeControllerTest.java | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spring-boot-modules/spring-boot-data-2/pom.xml b/spring-boot-modules/spring-boot-data-2/pom.xml index f6b55718be..0baaf292e8 100644 --- a/spring-boot-modules/spring-boot-data-2/pom.xml +++ b/spring-boot-modules/spring-boot-data-2/pom.xml @@ -3,16 +3,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.3.2.RELEASE - + com.baeldung.spring-boot-modules + spring-boot-modules + 1.0.0-SNAPSHOT + ../ - yaml-to-pojo - demo + + spring-boot-data-2 0.0.1-SNAPSHOT - demo - Demo project for YAML into POJO + spring-boot-data-2 + Spring Boot Data Module 1.8 diff --git a/spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java index ae92d7d57f..eb6f896be9 100644 --- a/spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java +++ b/spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java @@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class TshirtSizeControllerTest { +class TshirtSizeControllerUnitTest { @Mock private SizeConverterService service; @@ -20,7 +20,7 @@ class TshirtSizeControllerTest { private TshirtSizeController tested; @Test - void givenSizeConverter_whenLabelIsSandCountryCodeIsFr_thenReturnCorrectSize() { + void whenConvertSize_thenOK() { // Given String label = "S"; From 7e1461c40a650964af58464acb27d2b48da11b7c Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Wed, 12 Aug 2020 22:00:11 +0100 Subject: [PATCH 0418/1862] BAEL-4321 fix package name --- .../demo => com/baeldung/boot/data}/DemoApplication.java | 0 .../demo => com/baeldung/boot/data}/config/TshirtSizeConfig.java | 0 .../baeldung/boot/data}/controller/TshirtSizeController.java | 0 .../baeldung/boot/data}/service/SizeConverterImpl.java | 0 .../baeldung/boot/data}/service/SizeConverterService.java | 0 .../baeldung/boot/data}/controller/TshirtSizeControllerTest.java | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename spring-boot-modules/spring-boot-data-2/src/main/java/{yamltopojo/demo => com/baeldung/boot/data}/DemoApplication.java (100%) rename spring-boot-modules/spring-boot-data-2/src/main/java/{yamltopojo/demo => com/baeldung/boot/data}/config/TshirtSizeConfig.java (100%) rename spring-boot-modules/spring-boot-data-2/src/main/java/{yamltopojo/demo => com/baeldung/boot/data}/controller/TshirtSizeController.java (100%) rename spring-boot-modules/spring-boot-data-2/src/main/java/{yamltopojo/demo => com/baeldung/boot/data}/service/SizeConverterImpl.java (100%) rename spring-boot-modules/spring-boot-data-2/src/main/java/{yamltopojo/demo => com/baeldung/boot/data}/service/SizeConverterService.java (100%) rename spring-boot-modules/spring-boot-data-2/src/test/java/{yamltopojo/demo => com/baeldung/boot/data}/controller/TshirtSizeControllerTest.java (100%) diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/DemoApplication.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/DemoApplication.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/DemoApplication.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/DemoApplication.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/config/TshirtSizeConfig.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/config/TshirtSizeConfig.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/config/TshirtSizeConfig.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/controller/TshirtSizeController.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/controller/TshirtSizeController.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/controller/TshirtSizeController.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterImpl.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterImpl.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterImpl.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterService.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterService.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/yamltopojo/demo/service/SizeConverterService.java rename to spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterService.java diff --git a/spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-data-2/src/test/java/com/baeldung/boot/data/controller/TshirtSizeControllerTest.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/test/java/yamltopojo/demo/controller/TshirtSizeControllerTest.java rename to spring-boot-modules/spring-boot-data-2/src/test/java/com/baeldung/boot/data/controller/TshirtSizeControllerTest.java From eb4ce37f31a2925791f02d3e810bcd1103586d43 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Thu, 13 Aug 2020 08:31:19 +0530 Subject: [PATCH 0419/1862] Update MainMenuUnitTest.java Updated the method name to follow BDD conventions --- .../baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java index e9aef1b484..7e53fa9c0e 100644 --- a/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java +++ b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java @@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test; class MainMenuUnitTest { @Test - void testgetSpecials() { + void whenGetSpecials_thenNotNull() { assertNotNull(MainMenu.getSpecials()); } From b94d29a1cc57ada0d4ee3fc0ce31aaa70359c3aa Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Thu, 13 Aug 2020 07:19:44 +0100 Subject: [PATCH 0420/1862] BAEL-4321 fix package name everywhere --- .../src/main/java/com/baeldung/boot/data/DemoApplication.java | 4 ++-- .../java/com/baeldung/boot/data/config/TshirtSizeConfig.java | 2 +- .../baeldung/boot/data/controller/TshirtSizeController.java | 4 ++-- .../com/baeldung/boot/data/service/SizeConverterImpl.java | 4 ++-- .../com/baeldung/boot/data/service/SizeConverterService.java | 2 +- .../boot/data/controller/TshirtSizeControllerTest.java | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/DemoApplication.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/DemoApplication.java index ec8df793c2..125cba6283 100644 --- a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/DemoApplication.java +++ b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/DemoApplication.java @@ -1,9 +1,9 @@ -package yamltopojo.demo; +package com.baeldung.boot.data; +import com.baeldung.boot.data.config.TshirtSizeConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; -import yamltopojo.demo.config.TshirtSizeConfig; @SpringBootApplication @EnableConfigurationProperties(TshirtSizeConfig.class) diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/config/TshirtSizeConfig.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/config/TshirtSizeConfig.java index 8f8d2e5b39..000f5b6826 100644 --- a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/config/TshirtSizeConfig.java +++ b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/config/TshirtSizeConfig.java @@ -1,4 +1,4 @@ -package yamltopojo.demo.config; +package com.baeldung.boot.data.config; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/controller/TshirtSizeController.java index 3504579504..6446a17317 100644 --- a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/controller/TshirtSizeController.java +++ b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/controller/TshirtSizeController.java @@ -1,7 +1,7 @@ -package yamltopojo.demo.controller; +package com.baeldung.boot.data.controller; import org.springframework.web.bind.annotation.*; -import yamltopojo.demo.service.SizeConverterService; +import com.baeldung.boot.data.service.SizeConverterService; @RestController @RequestMapping(value = "/") diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterImpl.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterImpl.java index 829950433e..ccb5a06da4 100644 --- a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterImpl.java +++ b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterImpl.java @@ -1,7 +1,7 @@ -package yamltopojo.demo.service; +package com.baeldung.boot.data.service; import org.springframework.stereotype.Service; -import yamltopojo.demo.config.TshirtSizeConfig; +import com.baeldung.boot.data.config.TshirtSizeConfig; @Service diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterService.java b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterService.java index 3e24681cbe..91cf2bf0b4 100644 --- a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterService.java +++ b/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterService.java @@ -1,4 +1,4 @@ -package yamltopojo.demo.service; +package com.baeldung.boot.data.service; public interface SizeConverterService { diff --git a/spring-boot-modules/spring-boot-data-2/src/test/java/com/baeldung/boot/data/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-data-2/src/test/java/com/baeldung/boot/data/controller/TshirtSizeControllerTest.java index eb6f896be9..1d60eb41c0 100644 --- a/spring-boot-modules/spring-boot-data-2/src/test/java/com/baeldung/boot/data/controller/TshirtSizeControllerTest.java +++ b/spring-boot-modules/spring-boot-data-2/src/test/java/com/baeldung/boot/data/controller/TshirtSizeControllerTest.java @@ -1,11 +1,11 @@ -package yamltopojo.demo.controller; +package com.baeldung.boot.data.controller; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import yamltopojo.demo.service.SizeConverterService; +import com.baeldung.boot.data.service.SizeConverterService; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; From 01b61a6bf01dce1fbba137dc77641745919cb0ec Mon Sep 17 00:00:00 2001 From: CHANDRAKANT Kumar Date: Thu, 13 Aug 2020 11:56:49 +0530 Subject: [PATCH 0421/1862] Adding source code for article tracked under BAEL-4109. --- pom.xml | 2 + spring-webflux-threads/.gitignore | 25 ++++ spring-webflux-threads/README.md | 7 + spring-webflux-threads/pom.xml | 87 ++++++++++++ .../com/baeldung/webflux/Application.java | 13 ++ .../java/com/baeldung/webflux/Controller.java | 128 ++++++++++++++++++ .../java/com/baeldung/webflux/Person.java | 27 ++++ .../baeldung/webflux/PersonRepository.java | 6 + .../src/main/resources/application.yml | 7 + .../src/main/resources/logback.xml | 13 ++ 10 files changed, 315 insertions(+) create mode 100644 spring-webflux-threads/.gitignore create mode 100644 spring-webflux-threads/README.md create mode 100644 spring-webflux-threads/pom.xml create mode 100644 spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java create mode 100644 spring-webflux-threads/src/main/java/com/baeldung/webflux/Controller.java create mode 100644 spring-webflux-threads/src/main/java/com/baeldung/webflux/Person.java create mode 100644 spring-webflux-threads/src/main/java/com/baeldung/webflux/PersonRepository.java create mode 100644 spring-webflux-threads/src/main/resources/application.yml create mode 100644 spring-webflux-threads/src/main/resources/logback.xml diff --git a/pom.xml b/pom.xml index a69ffa2798..3565c2dc4b 100644 --- a/pom.xml +++ b/pom.xml @@ -556,6 +556,7 @@ atomikos reactive-systems slack + spring-webflux-threads @@ -1067,6 +1068,7 @@ atomikos reactive-systems slack + spring-webflux-threads diff --git a/spring-webflux-threads/.gitignore b/spring-webflux-threads/.gitignore new file mode 100644 index 0000000000..82eca336e3 --- /dev/null +++ b/spring-webflux-threads/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/spring-webflux-threads/README.md b/spring-webflux-threads/README.md new file mode 100644 index 0000000000..ab64d897cc --- /dev/null +++ b/spring-webflux-threads/README.md @@ -0,0 +1,7 @@ +## Spring WebFlux Concurrency + +This module contains articles about consurrency model in Spring WebFlux + +### Relevant Articles: + +- [Concurrency in Spring WebFlux]() diff --git a/spring-webflux-threads/pom.xml b/spring-webflux-threads/pom.xml new file mode 100644 index 0000000000..e5b5bafd3b --- /dev/null +++ b/spring-webflux-threads/pom.xml @@ -0,0 +1,87 @@ + + + 4.0.0 + com.baeldung.spring + spring-webflux-threads + 1.0.0-SNAPSHOT + spring-webflux-threads + jar + Spring WebFlux AMQP Sample + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-webflux + + + + + + io.reactivex.rxjava2 + rxjava + 2.2.19 + + + org.springframework.boot + spring-boot-starter-data-mongodb-reactive + + + io.projectreactor.kafka + reactor-kafka + 1.2.2.RELEASE + + + com.fasterxml.jackson.core + jackson-databind + + + org.springframework.boot + spring-boot-starter-test + test + + + io.projectreactor + reactor-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java new file mode 100644 index 0000000000..1dfa00eae0 --- /dev/null +++ b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java @@ -0,0 +1,13 @@ +package com.baeldung.webflux; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Controller.java b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Controller.java new file mode 100644 index 0000000000..7036deb998 --- /dev/null +++ b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Controller.java @@ -0,0 +1,128 @@ +package com.baeldung.webflux; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.apache.kafka.clients.consumer.ConsumerConfig; +import org.apache.kafka.clients.producer.ProducerConfig; +import org.apache.kafka.clients.producer.ProducerRecord; +import org.apache.kafka.common.serialization.IntegerDeserializer; +import org.apache.kafka.common.serialization.IntegerSerializer; +import org.apache.kafka.common.serialization.StringDeserializer; +import org.apache.kafka.common.serialization.StringSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.reactive.function.client.WebClient; + +import io.reactivex.Observable; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; +import reactor.core.scheduler.Schedulers; +import reactor.kafka.receiver.KafkaReceiver; +import reactor.kafka.receiver.ReceiverOptions; +import reactor.kafka.receiver.ReceiverRecord; +import reactor.kafka.sender.KafkaSender; +import reactor.kafka.sender.SenderOptions; +import reactor.kafka.sender.SenderRecord; + +@RestController +@RequestMapping("/") +public class Controller { + + @Autowired + private PersonRepository personRepository; + + private Scheduler scheduler = Schedulers.newBoundedElastic(5, 10, "MyThreadGroup"); + + private Logger logger = LoggerFactory.getLogger(Controller.class); + + @GetMapping("/threads/webflux") + public Flux getThreadsWebflux() { + return Flux.fromIterable(getThreads()); + } + + @GetMapping("/threads/webclient") + public Flux getThreadsWebClient() { + WebClient.create("http://localhost:8080/index") + .get() + .retrieve() + .bodyToMono(String.class) + .subscribeOn(scheduler) + .publishOn(scheduler) + .doOnNext(s -> logger.info("Response: {}", s)) + .subscribe(); + return Flux.fromIterable(getThreads()); + } + + @GetMapping("/threads/rxjava") + public Observable getIndexRxJava() { + Observable.fromIterable(Arrays.asList("Hello", "World")) + .map(s -> s.toUpperCase()) + .observeOn(io.reactivex.schedulers.Schedulers.trampoline()) + .doOnNext(s -> logger.info("String: {}", s)) + .subscribe(); + return Observable.fromIterable(getThreads()); + } + + @GetMapping("/threads/mongodb") + public Flux getIndexMongo() { + personRepository.findAll() + .doOnNext(p -> logger.info("Person: {}", p)) + .subscribe(); + return Flux.fromIterable(getThreads()); + } + + @GetMapping("/thareds/reactor-kafka") + public Flux getIndexKafka() { + Map producerProps = new HashMap<>(); + producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); + producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, IntegerSerializer.class); + producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class); + SenderOptions senderOptions = SenderOptions.create(producerProps); + KafkaSender sender = KafkaSender.create(senderOptions); + Flux> outboundFlux = Flux.range(1, 10) + .map(i -> SenderRecord.create(new ProducerRecord<>("reactive-test", i, "Message_" + i), i)); + sender.send(outboundFlux) + .subscribe(); + + Map consumerProps = new HashMap<>(); + consumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); + consumerProps.put(ConsumerConfig.CLIENT_ID_CONFIG, "my-consumer"); + consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, "my-group"); + consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, IntegerDeserializer.class); + consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); + consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); + ReceiverOptions receiverOptions = ReceiverOptions.create(consumerProps); + receiverOptions.subscription(Collections.singleton("reactive-test")); + KafkaReceiver receiver = KafkaReceiver.create(receiverOptions); + Flux> inboundFlux = receiver.receive(); + inboundFlux.subscribe(r -> { + logger.info("Received message: {}", r.value()); + r.receiverOffset() + .acknowledge(); + }); + return Flux.fromIterable(getThreads()); + } + + @GetMapping("/index") + public Mono getIndex() { + return Mono.just("Hello world!"); + } + + private List getThreads() { + return Thread.getAllStackTraces() + .keySet() + .stream() + .map(t -> String.format("%-20s \t %s \t %d \t %s\n", t.getName(), t.getState(), t.getPriority(), t.isDaemon() ? "Daemon" : "Normal")) + .collect(Collectors.toList()); + } +} diff --git a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Person.java b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Person.java new file mode 100644 index 0000000000..4c6bd5f585 --- /dev/null +++ b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Person.java @@ -0,0 +1,27 @@ +package com.baeldung.webflux; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +@Document +public class Person { + @Id + String id; + + public Person(String id) { + this.id = id; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public String toString() { + return "Person{" + "id='" + id + '\'' + '}'; + } +} diff --git a/spring-webflux-threads/src/main/java/com/baeldung/webflux/PersonRepository.java b/spring-webflux-threads/src/main/java/com/baeldung/webflux/PersonRepository.java new file mode 100644 index 0000000000..38fbd3d431 --- /dev/null +++ b/spring-webflux-threads/src/main/java/com/baeldung/webflux/PersonRepository.java @@ -0,0 +1,6 @@ +package com.baeldung.webflux; + +import org.springframework.data.mongodb.repository.ReactiveMongoRepository; + +public interface PersonRepository extends ReactiveMongoRepository { +} diff --git a/spring-webflux-threads/src/main/resources/application.yml b/spring-webflux-threads/src/main/resources/application.yml new file mode 100644 index 0000000000..5addcff6c2 --- /dev/null +++ b/spring-webflux-threads/src/main/resources/application.yml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/spring-webflux-threads/src/main/resources/logback.xml b/spring-webflux-threads/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-webflux-threads/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file From bc2352684ac2aef229726f35a8a70e22175522c7 Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Thu, 13 Aug 2020 09:12:53 +0200 Subject: [PATCH 0422/1862] BAEL-4341 - Add AfterEach annotation instead of BeforeEach on tearDown method --- .../java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java index 3ffc508fa5..549f0ee7b9 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/systemout/SystemOutPrintlnUnitTest.java @@ -4,6 +4,7 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; import org.junit.Assert; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -19,7 +20,7 @@ class SystemOutPrintlnUnitTest { System.setOut(new PrintStream(outputStreamCaptor)); } - @BeforeEach + @AfterEach public void tearDown() { System.setOut(standardOut); } From 103d36000f726710fea3272164ca2280f8943bc7 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 13 Aug 2020 12:49:18 +0530 Subject: [PATCH 0423/1862] JAVA-67: renamed spring-security-angular to spring-security-web-angular --- .../README.md | 0 .../client/anguarjs/app.js | 0 .../client/anguarjs/home/home.controller.js | 0 .../client/anguarjs/home/home.view.html | 0 .../client/anguarjs/index.html | 0 .../client/anguarjs/login/login.controller.js | 0 .../client/anguarjs/login/login.view.html | 0 .../client/angular2/app.css | 0 .../client/angular2/app/app.component.html | 0 .../client/angular2/app/app.component.ts | 0 .../client/angular2/app/app.module.ts | 0 .../client/angular2/app/app.routing.ts | 0 .../client/angular2/app/home/home.component.html | 0 .../client/angular2/app/home/home.component.ts | 0 .../client/angular2/app/login/login.component.html | 0 .../client/angular2/app/login/login.component.ts | 0 .../client/angular2/app/main.ts | 0 .../client/angular2/index.html | 0 .../client/angular2/package.json | 0 .../client/angular2/systemjs.config.js | 0 .../client/angular2/tsconfig.json | 0 .../client/angular4/.angular-cli.json | 0 .../client/angular4/package.json | 0 .../client/angular4/src/app/app.component.html | 0 .../client/angular4/src/app/app.component.ts | 0 .../client/angular4/src/app/app.module.ts | 0 .../client/angular4/src/app/app.routing.ts | 0 .../client/angular4/src/app/home/home.component.html | 0 .../client/angular4/src/app/home/home.component.ts | 0 .../client/angular4/src/app/login/login.component.html | 0 .../client/angular4/src/app/login/login.component.ts | 0 .../client/angular4/src/index.html | 0 .../client/angular4/src/main.ts | 0 .../client/angular4/src/polyfills.ts | 0 .../client/angular4/src/styles.css | 0 .../client/angular4/src/tsconfig.app.json | 0 .../client/angular4/tsconfig.json | 0 .../client/angular4/tslint.json | 0 .../client/angular5/.angular-cli.json | 0 .../client/angular5/package.json | 0 .../client/angular5/src/app/app.component.html | 0 .../client/angular5/src/app/app.component.ts | 0 .../client/angular5/src/app/app.module.ts | 0 .../client/angular5/src/app/app.routing.ts | 0 .../client/angular5/src/app/home/home.component.html | 0 .../client/angular5/src/app/home/home.component.ts | 0 .../client/angular5/src/app/login/login.component.html | 0 .../client/angular5/src/app/login/login.component.ts | 0 .../client/angular5/src/index.html | 0 .../client/angular5/src/main.ts | 0 .../client/angular5/src/polyfills.ts | 0 .../client/angular5/src/styles.css | 0 .../client/angular5/src/tsconfig.app.json | 0 .../client/angular5/tsconfig.json | 0 .../client/angular5/tslint.json | 0 .../client/angular6/angular.json | 0 .../client/angular6/package.json | 0 .../client/angular6/src/app/app.component.html | 0 .../client/angular6/src/app/app.component.ts | 0 .../client/angular6/src/app/app.module.ts | 0 .../client/angular6/src/app/app.routing.ts | 0 .../client/angular6/src/app/home/home.component.html | 0 .../client/angular6/src/app/home/home.component.ts | 0 .../client/angular6/src/app/login/login.component.html | 0 .../client/angular6/src/app/login/login.component.ts | 0 .../client/angular6/src/index.html | 0 .../client/angular6/src/main.ts | 0 .../client/angular6/src/polyfills.ts | 0 .../client/angular6/src/styles.css | 0 .../client/angular6/src/tsconfig.app.json | 0 .../client/angular6/tsconfig.json | 0 .../client/angular6/tslint.json | 0 .../server/pom.xml | 0 .../basicauth/SpringBootSecurityApplication.java | 0 .../basicauth/config/BasicAuthConfiguration.java | 0 .../springbootsecurityrest/controller/UserController.java | 0 .../main/java/com/baeldung/springbootsecurityrest/vo/User.java | 0 .../server/src/main/resources/application.properties | 0 .../server/src/main/resources/logback.xml | 0 .../server/src/test/java/com/baeldung/SpringContextTest.java | 0 .../BasicAuthConfigurationIntegrationTest.java | 0 81 files changed, 0 insertions(+), 0 deletions(-) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/README.md (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/anguarjs/app.js (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/anguarjs/home/home.controller.js (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/anguarjs/home/home.view.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/anguarjs/index.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/anguarjs/login/login.controller.js (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/anguarjs/login/login.view.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app.css (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/app.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/app.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/app.module.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/app.routing.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/home/home.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/home/home.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/login/login.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/login/login.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/app/main.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/index.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/package.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/systemjs.config.js (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular2/tsconfig.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/.angular-cli.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/package.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/app/app.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/app/app.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/app/app.module.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/app/app.routing.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/app/home/home.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/app/home/home.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/app/login/login.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/app/login/login.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/index.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/main.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/polyfills.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/styles.css (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/src/tsconfig.app.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/tsconfig.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular4/tslint.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/.angular-cli.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/package.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/app/app.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/app/app.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/app/app.module.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/app/app.routing.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/app/home/home.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/app/home/home.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/app/login/login.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/app/login/login.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/index.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/main.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/polyfills.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/styles.css (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/src/tsconfig.app.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/tsconfig.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular5/tslint.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/angular.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/package.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/app/app.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/app/app.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/app/app.module.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/app/app.routing.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/app/home/home.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/app/home/home.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/app/login/login.component.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/app/login/login.component.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/index.html (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/main.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/polyfills.ts (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/styles.css (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/src/tsconfig.app.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/tsconfig.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/client/angular6/tslint.json (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/pom.xml (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-angular => spring-security-web-angular}/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java (100%) diff --git a/spring-security-modules/spring-security-angular/README.md b/spring-security-modules/spring-security-web-angular/README.md similarity index 100% rename from spring-security-modules/spring-security-angular/README.md rename to spring-security-modules/spring-security-web-angular/README.md diff --git a/spring-security-modules/spring-security-angular/client/anguarjs/app.js b/spring-security-modules/spring-security-web-angular/client/anguarjs/app.js similarity index 100% rename from spring-security-modules/spring-security-angular/client/anguarjs/app.js rename to spring-security-modules/spring-security-web-angular/client/anguarjs/app.js diff --git a/spring-security-modules/spring-security-angular/client/anguarjs/home/home.controller.js b/spring-security-modules/spring-security-web-angular/client/anguarjs/home/home.controller.js similarity index 100% rename from spring-security-modules/spring-security-angular/client/anguarjs/home/home.controller.js rename to spring-security-modules/spring-security-web-angular/client/anguarjs/home/home.controller.js diff --git a/spring-security-modules/spring-security-angular/client/anguarjs/home/home.view.html b/spring-security-modules/spring-security-web-angular/client/anguarjs/home/home.view.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/anguarjs/home/home.view.html rename to spring-security-modules/spring-security-web-angular/client/anguarjs/home/home.view.html diff --git a/spring-security-modules/spring-security-angular/client/anguarjs/index.html b/spring-security-modules/spring-security-web-angular/client/anguarjs/index.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/anguarjs/index.html rename to spring-security-modules/spring-security-web-angular/client/anguarjs/index.html diff --git a/spring-security-modules/spring-security-angular/client/anguarjs/login/login.controller.js b/spring-security-modules/spring-security-web-angular/client/anguarjs/login/login.controller.js similarity index 100% rename from spring-security-modules/spring-security-angular/client/anguarjs/login/login.controller.js rename to spring-security-modules/spring-security-web-angular/client/anguarjs/login/login.controller.js diff --git a/spring-security-modules/spring-security-angular/client/anguarjs/login/login.view.html b/spring-security-modules/spring-security-web-angular/client/anguarjs/login/login.view.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/anguarjs/login/login.view.html rename to spring-security-modules/spring-security-web-angular/client/anguarjs/login/login.view.html diff --git a/spring-security-modules/spring-security-angular/client/angular2/app.css b/spring-security-modules/spring-security-web-angular/client/angular2/app.css similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app.css rename to spring-security-modules/spring-security-web-angular/client/angular2/app.css diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/app.component.html b/spring-security-modules/spring-security-web-angular/client/angular2/app/app.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/app.component.html rename to spring-security-modules/spring-security-web-angular/client/angular2/app/app.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/app.component.ts b/spring-security-modules/spring-security-web-angular/client/angular2/app/app.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/app.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular2/app/app.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/app.module.ts b/spring-security-modules/spring-security-web-angular/client/angular2/app/app.module.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/app.module.ts rename to spring-security-modules/spring-security-web-angular/client/angular2/app/app.module.ts diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/app.routing.ts b/spring-security-modules/spring-security-web-angular/client/angular2/app/app.routing.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/app.routing.ts rename to spring-security-modules/spring-security-web-angular/client/angular2/app/app.routing.ts diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/home/home.component.html b/spring-security-modules/spring-security-web-angular/client/angular2/app/home/home.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/home/home.component.html rename to spring-security-modules/spring-security-web-angular/client/angular2/app/home/home.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/home/home.component.ts b/spring-security-modules/spring-security-web-angular/client/angular2/app/home/home.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/home/home.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular2/app/home/home.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/login/login.component.html b/spring-security-modules/spring-security-web-angular/client/angular2/app/login/login.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/login/login.component.html rename to spring-security-modules/spring-security-web-angular/client/angular2/app/login/login.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/login/login.component.ts b/spring-security-modules/spring-security-web-angular/client/angular2/app/login/login.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/login/login.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular2/app/login/login.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular2/app/main.ts b/spring-security-modules/spring-security-web-angular/client/angular2/app/main.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/app/main.ts rename to spring-security-modules/spring-security-web-angular/client/angular2/app/main.ts diff --git a/spring-security-modules/spring-security-angular/client/angular2/index.html b/spring-security-modules/spring-security-web-angular/client/angular2/index.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/index.html rename to spring-security-modules/spring-security-web-angular/client/angular2/index.html diff --git a/spring-security-modules/spring-security-angular/client/angular2/package.json b/spring-security-modules/spring-security-web-angular/client/angular2/package.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/package.json rename to spring-security-modules/spring-security-web-angular/client/angular2/package.json diff --git a/spring-security-modules/spring-security-angular/client/angular2/systemjs.config.js b/spring-security-modules/spring-security-web-angular/client/angular2/systemjs.config.js similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/systemjs.config.js rename to spring-security-modules/spring-security-web-angular/client/angular2/systemjs.config.js diff --git a/spring-security-modules/spring-security-angular/client/angular2/tsconfig.json b/spring-security-modules/spring-security-web-angular/client/angular2/tsconfig.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular2/tsconfig.json rename to spring-security-modules/spring-security-web-angular/client/angular2/tsconfig.json diff --git a/spring-security-modules/spring-security-angular/client/angular4/.angular-cli.json b/spring-security-modules/spring-security-web-angular/client/angular4/.angular-cli.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/.angular-cli.json rename to spring-security-modules/spring-security-web-angular/client/angular4/.angular-cli.json diff --git a/spring-security-modules/spring-security-angular/client/angular4/package.json b/spring-security-modules/spring-security-web-angular/client/angular4/package.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/package.json rename to spring-security-modules/spring-security-web-angular/client/angular4/package.json diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/app/app.component.html b/spring-security-modules/spring-security-web-angular/client/angular4/src/app/app.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/app/app.component.html rename to spring-security-modules/spring-security-web-angular/client/angular4/src/app/app.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/app/app.component.ts b/spring-security-modules/spring-security-web-angular/client/angular4/src/app/app.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/app/app.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular4/src/app/app.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/app/app.module.ts b/spring-security-modules/spring-security-web-angular/client/angular4/src/app/app.module.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/app/app.module.ts rename to spring-security-modules/spring-security-web-angular/client/angular4/src/app/app.module.ts diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/app/app.routing.ts b/spring-security-modules/spring-security-web-angular/client/angular4/src/app/app.routing.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/app/app.routing.ts rename to spring-security-modules/spring-security-web-angular/client/angular4/src/app/app.routing.ts diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/app/home/home.component.html b/spring-security-modules/spring-security-web-angular/client/angular4/src/app/home/home.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/app/home/home.component.html rename to spring-security-modules/spring-security-web-angular/client/angular4/src/app/home/home.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/app/home/home.component.ts b/spring-security-modules/spring-security-web-angular/client/angular4/src/app/home/home.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/app/home/home.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular4/src/app/home/home.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/app/login/login.component.html b/spring-security-modules/spring-security-web-angular/client/angular4/src/app/login/login.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/app/login/login.component.html rename to spring-security-modules/spring-security-web-angular/client/angular4/src/app/login/login.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/app/login/login.component.ts b/spring-security-modules/spring-security-web-angular/client/angular4/src/app/login/login.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/app/login/login.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular4/src/app/login/login.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/index.html b/spring-security-modules/spring-security-web-angular/client/angular4/src/index.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/index.html rename to spring-security-modules/spring-security-web-angular/client/angular4/src/index.html diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/main.ts b/spring-security-modules/spring-security-web-angular/client/angular4/src/main.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/main.ts rename to spring-security-modules/spring-security-web-angular/client/angular4/src/main.ts diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/polyfills.ts b/spring-security-modules/spring-security-web-angular/client/angular4/src/polyfills.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/polyfills.ts rename to spring-security-modules/spring-security-web-angular/client/angular4/src/polyfills.ts diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/styles.css b/spring-security-modules/spring-security-web-angular/client/angular4/src/styles.css similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/styles.css rename to spring-security-modules/spring-security-web-angular/client/angular4/src/styles.css diff --git a/spring-security-modules/spring-security-angular/client/angular4/src/tsconfig.app.json b/spring-security-modules/spring-security-web-angular/client/angular4/src/tsconfig.app.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/src/tsconfig.app.json rename to spring-security-modules/spring-security-web-angular/client/angular4/src/tsconfig.app.json diff --git a/spring-security-modules/spring-security-angular/client/angular4/tsconfig.json b/spring-security-modules/spring-security-web-angular/client/angular4/tsconfig.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/tsconfig.json rename to spring-security-modules/spring-security-web-angular/client/angular4/tsconfig.json diff --git a/spring-security-modules/spring-security-angular/client/angular4/tslint.json b/spring-security-modules/spring-security-web-angular/client/angular4/tslint.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular4/tslint.json rename to spring-security-modules/spring-security-web-angular/client/angular4/tslint.json diff --git a/spring-security-modules/spring-security-angular/client/angular5/.angular-cli.json b/spring-security-modules/spring-security-web-angular/client/angular5/.angular-cli.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/.angular-cli.json rename to spring-security-modules/spring-security-web-angular/client/angular5/.angular-cli.json diff --git a/spring-security-modules/spring-security-angular/client/angular5/package.json b/spring-security-modules/spring-security-web-angular/client/angular5/package.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/package.json rename to spring-security-modules/spring-security-web-angular/client/angular5/package.json diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/app/app.component.html b/spring-security-modules/spring-security-web-angular/client/angular5/src/app/app.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/app/app.component.html rename to spring-security-modules/spring-security-web-angular/client/angular5/src/app/app.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/app/app.component.ts b/spring-security-modules/spring-security-web-angular/client/angular5/src/app/app.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/app/app.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular5/src/app/app.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/app/app.module.ts b/spring-security-modules/spring-security-web-angular/client/angular5/src/app/app.module.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/app/app.module.ts rename to spring-security-modules/spring-security-web-angular/client/angular5/src/app/app.module.ts diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/app/app.routing.ts b/spring-security-modules/spring-security-web-angular/client/angular5/src/app/app.routing.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/app/app.routing.ts rename to spring-security-modules/spring-security-web-angular/client/angular5/src/app/app.routing.ts diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/app/home/home.component.html b/spring-security-modules/spring-security-web-angular/client/angular5/src/app/home/home.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/app/home/home.component.html rename to spring-security-modules/spring-security-web-angular/client/angular5/src/app/home/home.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/app/home/home.component.ts b/spring-security-modules/spring-security-web-angular/client/angular5/src/app/home/home.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/app/home/home.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular5/src/app/home/home.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/app/login/login.component.html b/spring-security-modules/spring-security-web-angular/client/angular5/src/app/login/login.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/app/login/login.component.html rename to spring-security-modules/spring-security-web-angular/client/angular5/src/app/login/login.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/app/login/login.component.ts b/spring-security-modules/spring-security-web-angular/client/angular5/src/app/login/login.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/app/login/login.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular5/src/app/login/login.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/index.html b/spring-security-modules/spring-security-web-angular/client/angular5/src/index.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/index.html rename to spring-security-modules/spring-security-web-angular/client/angular5/src/index.html diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/main.ts b/spring-security-modules/spring-security-web-angular/client/angular5/src/main.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/main.ts rename to spring-security-modules/spring-security-web-angular/client/angular5/src/main.ts diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/polyfills.ts b/spring-security-modules/spring-security-web-angular/client/angular5/src/polyfills.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/polyfills.ts rename to spring-security-modules/spring-security-web-angular/client/angular5/src/polyfills.ts diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/styles.css b/spring-security-modules/spring-security-web-angular/client/angular5/src/styles.css similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/styles.css rename to spring-security-modules/spring-security-web-angular/client/angular5/src/styles.css diff --git a/spring-security-modules/spring-security-angular/client/angular5/src/tsconfig.app.json b/spring-security-modules/spring-security-web-angular/client/angular5/src/tsconfig.app.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/src/tsconfig.app.json rename to spring-security-modules/spring-security-web-angular/client/angular5/src/tsconfig.app.json diff --git a/spring-security-modules/spring-security-angular/client/angular5/tsconfig.json b/spring-security-modules/spring-security-web-angular/client/angular5/tsconfig.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/tsconfig.json rename to spring-security-modules/spring-security-web-angular/client/angular5/tsconfig.json diff --git a/spring-security-modules/spring-security-angular/client/angular5/tslint.json b/spring-security-modules/spring-security-web-angular/client/angular5/tslint.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular5/tslint.json rename to spring-security-modules/spring-security-web-angular/client/angular5/tslint.json diff --git a/spring-security-modules/spring-security-angular/client/angular6/angular.json b/spring-security-modules/spring-security-web-angular/client/angular6/angular.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/angular.json rename to spring-security-modules/spring-security-web-angular/client/angular6/angular.json diff --git a/spring-security-modules/spring-security-angular/client/angular6/package.json b/spring-security-modules/spring-security-web-angular/client/angular6/package.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/package.json rename to spring-security-modules/spring-security-web-angular/client/angular6/package.json diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/app/app.component.html b/spring-security-modules/spring-security-web-angular/client/angular6/src/app/app.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/app/app.component.html rename to spring-security-modules/spring-security-web-angular/client/angular6/src/app/app.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/app/app.component.ts b/spring-security-modules/spring-security-web-angular/client/angular6/src/app/app.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/app/app.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular6/src/app/app.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/app/app.module.ts b/spring-security-modules/spring-security-web-angular/client/angular6/src/app/app.module.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/app/app.module.ts rename to spring-security-modules/spring-security-web-angular/client/angular6/src/app/app.module.ts diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/app/app.routing.ts b/spring-security-modules/spring-security-web-angular/client/angular6/src/app/app.routing.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/app/app.routing.ts rename to spring-security-modules/spring-security-web-angular/client/angular6/src/app/app.routing.ts diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/app/home/home.component.html b/spring-security-modules/spring-security-web-angular/client/angular6/src/app/home/home.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/app/home/home.component.html rename to spring-security-modules/spring-security-web-angular/client/angular6/src/app/home/home.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/app/home/home.component.ts b/spring-security-modules/spring-security-web-angular/client/angular6/src/app/home/home.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/app/home/home.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular6/src/app/home/home.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/app/login/login.component.html b/spring-security-modules/spring-security-web-angular/client/angular6/src/app/login/login.component.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/app/login/login.component.html rename to spring-security-modules/spring-security-web-angular/client/angular6/src/app/login/login.component.html diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/app/login/login.component.ts b/spring-security-modules/spring-security-web-angular/client/angular6/src/app/login/login.component.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/app/login/login.component.ts rename to spring-security-modules/spring-security-web-angular/client/angular6/src/app/login/login.component.ts diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/index.html b/spring-security-modules/spring-security-web-angular/client/angular6/src/index.html similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/index.html rename to spring-security-modules/spring-security-web-angular/client/angular6/src/index.html diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/main.ts b/spring-security-modules/spring-security-web-angular/client/angular6/src/main.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/main.ts rename to spring-security-modules/spring-security-web-angular/client/angular6/src/main.ts diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/polyfills.ts b/spring-security-modules/spring-security-web-angular/client/angular6/src/polyfills.ts similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/polyfills.ts rename to spring-security-modules/spring-security-web-angular/client/angular6/src/polyfills.ts diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/styles.css b/spring-security-modules/spring-security-web-angular/client/angular6/src/styles.css similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/styles.css rename to spring-security-modules/spring-security-web-angular/client/angular6/src/styles.css diff --git a/spring-security-modules/spring-security-angular/client/angular6/src/tsconfig.app.json b/spring-security-modules/spring-security-web-angular/client/angular6/src/tsconfig.app.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/src/tsconfig.app.json rename to spring-security-modules/spring-security-web-angular/client/angular6/src/tsconfig.app.json diff --git a/spring-security-modules/spring-security-angular/client/angular6/tsconfig.json b/spring-security-modules/spring-security-web-angular/client/angular6/tsconfig.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/tsconfig.json rename to spring-security-modules/spring-security-web-angular/client/angular6/tsconfig.json diff --git a/spring-security-modules/spring-security-angular/client/angular6/tslint.json b/spring-security-modules/spring-security-web-angular/client/angular6/tslint.json similarity index 100% rename from spring-security-modules/spring-security-angular/client/angular6/tslint.json rename to spring-security-modules/spring-security-web-angular/client/angular6/tslint.json diff --git a/spring-security-modules/spring-security-angular/server/pom.xml b/spring-security-modules/spring-security-web-angular/server/pom.xml similarity index 100% rename from spring-security-modules/spring-security-angular/server/pom.xml rename to spring-security-modules/spring-security-web-angular/server/pom.xml diff --git a/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java b/spring-security-modules/spring-security-web-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java similarity index 100% rename from spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java rename to spring-security-modules/spring-security-web-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/SpringBootSecurityApplication.java diff --git a/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java b/spring-security-modules/spring-security-web-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java similarity index 100% rename from spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java rename to spring-security-modules/spring-security-web-angular/server/src/main/java/com/baeldung/springbootsecurityrest/basicauth/config/BasicAuthConfiguration.java diff --git a/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java b/spring-security-modules/spring-security-web-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java similarity index 100% rename from spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java rename to spring-security-modules/spring-security-web-angular/server/src/main/java/com/baeldung/springbootsecurityrest/controller/UserController.java diff --git a/spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java b/spring-security-modules/spring-security-web-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java similarity index 100% rename from spring-security-modules/spring-security-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java rename to spring-security-modules/spring-security-web-angular/server/src/main/java/com/baeldung/springbootsecurityrest/vo/User.java diff --git a/spring-security-modules/spring-security-angular/server/src/main/resources/application.properties b/spring-security-modules/spring-security-web-angular/server/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-angular/server/src/main/resources/application.properties rename to spring-security-modules/spring-security-web-angular/server/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-angular/server/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-angular/server/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-angular/server/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-angular/server/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-angular/server/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-angular/server/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java b/spring-security-modules/spring-security-web-angular/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java rename to spring-security-modules/spring-security-web-angular/server/src/test/java/com/baeldung/springbootsecurityrest/BasicAuthConfigurationIntegrationTest.java From 36a2c6edb1ac65222ee6c1fded19c34357f6f57c Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 13 Aug 2020 12:51:16 +0530 Subject: [PATCH 0424/1862] JAVA-67: renamed spring-security-mvc to spring-security-web-mvc --- .../.gitignore | 0 .../README.md | 0 .../{spring-security-mvc => spring-security-web-mvc}/pom.xml | 4 ++-- .../baeldung/clearsitedata/LogoutClearSiteDataController.java | 0 .../java/com/baeldung/clearsitedata/SpringSecurityConfig.java | 0 .../src/main/java/com/baeldung/clearsitedata/WebConfig.java | 0 .../java/com/baeldung/monitoring/MetricRegistrySingleton.java | 0 .../security/MySimpleUrlAuthenticationSuccessHandler.java | 0 .../java/com/baeldung/session/SpringSessionApplication.java | 0 .../src/main/java/com/baeldung/session/bean/Constants.java | 0 .../src/main/java/com/baeldung/session/bean/Foo.java | 0 .../main/java/com/baeldung/session/filter/SessionFilter.java | 0 .../baeldung/session/security/config/SecSecurityConfig.java | 0 .../src/main/java/com/baeldung/session/web/FooController.java | 0 .../java/com/baeldung/session/web/SessionRestController.java | 0 .../baeldung/session/web/config/MainWebAppInitializer.java | 0 .../main/java/com/baeldung/session/web/config/MvcConfig.java | 0 .../java/com/baeldung/web/SessionListenerWithMetrics.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/main/webapp/WEB-INF/mvc-servlet.xml | 0 .../src/main/webapp/WEB-INF/view/anonymous.jsp | 0 .../src/main/webapp/WEB-INF/view/console.jsp | 0 .../src/main/webapp/WEB-INF/view/homepage.jsp | 0 .../src/main/webapp/WEB-INF/view/invalidSession.jsp | 0 .../src/main/webapp/WEB-INF/view/login.jsp | 0 .../src/main/webapp/WEB-INF/view/sessionExpired.jsp | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 .../clearsitedata/LogoutClearSiteDataControllerUnitTest.java | 0 .../com/baeldung/session/SessionConfigurationLiveTest.java | 0 .../src/test/resources/.gitignore | 0 33 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/.gitignore (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/README.md (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/pom.xml (97%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/clearsitedata/LogoutClearSiteDataController.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/clearsitedata/SpringSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/clearsitedata/WebConfig.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/SpringSessionApplication.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/bean/Constants.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/bean/Foo.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/filter/SessionFilter.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/web/FooController.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/web/SessionRestController.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/web/config/MainWebAppInitializer.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/session/web/config/MvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/webapp/WEB-INF/mvc-servlet.xml (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/webapp/WEB-INF/view/anonymous.jsp (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/webapp/WEB-INF/view/console.jsp (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/webapp/WEB-INF/view/homepage.jsp (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/webapp/WEB-INF/view/invalidSession.jsp (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/webapp/WEB-INF/view/login.jsp (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/webapp/WEB-INF/view/sessionExpired.jsp (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/main/webapp/WEB-INF/web.xml (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/test/java/com/baeldung/clearsitedata/LogoutClearSiteDataControllerUnitTest.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java (100%) rename spring-security-modules/{spring-security-mvc => spring-security-web-mvc}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/spring-security-mvc/.gitignore b/spring-security-modules/spring-security-web-mvc/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc/.gitignore rename to spring-security-modules/spring-security-web-mvc/.gitignore diff --git a/spring-security-modules/spring-security-mvc/README.md b/spring-security-modules/spring-security-web-mvc/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc/README.md rename to spring-security-modules/spring-security-web-mvc/README.md diff --git a/spring-security-modules/spring-security-mvc/pom.xml b/spring-security-modules/spring-security-web-mvc/pom.xml similarity index 97% rename from spring-security-modules/spring-security-mvc/pom.xml rename to spring-security-modules/spring-security-web-mvc/pom.xml index d97825975f..2651b3a0f2 100644 --- a/spring-security-modules/spring-security-mvc/pom.xml +++ b/spring-security-modules/spring-security-web-mvc/pom.xml @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - spring-security-mvc + spring-security-web-mvc 0.1-SNAPSHOT - spring-security-mvc + spring-security-web-mvc jar diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/LogoutClearSiteDataController.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/clearsitedata/LogoutClearSiteDataController.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/LogoutClearSiteDataController.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/clearsitedata/LogoutClearSiteDataController.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/SpringSecurityConfig.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/clearsitedata/SpringSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/SpringSecurityConfig.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/clearsitedata/SpringSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/WebConfig.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/clearsitedata/WebConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/WebConfig.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/clearsitedata/WebConfig.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/SpringSessionApplication.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/SpringSessionApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/SpringSessionApplication.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/SpringSessionApplication.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/bean/Constants.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/bean/Constants.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/bean/Constants.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/bean/Constants.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/bean/Foo.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/bean/Foo.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/bean/Foo.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/bean/Foo.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/filter/SessionFilter.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/filter/SessionFilter.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/filter/SessionFilter.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/filter/SessionFilter.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/security/config/SecSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/FooController.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/web/FooController.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/FooController.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/web/FooController.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/SessionRestController.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/web/SessionRestController.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/SessionRestController.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/web/SessionRestController.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/config/MainWebAppInitializer.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/web/config/MainWebAppInitializer.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/config/MainWebAppInitializer.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/web/config/MainWebAppInitializer.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/config/MvcConfig.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/web/config/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/session/web/config/MvcConfig.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/session/web/config/MvcConfig.java diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java b/spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java rename to spring-security-modules/spring-security-web-mvc/src/main/java/com/baeldung/web/SessionListenerWithMetrics.java diff --git a/spring-security-modules/spring-security-mvc/src/main/resources/application.properties b/spring-security-modules/spring-security-web-mvc/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/resources/application.properties rename to spring-security-modules/spring-security-web-mvc/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-mvc/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-mvc/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-mvc/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-web-mvc/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-web-mvc/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/console.jsp b/spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/console.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/console.jsp rename to spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/console.jsp diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/invalidSession.jsp b/spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/invalidSession.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/invalidSession.jsp rename to spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/invalidSession.jsp diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/login.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/login.jsp rename to spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/login.jsp diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/sessionExpired.jsp b/spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/sessionExpired.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/view/sessionExpired.jsp rename to spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/view/sessionExpired.jsp diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-web-mvc/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-mvc/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-mvc/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/clearsitedata/LogoutClearSiteDataControllerUnitTest.java b/spring-security-modules/spring-security-web-mvc/src/test/java/com/baeldung/clearsitedata/LogoutClearSiteDataControllerUnitTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/clearsitedata/LogoutClearSiteDataControllerUnitTest.java rename to spring-security-modules/spring-security-web-mvc/src/test/java/com/baeldung/clearsitedata/LogoutClearSiteDataControllerUnitTest.java diff --git a/spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java b/spring-security-modules/spring-security-web-mvc/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java rename to spring-security-modules/spring-security-web-mvc/src/test/java/com/baeldung/session/SessionConfigurationLiveTest.java diff --git a/spring-security-modules/spring-security-mvc/src/test/resources/.gitignore b/spring-security-modules/spring-security-web-mvc/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc/src/test/resources/.gitignore rename to spring-security-modules/spring-security-web-mvc/src/test/resources/.gitignore From 787bbd4f2c5e6d2213ca276a7c95d31c80cef48f Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 13 Aug 2020 12:52:53 +0530 Subject: [PATCH 0425/1862] JAVA-67:renamed spring-security-mvc-boot-1 to spring-security-web-boot-1 --- .../README.md | 0 .../WebContent/META-INF/MANIFEST.MF | 0 .../pom.xml | 4 ++-- .../src/main/java/com/baeldung/relationships/AppConfig.java | 0 .../java/com/baeldung/relationships/SpringSecurityConfig.java | 0 .../main/java/com/baeldung/relationships/models/AppUser.java | 0 .../main/java/com/baeldung/relationships/models/Tweet.java | 0 .../baeldung/relationships/repositories/TweetRepository.java | 0 .../baeldung/relationships/repositories/UserRepository.java | 0 .../com/baeldung/relationships/security/AppUserPrincipal.java | 0 .../security/AuthenticationSuccessHandlerImpl.java | 0 .../relationships/security/CustomUserDetailsService.java | 0 .../com/baeldung/relationships/util/DummyContentUtil.java | 0 .../src/main/java/com/baeldung/roles/custom/Application.java | 0 .../baeldung/roles/custom/config/MethodSecurityConfig.java | 0 .../main/java/com/baeldung/roles/custom/config/MvcConfig.java | 0 .../java/com/baeldung/roles/custom/config/SecurityConfig.java | 0 .../java/com/baeldung/roles/custom/persistence/SetupData.java | 0 .../roles/custom/persistence/dao/OrganizationRepository.java | 0 .../roles/custom/persistence/dao/PrivilegeRepository.java | 0 .../baeldung/roles/custom/persistence/dao/UserRepository.java | 0 .../java/com/baeldung/roles/custom/persistence/model/Foo.java | 0 .../baeldung/roles/custom/persistence/model/Organization.java | 0 .../baeldung/roles/custom/persistence/model/Privilege.java | 0 .../com/baeldung/roles/custom/persistence/model/User.java | 0 .../security/CustomMethodSecurityExpressionHandler.java | 0 .../custom/security/CustomMethodSecurityExpressionRoot.java | 0 .../roles/custom/security/CustomPermissionEvaluator.java | 0 .../roles/custom/security/MySecurityExpressionRoot.java | 0 .../baeldung/roles/custom/security/MyUserDetailsService.java | 0 .../com/baeldung/roles/custom/security/MyUserPrincipal.java | 0 .../java/com/baeldung/roles/custom/web/MainController.java | 0 .../src/main/java/com/baeldung/roles/ip/IpApplication.java | 0 .../roles/ip/config/CustomIpAuthenticationProvider.java | 0 .../java/com/baeldung/roles/ip/config/SecurityConfig.java | 0 .../java/com/baeldung/roles/ip/config/SecurityXmlConfig.java | 0 .../main/java/com/baeldung/roles/ip/web/MainController.java | 0 .../roles/rolesauthorities/CustomAuthenticationProvider.java | 0 .../roles/rolesauthorities/MyLogoutSuccessHandler.java | 0 .../baeldung/roles/rolesauthorities/MyUserDetailsService.java | 0 .../roles/rolesauthorities/RolesAuthoritiesApplication.java | 0 .../com/baeldung/roles/rolesauthorities/config/MvcConfig.java | 0 .../roles/rolesauthorities/config/SecurityConfig.java | 0 .../com/baeldung/roles/rolesauthorities/model/Privilege.java | 0 .../java/com/baeldung/roles/rolesauthorities/model/Role.java | 0 .../java/com/baeldung/roles/rolesauthorities/model/User.java | 0 .../roles/rolesauthorities/persistence/IUserService.java | 0 .../rolesauthorities/persistence/PrivilegeRepository.java | 0 .../roles/rolesauthorities/persistence/RoleRepository.java | 0 .../roles/rolesauthorities/persistence/SetupDataLoader.java | 0 .../roles/rolesauthorities/persistence/UserRepository.java | 0 .../roles/rolesauthorities/persistence/UserService.java | 0 .../main/java/com/baeldung/roles/voter/MinuteBasedVoter.java | 0 .../main/java/com/baeldung/roles/voter/VoterApplication.java | 0 .../main/java/com/baeldung/roles/voter/VoterMvcConfig.java | 0 .../main/java/com/baeldung/roles/voter/WebSecurityConfig.java | 0 .../main/java/com/baeldung/roles/voter/XmlSecurityConfig.java | 0 .../src/main/resources/application-defaults.properties | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/persistence-h2.properties | 0 .../src/main/resources/spring-security-custom-voter.xml | 0 .../src/main/resources/spring-security-ip.xml | 0 .../src/main/resources/templates/403.html | 0 .../src/main/resources/templates/index.html | 0 .../src/main/resources/templates/login.html | 0 .../src/main/resources/templates/loginAdmin.html | 0 .../src/main/resources/templates/loginUser.html | 0 .../src/main/resources/templates/multipleHttpElems/login.html | 0 .../templates/multipleHttpElems/loginWithWarning.html | 0 .../templates/multipleHttpElems/multipleHttpLinks.html | 0 .../resources/templates/multipleHttpElems/myAdminPage.html | 0 .../resources/templates/multipleHttpElems/myGuestPage.html | 0 .../templates/multipleHttpElems/myPrivateUserPage.html | 0 .../resources/templates/multipleHttpElems/myUserPage.html | 0 .../src/main/resources/templates/private.html | 0 .../src/main/resources/templates/rolesauthorities/home.html | 0 .../src/main/resources/templates/rolesauthorities/login.html | 0 .../templates/rolesauthorities/protectedbyauthority.html | 0 .../templates/rolesauthorities/protectedbynothing.html | 0 .../resources/templates/rolesauthorities/protectedbyrole.html | 0 .../src/main/resources/templates/ssl/welcome.html | 0 .../relationships/SpringDataWithSecurityIntegrationTest.java | 0 .../src/test/java/com/baeldung/roles/SpringContextTest.java | 0 .../test/java/com/baeldung/roles/web/ApplicationLiveTest.java | 0 .../roles/web/CustomUserDetailsServiceIntegrationTest.java | 0 .../src/test/java/com/baeldung/roles/web/IpLiveTest.java | 0 87 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/README.md (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/WebContent/META-INF/MANIFEST.MF (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/pom.xml (98%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/AppConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/SpringSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/models/AppUser.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/models/Tweet.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/repositories/TweetRepository.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/repositories/UserRepository.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/security/AppUserPrincipal.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/security/AuthenticationSuccessHandlerImpl.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/security/CustomUserDetailsService.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/relationships/util/DummyContentUtil.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/Application.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/config/MethodSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/config/MvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/config/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/persistence/SetupData.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/persistence/dao/OrganizationRepository.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/persistence/dao/PrivilegeRepository.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/persistence/dao/UserRepository.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/persistence/model/Foo.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/persistence/model/Organization.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/persistence/model/Privilege.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/persistence/model/User.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionHandler.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionRoot.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/security/CustomPermissionEvaluator.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/security/MySecurityExpressionRoot.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/security/MyUserDetailsService.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/security/MyUserPrincipal.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/custom/web/MainController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/ip/IpApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/ip/config/CustomIpAuthenticationProvider.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/ip/config/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/ip/config/SecurityXmlConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/ip/web/MainController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/CustomAuthenticationProvider.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/MyLogoutSuccessHandler.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/MyUserDetailsService.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/RolesAuthoritiesApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/config/MvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/config/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/model/Privilege.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/model/Role.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/model/User.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/persistence/IUserService.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/persistence/PrivilegeRepository.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/persistence/RoleRepository.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/persistence/SetupDataLoader.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserRepository.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserService.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/voter/MinuteBasedVoter.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/voter/VoterApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/voter/VoterMvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/voter/WebSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/java/com/baeldung/roles/voter/XmlSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/application-defaults.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/persistence-h2.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/spring-security-custom-voter.xml (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/spring-security-ip.xml (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/403.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/index.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/login.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/loginAdmin.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/loginUser.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/multipleHttpElems/login.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/multipleHttpElems/loginWithWarning.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/multipleHttpElems/myAdminPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/multipleHttpElems/myGuestPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/multipleHttpElems/myUserPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/private.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/rolesauthorities/home.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/rolesauthorities/login.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/rolesauthorities/protectedbyauthority.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/rolesauthorities/protectedbynothing.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/rolesauthorities/protectedbyrole.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/main/resources/templates/ssl/welcome.html (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/test/java/com/baeldung/roles/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/test/java/com/baeldung/roles/web/ApplicationLiveTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/test/java/com/baeldung/roles/web/CustomUserDetailsServiceIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-1 => spring-security-web-boot-1}/src/test/java/com/baeldung/roles/web/IpLiveTest.java (100%) diff --git a/spring-security-modules/spring-security-mvc-boot-1/README.md b/spring-security-modules/spring-security-web-boot-1/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/README.md rename to spring-security-modules/spring-security-web-boot-1/README.md diff --git a/spring-security-modules/spring-security-mvc-boot-1/WebContent/META-INF/MANIFEST.MF b/spring-security-modules/spring-security-web-boot-1/WebContent/META-INF/MANIFEST.MF similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/WebContent/META-INF/MANIFEST.MF rename to spring-security-modules/spring-security-web-boot-1/WebContent/META-INF/MANIFEST.MF diff --git a/spring-security-modules/spring-security-mvc-boot-1/pom.xml b/spring-security-modules/spring-security-web-boot-1/pom.xml similarity index 98% rename from spring-security-modules/spring-security-mvc-boot-1/pom.xml rename to spring-security-modules/spring-security-web-boot-1/pom.xml index 7ad18376ec..1f80b62765 100644 --- a/spring-security-modules/spring-security-mvc-boot-1/pom.xml +++ b/spring-security-modules/spring-security-web-boot-1/pom.xml @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - spring-security-mvc-boot-1 + spring-security-web-boot-1 0.0.1-SNAPSHOT - spring-security-mvc-boot-1 + spring-security-web-boot-1 war Spring Security MVC Boot - 1 diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/AppConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/AppConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/AppConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/AppConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/SpringSecurityConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/SpringSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/SpringSecurityConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/SpringSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/models/AppUser.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/models/AppUser.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/models/AppUser.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/models/AppUser.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/models/Tweet.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/models/Tweet.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/models/Tweet.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/models/Tweet.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/repositories/TweetRepository.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/repositories/TweetRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/repositories/TweetRepository.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/repositories/TweetRepository.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/repositories/UserRepository.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/repositories/UserRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/repositories/UserRepository.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/repositories/UserRepository.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/security/AppUserPrincipal.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/security/AppUserPrincipal.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/security/AppUserPrincipal.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/security/AppUserPrincipal.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/security/AuthenticationSuccessHandlerImpl.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/security/AuthenticationSuccessHandlerImpl.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/security/AuthenticationSuccessHandlerImpl.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/security/AuthenticationSuccessHandlerImpl.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/security/CustomUserDetailsService.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/security/CustomUserDetailsService.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/security/CustomUserDetailsService.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/security/CustomUserDetailsService.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/util/DummyContentUtil.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/util/DummyContentUtil.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/relationships/util/DummyContentUtil.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/relationships/util/DummyContentUtil.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/Application.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/Application.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/Application.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/Application.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/config/MethodSecurityConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/config/MethodSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/config/MethodSecurityConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/config/MethodSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/config/MvcConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/config/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/config/MvcConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/config/MvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/config/SecurityConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/config/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/config/SecurityConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/config/SecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/SetupData.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/SetupData.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/SetupData.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/SetupData.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/OrganizationRepository.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/OrganizationRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/OrganizationRepository.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/OrganizationRepository.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/PrivilegeRepository.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/PrivilegeRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/PrivilegeRepository.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/PrivilegeRepository.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/UserRepository.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/UserRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/UserRepository.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/dao/UserRepository.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Foo.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Foo.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Foo.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Foo.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Organization.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Organization.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Organization.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Organization.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Privilege.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Privilege.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Privilege.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/Privilege.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/User.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/User.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/User.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/persistence/model/User.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionHandler.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionHandler.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionHandler.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionRoot.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionRoot.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionRoot.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomMethodSecurityExpressionRoot.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomPermissionEvaluator.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomPermissionEvaluator.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomPermissionEvaluator.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/CustomPermissionEvaluator.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/MySecurityExpressionRoot.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/MySecurityExpressionRoot.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/MySecurityExpressionRoot.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/MySecurityExpressionRoot.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/MyUserDetailsService.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/MyUserDetailsService.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/MyUserDetailsService.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/MyUserDetailsService.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/MyUserPrincipal.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/MyUserPrincipal.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/security/MyUserPrincipal.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/security/MyUserPrincipal.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/web/MainController.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/web/MainController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/custom/web/MainController.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/custom/web/MainController.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/IpApplication.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/IpApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/IpApplication.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/IpApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/config/CustomIpAuthenticationProvider.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/config/CustomIpAuthenticationProvider.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/config/CustomIpAuthenticationProvider.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/config/CustomIpAuthenticationProvider.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/config/SecurityConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/config/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/config/SecurityConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/config/SecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/config/SecurityXmlConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/config/SecurityXmlConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/config/SecurityXmlConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/config/SecurityXmlConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/web/MainController.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/web/MainController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/ip/web/MainController.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/ip/web/MainController.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/CustomAuthenticationProvider.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/CustomAuthenticationProvider.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/CustomAuthenticationProvider.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/CustomAuthenticationProvider.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/MyLogoutSuccessHandler.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/MyLogoutSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/MyLogoutSuccessHandler.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/MyLogoutSuccessHandler.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/MyUserDetailsService.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/MyUserDetailsService.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/MyUserDetailsService.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/MyUserDetailsService.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/RolesAuthoritiesApplication.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/RolesAuthoritiesApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/RolesAuthoritiesApplication.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/RolesAuthoritiesApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/config/MvcConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/config/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/config/MvcConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/config/MvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/config/SecurityConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/config/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/config/SecurityConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/config/SecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/Privilege.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/Privilege.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/Privilege.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/Privilege.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/Role.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/Role.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/Role.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/Role.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/User.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/User.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/User.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/model/User.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/IUserService.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/IUserService.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/IUserService.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/IUserService.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/PrivilegeRepository.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/PrivilegeRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/PrivilegeRepository.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/PrivilegeRepository.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/RoleRepository.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/RoleRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/RoleRepository.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/RoleRepository.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/SetupDataLoader.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/SetupDataLoader.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/SetupDataLoader.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/SetupDataLoader.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserRepository.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserRepository.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserRepository.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserService.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserService.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserService.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/rolesauthorities/persistence/UserService.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/MinuteBasedVoter.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/MinuteBasedVoter.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/MinuteBasedVoter.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/MinuteBasedVoter.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/VoterApplication.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/VoterApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/VoterApplication.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/VoterApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/VoterMvcConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/VoterMvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/VoterMvcConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/VoterMvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/WebSecurityConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/WebSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/WebSecurityConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/WebSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/XmlSecurityConfig.java b/spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/XmlSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/java/com/baeldung/roles/voter/XmlSecurityConfig.java rename to spring-security-modules/spring-security-web-boot-1/src/main/java/com/baeldung/roles/voter/XmlSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/application-defaults.properties b/spring-security-modules/spring-security-web-boot-1/src/main/resources/application-defaults.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/application-defaults.properties rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/application-defaults.properties diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/application.properties b/spring-security-modules/spring-security-web-boot-1/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/application.properties rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-boot-1/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/persistence-h2.properties b/spring-security-modules/spring-security-web-boot-1/src/main/resources/persistence-h2.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/persistence-h2.properties rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/persistence-h2.properties diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/spring-security-custom-voter.xml b/spring-security-modules/spring-security-web-boot-1/src/main/resources/spring-security-custom-voter.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/spring-security-custom-voter.xml rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/spring-security-custom-voter.xml diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/spring-security-ip.xml b/spring-security-modules/spring-security-web-boot-1/src/main/resources/spring-security-ip.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/spring-security-ip.xml rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/spring-security-ip.xml diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/403.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/403.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/403.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/403.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/index.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/index.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/index.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/login.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/login.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/login.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/loginAdmin.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/loginAdmin.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/loginAdmin.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/loginAdmin.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/loginUser.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/loginUser.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/loginUser.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/loginUser.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/login.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/login.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/login.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/login.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/loginWithWarning.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/loginWithWarning.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/loginWithWarning.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/loginWithWarning.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/myAdminPage.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/myAdminPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/myAdminPage.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/myAdminPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/myGuestPage.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/myGuestPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/myGuestPage.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/myGuestPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/myUserPage.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/myUserPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/multipleHttpElems/myUserPage.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/multipleHttpElems/myUserPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/private.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/private.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/private.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/private.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/home.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/home.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/home.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/home.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/login.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/login.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/login.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/login.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/protectedbyauthority.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/protectedbyauthority.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/protectedbyauthority.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/protectedbyauthority.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/protectedbynothing.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/protectedbynothing.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/protectedbynothing.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/protectedbynothing.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/protectedbyrole.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/protectedbyrole.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/rolesauthorities/protectedbyrole.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/rolesauthorities/protectedbyrole.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/ssl/welcome.html b/spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/ssl/welcome.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/main/resources/templates/ssl/welcome.html rename to spring-security-modules/spring-security-web-boot-1/src/main/resources/templates/ssl/welcome.html diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java b/spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java rename to spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/relationships/SpringDataWithSecurityIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/roles/SpringContextTest.java b/spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/roles/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/roles/SpringContextTest.java rename to spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/roles/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/roles/web/ApplicationLiveTest.java b/spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/roles/web/ApplicationLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/roles/web/ApplicationLiveTest.java rename to spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/roles/web/ApplicationLiveTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/roles/web/CustomUserDetailsServiceIntegrationTest.java b/spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/roles/web/CustomUserDetailsServiceIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/roles/web/CustomUserDetailsServiceIntegrationTest.java rename to spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/roles/web/CustomUserDetailsServiceIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/roles/web/IpLiveTest.java b/spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/roles/web/IpLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-1/src/test/java/com/baeldung/roles/web/IpLiveTest.java rename to spring-security-modules/spring-security-web-boot-1/src/test/java/com/baeldung/roles/web/IpLiveTest.java From 8eede4e9f239ef347ce1ff3a8079955f757a5386 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 13 Aug 2020 12:54:12 +0530 Subject: [PATCH 0426/1862] JAVA-67:renamed spring-security-mvc-boot-2 to spring-security-web-boot-2 --- .../README.md | 0 .../WebContent/META-INF/MANIFEST.MF | 0 .../pom.xml | 4 ++-- .../CustomLogoutApplication.java | 0 .../customlogouthandler/MvcConfiguration.java | 0 .../customlogouthandler/services/UserCache.java | 0 .../com/baeldung/customlogouthandler/user/User.java | 0 .../customlogouthandler/user/UserUtils.java | 0 .../web/CustomLogoutHandler.java | 0 .../customlogouthandler/web/UserController.java | 0 .../h2/H2JdbcAuthenticationApplication.java | 0 .../h2/config/SecurityConfiguration.java | 0 .../jdbcauthentication/h2/web/UserController.java | 0 .../mysql/MySqlJdbcAuthenticationApplication.java | 0 .../mysql/config/SecurityConfiguration.java | 0 .../mysql/web/UserController.java | 0 .../PostgreJdbcAuthenticationApplication.java | 0 .../postgre/config/SecurityConfiguration.java | 0 .../postgre/web/UserController.java | 0 .../com/baeldung/loginredirect/LoginPageFilter.java | 0 .../loginredirect/LoginPageInterceptor.java | 0 .../loginredirect/LoginRedirectApplication.java | 0 .../loginredirect/LoginRedirectMvcConfig.java | 0 .../loginredirect/LoginRedirectSecurityConfig.java | 0 .../com/baeldung/loginredirect/UsersController.java | 0 .../CustomAuthenticationProvider.java | 0 .../MultipleAuthController.java | 0 .../MultipleAuthProvidersApplication.java | 0 .../MultipleAuthProvidersSecurityConfig.java | 0 .../MultipleEntryPointsApplication.java | 0 .../MultipleEntryPointsSecurityConfig.java | 0 .../multipleentrypoints/PagesController.java | 0 .../multiplelogin/MultipleLoginApplication.java | 0 .../multiplelogin/MultipleLoginMvcConfig.java | 0 .../multiplelogin/MultipleLoginSecurityConfig.java | 0 .../com/baeldung/multiplelogin/UsersController.java | 0 .../com/baeldung/ssl/HttpsEnabledApplication.java | 0 .../main/java/com/baeldung/ssl/SecurityConfig.java | 0 .../java/com/baeldung/ssl/WelcomeController.java | 0 .../application-customlogouthandler.properties | 0 .../main/resources/application-defaults.properties | 0 .../src/main/resources/application-mysql.properties | 0 .../main/resources/application-postgre.properties | 0 .../src/main/resources/application-ssl.properties | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/data-mysql.sql | 0 .../src/main/resources/data-postgre.sql | 0 .../src/main/resources/keystore/baeldung.p12 | Bin .../src/main/resources/logback.xml | 0 .../src/main/resources/persistence-h2.properties | 0 .../src/main/resources/schema-mysql.sql | 0 .../src/main/resources/schema-postgre.sql | 0 .../resources/spring-security-login-redirect.xml | 0 .../spring-security-multiple-auth-providers.xml | 0 .../resources/spring-security-multiple-entry.xml | 0 .../src/main/resources/templates/403.html | 0 .../src/main/resources/templates/adminPage.html | 0 .../src/main/resources/templates/index.html | 0 .../src/main/resources/templates/login.html | 0 .../src/main/resources/templates/loginAdmin.html | 0 .../src/main/resources/templates/loginUser.html | 0 .../templates/multipleHttpElems/login.html | 0 .../multipleHttpElems/loginWithWarning.html | 0 .../multipleHttpElems/multipleHttpLinks.html | 0 .../templates/multipleHttpElems/myAdminPage.html | 0 .../templates/multipleHttpElems/myGuestPage.html | 0 .../multipleHttpElems/myPrivateUserPage.html | 0 .../templates/multipleHttpElems/myUserPage.html | 0 .../src/main/resources/templates/private.html | 0 .../main/resources/templates/protectedLinks.html | 0 .../src/main/resources/templates/ssl/welcome.html | 0 .../src/main/resources/templates/userMainPage.html | 0 .../src/main/resources/templates/userPage.html | 0 .../CustomLogoutHandlerIntegrationTest.java | 0 .../jdbcauthentication/h2/SpringContextTest.java | 0 .../h2/web/UserControllerLiveTest.java | 0 .../mysql/web/UserControllerLiveTest.java | 0 .../postgre/web/UserControllerLiveTest.java | 0 .../web/HttpsApplicationIntegrationTest.java | 0 ...ipleAuthProvidersApplicationIntegrationTest.java | 0 .../web/MultipleEntryPointsIntegrationTest.java | 0 .../test/resources/customlogouthandler/after.sql | 0 .../customlogouthandler/application.properties | 0 .../test/resources/customlogouthandler/before.sql | 0 84 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/README.md (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/WebContent/META-INF/MANIFEST.MF (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/pom.xml (99%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/customlogouthandler/CustomLogoutApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/customlogouthandler/MvcConfiguration.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/customlogouthandler/services/UserCache.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/customlogouthandler/user/User.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/customlogouthandler/user/UserUtils.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/customlogouthandler/web/CustomLogoutHandler.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/customlogouthandler/web/UserController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/h2/web/UserController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/mysql/web/UserController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/jdbcauthentication/postgre/web/UserController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/loginredirect/LoginPageFilter.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/loginredirect/LoginPageInterceptor.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/loginredirect/LoginRedirectApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/loginredirect/LoginRedirectMvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/loginredirect/LoginRedirectSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/loginredirect/UsersController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multipleauthproviders/CustomAuthenticationProvider.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multipleentrypoints/PagesController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multiplelogin/MultipleLoginApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multiplelogin/MultipleLoginMvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multiplelogin/MultipleLoginSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/multiplelogin/UsersController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/ssl/HttpsEnabledApplication.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/ssl/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/java/com/baeldung/ssl/WelcomeController.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/application-customlogouthandler.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/application-defaults.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/application-mysql.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/application-postgre.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/application-ssl.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/data-mysql.sql (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/data-postgre.sql (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/keystore/baeldung.p12 (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/persistence-h2.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/schema-mysql.sql (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/schema-postgre.sql (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/spring-security-login-redirect.xml (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/spring-security-multiple-auth-providers.xml (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/spring-security-multiple-entry.xml (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/403.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/adminPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/index.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/login.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/loginAdmin.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/loginUser.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/multipleHttpElems/login.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/multipleHttpElems/loginWithWarning.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/multipleHttpElems/myAdminPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/multipleHttpElems/myGuestPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/multipleHttpElems/myUserPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/private.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/protectedLinks.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/ssl/welcome.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/userMainPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/main/resources/templates/userPage.html (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/java/com/baeldung/customlogouthandler/CustomLogoutHandlerIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/java/com/baeldung/jdbcauthentication/h2/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/java/com/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/java/com/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/java/com/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/java/com/baeldung/web/HttpsApplicationIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/java/com/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/java/com/baeldung/web/MultipleEntryPointsIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/resources/customlogouthandler/after.sql (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/resources/customlogouthandler/application.properties (100%) rename spring-security-modules/{spring-security-mvc-boot-2 => spring-security-web-boot-2}/src/test/resources/customlogouthandler/before.sql (100%) diff --git a/spring-security-modules/spring-security-mvc-boot-2/README.md b/spring-security-modules/spring-security-web-boot-2/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/README.md rename to spring-security-modules/spring-security-web-boot-2/README.md diff --git a/spring-security-modules/spring-security-mvc-boot-2/WebContent/META-INF/MANIFEST.MF b/spring-security-modules/spring-security-web-boot-2/WebContent/META-INF/MANIFEST.MF similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/WebContent/META-INF/MANIFEST.MF rename to spring-security-modules/spring-security-web-boot-2/WebContent/META-INF/MANIFEST.MF diff --git a/spring-security-modules/spring-security-mvc-boot-2/pom.xml b/spring-security-modules/spring-security-web-boot-2/pom.xml similarity index 99% rename from spring-security-modules/spring-security-mvc-boot-2/pom.xml rename to spring-security-modules/spring-security-web-boot-2/pom.xml index 668eb04cd9..ca357509a3 100644 --- a/spring-security-modules/spring-security-mvc-boot-2/pom.xml +++ b/spring-security-modules/spring-security-web-boot-2/pom.xml @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - spring-security-mvc-boot-2 + spring-security-web-boot-2 0.0.1-SNAPSHOT - spring-security-mvc-boot-2 + spring-security-web-boot-2 war Spring Security MVC Boot - 2 diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/CustomLogoutApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/CustomLogoutApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/CustomLogoutApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/CustomLogoutApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/MvcConfiguration.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/MvcConfiguration.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/MvcConfiguration.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/MvcConfiguration.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/services/UserCache.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/services/UserCache.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/services/UserCache.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/services/UserCache.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/user/User.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/user/User.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/user/User.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/user/User.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/user/UserUtils.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/user/UserUtils.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/user/UserUtils.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/user/UserUtils.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/web/CustomLogoutHandler.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/web/CustomLogoutHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/web/CustomLogoutHandler.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/web/CustomLogoutHandler.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/web/UserController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/web/UserController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/customlogouthandler/web/UserController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/customlogouthandler/web/UserController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/H2JdbcAuthenticationApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/config/SecurityConfiguration.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/web/UserController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/web/UserController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/web/UserController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/h2/web/UserController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/MySqlJdbcAuthenticationApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/config/SecurityConfiguration.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/web/UserController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/web/UserController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/web/UserController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/mysql/web/UserController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/PostgreJdbcAuthenticationApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/config/SecurityConfiguration.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/web/UserController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/web/UserController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/web/UserController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/jdbcauthentication/postgre/web/UserController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginPageFilter.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginPageFilter.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginPageFilter.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginPageFilter.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginPageInterceptor.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginPageInterceptor.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginPageInterceptor.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginPageInterceptor.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectMvcConfig.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectMvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectMvcConfig.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectMvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectSecurityConfig.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectSecurityConfig.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/LoginRedirectSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/UsersController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/UsersController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/loginredirect/UsersController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/loginredirect/UsersController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleauthproviders/CustomAuthenticationProvider.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleauthproviders/CustomAuthenticationProvider.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleauthproviders/CustomAuthenticationProvider.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleauthproviders/CustomAuthenticationProvider.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleauthproviders/MultipleAuthProvidersSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleentrypoints/MultipleEntryPointsSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleentrypoints/PagesController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleentrypoints/PagesController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multipleentrypoints/PagesController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multipleentrypoints/PagesController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginMvcConfig.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginMvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginMvcConfig.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginMvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginSecurityConfig.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginSecurityConfig.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multiplelogin/MultipleLoginSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multiplelogin/UsersController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multiplelogin/UsersController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/multiplelogin/UsersController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/multiplelogin/UsersController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/ssl/HttpsEnabledApplication.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/ssl/HttpsEnabledApplication.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/ssl/HttpsEnabledApplication.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/ssl/HttpsEnabledApplication.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/ssl/SecurityConfig.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/ssl/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/ssl/SecurityConfig.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/ssl/SecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/ssl/WelcomeController.java b/spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/ssl/WelcomeController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/java/com/baeldung/ssl/WelcomeController.java rename to spring-security-modules/spring-security-web-boot-2/src/main/java/com/baeldung/ssl/WelcomeController.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-customlogouthandler.properties b/spring-security-modules/spring-security-web-boot-2/src/main/resources/application-customlogouthandler.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-customlogouthandler.properties rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/application-customlogouthandler.properties diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-defaults.properties b/spring-security-modules/spring-security-web-boot-2/src/main/resources/application-defaults.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-defaults.properties rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/application-defaults.properties diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-mysql.properties b/spring-security-modules/spring-security-web-boot-2/src/main/resources/application-mysql.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-mysql.properties rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/application-mysql.properties diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-postgre.properties b/spring-security-modules/spring-security-web-boot-2/src/main/resources/application-postgre.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-postgre.properties rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/application-postgre.properties diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-ssl.properties b/spring-security-modules/spring-security-web-boot-2/src/main/resources/application-ssl.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application-ssl.properties rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/application-ssl.properties diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application.properties b/spring-security-modules/spring-security-web-boot-2/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/application.properties rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/data-mysql.sql b/spring-security-modules/spring-security-web-boot-2/src/main/resources/data-mysql.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/data-mysql.sql rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/data-mysql.sql diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/data-postgre.sql b/spring-security-modules/spring-security-web-boot-2/src/main/resources/data-postgre.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/data-postgre.sql rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/data-postgre.sql diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/keystore/baeldung.p12 b/spring-security-modules/spring-security-web-boot-2/src/main/resources/keystore/baeldung.p12 similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/keystore/baeldung.p12 rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/keystore/baeldung.p12 diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-boot-2/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/persistence-h2.properties b/spring-security-modules/spring-security-web-boot-2/src/main/resources/persistence-h2.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/persistence-h2.properties rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/persistence-h2.properties diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/schema-mysql.sql b/spring-security-modules/spring-security-web-boot-2/src/main/resources/schema-mysql.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/schema-mysql.sql rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/schema-mysql.sql diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/schema-postgre.sql b/spring-security-modules/spring-security-web-boot-2/src/main/resources/schema-postgre.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/schema-postgre.sql rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/schema-postgre.sql diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/spring-security-login-redirect.xml b/spring-security-modules/spring-security-web-boot-2/src/main/resources/spring-security-login-redirect.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/spring-security-login-redirect.xml rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/spring-security-login-redirect.xml diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/spring-security-multiple-auth-providers.xml b/spring-security-modules/spring-security-web-boot-2/src/main/resources/spring-security-multiple-auth-providers.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/spring-security-multiple-auth-providers.xml rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/spring-security-multiple-auth-providers.xml diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/spring-security-multiple-entry.xml b/spring-security-modules/spring-security-web-boot-2/src/main/resources/spring-security-multiple-entry.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/spring-security-multiple-entry.xml rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/spring-security-multiple-entry.xml diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/403.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/403.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/403.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/403.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/adminPage.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/adminPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/adminPage.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/adminPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/index.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/index.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/index.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/login.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/login.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/login.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/loginAdmin.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/loginAdmin.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/loginAdmin.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/loginAdmin.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/loginUser.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/loginUser.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/loginUser.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/loginUser.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/login.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/login.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/login.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/login.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/loginWithWarning.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/loginWithWarning.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/loginWithWarning.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/loginWithWarning.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/multipleHttpLinks.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/myAdminPage.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/myAdminPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/myAdminPage.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/myAdminPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/myGuestPage.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/myGuestPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/myGuestPage.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/myGuestPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/myPrivateUserPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/myUserPage.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/myUserPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/multipleHttpElems/myUserPage.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/multipleHttpElems/myUserPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/private.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/private.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/private.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/private.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/protectedLinks.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/protectedLinks.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/protectedLinks.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/protectedLinks.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/ssl/welcome.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/ssl/welcome.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/ssl/welcome.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/ssl/welcome.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/userMainPage.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/userMainPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/userMainPage.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/userMainPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/userPage.html b/spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/userPage.html similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/main/resources/templates/userPage.html rename to spring-security-modules/spring-security-web-boot-2/src/main/resources/templates/userPage.html diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/customlogouthandler/CustomLogoutHandlerIntegrationTest.java b/spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/customlogouthandler/CustomLogoutHandlerIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/customlogouthandler/CustomLogoutHandlerIntegrationTest.java rename to spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/customlogouthandler/CustomLogoutHandlerIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/jdbcauthentication/h2/SpringContextTest.java b/spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/jdbcauthentication/h2/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/jdbcauthentication/h2/SpringContextTest.java rename to spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/jdbcauthentication/h2/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java b/spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java rename to spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/jdbcauthentication/h2/web/UserControllerLiveTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java b/spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java rename to spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/jdbcauthentication/mysql/web/UserControllerLiveTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java b/spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java rename to spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/jdbcauthentication/postgre/web/UserControllerLiveTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/web/HttpsApplicationIntegrationTest.java b/spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/web/HttpsApplicationIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/web/HttpsApplicationIntegrationTest.java rename to spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/web/HttpsApplicationIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java b/spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java rename to spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/web/MultipleAuthProvidersApplicationIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/web/MultipleEntryPointsIntegrationTest.java b/spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/web/MultipleEntryPointsIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/java/com/baeldung/web/MultipleEntryPointsIntegrationTest.java rename to spring-security-modules/spring-security-web-boot-2/src/test/java/com/baeldung/web/MultipleEntryPointsIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/resources/customlogouthandler/after.sql b/spring-security-modules/spring-security-web-boot-2/src/test/resources/customlogouthandler/after.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/resources/customlogouthandler/after.sql rename to spring-security-modules/spring-security-web-boot-2/src/test/resources/customlogouthandler/after.sql diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/resources/customlogouthandler/application.properties b/spring-security-modules/spring-security-web-boot-2/src/test/resources/customlogouthandler/application.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/resources/customlogouthandler/application.properties rename to spring-security-modules/spring-security-web-boot-2/src/test/resources/customlogouthandler/application.properties diff --git a/spring-security-modules/spring-security-mvc-boot-2/src/test/resources/customlogouthandler/before.sql b/spring-security-modules/spring-security-web-boot-2/src/test/resources/customlogouthandler/before.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-boot-2/src/test/resources/customlogouthandler/before.sql rename to spring-security-modules/spring-security-web-boot-2/src/test/resources/customlogouthandler/before.sql From fe7894fae0257be7e962513a7917d69f5f218695 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 13 Aug 2020 12:55:25 +0530 Subject: [PATCH 0427/1862] JAVA-67:renamed spring-security-mvc-custom to spring-security-web-mvc-custom --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../security/MySimpleUrlAuthenticationSuccessHandler.java | 0 .../src/main/java/com/baeldung/spring/MvcConfig.java | 0 .../main/java/com/baeldung/spring/MyUserDetailsService.java | 0 .../src/main/java/com/baeldung/spring/SecSecurityConfig.java | 0 .../main/java/com/baeldung/web/controller/BankController.java | 0 .../main/java/com/baeldung/web/controller/FooController.java | 0 .../java/com/baeldung/web/controller/LoginController.java | 0 .../java/com/baeldung/web/controller/PrintUserController.java | 0 .../src/main/java/com/baeldung/web/dto/Foo.java | 0 .../java/com/baeldung/web/interceptor/LoggerInterceptor.java | 0 .../com/baeldung/web/interceptor/SessionTimerInterceptor.java | 0 .../java/com/baeldung/web/interceptor/UserInterceptor.java | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/main/webapp/WEB-INF/mvc-servlet.xml | 0 .../src/main/webapp/WEB-INF/view/anonymous.jsp | 0 .../src/main/webapp/WEB-INF/view/console.jsp | 0 .../src/main/webapp/WEB-INF/view/csrfHome.jsp | 0 .../src/main/webapp/WEB-INF/view/homepage.jsp | 0 .../src/main/webapp/WEB-INF/view/login.jsp | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 .../baeldung/security/csrf/CsrfAbstractIntegrationTest.java | 0 .../baeldung/security/csrf/CsrfDisabledIntegrationTest.java | 0 .../baeldung/security/csrf/CsrfEnabledIntegrationTest.java | 0 .../com/baeldung/security/spring/ManualSecurityConfig.java | 0 .../security/spring/ManualSecurityIntegrationTest.java | 0 .../com/baeldung/security/spring/SecurityWithCsrfConfig.java | 0 .../baeldung/security/spring/SecurityWithoutCsrfConfig.java | 0 .../web/interceptor/LoggerInterceptorIntegrationTest.java | 0 .../interceptor/SessionTimerInterceptorIntegrationTest.java | 0 .../web/interceptor/UserInterceptorIntegrationTest.java | 0 .../src/test/resources/.gitignore | 0 36 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/.gitignore (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/README.md (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/pom.xml (98%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/spring/MvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/spring/MyUserDetailsService.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/spring/SecSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/web/controller/BankController.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/web/controller/FooController.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/web/controller/LoginController.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/web/controller/PrintUserController.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/web/dto/Foo.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/web/interceptor/LoggerInterceptor.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/web/interceptor/SessionTimerInterceptor.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/webapp/WEB-INF/mvc-servlet.xml (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/webapp/WEB-INF/view/anonymous.jsp (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/webapp/WEB-INF/view/console.jsp (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/webapp/WEB-INF/view/csrfHome.jsp (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/webapp/WEB-INF/view/homepage.jsp (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/webapp/WEB-INF/view/login.jsp (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/main/webapp/WEB-INF/web.xml (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/security/csrf/CsrfAbstractIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/security/csrf/CsrfDisabledIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/security/csrf/CsrfEnabledIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/security/spring/ManualSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/security/spring/ManualSecurityIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/security/spring/SecurityWithCsrfConfig.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/security/spring/SecurityWithoutCsrfConfig.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/java/com/baeldung/web/interceptor/UserInterceptorIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-custom => spring-security-web-mvc-custom}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/spring-security-mvc-custom/.gitignore b/spring-security-modules/spring-security-web-mvc-custom/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/.gitignore rename to spring-security-modules/spring-security-web-mvc-custom/.gitignore diff --git a/spring-security-modules/spring-security-mvc-custom/README.md b/spring-security-modules/spring-security-web-mvc-custom/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/README.md rename to spring-security-modules/spring-security-web-mvc-custom/README.md diff --git a/spring-security-modules/spring-security-mvc-custom/pom.xml b/spring-security-modules/spring-security-web-mvc-custom/pom.xml similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/pom.xml rename to spring-security-modules/spring-security-web-mvc-custom/pom.xml index fe8c749c59..bd4a800bc5 100644 --- a/spring-security-modules/spring-security-mvc-custom/pom.xml +++ b/spring-security-modules/spring-security-web-mvc-custom/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-mvc-custom + spring-security-web-mvc-custom 0.1-SNAPSHOT - spring-security-mvc-custom + spring-security-web-mvc-custom war diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MyUserDetailsService.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/spring/MyUserDetailsService.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MyUserDetailsService.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/spring/MyUserDetailsService.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/spring/SecSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/BankController.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/controller/BankController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/BankController.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/controller/BankController.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/controller/FooController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/controller/FooController.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/LoginController.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/controller/LoginController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/LoginController.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/controller/LoginController.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/PrintUserController.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/controller/PrintUserController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/PrintUserController.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/controller/PrintUserController.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/dto/Foo.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/dto/Foo.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/LoggerInterceptor.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/interceptor/LoggerInterceptor.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/LoggerInterceptor.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/interceptor/LoggerInterceptor.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/SessionTimerInterceptor.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/interceptor/SessionTimerInterceptor.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/SessionTimerInterceptor.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/interceptor/SessionTimerInterceptor.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java b/spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java rename to spring-security-modules/spring-security-web-mvc-custom/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-mvc-custom/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-mvc-custom/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-web-mvc-custom/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-web-mvc-custom/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/console.jsp b/spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/console.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/console.jsp rename to spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/console.jsp diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/csrfHome.jsp b/spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/csrfHome.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/csrfHome.jsp rename to spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/csrfHome.jsp diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp rename to spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/view/login.jsp diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-web-mvc-custom/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfAbstractIntegrationTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfAbstractIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfAbstractIntegrationTest.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfAbstractIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfDisabledIntegrationTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfDisabledIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfDisabledIntegrationTest.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfDisabledIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfEnabledIntegrationTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfEnabledIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfEnabledIntegrationTest.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfEnabledIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityConfig.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityConfig.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityIntegrationTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityIntegrationTest.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithCsrfConfig.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithCsrfConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithCsrfConfig.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithCsrfConfig.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithoutCsrfConfig.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithoutCsrfConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithoutCsrfConfig.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithoutCsrfConfig.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/UserInterceptorIntegrationTest.java b/spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/UserInterceptorIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/UserInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-web-mvc-custom/src/test/java/com/baeldung/web/interceptor/UserInterceptorIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/resources/.gitignore b/spring-security-modules/spring-security-web-mvc-custom/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-custom/src/test/resources/.gitignore rename to spring-security-modules/spring-security-web-mvc-custom/src/test/resources/.gitignore From ab84d1c6d04ca9d16d256e62e8815f17fd25ce57 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 13 Aug 2020 12:56:26 +0530 Subject: [PATCH 0428/1862] JAVA-67:renamed spring-security-mvc-digest-auth to spring-security-web-digest-auth --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../com/baeldung/basic/MyBasicAuthenticationEntryPoint.java | 0 .../HttpComponentsClientHttpRequestFactoryDigestAuth.java | 0 .../src/main/java/com/baeldung/spring/ClientConfig.java | 0 .../src/main/java/com/baeldung/spring/MvcConfig.java | 0 .../src/main/java/com/baeldung/spring/SecSecurityConfig.java | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/main/webapp/WEB-INF/mvc-servlet.xml | 0 .../src/main/webapp/WEB-INF/view/homepage.jsp | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 .../src/test/java/com/baeldung/client/RawClientLiveTest.java | 0 .../src/test/resources/.gitignore | 0 16 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/.gitignore (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/README.md (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/pom.xml (98%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/java/com/baeldung/spring/ClientConfig.java (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/java/com/baeldung/spring/MvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/java/com/baeldung/spring/SecSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/webapp/WEB-INF/mvc-servlet.xml (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/webapp/WEB-INF/view/homepage.jsp (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/main/webapp/WEB-INF/web.xml (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/test/java/com/baeldung/client/RawClientLiveTest.java (100%) rename spring-security-modules/{spring-security-mvc-digest-auth => spring-security-web-digest-auth}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/spring-security-mvc-digest-auth/.gitignore b/spring-security-modules/spring-security-web-digest-auth/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/.gitignore rename to spring-security-modules/spring-security-web-digest-auth/.gitignore diff --git a/spring-security-modules/spring-security-mvc-digest-auth/README.md b/spring-security-modules/spring-security-web-digest-auth/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/README.md rename to spring-security-modules/spring-security-web-digest-auth/README.md diff --git a/spring-security-modules/spring-security-mvc-digest-auth/pom.xml b/spring-security-modules/spring-security-web-digest-auth/pom.xml similarity index 98% rename from spring-security-modules/spring-security-mvc-digest-auth/pom.xml rename to spring-security-modules/spring-security-web-digest-auth/pom.xml index 8061235c71..2579a11f97 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/pom.xml +++ b/spring-security-modules/spring-security-web-digest-auth/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-mvc-digest-auth + spring-security-web-digest-auth 0.1-SNAPSHOT - spring-security-mvc-digest-auth + spring-security-web-digest-auth war diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java b/spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java b/spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java rename to spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/ClientConfig.java b/spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/spring/ClientConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/ClientConfig.java rename to spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/spring/ClientConfig.java diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/spring/MvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-web-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-digest-auth/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-digest-auth/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-web-digest-auth/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-web-digest-auth/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-web-digest-auth/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-web-digest-auth/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-web-digest-auth/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-web-digest-auth/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-web-digest-auth/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-web-digest-auth/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-digest-auth/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-digest-auth/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/client/RawClientLiveTest.java b/spring-security-modules/spring-security-web-digest-auth/src/test/java/com/baeldung/client/RawClientLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/client/RawClientLiveTest.java rename to spring-security-modules/spring-security-web-digest-auth/src/test/java/com/baeldung/client/RawClientLiveTest.java diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/test/resources/.gitignore b/spring-security-modules/spring-security-web-digest-auth/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-digest-auth/src/test/resources/.gitignore rename to spring-security-modules/spring-security-web-digest-auth/src/test/resources/.gitignore From daed0a310a4adc5b711fd84210a360ac0d3957f6 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 13 Aug 2020 12:57:25 +0530 Subject: [PATCH 0429/1862] JAVA-67: module pom changes as per renamed modules --- spring-security-modules/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index 472c6b6e0d..d7b5844e6f 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -16,14 +16,14 @@ spring-security-acl spring-security-auth0 - spring-security-angular/server + spring-security-web-angular/server spring-security-config spring-security-core - spring-security-mvc - spring-security-mvc-boot-1 - spring-security-mvc-boot-2 - spring-security-mvc-custom - spring-security-mvc-digest-auth + spring-security-web-mvc + spring-security-web-boot-1 + spring-security-web-boot-2 + spring-security-web-mvc-custom + spring-security-web-digest-auth spring-security-mvc-jsonview spring-security-ldap spring-security-mvc-login From 6ce7fee3ffca103d84bba26f1dce438a5718b321 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 13 Aug 2020 11:38:50 +0200 Subject: [PATCH 0430/1862] BAEL-4541: Fix typos in the spring-kafka module (#9857) --- .../spring/kafka/KafkaApplication.java | 30 +++++++++---------- .../spring/kafka/KafkaTopicConfig.java | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java index fde56bebc0..9b79f716e9 100644 --- a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java +++ b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaApplication.java @@ -30,23 +30,23 @@ public class KafkaApplication { MessageListener listener = context.getBean(MessageListener.class); /* * Sending a Hello World message to topic 'baeldung'. - * Must be recieved by both listeners with group foo + * Must be received by both listeners with group foo * and bar with containerFactory fooKafkaListenerContainerFactory * and barKafkaListenerContainerFactory respectively. - * It will also be recieved by the listener with - * headersKafkaListenerContainerFactory as container factory + * It will also be received by the listener with + * headersKafkaListenerContainerFactory as container factory. */ producer.sendMessage("Hello, World!"); listener.latch.await(10, TimeUnit.SECONDS); /* - * Sending message to a topic with 5 partition, + * Sending message to a topic with 5 partitions, * each message to a different partition. But as per * listener configuration, only the messages from * partition 0 and 3 will be consumed. */ for (int i = 0; i < 5; i++) { - producer.sendMessageToPartion("Hello To Partioned Topic!", i); + producer.sendMessageToPartition("Hello To Partitioned Topic!", i); } listener.partitionLatch.await(10, TimeUnit.SECONDS); @@ -61,7 +61,7 @@ public class KafkaApplication { /* * Sending message to 'greeting' topic. This will send - * and recieved a java object with the help of + * and received a java object with the help of * greetingKafkaListenerContainerFactory. */ producer.sendGreetingMessage(new Greeting("Greetings", "World!")); @@ -92,7 +92,7 @@ public class KafkaApplication { private String topicName; @Value(value = "${partitioned.topic.name}") - private String partionedTopicName; + private String partitionedTopicName; @Value(value = "${filtered.topic.name}") private String filteredTopicName; @@ -119,8 +119,8 @@ public class KafkaApplication { }); } - public void sendMessageToPartion(String message, int partition) { - kafkaTemplate.send(partionedTopicName, partition, null, message); + public void sendMessageToPartition(String message, int partition) { + kafkaTemplate.send(partitionedTopicName, partition, null, message); } public void sendMessageToFiltered(String message) { @@ -144,37 +144,37 @@ public class KafkaApplication { @KafkaListener(topics = "${message.topic.name}", groupId = "foo", containerFactory = "fooKafkaListenerContainerFactory") public void listenGroupFoo(String message) { - System.out.println("Received Messasge in group 'foo': " + message); + System.out.println("Received Message in group 'foo': " + message); latch.countDown(); } @KafkaListener(topics = "${message.topic.name}", groupId = "bar", containerFactory = "barKafkaListenerContainerFactory") public void listenGroupBar(String message) { - System.out.println("Received Messasge in group 'bar': " + message); + System.out.println("Received Message in group 'bar': " + message); latch.countDown(); } @KafkaListener(topics = "${message.topic.name}", containerFactory = "headersKafkaListenerContainerFactory") public void listenWithHeaders(@Payload String message, @Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partition) { - System.out.println("Received Messasge: " + message + " from partition: " + partition); + System.out.println("Received Message: " + message + " from partition: " + partition); latch.countDown(); } @KafkaListener(topicPartitions = @TopicPartition(topic = "${partitioned.topic.name}", partitions = { "0", "3" }), containerFactory = "partitionsKafkaListenerContainerFactory") - public void listenToParition(@Payload String message, @Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partition) { + public void listenToPartition(@Payload String message, @Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partition) { System.out.println("Received Message: " + message + " from partition: " + partition); this.partitionLatch.countDown(); } @KafkaListener(topics = "${filtered.topic.name}", containerFactory = "filterKafkaListenerContainerFactory") public void listenWithFilter(String message) { - System.out.println("Recieved Message in filtered listener: " + message); + System.out.println("Received Message in filtered listener: " + message); this.filterLatch.countDown(); } @KafkaListener(topics = "${greeting.topic.name}", containerFactory = "greetingKafkaListenerContainerFactory") public void greetingListener(Greeting greeting) { - System.out.println("Recieved greeting message: " + greeting); + System.out.println("Received greeting message: " + greeting); this.greetingLatch.countDown(); } diff --git a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaTopicConfig.java b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaTopicConfig.java index fb60fadde4..00e4147cd0 100644 --- a/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaTopicConfig.java +++ b/spring-kafka/src/main/java/com/baeldung/spring/kafka/KafkaTopicConfig.java @@ -20,7 +20,7 @@ public class KafkaTopicConfig { private String topicName; @Value(value = "${partitioned.topic.name}") - private String partionedTopicName; + private String partitionedTopicName; @Value(value = "${filtered.topic.name}") private String filteredTopicName; @@ -42,7 +42,7 @@ public class KafkaTopicConfig { @Bean public NewTopic topic2() { - return new NewTopic(partionedTopicName, 6, (short) 1); + return new NewTopic(partitionedTopicName, 6, (short) 1); } @Bean From ee2eae1056be8334bff0c83a119c778d5374557d Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 13 Aug 2020 16:07:42 +0530 Subject: [PATCH 0431/1862] JAVA-67: README updated for next-prev links --- spring-security-modules/spring-security-web-boot-1/README.md | 2 +- spring-security-modules/spring-security-web-boot-2/README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-boot-1/README.md b/spring-security-modules/spring-security-web-boot-1/README.md index f2c161d387..042fedf62b 100644 --- a/spring-security-modules/spring-security-web-boot-1/README.md +++ b/spring-security-modules/spring-security-web-boot-1/README.md @@ -13,5 +13,5 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com - [Granted Authority Versus Role in Spring Security](https://www.baeldung.com/spring-security-granted-authority-vs-role) - [Spring Security – Whitelist IP Range](https://www.baeldung.com/spring-security-whitelist-ip-range) - [Find the Registered Spring Security Filters](https://www.baeldung.com/spring-security-registered-filters) -- More articles: [[next -->]](/../spring-security-mvc-boot-2) +- More articles: [[next -->]](/spring-security-modules/spring-security-web-boot-2) diff --git a/spring-security-modules/spring-security-web-boot-2/README.md b/spring-security-modules/spring-security-web-boot-2/README.md index bbbf514c90..f5fc3a890d 100644 --- a/spring-security-modules/spring-security-web-boot-2/README.md +++ b/spring-security-modules/spring-security-web-boot-2/README.md @@ -14,3 +14,4 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com - [Spring Security: Exploring JDBC Authentication](https://www.baeldung.com/spring-security-jdbc-authentication) - [Spring Security Custom Logout Handler](https://www.baeldung.com/spring-security-custom-logout-handler) - [Redirecting Logged-in Users with Spring Security](https://www.baeldung.com/spring-security-redirect-logged-in) +- More articles: [[<-- prev]](/spring-security-modules/spring-security-web-boot-1) From a0ee1712e6645250e83153f6b7787daed718af8b Mon Sep 17 00:00:00 2001 From: sahilsingla112 Date: Thu, 13 Aug 2020 19:07:46 +0530 Subject: [PATCH 0432/1862] BAEL-4431-jdbcmetadata: Article about extracting metadata using JDBC (#9815) * BAEL-4431-jdbcmetadata: Article about extracting metadata using JDBC * BAEL-4431-jdbcmetadata: Review comments, fixed formatting issues by using the recommended intelij formatter Co-authored-by: sahil.singla --- .../baeldung/jdbcmetadata/DatabaseConfig.java | 49 ++++++++ .../jdbcmetadata/JdbcMetadataApplication.java | 30 +++++ .../jdbcmetadata/MetadataExtractor.java | 113 ++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/DatabaseConfig.java create mode 100644 persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/JdbcMetadataApplication.java create mode 100644 persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/MetadataExtractor.java diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/DatabaseConfig.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/DatabaseConfig.java new file mode 100644 index 0000000000..8ad689041e --- /dev/null +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/DatabaseConfig.java @@ -0,0 +1,49 @@ +package com.baeldung.jdbcmetadata; + +import org.apache.log4j.Logger; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class DatabaseConfig { + private static final Logger LOG = Logger.getLogger(DatabaseConfig.class); + + private Connection connection; + + public DatabaseConfig() { + try { + Class.forName("org.h2.Driver"); + String url = "jdbc:h2:mem:testdb"; + connection = DriverManager.getConnection(url, "sa", ""); + } catch (ClassNotFoundException | SQLException e) { + LOG.error(e); + } + } + + public Connection getConnection() { + return connection; + } + + public void init() { + createTables(); + createViews(); + } + + private void createTables() { + try { + connection.createStatement().executeUpdate("create table CUSTOMER (ID int primary key auto_increment, NAME VARCHAR(45))"); + connection.createStatement().executeUpdate("create table CUST_ADDRESS (ID VARCHAR(36), CUST_ID int, ADDRESS VARCHAR(45), FOREIGN KEY (CUST_ID) REFERENCES CUSTOMER(ID))"); + } catch (SQLException e) { + LOG.error(e); + } + } + + private void createViews() { + try { + connection.createStatement().executeUpdate("CREATE VIEW CUSTOMER_VIEW AS SELECT * FROM CUSTOMER"); + } catch (SQLException e) { + LOG.error(e); + } + } +} diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/JdbcMetadataApplication.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/JdbcMetadataApplication.java new file mode 100644 index 0000000000..591a14f3b5 --- /dev/null +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/JdbcMetadataApplication.java @@ -0,0 +1,30 @@ +package com.baeldung.jdbcmetadata; + +import org.apache.log4j.Logger; + +import java.sql.SQLException; + +public class JdbcMetadataApplication { + + private static final Logger LOG = Logger.getLogger(JdbcMetadataApplication.class); + + public static void main(String[] args) { + DatabaseConfig databaseConfig = new DatabaseConfig(); + databaseConfig.init(); + try { + MetadataExtractor metadataExtractor = new MetadataExtractor(databaseConfig.getConnection()); + metadataExtractor.extractTableInfo(); + metadataExtractor.extractSystemTables(); + metadataExtractor.extractViews(); + String tableName = "CUSTOMER"; + metadataExtractor.extractColumnInfo(tableName); + metadataExtractor.extractPrimaryKeys(tableName); + metadataExtractor.extractForeignKeys("CUST_ADDRESS"); + metadataExtractor.extractDatabaseInfo(); + metadataExtractor.extractUserName(); + metadataExtractor.extractSupportedFeatures(); + } catch (SQLException e) { + LOG.error("Error while executing SQL statements", e); + } + } +} diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/MetadataExtractor.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/MetadataExtractor.java new file mode 100644 index 0000000000..27c615aebc --- /dev/null +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbcmetadata/MetadataExtractor.java @@ -0,0 +1,113 @@ +package com.baeldung.jdbcmetadata; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class MetadataExtractor { + private final DatabaseMetaData databaseMetaData; + + public MetadataExtractor(Connection connection) throws SQLException { + this.databaseMetaData = connection.getMetaData(); + DatabaseMetaData databaseMetaData = connection.getMetaData(); + } + + public void extractTableInfo() throws SQLException { + ResultSet resultSet = databaseMetaData.getTables(null, null, "CUST%", new String[] { "TABLE" }); + while (resultSet.next()) { + // Print the names of existing tables + System.out.println(resultSet.getString("TABLE_NAME")); + System.out.println(resultSet.getString("REMARKS")); + } + } + + public void extractSystemTables() throws SQLException { + ResultSet resultSet = databaseMetaData.getTables(null, null, null, new String[] { "SYSTEM TABLE" }); + while (resultSet.next()) { + // Print the names of system tables + System.out.println(resultSet.getString("TABLE_NAME")); + } + } + + public void extractViews() throws SQLException { + ResultSet resultSet = databaseMetaData.getTables(null, null, null, new String[] { "VIEW" }); + while (resultSet.next()) { + // Print the names of existing views + System.out.println(resultSet.getString("TABLE_NAME")); + } + } + + public void extractColumnInfo(String tableName) throws SQLException { + ResultSet columns = databaseMetaData.getColumns(null, null, tableName, null); + + while (columns.next()) { + String columnName = columns.getString("COLUMN_NAME"); + String columnSize = columns.getString("COLUMN_SIZE"); + String datatype = columns.getString("DATA_TYPE"); + String isNullable = columns.getString("IS_NULLABLE"); + String isAutoIncrement = columns.getString("IS_AUTOINCREMENT"); + System.out.println(String.format("ColumnName: %s, columnSize: %s, datatype: %s, isColumnNullable: %s, isAutoIncrementEnabled: %s", columnName, columnSize, datatype, isNullable, isAutoIncrement)); + } + } + + public void extractPrimaryKeys(String tableName) throws SQLException { + ResultSet primaryKeys = databaseMetaData.getPrimaryKeys(null, null, tableName); + while (primaryKeys.next()) { + String primaryKeyColumnName = primaryKeys.getString("COLUMN_NAME"); + String primaryKeyName = primaryKeys.getString("PK_NAME"); + System.out.println(String.format("columnName:%s, pkName:%s", primaryKeyColumnName, primaryKeyName)); + } + } + + public void fun() throws SQLException { + + } + + public void extractForeignKeys(String tableName) throws SQLException { + ResultSet foreignKeys = databaseMetaData.getImportedKeys(null, null, tableName); + while (foreignKeys.next()) { + String pkTableName = foreignKeys.getString("PKTABLE_NAME"); + String fkTableName = foreignKeys.getString("FKTABLE_NAME"); + String pkColumnName = foreignKeys.getString("PKCOLUMN_NAME"); + String fkColumnName = foreignKeys.getString("FKCOLUMN_NAME"); + System.out.println(String.format("pkTableName:%s, fkTableName:%s, pkColumnName:%s, fkColumnName:%s", pkTableName, fkTableName, pkColumnName, fkColumnName)); + } + } + + public void extractDatabaseInfo() throws SQLException { + String productName = databaseMetaData.getDatabaseProductName(); + String productVersion = databaseMetaData.getDatabaseProductVersion(); + + String driverName = databaseMetaData.getDriverName(); + String driverVersion = databaseMetaData.getDriverVersion(); + + System.out.println(String.format("Product name:%s, Product version:%s", productName, productVersion)); + System.out.println(String.format("Driver name:%s, Driver Version:%s", driverName, driverVersion)); + } + + public void extractUserName() throws SQLException { + String userName = databaseMetaData.getUserName(); + System.out.println(userName); + ResultSet schemas = databaseMetaData.getSchemas(); + while (schemas.next()) { + String table_schem = schemas.getString("TABLE_SCHEM"); + String table_catalog = schemas.getString("TABLE_CATALOG"); + System.out.println(String.format("Table_schema:%s, Table_catalog:%s", table_schem, table_catalog)); + } + } + + public void extractSupportedFeatures() throws SQLException { + System.out.println("Supports scrollable & Updatable Result Set: " + databaseMetaData.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)); + System.out.println("Supports Full Outer Joins: " + databaseMetaData.supportsFullOuterJoins()); + System.out.println("Supports Stored Procedures: " + databaseMetaData.supportsStoredProcedures()); + System.out.println("Supports Subqueries in 'EXISTS': " + databaseMetaData.supportsSubqueriesInExists()); + System.out.println("Supports Transactions: " + databaseMetaData.supportsTransactions()); + System.out.println("Supports Core SQL Grammar: " + databaseMetaData.supportsCoreSQLGrammar()); + System.out.println("Supports Batch Updates: " + databaseMetaData.supportsBatchUpdates()); + System.out.println("Supports Column Aliasing: " + databaseMetaData.supportsColumnAliasing()); + System.out.println("Supports Savepoints: " + databaseMetaData.supportsSavepoints()); + System.out.println("Supports Union All: " + databaseMetaData.supportsUnionAll()); + System.out.println("Supports Union: " + databaseMetaData.supportsUnion()); + } +} From ad7f2cbefa6146205cc9d9bfcd1d30a65b1ac832 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 13 Aug 2020 17:09:19 +0300 Subject: [PATCH 0433/1862] Update README.md --- algorithms-searching/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/algorithms-searching/README.md b/algorithms-searching/README.md index 260a4ea714..aed3c7d21f 100644 --- a/algorithms-searching/README.md +++ b/algorithms-searching/README.md @@ -11,4 +11,3 @@ This module contains articles about searching algorithms. - [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search) - [Range Search Algorithm in Java](https://www.baeldung.com/java-range-search) - [Fast Pattern Matching of Strings Using Suffix Tree](https://www.baeldung.com/java-pattern-matching-suffix-tree) -- [Topological Sort of Directed Acyclic Graph](https://www.baeldung.com/cs/dag-topological-sort) From 9e2161f36bbb38d1628f169fb5b30cce72f7a1c2 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Thu, 13 Aug 2020 17:10:29 +0300 Subject: [PATCH 0434/1862] Delete README.md --- excelformula/README.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 excelformula/README.md diff --git a/excelformula/README.md b/excelformula/README.md deleted file mode 100644 index 24560525cd..0000000000 --- a/excelformula/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## Apache POI - -This module contains articles about Apache POI - -### Relevant Articles: From 2fe9016a23b0e6860a0b17e5a5c63c1ce11d5d3a Mon Sep 17 00:00:00 2001 From: root Date: Thu, 13 Aug 2020 16:10:01 +0000 Subject: [PATCH 0435/1862] final comments --- .../main/java/com/baeldung/loadedclasslisting/Launcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java index 30db6b0bb7..bd9573d6b5 100644 --- a/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java +++ b/core-java-modules/core-java-jvm-2/src/main/java/com/baeldung/loadedclasslisting/Launcher.java @@ -11,9 +11,9 @@ public class Launcher { } private static void printClassesLoadedBy(String classLoaderType) { + System.out.println(classLoaderType + " ClassLoader : "); Class[] classes = ListLoadedClassesAgent.listLoadedClasses(classLoaderType); Arrays.asList(classes) - .forEach(clazz -> System.out.println( - classLoaderType + " ClassLoader : " + clazz.getCanonicalName())); + .forEach(clazz -> System.out.println(clazz.getCanonicalName())); } } From 2addd74680639e4864a45ea35d2a02280bfa0dbe Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Thu, 13 Aug 2020 22:07:42 +0200 Subject: [PATCH 0436/1862] JAVA-1638: Get rid of the overriden spring-boot.version property --- spring-5-reactive-oauth/pom.xml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/spring-5-reactive-oauth/pom.xml b/spring-5-reactive-oauth/pom.xml index e9882a6d32..15f5dcacaa 100644 --- a/spring-5-reactive-oauth/pom.xml +++ b/spring-5-reactive-oauth/pom.xml @@ -7,7 +7,7 @@ 1.0.0-SNAPSHOT spring-5-reactive-oauth jar - WebFluc and Spring Security OAuth + WebFlux and Spring Security OAuth com.baeldung @@ -64,8 +64,4 @@ - - 2.1.0.RELEASE - - From 850ace5f5e34bc2747aa82546837abdc286cec6a Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Fri, 14 Aug 2020 03:02:52 +0430 Subject: [PATCH 0437/1862] Custom Health Indicators in Spring Boot --- .../baeldung/health/HealthApplication.java | 12 ++++++++ .../health/RandomHealthIndicator.java | 28 +++++++++++++++++++ .../src/main/resources/application.properties | 6 +++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/HealthApplication.java create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/RandomHealthIndicator.java diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/HealthApplication.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/HealthApplication.java new file mode 100644 index 0000000000..af1f35b29f --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/HealthApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.health; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HealthApplication { + + public static void main(String[] args) { + SpringApplication.run(HealthApplication.class, args); + } +} diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/RandomHealthIndicator.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/RandomHealthIndicator.java new file mode 100644 index 0000000000..958f173458 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/RandomHealthIndicator.java @@ -0,0 +1,28 @@ +package com.baeldung.health; + +import org.springframework.boot.actuate.health.Health; +import org.springframework.boot.actuate.health.HealthIndicator; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ThreadLocalRandom; + +@Component +public class RandomHealthIndicator implements HealthIndicator { + + @Override + public Health health() { + double chance = ThreadLocalRandom.current().nextDouble(); + Health.Builder status = Health.up(); + if (chance > 0.9) { + status = Health.down(new RuntimeException("Bad Luck")); + } + + Map details = new HashMap<>(); + details.put("chance", chance); + details.put("strategy", "thread-local"); + + return status.withDetails(details).build(); + } +} diff --git a/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties b/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties index 8c706a9b1d..290221b731 100644 --- a/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties @@ -1 +1,5 @@ -management.health.probes.enabled=true \ No newline at end of file +management.health.probes.enabled=true +management.endpoint.health.show-details=always +management.health.random.enabled=false +management.endpoint.health.status.http-mapping.down=500 +management.endpoint.health.status.http-mapping.out_of_service=503 \ No newline at end of file From 89ef54df80995ef56f7e31fa926749d0ae62ece6 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Fri, 14 Aug 2020 03:26:35 +0430 Subject: [PATCH 0438/1862] Added a HttpCodeStatusMapper impl. --- .../health/CustomStatusCodeMapper.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/CustomStatusCodeMapper.java diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/CustomStatusCodeMapper.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/CustomStatusCodeMapper.java new file mode 100644 index 0000000000..0ff6773240 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/CustomStatusCodeMapper.java @@ -0,0 +1,26 @@ +package com.baeldung.health; + +import org.springframework.boot.actuate.health.HttpCodeStatusMapper; +import org.springframework.boot.actuate.health.Status; +import org.springframework.stereotype.Component; + +@Component +public class CustomStatusCodeMapper implements HttpCodeStatusMapper { + + @Override + public int getStatusCode(Status status) { + if (status == Status.DOWN) { + return 500; + } + + if (status == Status.OUT_OF_SERVICE) { + return 503; + } + + if (status == Status.UNKNOWN) { + return 500; + } + + return 200; + } +} From 925c5655b7093c65ef690224f0713d5ed1abb48e Mon Sep 17 00:00:00 2001 From: CHANDRAKANT Kumar Date: Fri, 14 Aug 2020 12:46:33 +0530 Subject: [PATCH 0439/1862] Incorporated review comments on the pull request. --- spring-webflux-threads/pom.xml | 5 ++++- .../src/main/java/com/baeldung/webflux/Controller.java | 2 +- spring-webflux-threads/src/main/resources/application.yml | 7 ------- 3 files changed, 5 insertions(+), 9 deletions(-) delete mode 100644 spring-webflux-threads/src/main/resources/application.yml diff --git a/spring-webflux-threads/pom.xml b/spring-webflux-threads/pom.xml index e5b5bafd3b..15224fcd14 100644 --- a/spring-webflux-threads/pom.xml +++ b/spring-webflux-threads/pom.xml @@ -7,7 +7,7 @@ 1.0.0-SNAPSHOT spring-webflux-threads jar - Spring WebFlux AMQP Sample + Spring WebFlux Threads Sample com.baeldung @@ -20,6 +20,7 @@ org.springframework.boot spring-boot-starter-webflux + + + @@ -53,10 +47,10 @@ test - - one.util - streamex - ${streamex.version} + + one.util + streamex + ${streamex.version} net.bytebuddy diff --git a/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java index d8bc46985d..e4ac8a3a95 100644 --- a/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java +++ b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java @@ -5,8 +5,6 @@ import au.com.dius.pact.consumer.PactProviderRuleMk2; import au.com.dius.pact.consumer.PactVerification; import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.model.RequestResponsePact; - -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.springframework.http.HttpEntity; @@ -28,15 +26,30 @@ public class PactConsumerDrivenContractUnitTest { @Pact(consumer = "test_consumer") public RequestResponsePact createPact(PactDslWithProvider builder) { - Map headers = new HashMap(); + Map headers = new HashMap<>(); headers.put("Content-Type", "application/json"); - return builder.given("test GET").uponReceiving("GET REQUEST").path("/pact").method("GET").willRespondWith().status(200).headers(headers).body("{\"condition\": true, \"name\": \"tom\"}").given("test POST").uponReceiving("POST REQUEST").method("POST") - .headers(headers).body("{\"name\": \"Michael\"}").path("/pact").willRespondWith().status(201).toPact(); + return builder + .given("test GET") + .uponReceiving("GET REQUEST") + .path("/pact") + .method("GET") + .willRespondWith() + .status(200) + .headers(headers) + .body("{\"condition\": true, \"name\": \"tom\"}") + .given("test POST") + .uponReceiving("POST REQUEST") + .method("POST") + .headers(headers) + .body("{\"name\": \"Michael\"}") + .path("/pact") + .willRespondWith() + .status(201) + .toPact(); } @Test - @Ignore @PactVerification() public void givenGet_whenSendRequest_shouldReturn200WithProperHeaderAndBody() { // when From 459662daf6bd4df19e8275664796708dff9c8dd2 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 14 Aug 2020 17:36:57 +0200 Subject: [PATCH 0445/1862] BAEL-4543: Use the prefered toArray() approach (#9869) --- .../java/collections/JavaCollectionConversionUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java index ba640f3fb2..7b856309f1 100644 --- a/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java +++ b/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java @@ -144,7 +144,7 @@ public class JavaCollectionConversionUnitTest { final Map sourceMap = createMap(); final Collection values = sourceMap.values(); - final String[] targetArray = values.toArray(new String[values.size()]); + final String[] targetArray = values.toArray(new String[0]); } @Test From 9ca1a0064a74209d83a784811883a13e013c6430 Mon Sep 17 00:00:00 2001 From: Maiklins Date: Fri, 14 Aug 2020 17:41:36 +0200 Subject: [PATCH 0446/1862] CS-378 Find kth smallest element in union of two sorted arrays (#9812) * CS-378 Find the Kth Smallest Element in the Union of Two Sorted Arrays * CS-378 Fix name of unit test * CS-378 Update merge algorithm to operate only on two input arrays Co-authored-by: mikr --- .../algorithms/kthsmallest/KthSmallest.java | 126 ++++++++ .../kthsmallest/KthSmallestUnitTest.java | 288 ++++++++++++++++++ 2 files changed, 414 insertions(+) create mode 100644 algorithms-searching/src/main/java/com/baeldung/algorithms/kthsmallest/KthSmallest.java create mode 100644 algorithms-searching/src/test/java/com/baeldung/algorithms/kthsmallest/KthSmallestUnitTest.java diff --git a/algorithms-searching/src/main/java/com/baeldung/algorithms/kthsmallest/KthSmallest.java b/algorithms-searching/src/main/java/com/baeldung/algorithms/kthsmallest/KthSmallest.java new file mode 100644 index 0000000000..2bd1a20ce0 --- /dev/null +++ b/algorithms-searching/src/main/java/com/baeldung/algorithms/kthsmallest/KthSmallest.java @@ -0,0 +1,126 @@ +package com.baeldung.algorithms.kthsmallest; + +import java.util.Arrays; +import java.util.NoSuchElementException; + +import static java.lang.Math.max; +import static java.lang.Math.min; + +public class KthSmallest { + + public static int findKthSmallestElement(int k, int[] list1, int[] list2) throws NoSuchElementException, IllegalArgumentException { + + checkInput(k, list1, list2); + + // we are looking for the minimum value + if(k == 1) { + return min(list1[0], list2[0]); + } + + // we are looking for the maximum value + if(list1.length + list2.length == k) { + return max(list1[list1.length-1], list2[list2.length-1]); + } + + // swap lists if needed to make sure we take at least one element from list1 + if(k <= list2.length && list2[k-1] < list1[0]) { + int[] list1_ = list1; + list1 = list2; + list2 = list1_; + } + + // correct left boundary if k is bigger than the size of list2 + int left = k < list2.length ? 0 : k - list2.length - 1; + + // the inital right boundary cannot exceed the list1 + int right = min(k-1, list1.length - 1); + + int nElementsList1, nElementsList2; + + // binary search + do { + nElementsList1 = ((left + right) / 2) + 1; + nElementsList2 = k - nElementsList1; + + if(nElementsList2 > 0) { + if (list1[nElementsList1 - 1] > list2[nElementsList2 - 1]) { + right = nElementsList1 - 2; + } else { + left = nElementsList1; + } + } + } while(!kthSmallesElementFound(list1, list2, nElementsList1, nElementsList2)); + + return nElementsList2 == 0 ? list1[nElementsList1-1] : max(list1[nElementsList1-1], list2[nElementsList2-1]); + } + + private static boolean kthSmallesElementFound(int[] list1, int[] list2, int nElementsList1, int nElementsList2) { + + // we do not take any element from the second list + if(nElementsList2 < 1) { + return true; + } + + if(list1[nElementsList1-1] == list2[nElementsList2-1]) { + return true; + } + + if(nElementsList1 == list1.length) { + return list1[nElementsList1-1] <= list2[nElementsList2]; + } + + if(nElementsList2 == list2.length) { + return list2[nElementsList2-1] <= list1[nElementsList1]; + } + + return list1[nElementsList1-1] <= list2[nElementsList2] && list2[nElementsList2-1] <= list1[nElementsList1]; + } + + + private static void checkInput(int k, int[] list1, int[] list2) throws NoSuchElementException, IllegalArgumentException { + + if(list1 == null || list2 == null || k < 1) { + throw new IllegalArgumentException(); + } + + if(list1.length == 0 || list2.length == 0) { + throw new IllegalArgumentException(); + } + + if(k > list1.length + list2.length) { + throw new NoSuchElementException(); + } + } + + public static int getKthElementSorted(int[] list1, int[] list2, int k) { + + int length1 = list1.length, length2 = list2.length; + int[] combinedArray = new int[length1 + length2]; + System.arraycopy(list1, 0, combinedArray, 0, list1.length); + System.arraycopy(list2, 0, combinedArray, list1.length, list2.length); + Arrays.sort(combinedArray); + + return combinedArray[k-1]; + } + + public static int getKthElementMerge(int[] list1, int[] list2, int k) { + + int i1 = 0, i2 = 0; + + while(i1 < list1.length && i2 < list2.length && (i1 + i2) < k) { + if(list1[i1] < list2[i2]) { + i1++; + } else { + i2++; + } + } + + if((i1 + i2) < k) { + return i1 < list1.length ? list1[k - i2 - 1] : list2[k - i1 - 1]; + } else if(i1 > 0 && i2 > 0) { + return Math.max(list1[i1-1], list2[i2-1]); + } else { + return i1 == 0 ? list2[i2-1] : list1[i1-1]; + } + } +} diff --git a/algorithms-searching/src/test/java/com/baeldung/algorithms/kthsmallest/KthSmallestUnitTest.java b/algorithms-searching/src/test/java/com/baeldung/algorithms/kthsmallest/KthSmallestUnitTest.java new file mode 100644 index 0000000000..740e89d8e7 --- /dev/null +++ b/algorithms-searching/src/test/java/com/baeldung/algorithms/kthsmallest/KthSmallestUnitTest.java @@ -0,0 +1,288 @@ +package com.baeldung.algorithms.kthsmallest; + +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; + +import java.util.*; + +import static com.baeldung.algorithms.kthsmallest.KthSmallest.*; +import static org.junit.jupiter.api.Assertions.*; + +public class KthSmallestUnitTest { + + @Nested + class Exceptions { + + @Test + public void when_at_least_one_list_is_null_then_an_exception_is_thrown() { + + Executable executable1 = () -> findKthSmallestElement(1, null, null); + Executable executable2 = () -> findKthSmallestElement(1, new int[]{2}, null); + Executable executable3 = () -> findKthSmallestElement(1, null, new int[]{2}); + + assertThrows(IllegalArgumentException.class, executable1); + assertThrows(IllegalArgumentException.class, executable2); + assertThrows(IllegalArgumentException.class, executable3); + } + + @Test + public void when_at_least_one_list_is_empty_then_an_exception_is_thrown() { + + Executable executable1 = () -> findKthSmallestElement(1, new int[]{}, new int[]{2}); + Executable executable2 = () -> findKthSmallestElement(1, new int[]{2}, new int[]{}); + Executable executable3 = () -> findKthSmallestElement(1, new int[]{}, new int[]{}); + + assertThrows(IllegalArgumentException.class, executable1); + assertThrows(IllegalArgumentException.class, executable2); + assertThrows(IllegalArgumentException.class, executable3); + } + + @Test + public void when_k_is_smaller_than_0_then_an_exception_is_thrown() { + Executable executable1 = () -> findKthSmallestElement(-1, new int[]{2}, new int[]{2}); + assertThrows(IllegalArgumentException.class, executable1); + } + + @Test + public void when_k_is_smaller_than_1_then_an_exception_is_thrown() { + Executable executable1 = () -> findKthSmallestElement(0, new int[]{2}, new int[]{2}); + assertThrows(IllegalArgumentException.class, executable1); + } + + @Test + public void when_k_bigger_then_the_two_lists_then_an_exception_is_thrown() { + Executable executable1 = () -> findKthSmallestElement(6, new int[]{1, 5, 6}, new int[]{2, 5}); + assertThrows(NoSuchElementException.class, executable1); + } + + } + + @Nested + class K_is_smaller_than_the_size_of_list1_and_the_size_of_list2 { + + @Test + public void when_k_is_1_then_the_smallest_element_is_returned_from_list1() { + int result = findKthSmallestElement(1, new int[]{2, 7}, new int[]{3, 5}); + assertEquals(2, result); + } + + @Test + public void when_k_is_1_then_the_smallest_element_is_returned_list2() { + int result = findKthSmallestElement(1, new int[]{3, 5}, new int[]{2, 7}); + assertEquals(2, result); + } + + @Test + public void when_kth_element_is_smallest_element_and_occurs_in_both_lists() { + int[] list1 = new int[]{1, 2, 3}; + int[] list2 = new int[]{1, 2, 3}; + int result = findKthSmallestElement(1, list1, list2); + assertEquals(1, result); + } + + @Test + public void when_kth_element_is_smallest_element_and_occurs_in_both_lists2() { + int[] list1 = new int[]{1, 2, 3}; + int[] list2 = new int[]{1, 2, 3}; + int result = findKthSmallestElement(2, list1, list2); + assertEquals(1, result); + } + + @Test + public void when_kth_element_is_largest_element_and_occurs_in_both_lists_1() { + int[] list1 = new int[]{1, 2, 3}; + int[] list2 = new int[]{1, 2, 3}; + int result = findKthSmallestElement(5, list1, list2); + assertEquals(3, result); + } + + @Test + public void when_kth_element_is_largest_element_and_occurs_in_both_lists_2() { + int[] list1 = new int[]{1, 2, 3}; + int[] list2 = new int[]{1, 2, 3}; + int result = findKthSmallestElement(6, list1, list2); + assertEquals(3, result); + } + + @Test + public void when_kth_element_and_occurs_in_both_lists() { + int[] list1 = new int[]{1, 2, 3}; + int[] list2 = new int[]{0, 2, 3}; + int result = findKthSmallestElement(3, list1, list2); + assertEquals(2, result); + } + + @Test + public void and_kth_element_is_in_first_list() { + int[] list1 = new int[]{1,2,3,4}; + int[] list2 = new int[]{1,3,4,5}; + int result = findKthSmallestElement(3, list1, list2); + assertEquals(2, result); + } + + @Test + public void and_kth_is_in_second_list() { + int[] list1 = new int[]{1,3,4,4}; + int[] list2 = new int[]{1,2,4,5}; + int result = findKthSmallestElement(3, list1, list2); + assertEquals(2, result); + } + + @Test + public void and_elements_in_first_list_are_all_smaller_than_second_list() { + int[] list1 = new int[]{1,3,7,9}; + int[] list2 = new int[]{11,12,14,15}; + int result = findKthSmallestElement(3, list1, list2); + assertEquals(7, result); + } + + @Test + public void and_elements_in_first_list_are_all_smaller_than_second_list2() { + int[] list1 = new int[]{1,3,7,9}; + int[] list2 = new int[]{11,12,14,15}; + int result = findKthSmallestElement(4, list1, list2); + assertEquals(9, result); + } + + @Test + public void and_only_elements_from_second_list_are_part_of_result() { + int[] list1 = new int[]{11,12,14,15}; + int[] list2 = new int[]{1,3,7,9}; + int result = findKthSmallestElement(3, list1, list2); + assertEquals(7, result); + } + + @Test + public void and_only_elements_from_second_list_are_part_of_result2() { + int[] list1 = new int[]{11,12,14,15}; + int[] list2 = new int[]{1,3,7,9}; + int result = findKthSmallestElement(4, list1, list2); + assertEquals(9, result); + } + } + + @Nested + class K_is_bigger_than_the_size_of_at_least_one_of_the_lists { + + @Test + public void k_is_smaller_than_list1_and_bigger_than_list2() { + int[] list1 = new int[]{1, 2, 3, 4, 7, 9}; + int[] list2 = new int[]{1, 2, 3}; + int result = findKthSmallestElement(5, list1, list2); + assertEquals(3, result); + } + + @Test + public void k_is_bigger_than_list1_and_smaller_than_list2() { + int[] list1 = new int[]{1, 2, 3}; + int[] list2 = new int[]{1, 2, 3, 4, 7, 9}; + int result = findKthSmallestElement(5, list1, list2); + assertEquals(3, result); + } + + @Test + public void when_k_is_bigger_than_the_size_of_both_lists_and_elements_in_second_list_are_all_smaller_than_first_list() { + int[] list1 = new int[]{9, 11, 13, 55}; + int[] list2 = new int[]{1, 2, 3, 7}; + int result = findKthSmallestElement(6, list1, list2); + assertEquals(11, result); + } + + @Test + public void when_k_is_bigger_than_the_size_of_both_lists_and_elements_in_second_list_are_all_bigger_than_first_list() { + int[] list1 = new int[]{1, 2, 3, 7}; + int[] list2 = new int[]{9, 11, 13, 55}; + int result = findKthSmallestElement(6, list1, list2); + assertEquals(11, result); + } + + @Test + public void when_k_is_bigger_than_the_size_of_both_lists() { + int[] list1 = new int[]{3, 7, 9, 11, 55}; + int[] list2 = new int[]{1, 2, 3, 7, 13}; + int result = findKthSmallestElement(7, list1, list2); + assertEquals(9, result); + } + + @Test + public void when_k_is_bigger_than_the_size_of_both_lists_and_list1_has_more_elements_than_list2() { + int[] list1 = new int[]{3, 7, 9, 11, 55, 77, 100, 200}; + int[] list2 = new int[]{1, 2, 3, 7, 13}; + int result = findKthSmallestElement(11, list1, list2); + assertEquals(77, result); + } + + @Test + public void max_test() { + int[] list1 = new int[]{100, 200}; + int[] list2 = new int[]{1, 2, 3}; + int result = findKthSmallestElement(4, list1, list2); + assertEquals(100, result); + } + + @Test + public void max_test2() { + int[] list1 = new int[]{100, 200}; + int[] list2 = new int[]{1, 2, 3}; + int result = findKthSmallestElement(5, list1, list2); + assertEquals(200, result); + } + + @Test + public void when_k_is_smaller_than_the_size_of_both_lists_and_kth_element_in_list2() { + int[] list1 = new int[]{1, 2, 5}; + int[] list2 = new int[]{1, 3, 4, 7}; + int result = findKthSmallestElement(4, list1, list2); + assertEquals(3, result); + } + + @Test + public void when_k_is_smaller_than_the_size_of_both_lists_and_kth_element_is_smallest_in_list2() { + int[] list1 = new int[]{1, 2, 5}; + int[] list2 = new int[]{3, 4, 7}; + int result = findKthSmallestElement(3, list1, list2); + assertEquals(3, result); + } + + @Test + public void when_k_is_smaller_than_the_size_of_both_lists_and_kth_element_is_smallest_in_list23() { + int[] list1 = new int[]{3, 11, 27, 53, 90}; + int[] list2 = new int[]{4, 20, 21, 100}; + int result = findKthSmallestElement(5, list1, list2); + assertEquals(21, result); + } + } + +// @Test +// public void randomTests() { +// IntStream.range(1, 100000).forEach(i -> random()); +// } + + private void random() { + + Random random = new Random(); + int length1 = (Math.abs(random.nextInt())) % 1000 + 1; + int length2 = (Math.abs(random.nextInt())) % 1000 + 1; + + int[] list1 = sortedRandomIntArrayOfLength(length1); + int[] list2 = sortedRandomIntArrayOfLength(length2); + + int k = (Math.abs(random.nextInt()) % (length1 + length2)) + 1 ; + + int result = findKthSmallestElement(k, list1, list2); + + int result2 = getKthElementSorted(list1, list2, k); + + int result3 = getKthElementMerge(list1, list2, k); + + assertEquals(result2, result); + assertEquals(result2, result3); + } + + private int[] sortedRandomIntArrayOfLength(int length) { + int[] intArray = new Random().ints(length).toArray(); + Arrays.sort(intArray); + return intArray; + } +} \ No newline at end of file From 8d97b0cb37a0e76767c3241bf6cfb9c5e0ca60a5 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Fri, 14 Aug 2020 22:07:40 +0530 Subject: [PATCH 0447/1862] JAVA-1639: Upgrade spring-5-security-cognito to use latest Spring Boot version --- spring-5-security-cognito/pom.xml | 9 +---- .../cognito/CognitoWebConfiguration.java | 2 -- .../cognito/SecurityConfiguration.java | 23 ++++++++++++ .../cognito/SpringCognitoApplication.java | 2 -- .../src/main/resources/application.yml | 15 ++++++++ .../resources/cognito/application-cognito.yml | 15 -------- .../src/main/resources/cognito/home.html | 32 ----------------- .../src/main/resources/cognito/style.css | 9 ----- .../src/main/resources/templates/home.html | 35 +++++++++++++++++++ 9 files changed, 74 insertions(+), 68 deletions(-) create mode 100644 spring-5-security-cognito/src/main/java/com/baeldung/cognito/SecurityConfiguration.java create mode 100644 spring-5-security-cognito/src/main/resources/application.yml delete mode 100644 spring-5-security-cognito/src/main/resources/cognito/application-cognito.yml delete mode 100644 spring-5-security-cognito/src/main/resources/cognito/home.html delete mode 100644 spring-5-security-cognito/src/main/resources/cognito/style.css create mode 100644 spring-5-security-cognito/src/main/resources/templates/home.html diff --git a/spring-5-security-cognito/pom.xml b/spring-5-security-cognito/pom.xml index 8d03b91ce0..5f8f328086 100644 --- a/spring-5-security-cognito/pom.xml +++ b/spring-5-security-cognito/pom.xml @@ -34,11 +34,6 @@ - - org.springframework.security.oauth.boot - spring-security-oauth2-autoconfigure - ${oauth-auto.version} - org.springframework.security spring-security-oauth2-client @@ -62,10 +57,8 @@ test - + - 2.1.0.RELEASE - 2.1.0.RELEASE com.baeldung.cognito.SpringCognitoApplication diff --git a/spring-5-security-cognito/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java index 6841fa7a65..df35a46ef3 100644 --- a/spring-5-security-cognito/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java +++ b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/CognitoWebConfiguration.java @@ -1,12 +1,10 @@ package com.baeldung.cognito; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration -@PropertySource("cognito/application-cognito.yml") public class CognitoWebConfiguration implements WebMvcConfigurer { @Override diff --git a/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SecurityConfiguration.java b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SecurityConfiguration.java new file mode 100644 index 0000000000..ba0436d20d --- /dev/null +++ b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SecurityConfiguration.java @@ -0,0 +1,23 @@ +package com.baeldung.cognito; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf() + .and() + .authorizeRequests(authz -> authz.mvcMatchers("/") + .permitAll() + .anyRequest() + .authenticated()) + .oauth2Login() + .and() + .logout() + .logoutSuccessUrl("/"); + } +} \ No newline at end of file diff --git a/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java index eebe6d8f45..fc55de590c 100644 --- a/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java +++ b/spring-5-security-cognito/src/main/java/com/baeldung/cognito/SpringCognitoApplication.java @@ -2,10 +2,8 @@ package com.baeldung.cognito; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.PropertySource; @SpringBootApplication -@PropertySource("cognito/application-cognito.yml") public class SpringCognitoApplication { public static void main(String[] args) { diff --git a/spring-5-security-cognito/src/main/resources/application.yml b/spring-5-security-cognito/src/main/resources/application.yml new file mode 100644 index 0000000000..e53a2642e0 --- /dev/null +++ b/spring-5-security-cognito/src/main/resources/application.yml @@ -0,0 +1,15 @@ +spring: + security: + oauth2: + client: + registration: + cognito: + client-id: your_clientId + client-secret: your_clientSecret + scope: openid + redirect-uri: http://localhost:8080/login/oauth2/code/cognito + clientName: your_clientName + provider: + cognito: + issuerUri: https://cognito-idp.{region}.amazonaws.com/{poolId} + user-name-attribute: cognito:username diff --git a/spring-5-security-cognito/src/main/resources/cognito/application-cognito.yml b/spring-5-security-cognito/src/main/resources/cognito/application-cognito.yml deleted file mode 100644 index 0a28dbccb4..0000000000 --- a/spring-5-security-cognito/src/main/resources/cognito/application-cognito.yml +++ /dev/null @@ -1,15 +0,0 @@ -spring: - security: - oauth2: - client: - registration: - cognito: - client-id: clientId - client-secret: clientSecret - scope: openid - redirectUriTemplate: "http://localhost:8080/login/oauth2/code/cognito" - clientName: cognito-client-name - provider: - cognito: - issuerUri: https://cognito-idp.{region}.amazonaws.com/{poolId} - usernameAttribute: cognito:username diff --git a/spring-5-security-cognito/src/main/resources/cognito/home.html b/spring-5-security-cognito/src/main/resources/cognito/home.html deleted file mode 100644 index f0bd9e52a8..0000000000 --- a/spring-5-security-cognito/src/main/resources/cognito/home.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - OAuth2 Cognito Demo - - - - - -
    -
    -
    -

    OAuth2 Spring Security Cognito Demo

    - -
    -
    - Hello, ! -
    -
    - - -
    -
    -
    - - diff --git a/spring-5-security-cognito/src/main/resources/cognito/style.css b/spring-5-security-cognito/src/main/resources/cognito/style.css deleted file mode 100644 index 45190d6d70..0000000000 --- a/spring-5-security-cognito/src/main/resources/cognito/style.css +++ /dev/null @@ -1,9 +0,0 @@ -.login { - background-color: #7289da; - color: #fff; -} - -.login:hover { - background-color: #697ec4; - color: #fff; -} diff --git a/spring-5-security-cognito/src/main/resources/templates/home.html b/spring-5-security-cognito/src/main/resources/templates/home.html new file mode 100644 index 0000000000..df3c86fe2a --- /dev/null +++ b/spring-5-security-cognito/src/main/resources/templates/home.html @@ -0,0 +1,35 @@ + + + + + +OAuth2 Cognito Demo + + + + +
    +
    +
    +

    OAuth2 Spring Security Cognito Demo

    + +
    +
    + Hello, ! +
    +
    + + +
    +
    +
    + + From 9c846f0e842799543be23dc71b0c54bbb697b474 Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sat, 15 Aug 2020 03:21:29 +0530 Subject: [PATCH 0448/1862] keeping Configuration in Separate class --- .../cosmosdb/AzureCosmosDbApplication.java | 34 +---------------- .../config/AzureCosmosDbConfiguration.java | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 33 deletions(-) create mode 100644 persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/config/AzureCosmosDbConfiguration.java diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplication.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplication.java index 7a91cd7d33..5a1764adc6 100644 --- a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplication.java +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/AzureCosmosDbApplication.java @@ -1,44 +1,12 @@ package com.baeldung.spring.data.cosmosdb; -import com.azure.data.cosmos.CosmosKeyCredential; -import com.baeldung.spring.data.cosmosdb.repository.ProductRepository; -import com.microsoft.azure.spring.data.cosmosdb.config.AbstractCosmosConfiguration; -import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; -import com.microsoft.azure.spring.data.cosmosdb.repository.config.EnableCosmosRepositories; - -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; @SpringBootApplication -@EnableCosmosRepositories(basePackageClasses = ProductRepository.class) -public class AzureCosmosDbApplication extends AbstractCosmosConfiguration { +public class AzureCosmosDbApplication { public static void main(String[] args) { SpringApplication.run(AzureCosmosDbApplication.class, args); } - - @Value("${azure.cosmosdb.uri}") - private String uri; - - @Value("${azure.cosmosdb.key}") - private String key; - - @Value("${azure.cosmosdb.secondaryKey}") - private String secondaryKey; - - @Value("${azure.cosmosdb.database}") - private String dbName; - - private CosmosKeyCredential cosmosKeyCredential; - - @Bean - public CosmosDBConfig getConfig() { - this.cosmosKeyCredential = new CosmosKeyCredential(key); - CosmosDBConfig cosmosdbConfig = CosmosDBConfig.builder(uri, this.cosmosKeyCredential, dbName) - .build(); - return cosmosdbConfig; - } - } diff --git a/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/config/AzureCosmosDbConfiguration.java b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/config/AzureCosmosDbConfiguration.java new file mode 100644 index 0000000000..7d3322faf6 --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/src/main/java/com/baeldung/spring/data/cosmosdb/config/AzureCosmosDbConfiguration.java @@ -0,0 +1,37 @@ +package com.baeldung.spring.data.cosmosdb.config; + +import com.azure.data.cosmos.CosmosKeyCredential; +import com.microsoft.azure.spring.data.cosmosdb.config.AbstractCosmosConfiguration; +import com.microsoft.azure.spring.data.cosmosdb.config.CosmosDBConfig; +import com.microsoft.azure.spring.data.cosmosdb.repository.config.EnableCosmosRepositories; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableCosmosRepositories(basePackages = "com.baeldung.spring.data.cosmosdb.repository") +public class AzureCosmosDbConfiguration extends AbstractCosmosConfiguration { + + @Value("${azure.cosmosdb.uri}") + private String uri; + + @Value("${azure.cosmosdb.key}") + private String key; + + @Value("${azure.cosmosdb.secondaryKey}") + private String secondaryKey; + + @Value("${azure.cosmosdb.database}") + private String dbName; + + private CosmosKeyCredential cosmosKeyCredential; + + @Bean + public CosmosDBConfig getConfig() { + this.cosmosKeyCredential = new CosmosKeyCredential(key); + CosmosDBConfig cosmosdbConfig = CosmosDBConfig.builder(uri, this.cosmosKeyCredential, dbName) + .build(); + return cosmosdbConfig; + } +} From 10349f5185f16f53487c88c10bf623a3a3698292 Mon Sep 17 00:00:00 2001 From: Philippe Date: Fri, 14 Aug 2020 22:58:58 -0300 Subject: [PATCH 0449/1862] [BAEL-4381] Fix formatting --- .../article-resources/archunit/figure1.drawio | 1 - .../article-resources/archunit/figure1.png | Bin 15103 -> 0 bytes 2 files changed, 1 deletion(-) delete mode 100644 libraries-testing/article-resources/archunit/figure1.drawio delete mode 100644 libraries-testing/article-resources/archunit/figure1.png diff --git a/libraries-testing/article-resources/archunit/figure1.drawio b/libraries-testing/article-resources/archunit/figure1.drawio deleted file mode 100644 index 859d9946a1..0000000000 --- a/libraries-testing/article-resources/archunit/figure1.drawio +++ /dev/null @@ -1 +0,0 @@ -7VjbctowEP0aP9LBNgb3sSa3BzJNJ+2kk5eMsBdbrax1ZUEgX1/Jlm84YWgbKL3wwFhHa3l99pyVwHKn6fpSkCy5xgiY5QyjteWeWY7jj331rYFNCXjOsARiQaMSshvglj6BAauwJY0g7wRKRCZp1gVD5BxC2cGIEPjYDVsg6z41IzH0gNuQsD56RyOZGNQev20mroDGiXm070zKiTkJv8YCl9w8jyOHciYl1TLmHfOERPjYgtxzy50KRFlepespMM1qxVh538ULs3XKArjc54YrsrkffLj+Bp8ePr+/GTw409XdwKyyImxpqEg3JMsYDYmkyE3mclMRpV4i05eaYRCWGyyQy1szb6txnpGQ8vgjZhoYKkSSecXpyIxrKu1RCdxgTovnuWcMFmomSGTKzJIrEFLlw94xGusIqdcOiBmZeJ3HBUkp0wqcLUMaEZX5FHmOOreAkTmwoK7WFBmK4pXcRfHRS1DGWvhF8VF4n+iKNZUYrFuQIf4SMAUpNiqkmvWMCIw/7EoUj43aJr7BkpbQRq4BiVF4XK/dlFpdmGr/QOUnvcpbzpikmlomi7dujyLIgEd5DcadEDPa0gpEymNmiEImGCMn7LxBg6IUoLPUwmhiZljKR4FfQMqNaRhkKbErjYjkSXG//ToSeLHUOS5FCDvodE3XIiIGuSPOK+M0NzuFI4ApB666/enVReD2RJCDWNEQTsL4bUMWjbXn+udbwyGFsL/nPX/L837f8874Gc/bB/P8+N/26GhPj7on5VH/KI16ponvFq7yWqiILiy/7baURlGpEcjpE5kX62mVZEi5LHjwAss7O1Tdd2m859P68Gjy7JzCnvPvYPhG7dOmX+9darPcjWagtf9POq1gYHvdFXCxyJUkt6VSJ/Xz6hn11JOpaikKT+d892e3eXuyR5v3jtrmvX7NQeQ0l8BPZGc/Vn0PeKTf3t5Hw9++vVe/pk/Z7P+d/UsV7v9eP6UD+19o64Oe2tWw+f+n3PGbv9fc8+8= \ No newline at end of file diff --git a/libraries-testing/article-resources/archunit/figure1.png b/libraries-testing/article-resources/archunit/figure1.png deleted file mode 100644 index 8bd8e9647b07a46e7d8e363ba750fa838c07debb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15103 zcmeHuc{tQ<`!|!aCCZxaiWU??4JzA2%1$bhEV+xUlZdQi?(QfQg)oDmP*PO3vW;$~ z&DcivF)eq)*hXd;X3Wg*`l9qa@AEvzd%W-OIDW@_y!|=X_xnAs>pZV>|D1Ep&gQU~ zh`b0NAD@`H*+F|gz7=A8eEg+CtH8?o2m93c_!Rie4<0yn$#tA`;Qq$$Fuspk7LRJ}y$E9$XWZVd&If0KKCLkoCfQUg%!;;|ELCgtKO^VC# z)+GH~N_%_fGUdKM=R^0cgo{;p^{^IRU-(XKN3QpYb#48^5P^l2&Rx0Q_YE4m4ln)$ z>+a_K){VDf25o+<7{LiC)xPwV69wcjaAoUlg_ zA8*U8lKio9-vvRmi->)c^n;0pTQE%QcK*8TA1jD)u+q23FKUrXX#KWS8(d9zczk)q zNA}Vg_RM%Fa0%yppJw$MP$?g~rHueCB*w?CMdtzz?DD!^C$?zS){| zPJUBIOaHQD9{w3qczSz>-_2zTn_P3R7Jh2Z+(Wn~sq9&-fBqvP=+j?UJV(18m62q5BiB<{}tNSjg5Y)G{vRMk+^T}ZcR)Mn47D?vuh}__*v7MrlFjO zl6~Qfb8IqoCYN~6wu+}0JwMx=t9R@knf&DU!$E()xv6bP8YTA7YUws9+_}!6p%#K` z(DcX$&+ZbJ@$rMU`ri%)eSMckVNH*Yo%wdVL&`t^2j!`sthCz#dD{O$rRpjUbc zf#ZD@p5*!{(IIWr=+W>a)en*>`*=A4F>r3Be}7-`rqNe*K|?k{V?9r_eaE}#bR4fX z3OU7jYa6|LL*s`;4A;j=bV>HPo6r%M*x+H*NYTAMX)cG%i|XGNEM~&0vrONmEvw<` z7cwyr)~d*@V-ETnau~$QqTw}kssVL+a}=ZfVV+ss1cO(T>`^czIT%SNP_D?jp2HnB z6C8DP4J!zn>Gh(88GeecQl1v4atiZ&h2j_X3wxiV|d^Y zxf@whKm7XTZ1nt=VT{0gog(U{nhBW7Zz`)3O; za~<)l4>K}%7(~*Ilz_51ATrKOKYQY1tt&BkO$#Y4*3{aBcRPE)+64cWO1{vEYGa)) zfuEEAto!up4?S)a);~|wL}{OHKOW2F*SD@iMc6adqpQ=6NHeMRfwqJ}QL|GZ(ekHH%7ND;wj}i~J2E-owlu>W$aRmsnTyy$P0aaJMGN{1kgV#-eL`#lcCR0Rk3y>2S0@HiEOfgOfOB@hA7S^|a9Dmd1B)0@l;0ijg&TyGUU zl&39tk|veG%8MMKJHNI5y^Z953-@vT@WoVc$>7j1rb&k(P5K}m@pb{2%?cP+SH z5QN>guUw?(aDjLN4q~`4h~b~`y1Y4^+;PYKbjsqRZ zn?YJy`@PZSQIK3p{*dn9eb=oO(i>W`^{~L@Z|gqaq&SIy8G3EH`aVJUnEFS$ic;NW zxLEz^YvwsB0!>nr%t))KC*wvDK;||GgR8xwm{>WlBSOcNbIlynJMPGw;Yp|MO4+V? zKPFsLh30qO+9a_|Mc{#?U4F5p_Yu*jym*WBx9jANAq?bF9f=Z+HGAJ(5tYSkJ$wT$ zxaPNW9VjHJ`eHNns`bY_0V!&n2ffe=cC;52Ix*mVW20VImR@Mdz9?33(ERK-D^>Vv zei&9d!@{6vEYdP6TUAVScj%X<>y)-U6T+7yBW^<+>+GQOh|+G_2PwOJ$33*8P8A&8 zG^-3j^tY9rmot7lCl43X(z8w-0eg+upX~f&41cHN>{EeN(stsjzGjOVo+F+IX%%Ji zQzJprR=@q!^9u#fqdDOlW{2DF5_-$Lu%YCrs<5H#(7yiQdNzqxiK>iXPEbC-O0Z@P zm36dc?(xD%D%&(G4b(B|twzY#^^tQ^W33b<(}`Axto?R~-pZSAC8XCg3MkXvZb&k2 zkUi6ntoqh*mNJLiHPMRV(r0!athy~2hK#Q{r|w+o=iTU16Y{9H3Q5MaIhMNm&rFc| zTYTHINP|*zS<}>rl~Ud{9#&{BcQjybtaWI9jy~>nkVP%wV~&PAcvKTI?&Fp+f?}yr z4Q)I8549RFPqDrFtB^>eQv2))L!u#jtZXLe^WSe%d<`$Nw7QF_By}rJKc+gYrp~*0 z^-8(B5R z1H6mO!Rh!h&LH-4a2&IjwsG>6MmBRlZJy8@${61wg67HE<&Vc|t*qvB8@*xT&yP?lUHz@A zaP@N(EJ0MGwk=wzph?jnX>y+4sw*hI$&Xj#d#G9iS>0#Ad%lMkMnuX{@IscTE~H#X zkK5ckM^D^#mxo&ZuaxXCF|Btq60g9;sLq)s8KJMVrAZt0LdvZh?_5SP547QLwefT) z&SX{>2072Z5^|SW7-&y?e1E+;SaTg}#1d+6a|C;{5=gq(=T9=!k9FITkS$vM zrcyA>st9*^7{|mIuf!bn!BFoMOHi4_)Acnc+jxm1r6p`NbH@#?5#tq5nB< zmk-x5Yeb&3zreHkMhr8mop0Q(>&W%K+B=v^dXB0$i3 zt!}l&P1h7djgAk)!8P^|*mP@iCWf27pF?(L%ynstQ7zEBJ+`wf%rcLc{9VU z+_BcKIs@rk-2CSo#h-<9=pS4-+!057pJ759YK=eFGM@k!qdTtDp_?AN zK-JZx)4sKq-*_JMvgAm^&=D(#MocXCLiJ_ZeAQ^e?b>07Tn53KMKwB>6i--;y{O0(%&XDrU{~`{ai+MW#<%M; z5mAtNT#)a8GkDY2GR|Hzj%jFv#WULeYQp1UI9@0Tg*M^)f?5#=h!S7aM9}}i^GK8l z9DxE6;^rn37b~(_-wFYtX3<&w_+H8X(a(pM05u=wD*=jx}=&bSFX?LG|Cf{h%=Dih56{h_I%U0Tc*m*e{r zoD(^Yr`}m*G`Pb?UbvV0t_q2;|Mvmq|7Kq=d5`~>_kHMdvmR97^l>DrCT#kHBQ{$v z^v11jz0e8x>l+(=bD~*PPugJJ-R9F{xy9AIrVv?NgA^14AD)x<$N~b-Zg?Q$ZQTg3 zoO&>U_a4TsM0-PeI@bn&xi`T$cRyM_KA6?S1#y7@%A=sxEPw*|R>!M6R z5%TN%bgVKi@+oIJDVlM2#(-4C9csz;Me#;H6pvT&WOto97d>6k%b~f&*=`_iJNqy*HG{avU+w=hkIBfOK{JcU@JfGrPB9y1+6W zlOU^6;w@L*I7h(h_Fv|J(i6+*gZz9PGx#I7CA5BzuRKeT&hVmE7E}#}7l+a6n3!%i zRNY42dpGWd2)*|1`k9K5MBnZbZ6glVw*OEbs<<7r05B$TYqS?4j#}MBcIcot_Bxaz z%rS_z{bXA)Yk6f3v&5ywlVFV*oo@{vwF(-4z0?2l?RuUCUB?Y}RK`x+i7Zn8ztYeaosS^?qRAAp$tF*w{ z-Dx%AMTY1d2_ID4*hyqp_v5OWkGkRcs^TD#YErWa^=(f=&3}o=am+wE4CEXmxfzIV zLAZmRTJPSvRphO*!+qCnSbhRYl6F0B%W^QO}AS)7z&y0|eDX=_o6 zzwp(9T|d{4Vu>5yD<7oIv$4wIuH?|$tNGy_2 z(9A%H;SOK^bmq4c#N@R^I{^oC#LaqC#nY~6aSpG*&9Ov&C$>@)6`nO z)KyzFo%m6$%2-TVMh2&9op+@f47<)wT<29eBLPHacpksd!$J@SF=0t3r^TZuFH@3u zvq@Nu=x+(4CVi+QnG$ggjDSTvjmnlq$GS_IkGHJn-yfe~aQ?Ww!h z!|sXz_UHd0fSIcg#~IC^rhiV*(BaXIc*Oj=5U7DhxXjTl3eH@OJ_2@;i~erKP$@zE zTc-TtXcxteH|^FR7WGNg?F3Ojl4|K@A^ycWphf9m45Ah!a&kf6KQeoDm%ZQ@Qj-^CrN6#C^otx++ zm-bc(Mx_^iI`FDChY#(5xLLV2R;H)Y-#G|W2s(+XVkW*DaERv%;s4%u1C9^AxFfss zkB&WJWFD8N z8DM!LljCT7yZI&}5fC04%Z!!t1?A*+P)??`e3tp0C!M}qQb{udl#_Df7&PhEzCYKe zzvTRr#{bf*Uv~7%Z~Xu1Ck3AycmphtaD9WWhl7F$KkTm1*ue9$xxZ6v4_#AN;m7S+ zj9s9&Q>ST0l-P3-l-3Y1i9RkfDMsJvMee%`V2<|BpO;V$Cjq#albo2b`%%zovDOM( zyNI}GYNL z&AI^^+xwquN-iSCANd9Jg*bdCTrK_yZcf~q>n-=%rSk*8d>?uaKEf;zmeTk*lmGeX zIsTPkI}wZ9MeBZ`te{~))QqhL4e|vB!MR1&wZWxQ)sAil{DPlcw}x@^kQL~?0L0F! zFk5^Nafn~s*y|-+3M~dWuM}Ej*DfD)u-}wt2Im1jjU~PMvfd8p@bSr4L$d%2AG&{7 z339~|y$04+AitY^9?K|^iX8yA-8-xnI^zq6K>%`!_ReaHEGuAR`coE~5V3%|*tOav z%qinej9}iq4C$Z;#{mIf&qs?8|1k)d*MD(acL#vu^E*!OUOae%Cv*U(9i>|z*8+)# znQZ;ewvfdAlYqd*aP=EME~8-zZ1q*_`l2L+5*2_L*S1|bqhKYwh+hh~GB06&Sv z*A{q#i$Pilo!brvz8ZO7ByH{3kQPg&G&L`&BU|W_MBj{p1V}iqmdPw>(HoUq?>ASy zRbU&00L8V76m!jhCP`=Nr0hBdxIFjS>IZ5Xg8-n3qQ%MImbbnFjv`{6<-IU^fIcpJ zKBD6Rjc+swDAhrq1k**ypOKtY2-dM!v9<@?++)R?vP+UY3f{8PQl%U#2IA;yJ}JA% z17tl`K%7>|u|M#61-pNECnL9EyuS*IM6vq`#ijLqz$SxI*AG4qy0;xSY#k!zf zzVYmuKh~*O11?TBHK#8~NJpQ>(X*T#*iwBRBH6!=n^uwNpQ8K+Ip8F(Y zE~mRiKMxzP=wQ`f<-(!^7^0jP#bQt?v){fz&ID6Mj;@)b=;HS!1aar* zbV7_;Km~<;y(!}1zQE5f)f{vkP;0zevb;eD0yz+*eJ3G>`?fp4P`q?FTi~5U8$9)< za@n>8ZA)2aCOEQ$?4KfP2FKB{y2wgFHt2BcP%HF8#?Fb;s12NKTBH|f>xxsTtsVZB z$hv6<`d|c2yA;n2*W;$+=fBQ`+$oJ3_Z^o5{?0d=MZ{HJH|9Cq_3y9Lj$5`}LF(SpK0;casc#P^z3TmU&=}2`WCN zWE}(5A$`RlVy4_tzFL)!B#oAJi+mDBElBrl)oeB*wq5UbNy}&@-8pnW!rI4bX1u@q zA#?B~6MgYf4lvp23jwbdY#Bg4)hjN9KBgJH8PJvla8QQJX|n@5KJr}=D*LbNlHtMl z3Ag9N8fX4pvmx$}86}t`q^+7e3J)$Qb)j0@&s_#{x^3L#VbC_oaZboVap!v3_A8R3 zJ02NxaEw75XUuE-ktq(WkA>V})SB$Se~)>w%IG4^xzyXtansX&MgA3ihiey7(yu;nM;hmIG}VJk2o;DXI7b;A!Dw#`F5qZt6x8wru{20QAw@6uGq z*%Ty?Y9y3xMhlIw_mQt|+G>!<={#y%;bi8xuX;$qK9NDh-}-o9I9{i?Kn-A>CopY% zi#`t#fSyCn2PGl(VFH`15X4D$S6Ayr8x{Z_0+xJ5VUiCRj$p%-{jv`z243XEtB1~e zmd#fXXsABl?eyj7al#aM!kwNZ%%Ue;38T81?hl(fvr_em0E{RLL~C@|(`<1sH3_r0 z4A4z}s)$fPAczt%YD;59$!-W@GP(1rK$m12yl2DGp>M(hY?K05FF&k!7jVD@*Cv@ZsF}SNaDbA3 z8I$2+*tDtru=fCMzpV?0Es9$64{!yC5V9A}0xGK5a8cz2d7l-Y|0rm5&Nb|78U<>< zV2wCLqik#LkERgnn=Gmw>LscA9`Uryl>pbOcx|`!f~X&lz<695Z_tlaT`^bT#;%~W zAKvUAO=Cuv&b>y>zor0en}FhUqqG5H8c;v`N~2_d%Cw~1L7)Ue#RnESMk@-`^EfnJ z6kQiZoF77Qhx}$WB0q@|Lh)=8rIb5T8Y|>&1rxv&w!?c?ElFPsM)hfg5OrPNx6M2) zEFC%DgaoZb4c_OSCR$GL_H}^E?Vg0Jg*_TXL>Z+z&)z-$Yr~5U6YwN&;E$!teJ`^3 zb|A_UNi4yhD8NX6`!NNrx#9<>xvGp_>{yQ zPQu_h{rG7$lREFpr@}y;l~Pw9g~BqLARNgVbwe7?e!NVmyY#2yIG6$q<8hdWuc~bW z*Alz74Ziw|&oM}ta&`()mq?(;-XQc|%wT#>y=p&A3E?gcPFtLD(H9sa;uGwsQL1fJ z^p$&LhOmU(0U$+Kbux68$5{=X;$M&A$QM|HU@T%M$T%FdM!Ud}5c;pBISUb6JXKNw zXhGp=U^0+c-1jXFXMAPUVL>tuCAl75kD!$Cil`OG&Tx88IwzW_jBpnKDk?N=40)=C z3rmN1PmRz8-r*;|CL+5yfT60-DYT7g5CXCS=^Ye+(O;K_M{X0D0bm~E2(Z_9rz&XJ zLu!}iw8>oOkmDtmHI5Ix7FgcaTv2n#^Sl>cJcRl^8c9It;T>>t>9PO<;8*3;;y_2~ zBm-;658Dd-F3{|S2zpy`X&A+ZTq7*;vq!ai)y!=m3P{0(1bf(%m9^x1E7< z_P?MutN>_$fUZ6CNg`~G@OmvV)7F%-NVosYr!Z5 z==3#`To@CZh<#zFs$myypt2nt!G8DI97sr7EK467tgCr`>6-_8H2BKr z=R-NZ(Nih7=C1xE1KuDP!>T%Z@p8?hcWw_mfXZvF?_B7hLVB=%B?TKBe91O$;`?xA ze`Dl+Ga48HA^0Pz0!SDRi=a#PbG`KG%1lMkdb8H8`n-8M;l*Xaex42C#m%jUbs`A($7)oiMmIi`)fVC)*|Hly(z@ZnUkI)Hv~}*; zWcy&ROgLSQmQ2ND1y3t#YbKOzQmbaQzZ%xnUr#)v0#gJQCP6v00A@o@{)|))m}6Y? z7gbqXjN^=|_71Mv3_zOT(ovKN{yzUR^6@KNbsN$nYiiyQfb^Mqvl>Kr{>6)84o#_Y z@eStyIl1t~rajP=|9*-5RxCW8IRiT(cajMeQvPB<<$ws z;Dm+c?h!6(dl&s(hLXuzA>c;;)T}Ys5er~%pyqFOXp-T6U{ZLdbopy{2M5N_fFhdZq}(B0zGr92Ue+2F$mRnF%5e`S{pcE zx=h&){Esd#<5;H3_gDDPfuO+s@+@JQa;_XmMYW1{A6cRT$bA9zY*V0Y+7HSIEkN1B z{_LH_jiB`=kn<*f*|l?-vIn62D*xTVWj2=JtA+LgI3M`z6`&k%o_1}S4Y|Xhi*Tdn z{xaowK>7bfK@s%uQ_$ JmKeML@n88 Date: Sat, 15 Aug 2020 14:42:21 +0300 Subject: [PATCH 0450/1862] BAEL-4516: First structure --- gradle-5/settings.gradle | 3 +- gradle-5/source-sets/build.gradle | 35 +++++++++++++++++++ .../com/baeldung/itest/SourceSetsItest.java | 19 ++++++++++ .../com/baeldung/main/SourceSetsMain.java | 9 +++++ .../com/baeldung/test/SourceSetsTest.java | 19 ++++++++++ 5 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 gradle-5/source-sets/build.gradle create mode 100644 gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java create mode 100644 gradle-5/source-sets/src/main/java/com/baeldung/main/SourceSetsMain.java create mode 100644 gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java diff --git a/gradle-5/settings.gradle b/gradle-5/settings.gradle index 1997e12ca5..5384d071e7 100644 --- a/gradle-5/settings.gradle +++ b/gradle-5/settings.gradle @@ -1,3 +1,4 @@ rootProject.name='gradle-5-articles' include 'java-exec' -include 'unused-dependencies' \ No newline at end of file +include 'unused-dependencies' +include 'source-sets' \ No newline at end of file diff --git a/gradle-5/source-sets/build.gradle b/gradle-5/source-sets/build.gradle new file mode 100644 index 0000000000..909b125aed --- /dev/null +++ b/gradle-5/source-sets/build.gradle @@ -0,0 +1,35 @@ + +apply plugin: "eclipse" + +description = "Source Sets example" + +task printConfigurations(){ + doLast{ + configurations.each { + println it.name + } + } +} + +sourceSets{ + itest { + java { + } + } +} + +dependencies { + implementation('org.apache.httpcomponents:httpclient:4.5.12') + testImplementation('junit:junit:4.12') + itestImplementation('com.google.guava:guava:29.0-jre') +} + +configurations { + itestImplementation.extendsFrom(testImplementation) +} + +eclipse { + classpath { + plusConfigurations+=[configurations.itestCompileClasspath] + } +} \ No newline at end of file diff --git a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java new file mode 100644 index 0000000000..7f5d0699a2 --- /dev/null +++ b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java @@ -0,0 +1,19 @@ +package com.baeldung.itest; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.util.List; + +import org.junit.Test; + +import com.google.common.collect.ImmutableList; + +public class SourceSetsItest { + + @Test + public void whenRunThenFail() { + List someStrings = ImmutableList.of("Baeldung", "is", "cool"); + assertThat(false, is(true)); + } +} diff --git a/gradle-5/source-sets/src/main/java/com/baeldung/main/SourceSetsMain.java b/gradle-5/source-sets/src/main/java/com/baeldung/main/SourceSetsMain.java new file mode 100644 index 0000000000..319894d336 --- /dev/null +++ b/gradle-5/source-sets/src/main/java/com/baeldung/main/SourceSetsMain.java @@ -0,0 +1,9 @@ +package com.baeldung.main; + +public class SourceSetsMain { + + public static void main(String[] args) { + System.out.println("Hell..oh...world!"); + } + +} diff --git a/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java b/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java new file mode 100644 index 0000000000..829b6ee36b --- /dev/null +++ b/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java @@ -0,0 +1,19 @@ +package com.baeldung.test; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.util.List; + +import org.junit.Test; + +import com.google.common.collect.ImmutableList; + +public class SourceSetsTest { + + @Test + public void whenRunThenSuccess() { + List someStrings = ImmutableList.of("Baeldung", "is", "cool"); + assertThat(true, is(true)); + } +} From e36678d920f1b4af224e19cdb598f7622bcce91e Mon Sep 17 00:00:00 2001 From: maryarm Date: Sat, 15 Aug 2020 14:20:40 +0200 Subject: [PATCH 0451/1862] BAEL-4107: Spring MVC Async vs Spring WebFlux --- spring-5-webflux/.gitignore | 3 +- .../spring/asyncvsflux/AsyncVsWebFluxApp.java | 11 ++++++ .../spring/asyncvsflux/WebFluxController.java | 17 ++++++++++ .../spring/asyncvsflux/WebFluxFilter.java | 20 +++++++++++ .../baeldung/asyncvsflux/AsyncController.java | 23 +++++++++++++ .../com/baeldung/asyncvsflux/AsyncFilter.java | 34 +++++++++++++++++++ .../asyncvsflux/AsyncVsWebFluxApp.java | 13 +++++++ 7 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/AsyncVsWebFluxApp.java create mode 100644 spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/WebFluxController.java create mode 100644 spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/WebFluxFilter.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncController.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncFilter.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncVsWebFluxApp.java diff --git a/spring-5-webflux/.gitignore b/spring-5-webflux/.gitignore index aa4871eeea..b2a03f1b15 100644 --- a/spring-5-webflux/.gitignore +++ b/spring-5-webflux/.gitignore @@ -1,2 +1,3 @@ # Files # -*.log \ No newline at end of file +*.log +*.ipr \ No newline at end of file diff --git a/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/AsyncVsWebFluxApp.java b/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/AsyncVsWebFluxApp.java new file mode 100644 index 0000000000..5ae6784536 --- /dev/null +++ b/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/AsyncVsWebFluxApp.java @@ -0,0 +1,11 @@ +package com.baeldung.spring.asyncvsflux; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class AsyncVsWebFluxApp { + public static void main(String[] args) { + SpringApplication.run(AsyncVsWebFluxApp.class, args); + } +} \ No newline at end of file diff --git a/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/WebFluxController.java b/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/WebFluxController.java new file mode 100644 index 0000000000..8ef1ef3e7e --- /dev/null +++ b/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/WebFluxController.java @@ -0,0 +1,17 @@ +package com.baeldung.spring.asyncvsflux; + +import java.time.Duration; +import org.springframework.http.server.reactive.ServerHttpRequest; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +@RestController +public class WebFluxController { + + @GetMapping("/flux_result") + public Mono getResult(ServerHttpRequest request) { + return Mono.defer(() -> Mono.just("Result is ready!")) + .delaySubscription(Duration.ofMillis(500)); + } +} diff --git a/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/WebFluxFilter.java b/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/WebFluxFilter.java new file mode 100644 index 0000000000..3a78047ab8 --- /dev/null +++ b/spring-5-webflux/src/main/java/com/baeldung/spring/asyncvsflux/WebFluxFilter.java @@ -0,0 +1,20 @@ +package com.baeldung.spring.asyncvsflux; + +import java.time.Duration; +import org.springframework.stereotype.Component; +import org.springframework.web.server.ServerWebExchange; +import org.springframework.web.server.WebFilterChain; +import reactor.core.publisher.Mono; + +@Component +public class WebFluxFilter implements org.springframework.web.server.WebFilter { + + @Override + public Mono filter(ServerWebExchange serverWebExchange, WebFilterChain webFilterChain) { + return Mono + .delay(Duration.ofMillis(200)) + .then( + webFilterChain.filter(serverWebExchange) + ); + } +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncController.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncController.java new file mode 100644 index 0000000000..ece06f3fc5 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncController.java @@ -0,0 +1,23 @@ +package com.baeldung.asyncvsflux; + +import java.util.concurrent.CompletableFuture; +import javax.servlet.http.HttpServletRequest; +import org.springframework.scheduling.annotation.Async; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class AsyncController { + + @GetMapping("/async_result") + @Async + public CompletableFuture getResultAsyc(HttpServletRequest request) { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return CompletableFuture.completedFuture("Result is ready!"); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncFilter.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncFilter.java new file mode 100644 index 0000000000..5a8ac4d9df --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncFilter.java @@ -0,0 +1,34 @@ +package com.baeldung.asyncvsflux; + +import java.io.IOException; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import org.springframework.stereotype.Component; + +@Component +public class AsyncFilter implements Filter { + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + + } + + @Override + public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + e.printStackTrace(); + } + filterChain.doFilter(servletRequest, servletResponse); + } + + @Override + public void destroy() { + + } +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncVsWebFluxApp.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncVsWebFluxApp.java new file mode 100644 index 0000000000..3905199468 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/asyncvsflux/AsyncVsWebFluxApp.java @@ -0,0 +1,13 @@ +package com.baeldung.asyncvsflux; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableAsync; + +@SpringBootApplication +@EnableAsync +public class AsyncVsWebFluxApp { + public static void main(String[] args) { + SpringApplication.run(AsyncVsWebFluxApp.class, args); + } +} \ No newline at end of file From 9a102f03aff1c782a9fafe8660092dc35db6996e Mon Sep 17 00:00:00 2001 From: Cristian Rosu Date: Sat, 15 Aug 2020 16:48:24 +0300 Subject: [PATCH 0452/1862] BAEL-4394: Line at a given number tests --- .../linenumber/LineAtGivenNumberTest.java | 88 +++++++++++++++++++ .../src/test/resources/linesInput.txt | 5 ++ 2 files changed, 93 insertions(+) create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberTest.java create mode 100644 core-java-modules/core-java-io-3/src/test/resources/linesInput.txt diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberTest.java new file mode 100644 index 0000000000..b73320c8d9 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberTest.java @@ -0,0 +1,88 @@ +package com.baeldung.linenumber; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; +import java.util.Scanner; +import java.util.stream.Stream; + +import static org.junit.Assert.assertEquals; + +public class LineAtGivenNumberTest { + + private static final String FILE_PATH = "src/test/resources/linesInput.txt"; + + @Test + public void givenFile_whenUsingBufferedReader_thenExtractedLineIsCorrect() throws IOException { + try (BufferedReader br = Files.newBufferedReader(Paths.get(FILE_PATH))) { + for (int i = 0; i < 3; i++) { + br.readLine(); + } + + String extractedLine = br.readLine(); + String expectedLine = "Line 4"; + assertEquals(expectedLine, extractedLine); + } + } + + @Test + public void givenFile_whenUsingScanner_thenExtractedLineIsCorrect() throws IOException { + try (Scanner scanner = new Scanner(new File(FILE_PATH))) { + for (int i = 0; i < 3; i++) { + scanner.nextLine(); + } + + String extractedLine = scanner.nextLine(); + String expectedLine = "Line 4"; + assertEquals(expectedLine, extractedLine); + } + } + + @Test + public void givenSmallFile_whenUsingFilesAPI_thenExtractedLineIsCorrect() throws IOException { + String extractedLine = Files.readAllLines(Paths.get(FILE_PATH)).get(4); + String expectedLine = "Line 5"; + + assertEquals(expectedLine, extractedLine); + } + + @Test + public void givenLargeFile_whenUsingFilesAPI_thenExtractedLineIsCorrect() throws IOException { + try (Stream lines = Files.lines(Paths.get(FILE_PATH))) { + String extractedLine = lines.skip(4).findFirst().get(); + String expectedLine = "Line 5"; + + assertEquals(expectedLine, extractedLine); + } + } + + @Test + public void givenFile_whenUsingFIleUtils_thenExtractedLineIsCorrect() throws IOException { + ClassLoader classLoader = getClass().getClassLoader(); + File file = new File(classLoader.getResource("linesInput.txt").getFile()); + + List lines = FileUtils.readLines(file, "UTF-8"); + + String extractedLine = lines.get(0); + String expectedLine = "Line 1"; + assertEquals(expectedLine, extractedLine); + } + + @Test + public void givenFile_whenUsingIOUtils_thenExtractedLineIsCorrect() throws IOException { + String fileContent = IOUtils.toString(new FileInputStream(FILE_PATH), StandardCharsets.UTF_8); + + String extractedLine = fileContent.split(System.lineSeparator())[0]; + String expectedLine = "Line 1"; + assertEquals(expectedLine, extractedLine); + } +} diff --git a/core-java-modules/core-java-io-3/src/test/resources/linesInput.txt b/core-java-modules/core-java-io-3/src/test/resources/linesInput.txt new file mode 100644 index 0000000000..572d5d9483 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/resources/linesInput.txt @@ -0,0 +1,5 @@ +Line 1 +Line 2 +Line 3 +Line 4 +Line 5 From 223944628593984ee2c663e9dfb317de09b45ec8 Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Sat, 15 Aug 2020 15:01:37 +0100 Subject: [PATCH 0453/1862] BAEL-4321 use properties module and delete ReadMe --- spring-boot-modules/spring-boot-data-2/README.md | 9 --------- .../pom.xml | 6 +++--- .../com/baeldung/boot/properties}/DemoApplication.java | 0 .../boot/properties}/config/TshirtSizeConfig.java | 0 .../properties}/controller/TshirtSizeController.java | 0 .../boot/properties}/service/SizeConverterImpl.java | 0 .../boot/properties}/service/SizeConverterService.java | 0 .../src/main/resources/application.yml | 0 .../properties}/controller/TshirtSizeControllerTest.java | 0 9 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-data-2/README.md rename spring-boot-modules/{spring-boot-data-2 => spring-boot-properties-3}/pom.xml (90%) rename spring-boot-modules/{spring-boot-data-2/src/main/java/com/baeldung/boot/data => spring-boot-properties-3/src/main/java/com/baeldung/boot/properties}/DemoApplication.java (100%) rename spring-boot-modules/{spring-boot-data-2/src/main/java/com/baeldung/boot/data => spring-boot-properties-3/src/main/java/com/baeldung/boot/properties}/config/TshirtSizeConfig.java (100%) rename spring-boot-modules/{spring-boot-data-2/src/main/java/com/baeldung/boot/data => spring-boot-properties-3/src/main/java/com/baeldung/boot/properties}/controller/TshirtSizeController.java (100%) rename spring-boot-modules/{spring-boot-data-2/src/main/java/com/baeldung/boot/data => spring-boot-properties-3/src/main/java/com/baeldung/boot/properties}/service/SizeConverterImpl.java (100%) rename spring-boot-modules/{spring-boot-data-2/src/main/java/com/baeldung/boot/data => spring-boot-properties-3/src/main/java/com/baeldung/boot/properties}/service/SizeConverterService.java (100%) rename spring-boot-modules/{spring-boot-data-2 => spring-boot-properties-3}/src/main/resources/application.yml (100%) rename spring-boot-modules/{spring-boot-data-2/src/test/java/com/baeldung/boot/data => spring-boot-properties-3/src/test/java/com/baeldung/boot/properties}/controller/TshirtSizeControllerTest.java (100%) diff --git a/spring-boot-modules/spring-boot-data-2/README.md b/spring-boot-modules/spring-boot-data-2/README.md deleted file mode 100644 index 9dba74a7e5..0000000000 --- a/spring-boot-modules/spring-boot-data-2/README.md +++ /dev/null @@ -1,9 +0,0 @@ -This is a demo application for using YAML configuration for defining values in a POJO class. - -The application has an endpoint to provide T-shirt size conversion for label and countrycode. - -If you run this service locally you can call this endpoint on: - -`localhost:8080/convertSize?label=M&countryCode=fr` - -It should return the size as int. \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-data-2/pom.xml b/spring-boot-modules/spring-boot-properties-3/pom.xml similarity index 90% rename from spring-boot-modules/spring-boot-data-2/pom.xml rename to spring-boot-modules/spring-boot-properties-3/pom.xml index 0baaf292e8..1e3d627b19 100644 --- a/spring-boot-modules/spring-boot-data-2/pom.xml +++ b/spring-boot-modules/spring-boot-properties-3/pom.xml @@ -9,10 +9,10 @@ ../ - spring-boot-data-2 + spring-boot-properties-3 0.0.1-SNAPSHOT - spring-boot-data-2 - Spring Boot Data Module + spring-boot-properties-3 + Spring Boot Properties Module 1.8 diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/DemoApplication.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/DemoApplication.java rename to spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/config/TshirtSizeConfig.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/config/TshirtSizeConfig.java rename to spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/controller/TshirtSizeController.java rename to spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterImpl.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterImpl.java rename to spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterService.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/java/com/baeldung/boot/data/service/SizeConverterService.java rename to spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java diff --git a/spring-boot-modules/spring-boot-data-2/src/main/resources/application.yml b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/main/resources/application.yml rename to spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml diff --git a/spring-boot-modules/spring-boot-data-2/src/test/java/com/baeldung/boot/data/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java similarity index 100% rename from spring-boot-modules/spring-boot-data-2/src/test/java/com/baeldung/boot/data/controller/TshirtSizeControllerTest.java rename to spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java From 3c44e7af209b2f93838d2503f673ff6d4330c5e7 Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Sat, 15 Aug 2020 15:04:10 +0100 Subject: [PATCH 0454/1862] BAEL-4321 fix indentation --- .../boot/properties/controller/TshirtSizeController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java index 6446a17317..82263eaeed 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java @@ -14,8 +14,7 @@ public class TshirtSizeController { } @RequestMapping(value ="convertSize", method = RequestMethod.GET) - public int convertSize(@RequestParam(value = "label") final String label, - @RequestParam(value = "countryCode", required = false) final String countryCode) { + public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { return service.convertSize(label, countryCode); } From e399a6a8bc9c79d96a27a62eb960e7e6c209620e Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Sat, 15 Aug 2020 15:34:56 +0100 Subject: [PATCH 0455/1862] BAEL-4321 fix package name in imports and convert tabs to spaces --- .../baeldung/boot/properties/DemoApplication.java | 8 ++++---- .../boot/properties/config/TshirtSizeConfig.java | 2 +- .../controller/TshirtSizeController.java | 2 +- .../boot/properties/service/SizeConverterImpl.java | 2 +- .../properties/service/SizeConverterService.java | 2 +- .../src/main/resources/application.yml | 14 +++++++------- .../controller/TshirtSizeControllerTest.java | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java index 125cba6283..634cb211b2 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.boot.data; +package com.baeldung.boot.properties; import com.baeldung.boot.data.config.TshirtSizeConfig; import org.springframework.boot.SpringApplication; @@ -9,8 +9,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties @EnableConfigurationProperties(TshirtSizeConfig.class) public class DemoApplication { - public static void main(String[] args) { - SpringApplication.run(DemoApplication.class, args); - } + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } } diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java index 000f5b6826..690763ab7b 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.boot.data.config; +package com.baeldung.boot.properties.config; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java index 82263eaeed..2f5c523c2e 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java @@ -1,4 +1,4 @@ -package com.baeldung.boot.data.controller; +package com.baeldung.boot.properties.controller; import org.springframework.web.bind.annotation.*; import com.baeldung.boot.data.service.SizeConverterService; diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java index ccb5a06da4..8554783493 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java @@ -1,4 +1,4 @@ -package com.baeldung.boot.data.service; +package com.baeldung.boot.properties.service; import org.springframework.stereotype.Service; import com.baeldung.boot.data.config.TshirtSizeConfig; diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java index 91cf2bf0b4..412199b176 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java @@ -1,4 +1,4 @@ -package com.baeldung.boot.data.service; +package com.baeldung.boot.properties.service; public interface SizeConverterService { diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml index edd200389e..8779cb6b0c 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml +++ b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml @@ -1,10 +1,10 @@ -t-shirt-size: - simple-mapping: - XS: 6 - S: 8 - M: 10 - L: 12 - XL: 14 + t-shirt-size: + simple-mapping: + XS: 6 + S: 8 + M: 10 + L: 12 + XL: 14 complex-mapping: diff --git a/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java index 1d60eb41c0..96584d6077 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java +++ b/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java @@ -1,4 +1,4 @@ -package com.baeldung.boot.data.controller; +package com.baeldung.boot.properties.controller; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; From 130133d73bf1a2ba4ca4c25394bb92755602240d Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Sat, 15 Aug 2020 15:39:01 +0100 Subject: [PATCH 0456/1862] BAEL-4321 fix leftover data package names --- .../main/java/com/baeldung/boot/properties/DemoApplication.java | 2 +- .../boot/properties/controller/TshirtSizeController.java | 2 +- .../com/baeldung/boot/properties/service/SizeConverterImpl.java | 2 +- .../boot/properties/controller/TshirtSizeControllerTest.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java index 634cb211b2..cf2fb7f981 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java @@ -1,6 +1,6 @@ package com.baeldung.boot.properties; -import com.baeldung.boot.data.config.TshirtSizeConfig; +import com.baeldung.boot.properties.config.TshirtSizeConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java index 2f5c523c2e..6b713c5be8 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java @@ -1,7 +1,7 @@ package com.baeldung.boot.properties.controller; import org.springframework.web.bind.annotation.*; -import com.baeldung.boot.data.service.SizeConverterService; +import com.baeldung.boot.properties.service.SizeConverterService; @RestController @RequestMapping(value = "/") diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java index 8554783493..34f7fe2ded 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java @@ -1,7 +1,7 @@ package com.baeldung.boot.properties.service; import org.springframework.stereotype.Service; -import com.baeldung.boot.data.config.TshirtSizeConfig; +import com.baeldung.boot.properties.config.TshirtSizeConfig; @Service diff --git a/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java index 96584d6077..0b70ed8622 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java +++ b/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import com.baeldung.boot.data.service.SizeConverterService; +import com.baeldung.boot.properties.service.SizeConverterService; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; From ab056706ac911db736de01b41aa257d2220f6881 Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 15 Aug 2020 20:02:21 +0200 Subject: [PATCH 0457/1862] Java-70 Remove unnecessary files from spring-jpa-2 + include in main persistence pom file --- persistence-modules/pom.xml | 1 + persistence-modules/spring-jpa-2/README.md | 18 +--- persistence-modules/spring-jpa-2/pom.xml | 94 +------------------ .../baeldung/config/PersistenceJPAConfig.java | 85 ----------------- .../config/PersistenceJPAConfigXml.java | 17 ---- .../com/baeldung/config/SpringWebConfig.java | 24 ----- .../com/baeldung/config/StudentJpaConfig.java | 67 ------------- .../com/baeldung/config/WebInitializer.java | 20 ---- .../src/main/resources/context.xml | 1 - .../src/main/resources/logback.xml | 19 ---- .../main/resources/persistence-h2.properties | 10 -- .../resources/persistence-student.properties | 11 --- .../src/main/resources/persistence.xml | 42 --------- .../src/main/resources/server.xml | 6 -- .../src/main/resources/sqlfiles.properties | 1 - .../src/test/java/META-INF/persistence.xml | 20 ---- .../java/com/baeldung/SpringContextTest.java | 21 ----- .../resources/persistence-student.properties | 9 -- persistence-modules/spring-jpa/README.md | 5 +- 19 files changed, 6 insertions(+), 465 deletions(-) delete mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfig.java delete mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java delete mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/SpringWebConfig.java delete mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/StudentJpaConfig.java delete mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/WebInitializer.java delete mode 100644 persistence-modules/spring-jpa-2/src/main/resources/context.xml delete mode 100644 persistence-modules/spring-jpa-2/src/main/resources/logback.xml delete mode 100644 persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties delete mode 100644 persistence-modules/spring-jpa-2/src/main/resources/persistence-student.properties delete mode 100644 persistence-modules/spring-jpa-2/src/main/resources/persistence.xml delete mode 100644 persistence-modules/spring-jpa-2/src/main/resources/server.xml delete mode 100644 persistence-modules/spring-jpa-2/src/main/resources/sqlfiles.properties delete mode 100644 persistence-modules/spring-jpa-2/src/test/java/META-INF/persistence.xml delete mode 100644 persistence-modules/spring-jpa-2/src/test/java/com/baeldung/SpringContextTest.java delete mode 100644 persistence-modules/spring-jpa-2/src/test/resources/persistence-student.properties diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 78f1afd39a..6186900a6e 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -78,6 +78,7 @@ spring-hibernate-5 spring-hibernate4 spring-jpa + spring-jpa-2 spring-persistence-simple spring-persistence-simple-2 diff --git a/persistence-modules/spring-jpa-2/README.md b/persistence-modules/spring-jpa-2/README.md index 71b368b44a..b1786f49bd 100644 --- a/persistence-modules/spring-jpa-2/README.md +++ b/persistence-modules/spring-jpa-2/README.md @@ -1,19 +1,5 @@ -========= - -## Spring JPA Example Project - +## Spring JPA (2) ### Relevant Articles: - [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many) -- More articles: [[<-- prev]](/spring-jpa) - - -### Eclipse Config -After importing the project into Eclipse, you may see the following error: -"No persistence xml file found in project" - -This can be ignored: -- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" -Or: -- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator - +- More articles: [[<-- prev]](/spring-jpa) \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/pom.xml b/persistence-modules/spring-jpa-2/pom.xml index 410ed592b0..08a1f0c6a3 100644 --- a/persistence-modules/spring-jpa-2/pom.xml +++ b/persistence-modules/spring-jpa-2/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-jpa + spring-jpa-2 0.1-SNAPSHOT - spring-jpa + spring-jpa-2 war @@ -31,94 +31,20 @@ spring-context ${org.springframework.version}
    - - org.springframework - spring-webmvc - ${org.springframework.version} - - org.hibernate hibernate-entitymanager ${hibernate.version} - - xml-apis - xml-apis - ${xml-apis.version} - - - org.javassist - javassist - ${javassist.version} - - - mysql - mysql-connector-java - ${mysql-connector-java.version} - runtime - - - org.springframework.data - spring-data-jpa - ${spring-data-jpa.version} - com.h2database h2 ${h2.version} - - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - - javax.el - javax.el-api - ${javax.el-api.version} - - - - - javax.servlet - jstl - ${jstl.version} - - - javax.servlet - servlet-api - provided - ${javax.servlet.servlet-api.version} - - - - - - com.google.guava - guava - ${guava.version} - - - org.assertj - assertj-core - ${assertj.version} - - - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - test - - org.springframework spring-test @@ -131,22 +57,6 @@ 5.1.5.RELEASE - 3.21.0-GA - - 6.0.6 - 2.1.5.RELEASE - - - 2.5 - - - 6.0.15.Final - 1.4.01 - 2.2.5 - - - 21.0 - 3.8.0 \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfig.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfig.java deleted file mode 100644 index c489321122..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfig.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baeldung.config; - -import com.google.common.base.Preconditions; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import java.util.Properties; - -@Configuration -@EnableTransactionManagement -@PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "com.baeldung.persistence" }) -@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao") -public class PersistenceJPAConfig { - - @Autowired - private Environment env; - - public PersistenceJPAConfig() { - super(); - } - - // beans - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); - - final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - em.setJpaVendorAdapter(vendorAdapter); - em.setJpaProperties(additionalProperties()); - - return em; - } - - @Bean - public DataSource dataSource() { - final DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Bean - public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(emf); - return transactionManager; - } - - @Bean - public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { - return new PersistenceExceptionTranslationPostProcessor(); - } - - final Properties additionalProperties() { - final Properties hibernateProperties = new Properties(); - hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); - hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", "false"); - - - return hibernateProperties; - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java deleted file mode 100644 index 95224a4662..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/PersistenceJPAConfigXml.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.config; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.ImportResource; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -// @Configuration -@EnableTransactionManagement -@ComponentScan({ "com.baeldung.persistence" }) -@ImportResource({ "classpath:jpaConfig.xml" }) -public class PersistenceJPAConfigXml { - - public PersistenceJPAConfigXml() { - super(); - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/SpringWebConfig.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/SpringWebConfig.java deleted file mode 100644 index 475970d1f0..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/SpringWebConfig.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; -import org.springframework.web.servlet.view.InternalResourceViewResolver; -import org.springframework.web.servlet.view.JstlView; - -@EnableWebMvc -@Configuration -@ComponentScan({ "com.baeldung.web" }) -public class SpringWebConfig extends WebMvcConfigurerAdapter { - - @Bean - public InternalResourceViewResolver viewResolver() { - InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); - viewResolver.setViewClass(JstlView.class); - viewResolver.setPrefix("/WEB-INF/views/jsp/"); - viewResolver.setSuffix(".jsp"); - return viewResolver; - } -} diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/StudentJpaConfig.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/StudentJpaConfig.java deleted file mode 100644 index 54ced72dd1..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/StudentJpaConfig.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.baeldung.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import java.util.Properties; - -@Configuration -@EnableJpaRepositories(basePackages = "com.baeldung.inmemory.persistence.dao") -@PropertySource("persistence-student.properties") -@EnableTransactionManagement -public class StudentJpaConfig { - - @Autowired - private Environment env; - - @Bean - public DataSource dataSource() { - final DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); - dataSource.setUrl(env.getProperty("jdbc.url")); - dataSource.setUsername(env.getProperty("jdbc.user")); - dataSource.setPassword(env.getProperty("jdbc.pass")); - - return dataSource; - } - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "com.baeldung.inmemory.persistence.model" }); - em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); - em.setJpaProperties(additionalProperties()); - return em; - } - - @Bean - JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { - JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(entityManagerFactory); - return transactionManager; - } - - final Properties additionalProperties() { - final Properties hibernateProperties = new Properties(); - - hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); - hibernateProperties.setProperty("hibernate.show_sql", env.getProperty("hibernate.show_sql")); - hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache")); - hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache")); - - return hibernateProperties; - } -} diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/WebInitializer.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/WebInitializer.java deleted file mode 100644 index be81cca76b..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/config/WebInitializer.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.config; - -import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; - -public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { - @Override - protected Class[] getRootConfigClasses() { - return new Class[] { PersistenceJPAConfig.class }; - } - - @Override - protected Class[] getServletConfigClasses() { - return new Class[] { SpringWebConfig.class }; - } - - @Override - protected String[] getServletMappings() { - return new String[] { "/" }; - } -} diff --git a/persistence-modules/spring-jpa-2/src/main/resources/context.xml b/persistence-modules/spring-jpa-2/src/main/resources/context.xml deleted file mode 100644 index a64dfe9a61..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/resources/context.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/logback.xml b/persistence-modules/spring-jpa-2/src/main/resources/logback.xml deleted file mode 100644 index ec0dc2469a..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/resources/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - web - %date [%thread] %-5level %logger{36} - %message%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties b/persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties deleted file mode 100644 index a3060cc796..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties +++ /dev/null @@ -1,10 +0,0 @@ -# jdbc.X -jdbc.driverClassName=org.h2.Driver -jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 -jdbc.user=sa -jdbc.pass= - -# hibernate.X -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.show_sql=true -hibernate.hbm2ddl.auto=create-drop \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/persistence-student.properties b/persistence-modules/spring-jpa-2/src/main/resources/persistence-student.properties deleted file mode 100644 index d4c82420de..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/resources/persistence-student.properties +++ /dev/null @@ -1,11 +0,0 @@ -jdbc.driverClassName=com.mysql.cj.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/myDb -jdbc.user=tutorialuser -jdbc.pass=tutorialpass - -hibernate.dialect=org.hibernate.dialect.MySQL5Dialect -hibernate.show_sql=true -hibernate.hbm2ddl.auto=create-drop - -hibernate.cache.use_second_level_cache=false -hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/persistence.xml b/persistence-modules/spring-jpa-2/src/main/resources/persistence.xml deleted file mode 100644 index 57687c306d..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/resources/persistence.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - ${hibernate.hbm2ddl.auto} - ${hibernate.dialect} - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/server.xml b/persistence-modules/spring-jpa-2/src/main/resources/server.xml deleted file mode 100644 index 5c61659018..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/resources/server.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/sqlfiles.properties b/persistence-modules/spring-jpa-2/src/main/resources/sqlfiles.properties deleted file mode 100644 index 0bea6adad1..0000000000 --- a/persistence-modules/spring-jpa-2/src/main/resources/sqlfiles.properties +++ /dev/null @@ -1 +0,0 @@ -spring.jpa.hibernate.ddl-auto=none \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/test/java/META-INF/persistence.xml b/persistence-modules/spring-jpa-2/src/test/java/META-INF/persistence.xml deleted file mode 100644 index 495f076fef..0000000000 --- a/persistence-modules/spring-jpa-2/src/test/java/META-INF/persistence.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - com.baeldung.persistence.model.Foo - com.baeldung.persistence.model.Bar - - - - - - - - - - - - - diff --git a/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/SpringContextTest.java deleted file mode 100644 index abc73e250d..0000000000 --- a/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/SpringContextTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung; - -import com.baeldung.config.PersistenceJPAConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class) -@WebAppConfiguration -@DirtiesContext -public class SpringContextTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-jpa-2/src/test/resources/persistence-student.properties b/persistence-modules/spring-jpa-2/src/test/resources/persistence-student.properties deleted file mode 100644 index 3b6b580630..0000000000 --- a/persistence-modules/spring-jpa-2/src/test/resources/persistence-student.properties +++ /dev/null @@ -1,9 +0,0 @@ -jdbc.driverClassName=org.h2.Driver -jdbc.url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1 - -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.show_sql=true -hibernate.hbm2ddl.auto=create - -hibernate.cache.use_second_level_cache=false -hibernate.cache.use_query_cache=false \ No newline at end of file diff --git a/persistence-modules/spring-jpa/README.md b/persistence-modules/spring-jpa/README.md index 3eb8ae8d55..d260913635 100644 --- a/persistence-modules/spring-jpa/README.md +++ b/persistence-modules/spring-jpa/README.md @@ -1,7 +1,4 @@ -========= - -## Spring JPA Example Project - +## Spring JPA (1) ### Relevant Articles: - [The DAO with JPA and Spring](https://www.baeldung.com/spring-dao-jpa) From 1d0488b5761a1591602a374c5594298f02429b17 Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 15 Aug 2020 20:25:37 +0200 Subject: [PATCH 0458/1862] Java-70 Rename modules in Spring Security modules --- spring-security-modules/pom.xml | 3 +- .../README.md | 0 .../pom.xml | 4 +- .../spring-security-sso-auth-server/pom.xml | 0 .../com/baeldung/config/AuthServerConfig.java | 0 .../AuthorizationServerApplication.java | 0 .../com/baeldung/config/SecurityConfig.java | 0 .../com/baeldung/config/UserController.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../java/com/baeldung/SpringContextTest.java | 0 .../baeldung/UserInfoEndpointLiveTest.java | 0 .../spring-security-sso-kerberos/.gitignore | 0 .../spring-security-sso-kerberos/README.md | 0 .../spring-security-sso-kerberos/pom.xml | 0 .../java/com/baeldung/intro/Application.java | 0 .../intro/config/WebSecurityConfig.java | 0 .../security/DummyUserDetailsService.java | 0 .../kerberos/client/KerberosClientApp.java | 0 .../java/kerberos/client/SampleClient.java | 0 .../kerberos/client/config/AppConfig.java | 0 .../client/config/KerberosConfig.java | 0 .../java/kerberos/kdc/KerberosMiniKdc.java | 0 .../kerberos/kdc/MiniKdcConfigBuilder.java | 0 .../kerberos/server/KerberizedServerApp.java | 0 .../kerberos/server/config/MvcConfig.java | 0 .../server/config/WebSecurityConfig.java | 0 .../server/controller/SampleController.java | 0 .../service/DummyUserDetailsService.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/minikdc-krb5.conf | 0 .../src/main/resources/minikdc.ldiff | 0 .../src/main/resources/templates/hello.html | 0 .../src/main/resources/templates/home.html | 0 .../src/main/resources/templates/login.html | 0 .../client/SampleClientManualTest.java | 0 .../spring-security-sso-ui-2/pom.xml | 0 .../com/baeldung/config/UiApplication.java | 0 .../com/baeldung/config/UiSecurityConfig.java | 0 .../java/com/baeldung/config/UiWebConfig.java | 0 .../src/main/resources/application.yml | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/templates/index.html | 0 .../main/resources/templates/securedPage.html | 0 .../java/com/baeldung/SpringContextTest.java | 0 .../spring-security-sso-ui/pom.xml | 0 .../com/baeldung/config/UiApplication.java | 0 .../com/baeldung/config/UiSecurityConfig.java | 0 .../java/com/baeldung/config/UiWebConfig.java | 0 .../src/main/resources/application.yml | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/templates/index.html | 0 .../main/resources/templates/securedPage.html | 0 .../java/com/baeldung/SpringContextTest.java | 0 .../spring-security-stormpath/README.md | 7 -- .../spring-security-stormpath/pom.xml | 68 ------------------- .../main/java/com/baeldung/Application.java | 25 ------- .../security/SecurityConfiguration.java | 24 ------- .../src/main/resources/application.properties | 6 -- .../src/main/resources/logback.xml | 13 ---- 60 files changed, 3 insertions(+), 147 deletions(-) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/README.md (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/pom.xml (92%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/pom.xml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthServerConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthorizationServerApplication.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/src/main/java/com/baeldung/config/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/src/main/java/com/baeldung/config/UserController.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-auth-server/src/test/java/com/baeldung/UserInfoEndpointLiveTest.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/.gitignore (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/README.md (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/pom.xml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/Application.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/config/WebSecurityConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/security/DummyUserDetailsService.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/resources/templates/hello.html (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/resources/templates/home.html (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/main/resources/templates/login.html (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/pom.xml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiApplication.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiSecurityConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiWebConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/src/main/resources/application.yml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/src/main/resources/templates/index.html (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui-2/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/pom.xml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/src/main/java/com/baeldung/config/UiApplication.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/src/main/java/com/baeldung/config/UiSecurityConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/src/main/java/com/baeldung/config/UiWebConfig.java (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/src/main/resources/application.yml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/src/main/resources/templates/index.html (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/src/main/resources/templates/securedPage.html (100%) rename spring-security-modules/{spring-security-sso => spring-security-oauth2-sso}/spring-security-sso-ui/src/test/java/com/baeldung/SpringContextTest.java (100%) delete mode 100644 spring-security-modules/spring-security-stormpath/README.md delete mode 100644 spring-security-modules/spring-security-stormpath/pom.xml delete mode 100644 spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/Application.java delete mode 100644 spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/security/SecurityConfiguration.java delete mode 100644 spring-security-modules/spring-security-stormpath/src/main/resources/application.properties delete mode 100644 spring-security-modules/spring-security-stormpath/src/main/resources/logback.xml diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index d7b5844e6f..f050b48ac5 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -35,8 +35,7 @@ spring-security-rest spring-security-rest-basic-auth spring-security-rest-custom - spring-security-sso - spring-security-stormpath + spring-security-oauth2-sso spring-security-thymeleaf spring-security-x509 spring-security-kotlin-dsl diff --git a/spring-security-modules/spring-security-sso/README.md b/spring-security-modules/spring-security-oauth2-sso/README.md similarity index 100% rename from spring-security-modules/spring-security-sso/README.md rename to spring-security-modules/spring-security-oauth2-sso/README.md diff --git a/spring-security-modules/spring-security-sso/pom.xml b/spring-security-modules/spring-security-oauth2-sso/pom.xml similarity index 92% rename from spring-security-modules/spring-security-sso/pom.xml rename to spring-security-modules/spring-security-oauth2-sso/pom.xml index 4e5bb49aa3..ed4b1d64ba 100644 --- a/spring-security-modules/spring-security-sso/pom.xml +++ b/spring-security-modules/spring-security-oauth2-sso/pom.xml @@ -3,9 +3,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.baeldung - spring-security-sso + spring-security-oauth2-sso 1.0.0-SNAPSHOT - spring-security-sso + spring-security-oauth2-sso pom diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthServerConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthServerConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthServerConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthServerConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthorizationServerApplication.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthorizationServerApplication.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthorizationServerApplication.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthorizationServerApplication.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/SecurityConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/SecurityConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/SecurityConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/UserController.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/UserController.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/UserController.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/UserController.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/resources/application.properties b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/resources/application.properties rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/resources/logback.xml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/UserInfoEndpointLiveTest.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/UserInfoEndpointLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/UserInfoEndpointLiveTest.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/UserInfoEndpointLiveTest.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/.gitignore b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/.gitignore similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/.gitignore rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/.gitignore diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/README.md b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/README.md similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/README.md rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/README.md diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/Application.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/Application.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/Application.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/Application.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/config/WebSecurityConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/config/WebSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/config/WebSecurityConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/config/WebSecurityConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/security/DummyUserDetailsService.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/security/DummyUserDetailsService.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/security/DummyUserDetailsService.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/com/baeldung/intro/security/DummyUserDetailsService.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/KerberosClientApp.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/SampleClient.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/AppConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/client/config/KerberosConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/KerberosMiniKdc.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/kdc/MiniKdcConfigBuilder.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/KerberizedServerApp.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/MvcConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/config/WebSecurityConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/controller/SampleController.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/java/kerberos/server/service/DummyUserDetailsService.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/application.properties b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/application.properties rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/minikdc-krb5.conf diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/minikdc.ldiff diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/hello.html b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/templates/hello.html similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/hello.html rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/templates/hello.html diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/home.html b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/templates/home.html similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/home.html rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/templates/home.html diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/login.html b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/templates/login.html similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/main/resources/templates/login.html diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/src/test/java/kerberos/client/SampleClientManualTest.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiApplication.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiApplication.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiApplication.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiApplication.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiSecurityConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiSecurityConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiSecurityConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiWebConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiWebConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiWebConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiWebConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/application.yml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/resources/application.yml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/application.yml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/resources/application.yml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/logback.xml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/index.html b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/resources/templates/index.html similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/resources/templates/index.html diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/main/resources/templates/securedPage.html diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiApplication.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiApplication.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiApplication.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiApplication.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiSecurityConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiSecurityConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiSecurityConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiWebConfig.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiWebConfig.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiWebConfig.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiWebConfig.java diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/application.yml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/resources/application.yml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/application.yml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/resources/application.yml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/logback.xml rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/index.html b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/resources/templates/index.html similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/resources/templates/index.html diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/securedPage.html b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/resources/templates/securedPage.html similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/resources/templates/securedPage.html rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/main/resources/templates/securedPage.html diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-stormpath/README.md b/spring-security-modules/spring-security-stormpath/README.md deleted file mode 100644 index 971d4cc858..0000000000 --- a/spring-security-modules/spring-security-stormpath/README.md +++ /dev/null @@ -1,7 +0,0 @@ -## Spring Security Stormpath - -This module contains articles about Spring Security with Stormpath - -### Relevant articles - -- [Spring Security with Stormpath](https://www.baeldung.com/spring-security-stormpath) diff --git a/spring-security-modules/spring-security-stormpath/pom.xml b/spring-security-modules/spring-security-stormpath/pom.xml deleted file mode 100644 index 81a7c40aef..0000000000 --- a/spring-security-modules/spring-security-stormpath/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - 4.0.0 - spring-security-stormpath - 1.0-SNAPSHOT - spring-security-stormpath - war - http://maven.apache.org - - - - abhinabkanrar@gmail.com - Abhinab Kanrar - https://github.com/AbhinabKanrar - abhinabkanrar - - - - - com.baeldung - parent-boot-1 - 0.0.1-SNAPSHOT - ../../parent-boot-1 - - - - - org.springframework.boot - spring-boot-starter-web - - - com.stormpath.spring - stormpath-default-spring-boot-starter - ${stormpath-spring.version} - - - - - spring-security-stormpath - - - src/main/resources - - - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - - - repackage - - - - - - - - - 1.5.4 - - - diff --git a/spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/Application.java b/spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/Application.java deleted file mode 100644 index 3d1409eaeb..0000000000 --- a/spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/Application.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - */ -package com.baeldung; - -import org.springframework.boot.CommandLineRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * @author abhinab - * - */ -@SpringBootApplication -public class Application implements CommandLineRunner { - - @Override - public void run(String... args) throws Exception { - } - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - -} diff --git a/spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/security/SecurityConfiguration.java b/spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/security/SecurityConfiguration.java deleted file mode 100644 index 5d75ecea8a..0000000000 --- a/spring-security-modules/spring-security-stormpath/src/main/java/com/baeldung/security/SecurityConfiguration.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * - */ -package com.baeldung.security; - -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - -import static com.stormpath.spring.config.StormpathWebSecurityConfigurer.stormpath; - -/** - * @author abhinab - * - */ -@Configuration -public class SecurityConfiguration extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.apply(stormpath()); - } - -} diff --git a/spring-security-modules/spring-security-stormpath/src/main/resources/application.properties b/spring-security-modules/spring-security-stormpath/src/main/resources/application.properties deleted file mode 100644 index 64a9ca456c..0000000000 --- a/spring-security-modules/spring-security-stormpath/src/main/resources/application.properties +++ /dev/null @@ -1,6 +0,0 @@ -security.basic.enabled = false - -stormpath.web.stormpathFilter.order = 0 - -stormpath.client.apiKey.id = 668HU0EOZQ7F4MT53ND2HSGBA -stormpath.client.apiKey.secret = RPTaYX07csTJR0AMKjM462KRdiP6q037kBWoDrBC3DI diff --git a/spring-security-modules/spring-security-stormpath/src/main/resources/logback.xml b/spring-security-modules/spring-security-stormpath/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/spring-security-modules/spring-security-stormpath/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file From 3e2ce28afbdeb558d8007a308ea3e6960430800c Mon Sep 17 00:00:00 2001 From: CHANDRAKANT Kumar Date: Sun, 16 Aug 2020 01:15:24 +0530 Subject: [PATCH 0459/1862] Incorporated the review comments on the pull request. --- spring-webflux-threads/.gitignore | 25 ------------ spring-webflux-threads/README.md | 2 +- .../com/baeldung/webflux/Application.java | 3 ++ .../java/com/baeldung/webflux/Controller.java | 40 +++++++++---------- 4 files changed, 24 insertions(+), 46 deletions(-) delete mode 100644 spring-webflux-threads/.gitignore diff --git a/spring-webflux-threads/.gitignore b/spring-webflux-threads/.gitignore deleted file mode 100644 index 82eca336e3..0000000000 --- a/spring-webflux-threads/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ \ No newline at end of file diff --git a/spring-webflux-threads/README.md b/spring-webflux-threads/README.md index 26013d73e1..279b831a6d 100644 --- a/spring-webflux-threads/README.md +++ b/spring-webflux-threads/README.md @@ -1,7 +1,7 @@ ## Spring WebFlux Concurrency This module contains articles about concurrency model in Spring WebFlux. -Please note that this assumes Mongo and Kafka to be running on the local machine on default configurations. + ### Relevant Articles: diff --git a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java index 1dfa00eae0..6cba90c0f4 100644 --- a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java +++ b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java @@ -3,6 +3,9 @@ package com.baeldung.webflux; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +/** +* Please note that this assumes Mongo and Kafka to be running on the local machine on default configurations. +*/ @SpringBootApplication public class Application { diff --git a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Controller.java b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Controller.java index ec6d7a596b..3c7e4e41ca 100644 --- a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Controller.java +++ b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Controller.java @@ -53,31 +53,31 @@ public class Controller { @GetMapping("/threads/webclient") public Flux getThreadsWebClient() { WebClient.create("http://localhost:8080/index") - .get() - .retrieve() - .bodyToMono(String.class) - .subscribeOn(scheduler) - .publishOn(scheduler) - .doOnNext(s -> logger.info("Response: {}", s)) - .subscribe(); + .get() + .retrieve() + .bodyToMono(String.class) + .subscribeOn(scheduler) + .publishOn(scheduler) + .doOnNext(s -> logger.info("Response: {}", s)) + .subscribe(); return Flux.fromIterable(getThreads()); } @GetMapping("/threads/rxjava") public Observable getIndexRxJava() { Observable.fromIterable(Arrays.asList("Hello", "World")) - .map(s -> s.toUpperCase()) - .observeOn(io.reactivex.schedulers.Schedulers.trampoline()) - .doOnNext(s -> logger.info("String: {}", s)) - .subscribe(); + .map(s -> s.toUpperCase()) + .observeOn(io.reactivex.schedulers.Schedulers.trampoline()) + .doOnNext(s -> logger.info("String: {}", s)) + .subscribe(); return Observable.fromIterable(getThreads()); } @GetMapping("/threads/mongodb") public Flux getIndexMongo() { personRepository.findAll() - .doOnNext(p -> logger.info("Person: {}", p)) - .subscribe(); + .doOnNext(p -> logger.info("Person: {}", p)) + .subscribe(); return Flux.fromIterable(getThreads()); } @@ -90,9 +90,9 @@ public class Controller { SenderOptions senderOptions = SenderOptions.create(producerProps); KafkaSender sender = KafkaSender.create(senderOptions); Flux> outboundFlux = Flux.range(1, 10) - .map(i -> SenderRecord.create(new ProducerRecord<>("reactive-test", i, "Message_" + i), i)); + .map(i -> SenderRecord.create(new ProducerRecord<>("reactive-test", i, "Message_" + i), i)); sender.send(outboundFlux) - .subscribe(); + .subscribe(); Map consumerProps = new HashMap<>(); consumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); @@ -108,7 +108,7 @@ public class Controller { inboundFlux.subscribe(r -> { logger.info("Received message: {}", r.value()); r.receiverOffset() - .acknowledge(); + .acknowledge(); }); return Flux.fromIterable(getThreads()); } @@ -120,9 +120,9 @@ public class Controller { private List getThreads() { return Thread.getAllStackTraces() - .keySet() - .stream() - .map(t -> String.format("%-20s \t %s \t %d \t %s\n", t.getName(), t.getState(), t.getPriority(), t.isDaemon() ? "Daemon" : "Normal")) - .collect(Collectors.toList()); + .keySet() + .stream() + .map(t -> String.format("%-20s \t %s \t %d \t %s\n", t.getName(), t.getState(), t.getPriority(), t.isDaemon() ? "Daemon" : "Normal")) + .collect(Collectors.toList()); } } From 1ba940679a4a324aa976d2070848f2e8ed8eaaf9 Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 15 Aug 2020 22:18:01 +0200 Subject: [PATCH 0460/1862] Java-1460 Reduce logging created by the maven-help plugin --- maven-modules/maven-profiles/pom.xml | 40 +++++++++++++++------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/maven-modules/maven-profiles/pom.xml b/maven-modules/maven-profiles/pom.xml index 4937bc7c5d..f3aeb9d549 100644 --- a/maven-modules/maven-profiles/pom.xml +++ b/maven-modules/maven-profiles/pom.xml @@ -66,27 +66,29 @@ + + show-active-profiles + + + + org.apache.maven.plugins + maven-help-plugin + ${help.plugin.version} + + + show-profiles + compile + + active-profiles + + + + + + + - - - - org.apache.maven.plugins - maven-help-plugin - ${help.plugin.version} - - - show-profiles - compile - - active-profiles - - - - - - - 3.2.0 From bb34174aeb777da69ef019aefeb9b102d374f35f Mon Sep 17 00:00:00 2001 From: Carlos Grappa Date: Sat, 15 Aug 2020 17:59:34 -0300 Subject: [PATCH 0461/1862] BAEL 2881 (#9639) * BAEL-4154 IOException Too many open files * Add comment to explain GC dependency * Add HPPC, remove Colt & Trove * Add inplace iterators for fastutil and extra maps for HPPC Co-authored-by: Carlos Grappa --- .../core-java-collections-maps-2/pom.xml | 14 +--- .../map/primitives/PrimitiveMaps.java | 81 +++++++++++++------ 2 files changed, 61 insertions(+), 34 deletions(-) diff --git a/core-java-modules/core-java-collections-maps-2/pom.xml b/core-java-modules/core-java-collections-maps-2/pom.xml index a64a11c6ea..7c4ab19945 100644 --- a/core-java-modules/core-java-collections-maps-2/pom.xml +++ b/core-java-modules/core-java-collections-maps-2/pom.xml @@ -21,20 +21,15 @@ ${eclipse-collections.version} - net.sf.trove4j - trove4j - ${trove4j.version} + com.carrotsearch + hppc + ${hppc.version} it.unimi.dsi fastutil ${fastutil.version} - - colt - colt - ${colt.version} - org.apache.commons commons-lang3 @@ -69,9 +64,8 @@ 4.1 1.7.0 8.2.0 - 3.0.2 + 0.7.2 8.1.0 - 1.2.0 3.11.1 diff --git a/core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/primitives/PrimitiveMaps.java b/core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/primitives/PrimitiveMaps.java index 30bec12ccc..e53290f93a 100644 --- a/core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/primitives/PrimitiveMaps.java +++ b/core-java-modules/core-java-collections-maps-2/src/main/java/com/baeldung/map/primitives/PrimitiveMaps.java @@ -1,29 +1,68 @@ package com.baeldung.map.primitives; -import cern.colt.map.AbstractIntDoubleMap; -import cern.colt.map.OpenIntDoubleHashMap; -import gnu.trove.map.TDoubleIntMap; -import gnu.trove.map.hash.TDoubleIntHashMap; +import com.carrotsearch.hppc.IntLongHashMap; +import com.carrotsearch.hppc.IntLongScatterMap; +import com.carrotsearch.hppc.IntObjectHashMap; +import com.carrotsearch.hppc.IntObjectMap; +import com.carrotsearch.hppc.IntObjectScatterMap; + import it.unimi.dsi.fastutil.ints.Int2BooleanMap; +import it.unimi.dsi.fastutil.ints.Int2BooleanMaps; import it.unimi.dsi.fastutil.ints.Int2BooleanOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2BooleanSortedMap; import it.unimi.dsi.fastutil.ints.Int2BooleanSortedMaps; +import it.unimi.dsi.fastutil.objects.ObjectIterator; + import org.eclipse.collections.api.map.primitive.ImmutableIntIntMap; import org.eclipse.collections.api.map.primitive.MutableIntIntMap; import org.eclipse.collections.api.map.primitive.MutableObjectDoubleMap; import org.eclipse.collections.impl.factory.primitive.IntIntMaps; import org.eclipse.collections.impl.factory.primitive.ObjectDoubleMaps; +import static java.lang.String.format; + +import java.math.BigDecimal; + public class PrimitiveMaps { public static void main(String[] args) { + hppcMap(); eclipseCollectionsMap(); - troveMap(); - coltMap(); fastutilMap(); } + private static void hppcMap() { + //Regular maps + IntLongHashMap intLongHashMap = new IntLongHashMap(); + intLongHashMap.put(25,1L); + intLongHashMap.put(150,Long.MAX_VALUE); + intLongHashMap.put(1,0L); + + intLongHashMap.get(150); + + IntObjectMap intObjectMap = new IntObjectHashMap(); + intObjectMap.put(1, BigDecimal.valueOf(1)); + intObjectMap.put(2, BigDecimal.valueOf(2500)); + + BigDecimal value = intObjectMap.get(2); + + //Scatter maps + IntLongScatterMap intLongScatterMap = new IntLongScatterMap(); + intLongScatterMap.put(1, 1L); + intLongScatterMap.put(2, -2L); + intLongScatterMap.put(1000,0L); + + intLongScatterMap.get(1000); + + IntObjectScatterMap intObjectScatterMap = new IntObjectScatterMap(); + intObjectScatterMap.put(1, BigDecimal.valueOf(1)); + intObjectScatterMap.put(2, BigDecimal.valueOf(2500)); + + value = intObjectScatterMap.get(2); + } + + private static void fastutilMap() { Int2BooleanMap int2BooleanMap = new Int2BooleanOpenHashMap(); int2BooleanMap.put(1, true); @@ -32,13 +71,19 @@ public class PrimitiveMaps { boolean value = int2BooleanMap.get(1); - Int2BooleanSortedMap int2BooleanSorted = Int2BooleanSortedMaps.EMPTY_MAP; - } + //Lambda style iteration + Int2BooleanMaps.fastForEach(int2BooleanMap, entry -> { + System.out.println(String.format("Key: %d, Value: %b",entry.getIntKey(),entry.getBooleanValue())); + }); + + //Iterator based loop + ObjectIterator iterator = Int2BooleanMaps.fastIterator(int2BooleanMap); + while(iterator.hasNext()) { + Int2BooleanMap.Entry entry = iterator.next(); + System.out.println(String.format("Key: %d, Value: %b",entry.getIntKey(),entry.getBooleanValue())); + + } - private static void coltMap() { - AbstractIntDoubleMap map = new OpenIntDoubleHashMap(); - map.put(1, 4.5); - double value = map.get(1); } private static void eclipseCollectionsMap() { @@ -53,17 +98,5 @@ public class PrimitiveMaps { dObject.addToValue("stability", 0.8); } - private static void troveMap() { - double[] doubles = new double[] {1.2, 4.5, 0.3}; - int[] ints = new int[] {1, 4, 0}; - TDoubleIntMap doubleIntMap = new TDoubleIntHashMap(doubles, ints); - - doubleIntMap.put(1.2, 22); - doubleIntMap.put(4.5, 16); - - doubleIntMap.adjustValue(1.2, 1); - doubleIntMap.adjustValue(4.5, 4); - doubleIntMap.adjustValue(0.3, 7); - } } From 44afb00d224caffb9259e1b714dde051a49ae06b Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Sun, 16 Aug 2020 08:46:46 +0530 Subject: [PATCH 0462/1862] Update README.md --- core-java-modules/core-java/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core-java-modules/core-java/README.md b/core-java-modules/core-java/README.md index 7781382ae5..b0e740e3b5 100644 --- a/core-java-modules/core-java/README.md +++ b/core-java-modules/core-java/README.md @@ -1,13 +1,13 @@ ## Core Java Cookbooks and Examples ### Relevant Articles: -[Getting Started with Java Properties](http://www.baeldung.com/java-properties) -[Java Money and the Currency API](http://www.baeldung.com/java-money-and-currency) -[Introduction to Java Serialization](http://www.baeldung.com/java-serialization) -[Guide to UUID in Java](http://www.baeldung.com/java-uuid) -[Compiling Java *.class Files with javac](http://www.baeldung.com/javac) -[Introduction to Javadoc](http://www.baeldung.com/javadoc) -[Guide to the Externalizable Interface in Java](http://www.baeldung.com/java-externalizable) -[What is the serialVersionUID?](http://www.baeldung.com/java-serial-version-uid) -[A Guide to the ResourceBundle](http://www.baeldung.com/java-resourcebundle) -[Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) +- [Getting Started with Java Properties](http://www.baeldung.com/java-properties) +- [Java Money and the Currency API](http://www.baeldung.com/java-money-and-currency) +- [Introduction to Java Serialization](http://www.baeldung.com/java-serialization) +- [Guide to UUID in Java](http://www.baeldung.com/java-uuid) +- [Compiling Java *.class Files with javac](http://www.baeldung.com/javac) +- [Introduction to Javadoc](http://www.baeldung.com/javadoc) +- [Guide to the Externalizable Interface in Java](http://www.baeldung.com/java-externalizable) +- [What is the serialVersionUID?](http://www.baeldung.com/java-serial-version-uid) +- [A Guide to the ResourceBundle](http://www.baeldung.com/java-resourcebundle) +- [Merging java.util.Properties Objects](https://www.baeldung.com/java-merging-properties) From 1e96de4b6417fb73b1413807bcb2a99584ab19cd Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sun, 16 Aug 2020 13:35:04 +0530 Subject: [PATCH 0463/1862] Update pom.xml Adding spring-data-cosmosdb module in the persistence module --- persistence-modules/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index f1154f203b..8544a5cef4 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -53,6 +53,7 @@ spring-boot-persistence-mongodb spring-data-cassandra spring-data-cassandra-reactive + spring-data-cosmosdb spring-data-couchbase-2 spring-data-dynamodb spring-data-eclipselink From 5eefa6b148b318378552ab24d4134cd97b84591c Mon Sep 17 00:00:00 2001 From: Ankur Gupta Date: Sun, 16 Aug 2020 13:36:23 +0530 Subject: [PATCH 0464/1862] Update pom.xml removing extra spaces --- persistence-modules/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 8544a5cef4..a9d3c89604 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -53,7 +53,7 @@ spring-boot-persistence-mongodb spring-data-cassandra spring-data-cassandra-reactive - spring-data-cosmosdb + spring-data-cosmosdb spring-data-couchbase-2 spring-data-dynamodb spring-data-eclipselink From ecaa8db1421fc0af794b983c309b35fe16adf6b4 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 16 Aug 2020 16:30:53 +0530 Subject: [PATCH 0465/1862] JAVA-68: Renamed spring-security-mvc-jsonview to spring-security-web-jsonview --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../src/main/java/com/baeldung/AppInitializer.java | 0 .../main/java/com/baeldung/controller/ItemsController.java | 0 .../src/main/java/com/baeldung/controller/View.java | 0 .../src/main/java/com/baeldung/model/Item.java | 0 .../src/main/java/com/baeldung/spring/AppConfig.java | 0 .../com/baeldung/spring/SecurityJsonViewControllerAdvice.java | 0 .../src/main/resources/logback.xml | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 .../security/SpringSecurityJsonViewIntegrationTest.java | 0 12 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/.gitignore (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/README.md (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/pom.xml (98%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/main/java/com/baeldung/AppInitializer.java (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/main/java/com/baeldung/controller/ItemsController.java (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/main/java/com/baeldung/controller/View.java (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/main/java/com/baeldung/model/Item.java (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/main/java/com/baeldung/spring/AppConfig.java (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc-jsonview => spring-security-web-jsonview}/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java (100%) diff --git a/spring-security-modules/spring-security-mvc-jsonview/.gitignore b/spring-security-modules/spring-security-web-jsonview/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/.gitignore rename to spring-security-modules/spring-security-web-jsonview/.gitignore diff --git a/spring-security-modules/spring-security-mvc-jsonview/README.md b/spring-security-modules/spring-security-web-jsonview/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/README.md rename to spring-security-modules/spring-security-web-jsonview/README.md diff --git a/spring-security-modules/spring-security-mvc-jsonview/pom.xml b/spring-security-modules/spring-security-web-jsonview/pom.xml similarity index 98% rename from spring-security-modules/spring-security-mvc-jsonview/pom.xml rename to spring-security-modules/spring-security-web-jsonview/pom.xml index f6ba997c62..0d1b0b09db 100644 --- a/spring-security-modules/spring-security-mvc-jsonview/pom.xml +++ b/spring-security-modules/spring-security-web-jsonview/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-mvc-jsonview + spring-security-web-jsonview 0.1-SNAPSHOT - spring-security-mvc-jsonview + spring-security-web-jsonview war diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java b/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/AppInitializer.java similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/AppInitializer.java rename to spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/AppInitializer.java diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java b/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/ItemsController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/ItemsController.java rename to spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/ItemsController.java diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java b/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/View.java similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/controller/View.java rename to spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/View.java diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java b/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/model/Item.java similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/model/Item.java rename to spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/model/Item.java diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java b/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/AppConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/AppConfig.java rename to spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/AppConfig.java diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java b/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java rename to spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-jsonview/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-jsonview/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java b/spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java rename to spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java From 3e193877e67b849c8c7c587e86e1916d925b1fb9 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 16 Aug 2020 16:31:42 +0530 Subject: [PATCH 0466/1862] JAVA-68: Renamed spring-security-mvc-login to spring-security-web-login --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../src/main/java/com/baeldung/AppInitializer.java | 0 .../com/baeldung/controller/SecuredResourceController.java | 0 .../java/com/baeldung/security/CustomAccessDeniedHandler.java | 0 .../baeldung/security/CustomAuthenticationFailureHandler.java | 0 .../com/baeldung/security/CustomLogoutSuccessHandler.java | 0 .../security/RefererAuthenticationSuccessHandler.java | 0 .../java/com/baeldung/security/config/SecSecurityConfig.java | 0 .../java/com/baeldung/spring/ChannelSecSecurityConfig.java | 0 .../src/main/java/com/baeldung/spring/MvcConfig.java | 0 .../java/com/baeldung/spring/RedirectionSecurityConfig.java | 0 .../src/main/resources/RedirectionWebSecurityConfig.xml | 0 .../src/main/resources/channelWebSecurityConfig.xml | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/main/webapp/WEB-INF/mvc-servlet.xml | 0 .../src/main/webapp/WEB-INF/view/accessDenied.jsp | 0 .../src/main/webapp/WEB-INF/view/admin/adminpage.jsp | 0 .../src/main/webapp/WEB-INF/view/anonymous.jsp | 0 .../src/main/webapp/WEB-INF/view/homepage.jsp | 0 .../src/main/webapp/WEB-INF/view/login.jsp | 0 .../src/main/webapp/WEB-INF/web-old.xml | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 .../test/java/com/baeldung/security/FormLoginUnitTest.java | 0 .../baeldung/security/RedirectionSecurityIntegrationTest.java | 0 .../src/test/resources/.gitignore | 0 28 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/.gitignore (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/README.md (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/pom.xml (98%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/AppInitializer.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/controller/SecuredResourceController.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/security/config/SecSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/spring/MvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/resources/RedirectionWebSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/resources/channelWebSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/webapp/WEB-INF/mvc-servlet.xml (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/webapp/WEB-INF/view/accessDenied.jsp (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/webapp/WEB-INF/view/admin/adminpage.jsp (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/webapp/WEB-INF/view/anonymous.jsp (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/webapp/WEB-INF/view/homepage.jsp (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/webapp/WEB-INF/view/login.jsp (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/main/webapp/WEB-INF/web-old.xml (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/test/java/com/baeldung/security/FormLoginUnitTest.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java (100%) rename spring-security-modules/{spring-security-mvc-login => spring-security-web-login}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/spring-security-mvc-login/.gitignore b/spring-security-modules/spring-security-web-login/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-login/.gitignore rename to spring-security-modules/spring-security-web-login/.gitignore diff --git a/spring-security-modules/spring-security-mvc-login/README.md b/spring-security-modules/spring-security-web-login/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-login/README.md rename to spring-security-modules/spring-security-web-login/README.md diff --git a/spring-security-modules/spring-security-mvc-login/pom.xml b/spring-security-modules/spring-security-web-login/pom.xml similarity index 98% rename from spring-security-modules/spring-security-mvc-login/pom.xml rename to spring-security-modules/spring-security-web-login/pom.xml index 4e0fe00176..2b64d157d3 100644 --- a/spring-security-modules/spring-security-mvc-login/pom.xml +++ b/spring-security-modules/spring-security-web-login/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-mvc-login + spring-security-web-login 0.1-SNAPSHOT - spring-security-mvc-login + spring-security-web-login war diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/AppInitializer.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/AppInitializer.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/AppInitializer.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/controller/SecuredResourceController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/controller/SecuredResourceController.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/controller/SecuredResourceController.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/CustomAccessDeniedHandler.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/CustomAuthenticationFailureHandler.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/CustomLogoutSuccessHandler.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/RefererAuthenticationSuccessHandler.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/config/SecSecurityConfig.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/config/SecSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/security/config/SecSecurityConfig.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/security/config/SecSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/spring/ChannelSecSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/spring/MvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java b/spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java rename to spring-security-modules/spring-security-web-login/src/main/java/com/baeldung/spring/RedirectionSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml b/spring-security-modules/spring-security-web-login/src/main/resources/RedirectionWebSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/resources/RedirectionWebSecurityConfig.xml rename to spring-security-modules/spring-security-web-login/src/main/resources/RedirectionWebSecurityConfig.xml diff --git a/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml b/spring-security-modules/spring-security-web-login/src/main/resources/channelWebSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml rename to spring-security-modules/spring-security-web-login/src/main/resources/channelWebSecurityConfig.xml diff --git a/spring-security-modules/spring-security-mvc-login/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-login/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-login/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-web-login/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-web-login/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/accessDenied.jsp b/spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/accessDenied.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/accessDenied.jsp rename to spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/accessDenied.jsp diff --git a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/admin/adminpage.jsp b/spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/admin/adminpage.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/admin/adminpage.jsp rename to spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/admin/adminpage.jsp diff --git a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/login.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/view/login.jsp rename to spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/view/login.jsp diff --git a/spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml b/spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/web-old.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/main/webapp/WEB-INF/web-old.xml rename to spring-security-modules/spring-security-web-login/src/main/webapp/WEB-INF/web-old.xml diff --git a/spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-login/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-login/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java b/spring-security-modules/spring-security-web-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java rename to spring-security-modules/spring-security-web-login/src/test/java/com/baeldung/security/FormLoginUnitTest.java diff --git a/spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java b/spring-security-modules/spring-security-web-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java rename to spring-security-modules/spring-security-web-login/src/test/java/com/baeldung/security/RedirectionSecurityIntegrationTest.java diff --git a/spring-security-modules/spring-security-mvc-login/src/test/resources/.gitignore b/spring-security-modules/spring-security-web-login/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-login/src/test/resources/.gitignore rename to spring-security-modules/spring-security-web-login/src/test/resources/.gitignore From f645cac5d6b05d52a8feb61b3a487abe689819fa Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 16 Aug 2020 16:32:25 +0530 Subject: [PATCH 0467/1862] JAVA-68: Renamed spring-security-mvc-persisted-remember-me to spring-security-web-persisted-remember-me --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../src/main/java/com/baeldung/controller/MyController.java | 0 .../security/MySimpleUrlAuthenticationSuccessHandler.java | 0 .../src/main/java/com/baeldung/security/SecurityRole.java | 0 .../baeldung/security/SecurityWebApplicationInitializer.java | 0 .../main/java/com/baeldung/service/MyUserDetailsService.java | 0 .../src/main/java/com/baeldung/spring/MvcConfig.java | 0 .../src/main/java/com/baeldung/spring/PersistenceConfig.java | 0 .../src/main/java/com/baeldung/spring/SecurityConfig.java | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/persisted_logins_create_table.sql | 0 .../src/main/resources/persistence-h2.properties | 0 .../src/main/resources/persistence-postgres.properties | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/main/webapp/WEB-INF/mvc-servlet.xml | 0 .../src/main/webapp/WEB-INF/view/anonymous.jsp | 0 .../src/main/webapp/WEB-INF/view/console.jsp | 0 .../src/main/webapp/WEB-INF/view/homepage.jsp | 0 .../src/main/webapp/WEB-INF/view/login.jsp | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 .../src/test/resources/.gitignore | 0 24 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/.gitignore (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/README.md (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/pom.xml (98%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/java/com/baeldung/controller/MyController.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/java/com/baeldung/security/SecurityRole.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/java/com/baeldung/service/MyUserDetailsService.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/java/com/baeldung/spring/MvcConfig.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/java/com/baeldung/spring/PersistenceConfig.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/java/com/baeldung/spring/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/resources/persisted_logins_create_table.sql (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/resources/persistence-h2.properties (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/resources/persistence-postgres.properties (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/webapp/WEB-INF/mvc-servlet.xml (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/webapp/WEB-INF/view/anonymous.jsp (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/webapp/WEB-INF/view/console.jsp (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/webapp/WEB-INF/view/homepage.jsp (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/webapp/WEB-INF/view/login.jsp (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/main/webapp/WEB-INF/web.xml (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-mvc-persisted-remember-me => spring-security-web-persisted-remember-me}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/.gitignore b/spring-security-modules/spring-security-web-persisted-remember-me/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/.gitignore rename to spring-security-modules/spring-security-web-persisted-remember-me/.gitignore diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/README.md b/spring-security-modules/spring-security-web-persisted-remember-me/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/README.md rename to spring-security-modules/spring-security-web-persisted-remember-me/README.md diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/pom.xml b/spring-security-modules/spring-security-web-persisted-remember-me/pom.xml similarity index 98% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/pom.xml rename to spring-security-modules/spring-security-web-persisted-remember-me/pom.xml index 9410793222..25c5ddd9d0 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/pom.xml +++ b/spring-security-modules/spring-security-web-persisted-remember-me/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-mvc-persisted-remember-me + spring-security-web-persisted-remember-me 0.1-SNAPSHOT - spring-security-mvc-persisted-remember-me + spring-security-web-persisted-remember-me war diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/controller/MyController.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/controller/MyController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/controller/MyController.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/controller/MyController.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityRole.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/security/SecurityRole.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityRole.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/security/SecurityRole.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/service/MyUserDetailsService.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/service/MyUserDetailsService.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/service/MyUserDetailsService.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/service/MyUserDetailsService.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/spring/MvcConfig.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/PersistenceConfig.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/spring/PersistenceConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/PersistenceConfig.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/spring/PersistenceConfig.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/SecurityConfig.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/spring/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/SecurityConfig.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/java/com/baeldung/spring/SecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persisted_logins_create_table.sql b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/persisted_logins_create_table.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persisted_logins_create_table.sql rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/persisted_logins_create_table.sql diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-h2.properties b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/persistence-h2.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-h2.properties rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/persistence-h2.properties diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-postgres.properties b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/persistence-postgres.properties similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/persistence-postgres.properties rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/persistence-postgres.properties diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/console.jsp b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/view/console.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/console.jsp rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/view/console.jsp diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/login.jsp b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/view/login.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/view/login.jsp rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/view/login.jsp diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-web-persisted-remember-me/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-persisted-remember-me/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-persisted-remember-me/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/resources/.gitignore b/spring-security-modules/spring-security-web-persisted-remember-me/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/resources/.gitignore rename to spring-security-modules/spring-security-web-persisted-remember-me/src/test/resources/.gitignore From d35dfb6ba9fa6b97a7440a2f2ec82aa77d2581ac Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 16 Aug 2020 16:32:56 +0530 Subject: [PATCH 0468/1862] JAVA-68: Renamed spring-security-mvc-socket to spring-security-web-sockets --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../java/com/baeldung/springsecuredsockets/Constants.java | 0 .../com/baeldung/springsecuredsockets/config/AppConfig.java | 0 .../baeldung/springsecuredsockets/config/DataStoreConfig.java | 0 .../baeldung/springsecuredsockets/config/SecurityConfig.java | 0 .../springsecuredsockets/config/SocketBrokerConfig.java | 0 .../springsecuredsockets/config/SocketSecurityConfig.java | 0 .../springsecuredsockets/config/WebAppInitializer.java | 0 .../springsecuredsockets/controllers/CsrfTokenController.java | 0 .../springsecuredsockets/controllers/SocketController.java | 0 .../java/com/baeldung/springsecuredsockets/domain/Role.java | 0 .../java/com/baeldung/springsecuredsockets/domain/User.java | 0 .../springsecuredsockets/repositories/UserRepository.java | 0 .../security/CustomAccessDeniedHandler.java | 0 .../security/CustomDaoAuthenticationProvider.java | 0 .../security/CustomLoginSuccessHandler.java | 0 .../security/CustomLogoutSuccessHandler.java | 0 .../security/CustomUserDetailsService.java | 0 .../security/SecurityWebApplicationInitializer.java | 0 .../springsecuredsockets/transfer/socket/Message.java | 0 .../springsecuredsockets/transfer/socket/OutputMessage.java | 0 .../springsecuredsockets/transfer/user/CustomUserDetails.java | 0 .../springsockets/config/WebSocketMessageBrokerConfig.java | 0 .../baeldung/springsockets/controllers/RestAPIController.java | 0 .../springsockets/controllers/WebSocketController.java | 0 .../main/java/com/baeldung/springsockets/models/Greeting.java | 0 .../main/java/com/baeldung/springsockets/models/Message.java | 0 .../src/main/resources/data.sql | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/schema.sql | 0 .../src/main/resources/static/rest.html | 0 .../src/main/resources/static/rest.js | 0 .../src/main/resources/static/ws.html | 0 .../src/main/resources/static/ws.js | 0 .../src/main/webapp/WEB-INF/jsp/denied.jsp | 0 .../src/main/webapp/WEB-INF/jsp/index.jsp | 0 .../src/main/webapp/WEB-INF/jsp/login.jsp | 0 .../src/main/webapp/WEB-INF/jsp/socket.jsp | 0 .../src/main/webapp/WEB-INF/jsp/success.jsp | 0 .../src/main/webapp/resources/scripts/app.js | 0 .../webapp/resources/scripts/controllers/indexController.js | 0 .../webapp/resources/scripts/controllers/socketController.js | 0 .../webapp/resources/scripts/controllers/successController.js | 0 .../src/main/webapp/resources/scripts/routes/router.js | 0 .../main/webapp/resources/scripts/services/SocketService.js | 0 .../src/main/webapp/resources/styles/app.css | 0 .../src/main/webapp/resources/styles/denied.css | 0 .../src/main/webapp/resources/styles/index.css | 0 .../src/main/webapp/resources/styles/login.css | 0 .../src/main/webapp/resources/styles/socket.css | 0 .../src/main/webapp/resources/styles/success.css | 0 .../main/webapp/resources/vendor/angular/angular-route.min.js | 0 .../webapp/resources/vendor/angular/angular-route.min.js.map | 0 .../src/main/webapp/resources/vendor/angular/angular.min.js | 0 .../main/webapp/resources/vendor/angular/angular.min.js.map | 0 .../src/main/webapp/resources/vendor/jquery/jquery.min.js | 0 .../src/main/webapp/resources/vendor/sockjs/sockjs.min.js | 0 .../src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map | 0 .../src/main/webapp/resources/vendor/stomp/stomp.min.js | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 62 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/.gitignore (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/README.md (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/pom.xml (98%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/Constants.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/domain/User.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsockets/models/Greeting.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/java/com/baeldung/springsockets/models/Message.java (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/resources/data.sql (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/resources/schema.sql (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/resources/static/rest.html (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/resources/static/rest.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/resources/static/ws.html (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/resources/static/ws.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/WEB-INF/jsp/denied.jsp (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/WEB-INF/jsp/index.jsp (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/WEB-INF/jsp/login.jsp (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/WEB-INF/jsp/socket.jsp (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/WEB-INF/jsp/success.jsp (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/scripts/app.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/scripts/controllers/indexController.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/scripts/controllers/socketController.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/scripts/controllers/successController.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/scripts/routes/router.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/scripts/services/SocketService.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/styles/app.css (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/styles/denied.css (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/styles/index.css (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/styles/login.css (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/styles/socket.css (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/styles/success.css (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/vendor/angular/angular-route.min.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/vendor/angular/angular-route.min.js.map (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/vendor/angular/angular.min.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/vendor/angular/angular.min.js.map (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/vendor/jquery/jquery.min.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/vendor/sockjs/sockjs.min.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/main/webapp/resources/vendor/stomp/stomp.min.js (100%) rename spring-security-modules/{spring-security-mvc-socket => spring-security-web-sockets}/src/test/java/com/baeldung/SpringContextTest.java (100%) diff --git a/spring-security-modules/spring-security-mvc-socket/.gitignore b/spring-security-modules/spring-security-web-sockets/.gitignore similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/.gitignore rename to spring-security-modules/spring-security-web-sockets/.gitignore diff --git a/spring-security-modules/spring-security-mvc-socket/README.md b/spring-security-modules/spring-security-web-sockets/README.md similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/README.md rename to spring-security-modules/spring-security-web-sockets/README.md diff --git a/spring-security-modules/spring-security-mvc-socket/pom.xml b/spring-security-modules/spring-security-web-sockets/pom.xml similarity index 98% rename from spring-security-modules/spring-security-mvc-socket/pom.xml rename to spring-security-modules/spring-security-web-sockets/pom.xml index 6515121f9f..3a3ec47af5 100644 --- a/spring-security-modules/spring-security-mvc-socket/pom.xml +++ b/spring-security-modules/spring-security-web-sockets/pom.xml @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 com.baeldung.springsecuredsockets - spring-security-mvc-socket + spring-security-web-sockets 1.0.0 - spring-security-mvc-socket + spring-security-web-sockets war diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/Constants.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/Constants.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/Constants.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/Constants.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/AppConfig.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/DataStoreConfig.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/SecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/SocketBrokerConfig.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/SocketSecurityConfig.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/config/WebAppInitializer.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/controllers/CsrfTokenController.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/controllers/SocketController.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/domain/Role.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/User.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/domain/User.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/domain/User.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/domain/User.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/repositories/UserRepository.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomAccessDeniedHandler.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomDaoAuthenticationProvider.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomLoginSuccessHandler.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomLogoutSuccessHandler.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/CustomUserDetailsService.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/security/SecurityWebApplicationInitializer.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/Message.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/transfer/socket/OutputMessage.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsecuredsockets/transfer/user/CustomUserDetails.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/config/WebSocketMessageBrokerConfig.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/controllers/RestAPIController.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/controllers/WebSocketController.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Greeting.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/models/Greeting.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Greeting.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/models/Greeting.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Message.java b/spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/models/Message.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/java/com/baeldung/springsockets/models/Message.java rename to spring-security-modules/spring-security-web-sockets/src/main/java/com/baeldung/springsockets/models/Message.java diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/resources/data.sql b/spring-security-modules/spring-security-web-sockets/src/main/resources/data.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/resources/data.sql rename to spring-security-modules/spring-security-web-sockets/src/main/resources/data.sql diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-sockets/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-sockets/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/resources/schema.sql b/spring-security-modules/spring-security-web-sockets/src/main/resources/schema.sql similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/resources/schema.sql rename to spring-security-modules/spring-security-web-sockets/src/main/resources/schema.sql diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/resources/static/rest.html b/spring-security-modules/spring-security-web-sockets/src/main/resources/static/rest.html similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/resources/static/rest.html rename to spring-security-modules/spring-security-web-sockets/src/main/resources/static/rest.html diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/resources/static/rest.js b/spring-security-modules/spring-security-web-sockets/src/main/resources/static/rest.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/resources/static/rest.js rename to spring-security-modules/spring-security-web-sockets/src/main/resources/static/rest.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/resources/static/ws.html b/spring-security-modules/spring-security-web-sockets/src/main/resources/static/ws.html similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/resources/static/ws.html rename to spring-security-modules/spring-security-web-sockets/src/main/resources/static/ws.html diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/resources/static/ws.js b/spring-security-modules/spring-security-web-sockets/src/main/resources/static/ws.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/resources/static/ws.js rename to spring-security-modules/spring-security-web-sockets/src/main/resources/static/ws.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/denied.jsp b/spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/denied.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/denied.jsp rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/denied.jsp diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/index.jsp b/spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/index.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/index.jsp rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/index.jsp diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/login.jsp b/spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/login.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/login.jsp rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/login.jsp diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/socket.jsp b/spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/socket.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/socket.jsp rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/socket.jsp diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/success.jsp b/spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/success.jsp similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/WEB-INF/jsp/success.jsp rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/WEB-INF/jsp/success.jsp diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/app.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/app.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/app.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/app.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/indexController.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/controllers/indexController.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/indexController.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/controllers/indexController.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/socketController.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/controllers/socketController.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/socketController.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/controllers/socketController.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/successController.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/controllers/successController.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/controllers/successController.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/controllers/successController.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/routes/router.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/routes/router.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/routes/router.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/routes/router.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/services/SocketService.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/services/SocketService.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/scripts/services/SocketService.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/scripts/services/SocketService.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/app.css b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/app.css similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/app.css rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/app.css diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/denied.css b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/denied.css similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/denied.css rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/denied.css diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/index.css b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/index.css similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/index.css rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/index.css diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/login.css b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/login.css similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/login.css rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/login.css diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/socket.css b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/socket.css similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/socket.css rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/socket.css diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/success.css b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/success.css similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/styles/success.css rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/styles/success.css diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/angular/angular-route.min.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/angular/angular-route.min.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js.map b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/angular/angular-route.min.js.map similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular-route.min.js.map rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/angular/angular-route.min.js.map diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/angular/angular.min.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/angular/angular.min.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js.map b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/angular/angular.min.js.map similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/angular/angular.min.js.map rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/angular/angular.min.js.map diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/jquery/jquery.min.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/jquery/jquery.min.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/jquery/jquery.min.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/jquery/jquery.min.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/sockjs/sockjs.min.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/sockjs/sockjs.min.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/sockjs/sockjs.min.js.map diff --git a/spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/stomp/stomp.min.js b/spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/stomp/stomp.min.js similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/main/webapp/resources/vendor/stomp/stomp.min.js rename to spring-security-modules/spring-security-web-sockets/src/main/webapp/resources/vendor/stomp/stomp.min.js diff --git a/spring-security-modules/spring-security-mvc-socket/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-sockets/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-mvc-socket/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-sockets/src/test/java/com/baeldung/SpringContextTest.java From 10e9f147ee2a0e28c8a89741a97a41ad4f23194f Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 16 Aug 2020 16:33:28 +0530 Subject: [PATCH 0469/1862] JAVA-68: Renamed spring-security-react to spring-security-web-react --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../main/java/com/baeldung/spring/MvcConfig.java | 0 .../java/com/baeldung/spring/SecSecurityConfig.java | 0 .../src/main/resources/logback.xml | 0 .../src/main/webapp/WEB-INF/mvc-servlet.xml | 0 .../src/main/webapp/WEB-INF/view/accessDenied.jsp | 0 .../main/webapp/WEB-INF/view/admin/adminpage.jsp | 0 .../src/main/webapp/WEB-INF/view/anonymous.jsp | 0 .../src/main/webapp/WEB-INF/view/homepage.jsp | 0 .../src/main/webapp/WEB-INF/view/react/.babelrc | 0 .../main/webapp/WEB-INF/view/react/.eslintignore | 0 .../src/main/webapp/WEB-INF/view/react/.eslintrc | 0 .../src/main/webapp/WEB-INF/view/react/.gitignore | 0 .../webapp/WEB-INF/view/react/package-lock.json | 0 .../src/main/webapp/WEB-INF/view/react/package.json | 0 .../webapp/WEB-INF/view/react/public/favicon.ico | Bin .../webapp/WEB-INF/view/react/public/index.html | 0 .../webapp/WEB-INF/view/react/public/manifest.json | 0 .../src/main/webapp/WEB-INF/view/react/src/Form.js | 0 .../src/main/webapp/WEB-INF/view/react/src/Input.js | 0 .../main/webapp/WEB-INF/view/react/src/index.css | 0 .../src/main/webapp/WEB-INF/view/react/src/index.js | 0 .../WEB-INF/view/react/src/registerServiceWorker.js | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../test/java/com/baeldung/SpringContextTest.java | 0 27 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-react => spring-security-web-react}/.gitignore (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/README.md (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/pom.xml (98%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/java/com/baeldung/spring/MvcConfig.java (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/java/com/baeldung/spring/SecSecurityConfig.java (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/mvc-servlet.xml (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/accessDenied.jsp (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/admin/adminpage.jsp (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/anonymous.jsp (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/homepage.jsp (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/.babelrc (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/.eslintignore (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/.eslintrc (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/.gitignore (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/package-lock.json (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/package.json (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/public/favicon.ico (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/public/index.html (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/public/manifest.json (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/src/Form.js (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/src/Input.js (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/src/index.css (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/src/index.js (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/main/webapp/WEB-INF/web.xml (100%) rename spring-security-modules/{spring-security-react => spring-security-web-react}/src/test/java/com/baeldung/SpringContextTest.java (100%) diff --git a/spring-security-modules/spring-security-react/.gitignore b/spring-security-modules/spring-security-web-react/.gitignore similarity index 100% rename from spring-security-modules/spring-security-react/.gitignore rename to spring-security-modules/spring-security-web-react/.gitignore diff --git a/spring-security-modules/spring-security-react/README.md b/spring-security-modules/spring-security-web-react/README.md similarity index 100% rename from spring-security-modules/spring-security-react/README.md rename to spring-security-modules/spring-security-web-react/README.md diff --git a/spring-security-modules/spring-security-react/pom.xml b/spring-security-modules/spring-security-web-react/pom.xml similarity index 98% rename from spring-security-modules/spring-security-react/pom.xml rename to spring-security-modules/spring-security-web-react/pom.xml index 19240fe88c..d0ca6f8c8d 100644 --- a/spring-security-modules/spring-security-react/pom.xml +++ b/spring-security-modules/spring-security-web-react/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-react + spring-security-web-react 0.1-SNAPSHOT - spring-security-react + spring-security-web-react war diff --git a/spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-web-react/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 100% rename from spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-web-react/src/main/java/com/baeldung/spring/MvcConfig.java diff --git a/spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-web-react/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-web-react/src/main/java/com/baeldung/spring/SecSecurityConfig.java diff --git a/spring-security-modules/spring-security-react/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-react/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-react/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-react/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/mvc-servlet.xml similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/mvc-servlet.xml rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/mvc-servlet.xml diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/accessDenied.jsp b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/accessDenied.jsp similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/accessDenied.jsp rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/accessDenied.jsp diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/admin/adminpage.jsp b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/admin/adminpage.jsp similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/admin/adminpage.jsp rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/admin/adminpage.jsp diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/anonymous.jsp b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/anonymous.jsp similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/anonymous.jsp rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/anonymous.jsp diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/homepage.jsp similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/homepage.jsp rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/homepage.jsp diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.babelrc b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/.babelrc similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.babelrc rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/.babelrc diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintignore b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/.eslintignore similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintignore rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/.eslintignore diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintrc b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/.eslintrc similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.eslintrc rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/.eslintrc diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.gitignore b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/.gitignore similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/.gitignore rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/.gitignore diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/package-lock.json similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/package-lock.json rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/package-lock.json diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/package.json b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/package.json similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/package.json rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/package.json diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/favicon.ico b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/public/favicon.ico similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/favicon.ico rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/public/favicon.ico diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/index.html b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/public/index.html similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/index.html rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/public/index.html diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/manifest.json b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/public/manifest.json similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/public/manifest.json rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/public/manifest.json diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Form.js b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/Form.js similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Form.js rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/Form.js diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Input.js b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/Input.js similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/Input.js rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/Input.js diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.css b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/index.css similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.css rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/index.css diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.js b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/index.js similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/index.js rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/index.js diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/view/react/src/registerServiceWorker.js diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-web-react/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-modules/spring-security-react/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-react/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-react/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-react/src/test/java/com/baeldung/SpringContextTest.java From 12d16d9c850ebecc7cbc0c1a7fc4340730695234 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 16 Aug 2020 16:34:03 +0530 Subject: [PATCH 0470/1862] JAVA-68: parent module pom changes as per child module renaming --- spring-security-modules/pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index f050b48ac5..815b84d448 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -24,14 +24,14 @@ spring-security-web-boot-2 spring-security-web-mvc-custom spring-security-web-digest-auth - spring-security-mvc-jsonview + spring-security-web-jsonview spring-security-ldap - spring-security-mvc-login - spring-security-mvc-persisted-remember-me - spring-security-mvc-socket + spring-security-web-login + spring-security-web-persisted-remember-me + spring-security-web-sockets spring-security-oidc spring-security-okta - spring-security-react + spring-security-web-react spring-security-rest spring-security-rest-basic-auth spring-security-rest-custom From 00d8cdc2524cac8c1a3dd3cff243b81ca24e8a53 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 16 Aug 2020 16:37:06 +0530 Subject: [PATCH 0471/1862] JAVA-68: README changes --- spring-security-modules/spring-security-web-jsonview/README.md | 2 +- spring-security-modules/spring-security-web-sockets/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-security-modules/spring-security-web-jsonview/README.md b/spring-security-modules/spring-security-web-jsonview/README.md index 0e28d4c292..83f8106df9 100644 --- a/spring-security-modules/spring-security-web-jsonview/README.md +++ b/spring-security-modules/spring-security-web-jsonview/README.md @@ -1,4 +1,4 @@ -## Spring Security MVC Json View +## Spring Security Web Json View This module contains articles about Spring Security with JSON diff --git a/spring-security-modules/spring-security-web-sockets/README.md b/spring-security-modules/spring-security-web-sockets/README.md index d134d19c84..14ef0c8b99 100644 --- a/spring-security-modules/spring-security-web-sockets/README.md +++ b/spring-security-modules/spring-security-web-sockets/README.md @@ -1,4 +1,4 @@ -## Spring Security MVC Socket +## Spring Security Web Sockets This module contains articles about WebSockets with Spring Security From 6b75e0cbed0eb62f96df5f60228b1ec1170dd4dd Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sun, 16 Aug 2020 22:39:00 +0300 Subject: [PATCH 0472/1862] BAEL-4516: Task for config and srcset info --- gradle-5/source-sets/build.gradle | 47 +++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/gradle-5/source-sets/build.gradle b/gradle-5/source-sets/build.gradle index 909b125aed..47f64aca04 100644 --- a/gradle-5/source-sets/build.gradle +++ b/gradle-5/source-sets/build.gradle @@ -1,35 +1,52 @@ apply plugin: "eclipse" +apply plugin: "java" description = "Source Sets example" -task printConfigurations(){ +task printSourceSetInformation(){ doLast{ - configurations.each { - println it.name + sourceSets.each { srcSet -> + println "["+srcSet.name+"]" + print "-->Source directories: "+srcSet.allJava.srcDirs+"\n" + print "-->Output directories: "+srcSet.output.classesDirs.files+"\n" + print "-->Compile classpath:\n" + srcSet.compileClasspath.files.each { + print " "+it.path+"\n" + } + println "" } } } -sourceSets{ - itest { - java { +task printConfigurationInformation(){ + doLast{ + configurations.each { config -> + println "["+config.name+"]" } } } +// sourceSets{ + +// itest { +// java { +// } +// } +// } + dependencies { implementation('org.apache.httpcomponents:httpclient:4.5.12') testImplementation('junit:junit:4.12') - itestImplementation('com.google.guava:guava:29.0-jre') + // itestImplementation('com.google.guava:guava:29.0-jre') } -configurations { - itestImplementation.extendsFrom(testImplementation) -} +// configurations { +// itestImplementation.extendsFrom(testImplementation) +// } -eclipse { - classpath { - plusConfigurations+=[configurations.itestCompileClasspath] - } -} \ No newline at end of file +// eclipse { +// classpath { +// plusConfigurations+=[configurations.itestCompileClasspath] +// } +// } \ No newline at end of file From a32ecbeb8a75329707d4f9c899fe39a8737f7e7d Mon Sep 17 00:00:00 2001 From: bfontana Date: Sun, 16 Aug 2020 18:32:19 -0300 Subject: [PATCH 0473/1862] Delete README.md File will be added after the article is published. --- spring-webflux-threads/README.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 spring-webflux-threads/README.md diff --git a/spring-webflux-threads/README.md b/spring-webflux-threads/README.md deleted file mode 100644 index b69ba958c1..0000000000 --- a/spring-webflux-threads/README.md +++ /dev/null @@ -1,7 +0,0 @@ -## Spring WebFlux Concurrency - -This module contains articles about concurrency model in Spring WebFlux. - -### Relevant Articles: - -- [Concurrency in Spring WebFlux]() From 1c432896ca36bded5196933a5c804d1cc986f5f4 Mon Sep 17 00:00:00 2001 From: bfontana Date: Sun, 16 Aug 2020 19:21:54 -0300 Subject: [PATCH 0474/1862] Update Application.java Minor Javadoc fixings. --- .../src/main/java/com/baeldung/webflux/Application.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java index a0cd7d6a27..06a148a77f 100644 --- a/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java +++ b/spring-webflux-threads/src/main/java/com/baeldung/webflux/Application.java @@ -4,8 +4,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** -* Please note that this assumes Mongo and Kafka to be running on the local machine on default configurations. -* If you want to experiment with Tomcat/Jetty instead of Netty, just uncomment the lines in pom.xml and rebuild. +* Please note we assume Mongo and Kafka are running in the local machine and on default configuration. +* Additionally, if you want to experiment with Tomcat/Jetty instead of Netty, just uncomment the lines in pom.xml and rebuild. */ @SpringBootApplication public class Application { From 62432a25320d7caec51e6ad6573968fbed6d83e5 Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Mon, 17 Aug 2020 10:30:19 +0530 Subject: [PATCH 0475/1862] Java 2387 (#9882) * fix junit test cases * added module in parent build --- .../com/baeldung/datetime/UseDateTimeFormatterUnitTest.java | 2 +- .../java/com/baeldung/datetime/UseToInstantUnitTest.java | 6 ++++-- .../com/baeldung/datetime/UseZonedDateTimeUnitTest.java | 2 +- core-java-modules/pom.xml | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java b/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java index 797e0b954a..8ca0066a0d 100644 --- a/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java +++ b/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseDateTimeFormatterUnitTest.java @@ -31,6 +31,6 @@ public class UseDateTimeFormatterUnitTest { public void givenALocalDate_whenFormattingWithStyleAndLocale_thenPass() { String result = subject.formatWithStyleAndLocale(localDateTime, FormatStyle.MEDIUM, Locale.UK); - assertThat(result).isEqualTo("25 Jan 2015, 06:30:00"); + assertThat(result).isEqualTo("25-Jan-2015 06:30:00"); } } \ No newline at end of file diff --git a/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java b/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java index 78d9a647fe..cb6e804284 100644 --- a/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java +++ b/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseToInstantUnitTest.java @@ -3,6 +3,7 @@ package com.baeldung.datetime; import static org.assertj.core.api.Assertions.assertThat; import java.time.LocalDateTime; +import java.time.ZoneId; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -24,10 +25,11 @@ public class UseToInstantUnitTest { @Test public void givenADate_whenConvertingToLocalDate_thenAsExpected() { - Date givenDate = new Date(1465817690000L); + LocalDateTime currentDateTime = LocalDateTime.now(); + Date givenDate = Date.from(currentDateTime.atZone(ZoneId.systemDefault()).toInstant()); LocalDateTime localDateTime = subject.convertDateToLocalDate(givenDate); - assertThat(localDateTime).isEqualTo("2016-06-13T13:34:50"); + assertThat(localDateTime).isEqualTo(currentDateTime); } } \ No newline at end of file diff --git a/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java b/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java index 4a39f6056e..0ee0f72d78 100644 --- a/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java +++ b/core-java-modules/core-java-8-datetime/src/test/java/com/baeldung/datetime/UseZonedDateTimeUnitTest.java @@ -54,7 +54,7 @@ public class UseZonedDateTimeUnitTest { @Test public void givenAStringWithTimeZone_whenParsing_thenEqualsExpected() { ZonedDateTime resultFromString = zonedDateTime.getZonedDateTimeUsingParseMethod("2015-05-03T10:15:30+01:00[Europe/Paris]"); - ZonedDateTime resultFromLocalDateTime = ZonedDateTime.of(2015, 5, 3, 11, 15, 30, 0, ZoneId.of("Europe/Paris")); + ZonedDateTime resultFromLocalDateTime = ZonedDateTime.of(2015, 5, 3, 10, 15, 30, 0, ZoneId.of("Europe/Paris")); assertThat(resultFromString.getZone()).isEqualTo(ZoneId.of("Europe/Paris")); assertThat(resultFromLocalDateTime.getZone()).isEqualTo(ZoneId.of("Europe/Paris")); diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 589097cf48..e6fd449c87 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -64,6 +64,7 @@ core-java-date-operations-2 + core-java-8-datetime core-java-exceptions core-java-exceptions-2 From 2bad67ff3831f2fd4b907983d3e726fa00c8b3d7 Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Mon, 17 Aug 2020 10:33:20 +0530 Subject: [PATCH 0476/1862] added modules in parent (#9842) * added modules in parent * commented failed modules in pom --- core-java-modules/pom.xml | 5 +++++ patterns/pom.xml | 1 + persistence-modules/pom.xml | 2 ++ spring-boot-modules/spring-boot-custom-starter/pom.xml | 1 + spring-cloud/pom.xml | 2 ++ spring-cloud/spring-cloud-stream/pom.xml | 2 ++ 6 files changed, 13 insertions(+) diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index e6fd449c87..0b832223f4 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -22,6 +22,7 @@ + core-java-8 core-java-8-2 @@ -59,7 +60,11 @@ core-java-concurrency-basic core-java-concurrency-basic-2 core-java-concurrency-collections + core-java-concurrency-collections-2 + core-java-console + + core-java-8-datetime-2 core-java-date-operations-2 diff --git a/patterns/pom.xml b/patterns/pom.xml index e1753aba56..a179d75ffe 100644 --- a/patterns/pom.xml +++ b/patterns/pom.xml @@ -21,6 +21,7 @@ dip cqrs-es front-controller + hexagonal-architecture intercepting-filter solid diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 6186900a6e..3e1a90b737 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -19,12 +19,14 @@ core-java-persistence deltaspike elasticsearch + flyway flyway-repair hbase hibernate5 hibernate-mapping hibernate-ogm hibernate-annotations + hibernate-exceptions hibernate-libraries hibernate-jpa hibernate-queries diff --git a/spring-boot-modules/spring-boot-custom-starter/pom.xml b/spring-boot-modules/spring-boot-custom-starter/pom.xml index 17f9fdc2cc..338bf22f46 100644 --- a/spring-boot-modules/spring-boot-custom-starter/pom.xml +++ b/spring-boot-modules/spring-boot-custom-starter/pom.xml @@ -18,6 +18,7 @@ greeter-library + greeter greeter-spring-boot-autoconfigure greeter-spring-boot-starter greeter-spring-boot-sample-app diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 0e2cac1ff9..99fde0daf4 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -41,6 +41,8 @@ spring-cloud-zuul spring-cloud-zuul-fallback spring-cloud-ribbon-retry + spring-cloud-circuit-breaker + spring-cloud-eureka-self-preservation diff --git a/spring-cloud/spring-cloud-stream/pom.xml b/spring-cloud/spring-cloud-stream/pom.xml index ebaaab0801..17c788c000 100644 --- a/spring-cloud/spring-cloud-stream/pom.xml +++ b/spring-cloud/spring-cloud-stream/pom.xml @@ -14,7 +14,9 @@ + spring-cloud-stream-kafka spring-cloud-stream-rabbit + spring-cloud-stream-kinesis From b6e9fa3848f96fdd6628bf5919f2b6604f324485 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Mon, 17 Aug 2020 16:48:47 +0530 Subject: [PATCH 0477/1862] Delete MainMenuUnitTest.java Moving code to a new module - core-java-exceptions-3 --- .../nosuchmethoderror/MainMenuUnitTest.java | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java diff --git a/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java b/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java deleted file mode 100644 index 7e53fa9c0e..0000000000 --- a/core-java-modules/core-java-exceptions/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.exceptions.nosuchmethoderror; - -import static org.junit.Assert.assertNotNull; - -import org.junit.jupiter.api.Test; - -class MainMenuUnitTest { - - @Test - void whenGetSpecials_thenNotNull() { - assertNotNull(MainMenu.getSpecials()); - } - -} From 02fb2aee854d7e11f3a39cdb8c2abcf86451c5f7 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Mon, 17 Aug 2020 16:50:59 +0530 Subject: [PATCH 0478/1862] Delete MainMenu.java Moving code to a new module - core-java-exceptions-3 --- .../exceptions/nosuchmethoderror/MainMenu.java | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java deleted file mode 100644 index f12cbe1897..0000000000 --- a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.exceptions.nosuchmethoderror; - -public class MainMenu { - public static void main(String[] args) { - System.out.println("Today's Specials: " + getSpecials()); - } - - public static String getSpecials() { - return SpecialToday.getDesert(); - } -} From ccad8d217f11a0d99b0e2853b4bed93076fe7099 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Mon, 17 Aug 2020 16:51:16 +0530 Subject: [PATCH 0479/1862] Delete SpecialToday.java Moving code to a new module - core-java-exceptions-3 --- .../exceptions/nosuchmethoderror/SpecialToday.java | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java diff --git a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java b/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java deleted file mode 100644 index 1b0dea9784..0000000000 --- a/core-java-modules/core-java-exceptions/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.exceptions.nosuchmethoderror; -public class SpecialToday { - private static String desert = "Chocolate Cake"; - - public static String getDesert() { - return desert; - } -} From 3233bd6adc5e5485d9af8573c200291bd95c3beb Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Mon, 17 Aug 2020 12:41:09 +0100 Subject: [PATCH 0480/1862] BAEL-4321 add new module to pom --- spring-boot-modules/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index 84f1f0e86c..f4e3e534c8 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -56,6 +56,7 @@ spring-boot-performance spring-boot-properties spring-boot-properties-2 + spring-boot-properties-3 spring-boot-property-exp spring-boot-runtime spring-boot-security From 3cbfd383edd32b2848286c643fbc53b5f7609718 Mon Sep 17 00:00:00 2001 From: Vishal Date: Mon, 17 Aug 2020 18:06:20 +0530 Subject: [PATCH 0481/1862] Refactor | Add common formatting, remove comments, update test class name,follow test method naming convention and use Junit5 --- testing-modules/testing-assertions/pom.xml | 22 +++++++++ .../OrderAgnosticListComparison.java | 46 ------------------- .../OrderAgnosticListComparisonUnitTest.java | 40 ++++++++++++++++ 3 files changed, 62 insertions(+), 46 deletions(-) delete mode 100644 testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparison.java create mode 100644 testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparisonUnitTest.java diff --git a/testing-modules/testing-assertions/pom.xml b/testing-modules/testing-assertions/pom.xml index fe8c86d058..5bb6f5faaa 100644 --- a/testing-modules/testing-assertions/pom.xml +++ b/testing-modules/testing-assertions/pom.xml @@ -18,6 +18,18 @@ logback-classic 1.2.3 + + org.junit.jupiter + junit-jupiter-engine + 5.6.2 + test + + + org.junit.jupiter + junit-jupiter-api + 5.6.2 + test + org.assertj assertj-core @@ -37,4 +49,14 @@ test + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.1 + + + diff --git a/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparison.java b/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparison.java deleted file mode 100644 index b03723e5bd..0000000000 --- a/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparison.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.listassert; - -import org.hamcrest.Matchers; -import org.apache.commons.collections4.CollectionUtils; -import org.junit.Test; - - -import java.util.Arrays; -import java.util.List; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class OrderAgnosticListComparison { - - private final List first = Arrays.asList(1, 3, 4, 6, 8); - private final List second = Arrays.asList(8, 1, 6, 3, 4); - private final List third = Arrays.asList(1, 3, 3, 6, 6); - - //In this test using simple JUnit assertion - @Test - public void whenTestingForOrderAgnosticEqualityShouldBeTrue() { - assertTrue(first.size() == second.size() && - first.containsAll(second) && second.containsAll(first)); - } - - @Test - public void whenTestingForOrderAgnosticEqualityShouldBeFalse() { - assertFalse(first.size() == third.size() && - first.containsAll(third) && third.containsAll(first)); - } - - //In this test using Hamcrest lib apis for assertion - @Test - public void whenTestingForOrderAgnosticEqualityShouldBeEqual() { - assertThat(first, Matchers.containsInAnyOrder(second.toArray())); - } - - //In this test asserting lists using Apache Commons apis - @Test - public void whenTestingForOrderAgnosticEqualityShouldBeTrueIfEqualOtherwiseFalse() { - assertTrue(CollectionUtils.isEqualCollection(first, second)); - assertFalse(CollectionUtils.isEqualCollection(first, third)); - } -} diff --git a/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparisonUnitTest.java b/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparisonUnitTest.java new file mode 100644 index 0000000000..9ef6f203af --- /dev/null +++ b/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparisonUnitTest.java @@ -0,0 +1,40 @@ +package com.baeldung.listassert; + +import org.apache.commons.collections4.CollectionUtils; +import org.hamcrest.Matchers; +import org.junit.jupiter.api.Test; + +import java.util.Arrays; +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class OrderAgnosticListComparisonUnitTest { + + private final List first = Arrays.asList(1, 3, 4, 6, 8); + private final List second = Arrays.asList(8, 1, 6, 3, 4); + private final List third = Arrays.asList(1, 3, 3, 6, 6); + + @Test + public void whenTestingForOrderAgnosticEquality_ShouldBeTrue() { + assertTrue(first.size() == second.size() && first.containsAll(second) && second.containsAll(first)); + } + + @Test + public void whenTestingForOrderAgnosticEquality_ShouldBeFalse() { + assertFalse(first.size() == third.size() && first.containsAll(third) && third.containsAll(first)); + } + + @Test + public void whenTestingForOrderAgnosticEquality_ShouldBeEqual() { + assertThat(first, Matchers.containsInAnyOrder(second.toArray())); + } + + @Test + public void whenTestingForOrderAgnosticEquality_ShouldBeTrueIfEqualOtherwiseFalse() { + assertTrue(CollectionUtils.isEqualCollection(first, second)); + assertFalse(CollectionUtils.isEqualCollection(first, third)); + } +} From 5c46488ac82f826873f7214efd6dc0cb848dc0ea Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Mon, 17 Aug 2020 18:21:42 +0530 Subject: [PATCH 0482/1862] used standard parent pom (#9885) --- .../spring-boot-basic-customization/pom.xml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spring-boot-modules/spring-boot-basic-customization/pom.xml b/spring-boot-modules/spring-boot-basic-customization/pom.xml index 2a4b321c5f..fc34994a85 100644 --- a/spring-boot-modules/spring-boot-basic-customization/pom.xml +++ b/spring-boot-modules/spring-boot-basic-customization/pom.xml @@ -4,13 +4,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.3.2.RELEASE - + com.baeldung.spring-boot-modules + spring-boot-modules + 1.0.0-SNAPSHOT + ../ spring-boot-basic-customization From f00adab98c004db720aeee3a94db6ed27350ad20 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Mon, 17 Aug 2020 19:33:14 +0530 Subject: [PATCH 0483/1862] BAEL-4193 - initial commit initial commit in new module core-java-exceptions-3 --- .../core-java-exceptions-3/README.md | 6 ++++ .../core-java-exceptions-3/pom.xml | 34 +++++++++++++++++++ .../nosuchmethoderror/MainMenu.java | 11 ++++++ .../nosuchmethoderror/SpecialToday.java | 8 +++++ .../nosuchmethoderror/MainMenuUnitTest.java | 13 +++++++ 5 files changed, 72 insertions(+) create mode 100644 core-java-modules/core-java-exceptions-3/README.md create mode 100644 core-java-modules/core-java-exceptions-3/pom.xml create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java create mode 100644 core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java diff --git a/core-java-modules/core-java-exceptions-3/README.md b/core-java-modules/core-java-exceptions-3/README.md new file mode 100644 index 0000000000..52fca27486 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/README.md @@ -0,0 +1,6 @@ +## Core Java Exceptions + +This module contains articles about core java exceptions + +### Relevant articles: +- [NoSuchMethodError in Java](https://www.baeldung.com/java-chained-exceptions) diff --git a/core-java-modules/core-java-exceptions-3/pom.xml b/core-java-modules/core-java-exceptions-3/pom.xml new file mode 100644 index 0000000000..32c522dab5 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + com.baeldung.exceptions + core-java-exceptions-3 + 0.1.0-SNAPSHOT + core-java-exceptions-3 + jar + + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../ + + + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + + + + + 3.10.0 + + + \ No newline at end of file diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java new file mode 100644 index 0000000000..f12cbe1897 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/nosuchmethoderror/MainMenu.java @@ -0,0 +1,11 @@ +package com.baeldung.exceptions.nosuchmethoderror; + +public class MainMenu { + public static void main(String[] args) { + System.out.println("Today's Specials: " + getSpecials()); + } + + public static String getSpecials() { + return SpecialToday.getDesert(); + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java new file mode 100644 index 0000000000..1b0dea9784 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/nosuchmethoderror/SpecialToday.java @@ -0,0 +1,8 @@ +package com.baeldung.exceptions.nosuchmethoderror; +public class SpecialToday { + private static String desert = "Chocolate Cake"; + + public static String getDesert() { + return desert; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java new file mode 100644 index 0000000000..ce4374a9ba --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/nosuchmethoderror/MainMenuUnitTest.java @@ -0,0 +1,13 @@ +package com.baeldung.exceptions.nosuchmethoderror; + +import static org.junit.Assert.assertNotNull; + +import org.junit.jupiter.api.Test; + +class MainMenuUnitTest { + + @Test + void whenGetSpecials_thenNotNull() { + assertNotNull(MainMenu.getSpecials()); + } +} From 10d571fd1d93b89f337ce4c87e4b6bf0df8285fd Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Mon, 17 Aug 2020 19:37:28 +0530 Subject: [PATCH 0484/1862] pom : added new module core-java-exceptions-3 added new module core-java-exceptions-3 --- core-java-modules/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 589097cf48..29f849ecf7 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -67,7 +67,7 @@ core-java-exceptions core-java-exceptions-2 - + core-java-exceptions-3 core-java-function core-java-io From eac28eb90f89acc2be018013ac31348ec64705b9 Mon Sep 17 00:00:00 2001 From: azhwani <> Date: Mon, 17 Aug 2020 15:12:50 +0100 Subject: [PATCH 0485/1862] first commit --- .../NotificationApplication.java | 12 +++++++++ .../config/NotificationConfig.java | 26 ++++++++++++++++++ .../service/EmailNotification.java | 10 +++++++ .../service/NotificationSender.java | 5 ++++ .../service/SmsNotification.java | 10 +++++++ .../src/main/resources/application.properties | 2 ++ .../NotificationUnitTest.java | 27 +++++++++++++++++++ 7 files changed, 92 insertions(+) create mode 100644 spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/NotificationApplication.java create mode 100644 spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/config/NotificationConfig.java create mode 100644 spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/EmailNotification.java create mode 100644 spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/NotificationSender.java create mode 100644 spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/SmsNotification.java create mode 100644 spring-boot-modules/spring-boot-autoconfiguration/src/test/java/com/baeldung/conditionalonproperty/NotificationUnitTest.java diff --git a/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/NotificationApplication.java b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/NotificationApplication.java new file mode 100644 index 0000000000..977de5534d --- /dev/null +++ b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/NotificationApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.conditionalonproperty; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class NotificationApplication { + + public static void main(String[] args) { + SpringApplication.run(NotificationApplication.class, args); + } +} diff --git a/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/config/NotificationConfig.java b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/config/NotificationConfig.java new file mode 100644 index 0000000000..ffd942cd02 --- /dev/null +++ b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/config/NotificationConfig.java @@ -0,0 +1,26 @@ +package com.baeldung.conditionalonproperty.config; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.baeldung.conditionalonproperty.service.EmailNotification; +import com.baeldung.conditionalonproperty.service.NotificationSender; +import com.baeldung.conditionalonproperty.service.SmsNotification; + +@Configuration +public class NotificationConfig { + + @Bean(name = "emailNotification") + @ConditionalOnProperty(prefix = "notification", name = "service", havingValue = "email") + public NotificationSender notificationSender() { + return new EmailNotification(); + } + + @Bean(name = "smsNotification") + @ConditionalOnProperty(prefix = "notification", name = "service", havingValue = "sms") + public NotificationSender notificationSender2() { + return new SmsNotification(); + } + +} diff --git a/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/EmailNotification.java b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/EmailNotification.java new file mode 100644 index 0000000000..c66800f817 --- /dev/null +++ b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/EmailNotification.java @@ -0,0 +1,10 @@ +package com.baeldung.conditionalonproperty.service; + +public class EmailNotification implements NotificationSender { + + @Override + public String send(String message) { + return "Email Notification: " + message; + } + +} diff --git a/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/NotificationSender.java b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/NotificationSender.java new file mode 100644 index 0000000000..945306e7c4 --- /dev/null +++ b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/NotificationSender.java @@ -0,0 +1,5 @@ +package com.baeldung.conditionalonproperty.service; + +public interface NotificationSender { + String send(String message); +} diff --git a/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/SmsNotification.java b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/SmsNotification.java new file mode 100644 index 0000000000..dcf611da19 --- /dev/null +++ b/spring-boot-modules/spring-boot-autoconfiguration/src/main/java/com/baeldung/conditionalonproperty/service/SmsNotification.java @@ -0,0 +1,10 @@ +package com.baeldung.conditionalonproperty.service; + +public class SmsNotification implements NotificationSender { + + @Override + public String send(String message) { + return "SMS notification: " + message; + } + +} diff --git a/spring-boot-modules/spring-boot-autoconfiguration/src/main/resources/application.properties b/spring-boot-modules/spring-boot-autoconfiguration/src/main/resources/application.properties index 4456c78e5d..03f753abf9 100644 --- a/spring-boot-modules/spring-boot-autoconfiguration/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-autoconfiguration/src/main/resources/application.properties @@ -1,2 +1,4 @@ spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto = update + +notification.service=email diff --git a/spring-boot-modules/spring-boot-autoconfiguration/src/test/java/com/baeldung/conditionalonproperty/NotificationUnitTest.java b/spring-boot-modules/spring-boot-autoconfiguration/src/test/java/com/baeldung/conditionalonproperty/NotificationUnitTest.java new file mode 100644 index 0000000000..fb9b177e5f --- /dev/null +++ b/spring-boot-modules/spring-boot-autoconfiguration/src/test/java/com/baeldung/conditionalonproperty/NotificationUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.conditionalonproperty; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; + +import com.baeldung.conditionalonproperty.config.NotificationConfig; +import com.baeldung.conditionalonproperty.service.EmailNotification; +import com.baeldung.conditionalonproperty.service.NotificationSender; + +public class NotificationUnitTest { + + private final ApplicationContextRunner contextRunner = new ApplicationContextRunner(); + + @Test + public void whenValueSetToEmail_thenCreateEmailNotification() { + this.contextRunner.withPropertyValues("notification.service=email") + .withUserConfiguration(NotificationConfig.class) + .run(context -> { + assertThat(context).hasBean("emailNotification"); + NotificationSender notificationSender = context.getBean(EmailNotification.class); + assertThat(notificationSender.send("Hello From Baeldung!")).isEqualTo("Email Notification: Hello From Baeldung!"); + assertThat(context).doesNotHaveBean("smsNotification"); + }); + } +} From 0d2ae486e100cb5e94c8598670579e8393b690ce Mon Sep 17 00:00:00 2001 From: davidmartinezbarua Date: Mon, 17 Aug 2020 11:52:28 -0300 Subject: [PATCH 0486/1862] Revert "BAEL-4321 demo app for yaml to pojo" --- spring-boot-modules/pom.xml | 1 - .../spring-boot-properties-3/pom.xml | 54 ------------------- .../boot/properties/DemoApplication.java | 16 ------ .../properties/config/TshirtSizeConfig.java | 27 ---------- .../controller/TshirtSizeController.java | 21 -------- .../properties/service/SizeConverterImpl.java | 22 -------- .../service/SizeConverterService.java | 8 --- .../src/main/resources/application.yml | 30 ----------- .../controller/TshirtSizeControllerTest.java | 38 ------------- 9 files changed, 217 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-properties-3/pom.xml delete mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java delete mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java delete mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java delete mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java delete mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java delete mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml delete mode 100644 spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index b4cabaaedf..3a2f14f5df 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -56,7 +56,6 @@ spring-boot-performance spring-boot-properties spring-boot-properties-2 - spring-boot-properties-3 spring-boot-property-exp spring-boot-runtime spring-boot-security diff --git a/spring-boot-modules/spring-boot-properties-3/pom.xml b/spring-boot-modules/spring-boot-properties-3/pom.xml deleted file mode 100644 index 1e3d627b19..0000000000 --- a/spring-boot-modules/spring-boot-properties-3/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 4.0.0 - - com.baeldung.spring-boot-modules - spring-boot-modules - 1.0.0-SNAPSHOT - ../ - - - spring-boot-properties-3 - 0.0.1-SNAPSHOT - spring-boot-properties-3 - Spring Boot Properties Module - - - 1.8 - - - - - org.springframework.boot - spring-boot-starter - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - - - org.springframework.boot - spring-boot-starter-web - RELEASE - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java deleted file mode 100644 index cf2fb7f981..0000000000 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.boot.properties; - -import com.baeldung.boot.properties.config.TshirtSizeConfig; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.context.properties.EnableConfigurationProperties; - -@SpringBootApplication -@EnableConfigurationProperties(TshirtSizeConfig.class) -public class DemoApplication { - - public static void main(String[] args) { - SpringApplication.run(DemoApplication.class, args); - } - -} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java deleted file mode 100644 index 690763ab7b..0000000000 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.boot.properties.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -import java.util.Map; - -@ConfigurationProperties(prefix = "t-shirt-size") -public class TshirtSizeConfig { - - private final Map simpleMapping; - - private final Map> complexMapping; - - - public TshirtSizeConfig(Map simpleMapping, Map> complexMapping) { - this.simpleMapping = simpleMapping; - this.complexMapping = complexMapping; - } - - public Map getSimpleMapping() { - return simpleMapping; - } - - public Map> getComplexMapping() { - return complexMapping; - } -} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java deleted file mode 100644 index 6b713c5be8..0000000000 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.boot.properties.controller; - -import org.springframework.web.bind.annotation.*; -import com.baeldung.boot.properties.service.SizeConverterService; - -@RestController -@RequestMapping(value = "/") -public class TshirtSizeController { - - private final SizeConverterService service; - - public TshirtSizeController(SizeConverterService service) { - this.service = service; - } - - @RequestMapping(value ="convertSize", method = RequestMethod.GET) - public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { - return service.convertSize(label, countryCode); - } - -} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java deleted file mode 100644 index 34f7fe2ded..0000000000 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.boot.properties.service; - -import org.springframework.stereotype.Service; -import com.baeldung.boot.properties.config.TshirtSizeConfig; - - -@Service -public class SizeConverterImpl implements SizeConverterService { - - private final TshirtSizeConfig tshirtSizeConfig; - - public SizeConverterImpl(TshirtSizeConfig tshirtSizeConfig) { - this.tshirtSizeConfig = tshirtSizeConfig; - } - - public int convertSize(String label, String countryCode) { - if(countryCode == null) { - return tshirtSizeConfig.getSimpleMapping().get(label); - } - return tshirtSizeConfig.getComplexMapping().get(label).get(countryCode.toLowerCase()); - } -} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java deleted file mode 100644 index 412199b176..0000000000 --- a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.boot.properties.service; - - -public interface SizeConverterService { - - int convertSize(String label, String countryCode); - -} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml deleted file mode 100644 index 8779cb6b0c..0000000000 --- a/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml +++ /dev/null @@ -1,30 +0,0 @@ - t-shirt-size: - simple-mapping: - XS: 6 - S: 8 - M: 10 - L: 12 - XL: 14 - - - complex-mapping: - XS: - uk: 6 - fr: 34 - us: 2 - S: - uk: 8 - fr: 36 - us: 4 - M: - uk: 10 - fr: 38 - us: 6 - L: - uk: 12 - fr: 40 - us: 8 - XL: - uk: 14 - fr: 42 - us: 10 diff --git a/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java deleted file mode 100644 index 0b70ed8622..0000000000 --- a/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.boot.properties.controller; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import com.baeldung.boot.properties.service.SizeConverterService; - -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.when; - -@ExtendWith(MockitoExtension.class) -class TshirtSizeControllerUnitTest { - - @Mock - private SizeConverterService service; - - @InjectMocks - private TshirtSizeController tested; - - @Test - void whenConvertSize_thenOK() { - - // Given - String label = "S"; - String countryCode = "fr"; - int result = 36; - - // When - when(service.convertSize(label, countryCode)).thenReturn(result); - int actual = tested.convertSize(label, countryCode); - - // Then - assertEquals(actual, result); - - } -} \ No newline at end of file From f3c4e3e36df8ac3a92b4d50da27278cf76ea663a Mon Sep 17 00:00:00 2001 From: Philippe Date: Mon, 17 Aug 2020 11:58:25 -0300 Subject: [PATCH 0487/1862] [BAEL-4381] Fix formatting --- .../archunit/smurfs/persistence/SmurfsRepository.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java index c18fcbc839..5d90d0f288 100644 --- a/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java +++ b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java @@ -26,11 +26,7 @@ public class SmurfsRepository { smurfs.put("Baker", new Smurf("Baker", true, true)); smurfs.put("Baker", new Smurf("Baker", true, true)); } - - public SmurfsRepository() { - - } - + public List findAll() { return Collections.unmodifiableList(smurfs.values().stream().collect(toList())); } From 39ba03a48843d668ee8d0852df5f8386b35c65d3 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Mon, 17 Aug 2020 21:11:50 +0530 Subject: [PATCH 0488/1862] Delete README.md --- core-java-modules/core-java-exceptions-3/README.md | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 core-java-modules/core-java-exceptions-3/README.md diff --git a/core-java-modules/core-java-exceptions-3/README.md b/core-java-modules/core-java-exceptions-3/README.md deleted file mode 100644 index 52fca27486..0000000000 --- a/core-java-modules/core-java-exceptions-3/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## Core Java Exceptions - -This module contains articles about core java exceptions - -### Relevant articles: -- [NoSuchMethodError in Java](https://www.baeldung.com/java-chained-exceptions) From e4f034795d1e4cb5aef5c3a12f81a9d1c268f03f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20G=C5=82=C3=B3wka?= Date: Mon, 17 Aug 2020 19:11:57 +0200 Subject: [PATCH 0489/1862] BAEL-4057: Hibernate Hi/Lo algorithm example (#9802) * BAEL-4057: Hibernate Hi/Lo algorithm example * BAEL-4057: fixed code indentation --- .../hibernate/hilo/RestaurantOrder.java | 34 +++++++ .../hibernate/hilo/HibernateHiloUnitTest.java | 99 +++++++++++++++++++ .../test/resources/hibernate-hilo.properties | 10 ++ 3 files changed, 143 insertions(+) create mode 100644 persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/hilo/RestaurantOrder.java create mode 100644 persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/hilo/HibernateHiloUnitTest.java create mode 100644 persistence-modules/hibernate5/src/test/resources/hibernate-hilo.properties diff --git a/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/hilo/RestaurantOrder.java b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/hilo/RestaurantOrder.java new file mode 100644 index 0000000000..03d7edeae9 --- /dev/null +++ b/persistence-modules/hibernate5/src/main/java/com/baeldung/hibernate/hilo/RestaurantOrder.java @@ -0,0 +1,34 @@ +package com.baeldung.hibernate.hilo; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class RestaurantOrder { + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "hilo_sequence_generator") + @GenericGenerator( + name = "hilo_sequence_generator", + strategy = "sequence", + parameters = { + @Parameter(name = "sequence_name", value = "hilo_seqeunce"), + @Parameter(name = "initial_value", value = "1"), + @Parameter(name = "increment_size", value = "3"), + @Parameter(name = "optimizer", value = "hilo") + } + ) + private Long id; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } +} diff --git a/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/hilo/HibernateHiloUnitTest.java b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/hilo/HibernateHiloUnitTest.java new file mode 100644 index 0000000000..9285c30af5 --- /dev/null +++ b/persistence-modules/hibernate5/src/test/java/com/baeldung/hibernate/hilo/HibernateHiloUnitTest.java @@ -0,0 +1,99 @@ +package com.baeldung.hibernate.hilo; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Level; +import org.apache.log4j.LogManager; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.hibernate.boot.Metadata; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.SessionFactoryBuilder; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.service.ServiceRegistry; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.Properties; + +import static org.junit.Assert.fail; + +public class HibernateHiloUnitTest { + private Session session; + + @Before + public void init() { + try { + configureLogger(); + + ServiceRegistry serviceRegistry = configureServiceRegistry(); + SessionFactory factory = getSessionFactoryBuilder(serviceRegistry).build(); + session = factory.openSession(); + } catch (HibernateException | IOException e) { + fail("Failed to initiate Hibernate Session [Exception:" + e.toString() + "]"); + } + } + + private void configureLogger() { + BasicConfigurator.configure(); + LogManager.getLogger("org.hibernate").setLevel(Level.ERROR); + LogManager.getLogger("org.hibernate.id.enhanced.SequenceStructure").setLevel(Level.DEBUG); + LogManager.getLogger("org.hibernate.event.internal.AbstractSaveEventListener").setLevel(Level.DEBUG); + LogManager.getLogger("org.hibernate.SQL").setLevel(Level.DEBUG); + } + + + private static SessionFactoryBuilder getSessionFactoryBuilder(ServiceRegistry serviceRegistry) { + MetadataSources metadataSources = new MetadataSources(serviceRegistry); + metadataSources.addAnnotatedClass(RestaurantOrder.class); + Metadata metadata = metadataSources.buildMetadata(); + + return metadata.getSessionFactoryBuilder(); + } + + private static ServiceRegistry configureServiceRegistry() throws IOException { + Properties properties = getProperties(); + + return new StandardServiceRegistryBuilder().applySettings(properties) + .build(); + } + + private static Properties getProperties() throws IOException { + Properties properties = new Properties(); + URL propertiesURL = getPropertiesURL(); + + try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) { + properties.load(inputStream); + } + + return properties; + } + + private static URL getPropertiesURL() { + return Thread.currentThread() + .getContextClassLoader() + .getResource("hibernate-hilo.properties"); + } + + @Test + public void givenHiLoAlgorithm_when9EntitiesArePersisted_Then3callsToDBForNextValueShouldBeMade() { + Transaction transaction = session.beginTransaction(); + + for (int i = 0; i < 9; i++) { + session.persist(new RestaurantOrder()); + session.flush(); + } + + transaction.commit(); + } + + @After + public void cleanup() { + session.close(); + } +} diff --git a/persistence-modules/hibernate5/src/test/resources/hibernate-hilo.properties b/persistence-modules/hibernate5/src/test/resources/hibernate-hilo.properties new file mode 100644 index 0000000000..60d487c1bd --- /dev/null +++ b/persistence-modules/hibernate5/src/test/resources/hibernate-hilo.properties @@ -0,0 +1,10 @@ +hibernate.connection.driver_class=org.h2.Driver +hibernate.connection.url=jdbc:h2:mem:hilo_db;DB_CLOSE_DELAY=-1 +hibernate.connection.username=sa +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop +hibernate.c3p0.min_size=5 +hibernate.c3p0.max_size=20 +hibernate.c3p0.acquire_increment=5 +hibernate.c3p0.timeout=1800 From ba5f54d666e4fd0a13a5eb2982a7321df1006ea9 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Tue, 18 Aug 2020 00:55:42 +0430 Subject: [PATCH 0490/1862] Fixed the Broken Test --- spring-boot-modules/spring-boot-actuator/pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-boot-modules/spring-boot-actuator/pom.xml b/spring-boot-modules/spring-boot-actuator/pom.xml index 0a7ad5725b..701949519e 100644 --- a/spring-boot-modules/spring-boot-actuator/pom.xml +++ b/spring-boot-modules/spring-boot-actuator/pom.xml @@ -43,6 +43,9 @@ org.springframework.boot spring-boot-maven-plugin + + com.baeldung.probes.ProbesApplication + From c0258feff87f4c33ca71129c8608900c901de33c Mon Sep 17 00:00:00 2001 From: Cristian Rosu Date: Mon, 17 Aug 2020 23:45:43 +0300 Subject: [PATCH 0491/1862] BAEL-4394: simplified assert statements + fixed type --- ...st.java => LineAtGivenNumberUnitTest.java} | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) rename core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/{LineAtGivenNumberTest.java => LineAtGivenNumberUnitTest.java} (77%) diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberUnitTest.java similarity index 77% rename from core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberTest.java rename to core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberUnitTest.java index b73320c8d9..ffe3221d62 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/linenumber/LineAtGivenNumberUnitTest.java @@ -17,7 +17,7 @@ import java.util.stream.Stream; import static org.junit.Assert.assertEquals; -public class LineAtGivenNumberTest { +public class LineAtGivenNumberUnitTest { private static final String FILE_PATH = "src/test/resources/linesInput.txt"; @@ -29,8 +29,7 @@ public class LineAtGivenNumberTest { } String extractedLine = br.readLine(); - String expectedLine = "Line 4"; - assertEquals(expectedLine, extractedLine); + assertEquals("Line 4", extractedLine); } } @@ -42,39 +41,35 @@ public class LineAtGivenNumberTest { } String extractedLine = scanner.nextLine(); - String expectedLine = "Line 4"; - assertEquals(expectedLine, extractedLine); + assertEquals("Line 4", extractedLine); } } @Test public void givenSmallFile_whenUsingFilesAPI_thenExtractedLineIsCorrect() throws IOException { String extractedLine = Files.readAllLines(Paths.get(FILE_PATH)).get(4); - String expectedLine = "Line 5"; - assertEquals(expectedLine, extractedLine); + assertEquals("Line 5", extractedLine); } @Test public void givenLargeFile_whenUsingFilesAPI_thenExtractedLineIsCorrect() throws IOException { try (Stream lines = Files.lines(Paths.get(FILE_PATH))) { String extractedLine = lines.skip(4).findFirst().get(); - String expectedLine = "Line 5"; - assertEquals(expectedLine, extractedLine); + assertEquals("Line 5", extractedLine); } } @Test - public void givenFile_whenUsingFIleUtils_thenExtractedLineIsCorrect() throws IOException { + public void givenFile_whenUsingFileUtils_thenExtractedLineIsCorrect() throws IOException { ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("linesInput.txt").getFile()); List lines = FileUtils.readLines(file, "UTF-8"); String extractedLine = lines.get(0); - String expectedLine = "Line 1"; - assertEquals(expectedLine, extractedLine); + assertEquals("Line 1", extractedLine); } @Test @@ -82,7 +77,6 @@ public class LineAtGivenNumberTest { String fileContent = IOUtils.toString(new FileInputStream(FILE_PATH), StandardCharsets.UTF_8); String extractedLine = fileContent.split(System.lineSeparator())[0]; - String expectedLine = "Line 1"; - assertEquals(expectedLine, extractedLine); + assertEquals("Line 1", extractedLine); } } From 0df340f847429bac5e557da74078ac72a999179d Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Mon, 17 Aug 2020 23:55:43 +0300 Subject: [PATCH 0492/1862] BAEL-4516: Refine examples --- gradle-5/source-sets/.gitignore | 1 + gradle-5/source-sets/build.gradle | 37 ++++++++++++++----- .../com/baeldung/itest/SourceSetsItest.java | 22 ++++++++--- .../com/baeldung/main/SourceSetsObject.java | 21 +++++++++++ gradle-5/source-sets/src/random/Random.java | 0 .../com/baeldung/test/SourceSetsTest.java | 11 +++--- 6 files changed, 71 insertions(+), 21 deletions(-) create mode 100644 gradle-5/source-sets/.gitignore create mode 100644 gradle-5/source-sets/src/main/java/com/baeldung/main/SourceSetsObject.java create mode 100644 gradle-5/source-sets/src/random/Random.java diff --git a/gradle-5/source-sets/.gitignore b/gradle-5/source-sets/.gitignore new file mode 100644 index 0000000000..84c048a73c --- /dev/null +++ b/gradle-5/source-sets/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/gradle-5/source-sets/build.gradle b/gradle-5/source-sets/build.gradle index 47f64aca04..435c54c7a9 100644 --- a/gradle-5/source-sets/build.gradle +++ b/gradle-5/source-sets/build.gradle @@ -27,23 +27,40 @@ task printConfigurationInformation(){ } } -// sourceSets{ +sourceSets{ + itest { + compileClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.main.output + java { + } + } +} -// itest { -// java { -// } -// } -// } +test { + testLogging { + events "passed","skipped", "failed" + } +} + // main { + // java { + // srcDir('src/random') + // } + // } dependencies { implementation('org.apache.httpcomponents:httpclient:4.5.12') testImplementation('junit:junit:4.12') - // itestImplementation('com.google.guava:guava:29.0-jre') + itestImplementation('com.google.guava:guava:29.0-jre') } -// configurations { -// itestImplementation.extendsFrom(testImplementation) -// } +configurations { + itestImplementation.extendsFrom(testImplementation) + itestRuntimeOnly.extendsFrom(t) +} + +task itest(Type: test) { + +} // eclipse { // classpath { diff --git a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java index 7f5d0699a2..6a528a9b9b 100644 --- a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java +++ b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java @@ -3,17 +3,27 @@ package com.baeldung.itest; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -import java.util.List; +//import java.util.List; import org.junit.Test; -import com.google.common.collect.ImmutableList; +import com.baeldung.main.SourceSetsObject; +//import com.google.common.collect.ImmutableList; public class SourceSetsItest { - + @Test - public void whenRunThenFail() { - List someStrings = ImmutableList.of("Baeldung", "is", "cool"); - assertThat(false, is(true)); + public void whenRunThenSuccess() { + + SourceSetsObject underTest = new SourceSetsObject("lorem","ipsum"); + + assertThat(underTest.getUser(), is("lorem")); + assertThat(underTest.getPassword(), is("ipsum")); } + +// @Test +// public void whenRunThenFail() { +// List someStrings = ImmutableList.of("Baeldung", "is", "cool"); +// assertThat(false, is(true)); +// } } diff --git a/gradle-5/source-sets/src/main/java/com/baeldung/main/SourceSetsObject.java b/gradle-5/source-sets/src/main/java/com/baeldung/main/SourceSetsObject.java new file mode 100644 index 0000000000..130121789c --- /dev/null +++ b/gradle-5/source-sets/src/main/java/com/baeldung/main/SourceSetsObject.java @@ -0,0 +1,21 @@ +package com.baeldung.main; + +public class SourceSetsObject { + + private final String user; + private final String password; + + public SourceSetsObject(String user, String password) { + this.user = user; + this.password = password; + } + + public String getPassword() { + return password; + } + + public String getUser() { + return user; + } + +} diff --git a/gradle-5/source-sets/src/random/Random.java b/gradle-5/source-sets/src/random/Random.java new file mode 100644 index 0000000000..e69de29bb2 diff --git a/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java b/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java index 829b6ee36b..4891ffd694 100644 --- a/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java +++ b/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java @@ -3,17 +3,18 @@ package com.baeldung.test; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -import java.util.List; - import org.junit.Test; -import com.google.common.collect.ImmutableList; +import com.baeldung.main.SourceSetsObject; public class SourceSetsTest { @Test public void whenRunThenSuccess() { - List someStrings = ImmutableList.of("Baeldung", "is", "cool"); - assertThat(true, is(true)); + + SourceSetsObject underTest = new SourceSetsObject("lorem","ipsum"); + + assertThat(underTest.getUser(), is("lorem")); + assertThat(underTest.getPassword(), is("ipsum")); } } From 29a7bbe857d9e2240781b1910276c924c778bfe7 Mon Sep 17 00:00:00 2001 From: bfontana Date: Mon, 17 Aug 2020 21:49:49 -0300 Subject: [PATCH 0493/1862] Update SmurfsArchUnitTest.java --- .../java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java index 68a33be69b..9724c2bcae 100644 --- a/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java +++ b/libraries-testing/src/test/java/com/baeldung/archunit/smurfs/SmurfsArchUnitTest.java @@ -1,6 +1,3 @@ -/** - * - */ package com.baeldung.archunit.smurfs; From 4e9ce6e4ccbbf269b87409260c310bab9e6b8bdb Mon Sep 17 00:00:00 2001 From: Trixi Turny Date: Tue, 18 Aug 2020 09:32:12 +0100 Subject: [PATCH 0494/1862] BAEL-4321 yaml config to map in pojo demo --- spring-boot-modules/pom.xml | 1 + .../spring-boot-properties-3/pom.xml | 54 +++++++++++++++++++ .../boot/properties/DemoApplication.java | 16 ++++++ .../properties/config/TshirtSizeConfig.java | 27 ++++++++++ .../controller/TshirtSizeController.java | 21 ++++++++ .../properties/service/SizeConverterImpl.java | 22 ++++++++ .../service/SizeConverterService.java | 8 +++ .../src/main/resources/application.yml | 30 +++++++++++ .../controller/TshirtSizeControllerTest.java | 38 +++++++++++++ 9 files changed, 217 insertions(+) create mode 100644 spring-boot-modules/spring-boot-properties-3/pom.xml create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml create mode 100644 spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index 84f1f0e86c..f4e3e534c8 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -56,6 +56,7 @@ spring-boot-performance spring-boot-properties spring-boot-properties-2 + spring-boot-properties-3 spring-boot-property-exp spring-boot-runtime spring-boot-security diff --git a/spring-boot-modules/spring-boot-properties-3/pom.xml b/spring-boot-modules/spring-boot-properties-3/pom.xml new file mode 100644 index 0000000000..cf94e1fc1d --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + com.baeldung.spring-boot-modules + spring-boot-modules + 1.0.0-SNAPSHOT + ../ + + + spring-boot-properties-3 + 0.0.1-SNAPSHOT + spring-boot-properties-3 + Spring Boot Properties Module + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + org.springframework.boot + spring-boot-starter-web + RELEASE + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java new file mode 100644 index 0000000000..cf2fb7f981 --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/DemoApplication.java @@ -0,0 +1,16 @@ +package com.baeldung.boot.properties; + +import com.baeldung.boot.properties.config.TshirtSizeConfig; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; + +@SpringBootApplication +@EnableConfigurationProperties(TshirtSizeConfig.class) +public class DemoApplication { + + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java new file mode 100644 index 0000000000..690763ab7b --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/config/TshirtSizeConfig.java @@ -0,0 +1,27 @@ +package com.baeldung.boot.properties.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.Map; + +@ConfigurationProperties(prefix = "t-shirt-size") +public class TshirtSizeConfig { + + private final Map simpleMapping; + + private final Map> complexMapping; + + + public TshirtSizeConfig(Map simpleMapping, Map> complexMapping) { + this.simpleMapping = simpleMapping; + this.complexMapping = complexMapping; + } + + public Map getSimpleMapping() { + return simpleMapping; + } + + public Map> getComplexMapping() { + return complexMapping; + } +} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java new file mode 100644 index 0000000000..6b713c5be8 --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/controller/TshirtSizeController.java @@ -0,0 +1,21 @@ +package com.baeldung.boot.properties.controller; + +import org.springframework.web.bind.annotation.*; +import com.baeldung.boot.properties.service.SizeConverterService; + +@RestController +@RequestMapping(value = "/") +public class TshirtSizeController { + + private final SizeConverterService service; + + public TshirtSizeController(SizeConverterService service) { + this.service = service; + } + + @RequestMapping(value ="convertSize", method = RequestMethod.GET) + public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { + return service.convertSize(label, countryCode); + } + +} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java new file mode 100644 index 0000000000..34f7fe2ded --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterImpl.java @@ -0,0 +1,22 @@ +package com.baeldung.boot.properties.service; + +import org.springframework.stereotype.Service; +import com.baeldung.boot.properties.config.TshirtSizeConfig; + + +@Service +public class SizeConverterImpl implements SizeConverterService { + + private final TshirtSizeConfig tshirtSizeConfig; + + public SizeConverterImpl(TshirtSizeConfig tshirtSizeConfig) { + this.tshirtSizeConfig = tshirtSizeConfig; + } + + public int convertSize(String label, String countryCode) { + if(countryCode == null) { + return tshirtSizeConfig.getSimpleMapping().get(label); + } + return tshirtSizeConfig.getComplexMapping().get(label).get(countryCode.toLowerCase()); + } +} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java new file mode 100644 index 0000000000..412199b176 --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/boot/properties/service/SizeConverterService.java @@ -0,0 +1,8 @@ +package com.baeldung.boot.properties.service; + + +public interface SizeConverterService { + + int convertSize(String label, String countryCode); + +} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml new file mode 100644 index 0000000000..8779cb6b0c --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml @@ -0,0 +1,30 @@ + t-shirt-size: + simple-mapping: + XS: 6 + S: 8 + M: 10 + L: 12 + XL: 14 + + + complex-mapping: + XS: + uk: 6 + fr: 34 + us: 2 + S: + uk: 8 + fr: 36 + us: 4 + M: + uk: 10 + fr: 38 + us: 6 + L: + uk: 12 + fr: 40 + us: 8 + XL: + uk: 14 + fr: 42 + us: 10 diff --git a/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java b/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java new file mode 100644 index 0000000000..0b70ed8622 --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/test/java/com/baeldung/boot/properties/controller/TshirtSizeControllerTest.java @@ -0,0 +1,38 @@ +package com.baeldung.boot.properties.controller; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import com.baeldung.boot.properties.service.SizeConverterService; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class TshirtSizeControllerUnitTest { + + @Mock + private SizeConverterService service; + + @InjectMocks + private TshirtSizeController tested; + + @Test + void whenConvertSize_thenOK() { + + // Given + String label = "S"; + String countryCode = "fr"; + int result = 36; + + // When + when(service.convertSize(label, countryCode)).thenReturn(result); + int actual = tested.convertSize(label, countryCode); + + // Then + assertEquals(actual, result); + + } +} \ No newline at end of file From 90e80fd32bb4e20c9db324619d83b9633334394b Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 18 Aug 2020 15:37:27 +0530 Subject: [PATCH 0495/1862] JAVA-69: Renamed spring-security-rest to spring-security-web-rest --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../src/main/java/com/baeldung/errorhandling/ApiError.java | 0 .../baeldung/errorhandling/CustomRestExceptionHandler.java | 0 .../src/main/java/com/baeldung/persistence/model/Foo.java | 0 .../main/java/com/baeldung/security/SecurityJavaConfig.java | 0 .../baeldung/security/SecurityWebApplicationInitializer.java | 0 .../web/MySavedRequestAwareAuthenticationSuccessHandler.java | 0 .../baeldung/security/web/RestAuthenticationEntryPoint.java | 0 .../src/main/java/com/baeldung/spring/ClientWebConfig.java | 0 .../src/main/java/com/baeldung/spring/SecurityXmlConfig.java | 0 .../src/main/java/com/baeldung/spring/WebConfig.java | 0 .../src/main/java/com/baeldung/swagger2/SwaggerConfig.java | 0 .../java/com/baeldung/web/controller/AsyncController.java | 0 .../java/com/baeldung/web/controller/CustomController.java | 0 .../main/java/com/baeldung/web/controller/FooController.java | 0 .../main/java/com/baeldung/web/controller/RootController.java | 0 .../com/baeldung/web/error/CustomAccessDeniedHandler.java | 0 .../web/error/RestResponseEntityExceptionHandler.java | 0 .../baeldung/web/exception/MyResourceNotFoundException.java | 0 .../src/main/java/com/baeldung/web/service/AsyncService.java | 0 .../main/java/com/baeldung/web/service/AsyncServiceImpl.java | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/main/webapp/WEB-INF/api-servlet.xml | 0 .../src/main/webapp/WEB-INF/view/csrfAttacker.jsp | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 .../src/test/java/com/baeldung/errorhandling/FooLiveTest.java | 0 .../java/com/baeldung/web/AsyncControllerIntegrationTest.java | 0 .../src/test/java/com/baeldung/web/SwaggerLiveTest.java | 0 .../src/test/java/com/baeldung/web/TestConfig.java | 0 .../src/test/resources/.gitignore | 0 34 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/.gitignore (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/README.md (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/pom.xml (99%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/errorhandling/ApiError.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/errorhandling/CustomRestExceptionHandler.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/persistence/model/Foo.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/security/SecurityJavaConfig.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/security/web/RestAuthenticationEntryPoint.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/spring/ClientWebConfig.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/spring/SecurityXmlConfig.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/spring/WebConfig.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/swagger2/SwaggerConfig.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/controller/AsyncController.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/controller/CustomController.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/controller/FooController.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/controller/RootController.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/error/CustomAccessDeniedHandler.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/service/AsyncService.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/java/com/baeldung/web/service/AsyncServiceImpl.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/webapp/WEB-INF/api-servlet.xml (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/webapp/WEB-INF/view/csrfAttacker.jsp (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/main/webapp/WEB-INF/web.xml (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/test/java/com/baeldung/errorhandling/FooLiveTest.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/test/java/com/baeldung/web/AsyncControllerIntegrationTest.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/test/java/com/baeldung/web/SwaggerLiveTest.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/test/java/com/baeldung/web/TestConfig.java (100%) rename spring-security-modules/{spring-security-rest => spring-security-web-rest}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/spring-security-rest/.gitignore b/spring-security-modules/spring-security-web-rest/.gitignore similarity index 100% rename from spring-security-modules/spring-security-rest/.gitignore rename to spring-security-modules/spring-security-web-rest/.gitignore diff --git a/spring-security-modules/spring-security-rest/README.md b/spring-security-modules/spring-security-web-rest/README.md similarity index 100% rename from spring-security-modules/spring-security-rest/README.md rename to spring-security-modules/spring-security-web-rest/README.md diff --git a/spring-security-modules/spring-security-rest/pom.xml b/spring-security-modules/spring-security-web-rest/pom.xml similarity index 99% rename from spring-security-modules/spring-security-rest/pom.xml rename to spring-security-modules/spring-security-web-rest/pom.xml index 9410f08378..d2468152da 100644 --- a/spring-security-modules/spring-security-rest/pom.xml +++ b/spring-security-modules/spring-security-web-rest/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-rest + spring-security-web-rest 0.1-SNAPSHOT - spring-security-rest + spring-security-web-rest war diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/ApiError.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/errorhandling/ApiError.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/ApiError.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/errorhandling/ApiError.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/CustomRestExceptionHandler.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/errorhandling/CustomRestExceptionHandler.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/CustomRestExceptionHandler.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/errorhandling/CustomRestExceptionHandler.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/persistence/model/Foo.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/persistence/model/Foo.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/persistence/model/Foo.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityJavaConfig.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/security/SecurityJavaConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityJavaConfig.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/security/SecurityJavaConfig.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/security/web/RestAuthenticationEntryPoint.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/security/web/RestAuthenticationEntryPoint.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/ClientWebConfig.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/ClientWebConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/ClientWebConfig.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/ClientWebConfig.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/SecurityXmlConfig.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/SecurityXmlConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/SecurityXmlConfig.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/SecurityXmlConfig.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/WebConfig.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/WebConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/WebConfig.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/WebConfig.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/swagger2/SwaggerConfig.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/swagger2/SwaggerConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/swagger2/SwaggerConfig.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/swagger2/SwaggerConfig.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/AsyncController.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/controller/AsyncController.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/AsyncController.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/controller/AsyncController.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/CustomController.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/controller/CustomController.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/CustomController.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/controller/CustomController.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/controller/FooController.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/controller/FooController.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/RootController.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/controller/RootController.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/RootController.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/controller/RootController.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/CustomAccessDeniedHandler.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/error/CustomAccessDeniedHandler.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/CustomAccessDeniedHandler.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/error/CustomAccessDeniedHandler.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncService.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/service/AsyncService.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncService.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/service/AsyncService.java diff --git a/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncServiceImpl.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/service/AsyncServiceImpl.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncServiceImpl.java rename to spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/web/service/AsyncServiceImpl.java diff --git a/spring-security-modules/spring-security-rest/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-rest/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-rest/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-rest/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-web-rest/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-web-rest/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml b/spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/api-servlet.xml similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/api-servlet.xml rename to spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/api-servlet.xml diff --git a/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp b/spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp rename to spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/view/csrfAttacker.jsp diff --git a/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/errorhandling/FooLiveTest.java b/spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/errorhandling/FooLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/test/java/com/baeldung/errorhandling/FooLiveTest.java rename to spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/errorhandling/FooLiveTest.java diff --git a/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/AsyncControllerIntegrationTest.java b/spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/web/AsyncControllerIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/AsyncControllerIntegrationTest.java rename to spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/web/AsyncControllerIntegrationTest.java diff --git a/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/SwaggerLiveTest.java b/spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/web/SwaggerLiveTest.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/SwaggerLiveTest.java rename to spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/web/SwaggerLiveTest.java diff --git a/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/TestConfig.java b/spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/web/TestConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/TestConfig.java rename to spring-security-modules/spring-security-web-rest/src/test/java/com/baeldung/web/TestConfig.java diff --git a/spring-security-modules/spring-security-rest/src/test/resources/.gitignore b/spring-security-modules/spring-security-web-rest/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-rest/src/test/resources/.gitignore rename to spring-security-modules/spring-security-web-rest/src/test/resources/.gitignore From 526d66067f50eb52d6c8cac5056e00f98b9b4944 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 18 Aug 2020 15:37:55 +0530 Subject: [PATCH 0496/1862] JAVA-69: Renamed spring-security-rest-basic-auth to spring-security-web-rest-basic-auth --- .../.gitignore | 0 .../README.md | 0 .../pom.xml | 4 ++-- .../com/baeldung/basic/MyBasicAuthenticationEntryPoint.java | 0 .../HttpComponentsClientHttpRequestFactoryBasicAuth.java | 0 .../main/java/com/baeldung/client/RestTemplateFactory.java | 0 .../main/java/com/baeldung/client/spring/ClientConfig.java | 0 .../src/main/java/com/baeldung/filter/CustomFilter.java | 0 .../baeldung/filter/CustomWebSecurityConfigurerAdapter.java | 0 .../MySavedRequestAwareAuthenticationSuccessHandler.java | 0 .../com/baeldung/security/RestAuthenticationEntryPoint.java | 0 .../src/main/java/com/baeldung/spring/SecSecurityConfig.java | 0 .../src/main/java/com/baeldung/spring/WebConfig.java | 0 .../main/java/com/baeldung/web/controller/BarController.java | 0 .../main/java/com/baeldung/web/controller/FooController.java | 0 .../src/main/java/com/baeldung/web/dto/Bar.java | 0 .../src/main/java/com/baeldung/web/dto/Foo.java | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/main/webapp/WEB-INF/api-servlet.xml | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../src/test/java/com/baeldung/SpringContextTest.java | 0 .../src/test/resources/.gitignore | 0 23 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/.gitignore (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/README.md (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/pom.xml (98%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/client/RestTemplateFactory.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/client/spring/ClientConfig.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/filter/CustomFilter.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/filter/CustomWebSecurityConfigurerAdapter.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/spring/SecSecurityConfig.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/spring/WebConfig.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/web/controller/BarController.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/web/controller/FooController.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/web/dto/Bar.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/java/com/baeldung/web/dto/Foo.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/webapp/WEB-INF/api-servlet.xml (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/main/webapp/WEB-INF/web.xml (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-rest-basic-auth => spring-security-web-rest-basic-auth}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/spring-security-rest-basic-auth/.gitignore b/spring-security-modules/spring-security-web-rest-basic-auth/.gitignore similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/.gitignore rename to spring-security-modules/spring-security-web-rest-basic-auth/.gitignore diff --git a/spring-security-modules/spring-security-rest-basic-auth/README.md b/spring-security-modules/spring-security-web-rest-basic-auth/README.md similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/README.md rename to spring-security-modules/spring-security-web-rest-basic-auth/README.md diff --git a/spring-security-modules/spring-security-rest-basic-auth/pom.xml b/spring-security-modules/spring-security-web-rest-basic-auth/pom.xml similarity index 98% rename from spring-security-modules/spring-security-rest-basic-auth/pom.xml rename to spring-security-modules/spring-security-web-rest-basic-auth/pom.xml index 416882b3d4..0dc0b9cc42 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/pom.xml +++ b/spring-security-modules/spring-security-web-rest-basic-auth/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-rest-basic-auth + spring-security-web-rest-basic-auth 0.2-SNAPSHOT - spring-security-rest-basic-auth + spring-security-web-rest-basic-auth war diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/RestTemplateFactory.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/client/RestTemplateFactory.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/RestTemplateFactory.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/client/RestTemplateFactory.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomFilter.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/filter/CustomFilter.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomFilter.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/filter/CustomFilter.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomWebSecurityConfigurerAdapter.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/filter/CustomWebSecurityConfigurerAdapter.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomWebSecurityConfigurerAdapter.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/filter/CustomWebSecurityConfigurerAdapter.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/BarController.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/web/controller/BarController.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/BarController.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/web/controller/BarController.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/web/controller/FooController.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/web/controller/FooController.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Bar.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/web/dto/Bar.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Bar.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/web/dto/Bar.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/web/dto/Foo.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/java/com/baeldung/web/dto/Foo.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/api-servlet.xml b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/webapp/WEB-INF/api-servlet.xml similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/api-servlet.xml rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/webapp/WEB-INF/api-servlet.xml diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-web-rest-basic-auth/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml rename to spring-security-modules/spring-security-web-rest-basic-auth/src/main/webapp/WEB-INF/web.xml diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-rest-basic-auth/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-rest-basic-auth/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/test/resources/.gitignore b/spring-security-modules/spring-security-web-rest-basic-auth/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-rest-basic-auth/src/test/resources/.gitignore rename to spring-security-modules/spring-security-web-rest-basic-auth/src/test/resources/.gitignore From 61dd35dc835df05d441ec84669142b4535b1978c Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 18 Aug 2020 15:38:21 +0530 Subject: [PATCH 0497/1862] JAVA-69: Renamed spring-security-rest-custom to spring-security-web-rest-custom --- .../README.md | 0 .../pom.xml | 4 ++-- .../main/java/com/baeldung/config/MainWebAppInitializer.java | 0 .../java/com/baeldung/config/child/MethodSecurityConfig.java | 0 .../src/main/java/com/baeldung/config/child/WebConfig.java | 0 .../main/java/com/baeldung/config/parent/SecurityConfig.java | 0 .../main/java/com/baeldung/config/parent/ServiceConfig.java | 0 .../main/java/com/baeldung/security/AuthenticationFacade.java | 0 .../com/baeldung/security/CustomAuthenticationProvider.java | 0 .../java/com/baeldung/security/IAuthenticationFacade.java | 0 .../MySavedRequestAwareAuthenticationSuccessHandler.java | 0 .../com/baeldung/security/RestAuthenticationEntryPoint.java | 0 .../src/main/java/com/baeldung/service/FooService.java | 0 .../src/main/java/com/baeldung/service/IFooService.java | 0 .../src/main/java/com/baeldung/service/RunAsService.java | 0 .../main/java/com/baeldung/web/controller/FooController.java | 0 .../web/controller/GetUserWithCustomInterfaceController.java | 0 .../controller/GetUserWithHTTPServletRequestController.java | 0 .../java/com/baeldung/web/controller/RunAsController.java | 0 .../java/com/baeldung/web/controller/SecurityController.java | 0 .../java/com/baeldung/web/controller/SecurityController1.java | 0 .../java/com/baeldung/web/controller/SecurityController3.java | 0 .../main/java/com/baeldung/web/controller/ViewController.java | 0 .../src/main/java/com/baeldung/web/dto/Foo.java | 0 .../src/main/resources/foo.properties | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/prop.xml | 0 .../src/main/resources/webSecurityConfig.xml | 0 .../src/main/webapp/WEB-INF/templates/index.html | 0 .../src/main/webapp/WEB-INF/templates/runas.html | 0 .../src/main/webapp/WEB-INF/web_old.xml | 0 .../src/test/resources/.gitignore | 0 32 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/README.md (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/pom.xml (98%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/config/MainWebAppInitializer.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/config/child/MethodSecurityConfig.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/config/child/WebConfig.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/config/parent/SecurityConfig.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/config/parent/ServiceConfig.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/security/AuthenticationFacade.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/security/CustomAuthenticationProvider.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/security/IAuthenticationFacade.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/service/FooService.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/service/IFooService.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/service/RunAsService.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/controller/FooController.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/controller/GetUserWithCustomInterfaceController.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/controller/GetUserWithHTTPServletRequestController.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/controller/RunAsController.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/controller/SecurityController.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/controller/SecurityController1.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/controller/SecurityController3.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/controller/ViewController.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/java/com/baeldung/web/dto/Foo.java (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/resources/foo.properties (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/resources/prop.xml (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/resources/webSecurityConfig.xml (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/webapp/WEB-INF/templates/index.html (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/webapp/WEB-INF/templates/runas.html (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/main/webapp/WEB-INF/web_old.xml (100%) rename spring-security-modules/{spring-security-rest-custom => spring-security-web-rest-custom}/src/test/resources/.gitignore (100%) diff --git a/spring-security-modules/spring-security-rest-custom/README.md b/spring-security-modules/spring-security-web-rest-custom/README.md similarity index 100% rename from spring-security-modules/spring-security-rest-custom/README.md rename to spring-security-modules/spring-security-web-rest-custom/README.md diff --git a/spring-security-modules/spring-security-rest-custom/pom.xml b/spring-security-modules/spring-security-web-rest-custom/pom.xml similarity index 98% rename from spring-security-modules/spring-security-rest-custom/pom.xml rename to spring-security-modules/spring-security-web-rest-custom/pom.xml index b4f0f93bb6..0ba7f95de7 100644 --- a/spring-security-modules/spring-security-rest-custom/pom.xml +++ b/spring-security-modules/spring-security-web-rest-custom/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-rest-custom + spring-security-web-rest-custom 0.1-SNAPSHOT - spring-security-rest-custom + spring-security-web-rest-custom war diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/MethodSecurityConfig.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/child/MethodSecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/MethodSecurityConfig.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/child/MethodSecurityConfig.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/AuthenticationFacade.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/AuthenticationFacade.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/AuthenticationFacade.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/AuthenticationFacade.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/CustomAuthenticationProvider.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/CustomAuthenticationProvider.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/CustomAuthenticationProvider.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/CustomAuthenticationProvider.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/IAuthenticationFacade.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/IAuthenticationFacade.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/IAuthenticationFacade.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/IAuthenticationFacade.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/FooService.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/service/FooService.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/FooService.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/service/FooService.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/IFooService.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/service/IFooService.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/IFooService.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/service/IFooService.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/RunAsService.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/service/RunAsService.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/RunAsService.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/service/RunAsService.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/FooController.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/FooController.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithCustomInterfaceController.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithCustomInterfaceController.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithCustomInterfaceController.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithCustomInterfaceController.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithHTTPServletRequestController.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithHTTPServletRequestController.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithHTTPServletRequestController.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithHTTPServletRequestController.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/RunAsController.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/RunAsController.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/RunAsController.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/RunAsController.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController1.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController1.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController1.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController1.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController3.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController3.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController3.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController3.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/ViewController.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/ViewController.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/ViewController.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/controller/ViewController.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/dto/Foo.java similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-web-rest-custom/src/main/java/com/baeldung/web/dto/Foo.java diff --git a/spring-security-modules/spring-security-rest-custom/src/main/resources/foo.properties b/spring-security-modules/spring-security-web-rest-custom/src/main/resources/foo.properties similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/resources/foo.properties rename to spring-security-modules/spring-security-web-rest-custom/src/main/resources/foo.properties diff --git a/spring-security-modules/spring-security-rest-custom/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-rest-custom/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-rest-custom/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-rest-custom/src/main/resources/prop.xml b/spring-security-modules/spring-security-web-rest-custom/src/main/resources/prop.xml similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/resources/prop.xml rename to spring-security-modules/spring-security-web-rest-custom/src/main/resources/prop.xml diff --git a/spring-security-modules/spring-security-rest-custom/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-web-rest-custom/src/main/resources/webSecurityConfig.xml similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/resources/webSecurityConfig.xml rename to spring-security-modules/spring-security-web-rest-custom/src/main/resources/webSecurityConfig.xml diff --git a/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/index.html b/spring-security-modules/spring-security-web-rest-custom/src/main/webapp/WEB-INF/templates/index.html similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/index.html rename to spring-security-modules/spring-security-web-rest-custom/src/main/webapp/WEB-INF/templates/index.html diff --git a/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html b/spring-security-modules/spring-security-web-rest-custom/src/main/webapp/WEB-INF/templates/runas.html similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/templates/runas.html rename to spring-security-modules/spring-security-web-rest-custom/src/main/webapp/WEB-INF/templates/runas.html diff --git a/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml b/spring-security-modules/spring-security-web-rest-custom/src/main/webapp/WEB-INF/web_old.xml similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml rename to spring-security-modules/spring-security-web-rest-custom/src/main/webapp/WEB-INF/web_old.xml diff --git a/spring-security-modules/spring-security-rest-custom/src/test/resources/.gitignore b/spring-security-modules/spring-security-web-rest-custom/src/test/resources/.gitignore similarity index 100% rename from spring-security-modules/spring-security-rest-custom/src/test/resources/.gitignore rename to spring-security-modules/spring-security-web-rest-custom/src/test/resources/.gitignore From ec76361474cbe8d4afdd0d06e98c1dfa871d72b6 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 18 Aug 2020 15:38:54 +0530 Subject: [PATCH 0498/1862] JAVA-69: Renamed spring-security-thymeleaf to spring-security-web-thymeleaf --- .../README.MD => spring-security-web-thymeleaf/README.md} | 0 .../pom.xml | 4 ++-- .../springsecuritythymeleaf/SecurityConfiguration.java | 0 .../SpringSecurityThymeleafApplication.java | 0 .../com/baeldung/springsecuritythymeleaf/ViewController.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/templates/index.html | 0 .../src/main/resources/templates/login.html | 0 .../SpringSecurityThymeleafApplicationIntegrationTest.java | 0 .../ViewControllerIntegrationTest.java | 0 11 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/{spring-security-thymeleaf/README.MD => spring-security-web-thymeleaf/README.md} (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/pom.xml (94%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/main/resources/templates/index.html (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/main/resources/templates/login.html (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java (100%) rename spring-security-modules/{spring-security-thymeleaf => spring-security-web-thymeleaf}/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java (100%) diff --git a/spring-security-modules/spring-security-thymeleaf/README.MD b/spring-security-modules/spring-security-web-thymeleaf/README.md similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/README.MD rename to spring-security-modules/spring-security-web-thymeleaf/README.md diff --git a/spring-security-modules/spring-security-thymeleaf/pom.xml b/spring-security-modules/spring-security-web-thymeleaf/pom.xml similarity index 94% rename from spring-security-modules/spring-security-thymeleaf/pom.xml rename to spring-security-modules/spring-security-web-thymeleaf/pom.xml index a4ecbaff21..196ec0b86f 100644 --- a/spring-security-modules/spring-security-thymeleaf/pom.xml +++ b/spring-security-modules/spring-security-web-thymeleaf/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-thymeleaf + spring-security-web-thymeleaf 0.0.1-SNAPSHOT - spring-security-thymeleaf + spring-security-web-thymeleaf jar Spring Security with Thymeleaf tutorial diff --git a/spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java b/spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java rename to spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SecurityConfiguration.java diff --git a/spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java b/spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java rename to spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplication.java diff --git a/spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java b/spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java rename to spring-security-modules/spring-security-web-thymeleaf/src/main/java/com/baeldung/springsecuritythymeleaf/ViewController.java diff --git a/spring-security-modules/spring-security-thymeleaf/src/main/resources/application.properties b/spring-security-modules/spring-security-web-thymeleaf/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/main/resources/application.properties rename to spring-security-modules/spring-security-web-thymeleaf/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-thymeleaf/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-thymeleaf/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-thymeleaf/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/index.html b/spring-security-modules/spring-security-web-thymeleaf/src/main/resources/templates/index.html similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/index.html rename to spring-security-modules/spring-security-web-thymeleaf/src/main/resources/templates/index.html diff --git a/spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/login.html b/spring-security-modules/spring-security-web-thymeleaf/src/main/resources/templates/login.html similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/main/resources/templates/login.html rename to spring-security-modules/spring-security-web-thymeleaf/src/main/resources/templates/login.html diff --git a/spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java b/spring-security-modules/spring-security-web-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java rename to spring-security-modules/spring-security-web-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java diff --git a/spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java b/spring-security-modules/spring-security-web-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java rename to spring-security-modules/spring-security-web-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/ViewControllerIntegrationTest.java From 796b49b348af523baa367a3f3e01b6a9ed66fe3b Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 18 Aug 2020 15:39:46 +0530 Subject: [PATCH 0499/1862] JAVA-69: Renamed spring-security-x509 to spring-security-web-x509 --- .../README.md | 0 .../pom.xml | 8 ++++---- .../spring-security-web-x509-basic-auth}/pom.xml | 6 +++--- .../spring/security/x509/UserController.java | 0 .../security/x509/X509AuthenticationServer.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/templates/user.html | 0 .../test/java/com/baeldung/SpringContextTest.java | 0 .../X509AuthenticationServerIntegrationTest.java | 0 .../spring-security-web-x509-client-auth}/pom.xml | 6 +++--- .../spring/security/x509/UserController.java | 0 .../security/x509/X509AuthenticationServer.java | 0 .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/templates/user.html | 0 .../test/java/com/baeldung/SpringContextTest.java | 0 .../X509AuthenticationServerIntegrationTest.java | 0 .../store/clientBob.p12 | Bin .../store/keystore.jks | Bin .../store/localhost.ext | 0 .../store/rootCA.crt | 0 .../store/truststore.jks | Bin 23 files changed, 10 insertions(+), 10 deletions(-) rename spring-security-modules/{spring-security-x509 => spring-security-web-x509}/README.md (100%) rename spring-security-modules/{spring-security-x509 => spring-security-web-x509}/pom.xml (83%) rename spring-security-modules/{spring-security-x509/spring-security-x509-basic-auth => spring-security-web-x509/spring-security-web-x509-basic-auth}/pom.xml (87%) rename spring-security-modules/{spring-security-x509/spring-security-x509-basic-auth => spring-security-web-x509/spring-security-web-x509-basic-auth}/src/main/java/com/baeldung/spring/security/x509/UserController.java (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-basic-auth => spring-security-web-x509/spring-security-web-x509-basic-auth}/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-basic-auth => spring-security-web-x509/spring-security-web-x509-basic-auth}/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-basic-auth => spring-security-web-x509/spring-security-web-x509-basic-auth}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-basic-auth => spring-security-web-x509/spring-security-web-x509-basic-auth}/src/main/resources/templates/user.html (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-basic-auth => spring-security-web-x509/spring-security-web-x509-basic-auth}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-basic-auth => spring-security-web-x509/spring-security-web-x509-basic-auth}/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-client-auth => spring-security-web-x509/spring-security-web-x509-client-auth}/pom.xml (94%) rename spring-security-modules/{spring-security-x509/spring-security-x509-client-auth => spring-security-web-x509/spring-security-web-x509-client-auth}/src/main/java/com/baeldung/spring/security/x509/UserController.java (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-client-auth => spring-security-web-x509/spring-security-web-x509-client-auth}/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-client-auth => spring-security-web-x509/spring-security-web-x509-client-auth}/src/main/resources/application.properties (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-client-auth => spring-security-web-x509/spring-security-web-x509-client-auth}/src/main/resources/logback.xml (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-client-auth => spring-security-web-x509/spring-security-web-x509-client-auth}/src/main/resources/templates/user.html (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-client-auth => spring-security-web-x509/spring-security-web-x509-client-auth}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename spring-security-modules/{spring-security-x509/spring-security-x509-client-auth => spring-security-web-x509/spring-security-web-x509-client-auth}/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java (100%) rename spring-security-modules/{spring-security-x509 => spring-security-web-x509}/store/clientBob.p12 (100%) rename spring-security-modules/{spring-security-x509 => spring-security-web-x509}/store/keystore.jks (100%) rename spring-security-modules/{spring-security-x509 => spring-security-web-x509}/store/localhost.ext (100%) rename spring-security-modules/{spring-security-x509 => spring-security-web-x509}/store/rootCA.crt (100%) rename spring-security-modules/{spring-security-x509 => spring-security-web-x509}/store/truststore.jks (100%) diff --git a/spring-security-modules/spring-security-x509/README.md b/spring-security-modules/spring-security-web-x509/README.md similarity index 100% rename from spring-security-modules/spring-security-x509/README.md rename to spring-security-modules/spring-security-web-x509/README.md diff --git a/spring-security-modules/spring-security-x509/pom.xml b/spring-security-modules/spring-security-web-x509/pom.xml similarity index 83% rename from spring-security-modules/spring-security-x509/pom.xml rename to spring-security-modules/spring-security-web-x509/pom.xml index d4132f058d..045c0aba6a 100644 --- a/spring-security-modules/spring-security-x509/pom.xml +++ b/spring-security-modules/spring-security-web-x509/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-security-x509 + spring-security-web-x509 0.0.1-SNAPSHOT - spring-security-x509 + spring-security-web-x509 pom @@ -15,8 +15,8 @@ - spring-security-x509-basic-auth - spring-security-x509-client-auth + spring-security-web-x509-basic-auth + spring-security-web-x509-client-auth diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/pom.xml b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/pom.xml similarity index 87% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/pom.xml rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/pom.xml index 3cff638894..917ffa6b0e 100644 --- a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/pom.xml +++ b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/pom.xml @@ -2,15 +2,15 @@ 4.0.0 - spring-security-x509-basic-auth + spring-security-web-x509-basic-auth 0.0.1-SNAPSHOT - spring-security-x509-basic-auth + spring-security-web-x509-basic-auth jar Spring x.509 Authentication Demo com.baeldung - spring-security-x509 + spring-security-web-x509 0.0.1-SNAPSHOT diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/application.properties b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/application.properties rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/templates/user.html b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/resources/templates/user.html similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/main/resources/templates/user.html rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/main/resources/templates/user.html diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-basic-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/pom.xml b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/pom.xml similarity index 94% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/pom.xml rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/pom.xml index 3a39f6af67..fdbc90c0f6 100644 --- a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/pom.xml +++ b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/pom.xml @@ -2,15 +2,15 @@ 4.0.0 - spring-security-x509-client-auth + spring-security-web-x509-client-auth 0.0.1-SNAPSHOT - spring-security-x509-client-auth + spring-security-web-x509-client-auth jar Spring x.509 Client Authentication Demo com.baeldung - spring-security-x509 + spring-security-web-x509 0.0.1-SNAPSHOT diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/UserController.java diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/java/com/baeldung/spring/security/x509/X509AuthenticationServer.java diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/application.properties b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/resources/application.properties similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/application.properties rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/resources/application.properties diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/resources/logback.xml similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/logback.xml rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/resources/logback.xml diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/templates/user.html b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/resources/templates/user.html similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/main/resources/templates/user.html rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/main/resources/templates/user.html diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java b/spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java similarity index 100% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java rename to spring-security-modules/spring-security-web-x509/spring-security-web-x509-client-auth/src/test/java/com/baeldung/spring/security/x509/X509AuthenticationServerIntegrationTest.java diff --git a/spring-security-modules/spring-security-x509/store/clientBob.p12 b/spring-security-modules/spring-security-web-x509/store/clientBob.p12 similarity index 100% rename from spring-security-modules/spring-security-x509/store/clientBob.p12 rename to spring-security-modules/spring-security-web-x509/store/clientBob.p12 diff --git a/spring-security-modules/spring-security-x509/store/keystore.jks b/spring-security-modules/spring-security-web-x509/store/keystore.jks similarity index 100% rename from spring-security-modules/spring-security-x509/store/keystore.jks rename to spring-security-modules/spring-security-web-x509/store/keystore.jks diff --git a/spring-security-modules/spring-security-x509/store/localhost.ext b/spring-security-modules/spring-security-web-x509/store/localhost.ext similarity index 100% rename from spring-security-modules/spring-security-x509/store/localhost.ext rename to spring-security-modules/spring-security-web-x509/store/localhost.ext diff --git a/spring-security-modules/spring-security-x509/store/rootCA.crt b/spring-security-modules/spring-security-web-x509/store/rootCA.crt similarity index 100% rename from spring-security-modules/spring-security-x509/store/rootCA.crt rename to spring-security-modules/spring-security-web-x509/store/rootCA.crt diff --git a/spring-security-modules/spring-security-x509/store/truststore.jks b/spring-security-modules/spring-security-web-x509/store/truststore.jks similarity index 100% rename from spring-security-modules/spring-security-x509/store/truststore.jks rename to spring-security-modules/spring-security-web-x509/store/truststore.jks From 7e6ddf0e4848d569cf4ca115d52414f02a7fe8fa Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 18 Aug 2020 15:40:29 +0530 Subject: [PATCH 0500/1862] JAVA-69: parent module changes as per child module renaming --- spring-security-modules/pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index 815b84d448..b68138964b 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -32,12 +32,12 @@ spring-security-oidc spring-security-okta spring-security-web-react - spring-security-rest - spring-security-rest-basic-auth - spring-security-rest-custom + spring-security-web-rest + spring-security-web-rest-basic-auth + spring-security-web-rest-custom spring-security-oauth2-sso - spring-security-thymeleaf - spring-security-x509 + spring-security-web-thymeleaf + spring-security-web-x509 spring-security-kotlin-dsl From eb9dd3bf5c02504a934a661841c0381a264ff48e Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Tue, 18 Aug 2020 15:43:55 +0530 Subject: [PATCH 0501/1862] JAVA-69: README updates --- .../spring-security-web-rest-basic-auth/README.md | 2 +- .../spring-security-web-rest-custom/README.md | 2 +- spring-security-modules/spring-security-web-rest/README.md | 2 +- spring-security-modules/spring-security-web-thymeleaf/README.md | 2 +- spring-security-modules/spring-security-web-x509/README.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-security-modules/spring-security-web-rest-basic-auth/README.md b/spring-security-modules/spring-security-web-rest-basic-auth/README.md index af6dd598cc..97f682acd3 100644 --- a/spring-security-modules/spring-security-web-rest-basic-auth/README.md +++ b/spring-security-modules/spring-security-web-rest-basic-auth/README.md @@ -1,4 +1,4 @@ -## Spring Security REST Basic Authentication +## Spring Security Web - REST Basic Authentication This module contains articles about basic authentication in RESTful APIs with Spring Security diff --git a/spring-security-modules/spring-security-web-rest-custom/README.md b/spring-security-modules/spring-security-web-rest-custom/README.md index be360e035e..09b795c4b8 100644 --- a/spring-security-modules/spring-security-web-rest-custom/README.md +++ b/spring-security-modules/spring-security-web-rest-custom/README.md @@ -1,4 +1,4 @@ -## Spring Security REST Custom +## Spring Security Web - REST Custom This module contains articles about REST APIs with Spring Security diff --git a/spring-security-modules/spring-security-web-rest/README.md b/spring-security-modules/spring-security-web-rest/README.md index 26c101d32c..c13668798d 100644 --- a/spring-security-modules/spring-security-web-rest/README.md +++ b/spring-security-modules/spring-security-web-rest/README.md @@ -1,4 +1,4 @@ -## Spring Security REST +## Spring Security Web - REST This module contains articles about REST APIs with Spring Security diff --git a/spring-security-modules/spring-security-web-thymeleaf/README.md b/spring-security-modules/spring-security-web-thymeleaf/README.md index e0fca4067c..bb3281fa24 100644 --- a/spring-security-modules/spring-security-web-thymeleaf/README.md +++ b/spring-security-modules/spring-security-web-thymeleaf/README.md @@ -1,4 +1,4 @@ -## Spring Security Thymeleaf +## Spring Security Web - Thymeleaf This module contains articles about Spring Security with Thymeleaf. diff --git a/spring-security-modules/spring-security-web-x509/README.md b/spring-security-modules/spring-security-web-x509/README.md index da431d862c..5fd63c0307 100644 --- a/spring-security-modules/spring-security-web-x509/README.md +++ b/spring-security-modules/spring-security-web-x509/README.md @@ -1,4 +1,4 @@ -## Spring Security X.509 +## Spring Security Web - X.509 This module contains articles about X.509 authentication with Spring Security From afd00056a27667333500e812d782e414c11af146 Mon Sep 17 00:00:00 2001 From: Maiklins Date: Tue, 18 Aug 2020 13:46:29 +0200 Subject: [PATCH 0502/1862] Java-1457 Reduce logging - Modules jgit, libraries-testing (#9884) * Java-1457 Reduce logging - Modules jgit, libraries-testing * Java-1457 Reduce logging - Modules jgit, libraries-testing Co-authored-by: mikr --- .../com/baeldung/jgit/porcelain/AddFile.java | 6 ++++- .../baeldung/jgit/porcelain/CommitAll.java | 6 ++++- .../jgit/porcelain/CreateAndDeleteTag.java | 10 +++++--- .../java/com/baeldung/jgit/porcelain/Log.java | 25 +++++++++++-------- .../jgit/porcelain/PorcelainUnitTest.java | 5 ++-- .../src/test/resources/logback.xml | 5 ++++ 6 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 libraries-testing/src/test/resources/logback.xml diff --git a/jgit/src/main/java/com/baeldung/jgit/porcelain/AddFile.java b/jgit/src/main/java/com/baeldung/jgit/porcelain/AddFile.java index 314366f08c..e6b5dc1afc 100644 --- a/jgit/src/main/java/com/baeldung/jgit/porcelain/AddFile.java +++ b/jgit/src/main/java/com/baeldung/jgit/porcelain/AddFile.java @@ -6,6 +6,8 @@ import com.baeldung.jgit.helper.Helper; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.Repository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Simple snippet which shows how to add a file to the index @@ -14,6 +16,8 @@ import org.eclipse.jgit.lib.Repository; */ public class AddFile { + private static final Logger logger = LoggerFactory.getLogger(AddFile.class); + public static void main(String[] args) throws IOException, GitAPIException { // prepare a new test-repository try (Repository repository = Helper.createNewRepository()) { @@ -29,7 +33,7 @@ public class AddFile { .addFilepattern("testfile") .call(); - System.out.println("Added file " + myfile + " to repository at " + repository.getDirectory()); + logger.debug("Added file " + myfile + " to repository at " + repository.getDirectory()); } } } diff --git a/jgit/src/main/java/com/baeldung/jgit/porcelain/CommitAll.java b/jgit/src/main/java/com/baeldung/jgit/porcelain/CommitAll.java index 4c0956ebf8..a2d071f392 100644 --- a/jgit/src/main/java/com/baeldung/jgit/porcelain/CommitAll.java +++ b/jgit/src/main/java/com/baeldung/jgit/porcelain/CommitAll.java @@ -7,6 +7,8 @@ import com.baeldung.jgit.helper.Helper; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.Repository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Simple snippet which shows how to commit all files @@ -15,6 +17,8 @@ import org.eclipse.jgit.lib.Repository; */ public class CommitAll { + private static final Logger logger = LoggerFactory.getLogger(CommitAll.class); + public static void main(String[] args) throws IOException, GitAPIException { // prepare a new test-repository try (Repository repository = Helper.createNewRepository()) { @@ -44,7 +48,7 @@ public class CommitAll { .call(); - System.out.println("Committed all changes to repository at " + repository.getDirectory()); + logger.debug("Committed all changes to repository at " + repository.getDirectory()); } } } diff --git a/jgit/src/main/java/com/baeldung/jgit/porcelain/CreateAndDeleteTag.java b/jgit/src/main/java/com/baeldung/jgit/porcelain/CreateAndDeleteTag.java index 0f735daf8c..e7b0e424e2 100644 --- a/jgit/src/main/java/com/baeldung/jgit/porcelain/CreateAndDeleteTag.java +++ b/jgit/src/main/java/com/baeldung/jgit/porcelain/CreateAndDeleteTag.java @@ -9,6 +9,8 @@ import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Simple snippet which shows how to create a tag @@ -17,6 +19,8 @@ import org.eclipse.jgit.revwalk.RevWalk; */ public class CreateAndDeleteTag { + private static final Logger logger = LoggerFactory.getLogger(CreateAndDeleteTag.class); + public static void main(String[] args) throws IOException, GitAPIException { // prepare test-repository try (Repository repository = Helper.openJGitRepository()) { @@ -26,7 +30,7 @@ public class CreateAndDeleteTag { // set it on the current HEAD Ref tag = git.tag().setName("tag_for_testing").call(); - System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); + logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); // remove the tag again git.tagDelete().setTags("tag_for_testing").call(); @@ -36,14 +40,14 @@ public class CreateAndDeleteTag { try (RevWalk walk = new RevWalk(repository)) { RevCommit commit = walk.parseCommit(id); tag = git.tag().setObjectId(commit).setName("tag_for_testing").call(); - System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); + logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); // remove the tag again git.tagDelete().setTags("tag_for_testing").call(); // create an annotated tag tag = git.tag().setName("tag_for_testing").setAnnotated(true).call(); - System.out.println("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); + logger.debug("Created/moved tag " + tag + " to repository at " + repository.getDirectory()); // remove the tag again git.tagDelete().setTags("tag_for_testing").call(); diff --git a/jgit/src/main/java/com/baeldung/jgit/porcelain/Log.java b/jgit/src/main/java/com/baeldung/jgit/porcelain/Log.java index a50028a9ae..fba8a82962 100644 --- a/jgit/src/main/java/com/baeldung/jgit/porcelain/Log.java +++ b/jgit/src/main/java/com/baeldung/jgit/porcelain/Log.java @@ -7,6 +7,9 @@ import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Simple snippet which shows how to get the commit-ids for a file to provide log information. * @@ -14,6 +17,8 @@ import org.eclipse.jgit.revwalk.RevCommit; */ public class Log { + private static final Logger logger = LoggerFactory.getLogger(Log.class); + @SuppressWarnings("unused") public static void main(String[] args) throws IOException, GitAPIException { try (Repository repository = Helper.openJGitRepository()) { @@ -22,30 +27,30 @@ public class Log { .call(); int count = 0; for (RevCommit rev : logs) { - //System.out.println("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); + logger.trace("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); count++; } - System.out.println("Had " + count + " commits overall on current branch"); + logger.debug("Had " + count + " commits overall on current branch"); logs = git.log() .add(repository.resolve(git.getRepository().getFullBranch())) .call(); count = 0; for (RevCommit rev : logs) { - System.out.println("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); + logger.trace("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); count++; } - System.out.println("Had " + count + " commits overall on "+git.getRepository().getFullBranch()); + logger.debug("Had " + count + " commits overall on "+git.getRepository().getFullBranch()); logs = git.log() .all() .call(); count = 0; for (RevCommit rev : logs) { - //System.out.println("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); + logger.trace("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); count++; } - System.out.println("Had " + count + " commits overall in repository"); + logger.debug("Had " + count + " commits overall in repository"); logs = git.log() // for all log.all() @@ -53,10 +58,10 @@ public class Log { .call(); count = 0; for (RevCommit rev : logs) { - //System.out.println("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); + logger.trace("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); count++; } - System.out.println("Had " + count + " commits on README.md"); + logger.debug("Had " + count + " commits on README.md"); logs = git.log() // for all log.all() @@ -64,10 +69,10 @@ public class Log { .call(); count = 0; for (RevCommit rev : logs) { - //System.out.println("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); + logger.trace("Commit: " + rev /* + ", name: " + rev.getName() + ", id: " + rev.getId().getName() */); count++; } - System.out.println("Had " + count + " commits on pom.xml"); + logger.debug("Had " + count + " commits on pom.xml"); } } } diff --git a/jgit/src/test/java/com/baeldung/jgit/porcelain/PorcelainUnitTest.java b/jgit/src/test/java/com/baeldung/jgit/porcelain/PorcelainUnitTest.java index d3b3358664..842705e6ac 100644 --- a/jgit/src/test/java/com/baeldung/jgit/porcelain/PorcelainUnitTest.java +++ b/jgit/src/test/java/com/baeldung/jgit/porcelain/PorcelainUnitTest.java @@ -11,7 +11,8 @@ public class PorcelainUnitTest { CommitAll.main(null); CreateAndDeleteTag.main(null); - - Log.main(null); + + Log.main(null); + } } diff --git a/libraries-testing/src/test/resources/logback.xml b/libraries-testing/src/test/resources/logback.xml new file mode 100644 index 0000000000..95160412c3 --- /dev/null +++ b/libraries-testing/src/test/resources/logback.xml @@ -0,0 +1,5 @@ + + + + + From 1ed8b7a2bfa2fd4f67139e9771d725ad98a7fc67 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 18 Aug 2020 16:12:35 +0200 Subject: [PATCH 0503/1862] BAEL-4430: Update the email regexp pattern (#9893) --- .../src/main/java/com/baeldung/swagger2boot/model/User.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java index b724031536..339e85e0d4 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java +++ b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/model/User.java @@ -20,7 +20,7 @@ public class User { @Max(value = 65, message = "Age should not be greater than 65") private int age; - @Email(regexp=".@.\\..*", message = "Email should be valid") + @Email(regexp=".*@.*\\..*", message = "Email should be valid") private String email; public Long getId() { From 92d27d387612f29fbe6df99bbc9f6c55411c6f0d Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Tue, 18 Aug 2020 21:52:30 +0300 Subject: [PATCH 0504/1862] BAEL-4516: Cleanup sources --- gradle-5/build.gradle | 10 ++--- .../gradle/wrapper/gradle-wrapper.properties | 2 +- gradle-5/source-sets/build.gradle | 37 +++++++++---------- .../com/baeldung/itest/SourceSetsItest.java | 22 ++++++----- gradle-5/source-sets/src/random/Random.java | 0 5 files changed, 36 insertions(+), 35 deletions(-) delete mode 100644 gradle-5/source-sets/src/random/Random.java diff --git a/gradle-5/build.gradle b/gradle-5/build.gradle index 84cf05bad6..a40afb7024 100644 --- a/gradle-5/build.gradle +++ b/gradle-5/build.gradle @@ -5,11 +5,11 @@ plugins{ description = "Gradle 5 root project" allprojects { apply plugin :"java" - apply plugin :"nebula.lint" - gradleLint { - rules=['unused-dependency'] - reportFormat = 'text' - } + // apply plugin :"nebula.lint" + // gradleLint { + // rules=['unused-dependency'] + // reportFormat = 'text' + // } group = "com.baeldung" version = "0.0.1" sourceCompatibility = "1.8" diff --git a/gradle-5/gradle/wrapper/gradle-wrapper.properties b/gradle-5/gradle/wrapper/gradle-wrapper.properties index 4c46317507..0b7ed8da04 100644 --- a/gradle-5/gradle/wrapper/gradle-wrapper.properties +++ b/gradle-5/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip diff --git a/gradle-5/source-sets/build.gradle b/gradle-5/source-sets/build.gradle index 435c54c7a9..d7d3f18df3 100644 --- a/gradle-5/source-sets/build.gradle +++ b/gradle-5/source-sets/build.gradle @@ -1,10 +1,12 @@ -apply plugin: "eclipse" +// apply plugin: "eclipse" apply plugin: "java" description = "Source Sets example" task printSourceSetInformation(){ + description = "Print source set information" + doLast{ sourceSets.each { srcSet -> println "["+srcSet.name+"]" @@ -19,14 +21,6 @@ task printSourceSetInformation(){ } } -task printConfigurationInformation(){ - doLast{ - configurations.each { config -> - println "["+config.name+"]" - } - } -} - sourceSets{ itest { compileClasspath += sourceSets.main.output @@ -42,26 +36,31 @@ test { } } - // main { - // java { - // srcDir('src/random') - // } - // } dependencies { implementation('org.apache.httpcomponents:httpclient:4.5.12') testImplementation('junit:junit:4.12') itestImplementation('com.google.guava:guava:29.0-jre') } -configurations { - itestImplementation.extendsFrom(testImplementation) - itestRuntimeOnly.extendsFrom(t) +task itest(type: Test) { + description = "Run integration tests" + group = "verification" + testClassesDirs = sourceSets.itest.output.classesDirs + classpath = sourceSets.itest.runtimeClasspath } -task itest(Type: test) { - +itest { + testLogging { + events "passed","skipped", "failed" + } } +configurations { + itestImplementation.extendsFrom(testImplementation) + itestRuntimeOnly.extendsFrom(testRuntimeOnly) +} + + // eclipse { // classpath { // plusConfigurations+=[configurations.itestCompileClasspath] diff --git a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java index 6a528a9b9b..fea54574d6 100644 --- a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java +++ b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java @@ -3,27 +3,29 @@ package com.baeldung.itest; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -//import java.util.List; +import java.util.List; import org.junit.Test; import com.baeldung.main.SourceSetsObject; -//import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableList; public class SourceSetsItest { - + @Test public void whenRunThenSuccess() { - SourceSetsObject underTest = new SourceSetsObject("lorem","ipsum"); + SourceSetsObject underTest = new SourceSetsObject("lorem", "ipsum"); assertThat(underTest.getUser(), is("lorem")); assertThat(underTest.getPassword(), is("ipsum")); } - -// @Test -// public void whenRunThenFail() { -// List someStrings = ImmutableList.of("Baeldung", "is", "cool"); -// assertThat(false, is(true)); -// } + + @Test + public void givenImmutableListwhenRunThenSuccess() { + + List someStrings = ImmutableList.of("Baeldung", "is", "cool"); + + assertThat(someStrings.size(), is(3)); + } } diff --git a/gradle-5/source-sets/src/random/Random.java b/gradle-5/source-sets/src/random/Random.java deleted file mode 100644 index e69de29bb2..0000000000 From 1acfa2eabf78228d81bd84dd9d947eb739a28224 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 19 Aug 2020 10:26:34 +0200 Subject: [PATCH 0505/1862] JAVA-2305: Fix merge --- .../com/baeldung/spring/session/SessionConfig.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 spring-session/spring-session-redis/src/main/java/com/baeldung/spring/session/SessionConfig.java diff --git a/spring-session/spring-session-redis/src/main/java/com/baeldung/spring/session/SessionConfig.java b/spring-session/spring-session-redis/src/main/java/com/baeldung/spring/session/SessionConfig.java new file mode 100644 index 0000000000..5a9bc9ff28 --- /dev/null +++ b/spring-session/spring-session-redis/src/main/java/com/baeldung/spring/session/SessionConfig.java @@ -0,0 +1,10 @@ +package com.baeldung.spring.session; + +import org.springframework.context.annotation.Configuration; +import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer; + +@Configuration +@EnableRedisHttpSession +public class SessionConfig extends AbstractHttpSessionApplicationInitializer { +} From 090404a08be19d7c323bb0fc74dbc6b695c5ee98 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Wed, 19 Aug 2020 13:13:46 +0430 Subject: [PATCH 0506/1862] Added Tests --- .../health/CustomStatusCodeMapper.java | 4 +++ .../health/RandomHealthIndicator.java | 2 ++ .../health/WarningHealthIndicator.java | 14 ++++++++++ .../src/main/resources/application.properties | 4 +-- ...dRandomHealthIndicatorIntegrationTest.java | 26 +++++++++++++++++++ .../RandomHealthIndicatorIntegrationTest.java | 26 +++++++++++++++++++ ...WarningHealthIndicatorIntegrationTest.java | 26 +++++++++++++++++++ 7 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/WarningHealthIndicator.java create mode 100644 spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/DisabledRandomHealthIndicatorIntegrationTest.java create mode 100644 spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/RandomHealthIndicatorIntegrationTest.java create mode 100644 spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/WarningHealthIndicatorIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/CustomStatusCodeMapper.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/CustomStatusCodeMapper.java index 0ff6773240..483c21dfc1 100644 --- a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/CustomStatusCodeMapper.java +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/CustomStatusCodeMapper.java @@ -21,6 +21,10 @@ public class CustomStatusCodeMapper implements HttpCodeStatusMapper { return 500; } + if (status.getCode().equals("WARNING")) { + return 500; + } + return 200; } } diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/RandomHealthIndicator.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/RandomHealthIndicator.java index 958f173458..d8b27c7865 100644 --- a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/RandomHealthIndicator.java +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/RandomHealthIndicator.java @@ -1,5 +1,6 @@ package com.baeldung.health; +import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.stereotype.Component; @@ -9,6 +10,7 @@ import java.util.Map; import java.util.concurrent.ThreadLocalRandom; @Component +@ConditionalOnEnabledHealthIndicator("random") public class RandomHealthIndicator implements HealthIndicator { @Override diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/WarningHealthIndicator.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/WarningHealthIndicator.java new file mode 100644 index 0000000000..d978d90339 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/health/WarningHealthIndicator.java @@ -0,0 +1,14 @@ +package com.baeldung.health; + +import org.springframework.boot.actuate.health.Health; +import org.springframework.boot.actuate.health.HealthIndicator; +import org.springframework.stereotype.Component; + +@Component +public class WarningHealthIndicator implements HealthIndicator { + + @Override + public Health health() { + return Health.status("WARNING").build(); + } +} diff --git a/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties b/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties index 290221b731..27dba985b8 100644 --- a/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties @@ -1,5 +1,5 @@ management.health.probes.enabled=true management.endpoint.health.show-details=always -management.health.random.enabled=false management.endpoint.health.status.http-mapping.down=500 -management.endpoint.health.status.http-mapping.out_of_service=503 \ No newline at end of file +management.endpoint.health.status.http-mapping.out_of_service=503 +management.endpoint.health.status.http-mapping.warning=500 \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/DisabledRandomHealthIndicatorIntegrationTest.java b/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/DisabledRandomHealthIndicatorIntegrationTest.java new file mode 100644 index 0000000000..b69e7fd1f8 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/DisabledRandomHealthIndicatorIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.health; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.web.servlet.MockMvc; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@SpringBootTest +@AutoConfigureMockMvc +@TestPropertySource(properties = "management.health.random.enabled=false") +class DisabledRandomHealthIndicatorIntegrationTest { + + @Autowired + private MockMvc mockMvc; + + @Test + void givenADisabledIndicator_whenSendingRequest_thenReturns404() throws Exception { + mockMvc.perform(get("/actuator/health/random")) + .andExpect(status().isNotFound()); + } +} diff --git a/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/RandomHealthIndicatorIntegrationTest.java b/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/RandomHealthIndicatorIntegrationTest.java new file mode 100644 index 0000000000..dba38d4da3 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/RandomHealthIndicatorIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.health; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.web.servlet.MockMvc; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; + +@SpringBootTest +@AutoConfigureMockMvc +class RandomHealthIndicatorIntegrationTest { + + @Autowired + private MockMvc mockMvc; + + @Test + void givenRandomIndicator_whenCallingTheAPI_thenReturnsExpectedDetails() throws Exception { + mockMvc.perform(get("/actuator/health/random")) + .andExpect(jsonPath("$.status").exists()) + .andExpect(jsonPath("$.details.strategy").value("thread-local")) + .andExpect(jsonPath("$.details.chance").exists()); + } +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/WarningHealthIndicatorIntegrationTest.java b/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/WarningHealthIndicatorIntegrationTest.java new file mode 100644 index 0000000000..60d11a00c7 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/test/java/com/baeldung/health/WarningHealthIndicatorIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.health; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.web.servlet.MockMvc; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@SpringBootTest +@AutoConfigureMockMvc +class WarningHealthIndicatorIntegrationTest { + + @Autowired + private MockMvc mockMvc; + + @Test + void givenCustomMapping_whenCallingTheAPI_thenTheStatusCodeIsAsExpected() throws Exception { + mockMvc.perform(get("/actuator/health/warning")) + .andExpect(jsonPath("$.status").value("WARNING")) + .andExpect(status().isInternalServerError()); + } +} \ No newline at end of file From 3bfaf7a5563f9faf803672ab01e38f5a23298aca Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Wed, 19 Aug 2020 06:30:51 -0500 Subject: [PATCH 0507/1862] BAEL-4387 Fix method name --- .../ArrayToListConversion.java} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename java-collections-conversions-2/src/test/java/com/baeldung/{arrayconvertion/ArrayToListConvertion.java => arrayconversion/ArrayToListConversion.java} (79%) diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconvertion/ArrayToListConvertion.java b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java similarity index 79% rename from java-collections-conversions-2/src/test/java/com/baeldung/arrayconvertion/ArrayToListConvertion.java rename to java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java index f0f3fda42e..33927286c2 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconvertion/ArrayToListConvertion.java +++ b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java @@ -1,4 +1,4 @@ -package com.baeldung.arrayconvertion; +package com.baeldung.arrayconversion; import org.junit.Test; @@ -6,10 +6,10 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class ArrayToListConvertion { +public class ArrayToListConversion { @Test(expected = UnsupportedOperationException.class) - public void givenAnArray_whenConvertToList_returnUnmodifiableList() { + public void givenAnArray_whenConvertingToList_returnUnmodifiableList() { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = Arrays.asList(stringArray); System.out.println(stringList); @@ -20,7 +20,7 @@ public class ArrayToListConvertion { } @Test - public void givenAnArray_whenConvertToList_returnModifiableList() { + public void givenAnArray_whenConvertingToList_returnModifiableList() { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = new ArrayList<>(Arrays.asList(stringArray)); System.out.println(stringList); From bd0a7a2822130409a619c391d25d6051d93b33a3 Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Wed, 19 Aug 2020 06:34:26 -0500 Subject: [PATCH 0508/1862] BAEL-4387 Improve method naming --- .../com/baeldung/arrayconversion/ArrayToListConversion.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java index 33927286c2..09641cd1d5 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java +++ b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java @@ -9,7 +9,7 @@ import java.util.List; public class ArrayToListConversion { @Test(expected = UnsupportedOperationException.class) - public void givenAnArray_whenConvertingToList_returnUnmodifiableList() { + public void givenAnArray_whenConvertingToList_returnUnmodifiableListUnitTest() { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = Arrays.asList(stringArray); System.out.println(stringList); @@ -20,7 +20,7 @@ public class ArrayToListConversion { } @Test - public void givenAnArray_whenConvertingToList_returnModifiableList() { + public void givenAnArray_whenConvertingToList_returnModifiableListUnitTest() { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = new ArrayList<>(Arrays.asList(stringArray)); System.out.println(stringList); From 00e8b70870c36e923b0229367c200a14ab396103 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Wed, 19 Aug 2020 14:14:05 +0200 Subject: [PATCH 0509/1862] BAEL-4571: Remove redundant configuration (#9895) --- .../com/baeldung/spring/session/SessionConfig.java | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 spring-session/spring-session-redis/src/main/java/com/baeldung/spring/session/SessionConfig.java diff --git a/spring-session/spring-session-redis/src/main/java/com/baeldung/spring/session/SessionConfig.java b/spring-session/spring-session-redis/src/main/java/com/baeldung/spring/session/SessionConfig.java deleted file mode 100644 index 5a9bc9ff28..0000000000 --- a/spring-session/spring-session-redis/src/main/java/com/baeldung/spring/session/SessionConfig.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.spring.session; - -import org.springframework.context.annotation.Configuration; -import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; -import org.springframework.session.web.context.AbstractHttpSessionApplicationInitializer; - -@Configuration -@EnableRedisHttpSession -public class SessionConfig extends AbstractHttpSessionApplicationInitializer { -} From c9e9ff79e9d13edd04a2b61be2a972c3c074b475 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Wed, 19 Aug 2020 14:27:29 +0200 Subject: [PATCH 0510/1862] BAEL-3722: Sync article and the code (#9897) --- .../src/main/java/com/baeldung/java8/lambda/tips/Bar.java | 7 +++++-- .../src/main/java/com/baeldung/java8/lambda/tips/Baz.java | 8 ++++++-- .../java/com/baeldung/java8/lambda/tips/FooExtended.java | 5 ++--- .../tips/Java8FunctionalInteracesLambdasUnitTest.java | 4 ++-- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Bar.java b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Bar.java index 4cf0aa2399..3ee78bd7a3 100644 --- a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Bar.java +++ b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Bar.java @@ -6,8 +6,11 @@ public interface Bar { String method(String string); - default String defaultMethod() { - return "String from Bar"; + default String defaultBar() { + return "Default String from Bar"; } + default String defaultCommon() { + return "Default Common from Bar"; + } } diff --git a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Baz.java b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Baz.java index c7efe14c89..1e1e9ae094 100644 --- a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Baz.java +++ b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/Baz.java @@ -6,7 +6,11 @@ public interface Baz { String method(String string); - default String defaultMethod() { - return "String from Baz"; + default String defaultBaz() { + return "Default String from Baz"; + } + + default String defaultCommon(){ + return "Default Common from Baz"; } } diff --git a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java index 9141cd8eb8..27ab86dca3 100644 --- a/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java +++ b/core-java-modules/core-java-lambdas/src/main/java/com/baeldung/java8/lambda/tips/FooExtended.java @@ -5,8 +5,7 @@ package com.baeldung.java8.lambda.tips; public interface FooExtended extends Baz, Bar { @Override - default String defaultMethod() { - return Bar.super.defaultMethod(); + default String defaultCommon() { + return Bar.super.defaultCommon(); } - } diff --git a/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java b/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java index b409f8e37f..acc3bc8fa3 100644 --- a/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java +++ b/core-java-modules/core-java-lambdas/src/test/java/com/baeldung/java8/lambda/tips/Java8FunctionalInteracesLambdasUnitTest.java @@ -39,9 +39,9 @@ public class Java8FunctionalInteracesLambdasUnitTest { @Test public void defaultMethodFromExtendedInterface_whenReturnDefiniteString_thenCorrect() { final FooExtended fooExtended = string -> string; - final String result = fooExtended.defaultMethod(); + final String result = fooExtended.defaultCommon(); - assertEquals("String from Bar", result); + assertEquals("Default Common from Bar", result); } @Test From 10c8ff7a834749365b8fd084b61de97c9fe20d44 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Wed, 19 Aug 2020 21:11:19 +0300 Subject: [PATCH 0511/1862] BAEL-4516: Fixed formatting for sources --- gradle-5/build.gradle | 10 +++++----- gradle-5/gradle/wrapper/gradle-wrapper.properties | 2 +- gradle-5/source-sets/build.gradle | 13 ++++++------- .../java/com/baeldung/itest/SourceSetsItest.java | 12 ++++++------ .../test/java/com/baeldung/test/SourceSetsTest.java | 8 ++++---- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/gradle-5/build.gradle b/gradle-5/build.gradle index a40afb7024..84cf05bad6 100644 --- a/gradle-5/build.gradle +++ b/gradle-5/build.gradle @@ -5,11 +5,11 @@ plugins{ description = "Gradle 5 root project" allprojects { apply plugin :"java" - // apply plugin :"nebula.lint" - // gradleLint { - // rules=['unused-dependency'] - // reportFormat = 'text' - // } + apply plugin :"nebula.lint" + gradleLint { + rules=['unused-dependency'] + reportFormat = 'text' + } group = "com.baeldung" version = "0.0.1" sourceCompatibility = "1.8" diff --git a/gradle-5/gradle/wrapper/gradle-wrapper.properties b/gradle-5/gradle/wrapper/gradle-wrapper.properties index 0b7ed8da04..4c46317507 100644 --- a/gradle-5/gradle/wrapper/gradle-wrapper.properties +++ b/gradle-5/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip diff --git a/gradle-5/source-sets/build.gradle b/gradle-5/source-sets/build.gradle index d7d3f18df3..8325450cfd 100644 --- a/gradle-5/source-sets/build.gradle +++ b/gradle-5/source-sets/build.gradle @@ -1,5 +1,5 @@ -// apply plugin: "eclipse" +apply plugin: "eclipse" apply plugin: "java" description = "Source Sets example" @@ -60,9 +60,8 @@ configurations { itestRuntimeOnly.extendsFrom(testRuntimeOnly) } - -// eclipse { -// classpath { -// plusConfigurations+=[configurations.itestCompileClasspath] -// } -// } \ No newline at end of file +eclipse { + classpath { + plusConfigurations+=[configurations.itestCompileClasspath] + } +} \ No newline at end of file diff --git a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java index fea54574d6..59529f94ae 100644 --- a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java +++ b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java @@ -13,19 +13,19 @@ import com.google.common.collect.ImmutableList; public class SourceSetsItest { @Test - public void whenRunThenSuccess() { - + public void whenRun_ThenSuccess() { + SourceSetsObject underTest = new SourceSetsObject("lorem", "ipsum"); - + assertThat(underTest.getUser(), is("lorem")); assertThat(underTest.getPassword(), is("ipsum")); } @Test - public void givenImmutableListwhenRunThenSuccess() { - + public void givenImmutableList_whenRun_ThenSuccess() { + List someStrings = ImmutableList.of("Baeldung", "is", "cool"); - + assertThat(someStrings.size(), is(3)); } } diff --git a/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java b/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java index 4891ffd694..b033eb8e52 100644 --- a/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java +++ b/gradle-5/source-sets/src/test/java/com/baeldung/test/SourceSetsTest.java @@ -10,10 +10,10 @@ import com.baeldung.main.SourceSetsObject; public class SourceSetsTest { @Test - public void whenRunThenSuccess() { - - SourceSetsObject underTest = new SourceSetsObject("lorem","ipsum"); - + public void whenRun_ThenSuccess() { + + SourceSetsObject underTest = new SourceSetsObject("lorem", "ipsum"); + assertThat(underTest.getUser(), is("lorem")); assertThat(underTest.getPassword(), is("ipsum")); } From cc308b34edeb7567b2d4f444041e5f64ba4db131 Mon Sep 17 00:00:00 2001 From: bfontana Date: Wed, 19 Aug 2020 21:10:47 -0300 Subject: [PATCH 0512/1862] Update ArrayToListConversion.java --- .../com/baeldung/arrayconversion/ArrayToListConversion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java index 09641cd1d5..551661810d 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java +++ b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class ArrayToListConversion { +public class ArrayToListConversionUnitTest { @Test(expected = UnsupportedOperationException.class) public void givenAnArray_whenConvertingToList_returnUnmodifiableListUnitTest() { From 68154fa54070f1a038d116f479f679b4e1eb31cb Mon Sep 17 00:00:00 2001 From: Bruno Fontana Date: Wed, 19 Aug 2020 21:50:54 -0300 Subject: [PATCH 0513/1862] Fixing class file name --- ...ayToListConversion.java => ArrayToListConversionUnitTest.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/{ArrayToListConversion.java => ArrayToListConversionUnitTest.java} (100%) diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java similarity index 100% rename from java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversion.java rename to java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java From 8abe76937e11104d4392d5b5a8f8de80584064c0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 12:44:15 +0800 Subject: [PATCH 0514/1862] Update README.md --- performance-tests/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/performance-tests/README.md b/performance-tests/README.md index 09ed26ae19..27c0363010 100644 --- a/performance-tests/README.md +++ b/performance-tests/README.md @@ -5,6 +5,7 @@ This module contains articles about performance testing. ### Relevant Articles: - [Performance of Java Mapping Frameworks](https://www.baeldung.com/java-performance-mapping-frameworks) +- [Performance Effects of Exceptions in Java](https://www.baeldung.com/java-exceptions-performance) ### Running From c55045a315e7ec83a197a22a9550c4446512ca83 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 12:46:31 +0800 Subject: [PATCH 0515/1862] Update README.md --- java-collections-conversions-2/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java-collections-conversions-2/README.md b/java-collections-conversions-2/README.md index 11dddadc5c..9d0ba88cbf 100644 --- a/java-collections-conversions-2/README.md +++ b/java-collections-conversions-2/README.md @@ -3,6 +3,8 @@ This module contains articles about conversions among Collection types and arrays in Java. ### Relevant Articles: + - [Array to String Conversions](https://www.baeldung.com/java-array-to-string) - [Mapping Lists with ModelMapper](https://www.baeldung.com/java-modelmapper-lists) +- [Converting List to Map With a Custom Supplier](https://www.baeldung.com/list-to-map-supplier) - More articles: [[<-- prev]](../java-collections-conversions) From 5bac5debeee24311f09fe13a6bdc58c543d6bf97 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 12:49:13 +0800 Subject: [PATCH 0516/1862] Update README.md --- docker/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/README.md b/docker/README.md index 7948b3d663..8e5cc2b621 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,3 +1,4 @@ ## Relevant Articles: - [Introduction to Docker Compose](https://www.baeldung.com/docker-compose) +- [Creating Docker Images with Spring Boot](https://www.baeldung.com/spring-boot-docker-images) From 1f73d97d0f5c125787d74d40324dadd0bf86cb3b Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 12:51:17 +0800 Subject: [PATCH 0517/1862] Update README.md --- patterns/solid/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/patterns/solid/README.md b/patterns/solid/README.md index 41e986f544..b7eeb59a6f 100644 --- a/patterns/solid/README.md +++ b/patterns/solid/README.md @@ -4,3 +4,4 @@ - [Single Responsibility Principle in Java](https://www.baeldung.com/java-single-responsibility-principle) - [Open/Closed Principle in Java](https://www.baeldung.com/java-open-closed-principle) - [Interface Segregation Principle in Java](https://www.baeldung.com/java-interface-segregation) +- [Liskov Substitution Principle in Java](https://www.baeldung.com/java-liskov-substitution-principle) From 62d021f6860932d3d21c86385417f0bc49b7fefc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 12:59:10 +0800 Subject: [PATCH 0518/1862] Create README.md --- rule-engines/jess/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 rule-engines/jess/README.md diff --git a/rule-engines/jess/README.md b/rule-engines/jess/README.md new file mode 100644 index 0000000000..a5f02d2f3a --- /dev/null +++ b/rule-engines/jess/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Jess Rule Engine and JSR 94](https://www.baeldung.com/java-rule-engine-jess-jsr-94) From 13566b8c2d7a36f89ae5eeb60dd7542e6eae1a5d Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:02:58 +0800 Subject: [PATCH 0519/1862] Update README.md --- core-java-modules/core-java-collections-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-collections-3/README.md b/core-java-modules/core-java-collections-3/README.md index 4349ef6be3..c80e493767 100644 --- a/core-java-modules/core-java-collections-3/README.md +++ b/core-java-modules/core-java-collections-3/README.md @@ -12,3 +12,4 @@ - [Fail-Safe Iterator vs Fail-Fast Iterator](https://www.baeldung.com/java-fail-safe-vs-fail-fast-iterator) - [Quick Guide to the Java Stack](https://www.baeldung.com/java-stack) - [Convert an Array of Primitives to a List](https://www.baeldung.com/java-primitive-array-to-list) +- [A Guide to BitSet in Java](https://www.baeldung.com/java-bitset) From 308bd8998b9ec94f0d19ca5ab5f62108eb88e405 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:07:18 +0800 Subject: [PATCH 0520/1862] Update README.md --- testing-modules/mockito-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md index bb7235c2cc..9ca5a38e2e 100644 --- a/testing-modules/mockito-2/README.md +++ b/testing-modules/mockito-2/README.md @@ -7,3 +7,4 @@ - [Mocking the ObjectMapper readValue() Method](https://www.baeldung.com/mockito-mock-jackson-read-value) - [Introduction to Mockito’s AdditionalAnswers](https://www.baeldung.com/mockito-additionalanswers) - [Mockito – Using Spies](https://www.baeldung.com/mockito-spy) +- [Using Mockito ArgumentCaptor](https://www.baeldung.com/mockito-argumentcaptor) From ff66bac56c41f736b383b71ee651cc9ae7e39de7 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:10:04 +0800 Subject: [PATCH 0521/1862] Update README.md --- apache-poi/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apache-poi/README.md b/apache-poi/README.md index b562fefc29..599b21e063 100644 --- a/apache-poi/README.md +++ b/apache-poi/README.md @@ -3,9 +3,11 @@ This module contains articles about Apache POI ### Relevant Articles: + - [Microsoft Word Processing in Java with Apache POI](https://www.baeldung.com/java-microsoft-word-with-apache-poi) - [Working with Microsoft Excel in Java](https://www.baeldung.com/java-microsoft-excel) - [Creating a MS PowerPoint Presentation in Java](https://www.baeldung.com/apache-poi-slideshow) - [Merge Cells in Excel Using Apache POI](https://www.baeldung.com/java-apache-poi-merge-cells) - [Get String Value of Excel Cell with Apache POI](https://www.baeldung.com/java-apache-poi-cell-string-value) - [Read Excel Cell Value Rather Than Formula With Apache POI](https://www.baeldung.com/apache-poi-read-cell-value-formula) +- [Setting Formulas in Excel with Apache POI](https://www.baeldung.com/java-apache-poi-set-formulas) From af9ba730250d8c28c4101663ee2cd1e949172ada Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:15:17 +0800 Subject: [PATCH 0522/1862] Update README.md --- core-java-modules/core-java-console/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core-java-modules/core-java-console/README.md b/core-java-modules/core-java-console/README.md index 725e2482bb..0a31727588 100644 --- a/core-java-modules/core-java-console/README.md +++ b/core-java-modules/core-java-console/README.md @@ -1,5 +1,8 @@ #Core Java Console -[Read and Write User Input in Java](http://www.baeldung.com/java-console-input-output) -[Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf) -[ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java) \ No newline at end of file +### Relevant Articles: + +- [Read and Write User Input in Java](http://www.baeldung.com/java-console-input-output) +- [Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf) +- [ASCII Art in Java](http://www.baeldung.com/ascii-art-in-java) +- [System.console() vs. System.out](https://www.baeldung.com/java-system-console-vs-system-out) From 0dc5fee1014dce5ec52b657d84eaba3bedd704e5 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:17:06 +0800 Subject: [PATCH 0523/1862] Update README.md --- jsoup/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jsoup/README.md b/jsoup/README.md index 690afe3099..42b30d4d83 100644 --- a/jsoup/README.md +++ b/jsoup/README.md @@ -5,6 +5,7 @@ This module contains articles about jsoup. ### Relevant Articles: - [Parsing HTML in Java with Jsoup](https://www.baeldung.com/java-with-jsoup) - [How to add proxy support to Jsoup?](https://www.baeldung.com/java-jsoup-proxy) +- [Preserving Line Breaks When Using Jsoup](https://www.baeldung.com/jsoup-line-breaks) ### Build the Project From 4f44adacc9a5750b373927579e250f5a556ceac3 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:18:56 +0800 Subject: [PATCH 0524/1862] Update README.md --- core-java-modules/core-java-os/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-modules/core-java-os/README.md b/core-java-modules/core-java-os/README.md index f2ec3f9d48..10e04a8ba6 100644 --- a/core-java-modules/core-java-os/README.md +++ b/core-java-modules/core-java-os/README.md @@ -12,5 +12,6 @@ This module contains articles about working with the operating system (OS) in Ja - [How to Print Screen in Java](http://www.baeldung.com/print-screen-in-java) - [Pattern Search with Grep in Java](http://www.baeldung.com/grep-in-java) - [How to Run a Shell Command in Java](http://www.baeldung.com/run-shell-command-in-java) +- [Taking Screenshots Using Java](https://www.baeldung.com/java-taking-screenshots) -This module uses Java 9, so make sure to have the JDK 9 installed to run it. \ No newline at end of file +This module uses Java 9, so make sure to have the JDK 9 installed to run it. From 86f836d42a01a13b7a5a4f5b6c897c133d61f28f Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:21:26 +0800 Subject: [PATCH 0525/1862] Update README.md --- .../core-java-arrays-operations-advanced/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-arrays-operations-advanced/README.md b/core-java-modules/core-java-arrays-operations-advanced/README.md index af0c00641a..c8ec3e74bc 100644 --- a/core-java-modules/core-java-arrays-operations-advanced/README.md +++ b/core-java-modules/core-java-arrays-operations-advanced/README.md @@ -3,7 +3,9 @@ This module contains articles about advanced operations on arrays in Java. They assume some background knowledge with arrays in Java. ### Relevant Articles: + - [How to Copy an Array in Java](https://www.baeldung.com/java-array-copy) - [Arrays.deepEquals](https://www.baeldung.com/java-arrays-deepequals) - [Find Sum and Average in a Java Array](https://www.baeldung.com/java-array-sum-average) - [Intersection Between two Integer Arrays](https://www.baeldung.com/java-array-intersection) +- [Comparing Arrays in Java](https://www.baeldung.com/java-comparing-arrays) From abe88db97fcd25971c3d349b451c339283854f28 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 13:44:56 +0800 Subject: [PATCH 0526/1862] Update README.md --- core-kotlin-modules/core-kotlin/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-kotlin-modules/core-kotlin/README.md b/core-kotlin-modules/core-kotlin/README.md index 359c5a4787..33f8745937 100644 --- a/core-kotlin-modules/core-kotlin/README.md +++ b/core-kotlin-modules/core-kotlin/README.md @@ -3,6 +3,7 @@ This module contains articles about Kotlin core features. ### Relevant articles: + - [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin-intro) - [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability) - [Get a Random Number in Kotlin](https://www.baeldung.com/kotlin-random-number) @@ -10,3 +11,4 @@ This module contains articles about Kotlin core features. - [Kotlin Ternary Conditional Operator](https://www.baeldung.com/kotlin-ternary-operator) - [Sequences in Kotlin](https://www.baeldung.com/kotlin/sequences) - [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class) +- [Exception Handling in Kotlin](https://www.baeldung.com/kotlin/exception-handling) From baed0ba3a2039b95473837900a1d3f3d6099c933 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:21:55 +0800 Subject: [PATCH 0527/1862] Update README.md --- core-java-modules/core-java-lang-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-3/README.md b/core-java-modules/core-java-lang-3/README.md index 9ce49da868..0fa08ef397 100644 --- a/core-java-modules/core-java-lang-3/README.md +++ b/core-java-modules/core-java-lang-3/README.md @@ -4,4 +4,5 @@ This module contains articles about core features in the Java language - [Class.isInstance vs Class.isAssignableFrom](https://www.baeldung.com/java-isinstance-isassignablefrom) - [Converting a Java String Into a Boolean](https://www.baeldung.com/java-string-to-boolean) +- [When are Static Variables Initialized in Java?](https://www.baeldung.com/java-static-variables-initialization) - [[<-- Prev]](/core-java-modules/core-java-lang-2) From 74b3d125f42a63d0378de68bb923b4995fca220d Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:23:09 +0800 Subject: [PATCH 0528/1862] Update README.md --- deeplearning4j/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/deeplearning4j/README.md b/deeplearning4j/README.md index 47c2d8167d..5bd00778ce 100644 --- a/deeplearning4j/README.md +++ b/deeplearning4j/README.md @@ -5,3 +5,4 @@ This module contains articles about Deeplearning4j. ### Relevant Articles: - [A Guide to Deeplearning4j](https://www.baeldung.com/deeplearning4j) - [Logistic Regression in Java](https://www.baeldung.com/java-logistic-regression) +- [How to Implement a CNN with Deeplearning4j](https://www.baeldung.com/java-cnn-deeplearning4j) From 1ed61c074c3395b50b7dc3997b5b3f29ad83cedc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:28:41 +0800 Subject: [PATCH 0529/1862] Update README.md --- core-java-modules/core-java-io-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md index 61a040c1ce..8da42b2585 100644 --- a/core-java-modules/core-java-io-3/README.md +++ b/core-java-modules/core-java-io-3/README.md @@ -6,4 +6,5 @@ This module contains articles about core Java input and output (IO) - [Java – Create a File](https://www.baeldung.com/java-how-to-create-a-file) - [Check If a Directory Is Empty in Java](https://www.baeldung.com/java-check-empty-directory) +- [Check If a File or Directory Exists in Java](https://www.baeldung.com/java-file-directory-exists) - [[<-- Prev]](/core-java-modules/core-java-io-2) From ffa3a92ee5ea272615f0b691886784b86b119c9b Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:32:59 +0800 Subject: [PATCH 0530/1862] Create README.md --- spring-boot-modules/spring-boot-xml/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-boot-modules/spring-boot-xml/README.md diff --git a/spring-boot-modules/spring-boot-xml/README.md b/spring-boot-modules/spring-boot-xml/README.md new file mode 100644 index 0000000000..7a9a0bdc09 --- /dev/null +++ b/spring-boot-modules/spring-boot-xml/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [XML Defined Beans in Spring Boot](https://www.baeldung.com/spring-boot-xml-beans) From 515f3a96e0b639219e70fc086658b3cda19fda5c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:39:49 +0800 Subject: [PATCH 0531/1862] Update README.md --- jmh/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jmh/README.md b/jmh/README.md index 41bf16d6bb..3cfe847a3c 100644 --- a/jmh/README.md +++ b/jmh/README.md @@ -6,3 +6,4 @@ This module contains articles about the Java Microbenchmark Harness (JMH). - [Microbenchmarking with Java](https://www.baeldung.com/java-microbenchmark-harness) - [A Guide to False Sharing and @Contended](https://www.baeldung.com/java-false-sharing-contended) +- [Performance Comparison of boolean[] vs BitSet](https://www.baeldung.com/java-boolean-array-bitset-performance) From 8a5d692509b47daace026b14fdbff30e314896ed Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:42:07 +0800 Subject: [PATCH 0532/1862] Update README.MD --- persistence-modules/flyway-repair/README.MD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persistence-modules/flyway-repair/README.MD b/persistence-modules/flyway-repair/README.MD index 7d843af9ea..939b8498da 100644 --- a/persistence-modules/flyway-repair/README.MD +++ b/persistence-modules/flyway-repair/README.MD @@ -1 +1,3 @@ ### Relevant Articles: + +- [Flyway Repair With Spring Boot](https://www.baeldung.com/spring-boot-flyway-repair) From 15dba0da1af24b6fb5e90f5aa6e836b40ba83861 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:45:40 +0800 Subject: [PATCH 0533/1862] Update README.md --- core-java-modules/core-java-io-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md index 8da42b2585..325d5e19fa 100644 --- a/core-java-modules/core-java-io-3/README.md +++ b/core-java-modules/core-java-io-3/README.md @@ -7,4 +7,5 @@ This module contains articles about core Java input and output (IO) - [Java – Create a File](https://www.baeldung.com/java-how-to-create-a-file) - [Check If a Directory Is Empty in Java](https://www.baeldung.com/java-check-empty-directory) - [Check If a File or Directory Exists in Java](https://www.baeldung.com/java-file-directory-exists) +- [Copy a Directory in Java](https://www.baeldung.com/java-copy-directory) - [[<-- Prev]](/core-java-modules/core-java-io-2) From 705e9c0072c0ef840c0e445195eef022501262cd Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:47:05 +0800 Subject: [PATCH 0534/1862] Update README.md --- core-java-modules/core-java-lang-oop-types/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core-java-modules/core-java-lang-oop-types/README.md b/core-java-modules/core-java-lang-oop-types/README.md index 449a0f59cc..459352c490 100644 --- a/core-java-modules/core-java-lang-oop-types/README.md +++ b/core-java-modules/core-java-lang-oop-types/README.md @@ -3,6 +3,7 @@ This module contains articles about types in Java ### Relevant Articles: + - [Java Classes and Objects](https://www.baeldung.com/java-classes-objects) - [Guide to the this Java Keyword](https://www.baeldung.com/java-this) - [Nested Classes in Java](https://www.baeldung.com/java-nested-classes) @@ -10,3 +11,4 @@ This module contains articles about types in Java - [Iterating Over Enum Values in Java](https://www.baeldung.com/java-enum-iteration) - [Attaching Values to Java Enum](https://www.baeldung.com/java-enum-values) - [A Guide to Java Enums](https://www.baeldung.com/a-guide-to-java-enums) +- [Determine if an Object is of Primitive Type](https://www.baeldung.com/java-object-primitive-type) From 7ea6808a506e2f9b1e64b3c5be05ba8aa215f556 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:49:05 +0800 Subject: [PATCH 0535/1862] Update README.md --- json-2/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/json-2/README.md b/json-2/README.md index c2b6b36a11..64ca7e6449 100644 --- a/json-2/README.md +++ b/json-2/README.md @@ -3,5 +3,7 @@ This module contains articles about JSON. ### Relevant Articles: + - [Introduction to Jsoniter](https://www.baeldung.com/java-jsoniter) - [Introduction to Moshi Json](https://www.baeldung.com/java-json-moshi) +- [Hypermedia Serialization With JSON-LD](https://www.baeldung.com/json-linked-data) From 7d6e4d2dd47ad077cd61be4c2d7c306e7c2a8d3f Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:51:43 +0800 Subject: [PATCH 0536/1862] Update README.md --- spring-mvc-java-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-mvc-java-2/README.md b/spring-mvc-java-2/README.md index 42fa056b99..41ff7bdf7c 100644 --- a/spring-mvc-java-2/README.md +++ b/spring-mvc-java-2/README.md @@ -6,3 +6,4 @@ - [A Quick Guide to Spring MVC Matrix Variables](https://www.baeldung.com/spring-mvc-matrix-variables) - [Converting a Spring MultipartFile to a File](https://www.baeldung.com/spring-multipartfile-to-file) - [Testing a Spring Multipart POST Request](https://www.baeldung.com/spring-multipart-post-request-test) +- [Spring @Pathvariable Annotation](https://www.baeldung.com/spring-pathvariable) From 9b2237b72b9b3d64cd90237ea81a84ce75fdacd8 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:55:27 +0800 Subject: [PATCH 0537/1862] Update README.md --- javax-servlets/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javax-servlets/README.md b/javax-servlets/README.md index 54f92064a0..fe070f73b5 100644 --- a/javax-servlets/README.md +++ b/javax-servlets/README.md @@ -12,4 +12,4 @@ This module contains articles about Servlets. - [Jakarta EE Servlet Exception Handling](https://www.baeldung.com/servlet-exceptions) - [Context and Servlet Initialization Parameters](https://www.baeldung.com/context-servlet-initialization-param) - [The Difference between getRequestURI and getPathInfo in HttpServletRequest](https://www.baeldung.com/http-servlet-request-requesturi-pathinfo) -- Difference between request.getSession() and request.getSession(true) +- [Difference between request.getSession() and request.getSession(true)](https://www.baeldung.com/java-request-getsession) From a2ad623ba509624502beaff4bc0cfca31ff6975a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 17:58:14 +0800 Subject: [PATCH 0538/1862] Update README.md --- core-java-modules/core-java-reflection-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-reflection-2/README.md b/core-java-modules/core-java-reflection-2/README.md index 342fbd73bd..e5ddb7a8b8 100644 --- a/core-java-modules/core-java-reflection-2/README.md +++ b/core-java-modules/core-java-reflection-2/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Reading the Value of ‘private’ Fields from a Different Class in Java](https://www.baeldung.com/java-reflection-read-private-field-value) +- [Set Field Value With Reflection](https://www.baeldung.com/java-set-private-field-value) From 138fef96a4f984a5672265f5dbb3e2b61e0b145d Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:02:34 +0800 Subject: [PATCH 0539/1862] Create README.md --- persistence-modules/spring-data-jdbc/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 persistence-modules/spring-data-jdbc/README.md diff --git a/persistence-modules/spring-data-jdbc/README.md b/persistence-modules/spring-data-jdbc/README.md new file mode 100644 index 0000000000..0e54d0ba88 --- /dev/null +++ b/persistence-modules/spring-data-jdbc/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Introduction to Spring Data JDBC](https://www.baeldung.com/spring-data-jdbc-intro) From 5cf868be7f05ce60c7af43e4dface342646db586 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:03:52 +0800 Subject: [PATCH 0540/1862] Update README.md --- core-java-modules/core-java-io-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md index 325d5e19fa..c4eacdf27a 100644 --- a/core-java-modules/core-java-io-3/README.md +++ b/core-java-modules/core-java-io-3/README.md @@ -8,4 +8,5 @@ This module contains articles about core Java input and output (IO) - [Check If a Directory Is Empty in Java](https://www.baeldung.com/java-check-empty-directory) - [Check If a File or Directory Exists in Java](https://www.baeldung.com/java-file-directory-exists) - [Copy a Directory in Java](https://www.baeldung.com/java-copy-directory) +- [Java Files Open Options](https://www.baeldung.com/java-file-options) - [[<-- Prev]](/core-java-modules/core-java-io-2) From 8ae13d1f5430bcfe538251a7d681bfe1e7cb84a6 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:06:48 +0800 Subject: [PATCH 0541/1862] Update README.md --- spring-5-security/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-5-security/README.md b/spring-5-security/README.md index 764d726ff8..6847d4bf5c 100644 --- a/spring-5-security/README.md +++ b/spring-5-security/README.md @@ -11,3 +11,4 @@ This module contains articles about Spring Security 5 - [Guide to the AuthenticationManagerResolver in Spring Security](https://www.baeldung.com/spring-security-authenticationmanagerresolver) - [Disable Security for a Profile in Spring Boot](https://www.baeldung.com/spring-security-disable-profile) - [Manual Logout With Spring Security](https://www.baeldung.com/spring-security-manual-logout) +- [How to Disable Spring Security Logout Redirects](https://www.baeldung.com/spring-security-disable-logout-redirects) From e87597b5b161e73768c8134b80412950fd5bdd58 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:09:18 +0800 Subject: [PATCH 0542/1862] Update README.md --- maven-modules/optional-dependencies/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-modules/optional-dependencies/README.md b/maven-modules/optional-dependencies/README.md index 6b4d3e7647..c17f75c539 100644 --- a/maven-modules/optional-dependencies/README.md +++ b/maven-modules/optional-dependencies/README.md @@ -1,3 +1,3 @@ ### Relevant Articles: -- Optional Dependency in Maven \ No newline at end of file +- [Optional Dependency in Maven](https://www.baeldung.com/maven-optional-dependency) From 14b9bba5d0574d21d33598b5649e3aa3d9fa8279 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:15:54 +0800 Subject: [PATCH 0543/1862] Create README.md --- java-numbers-4/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 java-numbers-4/README.md diff --git a/java-numbers-4/README.md b/java-numbers-4/README.md new file mode 100644 index 0000000000..344d348733 --- /dev/null +++ b/java-numbers-4/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Probability in Java](https://www.baeldung.com/java-probability) From 9b55b49677ae3836722c9830794b37b50c930e0e Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:17:51 +0800 Subject: [PATCH 0544/1862] Update README.md --- core-java-modules/core-java-collections-list-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-collections-list-3/README.md b/core-java-modules/core-java-collections-list-3/README.md index 65c377bd99..967e148a99 100644 --- a/core-java-modules/core-java-collections-list-3/README.md +++ b/core-java-modules/core-java-collections-list-3/README.md @@ -10,4 +10,5 @@ This module contains articles about the Java List collection - [Performance Comparison of Primitive Lists in Java](https://www.baeldung.com/java-list-primitive-performance) - [Filtering a Java Collection by a List](https://www.baeldung.com/java-filter-collection-by-list) - [How to Count Duplicate Elements in Arraylist](https://www.baeldung.com/java-count-duplicate-elements-arraylist) +- [Finding the Differences Between Two Lists in Java](https://www.baeldung.com/java-lists-difference) - [[<-- Prev]](/core-java-modules/core-java-collections-list-2) From 44a3e5fd1e869fc2e6ab61edd0ee57348b24ec7a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:21:02 +0800 Subject: [PATCH 0545/1862] Update README.md --- persistence-modules/java-jpa-3/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/persistence-modules/java-jpa-3/README.md b/persistence-modules/java-jpa-3/README.md index 01fdf05b53..dce9c4e711 100644 --- a/persistence-modules/java-jpa-3/README.md +++ b/persistence-modules/java-jpa-3/README.md @@ -1,3 +1,7 @@ ## JPA in Java This module contains articles about the Java Persistence API (JPA) in Java. + +### Relevant Articles: + +- [JPA Entity Equality](https://www.baeldung.com/jpa-entity-equality) From 45ffc02262bc0184dba9cd675d38957762a5b51f Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:22:29 +0800 Subject: [PATCH 0546/1862] Update README.md --- persistence-modules/core-java-persistence/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/core-java-persistence/README.md b/persistence-modules/core-java-persistence/README.md index a760489480..b7eecdde0d 100644 --- a/persistence-modules/core-java-persistence/README.md +++ b/persistence-modules/core-java-persistence/README.md @@ -13,3 +13,4 @@ - [Returning the Generated Keys in JDBC](https://www.baeldung.com/jdbc-returning-generated-keys) - [Loading JDBC Drivers](https://www.baeldung.com/java-jdbc-loading-drivers) - [Difference Between Statement and PreparedStatement](https://www.baeldung.com/java-statement-preparedstatement) +- [Extracting Database Metadata Using JDBC](https://www.baeldung.com/jdbc-database-metadata) From 99ad2667666e2ab00da3a76f1caf517b9beb2822 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:28:49 +0800 Subject: [PATCH 0547/1862] Update README.md --- algorithms-searching/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/algorithms-searching/README.md b/algorithms-searching/README.md index aed3c7d21f..a3ea023da3 100644 --- a/algorithms-searching/README.md +++ b/algorithms-searching/README.md @@ -3,6 +3,7 @@ This module contains articles about searching algorithms. ### Relevant articles: + - [Binary Search Algorithm in Java](https://www.baeldung.com/java-binary-search) - [Depth First Search in Java](https://www.baeldung.com/java-depth-first-search) - [Interpolation Search in Java](https://www.baeldung.com/java-interpolation-search) @@ -11,3 +12,4 @@ This module contains articles about searching algorithms. - [Monte Carlo Tree Search for Tic-Tac-Toe Game](https://www.baeldung.com/java-monte-carlo-tree-search) - [Range Search Algorithm in Java](https://www.baeldung.com/java-range-search) - [Fast Pattern Matching of Strings Using Suffix Tree](https://www.baeldung.com/java-pattern-matching-suffix-tree) +- [Find the Kth Smallest Element in Two Sorted Arrays](https://www.baeldung.com/java-kth-smallest-element-in-sorted-arrays) From 7f3f7b6434331a72471d70d5bdc0f2f6b17cfcfc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:33:43 +0800 Subject: [PATCH 0548/1862] Update README.md --- core-java-modules/core-java-jvm-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-jvm-2/README.md b/core-java-modules/core-java-jvm-2/README.md index 7206a9eef7..36cafd3288 100644 --- a/core-java-modules/core-java-jvm-2/README.md +++ b/core-java-modules/core-java-jvm-2/README.md @@ -10,4 +10,5 @@ This module contains articles about working with the Java Virtual Machine (JVM). - [boolean and boolean[] Memory Layout in the JVM](https://www.baeldung.com/jvm-boolean-memory-layout) - [Where Is the Array Length Stored in JVM?](https://www.baeldung.com/java-jvm-array-length) - [Memory Address of Objects in Java](https://www.baeldung.com/java-object-memory-address) +- [List All Classes Loaded in a Specific Class Loader](https://www.baeldung.com/java-list-classes-class-loader) - More articles: [[<-- prev]](/core-java-modules/core-java-jvm) From 2beedd866c9da655b4029666a0e521464797beb7 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:37:21 +0800 Subject: [PATCH 0549/1862] Create README.md --- persistence-modules/spring-data-cosmosdb/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 persistence-modules/spring-data-cosmosdb/README.md diff --git a/persistence-modules/spring-data-cosmosdb/README.md b/persistence-modules/spring-data-cosmosdb/README.md new file mode 100644 index 0000000000..c4a102141f --- /dev/null +++ b/persistence-modules/spring-data-cosmosdb/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Introduction to Spring Data Azure Cosmos DB](https://www.baeldung.com/spring-data-cosmos-db) From bd82dcaec9a5b36c165a8ebc35e995af88b93e7d Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:38:27 +0800 Subject: [PATCH 0550/1862] Update README.md --- persistence-modules/hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index 8793e2e9c7..8fa6843b17 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -13,3 +13,4 @@ This module contains articles about Hibernate 5. Let's not add more articles her - [Guide to the Hibernate EntityManager](https://www.baeldung.com/hibernate-entitymanager) - [Using c3p0 with Hibernate](https://www.baeldung.com/hibernate-c3p0) - [Persist a JSON Object Using Hibernate](https://www.baeldung.com/hibernate-persist-json-object) +- [What Is the Hi/Lo Algorithm?](https://www.baeldung.com/hi-lo-algorithm-hibernate) From 22008a0cea2e98c7e5ccb1dbb87a499679a1b5a0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:40:15 +0800 Subject: [PATCH 0551/1862] Create README.md --- spring-webflux-threads/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-webflux-threads/README.md diff --git a/spring-webflux-threads/README.md b/spring-webflux-threads/README.md new file mode 100644 index 0000000000..746514feda --- /dev/null +++ b/spring-webflux-threads/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Concurrency in Spring WebFlux](https://www.baeldung.com/spring-webflux-concurrency) From 8fb13070b62b9c39c41eed3ab24208cf30d5b92b Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:41:40 +0800 Subject: [PATCH 0552/1862] Create README.md --- spring-boot-modules/spring-boot-properties-3/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-boot-modules/spring-boot-properties-3/README.md diff --git a/spring-boot-modules/spring-boot-properties-3/README.md b/spring-boot-modules/spring-boot-properties-3/README.md new file mode 100644 index 0000000000..df6ba5480a --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [How to Define a Map in YAML for a POJO?](https://www.baeldung.com/yaml-map-pojo) From 210c1ed732145b9eec1f26182d31aeeb306fbe89 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 20 Aug 2020 18:43:15 +0800 Subject: [PATCH 0553/1862] Create README.md --- core-java-modules/core-java-exceptions-3/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-java-modules/core-java-exceptions-3/README.md diff --git a/core-java-modules/core-java-exceptions-3/README.md b/core-java-modules/core-java-exceptions-3/README.md new file mode 100644 index 0000000000..e6c7eda881 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [NoSuchMethodError in Java](https://www.baeldung.com/java-nosuchmethod-error) From b35b7d0a90bc159fd7c1fd7f9e4e65ad1b933dd2 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 20 Aug 2020 16:45:04 +0530 Subject: [PATCH 0554/1862] JAVA-2382: Update "Performance of Mapping Frameworks" article --- performance-tests/pom.xml | 84 +++++++------------ .../dozer/DozerConverter.java | 40 ++++----- .../src/main/resources/dozer-mapping.xml | 6 +- .../src/test/resources/dozer-mapping.xml | 6 +- 4 files changed, 54 insertions(+), 82 deletions(-) diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml index c790dbbb16..fb3f82df38 100644 --- a/performance-tests/pom.xml +++ b/performance-tests/pom.xml @@ -19,27 +19,14 @@ ${orika.version} - net.sf.dozer - dozer + com.github.dozermapper + dozer-core ${dozer.version} - - - io.craftsman - dozer-jdk8-support - ${dozer-jdk8-support.version} - + org.mapstruct - mapstruct-jdk8 - ${mapstruct-jdk8.version} - true - - - - org.mapstruct - mapstruct-processor - ${mapstruct-jdk8.version} - provided + mapstruct + ${mapstruct.version} @@ -77,10 +64,15 @@ ${javac.target} ${javac.target} + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} + org.mapstruct mapstruct-processor - ${mapstruct-processor.version} + ${mapstruct.version} @@ -120,28 +112,16 @@ - - org.apache.maven.plugins - maven-jar-plugin - ${maven-jar-plugin.version} - - - - com.baeldung.performancetests.MappingFrameworksPerformance - - - - maven-clean-plugin - 2.5 + ${clean.plugin.version} maven-deploy-plugin - 2.8.1 + ${deploy.plugin.version} maven-install-plugin @@ -179,19 +159,13 @@ - 1.21 - 1.5.2 - 5.5.1 - 1.0.2 - 1.2.0.Final - 1.1.0 - 1.6.0.1 - 1.2.0.Final - 1.21 - 1.21 - 3.7.0 - 3.2.0 - + 1.23 + 1.5.4 + 6.5.0 + 1.3.1.Final + 2.3.8 + 1.6.1.CR2 + @@ -201,14 +175,16 @@ Name of the benchmark Uber-JAR to generate. --> benchmarks - 3.1 - 2.2 - 2.5.1 - 2.4 - 2.9.1 - 2.6 - 3.3 - 2.2.1 + 3.1.0 + 3.0.0-M1 + 3.8.1 + 3.2.4 + 3.0.0-M1 + 3.2.0 + 3.2.0 + 3.1.0 + 3.9.1 + 3.2.1 2.17 diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/dozer/DozerConverter.java b/performance-tests/src/main/java/com/baeldung/performancetests/dozer/DozerConverter.java index 710145ec58..e33c407dfa 100644 --- a/performance-tests/src/main/java/com/baeldung/performancetests/dozer/DozerConverter.java +++ b/performance-tests/src/main/java/com/baeldung/performancetests/dozer/DozerConverter.java @@ -2,28 +2,28 @@ package com.baeldung.performancetests.dozer; import com.baeldung.performancetests.Converter; import com.baeldung.performancetests.model.destination.DestinationCode; +import com.baeldung.performancetests.model.destination.Order; import com.baeldung.performancetests.model.source.SourceCode; import com.baeldung.performancetests.model.source.SourceOrder; -import com.baeldung.performancetests.model.destination.Order; -import org.dozer.DozerBeanMapper; -import org.dozer.Mapper; +import com.github.dozermapper.core.DozerBeanMapperBuilder; +import com.github.dozermapper.core.Mapper; - public class DozerConverter implements Converter { - private final Mapper mapper; +public class DozerConverter implements Converter { + private final Mapper mapper; - public DozerConverter() { - DozerBeanMapper mapper = new DozerBeanMapper(); - mapper.addMapping(DozerConverter.class.getResourceAsStream("/dozer-mapping.xml")); - this.mapper = mapper; - } - - @Override - public Order convert(SourceOrder sourceOrder) { - return mapper.map(sourceOrder,Order.class); - } - - @Override - public DestinationCode convert(SourceCode sourceCode) { - return mapper.map(sourceCode, DestinationCode.class); - } + public DozerConverter() { + this.mapper = DozerBeanMapperBuilder.create() + .withMappingFiles("dozer-mapping.xml") + .build(); } + + @Override + public Order convert(SourceOrder sourceOrder) { + return mapper.map(sourceOrder, Order.class); + } + + @Override + public DestinationCode convert(SourceCode sourceCode) { + return mapper.map(sourceCode, DestinationCode.class); + } +} diff --git a/performance-tests/src/main/resources/dozer-mapping.xml b/performance-tests/src/main/resources/dozer-mapping.xml index 7fd7e78e9f..3c4530561a 100644 --- a/performance-tests/src/main/resources/dozer-mapping.xml +++ b/performance-tests/src/main/resources/dozer-mapping.xml @@ -1,8 +1,6 @@ - + true diff --git a/performance-tests/src/test/resources/dozer-mapping.xml b/performance-tests/src/test/resources/dozer-mapping.xml index 7484812431..0476f45cdf 100644 --- a/performance-tests/src/test/resources/dozer-mapping.xml +++ b/performance-tests/src/test/resources/dozer-mapping.xml @@ -1,8 +1,6 @@ - + true From ebd334c9c59f956ebc54640b7e37f4b8d5e22808 Mon Sep 17 00:00:00 2001 From: Loredana Date: Thu, 20 Aug 2020 19:46:25 +0300 Subject: [PATCH 0555/1862] removed spring-all module --- spring-all/README.md | 3 - .../org/baeldung/scopes/ScopesConfig.java | 61 ------------------- 2 files changed, 64 deletions(-) delete mode 100644 spring-all/README.md delete mode 100644 spring-all/src/main/java/org/baeldung/scopes/ScopesConfig.java diff --git a/spring-all/README.md b/spring-all/README.md deleted file mode 100644 index 9ad78aa1ee..0000000000 --- a/spring-all/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Spring All - -This module contains articles about Spring diff --git a/spring-all/src/main/java/org/baeldung/scopes/ScopesConfig.java b/spring-all/src/main/java/org/baeldung/scopes/ScopesConfig.java deleted file mode 100644 index 11d3806b6e..0000000000 --- a/spring-all/src/main/java/org/baeldung/scopes/ScopesConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.baeldung.scopes; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Scope; -import org.springframework.context.annotation.ScopedProxyMode; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.view.JstlView; -import org.springframework.web.servlet.view.UrlBasedViewResolver; - -@Configuration -@ComponentScan("org.baeldung.scopes") -@EnableWebMvc -public class ScopesConfig { - @Bean - public UrlBasedViewResolver setupViewResolver() { - final UrlBasedViewResolver resolver = new UrlBasedViewResolver(); - resolver.setPrefix("/WEB-INF/view/"); - resolver.setSuffix(".jsp"); - resolver.setViewClass(JstlView.class); - return resolver; - } - - @Bean - @Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS) - public HelloMessageGenerator requestScopedBean() { - return new HelloMessageGenerator(); - } - - @Bean - @Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS) - public HelloMessageGenerator sessionScopedBean() { - return new HelloMessageGenerator(); - } - - @Bean - @Scope(value = WebApplicationContext.SCOPE_APPLICATION, proxyMode = ScopedProxyMode.TARGET_CLASS) - public HelloMessageGenerator applicationScopedBean() { - return new HelloMessageGenerator(); - } - - @Bean - @Scope(scopeName = "websocket", proxyMode = ScopedProxyMode.TARGET_CLASS) - public HelloMessageGenerator websocketScopedBean() { - return new HelloMessageGenerator(); - } - - @Bean - @Scope("prototype") - public Person personPrototype() { - return new Person(); - } - - @Bean - @Scope("singleton") - public Person personSingleton() { - return new Person(); - } -} From ca68c7d56c00e06f57ffa2d4db66e5c0936534a0 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Thu, 20 Aug 2020 20:46:12 +0200 Subject: [PATCH 0556/1862] JAVA-1651: Get rid of the overriden spring-boot.version property --- spring-cloud/spring-cloud-config/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-cloud/spring-cloud-config/pom.xml b/spring-cloud/spring-cloud-config/pom.xml index 5097a63092..8411a65500 100644 --- a/spring-cloud/spring-cloud-config/pom.xml +++ b/spring-cloud/spring-cloud-config/pom.xml @@ -33,8 +33,7 @@ - Hoxton.RELEASE - 2.2.2.RELEASE + Hoxton.SR4 From f9e54fd2f6352f2f86a77d1b46b550afa1488607 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 21 Aug 2020 14:33:39 +0200 Subject: [PATCH 0557/1862] BAEL-4572: Add List#copyOf and Set#copyOf (#9903) * BAEL-4572: Move Converting Between a List and a Set in Java to core-java-10 * BAEL-4572: Add Java10 examples --- core-java-modules/core-java-10/README.md | 1 + core-java-modules/core-java-10/pom.xml | 24 ++++--- .../conversion/ListSetConversionUnitTest.java | 68 +++++++++++++++++++ java-collections-conversions/README.md | 1 - .../JavaCollectionConversionUnitTest.java | 36 ---------- 5 files changed, 85 insertions(+), 45 deletions(-) create mode 100644 core-java-modules/core-java-10/src/test/java/com/baeldung/java10/collections/conversion/ListSetConversionUnitTest.java diff --git a/core-java-modules/core-java-10/README.md b/core-java-modules/core-java-10/README.md index 2b57ec9064..23f598b902 100644 --- a/core-java-modules/core-java-10/README.md +++ b/core-java-modules/core-java-10/README.md @@ -9,3 +9,4 @@ This module contains articles about Java 10 core features - [Copy a List to Another List in Java](http://www.baeldung.com/java-copy-list-to-another) - [Deep Dive Into the New Java JIT Compiler – Graal](https://www.baeldung.com/graal-java-jit-compiler) - [Copying Sets in Java](https://www.baeldung.com/java-copy-sets) +- [Converting between a List and a Set in Java](https://www.baeldung.com/convert-list-to-set-and-set-to-list) diff --git a/core-java-modules/core-java-10/pom.xml b/core-java-modules/core-java-10/pom.xml index a9b991852f..b293eb6c2f 100644 --- a/core-java-modules/core-java-10/pom.xml +++ b/core-java-modules/core-java-10/pom.xml @@ -1,22 +1,29 @@ + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 core-java-10 0.1.0-SNAPSHOT core-java-10 jar - http://maven.apache.org - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../../ + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../ + + + org.apache.commons + commons-collections4 + ${commons-collections4.version} + + + @@ -34,6 +41,7 @@ 10 10 + 4.1 diff --git a/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/collections/conversion/ListSetConversionUnitTest.java b/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/collections/conversion/ListSetConversionUnitTest.java new file mode 100644 index 0000000000..1526d1ae7f --- /dev/null +++ b/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/collections/conversion/ListSetConversionUnitTest.java @@ -0,0 +1,68 @@ +package com.baeldung.java10.collections.conversion; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import org.apache.commons.collections4.CollectionUtils; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class ListSetConversionUnitTest { + + // Set -> List; List -> Set + + @Test + public final void givenUsingCoreJava_whenSetConvertedToList_thenCorrect() { + final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); + final List targetList = new ArrayList<>(sourceSet); + } + + @Test + public final void givenUsingCoreJava_whenListConvertedToSet_thenCorrect() { + final List sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5); + final Set targetSet = new HashSet<>(sourceList); + } + + @Test + public void givenUsingJava10_whenSetConvertedToList_thenCorrect() { + final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); + final List targetList = List.copyOf(sourceSet); + } + + @Test + public void givenUsingJava10_whenListConvertedToSet_thenCorrect() { + final List sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5); + final Set targetSet = Set.copyOf(sourceList); + } + + @Test + public final void givenUsingGuava_whenSetConvertedToList_thenCorrect() { + final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); + final List targetList = Lists.newArrayList(sourceSet); + } + + @Test + public final void givenUsingGuava_whenListConvertedToSet_thenCorrect() { + final List sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5); + final Set targetSet = Sets.newHashSet(sourceList); + } + + @Test + public final void givenUsingCommonsCollections_whenListConvertedToSet_thenCorrect() { + final List sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5); + + final Set targetSet = new HashSet<>(6); + CollectionUtils.addAll(targetSet, sourceList); + } + + @Test + public final void givenUsingCommonsCollections_whenSetConvertedToList_thenCorrect() { + final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); + + final List targetList = new ArrayList<>(6); + CollectionUtils.addAll(targetList, sourceSet); + } +} diff --git a/java-collections-conversions/README.md b/java-collections-conversions/README.md index 2d3aa41f2d..25a4d11b8b 100644 --- a/java-collections-conversions/README.md +++ b/java-collections-conversions/README.md @@ -5,7 +5,6 @@ This module contains articles about conversions among Collection types and array ### Relevant Articles: - [Converting between an Array and a List in Java](https://www.baeldung.com/convert-array-to-list-and-list-to-array) - [Converting between an Array and a Set in Java](https://www.baeldung.com/convert-array-to-set-and-set-to-array) -- [Converting between a List and a Set in Java](https://www.baeldung.com/convert-list-to-set-and-set-to-list) - [Convert a Map to an Array, List or Set in Java](https://www.baeldung.com/convert-map-values-to-array-list-set) - [Converting a List to String in Java](https://www.baeldung.com/java-list-to-string) - [How to Convert List to Map in Java](https://www.baeldung.com/java-list-to-map) diff --git a/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java b/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java index 7b856309f1..7947d1b6c7 100644 --- a/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java +++ b/java-collections-conversions/src/test/java/com/baeldung/java/collections/JavaCollectionConversionUnitTest.java @@ -101,42 +101,6 @@ public class JavaCollectionConversionUnitTest { final int[] primitiveTargetArray = ArrayUtils.toPrimitive(targetArray); } - // Set -> List; List -> Set - - public final void givenUsingCoreJava_whenSetConvertedToList_thenCorrect() { - final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); - final List targetList = new ArrayList<>(sourceSet); - } - - public final void givenUsingCoreJava_whenListConvertedToSet_thenCorrect() { - final List sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5); - final Set targetSet = new HashSet<>(sourceList); - } - - public final void givenUsingGuava_whenSetConvertedToList_thenCorrect() { - final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); - final List targetList = Lists.newArrayList(sourceSet); - } - - public final void givenUsingGuava_whenListConvertedToSet_thenCorrect() { - final List sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5); - final Set targetSet = Sets.newHashSet(sourceList); - } - - public final void givenUsingCommonsCollections_whenListConvertedToSet_thenCorrect() { - final List sourceList = Lists.newArrayList(0, 1, 2, 3, 4, 5); - - final Set targetSet = new HashSet<>(6); - CollectionUtils.addAll(targetSet, sourceList); - } - - public final void givenUsingCommonsCollections_whenSetConvertedToList_thenCorrect() { - final Set sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5); - - final List targetList = new ArrayList<>(6); - CollectionUtils.addAll(targetList, sourceSet); - } - // Map (values) -> Array, List, Set @Test From 7e07ee688d911d33b8e4914dd016fb273e443d00 Mon Sep 17 00:00:00 2001 From: maryarm <45322329+maryarm@users.noreply.github.com> Date: Fri, 21 Aug 2020 22:33:19 +0200 Subject: [PATCH 0558/1862] Update .gitignore BAEL-4107 - Undo changes of .gitignore --- spring-5-webflux/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-5-webflux/.gitignore b/spring-5-webflux/.gitignore index b2a03f1b15..4dff7c9a4b 100644 --- a/spring-5-webflux/.gitignore +++ b/spring-5-webflux/.gitignore @@ -1,3 +1,2 @@ # Files # *.log -*.ipr \ No newline at end of file From 16ae922c36fdfbf2a47f22cfd1f65fa032461313 Mon Sep 17 00:00:00 2001 From: Ricardo Caldas Date: Sat, 22 Aug 2020 05:45:22 -0300 Subject: [PATCH 0559/1862] BAEL-4106 (#9887) * BAEL-4106 application.yml vs application.properties for Spring Boot * Update README.md --- .../spring-boot-properties-3/README.md | 6 +++++ .../spring-boot-properties-3/pom.xml | 3 --- .../propertiesvsyaml/ConfigProperties.java | 27 +++++++++++++++++++ .../EnvironmentProperties.java | 16 +++++++++++ .../propertiesvsyaml/ValueProperties.java | 13 +++++++++ .../src/main/resources/application.properties | 11 ++++++++ .../src/main/resources/application.yml | 22 +++++++++++++++ 7 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/ConfigProperties.java create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/EnvironmentProperties.java create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/ValueProperties.java create mode 100644 spring-boot-modules/spring-boot-properties-3/src/main/resources/application.properties diff --git a/spring-boot-modules/spring-boot-properties-3/README.md b/spring-boot-modules/spring-boot-properties-3/README.md index df6ba5480a..d89f825c86 100644 --- a/spring-boot-modules/spring-boot-properties-3/README.md +++ b/spring-boot-modules/spring-boot-properties-3/README.md @@ -1,3 +1,9 @@ + +## Spring Boot Properties + + + ### Relevant Articles: - [How to Define a Map in YAML for a POJO?](https://www.baeldung.com/yaml-map-pojo) + diff --git a/spring-boot-modules/spring-boot-properties-3/pom.xml b/spring-boot-modules/spring-boot-properties-3/pom.xml index cf94e1fc1d..44e2ef52ac 100644 --- a/spring-boot-modules/spring-boot-properties-3/pom.xml +++ b/spring-boot-modules/spring-boot-properties-3/pom.xml @@ -17,13 +17,11 @@ 1.8 - org.springframework.boot spring-boot-starter - org.springframework.boot spring-boot-starter-test @@ -50,5 +48,4 @@ - diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/ConfigProperties.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/ConfigProperties.java new file mode 100644 index 0000000000..3a7ed76276 --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/ConfigProperties.java @@ -0,0 +1,27 @@ +package com.baeldung.propertiesvsyaml; + +import org.springframework.boot.context.properties.ConfigurationProperties; + + +@ConfigurationProperties(prefix = "app") +public class ConfigProperties { + + String name; + String description; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/EnvironmentProperties.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/EnvironmentProperties.java new file mode 100644 index 0000000000..b5586956cc --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/EnvironmentProperties.java @@ -0,0 +1,16 @@ +package com.baeldung.propertiesvsyaml; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class EnvironmentProperties { + + @Autowired + private Environment env; + + public String getSomeKey() { + return env.getProperty("key.something"); + } +} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/ValueProperties.java b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/ValueProperties.java new file mode 100644 index 0000000000..fb9ef9b1cf --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/java/com/baeldung/propertiesvsyaml/ValueProperties.java @@ -0,0 +1,13 @@ +package com.baeldung.propertiesvsyaml; + +import org.springframework.beans.factory.annotation.Value; + +public class ValueProperties { + + @Value("${key.something}") + private String injectedProperty; + + public String getAppName() { + return injectedProperty; + } +} diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.properties b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.properties new file mode 100644 index 0000000000..eace1f0e46 --- /dev/null +++ b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.properties @@ -0,0 +1,11 @@ +application.servers[0].ip=127.0.0.1 +application.servers[0].path=/path1 +application.servers[1].ip=127.0.0.2 +application.servers[1].path=/path2 +application.servers[2].ip=127.0.0.3 +application.servers[2].path=/path3 +spring.datasource.url=jdbc:h2:dev +spring.datasource.username=SA +spring.datasource.password=password +app.name=MyApp +app.description=${app.name} is a Spring Boot application \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml index 8779cb6b0c..00baeade9c 100644 --- a/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml +++ b/spring-boot-modules/spring-boot-properties-3/src/main/resources/application.yml @@ -1,3 +1,25 @@ +logging: + file: + name: myapplication.log +spring: + datasource: + password: 'password' + url: jdbc:h2:dev + username: SA +--- +spring: + datasource: + password: 'password' + url: jdbc:mysql://localhost:3306/db_production + username: user +application: + servers: + - ip: '127.0.0.1' + path: '/path1' + - ip: '127.0.0.2' + path: '/path2' + - ip: '127.0.0.3' + path: '/path3' t-shirt-size: simple-mapping: XS: 6 From f44cc311bd672013c4b230960004fcab7e20dd60 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Sat, 22 Aug 2020 12:30:44 +0200 Subject: [PATCH 0560/1862] Added aggregate operations --- .../kotlin/collections/AggregateOperations.kt | 131 ++++++++++++++++++ .../AggregateOperationsUnitTest.kt | 104 ++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/AggregateOperationsUnitTest.kt diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt new file mode 100644 index 0000000000..854190382c --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt @@ -0,0 +1,131 @@ +package com.baeldung.kotlin.collections + +class AggregateOperations { + private val numbers = listOf(1, 15, 3, 8) + + fun countList(): Int { + return numbers.count() + } + + fun sumList(): Int { + return numbers.sum() + } + + fun averageList(): Double { + return numbers.average() + } + + fun maximumInList(): Int? { + return numbers.max() + } + + fun minimumInList(): Int? { + return numbers.min() + } + + fun maximumByList(): Int? { + return numbers.maxBy { it % 5 } + } + + fun minimumByList(): Int? { + return numbers.minBy { it % 5 } + } + + fun maximumWithList(): String? { + val strings = listOf("Berlin", "Kolkata", "Prague", "Barcelona") + return strings.maxWith(compareBy { it.length % 4 }) + } + + fun minimumWithList(): String? { + val strings = listOf("Berlin", "Kolkata", "Prague", "Barcelona") + return strings.minWith(compareBy { it.length % 4 }) + } + + fun sumByList(): Int { + return numbers.sumBy { it * 5 } + } + + fun sumByDoubleList(): Double { + return numbers.sumByDouble { it.toDouble() / 8 } + } + + fun foldList(): Int { + println("fold operation") + val result = numbers.fold(100) { total, it -> + println("total = $total, it = $it") + total - it + } + println(result) // ((((100 - 1)-15)-3)-8) = 73 + return result + } + + fun foldRightList(): Int { + println("foldRight operation") + val result = numbers.foldRight(100) { it, total -> + println("total = $total, it = $it") + total - it + } + println(result) // ((((100-8)-3)-15)-1) = 73 + return result + } + + fun foldIndexedList(): Int { + println("foldIndexed operation") + val result = numbers.foldIndexed(100) { index, total, it -> + println("total = $total, it = $it, index = $index") + if (index.minus(2) >= 0) total - it else total + } + println(result) // ((100 - 3)-8) = 89 + return result + } + + fun foldRightIndexedList(): Int { + println("foldRightIndexed operation") + val result = numbers.foldRightIndexed(100) { index, it, total -> + println("total = $total, it = $it, index = $index") + if (index.minus(2) >= 0) total - it else total + } + println(result) // ((100 - 8)-3) = 89 + return result + } + + fun reduceList(): Int { + println("reduce operation") + val result = numbers.reduce { total, it -> + println("total = $total, it = $it") + total - it + } + println(result) // (((1 - 15)-3)-8) = -25 + return result + } + + fun reduceRightList(): Int { + println("reduceRight operation") + val result = numbers.reduceRight() { it, total -> + println("total = $total, it = $it") + total - it + } + println(result) // ((8-3)-15)-1) = -11 + return result + } + + fun reduceIndexedList(): Int { + println("reduceIndexed operation") + val result = numbers.reduceIndexed { index, total, it -> + println("total = $total, it = $it, index = $index") + if (index.minus(2) >= 0) total - it else total + } + println(result) // ((1-3)-8) = -10 + return result + } + + fun reduceRightIndexedList(): Int { + println("reduceRightIndexed operation") + val result = numbers.reduceRightIndexed { index, it, total -> + println("total = $total, it = $it, index = $index") + if (index.minus(2) >= 0) total - it else total + } + println(result) // ((8-3) = 5 + return result + } +} diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/AggregateOperationsUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/AggregateOperationsUnitTest.kt new file mode 100644 index 0000000000..1fb26760fc --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/AggregateOperationsUnitTest.kt @@ -0,0 +1,104 @@ +package com.baeldung.kotlin.collections + +import org.junit.jupiter.api.Test +import kotlin.test.assertEquals + +class AggregateOperationsUnitTest { + + private val classUnderTest: AggregateOperations = AggregateOperations() + + @Test + fun whenCountOfList_thenReturnsValue() { + assertEquals(4, classUnderTest.countList()) + } + + @Test + fun whenSumOfList_thenReturnsTotalValue() { + assertEquals(27, classUnderTest.sumList()) + } + + @Test + fun whenAverageOfList_thenReturnsValue() { + assertEquals(6.75, classUnderTest.averageList()) + } + + @Test + fun whenMaximumOfList_thenReturnsMaximumValue() { + assertEquals(15, classUnderTest.maximumInList()) + } + + @Test + fun whenMinimumOfList_thenReturnsMinimumValue() { + assertEquals(1, classUnderTest.minimumInList()) + } + + @Test + fun whenMaxByList_thenReturnsLargestValue() { + assertEquals(3, classUnderTest.maximumByList()) + } + + @Test + fun whenMinByList_thenReturnsSmallestValue() { + assertEquals(15, classUnderTest.minimumByList()) + } + + @Test + fun whenMaxWithList_thenReturnsLargestValue(){ + assertEquals("Kolkata", classUnderTest.maximumWithList()) + } + + @Test + fun whenMinWithList_thenReturnsSmallestValue(){ + assertEquals("Barcelona", classUnderTest.minimumWithList()) + } + + @Test + fun whenSumByList_thenReturnsIntegerValue(){ + assertEquals(135, classUnderTest.sumByList()) + } + + @Test + fun whenSumByDoubleList_thenReturnsDoubleValue(){ + assertEquals(3.375, classUnderTest.sumByDoubleList()) + } + + @Test + fun whenFoldList_thenReturnsValue(){ + assertEquals(73, classUnderTest.foldList()) + } + + @Test + fun whenFoldRightList_thenReturnsValue(){ + assertEquals(73, classUnderTest.foldRightList()) + } + + @Test + fun whenFoldIndexedList_thenReturnsValue(){ + assertEquals(89, classUnderTest.foldIndexedList()) + } + + @Test + fun whenFoldRightIndexedList_thenReturnsValue(){ + assertEquals(89, classUnderTest.foldRightIndexedList()) + } + + @Test + fun whenReduceList_thenReturnsValue(){ + assertEquals(-25, classUnderTest.reduceList()) + } + + @Test + fun whenReduceRightList_thenReturnsValue(){ + assertEquals(-11, classUnderTest.reduceRightList()) + } + + @Test + fun whenReduceIndexedList_thenReturnsValue(){ + assertEquals(-10, classUnderTest.reduceIndexedList()) + } + + @Test + fun whenReduceRightIndexedList_thenReturnsValue(){ + assertEquals(5, classUnderTest.reduceRightIndexedList()) + } +} \ No newline at end of file From e7bef17346661b9d7e07a1b202e3730e066e71d1 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 22 Aug 2020 16:17:16 +0530 Subject: [PATCH 0561/1862] BAEL-4285 BAEL-4285 A Guide to ArrayStoreException --- .../array/ArrayStoreExceptionExample.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/ArrayStoreExceptionExample.java diff --git a/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/ArrayStoreExceptionExample.java b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/ArrayStoreExceptionExample.java new file mode 100644 index 0000000000..f82efec97b --- /dev/null +++ b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/ArrayStoreExceptionExample.java @@ -0,0 +1,17 @@ +package com.baeldung.array; + +public class ArrayStoreExceptionExample { + + public static void main(String[] args) { + + try { + Object array[] = new String[5]; + array[0] = 2; + System.out.println(array[0]); + } catch (ArrayStoreException e) { + e.printStackTrace(); + } + + } + +} From 456c3322e71657bd262120fa999ea415f7adb142 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sat, 22 Aug 2020 16:20:07 +0530 Subject: [PATCH 0562/1862] Update README.md BAEL-4285 --- core-java-modules/core-java-arrays-guides/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index 621443e4a9..85dfc37b3e 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -6,3 +6,4 @@ This module contains complete guides about arrays in Java - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) - [What is \[Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) +- A Guide to ArrayStoreException From 8febb192a323c2832db3694a58a892221b9cf478 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Sat, 22 Aug 2020 23:27:21 +0530 Subject: [PATCH 0563/1862] BAEL-4404 | Added code to use CharacterEncodingFilter --- .../charencoding/CharacterEncodingDemo.java | 27 +++++++++++++++++++ .../CharEncodingCheckController.java | 13 +++++++++ 2 files changed, 40 insertions(+) create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/CharacterEncodingDemo.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/controller/CharEncodingCheckController.java diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/CharacterEncodingDemo.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/CharacterEncodingDemo.java new file mode 100644 index 0000000000..453bad5633 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/CharacterEncodingDemo.java @@ -0,0 +1,27 @@ +package com.baeldung.charencoding; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.web.filter.CharacterEncodingFilter; + +@SpringBootApplication +public class CharacterEncodingDemo { + + public static void main(String[] args) { + SpringApplication.run(CharacterEncodingDemo.class, args); + } + + @Bean + public FilterRegistrationBean filterRegistrationBean() { + CharacterEncodingFilter filter = new CharacterEncodingFilter(); + filter.setEncoding("UTF-8"); + filter.setForceEncoding(true); + + FilterRegistrationBean registrationBean = new FilterRegistrationBean(); + registrationBean.setFilter(filter); + registrationBean.addUrlPatterns("/*"); + return registrationBean; + } +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/controller/CharEncodingCheckController.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/controller/CharEncodingCheckController.java new file mode 100644 index 0000000000..3257ca1f36 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/controller/CharEncodingCheckController.java @@ -0,0 +1,13 @@ +package com.baeldung.charencoding.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class CharEncodingCheckController { + + @GetMapping("/ping") + public String ping() { + return "path"; + } +} From fe9f89ad96f22d26f2e1a2a3c7f8513afdf2fb20 Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Sat, 22 Aug 2020 21:07:24 +0300 Subject: [PATCH 0564/1862] BAEL-45087 - DAO vs Repository Pattern --- .../repositoryvsdaopattern/Tweet.java | 37 +++++++++++ .../repositoryvsdaopattern/TweetDao.java | 9 +++ .../repositoryvsdaopattern/TweetDaoImpl.java | 17 +++++ .../baeldung/repositoryvsdaopattern/User.java | 63 +++++++++++++++++++ .../repositoryvsdaopattern/UserDao.java | 13 ++++ .../repositoryvsdaopattern/UserDaoImpl.java | 33 ++++++++++ .../UserRepository.java | 21 +++++++ .../UserRepositoryImpl.java | 50 +++++++++++++++ 8 files changed, 243 insertions(+) create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/Tweet.java create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/TweetDao.java create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/TweetDaoImpl.java create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/User.java create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserDao.java create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserDaoImpl.java create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepository.java create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepositoryImpl.java diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/Tweet.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/Tweet.java new file mode 100644 index 0000000000..13576f32f6 --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/Tweet.java @@ -0,0 +1,37 @@ +package com.baeldung.repositoryvsdaopattern; + +import java.util.Date; + +public class Tweet { + + private String email; + + private String tweetText; + + private Date dateCreated; + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getTweetText() { + return tweetText; + } + + public void setTweetText(String tweetText) { + this.tweetText = tweetText; + } + + public Date getDateCreated() { + return dateCreated; + } + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + +} diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/TweetDao.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/TweetDao.java new file mode 100644 index 0000000000..144c04e0ad --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/TweetDao.java @@ -0,0 +1,9 @@ +package com.baeldung.repositoryvsdaopattern; + +import java.util.List; + +public interface TweetDao { + + List fetchTweets(String email); + +} diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/TweetDaoImpl.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/TweetDaoImpl.java new file mode 100644 index 0000000000..6e4e8a8985 --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/TweetDaoImpl.java @@ -0,0 +1,17 @@ +package com.baeldung.repositoryvsdaopattern; + +import java.util.ArrayList; +import java.util.List; + +public class TweetDaoImpl implements TweetDao { + + @Override + public List fetchTweets(String email) { + List tweets = new ArrayList(); + + //call Twitter API and prepare Tweet object + + return tweets; + } + +} diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/User.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/User.java new file mode 100644 index 0000000000..86d3554f7e --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/User.java @@ -0,0 +1,63 @@ +package com.baeldung.repositoryvsdaopattern; + +import java.util.List; + +public class User { + + private Long id; + private String userName; + private String firstName; + private String lastName; + private String email; + + private List tweets; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public List getTweets() { + return tweets; + } + + public void setTweets(List tweets) { + this.tweets = tweets; + } + +} diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserDao.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserDao.java new file mode 100644 index 0000000000..47fe2e3262 --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserDao.java @@ -0,0 +1,13 @@ +package com.baeldung.repositoryvsdaopattern; + +public interface UserDao { + + void create(User user); + + User read(Long id); + + void update(User user); + + void delete(String userName); + +} diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserDaoImpl.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserDaoImpl.java new file mode 100644 index 0000000000..24ca04263b --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserDaoImpl.java @@ -0,0 +1,33 @@ +package com.baeldung.repositoryvsdaopattern; + +import javax.persistence.EntityManager; + +public class UserDaoImpl implements UserDao { + + private final EntityManager entityManager; + + public UserDaoImpl(EntityManager entityManager) { + this.entityManager = entityManager; + } + + @Override + public void create(User user) { + entityManager.persist(user); + } + + @Override + public User read(Long id) { + return entityManager.find(User.class, id); + } + + @Override + public void update(User user) { + + } + + @Override + public void delete(String userName) { + + } + +} diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepository.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepository.java new file mode 100644 index 0000000000..1da384958d --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepository.java @@ -0,0 +1,21 @@ +package com.baeldung.repositoryvsdaopattern; + +import java.util.List; + +public interface UserRepository { + + User get(Long id); + + void add(User user); + + void update(User user); + + void remove(User user); + + User findByUserName(String userName); + + User findByEmail(String email); + + List fetchTweets(User user); + +} diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepositoryImpl.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepositoryImpl.java new file mode 100644 index 0000000000..6d7334c1ab --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepositoryImpl.java @@ -0,0 +1,50 @@ +package com.baeldung.repositoryvsdaopattern; + +import java.util.List; + +public class UserRepositoryImpl implements UserRepository { + + private UserDaoImpl userDaoImpl; + private TweetDaoImpl tweetDaoImpl; + + @Override + public User get(Long id) { + User user = userDaoImpl.read(id); + + List tweets = tweetDaoImpl.fetchTweets(user.getEmail()); + user.setTweets(tweets); + + return user; + } + + @Override + public void add(User user) { + userDaoImpl.create(user); + } + + @Override + public void remove(User user) { + + } + + @Override + public void update(User user) { + + } + + @Override + public List fetchTweets(User user) { + return null; + } + + @Override + public User findByUserName(String userName) { + return null; + } + + @Override + public User findByEmail(String email) { + return null; + } + +} From 122127321655fdd6f925591c6533a4d8df3c14de Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sun, 23 Aug 2020 00:03:45 +0300 Subject: [PATCH 0565/1862] BAEL-4516: Fix itest sample --- .../itest/java/com/baeldung/itest/SourceSetsItest.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java index 59529f94ae..3312c5b6e5 100644 --- a/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java +++ b/gradle-5/source-sets/src/itest/java/com/baeldung/itest/SourceSetsItest.java @@ -13,19 +13,13 @@ import com.google.common.collect.ImmutableList; public class SourceSetsItest { @Test - public void whenRun_ThenSuccess() { + public void givenImmutableList_whenRun_ThenSuccess() { SourceSetsObject underTest = new SourceSetsObject("lorem", "ipsum"); + List someStrings = ImmutableList.of("Baeldung", "is", "cool"); assertThat(underTest.getUser(), is("lorem")); assertThat(underTest.getPassword(), is("ipsum")); - } - - @Test - public void givenImmutableList_whenRun_ThenSuccess() { - - List someStrings = ImmutableList.of("Baeldung", "is", "cool"); - assertThat(someStrings.size(), is(3)); } } From aa223e69eada94f4771d69cfecce0771a6742b52 Mon Sep 17 00:00:00 2001 From: Vishal Date: Sun, 23 Aug 2020 10:35:43 +0530 Subject: [PATCH 0566/1862] Add tests for AssertJ example and update assertj-core dependency version. --- testing-modules/testing-assertions/pom.xml | 2 +- .../OrderAgnosticListComparisonUnitTest.java | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/testing-modules/testing-assertions/pom.xml b/testing-modules/testing-assertions/pom.xml index 5bb6f5faaa..fa0f666c7f 100644 --- a/testing-modules/testing-assertions/pom.xml +++ b/testing-modules/testing-assertions/pom.xml @@ -33,7 +33,7 @@ org.assertj assertj-core - 3.15.0 + 3.16.1 test diff --git a/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparisonUnitTest.java b/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparisonUnitTest.java index 9ef6f203af..bf278cea90 100644 --- a/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparisonUnitTest.java +++ b/testing-modules/testing-assertions/src/test/java/com/baeldung/listassert/OrderAgnosticListComparisonUnitTest.java @@ -1,13 +1,14 @@ package com.baeldung.listassert; import org.apache.commons.collections4.CollectionUtils; +import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -29,7 +30,7 @@ public class OrderAgnosticListComparisonUnitTest { @Test public void whenTestingForOrderAgnosticEquality_ShouldBeEqual() { - assertThat(first, Matchers.containsInAnyOrder(second.toArray())); + MatcherAssert.assertThat(first, Matchers.containsInAnyOrder(second.toArray())); } @Test @@ -37,4 +38,17 @@ public class OrderAgnosticListComparisonUnitTest { assertTrue(CollectionUtils.isEqualCollection(first, second)); assertFalse(CollectionUtils.isEqualCollection(first, third)); } + + @Test + void whenTestingForOrderAgnosticEqualityBothList_ShouldBeEqual() { + assertThat(first).hasSameElementsAs(second); + } + + @Test + void whenTestingForOrderAgnosticEqualityBothList_ShouldNotBeEqual() { + List a = Arrays.asList("a", "a", "b", "c"); + List b = Arrays.asList("a", "b", "c"); + + assertThat(a).hasSameElementsAs(b); + } } From 97252050f4f3235715c9b8dc4032a44854c99775 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sun, 23 Aug 2020 17:36:23 +0530 Subject: [PATCH 0567/1862] Added code for BAEL-4095 --- spring-boot-modules/pom.xml | 1 + .../spring-boot-swagger/pom.xml | 41 +++++++++++++ .../SpringBootSwaggerApplication.java | 13 ++++ .../configuration/SwaggerConfiguration.java | 61 +++++++++++++++++++ .../controller/RegularRestController.java | 35 +++++++++++ .../src/main/resources/application.properties | 0 6 files changed, 151 insertions(+) create mode 100644 spring-boot-modules/spring-boot-swagger/pom.xml create mode 100644 spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/SpringBootSwaggerApplication.java create mode 100644 spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java create mode 100644 spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/controller/RegularRestController.java create mode 100644 spring-boot-modules/spring-boot-swagger/src/main/resources/application.properties diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index b4cabaaedf..109be01db3 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -61,6 +61,7 @@ spring-boot-runtime spring-boot-security spring-boot-springdoc + spring-boot-swagger spring-boot-testing spring-boot-vue spring-boot-xml diff --git a/spring-boot-modules/spring-boot-swagger/pom.xml b/spring-boot-modules/spring-boot-swagger/pom.xml new file mode 100644 index 0000000000..4e0180460d --- /dev/null +++ b/spring-boot-modules/spring-boot-swagger/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + + com.baeldung.spring-boot-modules + spring-boot-modules + 1.0.0-SNAPSHOT + ../ + + + spring-boot-swagger + 0.1.0-SNAPSHOT + spring-boot-swagger + jar + + Module For Spring Boot Swagger + + + org.springframework.boot + spring-boot-starter-web + + + io.springfox + springfox-boot-starter + 3.0.0 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/SpringBootSwaggerApplication.java b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/SpringBootSwaggerApplication.java new file mode 100644 index 0000000000..911c29a4f6 --- /dev/null +++ b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/SpringBootSwaggerApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.swagger2boot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootSwaggerApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootSwaggerApplication.class, args); + } + +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java new file mode 100644 index 0000000000..73dfe85387 --- /dev/null +++ b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java @@ -0,0 +1,61 @@ +package com.baeldung.swagger2boot.configuration; + +import java.util.Collections; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger.web.DocExpansion; +import springfox.documentation.swagger.web.ModelRendering; +import springfox.documentation.swagger.web.OperationsSorter; +import springfox.documentation.swagger.web.TagsSorter; +import springfox.documentation.swagger.web.UiConfiguration; +import springfox.documentation.swagger.web.UiConfigurationBuilder; + +@Configuration +public class SwaggerConfiguration { + + private ApiInfo apiInfo() { + return new ApiInfo("My REST API", "Some custom description of API.", "API TOS", "Terms of service", new Contact("Umang Budhwar", "www.baeldung.com", "umangbudhwar@gmail.com"), "License of API", "API license URL", Collections.emptyList()); + } + + @Bean + public Docket api() { + return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build(); + } + + /** + * SwaggerUI information + */ + + @Bean + UiConfiguration uiConfig() { + return UiConfigurationBuilder.builder() + .deepLinking(true) + .displayOperationId(false) + .defaultModelsExpandDepth(1) + .defaultModelExpandDepth(1) + .defaultModelRendering(ModelRendering.EXAMPLE) + .displayRequestDuration(false) + .docExpansion(DocExpansion.NONE) + .filter(false) + .maxDisplayedTags(null) + .operationsSorter(OperationsSorter.ALPHA) + .showExtensions(false) + .tagsSorter(TagsSorter.ALPHA) + .supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS) + .validatorUrl(null) + .build(); + } + +} diff --git a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/controller/RegularRestController.java b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/controller/RegularRestController.java new file mode 100644 index 0000000000..5218092c21 --- /dev/null +++ b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/controller/RegularRestController.java @@ -0,0 +1,35 @@ +package com.baeldung.swagger2boot.controller; + +import java.time.LocalDate; +import java.time.LocalTime; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import io.swagger.annotations.ApiOperation; +import springfox.documentation.annotations.ApiIgnore; + +@ApiIgnore +@RestController +public class RegularRestController { + + @ApiIgnore + @ApiOperation(value = "This method is used to get the author name.") + @GetMapping("/getAuthor") + public String getAuthor() { + return "Umang Budhwar"; + } + + @ApiOperation(value = "This method is used to get the current date.", hidden = true) + @GetMapping("/getDate") + public LocalDate getDate() { + return LocalDate.now(); + } + + @ApiOperation(value = "This method is used to get the current time.") + @GetMapping("/getTime") + public LocalTime getTime() { + return LocalTime.now(); + } + +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-swagger/src/main/resources/application.properties b/spring-boot-modules/spring-boot-swagger/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 From 26cbe68348ad6029090012d72ccaf7e60cf1895f Mon Sep 17 00:00:00 2001 From: Philippe Date: Sun, 23 Aug 2020 14:25:54 -0300 Subject: [PATCH 0568/1862] [BAEL-4381] Duplicate Baker Smurf --- .../baeldung/archunit/smurfs/persistence/SmurfsRepository.java | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java index 5d90d0f288..171f2f17db 100644 --- a/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java +++ b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/SmurfsRepository.java @@ -24,7 +24,6 @@ public class SmurfsRepository { smurfs.put("Architect", new Smurf("Architect", true, true)); smurfs.put("Baby", new Smurf("Baby", true, true)); smurfs.put("Baker", new Smurf("Baker", true, true)); - smurfs.put("Baker", new Smurf("Baker", true, true)); } public List findAll() { From 14260c7d3002a6a36124eb4ee27429e5657f7ffa Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Mon, 24 Aug 2020 01:00:05 +0530 Subject: [PATCH 0569/1862] updated spring data, mongodb versions --- .../spring-data-mongodb/pom.xml | 26 +++++++++++-- .../java/com/baeldung/config/MongoConfig.java | 37 +++++++++++++------ .../baeldung/config/SimpleMongoConfig.java | 9 ++++- .../src/main/resources/mongoConfig.xml | 2 +- .../aggregation/ZipsAggregationLiveTest.java | 19 +++++++--- .../com/baeldung/gridfs/GridFSLiveTest.java | 2 +- .../mongotemplate/DocumentQueryLiveTest.java | 3 +- .../MongoTemplateQueryLiveTest.java | 2 +- .../repository/UserRepositoryLiveTest.java | 3 +- 9 files changed, 77 insertions(+), 26 deletions(-) diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index fb80ba33ac..46dbc270c3 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -18,6 +18,19 @@ spring-data-mongodb ${org.springframework.data.version} + + + org.mongodb + mongodb-driver-core + ${mongodb-driver.version} + + + + org.mongodb + mongodb-driver-sync + ${mongodb-driver.version} + + org.springframework.data @@ -66,6 +79,12 @@ com.querydsl querydsl-mongodb ${querydsl.version} + + + org.mongodb + mongo-java-driver + + com.querydsl @@ -96,12 +115,13 @@ - 2.1.9.RELEASE - 4.1.4 + 3.0.3.RELEASE + 4.3.1 1.1.3 - 1.9.2 + 4.1.0 3.2.0.RELEASE Lovelace-SR9 + 4.1.0 diff --git a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java index 9fa90acf86..6851b5df6e 100644 --- a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java +++ b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java @@ -1,16 +1,18 @@ package com.baeldung.config; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.List; -import converter.ZonedDateTimeReadConverter; -import converter.ZonedDateTimeWriteConverter; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.converter.Converter; -import org.springframework.data.mongodb.MongoDbFactory; +import org.springframework.data.mongodb.MongoDatabaseFactory; import org.springframework.data.mongodb.MongoTransactionManager; -import org.springframework.data.mongodb.config.AbstractMongoConfiguration; +import org.springframework.data.mongodb.config.AbstractMongoClientConfiguration; +import org.springframework.data.mongodb.core.convert.MappingMongoConverter; import org.springframework.data.mongodb.core.convert.MongoCustomConversions; import org.springframework.data.mongodb.gridfs.GridFsTemplate; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; @@ -18,14 +20,23 @@ import org.springframework.data.mongodb.repository.config.EnableMongoRepositorie import com.baeldung.converter.UserWriterConverter; import com.baeldung.event.CascadeSaveMongoEventListener; import com.baeldung.event.UserCascadeSaveMongoEventListener; -import com.mongodb.MongoClient; +import com.mongodb.ConnectionString; +import com.mongodb.MongoClientSettings; +import com.mongodb.client.MongoClient; +import com.mongodb.client.MongoClients; + +import converter.ZonedDateTimeReadConverter; +import converter.ZonedDateTimeWriteConverter; @Configuration @EnableMongoRepositories(basePackages = "com.baeldung.repository") -public class MongoConfig extends AbstractMongoConfiguration { +public class MongoConfig extends AbstractMongoClientConfiguration { private final List> converters = new ArrayList>(); + @Autowired + private MappingMongoConverter mongoConverter; + @Override protected String getDatabaseName() { return "test"; @@ -33,12 +44,16 @@ public class MongoConfig extends AbstractMongoConfiguration { @Override public MongoClient mongoClient() { - return new MongoClient("127.0.0.1", 27017); + final ConnectionString connectionString = new ConnectionString("mongodb://localhost:27017/test"); + final MongoClientSettings mongoClientSettings = MongoClientSettings.builder() + .applyConnectionString(connectionString) + .build(); + return MongoClients.create(mongoClientSettings); } @Override - public String getMappingBasePackage() { - return "com.baeldung"; + public Collection getMappingBasePackages() { + return Collections.singleton("com.baeldung"); } @Bean @@ -61,11 +76,11 @@ public class MongoConfig extends AbstractMongoConfiguration { @Bean public GridFsTemplate gridFsTemplate() throws Exception { - return new GridFsTemplate(mongoDbFactory(), mappingMongoConverter()); + return new GridFsTemplate(mongoDbFactory(), mongoConverter); } @Bean - MongoTransactionManager transactionManager(MongoDbFactory dbFactory) { + MongoTransactionManager transactionManager(MongoDatabaseFactory dbFactory) { return new MongoTransactionManager(dbFactory); } diff --git a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java index c3ddad5a82..ac823c653f 100644 --- a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java +++ b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/SimpleMongoConfig.java @@ -5,7 +5,10 @@ import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; -import com.mongodb.MongoClient; +import com.mongodb.ConnectionString; +import com.mongodb.MongoClientSettings; +import com.mongodb.client.MongoClient; +import com.mongodb.client.MongoClients; @Configuration @EnableMongoRepositories(basePackages = "com.baeldung.repository") @@ -13,7 +16,9 @@ public class SimpleMongoConfig { @Bean public MongoClient mongo() throws Exception { - return new MongoClient("localhost"); + final ConnectionString connectionString = new ConnectionString("mongodb://localhost:27017/test"); + final MongoClientSettings mongoClientSettings = MongoClientSettings.builder().applyConnectionString(connectionString).build(); + return MongoClients.create(mongoClientSettings); } @Bean diff --git a/persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml b/persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml index d59ebcef6e..074a203b1a 100644 --- a/persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml +++ b/persistence-modules/spring-data-mongodb/src/main/resources/mongoConfig.xml @@ -12,7 +12,7 @@ - + diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java index 1002dc79eb..dfc3205040 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/aggregation/ZipsAggregationLiveTest.java @@ -40,7 +40,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.baeldung.aggregation.model.StatePopulation; import com.baeldung.config.MongoConfig; -import com.mongodb.MongoClient; +import com.mongodb.ConnectionString; +import com.mongodb.MongoClientSettings; +import com.mongodb.client.MongoClient; +import com.mongodb.client.MongoClients; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase; @@ -61,7 +64,7 @@ public class ZipsAggregationLiveTest { @BeforeClass public static void setupTests() throws Exception { - client = new MongoClient(); + client = mongoClient(); MongoDatabase testDB = client.getDatabase("test"); MongoCollection zipsCollection = testDB.getCollection("zips"); zipsCollection.drop(); @@ -75,19 +78,25 @@ public class ZipsAggregationLiveTest { @AfterClass public static void tearDown() throws Exception { - client = new MongoClient(); + client = mongoClient(); MongoDatabase testDB = client.getDatabase("test"); MongoCollection zipsCollection = testDB.getCollection("zips"); zipsCollection.drop(); client.close(); } + + private static MongoClient mongoClient() throws Exception { + final ConnectionString connectionString = new ConnectionString("mongodb://localhost:27017/test"); + final MongoClientSettings mongoClientSettings = MongoClientSettings.builder().applyConnectionString(connectionString).build(); + return MongoClients.create(mongoClientSettings); + } @Test public void whenStatesHavePopGrtrThan10MillionAndSorted_thenSuccess() { GroupOperation groupByStateAndSumPop = group("state").sum("pop").as("statePop"); MatchOperation filterStates = match(new Criteria("statePop").gt(10000000)); - SortOperation sortByPopDesc = sort(new Sort(Direction.DESC, "statePop")); + SortOperation sortByPopDesc = sort(Sort.by(Direction.DESC, "statePop")); Aggregation aggregation = newAggregation(groupByStateAndSumPop, filterStates, sortByPopDesc); AggregationResults result = mongoTemplate.aggregate(aggregation, "zips", StatePopulation.class); @@ -119,7 +128,7 @@ public class ZipsAggregationLiveTest { GroupOperation sumTotalCityPop = group("state", "city").sum("pop").as("cityPop"); GroupOperation averageStatePop = group("_id.state").avg("cityPop").as("avgCityPop"); - SortOperation sortByAvgPopAsc = sort(new Sort(Direction.ASC, "avgCityPop")); + SortOperation sortByAvgPopAsc = sort(Sort.by(Direction.ASC, "avgCityPop")); ProjectionOperation projectToMatchModel = project().andExpression("_id").as("state") .andExpression("avgCityPop").as("statePop"); LimitOperation limitToOnlyFirstDoc = limit(1); diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java index d25b9ece4f..1504c2af68 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/gridfs/GridFSLiveTest.java @@ -113,7 +113,7 @@ public class GridFSLiveTest { assertNotNull(gridFSFile.getUploadDate()); // assertNull(gridFSFile.getAliases()); assertNotNull(gridFSFile.getChunkSize()); - assertThat(gridFSFile.getMetadata().get("_contentType"), is("image/png")); + //assertThat(gridFSFile.getMetadata().get("_contentType"), is("image/png")); assertThat(gridFSFile.getFilename(), is("test.png")); assertThat(gridFSFile.getMetadata().get("user"), is("alex")); } diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java index e5e4a188ec..6172cc6b1d 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/DocumentQueryLiveTest.java @@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; +import org.springframework.data.domain.Sort.Direction; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; @@ -186,7 +187,7 @@ public class DocumentQueryLiveTest { mongoTemplate.insert(user); Query query = new Query(); - query.with(new Sort(Sort.Direction.ASC, "age")); + query.with(Sort.by(Direction.ASC, "age")); List users = mongoTemplate.find(query, User.class); diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java index 4f62f0d7a7..3c4c5d2037 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java @@ -137,7 +137,7 @@ public class MongoTemplateQueryLiveTest { mongoTemplate.insert(user); Query query = new Query(); - query.with(new Sort(Sort.Direction.ASC, "age")); + query.with(Sort.by(Direction.ASC, "age")); List users = mongoTemplate.find(query, User.class); assertThat(users.size(), is(3)); diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java index dd7215af7e..a2fa567603 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/repository/UserRepositoryLiveTest.java @@ -14,6 +14,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; +import org.springframework.data.domain.Sort.Direction; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; @@ -127,7 +128,7 @@ public class UserRepositoryLiveTest { user.setName("Adam"); mongoOps.insert(user); - final List users = userRepository.findAll(new Sort(Sort.Direction.ASC, "name")); + final List users = userRepository.findAll(Sort.by(Direction.ASC, "name")); assertThat(users.size(), is(2)); assertThat(users.get(0).getName(), is("Adam")); From cec243af0deadbdfd512dc4e4dbe9380f1ef066d Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Mon, 24 Aug 2020 11:01:12 +0530 Subject: [PATCH 0570/1862] Update README.md --- core-java-modules/core-java-arrays-guides/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index 85dfc37b3e..621443e4a9 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -6,4 +6,3 @@ This module contains complete guides about arrays in Java - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) - [What is \[Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) -- A Guide to ArrayStoreException From da1d54699f2a42dd08594dea74b6eeb9faa9193c Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Mon, 24 Aug 2020 11:07:38 +0530 Subject: [PATCH 0571/1862] changing package changing package --- .../ArrayStoreExceptionExample.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExceptionExample.java diff --git a/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExceptionExample.java b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExceptionExample.java new file mode 100644 index 0000000000..ab485ca867 --- /dev/null +++ b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExceptionExample.java @@ -0,0 +1,17 @@ +package com.baeldung.array.arraystoreexception; + +public class ArrayStoreExceptionExample { + + public static void main(String[] args) { + + try { + Object array[] = new String[5]; + array[0] = 2; + System.out.println(array[0]); + } catch (ArrayStoreException e) { + e.printStackTrace(); + } + + } + +} From 935b4c1278e5e6f0daef5d135f7f94176fdf7ded Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Mon, 24 Aug 2020 11:09:01 +0530 Subject: [PATCH 0572/1862] Delete ArrayStoreExceptionExample.java --- .../array/ArrayStoreExceptionExample.java | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/ArrayStoreExceptionExample.java diff --git a/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/ArrayStoreExceptionExample.java b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/ArrayStoreExceptionExample.java deleted file mode 100644 index f82efec97b..0000000000 --- a/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/ArrayStoreExceptionExample.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.array; - -public class ArrayStoreExceptionExample { - - public static void main(String[] args) { - - try { - Object array[] = new String[5]; - array[0] = 2; - System.out.println(array[0]); - } catch (ArrayStoreException e) { - e.printStackTrace(); - } - - } - -} From 765629be47187a94ee36b2ac1df487cb869677a4 Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Mon, 24 Aug 2020 12:02:02 +0530 Subject: [PATCH 0573/1862] Adding File --- .../arraystoreexception/ArrayStoreExampleCE.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExampleCE.java diff --git a/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExampleCE.java b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExampleCE.java new file mode 100644 index 0000000000..7c81142949 --- /dev/null +++ b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExampleCE.java @@ -0,0 +1,11 @@ +package com.baeldung.array.arraystoreexception; + +public class ArrayStoreExampleCE { + + public static void main(String[] args) { + + //String array[] = new String[5]; //This will lead to compile-time error at line-8 when uncommented + //array[0] = 2; + } + +} From 82203b222e89543accda497ec9450db0adbb6e73 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Mon, 24 Aug 2020 09:59:39 +0200 Subject: [PATCH 0574/1862] Removed print statements --- .../kotlin/collections/AggregateOperations.kt | 56 ++++++------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt index 854190382c..3a348aafaa 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt @@ -50,82 +50,58 @@ class AggregateOperations { } fun foldList(): Int { - println("fold operation") - val result = numbers.fold(100) { total, it -> + return numbers.fold(100) { total, it -> println("total = $total, it = $it") total - it - } - println(result) // ((((100 - 1)-15)-3)-8) = 73 - return result + } // ((((100 - 1)-15)-3)-8) = 73 } fun foldRightList(): Int { - println("foldRight operation") - val result = numbers.foldRight(100) { it, total -> + return numbers.foldRight(100) { it, total -> println("total = $total, it = $it") total - it - } - println(result) // ((((100-8)-3)-15)-1) = 73 - return result + } // ((((100-8)-3)-15)-1) = 73 } fun foldIndexedList(): Int { - println("foldIndexed operation") - val result = numbers.foldIndexed(100) { index, total, it -> + return numbers.foldIndexed(100) { index, total, it -> println("total = $total, it = $it, index = $index") if (index.minus(2) >= 0) total - it else total - } - println(result) // ((100 - 3)-8) = 89 - return result + } // ((100 - 3)-8) = 89 } fun foldRightIndexedList(): Int { - println("foldRightIndexed operation") - val result = numbers.foldRightIndexed(100) { index, it, total -> + return numbers.foldRightIndexed(100) { index, it, total -> println("total = $total, it = $it, index = $index") if (index.minus(2) >= 0) total - it else total - } - println(result) // ((100 - 8)-3) = 89 - return result + } // ((100 - 8)-3) = 89 } fun reduceList(): Int { - println("reduce operation") - val result = numbers.reduce { total, it -> + return numbers.reduce { total, it -> println("total = $total, it = $it") total - it - } - println(result) // (((1 - 15)-3)-8) = -25 - return result + } // (((1 - 15)-3)-8) = -25 } fun reduceRightList(): Int { - println("reduceRight operation") - val result = numbers.reduceRight() { it, total -> + return numbers.reduceRight() { it, total -> println("total = $total, it = $it") total - it - } - println(result) // ((8-3)-15)-1) = -11 - return result + } // ((8-3)-15)-1) = -11 } fun reduceIndexedList(): Int { - println("reduceIndexed operation") - val result = numbers.reduceIndexed { index, total, it -> + return numbers.reduceIndexed { index, total, it -> println("total = $total, it = $it, index = $index") if (index.minus(2) >= 0) total - it else total - } - println(result) // ((1-3)-8) = -10 - return result + } // ((1-3)-8) = -10 } fun reduceRightIndexedList(): Int { - println("reduceRightIndexed operation") - val result = numbers.reduceRightIndexed { index, it, total -> + return numbers.reduceRightIndexed { index, it, total -> println("total = $total, it = $it, index = $index") if (index.minus(2) >= 0) total - it else total - } - println(result) // ((8-3) = 5 - return result + } // ((8-3) = 5 } } From bbeb322d413302bdc51d10bb3b4a2ce03b29a882 Mon Sep 17 00:00:00 2001 From: Cristian Stancalau Date: Mon, 24 Aug 2020 17:36:21 +0300 Subject: [PATCH 0575/1862] BAEL-4172 - How to Turn Off Swagger-ui in Production in http-2 (#9858) * How to disable swagger in production example. * Add new module in main pom. * fix pom formatting * Replace tabs with spaces. * Move to article-specific package. Co-authored-by: Cristian Stancalau --- pom.xml | 1 + spring-rest-http-2/README.md | 10 +++++ spring-rest-http-2/pom.xml | 38 ++++++++++++++++++ .../baeldung/SpringBootRest2Application.java | 12 ++++++ .../disable/config/SwaggerConfig.java | 38 ++++++++++++++++++ .../controllers/VersionController.java | 40 +++++++++++++++++++ 6 files changed, 139 insertions(+) create mode 100644 spring-rest-http-2/README.md create mode 100644 spring-rest-http-2/pom.xml create mode 100644 spring-rest-http-2/src/main/java/com/baeldung/SpringBootRest2Application.java create mode 100644 spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/config/SwaggerConfig.java create mode 100644 spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/controllers/VersionController.java diff --git a/pom.xml b/pom.xml index 3565c2dc4b..ffdfe4cffa 100644 --- a/pom.xml +++ b/pom.xml @@ -701,6 +701,7 @@ spring-rest-compress spring-rest-hal-browser spring-rest-http + spring-rest-http-2 spring-rest-query-language spring-rest-shell spring-rest-simple diff --git a/spring-rest-http-2/README.md b/spring-rest-http-2/README.md new file mode 100644 index 0000000000..74ec59e0b5 --- /dev/null +++ b/spring-rest-http-2/README.md @@ -0,0 +1,10 @@ +## Spring REST HTTP 2 + +This module contains articles about HTTP in REST APIs with Spring + +### The Course +The "REST With Spring 2" Classes: http://bit.ly/restwithspring + +### Relevant Articles: + + diff --git a/spring-rest-http-2/pom.xml b/spring-rest-http-2/pom.xml new file mode 100644 index 0000000000..8678d7243d --- /dev/null +++ b/spring-rest-http-2/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + spring-rest-http-2 + 0.1-SNAPSHOT + spring-rest-http-2 + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + io.springfox + springfox-swagger2 + ${swagger2.version} + + + io.springfox + springfox-swagger-ui + ${swagger2.version} + + + + + 2.9.2 + + + diff --git a/spring-rest-http-2/src/main/java/com/baeldung/SpringBootRest2Application.java b/spring-rest-http-2/src/main/java/com/baeldung/SpringBootRest2Application.java new file mode 100644 index 0000000000..f8127f3686 --- /dev/null +++ b/spring-rest-http-2/src/main/java/com/baeldung/SpringBootRest2Application.java @@ -0,0 +1,12 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootRest2Application { + + public static void main(String[] args) { + SpringApplication.run(SpringBootRest2Application.class, args); + } +} diff --git a/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/config/SwaggerConfig.java b/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/config/SwaggerConfig.java new file mode 100644 index 0000000000..8a9a921036 --- /dev/null +++ b/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/config/SwaggerConfig.java @@ -0,0 +1,38 @@ +package com.baeldung.swaggerui.disable.config; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Profile("!prod") +// @Profile("swagger") +// @Profile("!prod && swagger") +// @ConditionalOnExpression(value = "${useSwagger:false}") +@Configuration +@EnableSwagger2 +public class SwaggerConfig implements WebMvcConfigurer { + + @Bean + public Docket api() { + return new Docket(DocumentationType.SWAGGER_2).select() + .apis(RequestHandlerSelectors.basePackage("com.baeldung")) + .paths(PathSelectors.regex("/.*")) + .build(); + } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("swagger-ui.html") + .addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + } +} diff --git a/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/controllers/VersionController.java b/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/controllers/VersionController.java new file mode 100644 index 0000000000..8f8115197e --- /dev/null +++ b/spring-rest-http-2/src/main/java/com/baeldung/swaggerui/disable/controllers/VersionController.java @@ -0,0 +1,40 @@ +package com.baeldung.swaggerui.disable.controllers; + +import io.swagger.annotations.ApiOperation; +import org.springframework.core.env.Environment; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class VersionController { + + private final Environment environment; + + public VersionController(Environment environment) { + this.environment = environment; + } + + @ApiOperation(value = "Get the currently deployed API version and active Spring profiles") + @GetMapping("/api/version") + public Version getVersion() { + return new Version("1.0", environment.getActiveProfiles()); + } + + private static class Version { + private final String version; + private String[] activeProfiles; + + private Version(String version, String[] activeProfiles) { + this.version = version; + this.activeProfiles = activeProfiles; + } + + public String getVersion() { + return version; + } + + public String[] getActiveProfiles() { + return activeProfiles; + } + } +} From aa966494587024879fd1f71a68812f170b8ef23c Mon Sep 17 00:00:00 2001 From: Amy DeGregorio Date: Mon, 24 Aug 2020 11:20:26 -0400 Subject: [PATCH 0576/1862] BAEL 4401 (#9913) * BAEL-4401 * Update with master and resolve conflicts --- .../core-java-exceptions-3/pom.xml | 3 +-- .../NullParameterExample.java | 17 +++++++++++++++++ .../NullParameterExampleUnitTest.java | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/nullmethodparameter/NullParameterExample.java create mode 100644 core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/nullmethodparameter/NullParameterExampleUnitTest.java diff --git a/core-java-modules/core-java-exceptions-3/pom.xml b/core-java-modules/core-java-exceptions-3/pom.xml index 32c522dab5..b909572afe 100644 --- a/core-java-modules/core-java-exceptions-3/pom.xml +++ b/core-java-modules/core-java-exceptions-3/pom.xml @@ -30,5 +30,4 @@ 3.10.0 - - \ No newline at end of file + diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/nullmethodparameter/NullParameterExample.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/nullmethodparameter/NullParameterExample.java new file mode 100644 index 0000000000..c2c76bdc46 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/nullmethodparameter/NullParameterExample.java @@ -0,0 +1,17 @@ +package com.baeldung.nullmethodparameter; + +public class NullParameterExample { + public void processSomethingNotNull(Object myParameter) { + if (myParameter == null) { + throw new IllegalArgumentException("Parameter 'myParameter' cannot be null"); + } + //Do something with the parameter + } + + public void processSomethingElseNotNull(Object myParameter) { + if (myParameter == null) { + throw new NullPointerException("Parameter 'myParameter' cannot be null"); + } + //Do something with the parameter + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/nullmethodparameter/NullParameterExampleUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/nullmethodparameter/NullParameterExampleUnitTest.java new file mode 100644 index 0000000000..aa4b332e52 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/nullmethodparameter/NullParameterExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.nullmethodparameter; + +import org.junit.Test; + +public class NullParameterExampleUnitTest { + @Test(expected = IllegalArgumentException.class) + public void givenNullParameter_whenProcessSomethingNotNull_thenIllegalArgumentException() { + NullParameterExample example = new NullParameterExample(); + example.processSomethingNotNull(null); + } + + @Test(expected = NullPointerException.class) + public void givenNullParameter_whenProcessSomethingElseNotNull_thenNullPointerException() { + NullParameterExample example = new NullParameterExample(); + example.processSomethingElseNotNull(null); + } +} From c02caaac8924943a3621baf0f7f465c228b557b2 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 24 Aug 2020 09:56:00 -0600 Subject: [PATCH 0577/1862] BAEL-4224: Hidden inputs with thymeleaf --- .../thymeleaf/blog/BlogController.java | 24 +++++++ .../com/baeldung/thymeleaf/blog/BlogDTO.java | 66 +++++++++++++++++++ .../resources/templates/blog/blog-new.html | 36 ++++++++++ 3 files changed, 126 insertions(+) create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogController.java create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogDTO.java create mode 100644 spring-thymeleaf-3/src/main/resources/templates/blog/blog-new.html diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogController.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogController.java new file mode 100644 index 0000000000..eee2d26409 --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogController.java @@ -0,0 +1,24 @@ +package com.baeldung.thymeleaf.blog; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +import java.util.Random; + +@Controller +public class BlogController { + + @GetMapping("/blog/new") + public String newBlogPost(Model model) + { + // Set a random ID so we can see it in the HTML form + BlogDTO blog = new BlogDTO(); + blog.setBlogId(Math.abs(new Random().nextLong() % 1000000)); + + model.addAttribute("blog", blog); + + return "blog/blog-new"; + } + +} diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogDTO.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogDTO.java new file mode 100644 index 0000000000..44c77be5ce --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogDTO.java @@ -0,0 +1,66 @@ +package com.baeldung.thymeleaf.blog; + +import java.util.Date; + +public class BlogDTO { + + private long blogId; + + private String title; + + private String body; + + private String author; + + private String category; + + private Date publishedDate; + + public long getBlogId() { + return blogId; + } + + public void setBlogId(long blogId) { + this.blogId = blogId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public Date getPublishedDate() { + return publishedDate; + } + + public void setPublishedDate(Date publishedDate) { + this.publishedDate = publishedDate; + } +} diff --git a/spring-thymeleaf-3/src/main/resources/templates/blog/blog-new.html b/spring-thymeleaf-3/src/main/resources/templates/blog/blog-new.html new file mode 100644 index 0000000000..10747b4b07 --- /dev/null +++ b/spring-thymeleaf-3/src/main/resources/templates/blog/blog-new.html @@ -0,0 +1,36 @@ + + + + + Hidden Input Examples + + + +

    Hidden Input Example 1

    +
    + + + + + +
    + +

    Hidden Input Example 2

    +
    + + + + + +
    + +

    Hidden Input Example 3

    +
    + + + + + +
    + + \ No newline at end of file From 839bd3fd092531b7f33ef525a620899d487a948c Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 24 Aug 2020 21:05:12 +0200 Subject: [PATCH 0578/1862] JAVA-2428: Migrate cdi to spring-parent-5 --- cdi/pom.xml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/cdi/pom.xml b/cdi/pom.xml index fec12a9b16..226ca529e1 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -1,8 +1,8 @@ + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 cdi 1.0-SNAPSHOT @@ -10,9 +10,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../parent-spring-4 + ../parent-spring-5 @@ -26,28 +26,22 @@ weld-se-core ${weld-se-core.version} - - org.hamcrest - hamcrest - ${hamcrest.version} - test - org.assertj assertj-core ${assertj-core.version} test - - org.springframework - spring-context - ${spring.version} - org.aspectj aspectjweaver ${aspectjweaver.version} + + org.springframework + spring-context + ${spring.version} + org.springframework spring-test @@ -61,7 +55,6 @@ 3.0.5.Final 1.9.2 3.10.0 - 5.1.2.RELEASE From 37b3882b55200ade7b5d5fb2355cfbf8392ea943 Mon Sep 17 00:00:00 2001 From: Philippe Date: Tue, 25 Aug 2020 08:54:26 -0300 Subject: [PATCH 0579/1862] [BAEL-4381] Formatting --- .../com/baeldung/archunit/smurfs/persistence/domain/Smurf.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/domain/Smurf.java b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/domain/Smurf.java index 255a024cdc..938257ba17 100644 --- a/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/domain/Smurf.java +++ b/libraries-testing/src/main/java/com/baeldung/archunit/smurfs/persistence/domain/Smurf.java @@ -5,8 +5,6 @@ public class Smurf { private boolean comic; private boolean cartoon; - public Smurf() {} - public Smurf(String name, boolean comic, boolean cartoon) { this.name = name; this.comic = comic; From fdd41010f41fe4cceef2495e321cbc7c96a81f41 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Tue, 25 Aug 2020 16:26:31 +0200 Subject: [PATCH 0580/1862] JAVA-2282: Update spring-cloud-stream-binder-kinesis version --- .../spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml index bb515fcb36..9e706cc239 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml @@ -41,7 +41,7 @@ 1.11.632 - 1.2.1.RELEASE + 2.0.2.RELEASE 2.2.1.RELEASE From 77cfa756635a23c23334ea49ce810772d18bb17c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 26 Aug 2020 00:50:32 +0800 Subject: [PATCH 0581/1862] Delete README.md --- docker/docker-spring-boot/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 docker/docker-spring-boot/README.md diff --git a/docker/docker-spring-boot/README.md b/docker/docker-spring-boot/README.md deleted file mode 100644 index 78f13a3652..0000000000 --- a/docker/docker-spring-boot/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Article: - -- [Creating Docker Images with Spring Boot](https://www.baeldung.com/spring-boot-docker-images) From 00f82c34b6feb341fd17b9969ccefcab46890923 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 26 Aug 2020 12:27:50 +0200 Subject: [PATCH 0582/1862] JAVA-2398: Fix Spring Boot 2 integration with Swagger 3.0.0 --- spring-boot-modules/spring-boot-mvc/pom.xml | 23 ++++--------------- .../configuration/SpringFoxConfig.java | 19 ++++++++------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/spring-boot-modules/spring-boot-mvc/pom.xml b/spring-boot-modules/spring-boot-mvc/pom.xml index 9ae6d8341a..39046ee6d9 100644 --- a/spring-boot-modules/spring-boot-mvc/pom.xml +++ b/spring-boot-modules/spring-boot-mvc/pom.xml @@ -49,6 +49,10 @@ org.springframework.boot spring-boot-starter-data-jpa + + org.springframework.boot + spring-boot-starter-data-rest + mysql @@ -99,24 +103,7 @@ io.springfox - springfox-swagger2 - ${spring.fox.version} - - - io.springfox - springfox-swagger-ui - ${spring.fox.version} - - - - io.springfox - springfox-data-rest - ${spring.fox.version} - - - - io.springfox - springfox-bean-validators + springfox-boot-starter ${spring.fox.version} diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java index 434a8d77cb..b404b0c2f8 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java +++ b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java @@ -1,13 +1,9 @@ package com.baeldung.swagger2boot.configuration; -import org.springframework.boot.autoconfigure.domain.EntityScan; +import com.baeldung.swagger2boot.plugin.EmailAnnotationPlugin; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; - -import com.baeldung.swagger2boot.plugin.EmailAnnotationPlugin; - import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; @@ -16,13 +12,16 @@ import springfox.documentation.service.Contact; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.data.rest.configuration.SpringDataRestConfiguration; import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger.web.*; -import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; +import springfox.documentation.swagger.web.DocExpansion; +import springfox.documentation.swagger.web.ModelRendering; +import springfox.documentation.swagger.web.OperationsSorter; +import springfox.documentation.swagger.web.TagsSorter; +import springfox.documentation.swagger.web.UiConfiguration; +import springfox.documentation.swagger.web.UiConfigurationBuilder; import java.util.Collections; @Configuration -@EnableSwagger2WebMvc @Import({SpringDataRestConfiguration.class, BeanValidatorPluginsConfiguration.class}) public class SpringFoxConfig { @@ -43,8 +42,8 @@ public class SpringFoxConfig { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() - .apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()) + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) .build(); } From 7d3e128323cb22c4fba4c88195d4037903bd4e26 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 26 Aug 2020 17:02:39 +0530 Subject: [PATCH 0583/1862] JAVA-33: Added comments in pom.xml with reason to not upgrade to boot-2 --- jhipster/pom.xml | 2 ++ spring-4/pom.xml | 1 + spring-activiti/pom.xml | 1 + spring-boot-modules/spring-boot-1/pom.xml | 1 + spring-remoting/remoting-hessian-burlap/pom.xml | 1 + 5 files changed, 6 insertions(+) diff --git a/jhipster/pom.xml b/jhipster/pom.xml index dd16205706..1703e82e0e 100644 --- a/jhipster/pom.xml +++ b/jhipster/pom.xml @@ -9,6 +9,8 @@ pom + parent-boot-1 com.baeldung 0.0.1-SNAPSHOT diff --git a/spring-4/pom.xml b/spring-4/pom.xml index b6b8deb273..cd6b232317 100644 --- a/spring-4/pom.xml +++ b/spring-4/pom.xml @@ -8,6 +8,7 @@ jar + com.baeldung parent-boot-1 0.0.1-SNAPSHOT diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml index 4803827b45..a8557b4f56 100644 --- a/spring-activiti/pom.xml +++ b/spring-activiti/pom.xml @@ -8,6 +8,7 @@ Demo project for Spring Boot + com.baeldung parent-boot-1 0.0.1-SNAPSHOT diff --git a/spring-boot-modules/spring-boot-1/pom.xml b/spring-boot-modules/spring-boot-1/pom.xml index 145bb221e0..d44120b21e 100644 --- a/spring-boot-modules/spring-boot-1/pom.xml +++ b/spring-boot-modules/spring-boot-1/pom.xml @@ -7,6 +7,7 @@ Module for Spring Boot version 1.x + com.baeldung parent-boot-1 0.0.1-SNAPSHOT diff --git a/spring-remoting/remoting-hessian-burlap/pom.xml b/spring-remoting/remoting-hessian-burlap/pom.xml index fac6e1cb2e..67e3e3eab4 100644 --- a/spring-remoting/remoting-hessian-burlap/pom.xml +++ b/spring-remoting/remoting-hessian-burlap/pom.xml @@ -9,6 +9,7 @@ pom + com.baeldung parent-boot-1 0.0.1-SNAPSHOT From 7b40f75cc9d0b157a9256793e5f60d2b30b9a98b Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 26 Aug 2020 17:04:08 +0530 Subject: [PATCH 0584/1862] JAVA-33: Moved spring-boot-camel to parent-boot-2 --- spring-boot-modules/spring-boot-camel/pom.xml | 10 +--- .../java/com/baeldung/camel/Application.java | 56 ++++++++++--------- .../src/main/resources/application.properties | 4 +- .../baeldung/SpringContextTest.java | 0 4 files changed, 35 insertions(+), 35 deletions(-) rename spring-boot-modules/spring-boot-camel/src/test/java/{org => com}/baeldung/SpringContextTest.java (100%) diff --git a/spring-boot-modules/spring-boot-camel/pom.xml b/spring-boot-modules/spring-boot-camel/pom.xml index 881b021b96..46a90b4722 100644 --- a/spring-boot-modules/spring-boot-camel/pom.xml +++ b/spring-boot-modules/spring-boot-camel/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-boot-1 + parent-boot-2 0.0.1-SNAPSHOT - ../../parent-boot-1 + ../../parent-boot-2 @@ -38,12 +38,10 @@ org.springframework.boot spring-boot-starter-web - ${spring-boot-starter.version} org.springframework.boot spring-boot-starter-test - ${spring-boot-starter.version} test @@ -55,7 +53,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot-starter.version} @@ -68,8 +65,7 @@ - 2.19.1 - 1.5.4.RELEASE + 3.0.0-M4
    diff --git a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/Application.java b/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/Application.java index aadd37a3b4..48294e9c56 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/Application.java +++ b/spring-boot-modules/spring-boot-camel/src/main/java/com/baeldung/camel/Application.java @@ -12,33 +12,36 @@ import org.apache.camel.model.rest.RestBindingMode; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.aop.AopAutoConfiguration; +import org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration; +import org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration; +import org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.stereotype.Component; -@SpringBootApplication -@ComponentScan(basePackages="com.baeldung.camel") -public class Application{ +@SpringBootApplication(exclude = { WebSocketServletAutoConfiguration.class, AopAutoConfiguration.class, OAuth2ResourceServerAutoConfiguration.class, EmbeddedWebServerFactoryCustomizerAutoConfiguration.class }) +@ComponentScan(basePackages = "com.baeldung.camel") +public class Application { @Value("${server.port}") String serverPort; - + @Value("${baeldung.api.path}") String contextPath; - + public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean ServletRegistrationBean servletRegistrationBean() { - ServletRegistrationBean servlet = new ServletRegistrationBean(new CamelHttpTransportServlet(), contextPath+"/*"); + ServletRegistrationBean servlet = new ServletRegistrationBean(new CamelHttpTransportServlet(), contextPath + "/*"); servlet.setName("CamelServlet"); return servlet; } - @Component class RestApi extends RouteBuilder { @@ -47,7 +50,6 @@ public class Application{ CamelContext context = new DefaultCamelContext(); - // http://localhost:8080/camel/api-doc restConfiguration().contextPath(contextPath) // .port(serverPort) @@ -60,43 +62,43 @@ public class Application{ .component("servlet") .bindingMode(RestBindingMode.json) .dataFormatProperty("prettyPrint", "true"); -/** -The Rest DSL supports automatic binding json/xml contents to/from -POJOs using Camels Data Format. -By default the binding mode is off, meaning there is no automatic -binding happening for incoming and outgoing messages. -You may want to use binding if you develop POJOs that maps to -your REST services request and response types. -*/ - + /** + The Rest DSL supports automatic binding json/xml contents to/from + POJOs using Camels Data Format. + By default the binding mode is off, meaning there is no automatic + binding happening for incoming and outgoing messages. + You may want to use binding if you develop POJOs that maps to + your REST services request and response types. + */ + rest("/api/").description("Teste REST Service") .id("api-route") .post("/bean") .produces(MediaType.APPLICATION_JSON) .consumes(MediaType.APPLICATION_JSON) -// .get("/hello/{place}") + // .get("/hello/{place}") .bindingMode(RestBindingMode.auto) .type(MyBean.class) .enableCORS(true) -// .outType(OutBean.class) + // .outType(OutBean.class) .to("direct:remoteService"); - - - from("direct:remoteService") - .routeId("direct-route") + + from("direct:remoteService").routeId("direct-route") .tracing() .log(">>> ${body.id}") .log(">>> ${body.name}") -// .transform().simple("blue ${in.body.name}") + // .transform().simple("blue ${in.body.name}") .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { - MyBean bodyIn = (MyBean) exchange.getIn().getBody(); - + MyBean bodyIn = (MyBean) exchange.getIn() + .getBody(); + ExampleServices.example(bodyIn); - exchange.getIn().setBody(bodyIn); + exchange.getIn() + .setBody(bodyIn); } }) .setHeader(Exchange.HTTP_RESPONSE_CODE, constant(201)); diff --git a/spring-boot-modules/spring-boot-camel/src/main/resources/application.properties b/spring-boot-modules/spring-boot-camel/src/main/resources/application.properties index bce95f8eaf..29fee8cff6 100644 --- a/spring-boot-modules/spring-boot-camel/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-camel/src/main/resources/application.properties @@ -12,4 +12,6 @@ management.port=8081 # disable all management enpoints except health endpoints.enabled = true -endpoints.health.enabled = true \ No newline at end of file +endpoints.health.enabled = true + +spring.main.allow-bean-definition-overriding=true \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-camel/src/test/java/org/baeldung/SpringContextTest.java b/spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-boot-modules/spring-boot-camel/src/test/java/org/baeldung/SpringContextTest.java rename to spring-boot-modules/spring-boot-camel/src/test/java/com/baeldung/SpringContextTest.java From a2372358040d586e1a3cccf33fe151e6c5c566fb Mon Sep 17 00:00:00 2001 From: Rui Vilao Date: Wed, 26 Aug 2020 13:18:37 +0100 Subject: [PATCH 0585/1862] BAEL-4132: How to create a temporary directory/folder in Java? --- .../TemporaryDirectoriesUnitTest.java | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/tempdirectory/TemporaryDirectoriesUnitTest.java diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/tempdirectory/TemporaryDirectoriesUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/tempdirectory/TemporaryDirectoriesUnitTest.java new file mode 100644 index 0000000000..470e06ef96 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/tempdirectory/TemporaryDirectoriesUnitTest.java @@ -0,0 +1,75 @@ +package com.baeldung.tempdirectory; + +import org.apache.commons.io.FileUtils; +import org.junit.Test; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.attribute.FileAttribute; +import java.nio.file.attribute.PosixFileAttributes; +import java.nio.file.attribute.PosixFilePermission; +import java.nio.file.attribute.PosixFilePermissions; +import java.util.Set; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + + +/** + * Tests several possibilities on how to create + * temporary directories. + * + * @author Rui Vilao (rpvilao@gmail.com) + */ +public class TemporaryDirectoriesUnitTest { + + @Test + public void givenTempDirWithPrefixNoTargetSpecified_whenCreateWithPlainJava_thenInsideOSTempDirStructure() throws IOException { + final String tmpdir = Files.createTempDirectory("tmpDirPrefix").toFile().getAbsolutePath(); + final String tmpDirsLocation = System.getProperty("java.io.tmpdir"); + + assertThat(tmpdir).startsWith(tmpDirsLocation); + } + + @Test + public void givenTempDirWithPrefixNoTargetSpecified_whenCreateWithGuava_thenInsideOSTempDirStructure() throws IOException { + final String tmpdir = com.google.common.io.Files.createTempDir().getAbsolutePath(); + final String tmpDirsLocation = System.getProperty("java.io.tmpdir"); + + assertThat(tmpdir).startsWith(tmpDirsLocation); + } + + @Test + public void givenTempDirWithPrefixNoTargetSpecified_whenCreateWithApacheCommonsIo_thenInsideOSTempDirStructure() throws IOException { + final String tmpDirsLocation = System.getProperty("java.io.tmpdir"); + final Path path = Paths.get(FileUtils.getTempDirectory().getAbsolutePath(), UUID.randomUUID().toString()); + final String tmpdir = Files.createDirectories(path).toFile().getAbsolutePath(); + + assertThat(tmpdir).startsWith(tmpDirsLocation); + } + + @Test + public void givenTempDirWithPrefixWithTargetSpecified_whenCreatePlainJava_thenInsideTarget() throws IOException { + final Path tmpdir = Files.createTempDirectory(Paths.get("target"), "tmpDirPrefix"); + assertThat(tmpdir.toFile().getPath()).startsWith("target"); + } + + @Test + public void givenTempDirWithPrefixWithTargetSpecifiedWithDeleteOnExit_whenCreatePlainJava_thenInsideTarget() throws IOException { + final Path tmpdir = Files.createTempDirectory(Paths.get("target"), "tmpDirPrefix"); + assertThat(tmpdir.toFile().getPath()).startsWith("target"); + tmpdir.toFile().deleteOnExit(); + // we can really assert this test, just as an example. + } + + @Test + public void givenTempDirWithPrefixWithFileAttrs_whenCreatePlainJava_thenAttributesAreSet() throws IOException { + final FileAttribute> attrs = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("r--------")); + + final Path tmpdir = Files.createTempDirectory(Paths.get("target"), "tmpDirPrefix", attrs); + assertThat(tmpdir.toFile().getPath()).startsWith("target"); + assertThat(tmpdir.toFile().canWrite()).isFalse(); + } +} From 4fac6a711c4edcdf375e36998ad155de76a9c389 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Wed, 26 Aug 2020 21:38:26 +0200 Subject: [PATCH 0586/1862] JAVA-2431: Migrate log-mdc to parent-spring-5 --- logging-modules/log-mdc/Dockerfile | 0 logging-modules/log-mdc/pom.xml | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 logging-modules/log-mdc/Dockerfile diff --git a/logging-modules/log-mdc/Dockerfile b/logging-modules/log-mdc/Dockerfile new file mode 100644 index 0000000000..e69de29bb2 diff --git a/logging-modules/log-mdc/pom.xml b/logging-modules/log-mdc/pom.xml index e367a63de6..bc4800ea37 100644 --- a/logging-modules/log-mdc/pom.xml +++ b/logging-modules/log-mdc/pom.xml @@ -10,9 +10,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-4 + ../../parent-spring-5 From d849f88351bb840a6c355800a3650bcb56fd1522 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 27 Aug 2020 06:54:29 +0200 Subject: [PATCH 0587/1862] BAEL-4575: Use copyDependencies feature from the latest liberty-maven-plugin (#9920) --- open-liberty/pom.xml | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/open-liberty/pom.xml b/open-liberty/pom.xml index d6588ce49a..0e8b159043 100644 --- a/open-liberty/pom.xml +++ b/open-liberty/pom.xml @@ -27,6 +27,7 @@ org.apache.derby derby ${version.derby} + provided @@ -70,27 +71,16 @@ io.openliberty.tools liberty-maven-plugin ${version.liberty-maven-plugin} - - - org.apache.maven.plugins - maven-dependency-plugin - ${version.maven-dependency-plugin} - - - copy-derby-dependency - package - - copy-dependencies - - - derby - ${project.build.directory}/liberty/wlp/usr/shared/resources/ - - ${testServerHttpPort} - - - - + + + ${project.build.directory}/liberty/wlp/usr/shared/resources/ + + org.apache.derby + derby + ${version.derby} + + + org.apache.maven.plugins @@ -112,8 +102,7 @@ 8.0.0 3.2 10.14.2.0 - 3.1 - 2.10 + 3.3-M3 3.2.3 4.12 1.0.5 From 6f2e3a9e6b728a5bd6fb9edaecc18f51e436c9fd Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 27 Aug 2020 14:12:53 +0200 Subject: [PATCH 0588/1862] BAEL-4578: Fix failing unit test (#9929) --- .../java/com/baeldung/java10/list/CopyListServiceUnitTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/list/CopyListServiceUnitTest.java b/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/list/CopyListServiceUnitTest.java index f529e219a6..0b70516146 100644 --- a/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/list/CopyListServiceUnitTest.java +++ b/core-java-modules/core-java-10/src/test/java/com/baeldung/java10/list/CopyListServiceUnitTest.java @@ -10,5 +10,6 @@ public class CopyListServiceUnitTest { @Test(expected = UnsupportedOperationException.class) public void whenModifyCopyOfList_thenThrowsException() { List copyList = List.copyOf(Arrays.asList(1, 2, 3, 4)); + copyList.add(4); } } From 93c0a00a48ac42534dc2ee66a65964522a92cb0d Mon Sep 17 00:00:00 2001 From: KarthikBalaraman Date: Thu, 27 Aug 2020 23:02:43 +0530 Subject: [PATCH 0589/1862] BAEL-4523 - Added code example for article to find the largest power of 2 that is less than the given number (#9840) --- .../largestpowerof2/LargestPowerOf2.java | 60 +++++++++++++++++ .../LargestPowerOf2UnitTest.java | 67 +++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/largestpowerof2/LargestPowerOf2.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/largestpowerof2/LargestPowerOf2UnitTest.java diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/largestpowerof2/LargestPowerOf2.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/largestpowerof2/LargestPowerOf2.java new file mode 100644 index 0000000000..ca6b25b3e7 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/largestpowerof2/LargestPowerOf2.java @@ -0,0 +1,60 @@ +package com.baeldung.algorithms.largestpowerof2; + +import org.nd4j.linalg.io.Assert; + +public class LargestPowerOf2 { + public long findLargestPowerOf2LessThanTheGivenNumber(long input) { + Assert.isTrue(input > 1, "Invalid input"); + + long firstPowerOf2 = 1; + long nextPowerOf2 = 2; + + while (nextPowerOf2 < input) { + firstPowerOf2 = nextPowerOf2; + nextPowerOf2 = nextPowerOf2 * 2; + } + return firstPowerOf2; + } + + public long findLargestPowerOf2LessThanTheGivenNumberUsingLogBase2(long input) { + Assert.isTrue(input > 1, "Invalid input"); + + long temp = input; + if (input % 2 == 0) { + temp = input - 1; + } + + // Find log base 2 of a given number + long power = (long) (Math.log(temp) / Math.log(2)); + long result = (long) Math.pow(2, power); + + return result; + } + + public long findLargestPowerOf2LessThanTheGivenNumberUsingBitwiseAnd(long input) { + Assert.isTrue(input > 1, "Invalid input"); + long result = 1; + for (long i = input - 1; i > 1; i--) { + if ((i & (i - 1)) == 0) { + result = i; + break; + } + } + return result; + } + + public long findLargestPowerOf2LessThanTheGivenNumberUsingBitShiftApproach(long input) { + Assert.isTrue(input > 1, "Invalid input"); + long result = 1; + long powerOf2; + + for (long i = 0; i < Long.BYTES * 8; i++) { + powerOf2 = 1 << i; + if (powerOf2 >= input) { + break; + } + result = powerOf2; + } + return result; + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/largestpowerof2/LargestPowerOf2UnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/largestpowerof2/LargestPowerOf2UnitTest.java new file mode 100644 index 0000000000..63f7b03cf7 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/largestpowerof2/LargestPowerOf2UnitTest.java @@ -0,0 +1,67 @@ +package com.baeldung.algorithms.largestpowerof2; + +import java.util.Arrays; +import java.util.Collection; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class LargestPowerOf2UnitTest { + private long input; + private long expectedResult; + + public LargestPowerOf2UnitTest(long input, long expectedResult) { + this.input = input; + this.expectedResult = expectedResult; + } + + @Parameterized.Parameters(name = "{index}: verifyLargestPowerOf2LessThanTheGivenNumber({0}) = {1}") + public static Collection data() { + return Arrays.asList(new Object[][] { { 2, 1 }, { 4, 2 }, { 500, 256 }, { 512, 256 }, { 1050, 1024 } }); + } + + @Test + public void givenValidInput_verifyLargestPowerOf2LessThanTheGivenNumber() { + LargestPowerOf2 largestPowerOf2 = new LargestPowerOf2(); + + long result = largestPowerOf2.findLargestPowerOf2LessThanTheGivenNumber(input); + + Assert.assertEquals(expectedResult, result); + } + + @Test + public void givenValidInput_verifyLargestPowerOf2LessThanTheGivenNumberUsingLogBase2() { + LargestPowerOf2 largestPowerOf2 = new LargestPowerOf2(); + + long result = largestPowerOf2.findLargestPowerOf2LessThanTheGivenNumberUsingLogBase2(input); + + Assert.assertEquals(expectedResult, result); + } + + @Test + public void givenValidInput_verifyLargestPowerOf2LessThanTheGivenNumberBitwiseAnd() { + LargestPowerOf2 largestPowerOf2 = new LargestPowerOf2(); + + long result = largestPowerOf2.findLargestPowerOf2LessThanTheGivenNumberUsingBitwiseAnd(input); + + Assert.assertEquals(expectedResult, result); + } + + @Test + public void givenValidInput_verifyLargestPowerOf2LessThanTheGivenNumberBitShiftApproach() { + LargestPowerOf2 largestPowerOf2 = new LargestPowerOf2(); + + long result = largestPowerOf2.findLargestPowerOf2LessThanTheGivenNumberUsingBitShiftApproach(input); + + Assert.assertEquals(expectedResult, result); + } + + @Test(expected = IllegalArgumentException.class) + public void givenInvalidInput_ShouldThrowException() { + LargestPowerOf2 largestPowerOf2 = new LargestPowerOf2(); + largestPowerOf2.findLargestPowerOf2LessThanTheGivenNumber(1); + } +} \ No newline at end of file From 9c09e01c0327dcb0c75569a065482670ea162286 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Thu, 27 Aug 2020 22:16:56 +0200 Subject: [PATCH 0590/1862] JAVA-2431: Fix README.md files --- drools/README.MD | 1 + logging-modules/log-mdc/README.md | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drools/README.MD b/drools/README.MD index 414ad2dea3..6011c8293c 100644 --- a/drools/README.MD +++ b/drools/README.MD @@ -6,3 +6,4 @@ This module contains articles about Drools - [Introduction to Drools](https://www.baeldung.com/drools) - [An Example of Backward Chaining in Drools](https://www.baeldung.com/drools-backward-chaining) +- [Drools Using Rules from Excel Files](https://www.baeldung.com/drools-excel) diff --git a/logging-modules/log-mdc/README.md b/logging-modules/log-mdc/README.md index 0d516619ef..f35bc7fccc 100644 --- a/logging-modules/log-mdc/README.md +++ b/logging-modules/log-mdc/README.md @@ -1,8 +1,6 @@ ### Relevant Articles: -- TBD - [Improved Java Logging with Mapped Diagnostic Context (MDC)](https://www.baeldung.com/mdc-in-log4j-2-logback) - [Java Logging with Nested Diagnostic Context (NDC)](https://www.baeldung.com/java-logging-ndc-log4j) -- [Drools Using Rules from Excel Files](https://www.baeldung.com/drools-excel) ### References From 482357866eb215d3e1becabd7d06961e0d1a24f1 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 28 Aug 2020 08:01:12 +0200 Subject: [PATCH 0591/1862] BAEL-4577: Fix @MapsIs usage and add integration test (#9930) --- .../com/baeldung/manytomany/model/Course.java | 39 +++++++++++++----- .../manytomany/model/CourseRating.java | 40 +++++++++++-------- .../manytomany/model/CourseRatingKey.java | 16 +++++++- .../manytomany/model/CourseRegistration.java | 20 +++++----- .../baeldung/manytomany/model/Student.java | 37 +++++++++++------ .../manytomany/ManyToManyIntegrationTest.java | 37 +++++++++++++++-- .../ManyToManyTestConfiguration.java | 22 ++++++---- 7 files changed, 149 insertions(+), 62 deletions(-) diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Course.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Course.java index bdfb8e890f..d824505629 100644 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Course.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Course.java @@ -1,14 +1,9 @@ package com.baeldung.manytomany.model; +import javax.persistence.*; +import java.util.HashSet; import java.util.Set; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToMany; -import javax.persistence.OneToMany; -import javax.persistence.Table; - @Entity @Table(name = "course") public class Course { @@ -18,31 +13,55 @@ public class Course { private Long id; @ManyToMany(mappedBy = "likedCourses") - private Set likes; + private Set likes = new HashSet<>(); @OneToMany(mappedBy = "course") - private Set ratings; + private Set ratings = new HashSet<>(); @OneToMany(mappedBy = "course") - private Set registrations; + private Set registrations = new HashSet<>(); // additional properties public Course() { } + public Course(Long id) { + this.id = id; + } + public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } + + public Set getLikes() { + return likes; + } + + public void setLikes(Set likes) { + this.likes = likes; + } + public Set getRatings() { return ratings; } + public void setRatings(Set ratings) { + this.ratings = ratings; + } + public Set getRegistrations() { return registrations; } + public void setRegistrations(Set registrations) { + this.registrations = registrations; + } + @Override public int hashCode() { final int prime = 31; diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRating.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRating.java index 4951f766bc..b89cc1dae9 100644 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRating.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRating.java @@ -1,12 +1,6 @@ package com.baeldung.manytomany.model; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.MapsId; -import javax.persistence.Table; +import javax.persistence.*; @Entity @Table(name = "course_rating") @@ -16,12 +10,12 @@ public class CourseRating { private CourseRatingKey id; @ManyToOne - @MapsId("student_id") + @MapsId("studentId") @JoinColumn(name = "student_id") private Student student; @ManyToOne - @MapsId("course_id") + @MapsId("courseId") @JoinColumn(name = "course_id") private Course course; @@ -31,26 +25,38 @@ public class CourseRating { public CourseRating() { } - public int getRating() { - return rating; - } - - public void setRating(int rating) { - this.rating = rating; - } - public CourseRatingKey getId() { return id; } + public void setId(CourseRatingKey id) { + this.id = id; + } + public Student getStudent() { return student; } + public void setStudent(Student student) { + this.student = student; + } + public Course getCourse() { return course; } + public void setCourse(Course course) { + this.course = course; + } + + public int getRating() { + return rating; + } + + public void setRating(int rating) { + this.rating = rating; + } + @Override public int hashCode() { final int prime = 31; diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java index 4e7430ed92..a4b2df9b07 100644 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRatingKey.java @@ -1,9 +1,8 @@ package com.baeldung.manytomany.model; -import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.Embeddable; +import java.io.Serializable; @Embeddable public class CourseRatingKey implements Serializable { @@ -17,14 +16,27 @@ public class CourseRatingKey implements Serializable { public CourseRatingKey() { } + public CourseRatingKey(Long studentId, Long courseId) { + this.studentId = studentId; + this.courseId = courseId; + } + public Long getStudentId() { return studentId; } + public void setStudentId(Long studentId) { + this.studentId = studentId; + } + public Long getCourseId() { return courseId; } + public void setCourseId(Long courseId) { + this.courseId = courseId; + } + @Override public int hashCode() { final int prime = 31; diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java index e1f30af883..ba914b564d 100644 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/CourseRegistration.java @@ -1,14 +1,8 @@ package com.baeldung.manytomany.model; +import javax.persistence.*; import java.time.LocalDateTime; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - @Entity @Table(name = "course_registration") public class CourseRegistration { @@ -36,6 +30,14 @@ public class CourseRegistration { public CourseRegistration() { } + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + public Student getStudent() { return student; } @@ -68,10 +70,6 @@ public class CourseRegistration { this.grade = grade; } - public Long getId() { - return id; - } - @Override public int hashCode() { final int prime = 31; diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Student.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Student.java index 00561593a6..53c5d88a57 100644 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Student.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/manytomany/model/Student.java @@ -1,16 +1,9 @@ package com.baeldung.manytomany.model; +import javax.persistence.*; +import java.util.HashSet; import java.util.Set; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.OneToMany; -import javax.persistence.Table; - @Entity @Table(name = "student") public class Student { @@ -21,35 +14,55 @@ public class Student { @ManyToMany @JoinTable(name = "course_like", joinColumns = @JoinColumn(name = "student_id"), inverseJoinColumns = @JoinColumn(name = "course_id")) - private Set likedCourses; + private Set likedCourses = new HashSet<>(); @OneToMany(mappedBy = "student") - private Set ratings; + private Set ratings = new HashSet<>(); @OneToMany(mappedBy = "student") - private Set registrations; + private Set registrations = new HashSet<>(); // additional properties public Student() { } + public Student(Long id) { + this.id = id; + } + public Long getId() { return id; } + public void setId(Long id) { + this.id = id; + } + public Set getLikedCourses() { return likedCourses; } + public void setLikedCourses(Set likedCourses) { + this.likedCourses = likedCourses; + } + public Set getRatings() { return ratings; } + public void setRatings(Set ratings) { + this.ratings = ratings; + } + public Set getRegistrations() { return registrations; } + public void setRegistrations(Set registrations) { + this.registrations = registrations; + } + @Override public int hashCode() { final int prime = 31; diff --git a/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java index 5e4334f5d4..f5b02ec2c1 100644 --- a/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java +++ b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyIntegrationTest.java @@ -1,17 +1,27 @@ package com.baeldung.manytomany; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; - +import com.baeldung.manytomany.model.Course; +import com.baeldung.manytomany.model.CourseRating; +import com.baeldung.manytomany.model.CourseRatingKey; +import com.baeldung.manytomany.model.Student; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.transaction.annotation.Transactional; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertThat; @RunWith(SpringRunner.class) @ContextConfiguration(classes = ManyToManyTestConfiguration.class) @DirtiesContext +@Transactional public class ManyToManyIntegrationTest { @PersistenceContext @@ -21,4 +31,25 @@ public class ManyToManyIntegrationTest { public void contextStarted() { } + @Test + public void whenCourseRatingPersisted_thenCorrect() { + Student student = new Student(101L); + entityManager.persist(student); + + Course course = new Course(201L); + entityManager.persist(course); + + CourseRating courseRating = new CourseRating(); + courseRating.setId(new CourseRatingKey()); + courseRating.setStudent(student); + courseRating.setCourse(course); + courseRating.setRating(100); + entityManager.persist(courseRating); + + CourseRating persistedCourseRating = entityManager.find(CourseRating.class, new CourseRatingKey(101L, 201L)); + + assertThat(persistedCourseRating, notNullValue()); + assertThat(persistedCourseRating.getStudent().getId(), is(101L)); + assertThat(persistedCourseRating.getCourse().getId(), is(201L)); + } } diff --git a/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java index 1cc3621f0d..fa12828074 100644 --- a/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java +++ b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/manytomany/ManyToManyTestConfiguration.java @@ -1,20 +1,21 @@ package com.baeldung.manytomany; -import java.util.HashMap; -import java.util.Map; - -import javax.sql.DataSource; - import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; +import java.util.HashMap; +import java.util.Map; + @Configuration @PropertySource("manytomany/test.properties") public class ManyToManyTestConfiguration { @@ -23,8 +24,8 @@ public class ManyToManyTestConfiguration { public DataSource dataSource() { EmbeddedDatabaseBuilder dbBuilder = new EmbeddedDatabaseBuilder(); return dbBuilder.setType(EmbeddedDatabaseType.H2) - .addScript("classpath:/manytomany/db.sql") - .build(); + .addScript("classpath:/manytomany/db.sql") + .build(); } @Bean @@ -44,6 +45,13 @@ public class ManyToManyTestConfiguration { return result; } + @Bean + JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { + JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory); + return transactionManager; + } + public JpaVendorAdapter jpaVendorAdapter() { return new HibernateJpaVendorAdapter(); } From 0c8f7f6716023441203d561ae21fc8b0ef2bf4f5 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Fri, 28 Aug 2020 15:39:15 +0530 Subject: [PATCH 0592/1862] Fix for String equals check --- .../main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java index 3fe858936a..8cfee8f5d6 100644 --- a/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java +++ b/persistence-modules/java-jpa-3/src/main/java/com/baeldung/jpa/equality/EqualByBusinessKey.java @@ -44,7 +44,7 @@ public class EqualByBusinessKey { return false; } if (obj instanceof EqualByBusinessKey) { - if (((EqualByBusinessKey) obj).getEmail() == getEmail()) { + if (((EqualByBusinessKey) obj).getEmail().equals(getEmail())) { return true; } } From 544c3667538a284797dde4dda7f11f446949a5a2 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Fri, 28 Aug 2020 17:54:52 +0530 Subject: [PATCH 0593/1862] JAVA-84: Moved 1 article to spring-boot-di --- spring-boot-modules/spring-boot-di/{README.MD => README.md} | 1 + spring-boot-modules/spring-boot-di/pom.xml | 6 ++++++ .../main/java/com/baeldung/displayallbeans/Application.java | 0 .../baeldung/displayallbeans/controller/FooController.java | 0 .../com/baeldung/displayallbeans/service/FooService.java | 0 .../displayallbeans/DisplayBeanIntegrationTest.java | 0 6 files changed, 7 insertions(+) rename spring-boot-modules/spring-boot-di/{README.MD => README.md} (81%) rename spring-boot-modules/{spring-boot => spring-boot-di}/src/main/java/com/baeldung/displayallbeans/Application.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-di}/src/main/java/com/baeldung/displayallbeans/controller/FooController.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-di}/src/main/java/com/baeldung/displayallbeans/service/FooService.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-di}/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java (100%) diff --git a/spring-boot-modules/spring-boot-di/README.MD b/spring-boot-modules/spring-boot-di/README.md similarity index 81% rename from spring-boot-modules/spring-boot-di/README.MD rename to spring-boot-modules/spring-boot-di/README.md index cbd42c5609..2759c73926 100644 --- a/spring-boot-modules/spring-boot-di/README.MD +++ b/spring-boot-modules/spring-boot-di/README.md @@ -9,3 +9,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Component Scanning](https://www.baeldung.com/spring-component-scanning) - [Spring @ComponentScan – Filter Types](https://www.baeldung.com/spring-componentscan-filter-type) +- [How to Get All Spring-Managed Beans?](https://www.baeldung.com/spring-show-all-beans) diff --git a/spring-boot-modules/spring-boot-di/pom.xml b/spring-boot-modules/spring-boot-di/pom.xml index 87a0ad2937..58b427a4a8 100644 --- a/spring-boot-modules/spring-boot-di/pom.xml +++ b/spring-boot-modules/spring-boot-di/pom.xml @@ -27,6 +27,12 @@ org.springframework.boot spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-actuator + + org.springframework.boot spring-boot-starter-tomcat diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java b/spring-boot-modules/spring-boot-di/src/main/java/com/baeldung/displayallbeans/Application.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/displayallbeans/Application.java rename to spring-boot-modules/spring-boot-di/src/main/java/com/baeldung/displayallbeans/Application.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java b/spring-boot-modules/spring-boot-di/src/main/java/com/baeldung/displayallbeans/controller/FooController.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/displayallbeans/controller/FooController.java rename to spring-boot-modules/spring-boot-di/src/main/java/com/baeldung/displayallbeans/controller/FooController.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/displayallbeans/service/FooService.java b/spring-boot-modules/spring-boot-di/src/main/java/com/baeldung/displayallbeans/service/FooService.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/displayallbeans/service/FooService.java rename to spring-boot-modules/spring-boot-di/src/main/java/com/baeldung/displayallbeans/service/FooService.java diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java b/spring-boot-modules/spring-boot-di/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java similarity index 100% rename from spring-boot-modules/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java rename to spring-boot-modules/spring-boot-di/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java From 52721a78d6b5c52525c1e8c9af2e00b4b9cf0eab Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Fri, 28 Aug 2020 17:56:09 +0530 Subject: [PATCH 0594/1862] JAVA-84: Moved 3 articles to spring-boot-libraries --- .../spring-boot-libraries/README.md | 3 + .../spring-boot-libraries/pom.xml | 31 +++- .../com/baeldung/demo/DemoApplication.java | 18 ++ .../java/com/baeldung/graphql/Author.java | 0 .../java/com/baeldung/graphql/AuthorDao.java | 0 .../com/baeldung/graphql/AuthorResolver.java | 0 .../graphql/GraphqlConfiguration.java | 0 .../java/com/baeldung/graphql/Mutation.java | 0 .../main/java/com/baeldung/graphql/Post.java | 0 .../java/com/baeldung/graphql/PostDao.java | 0 .../com/baeldung/graphql/PostResolver.java | 0 .../main/java/com/baeldung/graphql/Query.java | 0 .../com/baeldung/kong/QueryController.java | 0 .../main/java/com/baeldung/kong/StockApp.java | 0 .../java/com/baeldung/toggle/Employee.java | 37 ++++ .../baeldung/toggle/EmployeeRepository.java | 0 .../baeldung/toggle/FeatureAssociation.java | 0 .../com/baeldung/toggle/FeaturesAspect.java | 0 .../java/com/baeldung/toggle/MyFeatures.java | 0 .../com/baeldung/toggle/SalaryController.java | 0 .../com/baeldung/toggle/SalaryService.java | 0 .../baeldung/toggle/ToggleApplication.java | 0 .../baeldung/toggle/ToggleConfiguration.java | 0 .../baeldung/kong/KongAdminAPILiveTest.java | 170 ++++++++++++++++++ .../kong/KongLoadBalanceLiveTest.java | 75 ++++++++ .../com/baeldung/kong/domain/APIObject.java | 54 ++++++ .../baeldung/kong/domain/ConsumerObject.java | 35 ++++ .../baeldung/kong/domain/KeyAuthObject.java | 21 +++ .../baeldung/kong/domain/PluginObject.java | 30 ++++ .../baeldung/kong/domain/TargetObject.java | 31 ++++ .../baeldung/kong/domain/UpstreamObject.java | 21 +++ .../toggle/ToggleIntegrationTest.java | 62 +++++++ spring-boot-modules/spring-boot/pom.xml | 32 ---- 33 files changed, 587 insertions(+), 33 deletions(-) create mode 100644 spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/demo/DemoApplication.java rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/Author.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/AuthorDao.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/AuthorResolver.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/Mutation.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/Post.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/PostDao.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/PostResolver.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/graphql/Query.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/kong/QueryController.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/kong/StockApp.java (100%) create mode 100644 spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/Employee.java rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/toggle/EmployeeRepository.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/toggle/FeatureAssociation.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/toggle/FeaturesAspect.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/toggle/MyFeatures.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/toggle/SalaryController.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/toggle/SalaryService.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/toggle/ToggleApplication.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-libraries}/src/main/java/com/baeldung/toggle/ToggleConfiguration.java (100%) create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/APIObject.java create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/ConsumerObject.java create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/KeyAuthObject.java create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/PluginObject.java create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/TargetObject.java create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/UpstreamObject.java create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-libraries/README.md b/spring-boot-modules/spring-boot-libraries/README.md index 8cd3db9c93..10c56ca576 100644 --- a/spring-boot-modules/spring-boot-libraries/README.md +++ b/spring-boot-modules/spring-boot-libraries/README.md @@ -12,3 +12,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Generating Barcodes and QR Codes in Java](https://www.baeldung.com/java-generating-barcodes-qr-codes) - [Rate Limiting a Spring API Using Bucket4j](https://www.baeldung.com/spring-bucket4j) - [Spring Boot and Caffeine Cache](https://www.baeldung.com/spring-boot-caffeine-cache) +- [Spring Boot and Togglz Aspect](https://www.baeldung.com/spring-togglz) +- [Getting Started with GraphQL and Spring Boot](https://www.baeldung.com/spring-graphql) +- [An Introduction to Kong](https://www.baeldung.com/kong) diff --git a/spring-boot-modules/spring-boot-libraries/pom.xml b/spring-boot-modules/spring-boot-libraries/pom.xml index 05ab59aab7..3913babaa8 100644 --- a/spring-boot-modules/spring-boot-libraries/pom.xml +++ b/spring-boot-modules/spring-boot-libraries/pom.xml @@ -37,6 +37,36 @@ spring-boot-starter-test test + + + + org.togglz + togglz-spring-boot-starter + ${togglz.version} + + + + org.togglz + togglz-spring-security + ${togglz.version} + + + + + com.graphql-java + graphql-spring-boot-starter + ${graphql-spring-boot-starter.version} + + + com.graphql-java + graphql-java-tools + ${graphql-java-tools.version} + + + com.graphql-java + graphiql-spring-boot-starter + ${graphql-spring-boot-starter.version} + @@ -216,7 +246,6 @@ 1.9.0 2.0.0 5.0.2 - 5.0.2 5.2.4 18.0 2.2.4 diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/demo/DemoApplication.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/demo/DemoApplication.java new file mode 100644 index 0000000000..eb091b4695 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/demo/DemoApplication.java @@ -0,0 +1,18 @@ +package com.baeldung.demo; + +import com.baeldung.graphql.GraphqlConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +import org.springframework.context.annotation.Import; + +@SpringBootApplication +@Import(GraphqlConfiguration.class) +public class DemoApplication { + + public static void main(String[] args) { + System.setProperty("spring.config.name", "demo"); + SpringApplication.run(DemoApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/Author.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/Author.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/Author.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/Author.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/AuthorDao.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/AuthorDao.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/AuthorDao.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/AuthorDao.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/AuthorResolver.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/AuthorResolver.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/AuthorResolver.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/AuthorResolver.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/GraphqlConfiguration.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/Mutation.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/Mutation.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/Mutation.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/Mutation.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/Post.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/Post.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/Post.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/Post.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/PostDao.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/PostDao.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/PostDao.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/PostDao.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/PostResolver.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/PostResolver.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/PostResolver.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/PostResolver.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/Query.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/Query.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/graphql/Query.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/graphql/Query.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/kong/QueryController.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/kong/QueryController.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/kong/QueryController.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/kong/QueryController.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/kong/StockApp.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/kong/StockApp.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/kong/StockApp.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/kong/StockApp.java diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/Employee.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/Employee.java new file mode 100644 index 0000000000..64a8b3ce5b --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/Employee.java @@ -0,0 +1,37 @@ +package com.baeldung.toggle; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Employee { + + @Id + private long id; + private double salary; + + public Employee() { + } + + public Employee(long id, double salary) { + this.id = id; + this.salary = salary; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this.salary = salary; + } + +} diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/EmployeeRepository.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/EmployeeRepository.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/EmployeeRepository.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/EmployeeRepository.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/FeatureAssociation.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/FeatureAssociation.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/FeatureAssociation.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/FeatureAssociation.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/FeaturesAspect.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/FeaturesAspect.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/FeaturesAspect.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/FeaturesAspect.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/MyFeatures.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/MyFeatures.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/MyFeatures.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/MyFeatures.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/SalaryController.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/SalaryController.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/SalaryController.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/SalaryController.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/SalaryService.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/SalaryService.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/SalaryService.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/SalaryService.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/ToggleApplication.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/ToggleApplication.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/ToggleApplication.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/ToggleApplication.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/ToggleConfiguration.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/ToggleConfiguration.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/toggle/ToggleConfiguration.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/toggle/ToggleConfiguration.java diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java new file mode 100644 index 0000000000..92d2286518 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java @@ -0,0 +1,170 @@ +package com.baeldung.kong; + +import com.baeldung.kong.domain.APIObject; +import com.baeldung.kong.domain.ConsumerObject; +import com.baeldung.kong.domain.KeyAuthObject; +import com.baeldung.kong.domain.PluginObject; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.*; +import org.springframework.test.context.junit4.SpringRunner; + +import java.net.URI; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; + +/** + * @author aiet + */ +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = DEFINED_PORT, classes = StockApp.class) +public class KongAdminAPILiveTest { + + private String getStockPrice(String code) { + try { + return restTemplate.getForObject(new URI("http://localhost:8080/stock/" + code), String.class); + } catch (Exception ignored) { + } + return null; + } + + @Before + public void init() { + System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + } + + @Autowired + TestRestTemplate restTemplate; + + @Test + public void givenEndpoint_whenQueryStockPrice_thenPriceCorrect() { + String response = getStockPrice("btc"); + assertEquals("10000", response); + + response = getStockPrice("eth"); + assertEquals("N/A", response); + } + + @Test + public void givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong() throws Exception { + restTemplate.delete("http://localhost:8001/apis/stock-api"); + + APIObject stockAPI = new APIObject("stock-api", "stock.api", "http://localhost:9090", "/"); + HttpEntity apiEntity = new HttpEntity<>(stockAPI); + ResponseEntity addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); + + assertEquals(HttpStatus.CREATED, addAPIResp.getStatusCode()); + + addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); + assertEquals(HttpStatus.CONFLICT, addAPIResp.getStatusCode()); + String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class); + + assertTrue(apiListResp.contains("stock-api")); + + HttpHeaders headers = new HttpHeaders(); + headers.set("Host", "stock.api"); + RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); + ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); + + assertEquals("10000", stockPriceResp.getBody()); + } + + @Test + public void givenKongAdminAPI_whenAddAPIConsumer_thenAdded() { + restTemplate.delete("http://localhost:8001/consumers/eugenp"); + + ConsumerObject consumer = new ConsumerObject("eugenp"); + HttpEntity addConsumerEntity = new HttpEntity<>(consumer); + ResponseEntity addConsumerResp = restTemplate.postForEntity("http://localhost:8001/consumers/", addConsumerEntity, String.class); + + assertEquals(HttpStatus.CREATED, addConsumerResp.getStatusCode()); + + addConsumerResp = restTemplate.postForEntity("http://localhost:8001/consumers", addConsumerEntity, String.class); + assertEquals(HttpStatus.CONFLICT, addConsumerResp.getStatusCode()); + + String consumerListResp = restTemplate.getForObject("http://localhost:8001/consumers/", String.class); + assertTrue(consumerListResp.contains("eugenp")); + } + + @Test + public void givenAPI_whenEnableAuth_thenAnonymousDenied() throws Exception { + String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class); + if (!apiListResp.contains("stock-api")) { + givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong(); + } + + PluginObject authPlugin = new PluginObject("key-auth"); + ResponseEntity enableAuthResp = restTemplate.postForEntity("http://localhost:8001/apis/stock-api/plugins", new HttpEntity<>(authPlugin), String.class); + + assertTrue(HttpStatus.CREATED == enableAuthResp.getStatusCode() || HttpStatus.CONFLICT == enableAuthResp.getStatusCode()); + + String pluginsResp = restTemplate.getForObject("http://localhost:8001/apis/stock-api/plugins", String.class); + assertTrue(pluginsResp.contains("key-auth")); + + HttpHeaders headers = new HttpHeaders(); + headers.set("Host", "stock.api"); + RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/stock/btc")); + ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); + assertEquals(HttpStatus.UNAUTHORIZED, stockPriceResp.getStatusCode()); + } + + @Test + public void givenAPIAuthEnabled_whenAddKey_thenAccessAllowed() throws Exception { + String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class); + if (!apiListResp.contains("stock-api")) { + givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong(); + } + + String consumerListResp = restTemplate.getForObject("http://localhost:8001/consumers/", String.class); + if (!consumerListResp.contains("eugenp")) { + givenKongAdminAPI_whenAddAPIConsumer_thenAdded(); + } + + PluginObject authPlugin = new PluginObject("key-auth"); + ResponseEntity enableAuthResp = restTemplate.postForEntity("http://localhost:8001/apis/stock-api/plugins", new HttpEntity<>(authPlugin), String.class); + assertTrue(HttpStatus.CREATED == enableAuthResp.getStatusCode() || HttpStatus.CONFLICT == enableAuthResp.getStatusCode()); + + final String consumerKey = "eugenp.pass"; + KeyAuthObject keyAuth = new KeyAuthObject(consumerKey); + ResponseEntity keyAuthResp = restTemplate.postForEntity("http://localhost:8001/consumers/eugenp/key-auth", new HttpEntity<>(keyAuth), String.class); + + assertTrue(HttpStatus.CREATED == keyAuthResp.getStatusCode() || HttpStatus.CONFLICT == keyAuthResp.getStatusCode()); + + HttpHeaders headers = new HttpHeaders(); + headers.set("Host", "stock.api"); + headers.set("apikey", consumerKey); + RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); + ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); + + assertEquals("10000", stockPriceResp.getBody()); + + headers.set("apikey", "wrongpass"); + requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); + stockPriceResp = restTemplate.exchange(requestEntity, String.class); + assertEquals(HttpStatus.FORBIDDEN, stockPriceResp.getStatusCode()); + } + + @Test + public void givenAdminAPIProxy_whenAddAPIViaProxy_thenAPIAdded() throws Exception { + APIObject adminAPI = new APIObject("admin-api", "admin.api", "http://localhost:8001", "/admin-api"); + HttpEntity apiEntity = new HttpEntity<>(adminAPI); + ResponseEntity addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); + + assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode()); + + HttpHeaders headers = new HttpHeaders(); + headers.set("Host", "admin.api"); + APIObject baeldungAPI = new APIObject("baeldung-api", "baeldung.com", "http://ww.baeldung.com", "/"); + RequestEntity requestEntity = new RequestEntity<>(baeldungAPI, headers, HttpMethod.POST, new URI("http://localhost:8000/admin-api/apis")); + addAPIResp = restTemplate.exchange(requestEntity, String.class); + + assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode()); + } + +} diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java new file mode 100644 index 0000000000..7cf67453a6 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java @@ -0,0 +1,75 @@ +package com.baeldung.kong; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; + +import java.net.URI; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.kong.domain.APIObject; +import com.baeldung.kong.domain.TargetObject; +import com.baeldung.kong.domain.UpstreamObject; + +/** + * @author aiet + */ +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = DEFINED_PORT, classes = StockApp.class, properties = "server.servlet.contextPath=/springbootapp") +public class KongLoadBalanceLiveTest { + + @Before + public void init() { + System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + } + + @Autowired + TestRestTemplate restTemplate; + + @Test + public void givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong() throws Exception { + UpstreamObject upstream = new UpstreamObject("stock.api.service"); + ResponseEntity addUpstreamResp = restTemplate.postForEntity("http://localhost:8001/upstreams", new HttpEntity<>(upstream), String.class); + assertTrue(HttpStatus.CREATED == addUpstreamResp.getStatusCode() || HttpStatus.CONFLICT == addUpstreamResp.getStatusCode()); + + TargetObject testTarget = new TargetObject("localhost:8080", 10); + ResponseEntity addTargetResp = restTemplate.postForEntity("http://localhost:8001/upstreams/stock.api.service/targets", new HttpEntity<>(testTarget), String.class); + assertTrue(HttpStatus.CREATED == addTargetResp.getStatusCode() || HttpStatus.CONFLICT == addTargetResp.getStatusCode()); + + TargetObject releaseTarget = new TargetObject("localhost:9090", 40); + addTargetResp = restTemplate.postForEntity("http://localhost:8001/upstreams/stock.api.service/targets", new HttpEntity<>(releaseTarget), String.class); + assertTrue(HttpStatus.CREATED == addTargetResp.getStatusCode() || HttpStatus.CONFLICT == addTargetResp.getStatusCode()); + + APIObject stockAPI = new APIObject("balanced-stock-api", "balanced.stock.api", "http://stock.api.service", "/"); + HttpEntity apiEntity = new HttpEntity<>(stockAPI); + ResponseEntity addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); + assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode()); + + HttpHeaders headers = new HttpHeaders(); + headers.set("Host", "balanced.stock.api"); + for (int i = 0; i < 1000; i++) { + RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); + ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); + assertEquals("10000", stockPriceResp.getBody()); + } + + int releaseCount = restTemplate.getForObject("http://localhost:9090/springbootapp/stock/reqcount", Integer.class); + int testCount = restTemplate.getForObject("http://localhost:8080/springbootapp/stock/reqcount", Integer.class); + + assertTrue(Math.round(releaseCount * 1.0 / testCount) == 4); + } + +} diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/APIObject.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/APIObject.java new file mode 100644 index 0000000000..f386712444 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/APIObject.java @@ -0,0 +1,54 @@ +package com.baeldung.kong.domain; + +/** + * @author aiet + */ +public class APIObject { + + public APIObject() { + } + + public APIObject(String name, String hosts, String upstream_url, String uris) { + this.name = name; + this.hosts = hosts; + this.upstream_url = upstream_url; + this.uris = uris; + } + + private String name; + private String hosts; + private String upstream_url; + private String uris; + + public String getUris() { + return uris; + } + + public void setUris(String uris) { + this.uris = uris; + } + + public String getUpstream_url() { + return upstream_url; + } + + public void setUpstream_url(String upstream_url) { + this.upstream_url = upstream_url; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getHosts() { + return hosts; + } + + public void setHosts(String hosts) { + this.hosts = hosts; + } +} diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/ConsumerObject.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/ConsumerObject.java new file mode 100644 index 0000000000..74bef8f2d1 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/ConsumerObject.java @@ -0,0 +1,35 @@ +package com.baeldung.kong.domain; + +/** + * @author aiet + */ +public class ConsumerObject { + + private String username; + private String custom_id; + + public ConsumerObject(String username) { + this.username = username; + } + + public ConsumerObject(String username, String custom_id) { + this.username = username; + this.custom_id = custom_id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getCustom_id() { + return custom_id; + } + + public void setCustom_id(String custom_id) { + this.custom_id = custom_id; + } +} diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/KeyAuthObject.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/KeyAuthObject.java new file mode 100644 index 0000000000..80de6bfcd9 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/KeyAuthObject.java @@ -0,0 +1,21 @@ +package com.baeldung.kong.domain; + +/** + * @author aiet + */ +public class KeyAuthObject { + + public KeyAuthObject(String key) { + this.key = key; + } + + private String key; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } +} diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/PluginObject.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/PluginObject.java new file mode 100644 index 0000000000..c161fc9b54 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/PluginObject.java @@ -0,0 +1,30 @@ +package com.baeldung.kong.domain; + +/** + * @author aiet + */ +public class PluginObject { + + private String name; + private String consumer_id; + + public PluginObject(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getConsumer_id() { + return consumer_id; + } + + public void setConsumer_id(String consumer_id) { + this.consumer_id = consumer_id; + } +} diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/TargetObject.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/TargetObject.java new file mode 100644 index 0000000000..79653e2846 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/TargetObject.java @@ -0,0 +1,31 @@ +package com.baeldung.kong.domain; + +/** + * @author aiet + */ +public class TargetObject { + + public TargetObject(String target, int weight) { + this.target = target; + this.weight = weight; + } + + private String target; + private int weight; + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + + public int getWeight() { + return weight; + } + + public void setWeight(int weight) { + this.weight = weight; + } +} diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/UpstreamObject.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/UpstreamObject.java new file mode 100644 index 0000000000..6461381ac5 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/kong/domain/UpstreamObject.java @@ -0,0 +1,21 @@ +package com.baeldung.kong.domain; + +/** + * @author aiet + */ +public class UpstreamObject { + + public UpstreamObject(String name) { + this.name = name; + } + + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java new file mode 100644 index 0000000000..3213a10df9 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java @@ -0,0 +1,62 @@ +package com.baeldung.toggle; + +import static org.junit.Assert.assertEquals; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = ToggleApplication.class) +@AutoConfigureMockMvc +public class ToggleIntegrationTest { + + @Autowired + private EmployeeRepository employeeRepository; + + @Autowired + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + } + + @Test + public void givenFeaturePropertyFalse_whenIncreaseSalary_thenNoIncrease() throws Exception { + Employee emp = new Employee(1, 2000); + employeeRepository.save(emp); + + System.setProperty("employee.feature", "false"); + + mockMvc.perform(post("/increaseSalary").param("id", emp.getId() + "")).andExpect(status().is(200)); + + emp = employeeRepository.findById(1L).orElse(null); + assertEquals("salary incorrect", 2000, emp.getSalary(), 0.5); + } + + @Test + public void givenFeaturePropertyTrue_whenIncreaseSalary_thenIncrease() throws Exception { + Employee emp = new Employee(1, 2000); + employeeRepository.save(emp); + + System.setProperty("employee.feature", "true"); + + mockMvc.perform(post("/increaseSalary").param("id", emp.getId() + "")).andExpect(status().is(200)); + + emp = employeeRepository.findById(1L).orElse(null); + assertEquals("salary incorrect", 2200, emp.getSalary(), 0.5); + } +} diff --git a/spring-boot-modules/spring-boot/pom.xml b/spring-boot-modules/spring-boot/pom.xml index e1299a6a16..5efcffdf03 100644 --- a/spring-boot-modules/spring-boot/pom.xml +++ b/spring-boot-modules/spring-boot/pom.xml @@ -44,22 +44,6 @@ spring-boot-starter-actuator - - com.graphql-java - graphql-spring-boot-starter - ${graphql-spring-boot-starter.version} - - - com.graphql-java - graphql-java-tools - ${graphql-java-tools.version} - - - com.graphql-java - graphiql-spring-boot-starter - ${graphiql-spring-boot-starter.version} - - org.springframework.boot spring-boot-starter-tomcat @@ -104,18 +88,6 @@ provided - - org.togglz - togglz-spring-boot-starter - ${togglz.version} - - - - org.togglz - togglz-spring-security - ${togglz.version} - - org.apache.activemq artemis-server @@ -204,11 +176,7 @@ com.baeldung.intro.App 8.5.11 - 2.4.1.Final 1.9.0 - 5.0.2 - 5.0.2 - 5.2.4 18.0 @ From 5749d7ad23468ed7f2e071372be556f4b3925df0 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Fri, 28 Aug 2020 17:57:38 +0530 Subject: [PATCH 0595/1862] JAVA-84: Moved 1 article to spring-boot-testing --- .../spring-boot-testing/README.md | 1 + .../spring-boot-testing/pom.xml | 8 + .../com/baeldung/boot/testing}/Employee.java | 2 +- .../boot/testing}/EmployeeRepository.java | 2 +- .../boot/testing}/EmployeeRestController.java | 2 +- .../boot/testing}/EmployeeService.java | 2 +- .../boot/testing}/EmployeeServiceImpl.java | 2 +- .../src/main/resources/application.properties | 4 +- .../persistence-generic-entity.properties | 8 + .../EmployeeControllerIntegrationTest.java | 39 ++-- .../EmployeeRepositoryIntegrationTest.java | 7 +- ...EmployeeRestControllerIntegrationTest.java | 12 +- .../EmployeeServiceImplIntegrationTest.java | 11 +- .../com/baeldung/boot/testing}/JsonUtil.java | 2 +- .../application-integrationtest.properties | 0 .../src/test/resources/application.properties | 4 +- .../spring-boot/{README.MD => README.md} | 5 - .../com/baeldung/demo/DemoApplication.java | 4 - .../baeldung/kong/KongAdminAPILiveTest.java | 170 ------------------ .../kong/KongLoadBalanceLiveTest.java | 75 -------- .../com/baeldung/kong/domain/APIObject.java | 54 ------ .../baeldung/kong/domain/ConsumerObject.java | 35 ---- .../baeldung/kong/domain/KeyAuthObject.java | 21 --- .../baeldung/kong/domain/PluginObject.java | 30 ---- .../baeldung/kong/domain/TargetObject.java | 31 ---- .../baeldung/kong/domain/UpstreamObject.java | 21 --- .../toggle/ToggleIntegrationTest.java | 62 ------- 27 files changed, 70 insertions(+), 544 deletions(-) rename spring-boot-modules/{spring-boot/src/main/java/com/baeldung/demo/boottest => spring-boot-testing/src/main/java/com/baeldung/boot/testing}/Employee.java (95%) rename spring-boot-modules/{spring-boot/src/main/java/com/baeldung/demo/boottest => spring-boot-testing/src/main/java/com/baeldung/boot/testing}/EmployeeRepository.java (91%) rename spring-boot-modules/{spring-boot/src/main/java/com/baeldung/demo/boottest => spring-boot-testing/src/main/java/com/baeldung/boot/testing}/EmployeeRestController.java (96%) rename spring-boot-modules/{spring-boot/src/main/java/com/baeldung/demo/boottest => spring-boot-testing/src/main/java/com/baeldung/boot/testing}/EmployeeService.java (89%) rename spring-boot-modules/{spring-boot/src/main/java/com/baeldung/demo/boottest => spring-boot-testing/src/main/java/com/baeldung/boot/testing}/EmployeeServiceImpl.java (96%) create mode 100644 spring-boot-modules/spring-boot-testing/src/main/resources/persistence-generic-entity.properties rename spring-boot-modules/{spring-boot/src/test/java/com/baeldung/demo/boottest => spring-boot-testing/src/test/java/com/baeldung/boot/testing}/EmployeeControllerIntegrationTest.java (87%) rename spring-boot-modules/{spring-boot/src/test/java/com/baeldung/demo/boottest => spring-boot-testing/src/test/java/com/baeldung/boot/testing}/EmployeeRepositoryIntegrationTest.java (94%) rename spring-boot-modules/{spring-boot/src/test/java/com/baeldung/demo/boottest => spring-boot-testing/src/test/java/com/baeldung/boot/testing}/EmployeeRestControllerIntegrationTest.java (87%) rename spring-boot-modules/{spring-boot/src/test/java/com/baeldung/demo/boottest => spring-boot-testing/src/test/java/com/baeldung/boot/testing}/EmployeeServiceImplIntegrationTest.java (94%) rename spring-boot-modules/{spring-boot/src/test/java/com/baeldung/demo/boottest => spring-boot-testing/src/test/java/com/baeldung/boot/testing}/JsonUtil.java (91%) rename spring-boot-modules/{spring-boot => spring-boot-testing}/src/test/resources/application-integrationtest.properties (100%) rename spring-boot-modules/spring-boot/{README.MD => README.md} (79%) delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/APIObject.java delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/ConsumerObject.java delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/KeyAuthObject.java delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/PluginObject.java delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/TargetObject.java delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/UpstreamObject.java delete mode 100644 spring-boot-modules/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-testing/README.md b/spring-boot-modules/spring-boot-testing/README.md index 192f5cee99..1b7ad661c6 100644 --- a/spring-boot-modules/spring-boot-testing/README.md +++ b/spring-boot-modules/spring-boot-testing/README.md @@ -14,3 +14,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Embedded Redis Server with Spring Boot Test](https://www.baeldung.com/spring-embedded-redis) - [Testing Spring Boot @ConfigurationProperties](https://www.baeldung.com/spring-boot-testing-configurationproperties) - [Prevent ApplicationRunner or CommandLineRunner Beans From Executing During Junit Testing](https://www.baeldung.com/spring-junit-prevent-runner-beans-testing-execution) +- [Testing in Spring Boot](https://www.baeldung.com/spring-boot-testing) diff --git a/spring-boot-modules/spring-boot-testing/pom.xml b/spring-boot-modules/spring-boot-testing/pom.xml index a3b176af88..bd5ef901dd 100644 --- a/spring-boot-modules/spring-boot-testing/pom.xml +++ b/spring-boot-modules/spring-boot-testing/pom.xml @@ -34,6 +34,14 @@ org.springframework.boot spring-boot-starter-security + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + org.springframework.boot spring-boot-starter-test diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/Employee.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/Employee.java similarity index 95% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/Employee.java rename to spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/Employee.java index fa3c1dc809..2921ecc609 100644 --- a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/Employee.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/Employee.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeRepository.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeRepository.java similarity index 91% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeRepository.java rename to spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeRepository.java index b6850d587e..bcef5231e0 100644 --- a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeRepository.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeRepository.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; import java.util.List; diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeRestController.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeRestController.java similarity index 96% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeRestController.java rename to spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeRestController.java index 7d2e06d4a0..b52d38e028 100644 --- a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeRestController.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeRestController.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; import java.util.List; diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeService.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeService.java similarity index 89% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeService.java rename to spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeService.java index ff1976cad1..6fc48a3c3d 100644 --- a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeService.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeService.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; import java.util.List; diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeServiceImpl.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeServiceImpl.java similarity index 96% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeServiceImpl.java rename to spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeServiceImpl.java index 156fc571f3..7d5ec4a05d 100644 --- a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/boottest/EmployeeServiceImpl.java +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/boot/testing/EmployeeServiceImpl.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; import java.util.List; diff --git a/spring-boot-modules/spring-boot-testing/src/main/resources/application.properties b/spring-boot-modules/spring-boot-testing/src/main/resources/application.properties index 8dc7f6e3c3..daab3e8d2c 100644 --- a/spring-boot-modules/spring-boot-testing/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-testing/src/main/resources/application.properties @@ -4,4 +4,6 @@ spring.redis.port= 6379 # security spring.security.user.name=john -spring.security.user.password=123 \ No newline at end of file +spring.security.user.password=123 + +spring.main.allow-bean-definition-overriding=true \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-testing/src/main/resources/persistence-generic-entity.properties b/spring-boot-modules/spring-boot-testing/src/main/resources/persistence-generic-entity.properties new file mode 100644 index 0000000000..b19304cb1f --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/main/resources/persistence-generic-entity.properties @@ -0,0 +1,8 @@ +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 +jdbc.user=sa +jdbc.pass=sa + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=true +hibernate.hbm2ddl.auto=create-drop diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeControllerIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeControllerIntegrationTest.java similarity index 87% rename from spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeControllerIntegrationTest.java rename to spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeControllerIntegrationTest.java index 962abf0fa3..c51113a023 100644 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeControllerIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeControllerIntegrationTest.java @@ -1,19 +1,4 @@ -package com.baeldung.demo.boottest; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.mockito.internal.verification.VerificationModeFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.web.servlet.MockMvc; - -import java.util.Arrays; -import java.util.List; +package com.baeldung.boot.testing; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.hasSize; @@ -25,8 +10,28 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import java.util.Arrays; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.mockito.internal.verification.VerificationModeFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import com.baeldung.boot.testing.Employee; +import com.baeldung.boot.testing.EmployeeRestController; +import com.baeldung.boot.testing.EmployeeService; + @RunWith(SpringRunner.class) -@WebMvcTest(EmployeeRestController.class) +@WebMvcTest(value = EmployeeRestController.class, excludeAutoConfiguration = SecurityAutoConfiguration.class) public class EmployeeControllerIntegrationTest { @Autowired diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeRepositoryIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeRepositoryIntegrationTest.java similarity index 94% rename from spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeRepositoryIntegrationTest.java rename to spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeRepositoryIntegrationTest.java index 164887886b..b3a7316764 100644 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeRepositoryIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeRepositoryIntegrationTest.java @@ -1,7 +1,5 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; -import com.baeldung.demo.boottest.Employee; -import com.baeldung.demo.boottest.EmployeeRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -9,6 +7,9 @@ import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.boot.testing.Employee; +import com.baeldung.boot.testing.EmployeeRepository; + import java.util.List; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeRestControllerIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeRestControllerIntegrationTest.java similarity index 87% rename from spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeRestControllerIntegrationTest.java rename to spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeRestControllerIntegrationTest.java index 327e9f9d56..d13fcd79aa 100644 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeRestControllerIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeRestControllerIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.CoreMatchers.is; @@ -14,11 +14,12 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import java.io.IOException; import java.util.List; -import com.baeldung.demo.DemoApplication; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; @@ -27,9 +28,14 @@ import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; +import com.baeldung.boot.Application; +import com.baeldung.boot.testing.Employee; +import com.baeldung.boot.testing.EmployeeRepository; + @RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = DemoApplication.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = Application.class) @AutoConfigureMockMvc +@EnableAutoConfiguration(exclude=SecurityAutoConfiguration.class) // @TestPropertySource(locations = "classpath:application-integrationtest.properties") @AutoConfigureTestDatabase public class EmployeeRestControllerIntegrationTest { diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeServiceImplIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeServiceImplIntegrationTest.java similarity index 94% rename from spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeServiceImplIntegrationTest.java rename to spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeServiceImplIntegrationTest.java index 88f2830a2b..3176a7c75a 100644 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/EmployeeServiceImplIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/EmployeeServiceImplIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; import static org.assertj.core.api.Assertions.assertThat; @@ -6,10 +6,6 @@ import java.util.Arrays; import java.util.List; import java.util.Optional; -import com.baeldung.demo.boottest.Employee; -import com.baeldung.demo.boottest.EmployeeRepository; -import com.baeldung.demo.boottest.EmployeeService; -import com.baeldung.demo.boottest.EmployeeServiceImpl; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,6 +17,11 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.boot.testing.Employee; +import com.baeldung.boot.testing.EmployeeRepository; +import com.baeldung.boot.testing.EmployeeService; +import com.baeldung.boot.testing.EmployeeServiceImpl; + @RunWith(SpringRunner.class) public class EmployeeServiceImplIntegrationTest { diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/JsonUtil.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/JsonUtil.java similarity index 91% rename from spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/JsonUtil.java rename to spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/JsonUtil.java index 3fcd709f7c..49d018dde8 100644 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/demo/boottest/JsonUtil.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/boot/testing/JsonUtil.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.boottest; +package com.baeldung.boot.testing; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/spring-boot-modules/spring-boot/src/test/resources/application-integrationtest.properties b/spring-boot-modules/spring-boot-testing/src/test/resources/application-integrationtest.properties similarity index 100% rename from spring-boot-modules/spring-boot/src/test/resources/application-integrationtest.properties rename to spring-boot-modules/spring-boot-testing/src/test/resources/application-integrationtest.properties diff --git a/spring-boot-modules/spring-boot-testing/src/test/resources/application.properties b/spring-boot-modules/spring-boot-testing/src/test/resources/application.properties index 0c5b0e13e6..1810c7b1eb 100644 --- a/spring-boot-modules/spring-boot-testing/src/test/resources/application.properties +++ b/spring-boot-modules/spring-boot-testing/src/test/resources/application.properties @@ -3,4 +3,6 @@ spring.redis.host= localhost spring.redis.port= 6370 # security spring.security.user.name=john -spring.security.user.password=123 \ No newline at end of file +spring.security.user.password=123 + +spring.main.allow-bean-definition-overriding=true \ No newline at end of file diff --git a/spring-boot-modules/spring-boot/README.MD b/spring-boot-modules/spring-boot/README.md similarity index 79% rename from spring-boot-modules/spring-boot/README.MD rename to spring-boot-modules/spring-boot/README.md index c95fe51842..510864e339 100644 --- a/spring-boot-modules/spring-boot/README.MD +++ b/spring-boot-modules/spring-boot/README.md @@ -14,12 +14,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Guide to Internationalization in Spring Boot](https://www.baeldung.com/spring-boot-internationalization) - [Dynamic DTO Validation Config Retrieved from the Database](https://www.baeldung.com/spring-dynamic-dto-validation) - [Custom Information in Spring Boot Info Endpoint](https://www.baeldung.com/spring-boot-info-actuator-custom) -- [Testing in Spring Boot](https://www.baeldung.com/spring-boot-testing) -- [How to Get All Spring-Managed Beans?](https://www.baeldung.com/spring-show-all-beans) -- [Spring Boot and Togglz Aspect](https://www.baeldung.com/spring-togglz) -- [Getting Started with GraphQL and Spring Boot](https://www.baeldung.com/spring-graphql) - [Guide to Spring Type Conversions](https://www.baeldung.com/spring-type-conversions) -- [An Introduction to Kong](https://www.baeldung.com/kong) - [Spring Boot: Configuring a Main Class](https://www.baeldung.com/spring-boot-main-class) - [A Quick Intro to the SpringBootServletInitializer](https://www.baeldung.com/spring-boot-servlet-initializer) - [Spring Shutdown Callbacks](https://www.baeldung.com/spring-shutdown-callbacks) diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/DemoApplication.java b/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/DemoApplication.java index eb091b4695..d2bb217c2f 100644 --- a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/DemoApplication.java +++ b/spring-boot-modules/spring-boot/src/main/java/com/baeldung/demo/DemoApplication.java @@ -1,13 +1,9 @@ package com.baeldung.demo; -import com.baeldung.graphql.GraphqlConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Import; - @SpringBootApplication -@Import(GraphqlConfiguration.class) public class DemoApplication { public static void main(String[] args) { diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java deleted file mode 100644 index 92d2286518..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/KongAdminAPILiveTest.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.baeldung.kong; - -import com.baeldung.kong.domain.APIObject; -import com.baeldung.kong.domain.ConsumerObject; -import com.baeldung.kong.domain.KeyAuthObject; -import com.baeldung.kong.domain.PluginObject; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.*; -import org.springframework.test.context.junit4.SpringRunner; - -import java.net.URI; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; - -/** - * @author aiet - */ -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = DEFINED_PORT, classes = StockApp.class) -public class KongAdminAPILiveTest { - - private String getStockPrice(String code) { - try { - return restTemplate.getForObject(new URI("http://localhost:8080/stock/" + code), String.class); - } catch (Exception ignored) { - } - return null; - } - - @Before - public void init() { - System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); - } - - @Autowired - TestRestTemplate restTemplate; - - @Test - public void givenEndpoint_whenQueryStockPrice_thenPriceCorrect() { - String response = getStockPrice("btc"); - assertEquals("10000", response); - - response = getStockPrice("eth"); - assertEquals("N/A", response); - } - - @Test - public void givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong() throws Exception { - restTemplate.delete("http://localhost:8001/apis/stock-api"); - - APIObject stockAPI = new APIObject("stock-api", "stock.api", "http://localhost:9090", "/"); - HttpEntity apiEntity = new HttpEntity<>(stockAPI); - ResponseEntity addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); - - assertEquals(HttpStatus.CREATED, addAPIResp.getStatusCode()); - - addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); - assertEquals(HttpStatus.CONFLICT, addAPIResp.getStatusCode()); - String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class); - - assertTrue(apiListResp.contains("stock-api")); - - HttpHeaders headers = new HttpHeaders(); - headers.set("Host", "stock.api"); - RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); - ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); - - assertEquals("10000", stockPriceResp.getBody()); - } - - @Test - public void givenKongAdminAPI_whenAddAPIConsumer_thenAdded() { - restTemplate.delete("http://localhost:8001/consumers/eugenp"); - - ConsumerObject consumer = new ConsumerObject("eugenp"); - HttpEntity addConsumerEntity = new HttpEntity<>(consumer); - ResponseEntity addConsumerResp = restTemplate.postForEntity("http://localhost:8001/consumers/", addConsumerEntity, String.class); - - assertEquals(HttpStatus.CREATED, addConsumerResp.getStatusCode()); - - addConsumerResp = restTemplate.postForEntity("http://localhost:8001/consumers", addConsumerEntity, String.class); - assertEquals(HttpStatus.CONFLICT, addConsumerResp.getStatusCode()); - - String consumerListResp = restTemplate.getForObject("http://localhost:8001/consumers/", String.class); - assertTrue(consumerListResp.contains("eugenp")); - } - - @Test - public void givenAPI_whenEnableAuth_thenAnonymousDenied() throws Exception { - String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class); - if (!apiListResp.contains("stock-api")) { - givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong(); - } - - PluginObject authPlugin = new PluginObject("key-auth"); - ResponseEntity enableAuthResp = restTemplate.postForEntity("http://localhost:8001/apis/stock-api/plugins", new HttpEntity<>(authPlugin), String.class); - - assertTrue(HttpStatus.CREATED == enableAuthResp.getStatusCode() || HttpStatus.CONFLICT == enableAuthResp.getStatusCode()); - - String pluginsResp = restTemplate.getForObject("http://localhost:8001/apis/stock-api/plugins", String.class); - assertTrue(pluginsResp.contains("key-auth")); - - HttpHeaders headers = new HttpHeaders(); - headers.set("Host", "stock.api"); - RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/stock/btc")); - ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); - assertEquals(HttpStatus.UNAUTHORIZED, stockPriceResp.getStatusCode()); - } - - @Test - public void givenAPIAuthEnabled_whenAddKey_thenAccessAllowed() throws Exception { - String apiListResp = restTemplate.getForObject("http://localhost:8001/apis/", String.class); - if (!apiListResp.contains("stock-api")) { - givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong(); - } - - String consumerListResp = restTemplate.getForObject("http://localhost:8001/consumers/", String.class); - if (!consumerListResp.contains("eugenp")) { - givenKongAdminAPI_whenAddAPIConsumer_thenAdded(); - } - - PluginObject authPlugin = new PluginObject("key-auth"); - ResponseEntity enableAuthResp = restTemplate.postForEntity("http://localhost:8001/apis/stock-api/plugins", new HttpEntity<>(authPlugin), String.class); - assertTrue(HttpStatus.CREATED == enableAuthResp.getStatusCode() || HttpStatus.CONFLICT == enableAuthResp.getStatusCode()); - - final String consumerKey = "eugenp.pass"; - KeyAuthObject keyAuth = new KeyAuthObject(consumerKey); - ResponseEntity keyAuthResp = restTemplate.postForEntity("http://localhost:8001/consumers/eugenp/key-auth", new HttpEntity<>(keyAuth), String.class); - - assertTrue(HttpStatus.CREATED == keyAuthResp.getStatusCode() || HttpStatus.CONFLICT == keyAuthResp.getStatusCode()); - - HttpHeaders headers = new HttpHeaders(); - headers.set("Host", "stock.api"); - headers.set("apikey", consumerKey); - RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); - ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); - - assertEquals("10000", stockPriceResp.getBody()); - - headers.set("apikey", "wrongpass"); - requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); - stockPriceResp = restTemplate.exchange(requestEntity, String.class); - assertEquals(HttpStatus.FORBIDDEN, stockPriceResp.getStatusCode()); - } - - @Test - public void givenAdminAPIProxy_whenAddAPIViaProxy_thenAPIAdded() throws Exception { - APIObject adminAPI = new APIObject("admin-api", "admin.api", "http://localhost:8001", "/admin-api"); - HttpEntity apiEntity = new HttpEntity<>(adminAPI); - ResponseEntity addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); - - assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode()); - - HttpHeaders headers = new HttpHeaders(); - headers.set("Host", "admin.api"); - APIObject baeldungAPI = new APIObject("baeldung-api", "baeldung.com", "http://ww.baeldung.com", "/"); - RequestEntity requestEntity = new RequestEntity<>(baeldungAPI, headers, HttpMethod.POST, new URI("http://localhost:8000/admin-api/apis")); - addAPIResp = restTemplate.exchange(requestEntity, String.class); - - assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode()); - } - -} diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java deleted file mode 100644 index 7cf67453a6..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/KongLoadBalanceLiveTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baeldung.kong; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; - -import java.net.URI; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.RequestEntity; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.kong.domain.APIObject; -import com.baeldung.kong.domain.TargetObject; -import com.baeldung.kong.domain.UpstreamObject; - -/** - * @author aiet - */ -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = DEFINED_PORT, classes = StockApp.class, properties = "server.servlet.contextPath=/springbootapp") -public class KongLoadBalanceLiveTest { - - @Before - public void init() { - System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); - } - - @Autowired - TestRestTemplate restTemplate; - - @Test - public void givenKongAdminAPI_whenAddAPI_thenAPIAccessibleViaKong() throws Exception { - UpstreamObject upstream = new UpstreamObject("stock.api.service"); - ResponseEntity addUpstreamResp = restTemplate.postForEntity("http://localhost:8001/upstreams", new HttpEntity<>(upstream), String.class); - assertTrue(HttpStatus.CREATED == addUpstreamResp.getStatusCode() || HttpStatus.CONFLICT == addUpstreamResp.getStatusCode()); - - TargetObject testTarget = new TargetObject("localhost:8080", 10); - ResponseEntity addTargetResp = restTemplate.postForEntity("http://localhost:8001/upstreams/stock.api.service/targets", new HttpEntity<>(testTarget), String.class); - assertTrue(HttpStatus.CREATED == addTargetResp.getStatusCode() || HttpStatus.CONFLICT == addTargetResp.getStatusCode()); - - TargetObject releaseTarget = new TargetObject("localhost:9090", 40); - addTargetResp = restTemplate.postForEntity("http://localhost:8001/upstreams/stock.api.service/targets", new HttpEntity<>(releaseTarget), String.class); - assertTrue(HttpStatus.CREATED == addTargetResp.getStatusCode() || HttpStatus.CONFLICT == addTargetResp.getStatusCode()); - - APIObject stockAPI = new APIObject("balanced-stock-api", "balanced.stock.api", "http://stock.api.service", "/"); - HttpEntity apiEntity = new HttpEntity<>(stockAPI); - ResponseEntity addAPIResp = restTemplate.postForEntity("http://localhost:8001/apis", apiEntity, String.class); - assertTrue(HttpStatus.CREATED == addAPIResp.getStatusCode() || HttpStatus.CONFLICT == addAPIResp.getStatusCode()); - - HttpHeaders headers = new HttpHeaders(); - headers.set("Host", "balanced.stock.api"); - for (int i = 0; i < 1000; i++) { - RequestEntity requestEntity = new RequestEntity<>(headers, HttpMethod.GET, new URI("http://localhost:8000/springbootapp/stock/btc")); - ResponseEntity stockPriceResp = restTemplate.exchange(requestEntity, String.class); - assertEquals("10000", stockPriceResp.getBody()); - } - - int releaseCount = restTemplate.getForObject("http://localhost:9090/springbootapp/stock/reqcount", Integer.class); - int testCount = restTemplate.getForObject("http://localhost:8080/springbootapp/stock/reqcount", Integer.class); - - assertTrue(Math.round(releaseCount * 1.0 / testCount) == 4); - } - -} diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/APIObject.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/APIObject.java deleted file mode 100644 index f386712444..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/APIObject.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.baeldung.kong.domain; - -/** - * @author aiet - */ -public class APIObject { - - public APIObject() { - } - - public APIObject(String name, String hosts, String upstream_url, String uris) { - this.name = name; - this.hosts = hosts; - this.upstream_url = upstream_url; - this.uris = uris; - } - - private String name; - private String hosts; - private String upstream_url; - private String uris; - - public String getUris() { - return uris; - } - - public void setUris(String uris) { - this.uris = uris; - } - - public String getUpstream_url() { - return upstream_url; - } - - public void setUpstream_url(String upstream_url) { - this.upstream_url = upstream_url; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getHosts() { - return hosts; - } - - public void setHosts(String hosts) { - this.hosts = hosts; - } -} diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/ConsumerObject.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/ConsumerObject.java deleted file mode 100644 index 74bef8f2d1..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/ConsumerObject.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.kong.domain; - -/** - * @author aiet - */ -public class ConsumerObject { - - private String username; - private String custom_id; - - public ConsumerObject(String username) { - this.username = username; - } - - public ConsumerObject(String username, String custom_id) { - this.username = username; - this.custom_id = custom_id; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getCustom_id() { - return custom_id; - } - - public void setCustom_id(String custom_id) { - this.custom_id = custom_id; - } -} diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/KeyAuthObject.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/KeyAuthObject.java deleted file mode 100644 index 80de6bfcd9..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/KeyAuthObject.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.kong.domain; - -/** - * @author aiet - */ -public class KeyAuthObject { - - public KeyAuthObject(String key) { - this.key = key; - } - - private String key; - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } -} diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/PluginObject.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/PluginObject.java deleted file mode 100644 index c161fc9b54..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/PluginObject.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.kong.domain; - -/** - * @author aiet - */ -public class PluginObject { - - private String name; - private String consumer_id; - - public PluginObject(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getConsumer_id() { - return consumer_id; - } - - public void setConsumer_id(String consumer_id) { - this.consumer_id = consumer_id; - } -} diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/TargetObject.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/TargetObject.java deleted file mode 100644 index 79653e2846..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/TargetObject.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.kong.domain; - -/** - * @author aiet - */ -public class TargetObject { - - public TargetObject(String target, int weight) { - this.target = target; - this.weight = weight; - } - - private String target; - private int weight; - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public int getWeight() { - return weight; - } - - public void setWeight(int weight) { - this.weight = weight; - } -} diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/UpstreamObject.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/UpstreamObject.java deleted file mode 100644 index 6461381ac5..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/kong/domain/UpstreamObject.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.kong.domain; - -/** - * @author aiet - */ -public class UpstreamObject { - - public UpstreamObject(String name) { - this.name = name; - } - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java b/spring-boot-modules/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java deleted file mode 100644 index 3213a10df9..0000000000 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.baeldung.toggle; - -import static org.junit.Assert.assertEquals; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK, classes = ToggleApplication.class) -@AutoConfigureMockMvc -public class ToggleIntegrationTest { - - @Autowired - private EmployeeRepository employeeRepository; - - @Autowired - private MockMvc mockMvc; - - @Autowired - private WebApplicationContext wac; - - @Before - public void setup() { - this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); - } - - @Test - public void givenFeaturePropertyFalse_whenIncreaseSalary_thenNoIncrease() throws Exception { - Employee emp = new Employee(1, 2000); - employeeRepository.save(emp); - - System.setProperty("employee.feature", "false"); - - mockMvc.perform(post("/increaseSalary").param("id", emp.getId() + "")).andExpect(status().is(200)); - - emp = employeeRepository.findById(1L).orElse(null); - assertEquals("salary incorrect", 2000, emp.getSalary(), 0.5); - } - - @Test - public void givenFeaturePropertyTrue_whenIncreaseSalary_thenIncrease() throws Exception { - Employee emp = new Employee(1, 2000); - employeeRepository.save(emp); - - System.setProperty("employee.feature", "true"); - - mockMvc.perform(post("/increaseSalary").param("id", emp.getId() + "")).andExpect(status().is(200)); - - emp = employeeRepository.findById(1L).orElse(null); - assertEquals("salary incorrect", 2200, emp.getSalary(), 0.5); - } -} From e878b28d98896b0b0d35a1b63a104746eb73cb35 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sat, 29 Aug 2020 13:05:31 +0530 Subject: [PATCH 0596/1862] Splitted apiInfo to multiple lines. --- .../swagger2boot/configuration/SwaggerConfiguration.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java index 73dfe85387..7bacdde4c8 100644 --- a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java +++ b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java @@ -22,7 +22,9 @@ import springfox.documentation.swagger.web.UiConfigurationBuilder; public class SwaggerConfiguration { private ApiInfo apiInfo() { - return new ApiInfo("My REST API", "Some custom description of API.", "API TOS", "Terms of service", new Contact("Umang Budhwar", "www.baeldung.com", "umangbudhwar@gmail.com"), "License of API", "API license URL", Collections.emptyList()); + return new ApiInfo("My REST API", "Some custom description of API.", "API TOS", "Terms of service", + new Contact("Umang Budhwar", "www.baeldung.com", "umangbudhwar@gmail.com"), + "License of API", "API license URL", Collections.emptyList()); } @Bean From 44d66d9a0fe04ebc8e39b5f9e1651c1a5243537e Mon Sep 17 00:00:00 2001 From: kwoyke Date: Sat, 29 Aug 2020 10:49:40 +0200 Subject: [PATCH 0597/1862] BAEL-3715: Sync code and article (#9932) --- .../springevents/synchronous/CustomSpringEventPublisher.java | 2 +- .../AsynchronousCustomSpringEventsIntegrationTest.java | 2 +- .../SynchronousCustomSpringEventsIntegrationTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventPublisher.java b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventPublisher.java index e4d7fcdc99..0ed06afd00 100644 --- a/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventPublisher.java +++ b/spring-core-2/src/main/java/com/baeldung/springevents/synchronous/CustomSpringEventPublisher.java @@ -10,7 +10,7 @@ public class CustomSpringEventPublisher { @Autowired private ApplicationEventPublisher applicationEventPublisher; - public void publishEvent(final String message) { + public void publishCustomEvent(final String message) { System.out.println("Publishing custom event. "); final CustomSpringEvent customSpringEvent = new CustomSpringEvent(this, message); applicationEventPublisher.publishEvent(customSpringEvent); diff --git a/spring-core-2/src/test/java/com/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java index 4f8035bcbe..d41f0114ca 100644 --- a/spring-core-2/src/test/java/com/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/springevents/asynchronous/AsynchronousCustomSpringEventsIntegrationTest.java @@ -17,7 +17,7 @@ public class AsynchronousCustomSpringEventsIntegrationTest { @Test public void testCustomSpringEvents() throws InterruptedException { - publisher.publishEvent("Hello world!!"); + publisher.publishCustomEvent("Hello world!!"); System.out.println("Done publishing asynchronous custom event. "); } } diff --git a/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java index 1d624d2289..d4d718f980 100644 --- a/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java +++ b/spring-core-2/src/test/java/com/baeldung/springevents/synchronous/SynchronousCustomSpringEventsIntegrationTest.java @@ -22,7 +22,7 @@ public class SynchronousCustomSpringEventsIntegrationTest { @Test public void testCustomSpringEvents() { isTrue(!listener.isHitCustomEventHandler(), "The value should be false"); - publisher.publishEvent("Hello world!!"); + publisher.publishCustomEvent("Hello world!!"); System.out.println("Done publishing synchronous custom event. "); isTrue(listener.isHitCustomEventHandler(), "Now the value should be changed to true"); } From eab67c04b5bb0357b587eb1c34033253203ff269 Mon Sep 17 00:00:00 2001 From: akeshri Date: Sat, 29 Aug 2020 21:02:52 +0530 Subject: [PATCH 0598/1862] changes --- .../com/baeldung/article/HashMapExample.java | 36 ++++++++++++++++++ .../article/LinkedHashMapExample.java | 37 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 MapFirstKeyExample/src/com/baeldung/article/HashMapExample.java create mode 100644 MapFirstKeyExample/src/com/baeldung/article/LinkedHashMapExample.java diff --git a/MapFirstKeyExample/src/com/baeldung/article/HashMapExample.java b/MapFirstKeyExample/src/com/baeldung/article/HashMapExample.java new file mode 100644 index 0000000000..3292d995ab --- /dev/null +++ b/MapFirstKeyExample/src/com/baeldung/article/HashMapExample.java @@ -0,0 +1,36 @@ +package com.baeldung.article; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +/** + * @author AshwiniKeshri + * + */ +public class HashMapExample { + public static void main(String[] args) { + + Map hashmap = new HashMap<>(); + hashmap.put(5, "A"); + hashmap.put(1, "B"); + hashmap.put(2, "C"); + // hashmap.put(0, "D"); + + System.out.println(hashmap); + + Set> entrySet = hashmap.entrySet(); + + Iterator> iterator = entrySet.iterator(); + + if (iterator.hasNext()) + System.out.println("Using Iteraor: " + iterator.next()); + + System.out.println("Using Stream: " + entrySet.stream() + .findFirst() + .orElse(new AbstractMap.SimpleEntry(-1, "DEFAULT"))); + + } +} diff --git a/MapFirstKeyExample/src/com/baeldung/article/LinkedHashMapExample.java b/MapFirstKeyExample/src/com/baeldung/article/LinkedHashMapExample.java new file mode 100644 index 0000000000..249b9a0585 --- /dev/null +++ b/MapFirstKeyExample/src/com/baeldung/article/LinkedHashMapExample.java @@ -0,0 +1,37 @@ +package com.baeldung.article; + +import java.util.AbstractMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; + +/** + * @author AshwiniKeshri + * + */ +public class LinkedHashMapExample { + + public static void main(String[] args) { + + LinkedHashMap linkedHashMap = new LinkedHashMap<>(); + linkedHashMap.put(5, "A"); + linkedHashMap.put(1, "B"); + linkedHashMap.put(2, "C"); + // linkedHashMap.put(0, "D"); + + System.out.println(linkedHashMap); + + Set> entrySet = linkedHashMap.entrySet(); + + Iterator> iterator = entrySet.iterator(); + + if (iterator.hasNext()) + System.out.println("Using Iterator: " + iterator.next()); + + System.out.println("Using Stream: " + entrySet.stream() + .findFirst() + .orElse(new AbstractMap.SimpleEntry(0, "DEFAULT"))); + } + +} From 556d5d8eaa2d9c23d0657495f2721d4b2775c025 Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Sat, 29 Aug 2020 17:35:01 +0200 Subject: [PATCH 0599/1862] [BAEL-4471] Quarkus Testing (#9894) * [BAEL-4471] initial commit [BAEL-4471] commit [BAEL-4471] commit [BAEL-4471] commit [BAEL-4471] commit * [BAEL-4471] cosmetic fixes * [BAEL-4471] remove testcontainers * [BAEL-4471] PR comments fixes * [BAEL-4471] PR comments fixes * [BAEL-4471] assign different port per profile while testing * [BAEL-4471] rename unit to integration test --- quarkus/pom.xml | 42 ++++++++++++++++++- .../com/baeldung/quarkus/LibraryResource.java | 25 +++++++++++ .../java/com/baeldung/quarkus/model/Book.java | 17 ++++++++ .../quarkus/repository/BookRepository.java | 18 ++++++++ .../quarkus/service/LibraryService.java | 28 +++++++++++++ .../src/main/resources/application.properties | 11 ++++- .../CustomLibraryResourceManualTest.java | 27 ++++++++++++ .../LibraryHttpEndpointIntegrationTest.java | 21 ++++++++++ ...ryResourceHttpResourceIntegrationTest.java | 40 ++++++++++++++++++ ...braryResourceInjectSpyIntegrationTest.java | 27 ++++++++++++ .../LibraryResourceIntegrationTest.java | 24 +++++++++++ .../quarkus/NativeHelloResourceIT.java | 7 +++- .../quarkus/NativeLibraryResourceIT.java | 10 +++++ .../BookRepositoryIntegrationTest.java | 20 +++++++++ .../LibraryServiceInjectMockUnitTest.java | 38 +++++++++++++++++ .../LibraryServiceIntegrationTest.java | 21 ++++++++++ .../LibraryServiceQuarkusMockUnitTest.java | 38 +++++++++++++++++ .../quarkus/utils/CustomTestProfile.java | 26 ++++++++++++ .../utils/QuarkusTransactionalTest.java | 18 ++++++++ .../quarkus/utils/TestBookRepository.java | 22 ++++++++++ 20 files changed, 476 insertions(+), 4 deletions(-) create mode 100644 quarkus/src/main/java/com/baeldung/quarkus/LibraryResource.java create mode 100644 quarkus/src/main/java/com/baeldung/quarkus/model/Book.java create mode 100644 quarkus/src/main/java/com/baeldung/quarkus/repository/BookRepository.java create mode 100644 quarkus/src/main/java/com/baeldung/quarkus/service/LibraryService.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/CustomLibraryResourceManualTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/LibraryHttpEndpointIntegrationTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceHttpResourceIntegrationTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceInjectSpyIntegrationTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceIntegrationTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/NativeLibraryResourceIT.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/repository/BookRepositoryIntegrationTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceInjectMockUnitTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceIntegrationTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceQuarkusMockUnitTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/utils/CustomTestProfile.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/utils/QuarkusTransactionalTest.java create mode 100644 quarkus/src/test/java/com/baeldung/quarkus/utils/TestBookRepository.java diff --git a/quarkus/pom.xml b/quarkus/pom.xml index 09eb90d110..67356abdef 100644 --- a/quarkus/pom.xml +++ b/quarkus/pom.xml @@ -30,9 +30,48 @@ io.quarkus quarkus-resteasy + + io.quarkus + quarkus-resteasy-jackson + ${quarkus.version} + + + io.quarkus + quarkus-hibernate-orm-panache + ${quarkus.version} + + + io.quarkus + quarkus-jdbc-h2 + ${quarkus.version} + + + org.apache.commons + commons-lang3 + 3.9 + + + org.projectlombok + lombok + 1.18.6 + provided + io.quarkus quarkus-junit5 + ${quarkus.version} + test + + + io.quarkus + quarkus-junit5-mockito + ${quarkus.version} + test + + + io.quarkus + quarkus-test-h2 + ${quarkus.version} test @@ -117,7 +156,8 @@ 2.22.0 - 0.15.0 + 1.7.0.Final + 5.6.0
    diff --git a/quarkus/src/main/java/com/baeldung/quarkus/LibraryResource.java b/quarkus/src/main/java/com/baeldung/quarkus/LibraryResource.java new file mode 100644 index 0000000000..88c3f0ed6e --- /dev/null +++ b/quarkus/src/main/java/com/baeldung/quarkus/LibraryResource.java @@ -0,0 +1,25 @@ +package com.baeldung.quarkus; + +import com.baeldung.quarkus.model.Book; +import com.baeldung.quarkus.service.LibraryService; + +import javax.inject.Inject; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import java.util.Set; + +@Path("/library") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class LibraryResource { + + @Inject + LibraryService libraryService; + + @GET + @Path("/book") + public Set findBooks(@QueryParam("query") String query) { + return libraryService.find(query); + } + +} diff --git a/quarkus/src/main/java/com/baeldung/quarkus/model/Book.java b/quarkus/src/main/java/com/baeldung/quarkus/model/Book.java new file mode 100644 index 0000000000..7d258c1934 --- /dev/null +++ b/quarkus/src/main/java/com/baeldung/quarkus/model/Book.java @@ -0,0 +1,17 @@ +package com.baeldung.quarkus.model; + +import io.quarkus.hibernate.orm.panache.PanacheEntity; +import lombok.*; + +import javax.persistence.Entity; + +@Data +@Entity +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Book extends PanacheEntity { + private String title; + private String author; +} + diff --git a/quarkus/src/main/java/com/baeldung/quarkus/repository/BookRepository.java b/quarkus/src/main/java/com/baeldung/quarkus/repository/BookRepository.java new file mode 100644 index 0000000000..b142fa569b --- /dev/null +++ b/quarkus/src/main/java/com/baeldung/quarkus/repository/BookRepository.java @@ -0,0 +1,18 @@ +package com.baeldung.quarkus.repository; + +import com.baeldung.quarkus.model.Book; +import io.quarkus.hibernate.orm.panache.PanacheRepository; + +import javax.enterprise.context.ApplicationScoped; +import java.util.stream.Stream; + +import static io.quarkus.panache.common.Parameters.with; + +@ApplicationScoped +public class BookRepository implements PanacheRepository { + + public Stream findBy(String query) { + return find("author like :query or title like :query", with("query", "%"+query+"%")).stream(); + } + +} diff --git a/quarkus/src/main/java/com/baeldung/quarkus/service/LibraryService.java b/quarkus/src/main/java/com/baeldung/quarkus/service/LibraryService.java new file mode 100644 index 0000000000..be687589bf --- /dev/null +++ b/quarkus/src/main/java/com/baeldung/quarkus/service/LibraryService.java @@ -0,0 +1,28 @@ +package com.baeldung.quarkus.service; + +import com.baeldung.quarkus.model.Book; +import com.baeldung.quarkus.repository.BookRepository; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.transaction.Transactional; +import java.util.Set; + +import static java.util.stream.Collectors.toSet; + +@Transactional +@ApplicationScoped +public class LibraryService { + + @Inject + BookRepository bookRepository; + + public Set find(String query) { + if (query == null) { + return bookRepository.findAll().stream().collect(toSet()); + } + + return bookRepository.findBy(query).collect(toSet()); + } + +} diff --git a/quarkus/src/main/resources/application.properties b/quarkus/src/main/resources/application.properties index 3f05d2198f..283cf763b9 100644 --- a/quarkus/src/main/resources/application.properties +++ b/quarkus/src/main/resources/application.properties @@ -1,3 +1,12 @@ # Configuration file # key = value -greeting=Good morning \ No newline at end of file +greeting=Good morning + +quarkus.datasource.db-kind = h2 +quarkus.datasource.jdbc.url = jdbc:h2:tcp://localhost/mem:test + +quarkus.hibernate-orm.database.generation = drop-and-create + +%custom-profile.quarkus.datasource.jdbc.url = jdbc:h2:file:./testdb + +quarkus.http.test-port=0 diff --git a/quarkus/src/test/java/com/baeldung/quarkus/CustomLibraryResourceManualTest.java b/quarkus/src/test/java/com/baeldung/quarkus/CustomLibraryResourceManualTest.java new file mode 100644 index 0000000000..b9175ae457 --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/CustomLibraryResourceManualTest.java @@ -0,0 +1,27 @@ +package com.baeldung.quarkus; + +import com.baeldung.quarkus.utils.CustomTestProfile; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; +import io.restassured.http.ContentType; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.hasItems; + +@QuarkusTest +@TestProfile(CustomTestProfile.class) +class CustomLibraryResourceManualTest { + + public static final String BOOKSTORE_ENDPOINT = "/custom/library/book"; + + @Test + void whenGetBooksGivenNoQuery_thenAllBooksShouldBeReturned() { + given().contentType(ContentType.JSON) + .when().get(BOOKSTORE_ENDPOINT) + .then().statusCode(200) + .body("size()", is(2)) + .body("title", hasItems("Foundation", "Dune")); + } +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/LibraryHttpEndpointIntegrationTest.java b/quarkus/src/test/java/com/baeldung/quarkus/LibraryHttpEndpointIntegrationTest.java new file mode 100644 index 0000000000..f3a30a2383 --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/LibraryHttpEndpointIntegrationTest.java @@ -0,0 +1,21 @@ +package com.baeldung.quarkus; + +import io.quarkus.test.common.http.TestHTTPEndpoint; +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.http.ContentType; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; + +@QuarkusTest +@TestHTTPEndpoint(LibraryResource.class) +class LibraryHttpEndpointIntegrationTest { + + @Test + void whenGetBooks_thenShouldReturnSuccessfully() { + given().contentType(ContentType.JSON) + .when().get("book") + .then().statusCode(200); + } + +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceHttpResourceIntegrationTest.java b/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceHttpResourceIntegrationTest.java new file mode 100644 index 0000000000..1931460aaa --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceHttpResourceIntegrationTest.java @@ -0,0 +1,40 @@ +package com.baeldung.quarkus; + +import io.quarkus.test.common.http.TestHTTPEndpoint; +import io.quarkus.test.common.http.TestHTTPResource; +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.http.ContentType; +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.net.URL; + +import static io.restassured.RestAssured.given; +import static java.nio.charset.Charset.defaultCharset; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.hasItem; +import static org.junit.jupiter.api.Assertions.assertTrue; + +@QuarkusTest +class LibraryResourceHttpResourceIntegrationTest { + + @TestHTTPEndpoint(LibraryResource.class) + @TestHTTPResource("book") + URL libraryEndpoint; + + @Test + void whenGetBooksByTitle_thenBookShouldBeFound() { + given().contentType(ContentType.JSON).param("query", "Dune") + .when().get(libraryEndpoint) + .then().statusCode(200) + .body("size()", is(1)) + .body("title", hasItem("Dune")) + .body("author", hasItem("Frank Herbert")); + } + + @Test + void whenGetBooks_thenBooksShouldBeFound() throws IOException { + assertTrue(IOUtils.toString(libraryEndpoint.openStream(), defaultCharset()).contains("Asimov")); + } +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceInjectSpyIntegrationTest.java b/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceInjectSpyIntegrationTest.java new file mode 100644 index 0000000000..48ec1786fa --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceInjectSpyIntegrationTest.java @@ -0,0 +1,27 @@ +package com.baeldung.quarkus; + +import com.baeldung.quarkus.service.LibraryService; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.mockito.InjectSpy; +import io.restassured.http.ContentType; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; +import static org.mockito.Mockito.verify; + +@QuarkusTest +class LibraryResourceInjectSpyIntegrationTest { + + @InjectSpy + LibraryService libraryService; + + @Test + void whenGetBooksByAuthor_thenBookShouldBeFound() { + given().contentType(ContentType.JSON).param("query", "Asimov") + .when().get("/library/book") + .then().statusCode(200); + + verify(libraryService).find("Asimov"); + } + +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceIntegrationTest.java b/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceIntegrationTest.java new file mode 100644 index 0000000000..28eba8da44 --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/LibraryResourceIntegrationTest.java @@ -0,0 +1,24 @@ +package com.baeldung.quarkus; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.http.ContentType; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.hasItem; + +@QuarkusTest +class LibraryResourceIntegrationTest { + + @Test + void whenGetBooksByTitle_thenBookShouldBeFound() { + given().contentType(ContentType.JSON).param("query", "Dune") + .when().get("/library/book") + .then().statusCode(200) + .body("size()", is(1)) + .body("title", hasItem("Dune")) + .body("author", hasItem("Frank Herbert")); + } + +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/NativeHelloResourceIT.java b/quarkus/src/test/java/com/baeldung/quarkus/NativeHelloResourceIT.java index 9ada64b6a5..e6c8a3b8fb 100644 --- a/quarkus/src/test/java/com/baeldung/quarkus/NativeHelloResourceIT.java +++ b/quarkus/src/test/java/com/baeldung/quarkus/NativeHelloResourceIT.java @@ -1,8 +1,11 @@ package com.baeldung.quarkus; -import io.quarkus.test.junit.SubstrateTest; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.NativeImageTest; -@SubstrateTest +@NativeImageTest +@QuarkusTestResource(H2DatabaseTestResource.class) public class NativeHelloResourceIT extends HelloResourceUnitTest { // Execute the same tests but in native mode. diff --git a/quarkus/src/test/java/com/baeldung/quarkus/NativeLibraryResourceIT.java b/quarkus/src/test/java/com/baeldung/quarkus/NativeLibraryResourceIT.java new file mode 100644 index 0000000000..0c11fa6fb4 --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/NativeLibraryResourceIT.java @@ -0,0 +1,10 @@ +package com.baeldung.quarkus; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.h2.H2DatabaseTestResource; +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +@QuarkusTestResource(H2DatabaseTestResource.class) +class NativeLibraryResourceIT extends LibraryHttpEndpointIntegrationTest { +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/repository/BookRepositoryIntegrationTest.java b/quarkus/src/test/java/com/baeldung/quarkus/repository/BookRepositoryIntegrationTest.java new file mode 100644 index 0000000000..7d811b2268 --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/repository/BookRepositoryIntegrationTest.java @@ -0,0 +1,20 @@ +package com.baeldung.quarkus.repository; + +import com.baeldung.quarkus.utils.QuarkusTransactionalTest; +import org.junit.jupiter.api.Test; + +import javax.inject.Inject; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +@QuarkusTransactionalTest +class BookRepositoryIntegrationTest { + + @Inject + BookRepository bookRepository; + + @Test + void givenBookInRepository_whenFindByAuthor_thenShouldReturnBookFromRepository() { + assertTrue(bookRepository.findBy("Herbert").findAny().isPresent()); + } +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceInjectMockUnitTest.java b/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceInjectMockUnitTest.java new file mode 100644 index 0000000000..f0b7260c7d --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceInjectMockUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.quarkus.service; + +import com.baeldung.quarkus.model.Book; +import com.baeldung.quarkus.repository.BookRepository; +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.mockito.InjectMock; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import javax.inject.Inject; +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +@QuarkusTest +class LibraryServiceInjectMockUnitTest { + + @Inject + LibraryService libraryService; + + @InjectMock + BookRepository bookRepository; + + @BeforeEach + void setUp() { + when(bookRepository.findBy("Frank Herbert")) + .thenReturn(Arrays.stream(new Book[] { + new Book("Dune", "Frank Herbert"), + new Book("Children of Dune", "Frank Herbert")})); + } + + @Test + void whenFindByAuthor_thenBooksShouldBeFound() { + assertEquals(2, libraryService.find("Frank Herbert").size()); + } + +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceIntegrationTest.java b/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceIntegrationTest.java new file mode 100644 index 0000000000..16cce4d726 --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceIntegrationTest.java @@ -0,0 +1,21 @@ +package com.baeldung.quarkus.service; + +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Test; + +import javax.inject.Inject; + +import static org.junit.jupiter.api.Assertions.assertFalse; + +@QuarkusTest +class LibraryServiceIntegrationTest { + + @Inject + LibraryService libraryService; + + @Test + void whenFindByAuthor_thenBookShouldBeFound() { + assertFalse(libraryService.find("Frank Herbert").isEmpty()); + } + +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceQuarkusMockUnitTest.java b/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceQuarkusMockUnitTest.java new file mode 100644 index 0000000000..e2d40a0a0b --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/service/LibraryServiceQuarkusMockUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.quarkus.service; + +import com.baeldung.quarkus.model.Book; +import com.baeldung.quarkus.repository.BookRepository; +import com.baeldung.quarkus.utils.TestBookRepository; +import io.quarkus.test.junit.QuarkusMock; +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +import javax.inject.Inject; +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@QuarkusTest +class LibraryServiceQuarkusMockUnitTest { + + @Inject + LibraryService libraryService; + + @BeforeEach + void setUp() { + BookRepository mock = Mockito.mock(TestBookRepository.class); + Mockito.when(mock.findBy("Asimov")) + .thenReturn(Arrays.stream(new Book[] { + new Book("Foundation", "Isaac Asimov"), + new Book("I Robot", "Isaac Asimov")})); + QuarkusMock.installMockForType(mock, BookRepository.class); + } + + @Test + void whenFindByAuthor_thenBooksShouldBeFound() { + assertEquals(2, libraryService.find("Asimov").size()); + } + +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/utils/CustomTestProfile.java b/quarkus/src/test/java/com/baeldung/quarkus/utils/CustomTestProfile.java new file mode 100644 index 0000000000..75fb736acc --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/utils/CustomTestProfile.java @@ -0,0 +1,26 @@ +package com.baeldung.quarkus.utils; + +import io.quarkus.test.junit.QuarkusTestProfile; + +import java.util.Collections; +import java.util.Map; +import java.util.Set; + +public class CustomTestProfile implements QuarkusTestProfile { + + @Override + public Map getConfigOverrides() { + return Collections.singletonMap("quarkus.resteasy.path", "/custom"); + } + + @Override + public Set> getEnabledAlternatives() { + return Collections.singleton(TestBookRepository.class); + } + + @Override + public String getConfigProfile() { + return "custom-profile"; + } + +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/utils/QuarkusTransactionalTest.java b/quarkus/src/test/java/com/baeldung/quarkus/utils/QuarkusTransactionalTest.java new file mode 100644 index 0000000000..d02cff2662 --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/utils/QuarkusTransactionalTest.java @@ -0,0 +1,18 @@ +package com.baeldung.quarkus.utils; + +import io.quarkus.test.junit.QuarkusTest; + +import javax.enterprise.inject.Stereotype; +import javax.transaction.Transactional; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@QuarkusTest +@Stereotype +@Transactional +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface QuarkusTransactionalTest { +} diff --git a/quarkus/src/test/java/com/baeldung/quarkus/utils/TestBookRepository.java b/quarkus/src/test/java/com/baeldung/quarkus/utils/TestBookRepository.java new file mode 100644 index 0000000000..baaa9fd005 --- /dev/null +++ b/quarkus/src/test/java/com/baeldung/quarkus/utils/TestBookRepository.java @@ -0,0 +1,22 @@ +package com.baeldung.quarkus.utils; + +import com.baeldung.quarkus.model.Book; +import com.baeldung.quarkus.repository.BookRepository; + +import javax.annotation.PostConstruct; +import javax.annotation.Priority; +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Alternative; + +@Priority(1) +@Alternative +@ApplicationScoped +public class TestBookRepository extends BookRepository { + + @PostConstruct + public void init() { + persist(new Book("Dune", "Frank Herbert"), + new Book("Foundation", "Isaac Asimov")); + } + +} From e92ecf211a0cc3f0a83cb207e7d6667efe450cd7 Mon Sep 17 00:00:00 2001 From: Usman Mohyuddin Date: Sat, 29 Aug 2020 22:31:40 +0500 Subject: [PATCH 0600/1862] Remove prefix from string using groovy (BAEL-4104) Remove prefix from string using groovy (BAEL-4104) --- core-groovy-strings/README.md | 8 +++ core-groovy-strings/pom.xml | 72 +++++++++++++++++++ .../removeprefix/RemovePrefixTest.groovy | 58 +++++++++++++++ 3 files changed, 138 insertions(+) create mode 100644 core-groovy-strings/README.md create mode 100644 core-groovy-strings/pom.xml create mode 100644 core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy diff --git a/core-groovy-strings/README.md b/core-groovy-strings/README.md new file mode 100644 index 0000000000..e3202e2dd0 --- /dev/null +++ b/core-groovy-strings/README.md @@ -0,0 +1,8 @@ +# Core Groovy Strings + +This module contains articles about core Groovy strings concepts + +## Relevant articles: + +- [Remove prefix in Groovy]() +- [[<-- Prev]](/core-groovy-strings) diff --git a/core-groovy-strings/pom.xml b/core-groovy-strings/pom.xml new file mode 100644 index 0000000000..059b53662c --- /dev/null +++ b/core-groovy-strings/pom.xml @@ -0,0 +1,72 @@ + + + com.baeldung + 4.0.0 + core-groovy-strings + 1.0-SNAPSHOT + core-groovy-strings + jar + + + + org.codehaus.groovy + groovy-all + ${groovy.version} + pom + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + + + src/main/groovy + src/main/java + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy.compiler.version} + true + + + maven-compiler-plugin + ${compiler.plugin.version} + + groovy-eclipse-compiler + ${java.version} + ${java.version} + + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy.compiler.version} + + + org.codehaus.groovy + groovy-eclipse-batch + ${groovy.version}-01 + + + + + + + + 1.0.0 + 1.1.3 + 2.5.7 + 2.20.1 + 3.8.0 + 3.3.0-01 + 1.8 + + + \ No newline at end of file diff --git a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy new file mode 100644 index 0000000000..568e5fdde8 --- /dev/null +++ b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy @@ -0,0 +1,58 @@ +package com.baeldung.removeprefix + +import org.junit.Assert +import org.junit.Test + +class RemovePrefixTest { + + + @Test + public void givenWhenCasePrefixIsRemoved_thenReturnTrue() { + def trimPrefix = { + it.startsWith('Groovy') ? it.minus('Groovy') : it + } + + Assert.assertEquals(trimPrefix("GroovyTutorials at Baeldung"), "Tutorials at Baeldung") + } + + @Test + public void givenWhenPrefixIsRemoved_thenReturnTrue() { + + String prefix = "groovy-" + String trimPrefix = "Groovy-Tutorials at Baeldung" + def result; + if(trimPrefix.startsWithIgnoreCase(prefix)) { + result = trimPrefix.substring(prefix.length()) + } + + Assert.assertEquals("Tutorials at Baeldung", result) + } + + @Test + public void givenWhenPrefixIsRemovedUsingRegex_thenReturnTrue() { + + def regex = ~"^([Gg])roovy-" + String trimPrefix = "Groovy-Tutorials at Baeldung" + String result = trimPrefix - regex + + Assert.assertEquals("Tutorials at Baeldung", result) + } + + @Test public void givenWhenPrefixIsRemovedUsingReplaceFirst_thenReturnTrue() { + def regex = ~"^groovy" + String trimPrefix = "groovyTutorials at Baeldung's groovy page" + String result = trimPrefix.replaceFirst(regex, "") + + Assert.assertEquals("Tutorials at Baeldung's groovy page", result) + } + + @Test + public void givenWhenPrefixIsRemovedUsingReplaceAll_thenReturnTrue() { + + String trimPrefix = "groovyTutorials at Baeldung groovy" + String result = trimPrefix.replaceAll(/^groovy/, "") + + Assert.assertEquals("Tutorials at Baeldung groovy", result) + } + +} From c7b2ab3f46cabc6aedc7cf1b4d6c6ebb32ccfc9b Mon Sep 17 00:00:00 2001 From: akeshri Date: Sat, 29 Aug 2020 23:42:56 +0530 Subject: [PATCH 0601/1862] changes --- .../src/com/baeldung/article/HashMapExample.java | 0 .../src/com/baeldung/article/LinkedHashMapExample.java | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {MapFirstKeyExample => map-first-key-tutorial}/src/com/baeldung/article/HashMapExample.java (100%) rename {MapFirstKeyExample => map-first-key-tutorial}/src/com/baeldung/article/LinkedHashMapExample.java (100%) diff --git a/MapFirstKeyExample/src/com/baeldung/article/HashMapExample.java b/map-first-key-tutorial/src/com/baeldung/article/HashMapExample.java similarity index 100% rename from MapFirstKeyExample/src/com/baeldung/article/HashMapExample.java rename to map-first-key-tutorial/src/com/baeldung/article/HashMapExample.java diff --git a/MapFirstKeyExample/src/com/baeldung/article/LinkedHashMapExample.java b/map-first-key-tutorial/src/com/baeldung/article/LinkedHashMapExample.java similarity index 100% rename from MapFirstKeyExample/src/com/baeldung/article/LinkedHashMapExample.java rename to map-first-key-tutorial/src/com/baeldung/article/LinkedHashMapExample.java From 976862de1a42f9886e66abffd8764b501635bf3b Mon Sep 17 00:00:00 2001 From: akeshri Date: Sat, 29 Aug 2020 23:48:29 +0530 Subject: [PATCH 0602/1862] changes --- map-first-key-tutorial/README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 map-first-key-tutorial/README.md diff --git a/map-first-key-tutorial/README.md b/map-first-key-tutorial/README.md new file mode 100644 index 0000000000..13fb71643b --- /dev/null +++ b/map-first-key-tutorial/README.md @@ -0,0 +1,4 @@ +# HashMap - Getting First Key And Value +A example on how to get first key and value from HashMap. + +- JDK 1.8 and above \ No newline at end of file From 597e537bd46a8324184c9c1d203a9c5eef9bbe6e Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 29 Aug 2020 23:04:29 +0200 Subject: [PATCH 0603/1862] Java-1458 Reduce logging - jhipster5 --- jhipster-5/bookstore-monolith/pom.xml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jhipster-5/bookstore-monolith/pom.xml b/jhipster-5/bookstore-monolith/pom.xml index c965fd962d..dbc46bbb97 100644 --- a/jhipster-5/bookstore-monolith/pom.xml +++ b/jhipster-5/bookstore-monolith/pom.xml @@ -237,6 +237,26 @@ spring-boot:run + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + + set-system-properties + + + + + org.slf4j.simpleLogger.log.com.github.eirslett + error + + + + + + org.apache.maven.plugins maven-compiler-plugin From dee331897721ee8fb4921128f39e9afaf235dc24 Mon Sep 17 00:00:00 2001 From: mikr Date: Sun, 30 Aug 2020 00:05:49 +0200 Subject: [PATCH 0604/1862] Java-1456 Reduce logging modules apache-spark, spring-boot-crud maven-assembly-plugin --- apache-spark/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/apache-spark/pom.xml b/apache-spark/pom.xml index 27768d60fc..e0855155bc 100644 --- a/apache-spark/pom.xml +++ b/apache-spark/pom.xml @@ -74,6 +74,7 @@ maven-assembly-plugin + 3.3.0 package From 71b9fd959aeb0b66e513c8965993db69d70ba58c Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sun, 30 Aug 2020 14:19:34 +0530 Subject: [PATCH 0605/1862] Update ArrayStoreExceptionExample.java --- .../array/arraystoreexception/ArrayStoreExceptionExample.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExceptionExample.java b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExceptionExample.java index ab485ca867..ce63fd6605 100644 --- a/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExceptionExample.java +++ b/core-java-modules/core-java-arrays-guides/src/main/java/com/baeldung/array/arraystoreexception/ArrayStoreExceptionExample.java @@ -7,9 +7,8 @@ public class ArrayStoreExceptionExample { try { Object array[] = new String[5]; array[0] = 2; - System.out.println(array[0]); } catch (ArrayStoreException e) { - e.printStackTrace(); + // handle the exception } } From 3e89177d9b8d30c44623221050e5770af31b4f2a Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Sun, 30 Aug 2020 15:46:52 +0430 Subject: [PATCH 0606/1862] Fix the integrations tests in ribbon-client-service --- .../src/main/resources/application.yml | 1 - .../RibbonRetryFailureIntegrationTest.java | 7 +++++-- .../RibbonRetrySuccessIntegrationTest.java | 7 +++++-- .../spring/cloud/ribbon/retry/TestUtils.java | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/TestUtils.java diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/main/resources/application.yml b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/main/resources/application.yml index 29d2360793..a6f67772f2 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/main/resources/application.yml +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/main/resources/application.yml @@ -9,7 +9,6 @@ weather-service: ribbon: eureka: enabled: false - listOfServers: http://localhost:8021, http://localhost:8022 ServerListRefreshInterval: 5000 MaxAutoRetries: 3 MaxAutoRetriesNextServer: 1 diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java index 0f0a1c4255..6a4fe4bd00 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java @@ -10,6 +10,7 @@ import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.ResponseEntity; +import static com.baeldung.spring.cloud.ribbon.retry.TestUtils.setUpServices; import static org.junit.jupiter.api.Assertions.assertTrue; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RibbonClientApp.class) @@ -24,8 +25,10 @@ public class RibbonRetryFailureIntegrationTest { @BeforeAll public static void setup() { - weatherServiceInstance1 = startApp(8021); - weatherServiceInstance2 = startApp(8022); + weatherServiceInstance1 = startApp(0); + weatherServiceInstance2 = startApp(0); + + setUpServices(weatherServiceInstance1, weatherServiceInstance2); } @AfterAll diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java index 6fdad0f2a9..281f69d0bc 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java @@ -10,6 +10,7 @@ import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.ResponseEntity; +import static com.baeldung.spring.cloud.ribbon.retry.TestUtils.setUpServices; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -25,8 +26,10 @@ public class RibbonRetrySuccessIntegrationTest { @BeforeAll public static void setup() { - weatherServiceInstance1 = startApp(8021); - weatherServiceInstance2 = startApp(8022); + weatherServiceInstance1 = startApp(0); + weatherServiceInstance2 = startApp(0); + + setUpServices(weatherServiceInstance1, weatherServiceInstance2); } private static ConfigurableApplicationContext startApp(int port) { diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/TestUtils.java b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/TestUtils.java new file mode 100644 index 0000000000..67c7847cda --- /dev/null +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/TestUtils.java @@ -0,0 +1,18 @@ +package com.baeldung.spring.cloud.ribbon.retry; + +import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; + +class TestUtils { + + static int getWebAppPort(ConfigurableApplicationContext ctx) { + return ((AnnotationConfigServletWebServerApplicationContext) ctx).getWebServer().getPort(); + } + + static void setUpServices(ConfigurableApplicationContext service1, ConfigurableApplicationContext service2) { + int port1 = getWebAppPort(service1); + int port2 = getWebAppPort(service2); + String serversList = String.format("http://localhost:%d, http://localhost:%d", port1, port2); + System.setProperty("weather-service.ribbon.listOfServers", serversList); + } +} From fb36c068cd20d9b5d532e5d894d80ea0243d2823 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 30 Aug 2020 16:51:48 +0530 Subject: [PATCH 0607/1862] JAVA-33: Moved spring-katharsis to boot-2 --- spring-katharsis/pom.xml | 4 ++-- .../src/main/java/com/baeldung/Application.java | 2 +- .../persistence/katharsis/RoleResourceRepository.java | 10 +++++++--- .../persistence/katharsis/UserResourceRepository.java | 9 ++++++--- .../katharsis/UserToRoleRelationshipRepository.java | 10 ++++++---- .../src/main/resources/application.properties | 2 +- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/spring-katharsis/pom.xml b/spring-katharsis/pom.xml index 3aeaa973af..674d9a2a14 100644 --- a/spring-katharsis/pom.xml +++ b/spring-katharsis/pom.xml @@ -10,9 +10,9 @@ com.baeldung - parent-boot-1 + parent-boot-2 0.0.1-SNAPSHOT - ../parent-boot-1 + ../parent-boot-2 diff --git a/spring-katharsis/src/main/java/com/baeldung/Application.java b/spring-katharsis/src/main/java/com/baeldung/Application.java index 6c4f047b26..738afa039e 100644 --- a/spring-katharsis/src/main/java/com/baeldung/Application.java +++ b/spring-katharsis/src/main/java/com/baeldung/Application.java @@ -4,7 +4,7 @@ import io.katharsis.spring.boot.v3.KatharsisConfigV3; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.Import; @SpringBootApplication diff --git a/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/RoleResourceRepository.java b/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/RoleResourceRepository.java index c5e6326075..a249def128 100644 --- a/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/RoleResourceRepository.java +++ b/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/RoleResourceRepository.java @@ -7,6 +7,9 @@ import io.katharsis.repository.ResourceRepositoryV2; import io.katharsis.resource.list.ResourceList; import com.baeldung.persistence.model.Role; + +import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,7 +20,8 @@ public class RoleResourceRepository implements ResourceRepositoryV2 @Override public Role findOne(Long id, QuerySpec querySpec) { - return roleRepository.findOne(id); + Optional role = roleRepository.findById(id); + return role.isPresent()? role.get() : null; } @Override @@ -27,7 +31,7 @@ public class RoleResourceRepository implements ResourceRepositoryV2 @Override public ResourceList findAll(Iterable ids, QuerySpec querySpec) { - return querySpec.apply(roleRepository.findAll(ids)); + return querySpec.apply(roleRepository.findAllById(ids)); } @Override @@ -37,7 +41,7 @@ public class RoleResourceRepository implements ResourceRepositoryV2 @Override public void delete(Long id) { - roleRepository.delete(id); + roleRepository.deleteById(id); } @Override diff --git a/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/UserResourceRepository.java b/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/UserResourceRepository.java index 616431f3f0..af71da4727 100644 --- a/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/UserResourceRepository.java +++ b/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/UserResourceRepository.java @@ -6,6 +6,8 @@ import io.katharsis.queryspec.QuerySpec; import io.katharsis.repository.ResourceRepositoryV2; import io.katharsis.resource.list.ResourceList; +import java.util.Optional; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -17,7 +19,8 @@ public class UserResourceRepository implements ResourceRepositoryV2 @Override public User findOne(Long id, QuerySpec querySpec) { - return userRepository.findOne(id); + Optional user = userRepository.findById(id); + return user.isPresent()? user.get() : null; } @Override @@ -27,7 +30,7 @@ public class UserResourceRepository implements ResourceRepositoryV2 @Override public ResourceList findAll(Iterable ids, QuerySpec querySpec) { - return querySpec.apply(userRepository.findAll(ids)); + return querySpec.apply(userRepository.findAllById(ids)); } @Override @@ -37,7 +40,7 @@ public class UserResourceRepository implements ResourceRepositoryV2 @Override public void delete(Long id) { - userRepository.delete(id); + userRepository.deleteById(id); } @Override diff --git a/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/UserToRoleRelationshipRepository.java b/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/UserToRoleRelationshipRepository.java index 066292c00f..d0b4a464c9 100644 --- a/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/UserToRoleRelationshipRepository.java +++ b/spring-katharsis/src/main/java/com/baeldung/persistence/katharsis/UserToRoleRelationshipRepository.java @@ -8,6 +8,7 @@ import io.katharsis.repository.RelationshipRepositoryV2; import io.katharsis.resource.list.ResourceList; import java.util.HashSet; +import java.util.Optional; import java.util.Set; import com.baeldung.persistence.model.Role; @@ -31,7 +32,7 @@ public class UserToRoleRelationshipRepository implements RelationshipRepositoryV @Override public void setRelations(User user, Iterable roleIds, String fieldName) { final Set roles = new HashSet(); - roles.addAll(roleRepository.findAll(roleIds)); + roles.addAll(roleRepository.findAllById(roleIds)); user.setRoles(roles); userRepository.save(user); } @@ -39,7 +40,7 @@ public class UserToRoleRelationshipRepository implements RelationshipRepositoryV @Override public void addRelations(User user, Iterable roleIds, String fieldName) { final Set roles = user.getRoles(); - roles.addAll(roleRepository.findAll(roleIds)); + roles.addAll(roleRepository.findAllById(roleIds)); user.setRoles(roles); userRepository.save(user); } @@ -47,7 +48,7 @@ public class UserToRoleRelationshipRepository implements RelationshipRepositoryV @Override public void removeRelations(User user, Iterable roleIds, String fieldName) { final Set roles = user.getRoles(); - roles.removeAll(roleRepository.findAll(roleIds)); + roles.removeAll(roleRepository.findAllById(roleIds)); user.setRoles(roles); userRepository.save(user); } @@ -60,7 +61,8 @@ public class UserToRoleRelationshipRepository implements RelationshipRepositoryV @Override public ResourceList findManyTargets(Long sourceId, String fieldName, QuerySpec querySpec) { - final User user = userRepository.findOne(sourceId); + final Optional userOptional = userRepository.findById(sourceId); + User user = userOptional.isPresent() ? userOptional.get() : new User(); return querySpec.apply(user.getRoles()); } diff --git a/spring-katharsis/src/main/resources/application.properties b/spring-katharsis/src/main/resources/application.properties index 120b3c62ee..415ec1723b 100644 --- a/spring-katharsis/src/main/resources/application.properties +++ b/spring-katharsis/src/main/resources/application.properties @@ -6,7 +6,7 @@ spring.jpa.hibernate.ddl-auto = create-drop spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.H2Dialect server.port=8082 -server.context-path=/spring-katharsis +server.servlet.context-path=/spring-katharsis katharsis.domainName=http://localhost:8082/spring-katharsis katharsis.pathPrefix=/ \ No newline at end of file From 531751568cacd590d923b17d1b41940872c46da9 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Sun, 30 Aug 2020 13:23:51 +0200 Subject: [PATCH 0608/1862] Moved to new module --- .../core-kotlin-collections-2/README.md | 7 +++ .../core-kotlin-collections-2/pom.xml | 47 +++++++++++++++++++ .../AggregateOperations.kt | 2 +- .../AggregateOperationsUnitTest.kt | 2 +- core-kotlin-modules/pom.xml | 1 + 5 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 core-kotlin-modules/core-kotlin-collections-2/README.md create mode 100644 core-kotlin-modules/core-kotlin-collections-2/pom.xml rename core-kotlin-modules/{core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections => core-kotlin-collections-2/src/main/kotlin/com.baeldung.aggregate}/AggregateOperations.kt (98%) rename core-kotlin-modules/{core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections => core-kotlin-collections-2/src/test/kotlin/com.baeldung.aggregate}/AggregateOperationsUnitTest.kt (98%) diff --git a/core-kotlin-modules/core-kotlin-collections-2/README.md b/core-kotlin-modules/core-kotlin-collections-2/README.md new file mode 100644 index 0000000000..2dc180b5b3 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections-2/README.md @@ -0,0 +1,7 @@ +## Core Kotlin Collections + +This module contains articles about core Kotlin collections. + +### Relevant articles: + + diff --git a/core-kotlin-modules/core-kotlin-collections-2/pom.xml b/core-kotlin-modules/core-kotlin-collections-2/pom.xml new file mode 100644 index 0000000000..be462eed45 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections-2/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + core-kotlin-collections-2 + core-kotlin-collections-2 + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + + + 1.3.30 + 3.6.1 + 3.10.0 + + + \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt b/core-kotlin-modules/core-kotlin-collections-2/src/main/kotlin/com.baeldung.aggregate/AggregateOperations.kt similarity index 98% rename from core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt rename to core-kotlin-modules/core-kotlin-collections-2/src/main/kotlin/com.baeldung.aggregate/AggregateOperations.kt index 3a348aafaa..a09e101b59 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/AggregateOperations.kt +++ b/core-kotlin-modules/core-kotlin-collections-2/src/main/kotlin/com.baeldung.aggregate/AggregateOperations.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.collections +package com.baeldung.aggregate class AggregateOperations { private val numbers = listOf(1, 15, 3, 8) diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/AggregateOperationsUnitTest.kt b/core-kotlin-modules/core-kotlin-collections-2/src/test/kotlin/com.baeldung.aggregate/AggregateOperationsUnitTest.kt similarity index 98% rename from core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/AggregateOperationsUnitTest.kt rename to core-kotlin-modules/core-kotlin-collections-2/src/test/kotlin/com.baeldung.aggregate/AggregateOperationsUnitTest.kt index 1fb26760fc..a619759b0a 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/AggregateOperationsUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-collections-2/src/test/kotlin/com.baeldung.aggregate/AggregateOperationsUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.collections +package com.baeldung.aggregate import org.junit.jupiter.api.Test import kotlin.test.assertEquals diff --git a/core-kotlin-modules/pom.xml b/core-kotlin-modules/pom.xml index 8b626e1c1b..67520a7dee 100644 --- a/core-kotlin-modules/pom.xml +++ b/core-kotlin-modules/pom.xml @@ -21,6 +21,7 @@ core-kotlin-advanced core-kotlin-annotations core-kotlin-collections + core-kotlin-collections-2 core-kotlin-concurrency core-kotlin-date-time core-kotlin-design-patterns From d7e25cb6e99fbdb15566eb601e9a987ddcad5b29 Mon Sep 17 00:00:00 2001 From: mikr Date: Sun, 30 Aug 2020 14:35:18 +0200 Subject: [PATCH 0609/1862] Java-1462 Reduce logging - Modules core-java-io-2, spring-ejb-beans, spring-boot-security --- .../core-java-io-2/src/main/resources/logback.xml | 12 ++++++++++++ .../src/main/resources/logback.xml | 2 +- .../src/test/resources/application.properties | 2 ++ spring-ejb/ejb-beans/pom.xml | 6 ++++++ .../ejb-beans/src/test/resources/logging.properties | 2 ++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 core-java-modules/core-java-io-2/src/main/resources/logback.xml create mode 100644 spring-boot-modules/spring-boot-security/src/test/resources/application.properties create mode 100644 spring-ejb/ejb-beans/src/test/resources/logging.properties diff --git a/core-java-modules/core-java-io-2/src/main/resources/logback.xml b/core-java-modules/core-java-io-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..f46a64b3cb --- /dev/null +++ b/core-java-modules/core-java-io-2/src/main/resources/logback.xml @@ -0,0 +1,12 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + + + diff --git a/spring-boot-modules/spring-boot-security/src/main/resources/logback.xml b/spring-boot-modules/spring-boot-security/src/main/resources/logback.xml index 7d900d8ea8..73dd672c1a 100644 --- a/spring-boot-modules/spring-boot-security/src/main/resources/logback.xml +++ b/spring-boot-modules/spring-boot-security/src/main/resources/logback.xml @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-security/src/test/resources/application.properties b/spring-boot-modules/spring-boot-security/src/test/resources/application.properties new file mode 100644 index 0000000000..5494069009 --- /dev/null +++ b/spring-boot-modules/spring-boot-security/src/test/resources/application.properties @@ -0,0 +1,2 @@ +logging.level.root=ERROR +logging.level.com.baeldung.integrationtesting=ERROR diff --git a/spring-ejb/ejb-beans/pom.xml b/spring-ejb/ejb-beans/pom.xml index 299de584ef..d7f875acd0 100644 --- a/spring-ejb/ejb-beans/pom.xml +++ b/spring-ejb/ejb-beans/pom.xml @@ -131,6 +131,12 @@ always + + + java.util.logging.config.file + src/test/resources/logging.properties + + diff --git a/spring-ejb/ejb-beans/src/test/resources/logging.properties b/spring-ejb/ejb-beans/src/test/resources/logging.properties new file mode 100644 index 0000000000..0a0ecef337 --- /dev/null +++ b/spring-ejb/ejb-beans/src/test/resources/logging.properties @@ -0,0 +1,2 @@ +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = SEVERE \ No newline at end of file From 87f19ad21a6773abb6e9433122db951da3fc4771 Mon Sep 17 00:00:00 2001 From: mikr Date: Sun, 30 Aug 2020 16:54:15 +0200 Subject: [PATCH 0610/1862] Reduce logging - Modules api-gateway, spring-boot-springdoc, spring-zuul-rate-limiting, hibernate-ogm, jpa-hibernate-cascade-type --- .../hibernate-ogm/src/test/resources/logback.xml | 12 ++++++++++++ .../src/test/resources/hibernate.properties | 2 +- .../src/test/resources/logback.xml | 12 ++++++++++++ .../src/test/resources/logback.xml | 12 ++++++++++++ .../api-gateway/src/test/resources/logback.xml | 12 ++++++++++++ .../src/test/resources/application.properties | 1 + .../src/test/resources/logback.xml | 12 ++++++++++++ 7 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 persistence-modules/hibernate-ogm/src/test/resources/logback.xml create mode 100644 persistence-modules/jpa-hibernate-cascade-type/src/test/resources/logback.xml create mode 100644 spring-boot-modules/spring-boot-springdoc/src/test/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-zuul-fallback/api-gateway/src/test/resources/logback.xml create mode 100644 spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/resources/application.properties create mode 100644 spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/resources/logback.xml diff --git a/persistence-modules/hibernate-ogm/src/test/resources/logback.xml b/persistence-modules/hibernate-ogm/src/test/resources/logback.xml new file mode 100644 index 0000000000..ab4a5f3a20 --- /dev/null +++ b/persistence-modules/hibernate-ogm/src/test/resources/logback.xml @@ -0,0 +1,12 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + + + diff --git a/persistence-modules/jpa-hibernate-cascade-type/src/test/resources/hibernate.properties b/persistence-modules/jpa-hibernate-cascade-type/src/test/resources/hibernate.properties index c22da2496b..4999a0e600 100644 --- a/persistence-modules/jpa-hibernate-cascade-type/src/test/resources/hibernate.properties +++ b/persistence-modules/jpa-hibernate-cascade-type/src/test/resources/hibernate.properties @@ -5,6 +5,6 @@ hibernate.connection.autocommit=true jdbc.password= hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.show_sql=true +hibernate.show_sql=false hibernate.hbm2ddl.auto=create-drop diff --git a/persistence-modules/jpa-hibernate-cascade-type/src/test/resources/logback.xml b/persistence-modules/jpa-hibernate-cascade-type/src/test/resources/logback.xml new file mode 100644 index 0000000000..ab4a5f3a20 --- /dev/null +++ b/persistence-modules/jpa-hibernate-cascade-type/src/test/resources/logback.xml @@ -0,0 +1,12 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + + + diff --git a/spring-boot-modules/spring-boot-springdoc/src/test/resources/logback.xml b/spring-boot-modules/spring-boot-springdoc/src/test/resources/logback.xml new file mode 100644 index 0000000000..ab4a5f3a20 --- /dev/null +++ b/spring-boot-modules/spring-boot-springdoc/src/test/resources/logback.xml @@ -0,0 +1,12 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + + + diff --git a/spring-cloud/spring-cloud-zuul-fallback/api-gateway/src/test/resources/logback.xml b/spring-cloud/spring-cloud-zuul-fallback/api-gateway/src/test/resources/logback.xml new file mode 100644 index 0000000000..ab4a5f3a20 --- /dev/null +++ b/spring-cloud/spring-cloud-zuul-fallback/api-gateway/src/test/resources/logback.xml @@ -0,0 +1,12 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + + + diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/resources/application.properties b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/resources/application.properties new file mode 100644 index 0000000000..640fb2c6a4 --- /dev/null +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/resources/application.properties @@ -0,0 +1 @@ +logging.level.root=ERROR \ No newline at end of file diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/resources/logback.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/resources/logback.xml new file mode 100644 index 0000000000..ab4a5f3a20 --- /dev/null +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/src/test/resources/logback.xml @@ -0,0 +1,12 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + + + From d8d2ecc4b4962ec9811bede5c6689bb6480542a2 Mon Sep 17 00:00:00 2001 From: Meysam Tamkin Date: Sun, 30 Aug 2020 19:59:24 +0430 Subject: [PATCH 0611/1862] Add some changes --- .../BeforeAfterAllNonStaticTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAfterAllNonStaticTest.java diff --git a/testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAfterAllNonStaticTest.java b/testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAfterAllNonStaticTest.java new file mode 100644 index 0000000000..8dbe95ddf8 --- /dev/null +++ b/testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAfterAllNonStaticTest.java @@ -0,0 +1,25 @@ +package com.baeldung.junit5.nonstatic; + +import org.junit.jupiter.api.*; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class BeforeAfterAllNonStaticTest { + + String input; + Long result; + + @BeforeAll + public void setup() { + input = "77"; + } + + @AfterAll + public void teardown() { + Assertions.assertEquals(77l, result); + } + + @Test + public void testConvertStringToLong() { + result = Long.valueOf(input); + } +} From 5bcf243fdbba47e231c91dfe26b6330839c2de6f Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Mon, 31 Aug 2020 01:09:36 +0430 Subject: [PATCH 0612/1862] Revert "Fix the integrations tests in ribbon-client-service" This reverts commit 3e89177d --- .../src/main/resources/application.yml | 1 + .../RibbonRetryFailureIntegrationTest.java | 7 ++----- .../RibbonRetrySuccessIntegrationTest.java | 7 ++----- .../spring/cloud/ribbon/retry/TestUtils.java | 18 ------------------ 4 files changed, 5 insertions(+), 28 deletions(-) delete mode 100644 spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/TestUtils.java diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/main/resources/application.yml b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/main/resources/application.yml index a6f67772f2..29d2360793 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/main/resources/application.yml +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/main/resources/application.yml @@ -9,6 +9,7 @@ weather-service: ribbon: eureka: enabled: false + listOfServers: http://localhost:8021, http://localhost:8022 ServerListRefreshInterval: 5000 MaxAutoRetries: 3 MaxAutoRetriesNextServer: 1 diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java index 6a4fe4bd00..0f0a1c4255 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java @@ -10,7 +10,6 @@ import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.ResponseEntity; -import static com.baeldung.spring.cloud.ribbon.retry.TestUtils.setUpServices; import static org.junit.jupiter.api.Assertions.assertTrue; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RibbonClientApp.class) @@ -25,10 +24,8 @@ public class RibbonRetryFailureIntegrationTest { @BeforeAll public static void setup() { - weatherServiceInstance1 = startApp(0); - weatherServiceInstance2 = startApp(0); - - setUpServices(weatherServiceInstance1, weatherServiceInstance2); + weatherServiceInstance1 = startApp(8021); + weatherServiceInstance2 = startApp(8022); } @AfterAll diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java index 281f69d0bc..6fdad0f2a9 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java @@ -10,7 +10,6 @@ import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.http.ResponseEntity; -import static com.baeldung.spring.cloud.ribbon.retry.TestUtils.setUpServices; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -26,10 +25,8 @@ public class RibbonRetrySuccessIntegrationTest { @BeforeAll public static void setup() { - weatherServiceInstance1 = startApp(0); - weatherServiceInstance2 = startApp(0); - - setUpServices(weatherServiceInstance1, weatherServiceInstance2); + weatherServiceInstance1 = startApp(8021); + weatherServiceInstance2 = startApp(8022); } private static ConfigurableApplicationContext startApp(int port) { diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/TestUtils.java b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/TestUtils.java deleted file mode 100644 index 67c7847cda..0000000000 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/TestUtils.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.spring.cloud.ribbon.retry; - -import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext; -import org.springframework.context.ConfigurableApplicationContext; - -class TestUtils { - - static int getWebAppPort(ConfigurableApplicationContext ctx) { - return ((AnnotationConfigServletWebServerApplicationContext) ctx).getWebServer().getPort(); - } - - static void setUpServices(ConfigurableApplicationContext service1, ConfigurableApplicationContext service2) { - int port1 = getWebAppPort(service1); - int port2 = getWebAppPort(service2); - String serversList = String.format("http://localhost:%d, http://localhost:%d", port1, port2); - System.setProperty("weather-service.ribbon.listOfServers", serversList); - } -} From 5d7035cb19d39878422bda82e1c3b6b545024ec1 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Mon, 31 Aug 2020 01:25:37 +0430 Subject: [PATCH 0613/1862] Running two tests sequentially. --- spring-cloud/spring-cloud-ribbon-retry/pom.xml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spring-cloud/spring-cloud-ribbon-retry/pom.xml b/spring-cloud/spring-cloud-ribbon-retry/pom.xml index 5318ea6913..27037d6710 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-retry/pom.xml @@ -33,8 +33,20 @@ + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + 0 + + + + + Hoxton.SR3 - \ No newline at end of file From e0ebf5904faccb404a7e3bc6d8b4eb614b3dc880 Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Mon, 31 Aug 2020 20:41:47 +0530 Subject: [PATCH 0614/1862] JAVA-84: Move articles out of spring-boot part 1 (#9950) * JAVA-84: Moved 1 article to spring-boot-actuator * JAVA-84: Moved 2 articles to spring-boot-mvc * JAVA-84: README changes for spring-boot module * JAVA-84: Moved classes to com.baeldung pkg to correct compilation issue --- .../{README.MD => README.md} | 1 + .../spring-boot-actuator/pom.xml | 8 ++ .../baeldung/endpoints/info/Application.java | 13 ++++ .../info/TotalUsersInfoContributor.java | 1 - .../com/baeldung/endpoints/info/User.java | 49 ++++++++++++ .../endpoints/info/UserRepository.java | 78 +++++++++++++++++++ .../src/main/resources/application.properties | 8 +- spring-boot-modules/spring-boot-mvc/README.md | 2 + .../SpringBootAnnotatedApp.java | 0 .../SpringBootPlainApp.java | 0 .../components/AttrListener.java | 0 .../components/EchoServlet.java | 0 .../components/HelloFilter.java | 0 .../components/HelloServlet.java | 0 .../InternationalizationApp.java | 0 .../config/MvcConfig.java | 0 .../config/PageController.java | 2 +- .../src/main/resources/messages.properties | 6 +- .../src/main/resources/messages_fr.properties | 6 +- .../resources/static/internationalization.js | 0 .../templates/thymeleaf}/international.html | 0 .../baeldung/SpringContextLiveTest.java | 0 .../baeldung/SpringContextTest.java | 0 ...otWithServletComponentIntegrationTest.java | 26 +++---- ...ithoutServletComponentIntegrationTest.java | 0 spring-boot-modules/spring-boot/README.md | 3 - .../src/main/resources/application.properties | 6 -- .../src/main/resources/messages.properties | 4 - .../src/main/resources/messages_fr.properties | 4 - 29 files changed, 181 insertions(+), 36 deletions(-) rename spring-boot-modules/spring-boot-actuator/{README.MD => README.md} (72%) create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/Application.java rename spring-boot-modules/{spring-boot => spring-boot-actuator}/src/main/java/com/baeldung/endpoints/info/TotalUsersInfoContributor.java (94%) create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/User.java create mode 100644 spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/UserRepository.java rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/internationalization/InternationalizationApp.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/internationalization/config/MvcConfig.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/java/com/baeldung/internationalization/config/PageController.java (87%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/main/resources/static/internationalization.js (100%) rename spring-boot-modules/{spring-boot/src/main/resources/templates => spring-boot-mvc/src/main/resources/templates/thymeleaf}/international.html (100%) rename spring-boot-modules/spring-boot-mvc/src/test/java/{org => com}/baeldung/SpringContextLiveTest.java (100%) rename spring-boot-modules/spring-boot-mvc/src/test/java/{org => com}/baeldung/SpringContextTest.java (100%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java (94%) rename spring-boot-modules/{spring-boot => spring-boot-mvc}/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java (100%) delete mode 100644 spring-boot-modules/spring-boot/src/main/resources/messages.properties delete mode 100644 spring-boot-modules/spring-boot/src/main/resources/messages_fr.properties diff --git a/spring-boot-modules/spring-boot-actuator/README.MD b/spring-boot-modules/spring-boot-actuator/README.md similarity index 72% rename from spring-boot-modules/spring-boot-actuator/README.MD rename to spring-boot-modules/spring-boot-actuator/README.md index fbb4dfba0f..6f31ee4a5e 100644 --- a/spring-boot-modules/spring-boot-actuator/README.MD +++ b/spring-boot-modules/spring-boot-actuator/README.md @@ -8,3 +8,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: - [Liveness and Readiness Probes in Spring Boot](https://www.baeldung.com/spring-liveness-readiness-probes) +- [Custom Information in Spring Boot Info Endpoint](https://www.baeldung.com/spring-boot-info-actuator-custom) diff --git a/spring-boot-modules/spring-boot-actuator/pom.xml b/spring-boot-modules/spring-boot-actuator/pom.xml index 701949519e..18da6d3a9a 100644 --- a/spring-boot-modules/spring-boot-actuator/pom.xml +++ b/spring-boot-modules/spring-boot-actuator/pom.xml @@ -24,6 +24,14 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + org.springframework.boot diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/Application.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/Application.java new file mode 100644 index 0000000000..75a7182b3c --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/Application.java @@ -0,0 +1,13 @@ +package com.baeldung.endpoints.info; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/endpoints/info/TotalUsersInfoContributor.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/TotalUsersInfoContributor.java similarity index 94% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/endpoints/info/TotalUsersInfoContributor.java rename to spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/TotalUsersInfoContributor.java index c316cabda5..a685660b4f 100644 --- a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/endpoints/info/TotalUsersInfoContributor.java +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/TotalUsersInfoContributor.java @@ -3,7 +3,6 @@ package com.baeldung.endpoints.info; import java.util.HashMap; import java.util.Map; -import com.baeldung.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.info.Info; import org.springframework.boot.actuate.info.InfoContributor; diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/User.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/User.java new file mode 100644 index 0000000000..db4e69127a --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/User.java @@ -0,0 +1,49 @@ +package com.baeldung.endpoints.info; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "users") +public class User { + + @Id + @GeneratedValue + private Integer id; + private String name; + private Integer status; + + public User() { + } + + public User(String name, Integer status) { + this.name = name; + this.status = status; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } +} diff --git a/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/UserRepository.java b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/UserRepository.java new file mode 100644 index 0000000000..8af5ef3988 --- /dev/null +++ b/spring-boot-modules/spring-boot-actuator/src/main/java/com/baeldung/endpoints/info/UserRepository.java @@ -0,0 +1,78 @@ +package com.baeldung.endpoints.info; + +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Repository; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +@Repository("userRepository") +public interface UserRepository extends JpaRepository { + + int countByStatus(int status); + + Optional findOneByName(String name); + + @Async + CompletableFuture findOneByStatus(Integer status); + + @Query("SELECT u FROM User u WHERE u.status = 1") + Collection findAllActiveUsers(); + + @Query(value = "SELECT * FROM USERS u WHERE u.status = 1", nativeQuery = true) + Collection findAllActiveUsersNative(); + + @Query("SELECT u FROM User u WHERE u.status = ?1") + User findUserByStatus(Integer status); + + @Query(value = "SELECT * FROM Users u WHERE u.status = ?1", nativeQuery = true) + User findUserByStatusNative(Integer status); + + @Query("SELECT u FROM User u WHERE u.status = ?1 and u.name = ?2") + User findUserByStatusAndName(Integer status, String name); + + @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") + User findUserByStatusAndNameNamedParams(@Param("status") Integer status, @Param("name") String name); + + @Query(value = "SELECT * FROM Users u WHERE u.status = :status AND u.name = :name", nativeQuery = true) + User findUserByStatusAndNameNamedParamsNative(@Param("status") Integer status, @Param("name") String name); + + @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") + User findUserByUserStatusAndUserName(@Param("status") Integer userStatus, @Param("name") String userName); + + @Query("SELECT u FROM User u WHERE u.name like ?1%") + User findUserByNameLike(String name); + + @Query("SELECT u FROM User u WHERE u.name like :name%") + User findUserByNameLikeNamedParam(@Param("name") String name); + + @Query(value = "SELECT * FROM users u WHERE u.name LIKE ?1%", nativeQuery = true) + User findUserByNameLikeNative(String name); + + @Query(value = "SELECT u FROM User u") + List findAllUsers(Sort sort); + + @Query(value = "SELECT u FROM User u ORDER BY id") + Page findAllUsersWithPagination(Pageable pageable); + + @Query(value = "SELECT * FROM Users ORDER BY id \n-- #pageable\n", countQuery = "SELECT count(*) FROM Users", nativeQuery = true) + Page findAllUsersWithPaginationNative(Pageable pageable); + + @Modifying + @Query("update User u set u.status = :status where u.name = :name") + int updateUserSetStatusForName(@Param("status") Integer status, @Param("name") String name); + + @Modifying + @Query(value = "UPDATE Users u SET u.status = ? WHERE u.name = ?", nativeQuery = true) + int updateUserSetStatusForNameNative(Integer status, String name); + +} diff --git a/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties b/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties index 27dba985b8..00100d6d97 100644 --- a/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-actuator/src/main/resources/application.properties @@ -2,4 +2,10 @@ management.health.probes.enabled=true management.endpoint.health.show-details=always management.endpoint.health.status.http-mapping.down=500 management.endpoint.health.status.http-mapping.out_of_service=503 -management.endpoint.health.status.http-mapping.warning=500 \ No newline at end of file +management.endpoint.health.status.http-mapping.warning=500 + +## Configuring info endpoint +info.app.name=Spring Sample Application +info.app.description=This is my first spring boot application G1 +info.app.version=1.0.0 +info.java-vendor = ${java.specification.vendor} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc/README.md b/spring-boot-modules/spring-boot-mvc/README.md index 41b98063a6..5e9ecded10 100644 --- a/spring-boot-modules/spring-boot-mvc/README.md +++ b/spring-boot-modules/spring-boot-mvc/README.md @@ -9,4 +9,6 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [A Controller, Service and DAO Example with Spring Boot and JSF](https://www.baeldung.com/jsf-spring-boot-controller-service-dao) - [Setting Up Swagger 2 with a Spring REST API](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) - [Using Spring ResponseEntity to Manipulate the HTTP Response](https://www.baeldung.com/spring-response-entity) +- [The @ServletComponentScan Annotation in Spring Boot](https://www.baeldung.com/spring-servletcomponentscan) +- [Guide to Internationalization in Spring Boot](https://www.baeldung.com/spring-boot-internationalization) - More articles: [[next -->]](/spring-boot-modules/spring-boot-mvc-2) diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootAnnotatedApp.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/SpringBootPlainApp.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/components/AttrListener.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/components/EchoServlet.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloFilter.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/annotation/servletcomponentscan/components/HelloServlet.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/internationalization/InternationalizationApp.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/internationalization/InternationalizationApp.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/internationalization/InternationalizationApp.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/internationalization/config/MvcConfig.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/internationalization/config/MvcConfig.java similarity index 100% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/internationalization/config/MvcConfig.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/internationalization/config/MvcConfig.java diff --git a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/internationalization/config/PageController.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/internationalization/config/PageController.java similarity index 87% rename from spring-boot-modules/spring-boot/src/main/java/com/baeldung/internationalization/config/PageController.java rename to spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/internationalization/config/PageController.java index 96a534b853..efa55b8b33 100644 --- a/spring-boot-modules/spring-boot/src/main/java/com/baeldung/internationalization/config/PageController.java +++ b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/internationalization/config/PageController.java @@ -8,7 +8,7 @@ public class PageController { @GetMapping("/international") public String getInternationalPage() { - return "international"; + return "thymeleaf/international"; } } diff --git a/spring-boot-modules/spring-boot-mvc/src/main/resources/messages.properties b/spring-boot-modules/spring-boot-mvc/src/main/resources/messages.properties index 9794c89651..8f956fe5be 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/resources/messages.properties +++ b/spring-boot-modules/spring-boot-mvc/src/main/resources/messages.properties @@ -1 +1,5 @@ -email.notempty=Please provide valid email id. \ No newline at end of file +email.notempty=Please provide valid email id. +greeting=Hello! Welcome to our website! +lang.change=Change the language +lang.eng=English +lang.fr=French \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc/src/main/resources/messages_fr.properties b/spring-boot-modules/spring-boot-mvc/src/main/resources/messages_fr.properties index 070f4e0bfc..7ced0d7b0d 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/resources/messages_fr.properties +++ b/spring-boot-modules/spring-boot-mvc/src/main/resources/messages_fr.properties @@ -1 +1,5 @@ -email.notempty=Veuillez fournir un identifiant de messagerie valide. \ No newline at end of file +email.notempty=Veuillez fournir un identifiant de messagerie valide. +greeting=Bonjour! Bienvenue sur notre site! +lang.change=Changez la langue +lang.eng=Anglais +lang.fr=Francais diff --git a/spring-boot-modules/spring-boot/src/main/resources/static/internationalization.js b/spring-boot-modules/spring-boot-mvc/src/main/resources/static/internationalization.js similarity index 100% rename from spring-boot-modules/spring-boot/src/main/resources/static/internationalization.js rename to spring-boot-modules/spring-boot-mvc/src/main/resources/static/internationalization.js diff --git a/spring-boot-modules/spring-boot/src/main/resources/templates/international.html b/spring-boot-modules/spring-boot-mvc/src/main/resources/templates/thymeleaf/international.html similarity index 100% rename from spring-boot-modules/spring-boot/src/main/resources/templates/international.html rename to spring-boot-modules/spring-boot-mvc/src/main/resources/templates/thymeleaf/international.html diff --git a/spring-boot-modules/spring-boot-mvc/src/test/java/org/baeldung/SpringContextLiveTest.java b/spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/SpringContextLiveTest.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/test/java/org/baeldung/SpringContextLiveTest.java rename to spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/SpringContextLiveTest.java diff --git a/spring-boot-modules/spring-boot-mvc/src/test/java/org/baeldung/SpringContextTest.java b/spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-boot-modules/spring-boot-mvc/src/test/java/org/baeldung/SpringContextTest.java rename to spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java b/spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java similarity index 94% rename from spring-boot-modules/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java rename to spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java index 8c85934fac..92223892d9 100644 --- a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java +++ b/spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java @@ -1,23 +1,21 @@ package com.baeldung.annotation.servletcomponentscan; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit4.SpringRunner; - -import javax.servlet.FilterRegistration; -import javax.servlet.ServletContext; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import javax.servlet.FilterRegistration; +import javax.servlet.ServletContext; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; + @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootAnnotatedApp.class) public class SpringBootWithServletComponentIntegrationTest { diff --git a/spring-boot-modules/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java b/spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java similarity index 100% rename from spring-boot-modules/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java rename to spring-boot-modules/spring-boot-mvc/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java diff --git a/spring-boot-modules/spring-boot/README.md b/spring-boot-modules/spring-boot/README.md index 510864e339..5a45502fd8 100644 --- a/spring-boot-modules/spring-boot/README.md +++ b/spring-boot-modules/spring-boot/README.md @@ -8,12 +8,9 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: - [A Guide to Spring in Eclipse STS](https://www.baeldung.com/eclipse-sts-spring) -- [The @ServletComponentScan Annotation in Spring Boot](https://www.baeldung.com/spring-servletcomponentscan) - [How to Register a Servlet in Java](https://www.baeldung.com/register-servlet) - [Guide to Spring WebUtils and ServletRequestUtils](https://www.baeldung.com/spring-webutils-servletrequestutils) -- [Guide to Internationalization in Spring Boot](https://www.baeldung.com/spring-boot-internationalization) - [Dynamic DTO Validation Config Retrieved from the Database](https://www.baeldung.com/spring-dynamic-dto-validation) -- [Custom Information in Spring Boot Info Endpoint](https://www.baeldung.com/spring-boot-info-actuator-custom) - [Guide to Spring Type Conversions](https://www.baeldung.com/spring-type-conversions) - [Spring Boot: Configuring a Main Class](https://www.baeldung.com/spring-boot-main-class) - [A Quick Intro to the SpringBootServletInitializer](https://www.baeldung.com/spring-boot-servlet-initializer) diff --git a/spring-boot-modules/spring-boot/src/main/resources/application.properties b/spring-boot-modules/spring-boot/src/main/resources/application.properties index 44649fc1c0..142e6c8e6f 100644 --- a/spring-boot-modules/spring-boot/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot/src/main/resources/application.properties @@ -21,12 +21,6 @@ spring.jmx.enabled=true ## for pretty printing of json when endpoints accessed over HTTP http.mappers.jsonPrettyPrint=true -## Configuring info endpoint -info.app.name=Spring Sample Application -info.app.description=This is my first spring boot application G1 -info.app.version=1.0.0 -info.java-vendor = ${java.specification.vendor} - logging.level.org.springframework=INFO #Servlet Configuration diff --git a/spring-boot-modules/spring-boot/src/main/resources/messages.properties b/spring-boot-modules/spring-boot/src/main/resources/messages.properties deleted file mode 100644 index e4dbc44c3f..0000000000 --- a/spring-boot-modules/spring-boot/src/main/resources/messages.properties +++ /dev/null @@ -1,4 +0,0 @@ -greeting=Hello! Welcome to our website! -lang.change=Change the language -lang.eng=English -lang.fr=French \ No newline at end of file diff --git a/spring-boot-modules/spring-boot/src/main/resources/messages_fr.properties b/spring-boot-modules/spring-boot/src/main/resources/messages_fr.properties deleted file mode 100644 index ac5853717d..0000000000 --- a/spring-boot-modules/spring-boot/src/main/resources/messages_fr.properties +++ /dev/null @@ -1,4 +0,0 @@ -greeting=Bonjour! Bienvenue sur notre site! -lang.change=Changez la langue -lang.eng=Anglais -lang.fr=Francais \ No newline at end of file From 25b174930886c60d9b7e9b6a0003b1be4d906aed Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Mon, 31 Aug 2020 20:13:13 +0430 Subject: [PATCH 0615/1862] BAEL-4530: A Guide to @DynamicPropertySource in Spring (#9877) * A Guide to @DynamicPropertySource in Spring * Moving to a new module * Reverting the Changes in the original module --- testing-modules/pom.xml | 3 +- testing-modules/spring-testing-2/.gitignore | 3 + testing-modules/spring-testing-2/README.md | 1 + testing-modules/spring-testing-2/pom.xml | 57 +++++++++++++++++++ .../baeldung/dynamicproperties/Article.java | 45 +++++++++++++++ .../dynamicproperties/ArticleRepository.java | 6 ++ .../DynamicPropertiesApplication.java | 12 ++++ .../dynamicproperties/ArticleLiveTest.java | 50 ++++++++++++++++ .../ArticleTestFixtureLiveTest.java | 31 ++++++++++ .../ArticleTraditionalLiveTest.java | 57 +++++++++++++++++++ .../PostgreSQLExtension.java | 31 ++++++++++ .../test/resources/application-pg.properties | 2 + 12 files changed, 297 insertions(+), 1 deletion(-) create mode 100644 testing-modules/spring-testing-2/.gitignore create mode 100644 testing-modules/spring-testing-2/README.md create mode 100644 testing-modules/spring-testing-2/pom.xml create mode 100644 testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/Article.java create mode 100644 testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/ArticleRepository.java create mode 100644 testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/DynamicPropertiesApplication.java create mode 100644 testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleLiveTest.java create mode 100644 testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleTestFixtureLiveTest.java create mode 100644 testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleTraditionalLiveTest.java create mode 100644 testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/PostgreSQLExtension.java create mode 100644 testing-modules/spring-testing-2/src/test/resources/application-pg.properties diff --git a/testing-modules/pom.xml b/testing-modules/pom.xml index b467b3c503..f1d30cd7a1 100644 --- a/testing-modules/pom.xml +++ b/testing-modules/pom.xml @@ -31,7 +31,8 @@ rest-assured rest-testing selenium-junit-testng - spring-testing + spring-testing + spring-testing-2 test-containers testing-assertions testng diff --git a/testing-modules/spring-testing-2/.gitignore b/testing-modules/spring-testing-2/.gitignore new file mode 100644 index 0000000000..ffc5bf3bad --- /dev/null +++ b/testing-modules/spring-testing-2/.gitignore @@ -0,0 +1,3 @@ +.idea/** +target/** +*.iml \ No newline at end of file diff --git a/testing-modules/spring-testing-2/README.md b/testing-modules/spring-testing-2/README.md new file mode 100644 index 0000000000..729105e3fd --- /dev/null +++ b/testing-modules/spring-testing-2/README.md @@ -0,0 +1 @@ +## Relevant Articles: diff --git a/testing-modules/spring-testing-2/pom.xml b/testing-modules/spring-testing-2/pom.xml new file mode 100644 index 0000000000..c7ca2804fb --- /dev/null +++ b/testing-modules/spring-testing-2/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + spring-testing-2 + 0.1-SNAPSHOT + spring-testing-2 + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.postgresql + postgresql + runtime + + + + + org.testcontainers + postgresql + ${testcontainers.version} + test + + + org.testcontainers + junit-jupiter + ${testcontainers.version} + test + + + + + + 2.1.9.RELEASE + 2.1.9.RELEASE + 1.12.2 + + \ No newline at end of file diff --git a/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/Article.java b/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/Article.java new file mode 100644 index 0000000000..6b6bfb7bd6 --- /dev/null +++ b/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/Article.java @@ -0,0 +1,45 @@ +package com.baeldung.dynamicproperties; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +import static javax.persistence.GenerationType.IDENTITY; + +@Entity +@Table(name = "articles") +public class Article { + + @Id + @GeneratedValue(strategy = IDENTITY) + private Long id; + + private String title; + + private String content; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } +} diff --git a/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/ArticleRepository.java b/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/ArticleRepository.java new file mode 100644 index 0000000000..3f3731f6dc --- /dev/null +++ b/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/ArticleRepository.java @@ -0,0 +1,6 @@ +package com.baeldung.dynamicproperties; + +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ArticleRepository extends JpaRepository { +} diff --git a/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/DynamicPropertiesApplication.java b/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/DynamicPropertiesApplication.java new file mode 100644 index 0000000000..d64bd965fc --- /dev/null +++ b/testing-modules/spring-testing-2/src/main/java/com/baeldung/dynamicproperties/DynamicPropertiesApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.dynamicproperties; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DynamicPropertiesApplication { + + public static void main(String[] args) { + SpringApplication.run(DynamicPropertiesApplication.class, args); + } +} diff --git a/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleLiveTest.java b/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleLiveTest.java new file mode 100644 index 0000000000..74c31229bd --- /dev/null +++ b/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleLiveTest.java @@ -0,0 +1,50 @@ +package com.baeldung.dynamicproperties; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest +@Testcontainers +@ActiveProfiles("pg") +public class ArticleLiveTest { + + @Container + static PostgreSQLContainer postgres = new PostgreSQLContainer<>("postgres:11") + .withDatabaseName("prop") + .withUsername("postgres") + .withPassword("pass") + .withExposedPorts(5432); + + @Autowired + private ArticleRepository articleRepository; + + @DynamicPropertySource + static void registerPgProperties(DynamicPropertyRegistry registry) { + registry.add("spring.datasource.url", + () -> String.format("jdbc:postgresql://localhost:%d/prop", postgres.getFirstMappedPort())); + registry.add("spring.datasource.username", () -> "postgres"); + registry.add("spring.datasource.password", () -> "pass"); + } + + @Test + void givenAnArticle_whenPersisted_thenCanBeFoundInTheDb() { + Article article = new Article(); + article.setTitle("A Guide to @DynamicPropertySource in Spring"); + article.setContent("Today's applications..."); + + articleRepository.save(article); + Article persisted = articleRepository.findAll().get(0); + assertThat(persisted.getId()).isNotNull(); + assertThat(persisted.getTitle()).isEqualTo("A Guide to @DynamicPropertySource in Spring"); + assertThat(persisted.getContent()).isEqualTo("Today's applications..."); + } +} diff --git a/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleTestFixtureLiveTest.java b/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleTestFixtureLiveTest.java new file mode 100644 index 0000000000..bb3ad28365 --- /dev/null +++ b/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleTestFixtureLiveTest.java @@ -0,0 +1,31 @@ +package com.baeldung.dynamicproperties; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest +@ActiveProfiles("pg") +@ExtendWith(PostgreSQLExtension.class) +public class ArticleTestFixtureLiveTest { + + @Autowired + private ArticleRepository articleRepository; + + @Test + void givenAnArticle_whenPersisted_thenShouldBeAbleToReadIt() { + Article article = new Article(); + article.setTitle("A Guide to @DynamicPropertySource in Spring"); + article.setContent("Today's applications..."); + + articleRepository.save(article); + Article persisted = articleRepository.findAll().get(0); + assertThat(persisted.getId()).isNotNull(); + assertThat(persisted.getTitle()).isEqualTo("A Guide to @DynamicPropertySource in Spring"); + assertThat(persisted.getContent()).isEqualTo("Today's applications..."); + } +} diff --git a/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleTraditionalLiveTest.java b/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleTraditionalLiveTest.java new file mode 100644 index 0000000000..87234505a9 --- /dev/null +++ b/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/ArticleTraditionalLiveTest.java @@ -0,0 +1,57 @@ +package com.baeldung.dynamicproperties; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.context.ApplicationContextInitializer; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; + +import static org.assertj.core.api.Assertions.assertThat; + +@SpringBootTest +@Testcontainers +@ActiveProfiles("pg") +@ContextConfiguration(initializers = ArticleTraditionalLiveTest.EnvInitializer.class) +class ArticleTraditionalLiveTest { + + @Container + static PostgreSQLContainer postgres = new PostgreSQLContainer<>("postgres:11") + .withDatabaseName("prop") + .withUsername("postgres") + .withPassword("pass") + .withExposedPorts(5432); + + static class EnvInitializer implements ApplicationContextInitializer { + + @Override + public void initialize(ConfigurableApplicationContext applicationContext) { + TestPropertyValues.of( + String.format("spring.datasource.url=jdbc:postgresql://localhost:%d/prop", postgres.getFirstMappedPort()), + "spring.datasource.username=postgres", + "spring.datasource.password=pass" + ).applyTo(applicationContext); + } + } + + @Autowired + private ArticleRepository articleRepository; + + @Test + void givenAnArticle_whenPersisted_thenShouldBeAbleToReadIt() { + Article article = new Article(); + article.setTitle("A Guide to @DynamicPropertySource in Spring"); + article.setContent("Today's applications..."); + + articleRepository.save(article); + Article persisted = articleRepository.findAll().get(0); + assertThat(persisted.getId()).isNotNull(); + assertThat(persisted.getTitle()).isEqualTo("A Guide to @DynamicPropertySource in Spring"); + assertThat(persisted.getContent()).isEqualTo("Today's applications..."); + } +} diff --git a/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/PostgreSQLExtension.java b/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/PostgreSQLExtension.java new file mode 100644 index 0000000000..8c08ad67d7 --- /dev/null +++ b/testing-modules/spring-testing-2/src/test/java/com/baeldung/dynamicproperties/PostgreSQLExtension.java @@ -0,0 +1,31 @@ +package com.baeldung.dynamicproperties; + +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.testcontainers.containers.PostgreSQLContainer; + +public class PostgreSQLExtension implements BeforeAllCallback, AfterAllCallback { + + private PostgreSQLContainer postgres; + + @Override + public void beforeAll(ExtensionContext context) { + postgres = new PostgreSQLContainer<>("postgres:11") + .withDatabaseName("prop") + .withUsername("postgres") + .withPassword("pass") + .withExposedPorts(5432); + + postgres.start(); + String jdbcUrl = String.format("jdbc:postgresql://localhost:%d/prop", postgres.getFirstMappedPort()); + System.setProperty("spring.datasource.url", jdbcUrl); + System.setProperty("spring.datasource.username", "postgres"); + System.setProperty("spring.datasource.password", "pass"); + } + + @Override + public void afterAll(ExtensionContext context) { + postgres.stop(); + } +} diff --git a/testing-modules/spring-testing-2/src/test/resources/application-pg.properties b/testing-modules/spring-testing-2/src/test/resources/application-pg.properties new file mode 100644 index 0000000000..cb7bff1889 --- /dev/null +++ b/testing-modules/spring-testing-2/src/test/resources/application-pg.properties @@ -0,0 +1,2 @@ +spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect +spring.jpa.hibernate.ddl-auto=create-drop \ No newline at end of file From d4d7059add4837bc0b88e750a52cb09d1d447429 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 31 Aug 2020 10:34:01 -0600 Subject: [PATCH 0616/1862] Update BlogController.java Update formatting --- .../main/java/com/baeldung/thymeleaf/blog/BlogController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogController.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogController.java index eee2d26409..dfcfdc1117 100644 --- a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogController.java +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/blog/BlogController.java @@ -10,8 +10,7 @@ import java.util.Random; public class BlogController { @GetMapping("/blog/new") - public String newBlogPost(Model model) - { + public String newBlogPost(Model model) { // Set a random ID so we can see it in the HTML form BlogDTO blog = new BlogDTO(); blog.setBlogId(Math.abs(new Random().nextLong() % 1000000)); From d237c52a1f677b0cac7f59ca71bd0fa7a9ff6c95 Mon Sep 17 00:00:00 2001 From: Maiklins Date: Mon, 31 Aug 2020 19:41:46 +0200 Subject: [PATCH 0617/1862] Java-75 update intro to reactor core (#9953) * Java-75 Update intro to Reactor Core * Java-75 Create package for introduction * Java-75 Update reactor version and align unit test with article Co-authored-by: mikr --- reactor-core/pom.xml | 2 +- .../{ => introduction}/ReactorIntegrationTest.java | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) rename reactor-core/src/test/java/com/baeldung/reactor/{ => introduction}/ReactorIntegrationTest.java (91%) diff --git a/reactor-core/pom.xml b/reactor-core/pom.xml index c9917d14df..317cbde6e2 100644 --- a/reactor-core/pom.xml +++ b/reactor-core/pom.xml @@ -34,7 +34,7 @@ - 3.2.6.RELEASE + 3.3.9.RELEASE 3.6.1 diff --git a/reactor-core/src/test/java/com/baeldung/reactor/ReactorIntegrationTest.java b/reactor-core/src/test/java/com/baeldung/reactor/introduction/ReactorIntegrationTest.java similarity index 91% rename from reactor-core/src/test/java/com/baeldung/reactor/ReactorIntegrationTest.java rename to reactor-core/src/test/java/com/baeldung/reactor/introduction/ReactorIntegrationTest.java index e3060b8e02..a1acffac91 100644 --- a/reactor-core/src/test/java/com/baeldung/reactor/ReactorIntegrationTest.java +++ b/reactor-core/src/test/java/com/baeldung/reactor/introduction/ReactorIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.reactor; +package com.baeldung.reactor.introduction; import org.junit.Test; import org.reactivestreams.Subscriber; @@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class ReactorIntegrationTest { @Test - public void givenFlux_whenSubscribing_thenStream() throws InterruptedException { + public void givenFlux_whenSubscribing_thenStream() { List elements = new ArrayList<>(); @@ -48,14 +48,12 @@ public class ReactorIntegrationTest { } @Test - public void givenFlux_whenApplyingBackPressure_thenPushElementsInBatches() throws InterruptedException { + public void givenFlux_whenApplyingBackPressure_thenPushElementsInBatches() { List elements = new ArrayList<>(); Flux.just(1, 2, 3, 4) .log() - .map(i -> i * 2) - .onBackpressureBuffer() .subscribe(new Subscriber() { private Subscription s; int onNextAmount; @@ -81,11 +79,10 @@ public class ReactorIntegrationTest { @Override public void onComplete() { - int ham = 2; } }); - assertThat(elements).containsExactly(2, 4, 6, 8); + assertThat(elements).containsExactly(1, 2, 3, 4); } @Test From c6d95556171005b68cc4a6194de97de2cb5406ff Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Mon, 31 Aug 2020 20:38:06 +0200 Subject: [PATCH 0618/1862] Refactored package --- .../baeldung/aggregate}/AggregateOperations.kt | 0 .../baeldung/aggregate}/AggregateOperationsUnitTest.kt | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename core-kotlin-modules/core-kotlin-collections-2/src/main/kotlin/{com.baeldung.aggregate => com/baeldung/aggregate}/AggregateOperations.kt (100%) rename core-kotlin-modules/core-kotlin-collections-2/src/test/kotlin/{com.baeldung.aggregate => com/baeldung/aggregate}/AggregateOperationsUnitTest.kt (100%) diff --git a/core-kotlin-modules/core-kotlin-collections-2/src/main/kotlin/com.baeldung.aggregate/AggregateOperations.kt b/core-kotlin-modules/core-kotlin-collections-2/src/main/kotlin/com/baeldung/aggregate/AggregateOperations.kt similarity index 100% rename from core-kotlin-modules/core-kotlin-collections-2/src/main/kotlin/com.baeldung.aggregate/AggregateOperations.kt rename to core-kotlin-modules/core-kotlin-collections-2/src/main/kotlin/com/baeldung/aggregate/AggregateOperations.kt diff --git a/core-kotlin-modules/core-kotlin-collections-2/src/test/kotlin/com.baeldung.aggregate/AggregateOperationsUnitTest.kt b/core-kotlin-modules/core-kotlin-collections-2/src/test/kotlin/com/baeldung/aggregate/AggregateOperationsUnitTest.kt similarity index 100% rename from core-kotlin-modules/core-kotlin-collections-2/src/test/kotlin/com.baeldung.aggregate/AggregateOperationsUnitTest.kt rename to core-kotlin-modules/core-kotlin-collections-2/src/test/kotlin/com/baeldung/aggregate/AggregateOperationsUnitTest.kt From 661027c771768e0d7d1da95d9e893bb8ae41d746 Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Mon, 31 Aug 2020 13:42:50 -0500 Subject: [PATCH 0619/1862] Added code examples for BAEL-4534 --- .../CheckClassExistenceUnitTest.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java new file mode 100644 index 0000000000..10402af970 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.checkclassexistence; + +import org.junit.Test; + +public class CheckClassExistenceUnitTest { + + public static class InitializingClass { + static { + if (true) //enable throwing of an exception in a static initialization block + throw new RuntimeException(); + } + } + + @Test(expected = ClassNotFoundException.class) //thrown when class does not exist + public void givenNonExistingClass_whenUsingForName_classNotFound() throws ClassNotFoundException { + Class.forName("class.that.does.not.exist"); + } + + @Test + public void givenExistingClass_whenUsingForName_noException() throws ClassNotFoundException { + Class.forName("java.lang.String"); + } + + @Test(expected = ExceptionInInitializerError.class) //thrown when exception occurs inside of a static initialization block + public void givenInitializingClass_whenUsingForName_initializationError() throws ClassNotFoundException { + Class.forName("com.baeldung.checkclassexistence.CheckClassExistenceUnitTest$InitializingClass"); + } + + @Test + public void givenInitializingClass_whenUsingForNameWithoutInitialization_noException() throws ClassNotFoundException { + Class.forName("com.baeldung.checkclassexistence.CheckClassExistenceUnitTest$InitializingClass", false, getClass().getClassLoader()); + } +} From 691a948c5f55d20f98e3d96d5d201f8a098ffd6e Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Mon, 31 Aug 2020 22:53:30 +0300 Subject: [PATCH 0620/1862] BAEL-4371: Initial commit --- gradle-5/cmd-line-args/build.gradle | 16 ++++++++++++++++ gradle-5/settings.gradle | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gradle-5/cmd-line-args/build.gradle diff --git a/gradle-5/cmd-line-args/build.gradle b/gradle-5/cmd-line-args/build.gradle new file mode 100644 index 0000000000..aed57d775b --- /dev/null +++ b/gradle-5/cmd-line-args/build.gradle @@ -0,0 +1,16 @@ +apply plugin: "java" +description = "Gradle Command Line Arguments examples" + + + +task propertyTypes(){ + doLast{ + if (project.hasProperty('input')){ + println "This is my property ["+ project.getProperty('input')+"]" + } else { + println "No property was passed" + } + + } +} + diff --git a/gradle-5/settings.gradle b/gradle-5/settings.gradle index 5384d071e7..ede73daf0a 100644 --- a/gradle-5/settings.gradle +++ b/gradle-5/settings.gradle @@ -1,4 +1,5 @@ rootProject.name='gradle-5-articles' include 'java-exec' include 'unused-dependencies' -include 'source-sets' \ No newline at end of file +include 'source-sets' +include 'cmd-line-args' \ No newline at end of file From 026e3c511ef0181dffb883bbe95345f80fca353a Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Tue, 1 Sep 2020 04:27:53 +0430 Subject: [PATCH 0621/1862] Disabling Tomcat URL Stream Factory --- .../cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java | 2 ++ .../cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java index 0f0a1c4255..decb77e7b9 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetryFailureIntegrationTest.java @@ -1,5 +1,6 @@ package com.baeldung.spring.cloud.ribbon.retry; +import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -24,6 +25,7 @@ public class RibbonRetryFailureIntegrationTest { @BeforeAll public static void setup() { + TomcatURLStreamHandlerFactory.disable(); weatherServiceInstance1 = startApp(8021); weatherServiceInstance2 = startApp(8022); } diff --git a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java index 6fdad0f2a9..dc50fe76e6 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java +++ b/spring-cloud/spring-cloud-ribbon-retry/ribbon-client-service/src/test/java/com/baeldung/spring/cloud/ribbon/retry/RibbonRetrySuccessIntegrationTest.java @@ -1,5 +1,6 @@ package com.baeldung.spring.cloud.ribbon.retry; +import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -25,6 +26,7 @@ public class RibbonRetrySuccessIntegrationTest { @BeforeAll public static void setup() { + TomcatURLStreamHandlerFactory.disable(); weatherServiceInstance1 = startApp(8021); weatherServiceInstance2 = startApp(8022); } From 03ac0c0b5d331b1c67fa2af5c0b9e4614d7d5e7f Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Tue, 1 Sep 2020 19:13:34 +0530 Subject: [PATCH 0622/1862] Added two space indent for the line continuation. --- .../configuration/SwaggerConfiguration.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java index 7bacdde4c8..4f85d90f5f 100644 --- a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java +++ b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java @@ -30,10 +30,10 @@ public class SwaggerConfiguration { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()) - .build(); + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build(); } /** @@ -43,21 +43,21 @@ public class SwaggerConfiguration { @Bean UiConfiguration uiConfig() { return UiConfigurationBuilder.builder() - .deepLinking(true) - .displayOperationId(false) - .defaultModelsExpandDepth(1) - .defaultModelExpandDepth(1) - .defaultModelRendering(ModelRendering.EXAMPLE) - .displayRequestDuration(false) - .docExpansion(DocExpansion.NONE) - .filter(false) - .maxDisplayedTags(null) - .operationsSorter(OperationsSorter.ALPHA) - .showExtensions(false) - .tagsSorter(TagsSorter.ALPHA) - .supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS) - .validatorUrl(null) - .build(); + .deepLinking(true) + .displayOperationId(false) + .defaultModelsExpandDepth(1) + .defaultModelExpandDepth(1) + .defaultModelRendering(ModelRendering.EXAMPLE) + .displayRequestDuration(false) + .docExpansion(DocExpansion.NONE) + .filter(false) + .maxDisplayedTags(null) + .operationsSorter(OperationsSorter.ALPHA) + .showExtensions(false) + .tagsSorter(TagsSorter.ALPHA) + .supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS) + .validatorUrl(null) + .build(); } } From 994e25312b5d770f4aabdf14ac893fdd98b36467 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Tue, 1 Sep 2020 19:28:46 +0530 Subject: [PATCH 0623/1862] Revert "Added two space indent for the line continuation." This reverts commit 03ac0c0b5d331b1c67fa2af5c0b9e4614d7d5e7f. --- .../configuration/SwaggerConfiguration.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java index 4f85d90f5f..7bacdde4c8 100644 --- a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java +++ b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java @@ -30,10 +30,10 @@ public class SwaggerConfiguration { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()) - .build(); + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build(); } /** @@ -43,21 +43,21 @@ public class SwaggerConfiguration { @Bean UiConfiguration uiConfig() { return UiConfigurationBuilder.builder() - .deepLinking(true) - .displayOperationId(false) - .defaultModelsExpandDepth(1) - .defaultModelExpandDepth(1) - .defaultModelRendering(ModelRendering.EXAMPLE) - .displayRequestDuration(false) - .docExpansion(DocExpansion.NONE) - .filter(false) - .maxDisplayedTags(null) - .operationsSorter(OperationsSorter.ALPHA) - .showExtensions(false) - .tagsSorter(TagsSorter.ALPHA) - .supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS) - .validatorUrl(null) - .build(); + .deepLinking(true) + .displayOperationId(false) + .defaultModelsExpandDepth(1) + .defaultModelExpandDepth(1) + .defaultModelRendering(ModelRendering.EXAMPLE) + .displayRequestDuration(false) + .docExpansion(DocExpansion.NONE) + .filter(false) + .maxDisplayedTags(null) + .operationsSorter(OperationsSorter.ALPHA) + .showExtensions(false) + .tagsSorter(TagsSorter.ALPHA) + .supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS) + .validatorUrl(null) + .build(); } } From b8bcbeee90aa6b84778909ff94af60b5af78ebe2 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Tue, 1 Sep 2020 19:13:34 +0530 Subject: [PATCH 0624/1862] Added two space indent for the line continuation. --- .../configuration/SwaggerConfiguration.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java index 7bacdde4c8..4f85d90f5f 100644 --- a/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java +++ b/spring-boot-modules/spring-boot-swagger/src/main/java/com/baeldung/swagger2boot/configuration/SwaggerConfiguration.java @@ -30,10 +30,10 @@ public class SwaggerConfiguration { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.any()) - .paths(PathSelectors.any()) - .build(); + .select() + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build(); } /** @@ -43,21 +43,21 @@ public class SwaggerConfiguration { @Bean UiConfiguration uiConfig() { return UiConfigurationBuilder.builder() - .deepLinking(true) - .displayOperationId(false) - .defaultModelsExpandDepth(1) - .defaultModelExpandDepth(1) - .defaultModelRendering(ModelRendering.EXAMPLE) - .displayRequestDuration(false) - .docExpansion(DocExpansion.NONE) - .filter(false) - .maxDisplayedTags(null) - .operationsSorter(OperationsSorter.ALPHA) - .showExtensions(false) - .tagsSorter(TagsSorter.ALPHA) - .supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS) - .validatorUrl(null) - .build(); + .deepLinking(true) + .displayOperationId(false) + .defaultModelsExpandDepth(1) + .defaultModelExpandDepth(1) + .defaultModelRendering(ModelRendering.EXAMPLE) + .displayRequestDuration(false) + .docExpansion(DocExpansion.NONE) + .filter(false) + .maxDisplayedTags(null) + .operationsSorter(OperationsSorter.ALPHA) + .showExtensions(false) + .tagsSorter(TagsSorter.ALPHA) + .supportedSubmitMethods(UiConfiguration.Constants.DEFAULT_SUBMIT_METHODS) + .validatorUrl(null) + .build(); } } From 2dc6089b10eb062009fde17d72d2a0352f3fc70d Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 1 Sep 2020 16:49:22 +0200 Subject: [PATCH 0625/1862] BAEL-4518: Upgrade jooq version (#9955) --- spring-jooq/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index c07d6278cb..95418645fa 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -30,6 +30,7 @@ org.jooq jooq + ${org.jooq.version} @@ -201,7 +202,7 @@ - 3.11.7 + 3.12.4 1.0.0 1.5 1.0.0 From 468217efea75f9cc43f19fb5ca8f4fc2b65785a8 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Tue, 1 Sep 2020 17:19:24 +0200 Subject: [PATCH 0626/1862] JAVA-2398: Remove redundant config classes import --- .../com/baeldung/swagger2boot/configuration/SpringFoxConfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java index b404b0c2f8..5998ffeb2a 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java +++ b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java @@ -22,7 +22,6 @@ import springfox.documentation.swagger.web.UiConfigurationBuilder; import java.util.Collections; @Configuration -@Import({SpringDataRestConfiguration.class, BeanValidatorPluginsConfiguration.class}) public class SpringFoxConfig { private ApiInfo apiInfo() { From 8d2c467e2b4205812fcaaa2140ac0318a657a91f Mon Sep 17 00:00:00 2001 From: majajoksovic Date: Tue, 1 Sep 2020 17:23:00 +0200 Subject: [PATCH 0627/1862] BAEL-4465 (#9954) * initial commit * fixed indent * removed unused dependencies * some minor code changes and unit tests * fixed file names --- libraries-security/pom.xml | 17 +++-- .../com/baeldung/ssh/apachesshd/SshdDemo.java | 64 +++++++++++++++++++ .../java/com/baeldung/ssh/jsch/JschDemo.java | 52 +++++++++++++++ .../baeldung/ssh/ApacheMinaSshdLiveTest.java | 38 +++++++++++ .../java/com/baeldung/ssh/JSchLiveTest.java | 35 ++++++++++ 5 files changed, 201 insertions(+), 5 deletions(-) create mode 100644 libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java create mode 100644 libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java create mode 100644 libraries-security/src/test/java/com/baeldung/ssh/ApacheMinaSshdLiveTest.java create mode 100644 libraries-security/src/test/java/com/baeldung/ssh/JSchLiveTest.java diff --git a/libraries-security/pom.xml b/libraries-security/pom.xml index e02f766141..202b3b8763 100644 --- a/libraries-security/pom.xml +++ b/libraries-security/pom.xml @@ -14,29 +14,24 @@ - org.springframework.boot spring-boot-starter-web - org.springframework.security.oauth spring-security-oauth2 ${spring-boot.version} - org.springframework spring-web - com.github.scribejava scribejava-apis ${scribejava.version} - com.google.crypto.tink tink @@ -72,6 +67,16 @@ jasypt ${jasypt.version} + + com.jcraft + jsch + ${jsch.version} + + + org.apache.sshd + sshd-core + ${apache-mina.version} + @@ -81,6 +86,8 @@ 1.2.2 1.9.2 1.58 + 0.1.55 + 2.5.1 diff --git a/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java b/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java new file mode 100644 index 0000000000..05d8034040 --- /dev/null +++ b/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java @@ -0,0 +1,64 @@ +package com.baeldung.ssh.apachesshd; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.util.EnumSet; +import java.util.concurrent.TimeUnit; + +import org.apache.sshd.client.SshClient; +import org.apache.sshd.client.channel.ClientChannel; +import org.apache.sshd.client.channel.ClientChannelEvent; +import org.apache.sshd.client.session.ClientSession; +import org.apache.sshd.common.channel.Channel; + +public class SshdDemo { + + public static void main(String[] args) throws Exception { + String username = "demo"; + String password = "password"; + String host = "test.rebex.net"; + int port = 22; + long defaultTimeoutSeconds = 10l; + String command = "ls\n"; + + listFolderStructure(username, password, host, port, defaultTimeoutSeconds, command); + } + + public static String listFolderStructure(String username, String password, String host, int port, long defaultTimeoutSeconds, String command) throws Exception { + SshClient client = SshClient.setUpDefaultClient(); + client.start(); + try (ClientSession session = client.connect(username, host, port) + .verify(defaultTimeoutSeconds, TimeUnit.SECONDS) + .getSession()) { + session.addPasswordIdentity(password); + session.auth() + .verify(5L, TimeUnit.SECONDS); + try (ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); + ByteArrayOutputStream errorResponseStream = new ByteArrayOutputStream(); + ClientChannel channel = session.createChannel(Channel.CHANNEL_SHELL)) { + channel.setOut(responseStream); + channel.setErr(errorResponseStream); + try { + channel.open() + .verify(defaultTimeoutSeconds, TimeUnit.SECONDS); + try (OutputStream pipedIn = channel.getInvertedIn()) { + pipedIn.write(command.getBytes()); + pipedIn.flush(); + } + channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), TimeUnit.SECONDS.toMillis(defaultTimeoutSeconds)); + String errorString = new String(errorResponseStream.toByteArray()); + if(!errorString.isEmpty()) { + throw new Exception(errorString); + } + String responseString = new String(responseStream.toByteArray()); + return responseString; + } finally { + channel.close(false); + } + } + } finally { + client.stop(); + } + } + +} diff --git a/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java b/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java new file mode 100644 index 0000000000..34a40318bb --- /dev/null +++ b/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java @@ -0,0 +1,52 @@ +package com.baeldung.ssh.jsch; + +import java.io.ByteArrayOutputStream; + +import com.jcraft.jsch.ChannelExec; +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.Session; + +public class JschDemo { + + public static void main(String args[]) throws Exception { + String username = "demo"; + String password = "password"; + String host = "test.rebex.net"; + int port = 22; + String command = "ls"; + listFolderStructure(username, password, host, port, command); + } + + public static String listFolderStructure(String username, String password, String host, int port, String command) throws Exception { + Session session = null; + ChannelExec channel = null; + String response = null; + try { + session = new JSch().getSession(username, host, port); + session.setPassword(password); + session.setConfig("StrictHostKeyChecking", "no"); + session.connect(); + channel = (ChannelExec) session.openChannel("exec"); + channel.setCommand(command); + ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); + ByteArrayOutputStream errorResponseStream = new ByteArrayOutputStream(); + channel.setOutputStream(responseStream); + channel.setErrStream(errorResponseStream); + channel.connect(); + while (channel.isConnected()) { + Thread.sleep(100); + } + String errorResponse = new String(errorResponseStream.toByteArray()); + response = new String(responseStream.toByteArray()); + if(!errorResponse.isEmpty()) { + throw new Exception(errorResponse); + } + } finally { + if (session != null) + session.disconnect(); + if (channel != null) + channel.disconnect(); + } + return response; + } +} diff --git a/libraries-security/src/test/java/com/baeldung/ssh/ApacheMinaSshdLiveTest.java b/libraries-security/src/test/java/com/baeldung/ssh/ApacheMinaSshdLiveTest.java new file mode 100644 index 0000000000..3cefca05cb --- /dev/null +++ b/libraries-security/src/test/java/com/baeldung/ssh/ApacheMinaSshdLiveTest.java @@ -0,0 +1,38 @@ +package com.baeldung.ssh; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.junit.Test; + +import com.baeldung.ssh.apachesshd.SshdDemo; + +public class ApacheMinaSshdLiveTest { + + @Test + public void givenValidCredentials_whenConnectionIsEstablished_thenServerReturnsResponse() throws Exception { + String username = "demo"; + String password = "password"; + String host = "test.rebex.net"; + int port = 22; + long defaultTimeoutSeconds = 10l; + String command = "ls\n"; + String responseString = SshdDemo.listFolderStructure(username, password, host, port, defaultTimeoutSeconds, command); + + assertNotNull(responseString); + } + + @Test(expected = Exception.class) + public void givenInvalidCredentials_whenConnectionAttemptIsMade_thenServerReturnsErrorResponse() throws Exception { + String username = "invalidUsername"; + String password = "password"; + String host = "test.rebex.net"; + int port = 22; + long defaultTimeoutSeconds = 10l; + String command = "ls\n"; + String responseString = SshdDemo.listFolderStructure(username, password, host, port, defaultTimeoutSeconds, command); + + assertNull(responseString); + } + +} diff --git a/libraries-security/src/test/java/com/baeldung/ssh/JSchLiveTest.java b/libraries-security/src/test/java/com/baeldung/ssh/JSchLiveTest.java new file mode 100644 index 0000000000..c95c3c319c --- /dev/null +++ b/libraries-security/src/test/java/com/baeldung/ssh/JSchLiveTest.java @@ -0,0 +1,35 @@ +package com.baeldung.ssh; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.junit.Test; + +import com.baeldung.ssh.jsch.JschDemo; + +public class JSchLiveTest { + + @Test + public void givenValidCredentials_whenConnectionIsEstablished_thenServerReturnsResponse() throws Exception { + String username = "demo"; + String password = "password"; + String host = "test.rebex.net"; + int port = 22; + String command = "ls"; + String responseString = JschDemo.listFolderStructure(username, password, host, port, command); + + assertNotNull(responseString); + } + + @Test(expected = Exception.class) + public void givenInvalidCredentials_whenConnectionAttemptIsMade_thenServerReturnsErrorResponse() throws Exception { + String username = "invalidUsername"; + String password = "password"; + String host = "test.rebex.net"; + int port = 22; + String command = "ls"; + String responseString = JschDemo.listFolderStructure(username, password, host, port, command); + + assertNull(responseString); + } +} From d19ac51aaa6e19426e1a43cd1c9eb88f7884850e Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Tue, 1 Sep 2020 18:52:06 +0300 Subject: [PATCH 0628/1862] BAEL-4371: Finished code samples --- gradle-5/cmd-line-args/build.gradle | 40 ++++++++++++++++--- .../main/java/com/baeldung/cmd/MainClass.java | 10 +++++ 2 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 gradle-5/cmd-line-args/src/main/java/com/baeldung/cmd/MainClass.java diff --git a/gradle-5/cmd-line-args/build.gradle b/gradle-5/cmd-line-args/build.gradle index aed57d775b..57c48e36c3 100644 --- a/gradle-5/cmd-line-args/build.gradle +++ b/gradle-5/cmd-line-args/build.gradle @@ -1,16 +1,46 @@ apply plugin: "java" +apply plugin: "application" description = "Gradle Command Line Arguments examples" +ext.javaMainClass = "com.baeldung.cmd.MainClass" +application { + mainClassName = javaMainClass +} task propertyTypes(){ doLast{ - if (project.hasProperty('input')){ - println "This is my property ["+ project.getProperty('input')+"]" - } else { - println "No property was passed" + project.getProperties().values().each { + println "Project property ["+it+"]" + } + + System.getProperties().each { + println "System property ["+it+"]" } - } } +if (project.hasProperty("args")) { + ext.cmdargs = project.getProperty("args") + ext.cmdargsarray = cmdargs.split() +} else { + ext.cmdargs = "" +} + +task cmdLineJavaExec(type: JavaExec) { + group = "Execution" + description = "Run the main class with JavaExecTask" + classpath = sourceSets.main.runtimeClasspath + main = javaMainClass + args cmdargsarray +} + +ext.cmdarray = ["java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(), javaMainClass] +cmdarray = (cmdarray << cmdargsarray).flatten() + +task cmdLineExec(type: Exec) { + dependsOn build + group = "Execution" + description = "Run the main class with ExecTask" + commandLine cmdarray +} diff --git a/gradle-5/cmd-line-args/src/main/java/com/baeldung/cmd/MainClass.java b/gradle-5/cmd-line-args/src/main/java/com/baeldung/cmd/MainClass.java new file mode 100644 index 0000000000..f00aa07d72 --- /dev/null +++ b/gradle-5/cmd-line-args/src/main/java/com/baeldung/cmd/MainClass.java @@ -0,0 +1,10 @@ +package com.baeldung.cmd; + +public class MainClass { + public static void main(String[] args) { + System.out.println("Gradle command line arguments example"); + for (String arg : args) { + System.out.println("Got argument [" + arg + "]"); + } + } +} From 9d24bc15986325ca896e62cfd0bfd6f8c5048375 Mon Sep 17 00:00:00 2001 From: Maciej Glowka Date: Tue, 1 Sep 2020 21:15:01 +0200 Subject: [PATCH 0629/1862] BAEL-4297: example of IllegalMonitorStateException --- .../exceptions/illegalmonitorstate/Data.java | 14 ++++ .../SynchronizedReceiver.java | 35 ++++++++++ .../SynchronizedSender.java | 33 +++++++++ .../UnSynchronizedReceiver.java | 33 +++++++++ .../UnSynchronizedSender.java | 31 ++++++++ .../IllegalMonitorStateExceptionUnitTest.java | 70 +++++++++++++++++++ 6 files changed, 216 insertions(+) create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/Data.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedReceiver.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedSender.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedReceiver.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedSender.java create mode 100644 core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/illegalmonitorstate/IllegalMonitorStateExceptionUnitTest.java diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/Data.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/Data.java new file mode 100644 index 0000000000..b5867d15e7 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/Data.java @@ -0,0 +1,14 @@ +package com.baeldung.exceptions.illegalmonitorstate; + +public class Data { + private String message; + + public void send(String message) { + this.message = message; + } + + public String receive() { + return message; + } +} + diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedReceiver.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedReceiver.java new file mode 100644 index 0000000000..3dffb7b30a --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedReceiver.java @@ -0,0 +1,35 @@ +package com.baeldung.exceptions.illegalmonitorstate; + +public class SynchronizedReceiver implements Runnable { + private final Data data; + private String message; + private boolean illegalMonitorStateExceptionOccurred; + + public SynchronizedReceiver(Data data) { + this.data = data; + } + + @Override + public void run() { + synchronized (data) { + try { + data.wait(); + this.message = data.receive(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } catch (IllegalMonitorStateException e) { + e.printStackTrace(); + illegalMonitorStateExceptionOccurred = true; + } + } + } + + public boolean hasIllegalMonitorStateExceptionOccurred() { + return illegalMonitorStateExceptionOccurred; + } + + public String getMessage() { + return message; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedSender.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedSender.java new file mode 100644 index 0000000000..04bac03e77 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedSender.java @@ -0,0 +1,33 @@ +package com.baeldung.exceptions.illegalmonitorstate; + +public class SynchronizedSender implements Runnable { + private final Data data; + private boolean illegalMonitorStateExceptionOccurred; + + public SynchronizedSender(Data data) { + this.data = data; + } + + @Override + public void run() { + synchronized (data) { + try { + Thread.sleep(1000); + + data.send("test"); + + data.notifyAll(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } catch (IllegalMonitorStateException e) { + e.printStackTrace(); + illegalMonitorStateExceptionOccurred = true; + } + } + } + + public boolean hasIllegalMonitorStateExceptionOccurred() { + return illegalMonitorStateExceptionOccurred; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedReceiver.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedReceiver.java new file mode 100644 index 0000000000..a8e8befc4d --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedReceiver.java @@ -0,0 +1,33 @@ +package com.baeldung.exceptions.illegalmonitorstate; + +public class UnSynchronizedReceiver implements Runnable { + private final Data data; + private String message; + private boolean illegalMonitorStateExceptionOccurred; + + public UnSynchronizedReceiver(Data data) { + this.data = data; + } + + @Override + public void run() { + try { + data.wait(); + this.message = data.receive(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } catch (IllegalMonitorStateException e) { + e.printStackTrace(); + illegalMonitorStateExceptionOccurred = true; + } + } + + public boolean hasIllegalMonitorStateExceptionOccurred() { + return illegalMonitorStateExceptionOccurred; + } + + public String getMessage() { + return message; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedSender.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedSender.java new file mode 100644 index 0000000000..eb6fa16649 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedSender.java @@ -0,0 +1,31 @@ +package com.baeldung.exceptions.illegalmonitorstate; + +public class UnSynchronizedSender implements Runnable { + private final Data data; + private boolean illegalMonitorStateExceptionOccurred; + + public UnSynchronizedSender(Data data) { + this.data = data; + } + + @Override + public void run() { + try { + Thread.sleep(1000); + + data.send("test"); + + data.notifyAll(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } catch (IllegalMonitorStateException e) { + e.printStackTrace(); + illegalMonitorStateExceptionOccurred = true; + } + } + + public boolean hasIllegalMonitorStateExceptionOccurred() { + return illegalMonitorStateExceptionOccurred; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/illegalmonitorstate/IllegalMonitorStateExceptionUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/illegalmonitorstate/IllegalMonitorStateExceptionUnitTest.java new file mode 100644 index 0000000000..800cdc4a7b --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/illegalmonitorstate/IllegalMonitorStateExceptionUnitTest.java @@ -0,0 +1,70 @@ +package com.baeldung.exceptions.illegalmonitorstate; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class IllegalMonitorStateExceptionUnitTest { + + @Test + void whenSyncSenderAndSyncReceiverAreUsed_thenIllegalMonitorExceptionShouldNotBeThrown() throws InterruptedException { + Data data = new Data(); + + SynchronizedReceiver receiver = new SynchronizedReceiver(data); + Thread receiverThread = new Thread(receiver, "receiver-thread"); + receiverThread.start(); + + SynchronizedSender sender = new SynchronizedSender(data); + Thread senderThread = new Thread(sender, "sender-thread"); + senderThread.start(); + + senderThread.join(1000); + receiverThread.join(1000); + + assertEquals("test", receiver.getMessage()); + assertFalse(sender.hasIllegalMonitorStateExceptionOccurred()); + assertFalse(receiver.hasIllegalMonitorStateExceptionOccurred()); + } + + @Test + void whenSyncSenderAndUnSyncReceiverAreUsed_thenIllegalMonitorExceptionShouldNotBeThrown() throws InterruptedException { + Data data = new Data(); + + UnSynchronizedReceiver receiver = new UnSynchronizedReceiver(data); + Thread receiverThread = new Thread(receiver, "receiver-thread"); + receiverThread.start(); + + SynchronizedSender sender = new SynchronizedSender(data); + Thread senderThread = new Thread(sender, "sender-thread"); + senderThread.start(); + + + receiverThread.join(1000); + senderThread.join(1000); + + assertNull(receiver.getMessage()); + assertFalse(sender.hasIllegalMonitorStateExceptionOccurred()); + assertTrue(receiver.hasIllegalMonitorStateExceptionOccurred()); + } + + @Test + void whenUnSyncSenderAndSyncReceiverAreUsed_thenIllegalMonitorExceptionShouldBeThrown() throws InterruptedException { + Data data = new Data(); + + SynchronizedReceiver receiver = new SynchronizedReceiver(data); + Thread receiverThread = new Thread(receiver, "receiver-thread"); + receiverThread.start(); + + UnSynchronizedSender sender = new UnSynchronizedSender(data); + Thread senderThread = new Thread(sender, "sender-thread"); + senderThread.start(); + + + receiverThread.join(1000); + senderThread.join(1000); + + assertNull(receiver.getMessage()); + assertFalse(receiver.hasIllegalMonitorStateExceptionOccurred()); + assertTrue(sender.hasIllegalMonitorStateExceptionOccurred()); + } +} From 8d07e8fab96ca4375ae21c953f904d74985b4164 Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Wed, 2 Sep 2020 07:46:50 -0500 Subject: [PATCH 0630/1862] BAEL-4387 Change module --- .../ArrayToListConversionUnitTest.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) rename {java-collections-conversions-2 => core-java-modules/core-java-string-operations-3}/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java (61%) diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java similarity index 61% rename from java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java rename to core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java index 551661810d..80e7b93b0c 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java +++ b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java @@ -1,21 +1,24 @@ package com.baeldung.arrayconversion; +import org.hamcrest.CoreMatchers; import org.junit.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertArrayEquals; + public class ArrayToListConversionUnitTest { @Test(expected = UnsupportedOperationException.class) public void givenAnArray_whenConvertingToList_returnUnmodifiableListUnitTest() { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = Arrays.asList(stringArray); - System.out.println(stringList); stringList.set(0, "E"); - System.out.println(stringList); - System.out.println(Arrays.toString(stringArray)); + assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D")); + assertArrayEquals(stringArray, new String[] { "E", "B", "C", "D" }); stringList.add("F"); } @@ -23,10 +26,10 @@ public class ArrayToListConversionUnitTest { public void givenAnArray_whenConvertingToList_returnModifiableListUnitTest() { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = new ArrayList<>(Arrays.asList(stringArray)); - System.out.println(stringList); stringList.set(0, "E"); - System.out.println(stringList); - System.out.println(Arrays.toString(stringArray)); + assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D")); + assertArrayEquals(stringArray, new String[] { "A", "B", "C", "D" }); stringList.add("F"); + assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D", "F")); } } From c9d080aff4fbda963063d0abf6e5c86c5c524a1a Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 2 Sep 2020 15:23:35 +0200 Subject: [PATCH 0631/1862] JAVA-2401: Remove redundant repository config --- spring-boot-modules/spring-boot-mvc/pom.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/spring-boot-modules/spring-boot-mvc/pom.xml b/spring-boot-modules/spring-boot-mvc/pom.xml index 39046ee6d9..560ea1cffa 100644 --- a/spring-boot-modules/spring-boot-mvc/pom.xml +++ b/spring-boot-modules/spring-boot-mvc/pom.xml @@ -17,15 +17,6 @@ spring-boot-mvc Module For Spring Boot MVC - - - - jcenter-release - jcenter - http://oss.jfrog.org/artifactory/oss-release-local/ - - - From b27e6a047016b112fc47ab5ac7d6a63e0fe54ab6 Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Wed, 2 Sep 2020 09:00:42 -0500 Subject: [PATCH 0632/1862] Added braces to the if block --- .../checkclassexistence/CheckClassExistenceUnitTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java index 10402af970..2e500b390f 100644 --- a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java @@ -6,8 +6,9 @@ public class CheckClassExistenceUnitTest { public static class InitializingClass { static { - if (true) //enable throwing of an exception in a static initialization block + if (true) { //enable throwing of an exception in a static initialization block throw new RuntimeException(); + } } } From 473b453a1f0bf2f46d00999a000a0e881df8df1d Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Wed, 2 Sep 2020 21:16:52 +0530 Subject: [PATCH 0633/1862] BAEL-4441: Custom User Attributes with Keycloak and Spring (#9966) --- .../keycloak/CustomUserAttrController.java | 46 +++++++++++++++++++ .../com/baeldung/keycloak/SecurityConfig.java | 2 +- .../main/resources/templates/userInfo.html | 15 ++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 spring-boot-modules/spring-boot-keycloak/src/main/java/com/baeldung/keycloak/CustomUserAttrController.java create mode 100644 spring-boot-modules/spring-boot-keycloak/src/main/resources/templates/userInfo.html diff --git a/spring-boot-modules/spring-boot-keycloak/src/main/java/com/baeldung/keycloak/CustomUserAttrController.java b/spring-boot-modules/spring-boot-keycloak/src/main/java/com/baeldung/keycloak/CustomUserAttrController.java new file mode 100644 index 0000000000..1959590e5a --- /dev/null +++ b/spring-boot-modules/spring-boot-keycloak/src/main/java/com/baeldung/keycloak/CustomUserAttrController.java @@ -0,0 +1,46 @@ +package com.baeldung.keycloak; + +import java.security.Principal; +import java.util.Map; + +import org.keycloak.KeycloakPrincipal; +import org.keycloak.KeycloakSecurityContext; +import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken; +import org.keycloak.representations.IDToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class CustomUserAttrController { + + @GetMapping(path = "/users") + public String getUserInfo(Model model) { + + KeycloakAuthenticationToken authentication = (KeycloakAuthenticationToken) SecurityContextHolder.getContext() + .getAuthentication(); + + final Principal principal = (Principal) authentication.getPrincipal(); + + String dob = ""; + + if (principal instanceof KeycloakPrincipal) { + + KeycloakPrincipal kPrincipal = (KeycloakPrincipal) principal; + IDToken token = kPrincipal.getKeycloakSecurityContext() + .getIdToken(); + + Map customClaims = token.getOtherClaims(); + + if (customClaims.containsKey("DOB")) { + dob = String.valueOf(customClaims.get("DOB")); + } + } + + model.addAttribute("username", principal.getName()); + model.addAttribute("dob", dob); + return "userInfo"; + } + +} diff --git a/spring-boot-modules/spring-boot-keycloak/src/main/java/com/baeldung/keycloak/SecurityConfig.java b/spring-boot-modules/spring-boot-keycloak/src/main/java/com/baeldung/keycloak/SecurityConfig.java index 4ecb62b6d4..895ac8c562 100644 --- a/spring-boot-modules/spring-boot-keycloak/src/main/java/com/baeldung/keycloak/SecurityConfig.java +++ b/spring-boot-modules/spring-boot-keycloak/src/main/java/com/baeldung/keycloak/SecurityConfig.java @@ -44,7 +44,7 @@ class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter { protected void configure(HttpSecurity http) throws Exception { super.configure(http); http.authorizeRequests() - .antMatchers("/customers*") + .antMatchers("/customers*", "/users*") .hasRole("user") .anyRequest() .permitAll(); diff --git a/spring-boot-modules/spring-boot-keycloak/src/main/resources/templates/userInfo.html b/spring-boot-modules/spring-boot-keycloak/src/main/resources/templates/userInfo.html new file mode 100644 index 0000000000..1446fe2124 --- /dev/null +++ b/spring-boot-modules/spring-boot-keycloak/src/main/resources/templates/userInfo.html @@ -0,0 +1,15 @@ + + + + + +
    +

    + Hello, --name--. +

    +

    + Your Date of Birth as per our records is . +

    +
    + + From 0a24acf927ce6270a624a684de1601e46faecb6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Wed, 19 Aug 2020 19:44:49 +0200 Subject: [PATCH 0634/1862] [JAVA-2306] Fix - Added spring-data-jpa-query-2 to modules list --- persistence-modules/pom.xml | 1 + persistence-modules/spring-data-jpa-query-2/pom.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 522c281386..468d50b458 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -68,6 +68,7 @@ spring-data-jpa-enterprise spring-data-jpa-filtering spring-data-jpa-query + spring-data-jpa-query-2 spring-data-jpa-repo spring-data-jdbc diff --git a/persistence-modules/spring-data-jpa-query-2/pom.xml b/persistence-modules/spring-data-jpa-query-2/pom.xml index b9e5120543..22cd373c95 100644 --- a/persistence-modules/spring-data-jpa-query-2/pom.xml +++ b/persistence-modules/spring-data-jpa-query-2/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - spring-data-jpa-query + spring-data-jpa-query-2 spring-data-jpa-query-2 From 4e4ac650fa6b71fe9139a35b455950ccd00e2eb8 Mon Sep 17 00:00:00 2001 From: fdpro Date: Wed, 19 Aug 2020 20:18:54 +0200 Subject: [PATCH 0635/1862] [JAVA-2306] Moved articles from spring-persistence-simple * https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa went into spring-jpa-2 * https://www.baeldung.com/hibernate-5-spring went to spring-jpa-2 * https://www.baeldung.com/transaction-configuration-with-jpa-and-spring went to spring-jpa-2 * https://www.baeldung.com/persistence-layer-with-spring-and-hibernate went to spring-jpa-2 * https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics went to spring-jpa-2 * https://www.baeldung.com/the-persistence-layer-with-spring-data-jpa went to spring-data-jpa-repo-2 * https://www.baeldung.com/spring-data-jpa-query went to spring-data-jpa-query-2 * https://www.baeldung.com/spring-jdbc-jdbctemplate moved to spring-jdbc * Removed spring-persistence-simple module as all articles have been moved --- .../{ => spring}/jdbc/BatchProcessing.java | 2 +- .../baeldung/{ => spring}/jdbc/Employee.java | 2 +- .../jdbc/joins/ArticleWithAuthor.java | 2 +- .../jdbc/joins/ArticleWithAuthorDAO.java | 2 +- .../jdbc/BatchProcessingLiveTest.java | 2 +- .../jdbc/JdbcDriverLoadingUnitTest.java | 2 +- .../{ => spring}/jdbc/JdbcLiveTest.java | 2 +- .../{ => spring}/jdbc/ResultSetLiveTest.java | 2 +- .../joins/ArticleWithAuthorDAOLiveTest.java | 2 +- persistence-modules/pom.xml | 3 +- .../baeldung/spring/data/jpa/query}/User.java | 39 +- .../data/jpa/query}/UserRepository.java | 80 +-- .../data/jpa/query}/UserRepositoryCustom.java | 4 +- .../spring-data-jpa-repo-2/pom.xml | 47 ++ .../data/persistence/repository}/Foo.java | 17 +- .../persistence/repository/FooService.java | 15 + .../data/persistence/repository/IFooDAO.java} | 6 +- .../persistence/repository/IFooService.java | 5 + .../repository}/PersistenceConfig.java | 15 +- .../src/main/resources/application.properties | 3 + .../src/main/resources/persistence.properties | 9 + .../src/main/resources/springDataConfig.xml} | 6 +- .../repository/FooServiceIntegrationTest.java | 21 + persistence-modules/spring-jdbc/pom.xml | 41 ++ .../jdbc/CustomSQLErrorCodeTranslator.java | 2 +- .../com/baeldung/spring}/jdbc/Employee.java | 2 +- .../baeldung/spring}/jdbc/EmployeeDAO.java | 2 +- .../spring}/jdbc/EmployeeRowMapper.java | 2 +- .../spring}/jdbc/config/SpringJdbcConfig.java | 10 +- .../src/main/resources/application.properties | 3 + .../src/main/resources/jdbc/schema.sql | 0 .../src/main/resources/jdbc/test-data.sql | 0 .../jdbc/EmployeeDAOIntegrationTest.java | 4 +- persistence-modules/spring-jpa-2/pom.xml | 35 ++ .../hibernate/bootstrap/BarHibernateDAO.java | 0 .../hibernate/bootstrap/HibernateConf.java | 2 +- .../hibernate/bootstrap/HibernateXMLConf.java | 0 .../hibernate/bootstrap/model/TestEntity.java | 0 .../dao/generics}/AbstractHibernateDao.java | 24 +- .../spring/dao/generics}/AbstractJpaDAO.java | 4 +- .../baeldung/spring/dao/generics}/Foo.java | 19 +- .../spring/dao/generics/FooService.java | 21 + .../dao/generics}/GenericHibernateDao.java | 6 +- .../spring/dao/generics}/GenericJpaDao.java | 6 +- .../spring/dao/generics/IFooService.java | 5 + .../spring/dao/generics/IGenericDao.java} | 6 +- .../hibernate/AbstractHibernateDao.java | 56 ++ .../com/baeldung/spring/hibernate/Foo.java | 42 ++ .../baeldung/spring/hibernate}/FooDao.java | 8 +- .../baeldung/spring/hibernate}/IFooDao.java | 8 +- .../jpa/guide}/PersistenceJPAConfig.java | 14 +- .../spring/transaction/FooService.java | 8 + .../src/main/resources/application.properties | 11 + .../resources/hibernate5Configuration.xml | 0 .../main/resources/persistence-h2.properties | 0 .../resources/persistence-jpa-config.xml} | 3 - .../resources/persistence-mysql.properties | 0 .../HibernateBootstrapIntegrationTest.java | 0 .../HibernateXMLBootstrapIntegrationTest.java | 0 .../autogenkey/config/PersistenceConfig.java | 2 +- .../MessageRepositoryJDBCTemplate.java | 2 +- .../MessageRepositorySimpleJDBCInsert.java | 2 +- .../jdbc/autogenkey/GetAutoGenKeyByJDBC.java | 8 +- .../baeldung/{ => spring}/jdbc/Employee.java | 2 +- .../{ => spring}/jdbc/EmployeeDAO.java | 2 +- .../jdbc/EmployeeDAOUnitTest.java | 2 +- .../spring-persistence-simple/.gitignore | 13 - .../spring-persistence-simple/README.md | 25 - .../spring-persistence-simple/pom.xml | 152 ----- .../baeldung/config/PersistenceConfig.java | 110 ---- .../java/com/baeldung/jpa/dao/FooDao.java | 17 - .../persistence/dao/common/AbstractDao.java | 14 - .../persistence/dao/common/IGenericDao.java | 7 - .../com/baeldung/persistence/model/Bar.java | 102 ---- .../persistence/service/FooService.java | 36 -- .../data/persistence/model/Possession.java | 86 --- .../repository/UserRepositoryCustomImpl.java | 52 -- .../data/persistence/service/IFooService.java | 11 - .../service/common/AbstractService.java | 56 -- .../persistence/service/impl/FooService.java | 38 -- .../main/java/com/baeldung/util/IDUtil.java | 33 -- .../src/main/resources/hibernate5Config.xml | 34 -- .../main/resources/jdbc/springJdbc-config.xml | 19 - .../src/main/resources/logback.xml | 19 - .../src/main/resources/stored_procedure.sql | 20 - ...oPaginationPersistenceIntegrationTest.java | 157 ----- .../FooServicePersistenceIntegrationTest.java | 69 --- .../FooServiceSortingIntegrationTest.java | 118 ---- ...eSortingWitNullsManualIntegrationTest.java | 64 -- .../service/FooStoredProceduresLiveTest.java | 123 ---- .../FooTransactionalUnitTest.java | 250 -------- .../PersistenceTransactionalTestConfig.java | 149 ----- .../repository/UserRepositoryCommon.java | 555 ------------------ .../UserRepositoryIntegrationTest.java | 35 -- ...ractServicePersistenceIntegrationTest.java | 256 -------- .../FooServicePersistenceIntegrationTest.java | 77 --- .../src/test/resources/.gitignore | 13 - 97 files changed, 436 insertions(+), 2926 deletions(-) rename persistence-modules/core-java-persistence/src/main/java/com/baeldung/{ => spring}/jdbc/BatchProcessing.java (99%) rename persistence-modules/core-java-persistence/src/main/java/com/baeldung/{ => spring}/jdbc/Employee.java (97%) rename persistence-modules/core-java-persistence/src/main/java/com/baeldung/{ => spring}/jdbc/joins/ArticleWithAuthor.java (96%) rename persistence-modules/core-java-persistence/src/main/java/com/baeldung/{ => spring}/jdbc/joins/ArticleWithAuthorDAO.java (98%) rename persistence-modules/core-java-persistence/src/test/java/com/baeldung/{ => spring}/jdbc/BatchProcessingLiveTest.java (98%) rename persistence-modules/core-java-persistence/src/test/java/com/baeldung/{ => spring}/jdbc/JdbcDriverLoadingUnitTest.java (98%) rename persistence-modules/core-java-persistence/src/test/java/com/baeldung/{ => spring}/jdbc/JdbcLiveTest.java (99%) rename persistence-modules/core-java-persistence/src/test/java/com/baeldung/{ => spring}/jdbc/ResultSetLiveTest.java (99%) rename persistence-modules/core-java-persistence/src/test/java/com/baeldung/{ => spring}/jdbc/joins/ArticleWithAuthorDAOLiveTest.java (99%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model => spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query}/User.java (89%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository => spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query}/UserRepository.java (65%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository => spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query}/UserRepositoryCustom.java (72%) create mode 100644 persistence-modules/spring-data-jpa-repo-2/pom.xml rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model => spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository}/Foo.java (85%) create mode 100644 persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/FooService.java rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/IFooDao.java => spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/IFooDAO.java} (75%) create mode 100644 persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/IFooService.java rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/config => spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository}/PersistenceConfig.java (90%) create mode 100644 persistence-modules/spring-data-jpa-repo-2/src/main/resources/application.properties create mode 100644 persistence-modules/spring-data-jpa-repo-2/src/main/resources/persistence.properties rename persistence-modules/{spring-persistence-simple/src/main/resources/springDataJpaRepositoriesConfig.xml => spring-data-jpa-repo-2/src/main/resources/springDataConfig.xml} (80%) create mode 100644 persistence-modules/spring-data-jpa-repo-2/src/test/java/com/baeldung/spring/data/persistence/repository/FooServiceIntegrationTest.java create mode 100644 persistence-modules/spring-jdbc/pom.xml rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung => spring-jdbc/src/main/java/com/baeldung/spring}/jdbc/CustomSQLErrorCodeTranslator.java (95%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung => spring-jdbc/src/main/java/com/baeldung/spring}/jdbc/Employee.java (95%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung => spring-jdbc/src/main/java/com/baeldung/spring}/jdbc/EmployeeDAO.java (99%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung => spring-jdbc/src/main/java/com/baeldung/spring}/jdbc/EmployeeRowMapper.java (94%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung => spring-jdbc/src/main/java/com/baeldung/spring}/jdbc/config/SpringJdbcConfig.java (75%) create mode 100644 persistence-modules/spring-jdbc/src/main/resources/application.properties rename persistence-modules/{spring-persistence-simple => spring-jdbc}/src/main/resources/jdbc/schema.sql (100%) rename persistence-modules/{spring-persistence-simple => spring-jdbc}/src/main/resources/jdbc/test-data.sql (100%) rename persistence-modules/{spring-persistence-simple/src/test/java/com/baeldung => spring-jdbc/src/test/java/com/baeldung/spring}/jdbc/EmployeeDAOIntegrationTest.java (97%) rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/main/java/com/baeldung/hibernate/bootstrap/BarHibernateDAO.java (100%) rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/main/java/com/baeldung/hibernate/bootstrap/HibernateConf.java (97%) rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/main/java/com/baeldung/hibernate/bootstrap/HibernateXMLConf.java (100%) rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/main/java/com/baeldung/hibernate/bootstrap/model/TestEntity.java (100%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common => spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics}/AbstractHibernateDao.java (87%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/jpa/dao => spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics}/AbstractJpaDAO.java (96%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/persistence/model => spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics}/Foo.java (82%) create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/FooService.java rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common => spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics}/GenericHibernateDao.java (89%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common => spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics}/GenericJpaDao.java (79%) create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/IFooService.java rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/IOperations.java => spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/IGenericDao.java} (64%) create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/AbstractHibernateDao.java create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/Foo.java rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/hibernate/dao => spring-jpa-2/src/main/java/com/baeldung/spring/hibernate}/FooDao.java (55%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/jpa/dao => spring-jpa-2/src/main/java/com/baeldung/spring/hibernate}/IFooDao.java (65%) rename persistence-modules/{spring-persistence-simple/src/main/java/com/baeldung/config => spring-jpa-2/src/main/java/com/baeldung/spring/jpa/guide}/PersistenceJPAConfig.java (91%) create mode 100644 persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/transaction/FooService.java create mode 100644 persistence-modules/spring-jpa-2/src/main/resources/application.properties rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/main/resources/hibernate5Configuration.xml (100%) rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/main/resources/persistence-h2.properties (100%) rename persistence-modules/{spring-persistence-simple/src/main/resources/persistence.xml => spring-jpa-2/src/main/resources/persistence-jpa-config.xml} (88%) rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/main/resources/persistence-mysql.properties (100%) rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/test/java/com/baeldung/hibernate/bootstrap/HibernateBootstrapIntegrationTest.java (100%) rename persistence-modules/{spring-persistence-simple => spring-jpa-2}/src/test/java/com/baeldung/hibernate/bootstrap/HibernateXMLBootstrapIntegrationTest.java (100%) rename persistence-modules/spring-jpa/src/main/java/com/baeldung/{ => spring}/jdbc/autogenkey/config/PersistenceConfig.java (94%) rename persistence-modules/spring-jpa/src/main/java/com/baeldung/{ => spring}/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java (92%) rename persistence-modules/spring-jpa/src/main/java/com/baeldung/{ => spring}/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java (90%) rename persistence-modules/spring-jpa/src/test/java/com/baeldung/{ => spring}/jdbc/autogenkey/GetAutoGenKeyByJDBC.java (79%) rename persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/{ => spring}/jdbc/Employee.java (95%) rename persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/{ => spring}/jdbc/EmployeeDAO.java (98%) rename persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/{ => spring}/jdbc/EmployeeDAOUnitTest.java (99%) delete mode 100644 persistence-modules/spring-persistence-simple/.gitignore delete mode 100644 persistence-modules/spring-persistence-simple/README.md delete mode 100644 persistence-modules/spring-persistence-simple/pom.xml delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceConfig.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/FooDao.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Bar.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/service/FooService.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Possession.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCustomImpl.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/IFooService.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/common/AbstractService.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/impl/FooService.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/util/IDUtil.java delete mode 100644 persistence-modules/spring-persistence-simple/src/main/resources/hibernate5Config.xml delete mode 100644 persistence-modules/spring-persistence-simple/src/main/resources/jdbc/springJdbc-config.xml delete mode 100644 persistence-modules/spring-persistence-simple/src/main/resources/logback.xml delete mode 100644 persistence-modules/spring-persistence-simple/src/main/resources/stored_procedure.sql delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooPaginationPersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServiceSortingIntegrationTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServiceSortingWitNullsManualIntegrationTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/transactional/FooTransactionalUnitTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/transactional/PersistenceTransactionalTestConfig.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCommon.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/repository/UserRepositoryIntegrationTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/service/AbstractServicePersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/service/FooServicePersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-persistence-simple/src/test/resources/.gitignore diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/BatchProcessing.java similarity index 99% rename from persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/BatchProcessing.java index ad6a064c98..51b27ef5f4 100644 --- a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/BatchProcessing.java +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/BatchProcessing.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import java.sql.*; import java.util.UUID; diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/Employee.java similarity index 97% rename from persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/Employee.java index 27aef8b82f..99e5a1ad4a 100644 --- a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/Employee.java +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/Employee.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import java.util.Objects; diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/joins/ArticleWithAuthor.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthor.java similarity index 96% rename from persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/joins/ArticleWithAuthor.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthor.java index 5ce196ee47..bbcbb5871e 100644 --- a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/joins/ArticleWithAuthor.java +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthor.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc.joins; +package com.baeldung.spring.jdbc.joins; class ArticleWithAuthor { diff --git a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/joins/ArticleWithAuthorDAO.java b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthorDAO.java similarity index 98% rename from persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/joins/ArticleWithAuthorDAO.java rename to persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthorDAO.java index 55f03d99ec..48961b786f 100644 --- a/persistence-modules/core-java-persistence/src/main/java/com/baeldung/jdbc/joins/ArticleWithAuthorDAO.java +++ b/persistence-modules/core-java-persistence/src/main/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthorDAO.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc.joins; +package com.baeldung.spring.jdbc.joins; import java.sql.Connection; import java.sql.ResultSet; diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/BatchProcessingLiveTest.java similarity index 98% rename from persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/BatchProcessingLiveTest.java index c905482f55..3cb5e779f5 100644 --- a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/BatchProcessingLiveTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/BatchProcessingLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import org.junit.Before; diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcDriverLoadingUnitTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/JdbcDriverLoadingUnitTest.java similarity index 98% rename from persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcDriverLoadingUnitTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/JdbcDriverLoadingUnitTest.java index 387c050285..937cf1b833 100644 --- a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcDriverLoadingUnitTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/JdbcDriverLoadingUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import static org.junit.Assert.*; diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/JdbcLiveTest.java similarity index 99% rename from persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/JdbcLiveTest.java index 81179aade9..c13f94f12a 100644 --- a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/JdbcLiveTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/JdbcLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import org.apache.log4j.Logger; import org.junit.After; diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/ResultSetLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/ResultSetLiveTest.java similarity index 99% rename from persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/ResultSetLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/ResultSetLiveTest.java index 4e10f8bd43..853e78a68d 100644 --- a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/ResultSetLiveTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/ResultSetLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import static org.junit.Assert.assertEquals; diff --git a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/joins/ArticleWithAuthorDAOLiveTest.java b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthorDAOLiveTest.java similarity index 99% rename from persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/joins/ArticleWithAuthorDAOLiveTest.java rename to persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthorDAOLiveTest.java index 3f69a0e333..055c7ed9ed 100644 --- a/persistence-modules/core-java-persistence/src/test/java/com/baeldung/jdbc/joins/ArticleWithAuthorDAOLiveTest.java +++ b/persistence-modules/core-java-persistence/src/test/java/com/baeldung/spring/jdbc/joins/ArticleWithAuthorDAOLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc.joins; +package com.baeldung.spring.jdbc.joins; import org.junit.After; import org.junit.Before; diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 468d50b458..1a5ca8df70 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -70,6 +70,7 @@ spring-data-jpa-query spring-data-jpa-query-2 spring-data-jpa-repo + spring-data-jpa-repo-2 spring-data-jdbc @@ -83,8 +84,8 @@ spring-hibernate4 spring-jpa spring-jpa-2 + spring-jdbc - spring-persistence-simple spring-persistence-simple-2 diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/User.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/User.java similarity index 89% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/User.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/User.java index 1475eccbf0..179dbf2ae7 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/User.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/User.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.data.persistence.model; +package com.baeldung.spring.data.jpa.query; import javax.persistence.*; import java.time.LocalDate; @@ -8,7 +8,6 @@ import java.util.Objects; @Entity @Table(name = "users") public class User { - @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @@ -28,9 +27,6 @@ public class User { private Integer status; - @OneToMany - List possessionList; - public User() { super(); } @@ -87,12 +83,20 @@ public class User { return creationDate; } - public List getPossessionList() { - return possessionList; + public LocalDate getLastLoginDate() { + return lastLoginDate; } - public void setPossessionList(List possessionList) { - this.possessionList = possessionList; + public void setLastLoginDate(LocalDate lastLoginDate) { + this.lastLoginDate = lastLoginDate; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; } @Override @@ -119,21 +123,4 @@ public class User { public int hashCode() { return Objects.hash(id, name, creationDate, age, email, status); } - - public LocalDate getLastLoginDate() { - return lastLoginDate; - } - - public void setLastLoginDate(LocalDate lastLoginDate) { - this.lastLoginDate = lastLoginDate; - } - - public boolean isActive() { - return active; - } - - public void setActive(boolean active) { - this.active = active; - } - } \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepository.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepository.java similarity index 65% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepository.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepository.java index a8e3a536c3..6547e0ef66 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepository.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepository.java @@ -1,6 +1,5 @@ -package com.baeldung.spring.data.persistence.repository; +package com.baeldung.spring.data.jpa.query; -import com.baeldung.spring.data.persistence.model.User; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; @@ -9,51 +8,16 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; -import java.time.LocalDate; import java.util.Collection; import java.util.List; -import java.util.stream.Stream; public interface UserRepository extends JpaRepository, UserRepositoryCustom { - - Stream findAllByName(String name); - @Query("SELECT u FROM User u WHERE u.status = 1") Collection findAllActiveUsers(); - @Query("select u from User u where u.email like '%@gmail.com'") - List findUsersWithGmailAddress(); - @Query(value = "SELECT * FROM Users u WHERE u.status = 1", nativeQuery = true) Collection findAllActiveUsersNative(); - @Query("SELECT u FROM User u WHERE u.status = ?1") - User findUserByStatus(Integer status); - - @Query(value = "SELECT * FROM Users u WHERE u.status = ?1", nativeQuery = true) - User findUserByStatusNative(Integer status); - - @Query("SELECT u FROM User u WHERE u.status = ?1 and u.name = ?2") - User findUserByStatusAndName(Integer status, String name); - - @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") - User findUserByStatusAndNameNamedParams(@Param("status") Integer status, @Param("name") String name); - - @Query(value = "SELECT * FROM Users u WHERE u.status = :status AND u.name = :name", nativeQuery = true) - User findUserByStatusAndNameNamedParamsNative(@Param("status") Integer status, @Param("name") String name); - - @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") - User findUserByUserStatusAndUserName(@Param("status") Integer userStatus, @Param("name") String userName); - - @Query("SELECT u FROM User u WHERE u.name like ?1%") - User findUserByNameLike(String name); - - @Query("SELECT u FROM User u WHERE u.name like :name%") - User findUserByNameLikeNamedParam(@Param("name") String name); - - @Query(value = "SELECT * FROM users u WHERE u.name LIKE ?1%", nativeQuery = true) - User findUserByNameLikeNative(String name); - @Query(value = "SELECT u FROM User u") List findAllUsers(Sort sort); @@ -63,6 +27,27 @@ public interface UserRepository extends JpaRepository, UserReposi @Query(value = "SELECT * FROM Users ORDER BY id", countQuery = "SELECT count(*) FROM Users", nativeQuery = true) Page findAllUsersWithPaginationNative(Pageable pageable); + @Query("SELECT u FROM User u WHERE u.status = ?1") + User findUserByStatus(Integer status); + + @Query("SELECT u FROM User u WHERE u.status = ?1 and u.name = ?2") + User findUserByStatusAndName(Integer status, String name); + + @Query(value = "SELECT * FROM Users u WHERE u.status = ?1", nativeQuery = true) + User findUserByStatusNative(Integer status); + + @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") + User findUserByStatusAndNameNamedParams(@Param("status") Integer status, @Param("name") String name); + + @Query("SELECT u FROM User u WHERE u.status = :status and u.name = :name") + User findUserByUserStatusAndUserName(@Param("status") Integer userStatus, @Param("name") String userName); + + @Query(value = "SELECT * FROM Users u WHERE u.status = :status AND u.name = :name", nativeQuery = true) + User findUserByStatusAndNameNamedParamsNative(@Param("status") Integer status, @Param("name") String name); + + @Query(value = "SELECT u FROM User u WHERE u.name IN :names") + List findUserByNameList(@Param("names") Collection names); + @Modifying @Query("update User u set u.status = :status where u.name = :name") int updateUserSetStatusForName(@Param("status") Integer status, @Param("name") String name); @@ -74,25 +59,4 @@ public interface UserRepository extends JpaRepository, UserReposi @Query(value = "INSERT INTO Users (name, age, email, status, active) VALUES (:name, :age, :email, :status, :active)", nativeQuery = true) @Modifying void insertUser(@Param("name") String name, @Param("age") Integer age, @Param("email") String email, @Param("status") Integer status, @Param("active") boolean active); - - @Modifying - @Query(value = "UPDATE Users u SET status = ? WHERE u.name = ?", nativeQuery = true) - int updateUserSetStatusForNameNativePostgres(Integer status, String name); - - @Query(value = "SELECT u FROM User u WHERE u.name IN :names") - List findUserByNameList(@Param("names") Collection names); - - void deleteAllByCreationDateAfter(LocalDate date); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query("update User u set u.active = false where u.lastLoginDate < :date") - void deactivateUsersNotLoggedInSince(@Param("date") LocalDate date); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query("delete User u where u.active = false") - int deleteDeactivatedUsers(); - - @Modifying(clearAutomatically = true, flushAutomatically = true) - @Query(value = "alter table USERS add column deleted int(1) not null default 0", nativeQuery = true) - void addDeletedColumn(); } diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCustom.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepositoryCustom.java similarity index 72% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCustom.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepositoryCustom.java index 77e661bbbe..a3e53528f7 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCustom.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepositoryCustom.java @@ -1,6 +1,4 @@ -package com.baeldung.spring.data.persistence.repository; - -import com.baeldung.spring.data.persistence.model.User; +package com.baeldung.spring.data.jpa.query; import java.util.Collection; import java.util.List; diff --git a/persistence-modules/spring-data-jpa-repo-2/pom.xml b/persistence-modules/spring-data-jpa-repo-2/pom.xml new file mode 100644 index 0000000000..855b441074 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-2/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + spring-data-jpa-repo-2 + spring-data-jpa-repo-2 + + + + + javax.persistence + javax.persistence-api + + + org.springframework.data + spring-data-jpa + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + + + com.google.guava + guava + ${guava.version} + + + + + 29.0-jre + + \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Foo.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/Foo.java similarity index 85% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Foo.java rename to persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/Foo.java index 64bfe203d0..6833c4c556 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Foo.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/Foo.java @@ -1,16 +1,10 @@ -package com.baeldung.spring.data.persistence.model; +package com.baeldung.spring.data.persistence.repository; +import javax.persistence.*; import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; - @Entity public class Foo implements Serializable { - @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @@ -28,8 +22,6 @@ public class Foo implements Serializable { this.name = name; } - // API - public long getId() { return id; } @@ -46,8 +38,6 @@ public class Foo implements Serializable { this.name = name; } - // - @Override public int hashCode() { final int prime = 31; @@ -79,5 +69,4 @@ public class Foo implements Serializable { builder.append("Foo [name=").append(name).append("]"); return builder.toString(); } - -} +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/FooService.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/FooService.java new file mode 100644 index 0000000000..cb09a92b82 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/FooService.java @@ -0,0 +1,15 @@ +package com.baeldung.spring.data.persistence.repository; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FooService implements IFooService { + @Autowired + private IFooDAO dao; + + @Override + public Foo create(Foo foo) { + return dao.save(foo); + } +} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/IFooDao.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/IFooDAO.java similarity index 75% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/IFooDao.java rename to persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/IFooDAO.java index 0b750e37e1..20a81e7bfa 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/IFooDao.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/IFooDAO.java @@ -1,13 +1,13 @@ package com.baeldung.spring.data.persistence.repository; -import com.baeldung.spring.data.persistence.model.Foo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; -public interface IFooDao extends JpaRepository { +public interface IFooDAO extends JpaRepository { + + Foo findByName(String name); @Query("SELECT f FROM Foo f WHERE LOWER(f.name) = LOWER(:name)") Foo retrieveByName(@Param("name") String name); - } diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/IFooService.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/IFooService.java new file mode 100644 index 0000000000..8ce6a2d1ae --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/IFooService.java @@ -0,0 +1,5 @@ +package com.baeldung.spring.data.persistence.repository; + +public interface IFooService { + Foo create(Foo foo); +} \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/config/PersistenceConfig.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/PersistenceConfig.java similarity index 90% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/config/PersistenceConfig.java rename to persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/PersistenceConfig.java index 604923d615..f73ea94658 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/config/PersistenceConfig.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/repository/PersistenceConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.data.persistence.config; +package com.baeldung.spring.data.persistence.repository; import com.google.common.base.Preconditions; import org.springframework.beans.factory.annotation.Autowired; @@ -20,11 +20,11 @@ import javax.sql.DataSource; import java.util.Properties; @Configuration +@PropertySource("classpath:persistence.properties") +@ComponentScan("com.baeldung.spring.data.persistence.repository") +//@ImportResource("classpath*:*springDataConfig.xml") @EnableTransactionManagement -@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" }) -@ComponentScan({ "com.baeldung.spring.data.persistence" }) -//@ImportResource("classpath*:*springDataJpaRepositoriesConfig.xml") -@EnableJpaRepositories("com.baeldung.spring.data.persistence.repository") +@EnableJpaRepositories(basePackages = "com.baeldung.spring.data.persistence.repository") public class PersistenceConfig { @Autowired @@ -38,7 +38,7 @@ public class PersistenceConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan("com.baeldung.spring.data.persistence.model"); + em.setPackagesToScan("com.baeldung.spring.data.persistence.repository"); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); @@ -78,5 +78,4 @@ public class PersistenceConfig { return hibernateProperties; } - -} \ No newline at end of file +} diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/resources/application.properties b/persistence-modules/spring-data-jpa-repo-2/src/main/resources/application.properties new file mode 100644 index 0000000000..cb1eab9443 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 +spring.datasource.username=sa +spring.datasource.password=sa \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/resources/persistence.properties b/persistence-modules/spring-data-jpa-repo-2/src/main/resources/persistence.properties new file mode 100644 index 0000000000..339859a6e8 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/resources/persistence.properties @@ -0,0 +1,9 @@ +# jdbc.X +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 +jdbc.user=sa +jdbc.pass= + +# hibernate.X +hibernate.hbm2ddl.auto=create-drop +hibernate.dialect=org.hibernate.dialect.H2Dialect diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/springDataJpaRepositoriesConfig.xml b/persistence-modules/spring-data-jpa-repo-2/src/main/resources/springDataConfig.xml similarity index 80% rename from persistence-modules/spring-persistence-simple/src/main/resources/springDataJpaRepositoriesConfig.xml rename to persistence-modules/spring-data-jpa-repo-2/src/main/resources/springDataConfig.xml index 91778a17af..b2616d9eae 100644 --- a/persistence-modules/spring-persistence-simple/src/main/resources/springDataJpaRepositoriesConfig.xml +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/resources/springDataConfig.xml @@ -2,12 +2,10 @@ - - \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-2/src/test/java/com/baeldung/spring/data/persistence/repository/FooServiceIntegrationTest.java b/persistence-modules/spring-data-jpa-repo-2/src/test/java/com/baeldung/spring/data/persistence/repository/FooServiceIntegrationTest.java new file mode 100644 index 0000000000..141844fa11 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-2/src/test/java/com/baeldung/spring/data/persistence/repository/FooServiceIntegrationTest.java @@ -0,0 +1,21 @@ +package com.baeldung.spring.data.persistence.repository; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = PersistenceConfig.class) +public class FooServiceIntegrationTest { + + @Autowired + private IFooService service; + + @Test(expected = DataIntegrityViolationException.class) + public final void whenInvalidEntityIsCreated_thenDataException() { + service.create(new Foo()); + } +} diff --git a/persistence-modules/spring-jdbc/pom.xml b/persistence-modules/spring-jdbc/pom.xml new file mode 100644 index 0000000000..4ac5239318 --- /dev/null +++ b/persistence-modules/spring-jdbc/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + spring-jdbc + spring-jdbc + + + + org.springframework.data + spring-data-jdbc + ${spring-data-jdbc.version} + + + org.springframework.boot + spring-boot-starter-jdbc + + + com.h2database + h2 + + + mysql + mysql-connector-java + runtime + + + + + 2.0.3.RELEASE + + \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/CustomSQLErrorCodeTranslator.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/CustomSQLErrorCodeTranslator.java similarity index 95% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/CustomSQLErrorCodeTranslator.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/CustomSQLErrorCodeTranslator.java index 48ddfb04b1..aa0ffde00c 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/CustomSQLErrorCodeTranslator.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/CustomSQLErrorCodeTranslator.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import java.sql.SQLException; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/Employee.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/Employee.java similarity index 95% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/Employee.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/Employee.java index a43eb265c7..84780e30da 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/Employee.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/Employee.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; public class Employee { private int id; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeDAO.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java similarity index 99% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeDAO.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java index eef085f386..a6d0fe2f3b 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeDAO.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import java.sql.PreparedStatement; import java.sql.SQLException; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeRowMapper.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeRowMapper.java similarity index 94% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeRowMapper.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeRowMapper.java index d09cd45dbc..bf55d6160d 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeRowMapper.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeRowMapper.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/config/SpringJdbcConfig.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/config/SpringJdbcConfig.java similarity index 75% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/config/SpringJdbcConfig.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/config/SpringJdbcConfig.java index ddc24e439f..d7eb039637 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/config/SpringJdbcConfig.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/config/SpringJdbcConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc.config; +package com.baeldung.spring.jdbc.config; import javax.sql.DataSource; @@ -10,12 +10,16 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; @Configuration -@ComponentScan("com.baeldung.jdbc") +@ComponentScan("com.baeldung.spring.jdbc") public class SpringJdbcConfig { @Bean public DataSource dataSource() { - return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).addScript("classpath:jdbc/schema.sql").addScript("classpath:jdbc/test-data.sql").build(); + return new EmbeddedDatabaseBuilder() + .setType(EmbeddedDatabaseType.H2) + .addScript("classpath:jdbc/schema.sql") + .addScript("classpath:jdbc/test-data.sql") + .build(); } // @Bean diff --git a/persistence-modules/spring-jdbc/src/main/resources/application.properties b/persistence-modules/spring-jdbc/src/main/resources/application.properties new file mode 100644 index 0000000000..2f09a522ba --- /dev/null +++ b/persistence-modules/spring-jdbc/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.datasource.url=jdbc:mysql://localhost:3306/springjdbc +spring.datasource.username=guest_user +spring.datasource.password=guest_password \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/schema.sql b/persistence-modules/spring-jdbc/src/main/resources/jdbc/schema.sql similarity index 100% rename from persistence-modules/spring-persistence-simple/src/main/resources/jdbc/schema.sql rename to persistence-modules/spring-jdbc/src/main/resources/jdbc/schema.sql diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/test-data.sql b/persistence-modules/spring-jdbc/src/main/resources/jdbc/test-data.sql similarity index 100% rename from persistence-modules/spring-persistence-simple/src/main/resources/jdbc/test-data.sql rename to persistence-modules/spring-jdbc/src/main/resources/jdbc/test-data.sql diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOIntegrationTest.java b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOIntegrationTest.java similarity index 97% rename from persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOIntegrationTest.java rename to persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOIntegrationTest.java index 453656098a..10f47402be 100644 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOIntegrationTest.java +++ b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOIntegrationTest.java @@ -1,9 +1,9 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import java.util.ArrayList; import java.util.List; -import com.baeldung.jdbc.config.SpringJdbcConfig; +import com.baeldung.spring.jdbc.config.SpringJdbcConfig; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/persistence-modules/spring-jpa-2/pom.xml b/persistence-modules/spring-jpa-2/pom.xml index 08a1f0c6a3..1c21f6b98d 100644 --- a/persistence-modules/spring-jpa-2/pom.xml +++ b/persistence-modules/spring-jpa-2/pom.xml @@ -15,6 +15,17 @@ + + org.springframework.boot + spring-boot-starter + ${spring-boot.version} + + + org.springframework.boot + spring-boot-starter-data-jpa + ${spring-boot.version} + + org.springframework spring-orm @@ -43,8 +54,25 @@ h2 ${h2.version} + + org.apache.tomcat + tomcat-dbcp + ${tomcat-dbcp.version} + + + + + com.google.guava + guava + ${guava.version} + + + org.springframework.boot + spring-boot-starter-test + ${spring-boot.version} + org.springframework spring-test @@ -57,6 +85,13 @@ 5.1.5.RELEASE + + + 9.0.0.M26 + + + 21.0 + 2.2.6.RELEASE \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/BarHibernateDAO.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/BarHibernateDAO.java similarity index 100% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/BarHibernateDAO.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/BarHibernateDAO.java diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/HibernateConf.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/HibernateConf.java similarity index 97% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/HibernateConf.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/HibernateConf.java index 150e3778af..da23803d76 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/HibernateConf.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/HibernateConf.java @@ -51,7 +51,7 @@ public class HibernateConf { return transactionManager; } - private final Properties hibernateProperties() { + private Properties hibernateProperties() { final Properties hibernateProperties = new Properties(); hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/HibernateXMLConf.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/HibernateXMLConf.java similarity index 100% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/HibernateXMLConf.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/HibernateXMLConf.java diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/model/TestEntity.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/model/TestEntity.java similarity index 100% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/bootstrap/model/TestEntity.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/hibernate/bootstrap/model/TestEntity.java diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/AbstractHibernateDao.java similarity index 87% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/AbstractHibernateDao.java index e406f896dc..bd78fe647d 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/AbstractHibernateDao.java @@ -1,52 +1,49 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; -import java.util.List; +package com.baeldung.spring.dao.generics; +import com.google.common.base.Preconditions; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; -import com.google.common.base.Preconditions; +import java.io.Serializable; +import java.util.List; @SuppressWarnings("unchecked") -public abstract class AbstractHibernateDao extends AbstractDao implements IOperations { +public abstract class AbstractHibernateDao { + private Class clazz; @Autowired protected SessionFactory sessionFactory; - // API + public void setClazz(final Class clazzToSet) { + clazz = Preconditions.checkNotNull(clazzToSet); + } - @Override + // API public T findOne(final long id) { return (T) getCurrentSession().get(clazz, id); } - @Override public List findAll() { return getCurrentSession().createQuery("from " + clazz.getName()).list(); } - @Override public T create(final T entity) { Preconditions.checkNotNull(entity); getCurrentSession().saveOrUpdate(entity); return entity; } - @Override public T update(final T entity) { Preconditions.checkNotNull(entity); return (T) getCurrentSession().merge(entity); } - @Override public void delete(final T entity) { Preconditions.checkNotNull(entity); getCurrentSession().delete(entity); } - @Override public void deleteById(final long entityId) { final T entity = findOne(entityId); Preconditions.checkState(entity != null); @@ -56,5 +53,4 @@ public abstract class AbstractHibernateDao extends Abstr protected Session getCurrentSession() { return sessionFactory.getCurrentSession(); } - } \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/AbstractJpaDAO.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/AbstractJpaDAO.java similarity index 96% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/AbstractJpaDAO.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/AbstractJpaDAO.java index a6542c5cb1..e68a9281a0 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/AbstractJpaDAO.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/AbstractJpaDAO.java @@ -1,4 +1,4 @@ -package com.baeldung.jpa.dao; +package com.baeldung.spring.dao.generics; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @@ -6,7 +6,6 @@ import java.io.Serializable; import java.util.List; public abstract class AbstractJpaDAO { - private Class clazz; @PersistenceContext(unitName = "entityManagerFactory") @@ -42,5 +41,4 @@ public abstract class AbstractJpaDAO { final T entity = findOne(entityId); delete(entity); } - } \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Foo.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/Foo.java similarity index 82% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Foo.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/Foo.java index 009876f8cb..7849abb25f 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Foo.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/Foo.java @@ -1,21 +1,10 @@ -package com.baeldung.persistence.model; - -import java.io.Serializable; - -import javax.persistence.Cacheable; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.NamedNativeQueries; -import javax.persistence.NamedNativeQuery; +package com.baeldung.spring.dao.generics; import org.hibernate.annotations.CacheConcurrencyStrategy; +import javax.persistence.*; +import java.io.Serializable; + @Entity @Cacheable @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE) diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/FooService.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/FooService.java new file mode 100644 index 0000000000..4c2014c717 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/FooService.java @@ -0,0 +1,21 @@ +package com.baeldung.spring.dao.generics; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class FooService implements IFooService { + + IGenericDao dao; + + @Autowired + public void setDao(IGenericDao daoToSet) { + dao = daoToSet; + dao.setClazz(Foo.class); + } + + @Override + public Foo retrieveByName(String name) { + return null; + } +} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/GenericHibernateDao.java similarity index 89% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/GenericHibernateDao.java index 18b16fa033..619a144176 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/GenericHibernateDao.java @@ -1,11 +1,11 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; +package com.baeldung.spring.dao.generics; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; +import java.io.Serializable; + @Repository @Scope(BeanDefinition.SCOPE_PROTOTYPE) public class GenericHibernateDao extends AbstractHibernateDao implements IGenericDao { diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericJpaDao.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/GenericJpaDao.java similarity index 79% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericJpaDao.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/GenericJpaDao.java index d4da194f4d..cf89b05f96 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericJpaDao.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/GenericJpaDao.java @@ -1,12 +1,10 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; +package com.baeldung.spring.dao.generics; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; -import com.baeldung.jpa.dao.AbstractJpaDAO; +import java.io.Serializable; @Repository @Scope(BeanDefinition.SCOPE_PROTOTYPE) diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/IFooService.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/IFooService.java new file mode 100644 index 0000000000..2d525de405 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/IFooService.java @@ -0,0 +1,5 @@ +package com.baeldung.spring.dao.generics; + +public interface IFooService { + Foo retrieveByName(String name); +} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/IOperations.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/IGenericDao.java similarity index 64% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/IOperations.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/IGenericDao.java index 34c5e0f616..3fd7baf63f 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/IOperations.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/IGenericDao.java @@ -1,9 +1,10 @@ -package com.baeldung.persistence.dao.common; +package com.baeldung.spring.dao.generics; import java.io.Serializable; import java.util.List; -public interface IOperations { +public interface IGenericDao { + void setClazz(Class< T > clazzToSet); T findOne(final long id); @@ -16,5 +17,4 @@ public interface IOperations { void delete(final T entity); void deleteById(final long entityId); - } diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/AbstractHibernateDao.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/AbstractHibernateDao.java new file mode 100644 index 0000000000..c0a99e92c8 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/AbstractHibernateDao.java @@ -0,0 +1,56 @@ +package com.baeldung.spring.hibernate; + +import com.google.common.base.Preconditions; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import java.io.Serializable; +import java.util.List; + +@SuppressWarnings("unchecked") +public abstract class AbstractHibernateDao { + private Class clazz; + + @Autowired + protected SessionFactory sessionFactory; + + protected final void setClazz(final Class clazzToSet) { + clazz = Preconditions.checkNotNull(clazzToSet); + } + + // API + public T findOne(final long id) { + return (T) getCurrentSession().get(clazz, id); + } + + public List findAll() { + return getCurrentSession().createQuery("from " + clazz.getName()).list(); + } + + public T create(final T entity) { + Preconditions.checkNotNull(entity); + getCurrentSession().saveOrUpdate(entity); + return entity; + } + + public T update(final T entity) { + Preconditions.checkNotNull(entity); + return (T) getCurrentSession().merge(entity); + } + + public void delete(final T entity) { + Preconditions.checkNotNull(entity); + getCurrentSession().delete(entity); + } + + public void deleteById(final long entityId) { + final T entity = findOne(entityId); + Preconditions.checkState(entity != null); + delete(entity); + } + + protected Session getCurrentSession() { + return sessionFactory.getCurrentSession(); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/Foo.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/Foo.java new file mode 100644 index 0000000000..f92b510071 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/Foo.java @@ -0,0 +1,42 @@ +package com.baeldung.spring.hibernate; + +import javax.persistence.*; +import java.io.Serializable; + +@Entity +public class Foo implements Serializable { + private static final long serialVersionUID = 1L; + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + + this.name = name; + } + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "ID") + private Long id; + @Column(name = "NAME") + private String name; + + public Long getId() { + return id; + } + + public void setId(final Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } +} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/dao/FooDao.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/FooDao.java similarity index 55% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/dao/FooDao.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/FooDao.java index 67c10fe7fe..d5495d4eb1 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/dao/FooDao.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/FooDao.java @@ -1,14 +1,9 @@ -package com.baeldung.hibernate.dao; +package com.baeldung.spring.hibernate; -import com.baeldung.persistence.model.Foo; import org.springframework.stereotype.Repository; -import com.baeldung.jpa.dao.IFooDao; -import com.baeldung.persistence.dao.common.AbstractHibernateDao; - @Repository public class FooDao extends AbstractHibernateDao implements IFooDao { - public FooDao() { super(); @@ -16,5 +11,4 @@ public class FooDao extends AbstractHibernateDao implements IFooDao { } // API - } diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/IFooDao.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/IFooDao.java similarity index 65% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/IFooDao.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/IFooDao.java index 8140c56edd..d397163be5 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/IFooDao.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/hibernate/IFooDao.java @@ -1,21 +1,15 @@ -package com.baeldung.jpa.dao; +package com.baeldung.spring.hibernate; import java.util.List; -import com.baeldung.persistence.model.Foo; - public interface IFooDao { - Foo findOne(long id); List findAll(); - Foo create(Foo entity); - Foo update(Foo entity); void delete(Foo entity); void deleteById(long entityId); - } diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceJPAConfig.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/jpa/guide/PersistenceJPAConfig.java similarity index 91% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceJPAConfig.java rename to persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/jpa/guide/PersistenceJPAConfig.java index e8a2aefd6b..497d735c10 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceJPAConfig.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/jpa/guide/PersistenceJPAConfig.java @@ -1,9 +1,8 @@ -package com.baeldung.config; +package com.baeldung.spring.jpa.guide; import com.google.common.base.Preconditions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; @@ -21,17 +20,12 @@ import java.util.Properties; @Configuration @EnableTransactionManagement -@PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "com.baeldung.persistence","com.baeldung.jpa.dao" }) +@PropertySource("classpath:persistence-h2.properties") public class PersistenceJPAConfig { @Autowired private Environment env; - public PersistenceJPAConfig() { - super(); - } - // beans @Bean @@ -75,9 +69,7 @@ public class PersistenceJPAConfig { hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", "false"); - - + return hibernateProperties; } - } \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/transaction/FooService.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/transaction/FooService.java new file mode 100644 index 0000000000..407d8e3394 --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/transaction/FooService.java @@ -0,0 +1,8 @@ +package com.baeldung.spring.transaction; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +public class FooService {} \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/src/main/resources/application.properties b/persistence-modules/spring-jpa-2/src/main/resources/application.properties new file mode 100644 index 0000000000..0270c1683e --- /dev/null +++ b/persistence-modules/spring-jpa-2/src/main/resources/application.properties @@ -0,0 +1,11 @@ +# H2 +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 + +# MySQL +#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +#spring.datasource.username=mysqluser +#spring.datasource.password=mysqlpass +#spring.datasource.url=jdbc:mysql://localhost:3306/myDb?createDatabaseIfNotExist=true diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/hibernate5Configuration.xml b/persistence-modules/spring-jpa-2/src/main/resources/hibernate5Configuration.xml similarity index 100% rename from persistence-modules/spring-persistence-simple/src/main/resources/hibernate5Configuration.xml rename to persistence-modules/spring-jpa-2/src/main/resources/hibernate5Configuration.xml diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/persistence-h2.properties b/persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties similarity index 100% rename from persistence-modules/spring-persistence-simple/src/main/resources/persistence-h2.properties rename to persistence-modules/spring-jpa-2/src/main/resources/persistence-h2.properties diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/persistence.xml b/persistence-modules/spring-jpa-2/src/main/resources/persistence-jpa-config.xml similarity index 88% rename from persistence-modules/spring-persistence-simple/src/main/resources/persistence.xml rename to persistence-modules/spring-jpa-2/src/main/resources/persistence-jpa-config.xml index 57687c306d..54774442c6 100644 --- a/persistence-modules/spring-persistence-simple/src/main/resources/persistence.xml +++ b/persistence-modules/spring-jpa-2/src/main/resources/persistence-jpa-config.xml @@ -6,7 +6,6 @@ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd" > - @@ -14,8 +13,6 @@ - diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/persistence-mysql.properties b/persistence-modules/spring-jpa-2/src/main/resources/persistence-mysql.properties similarity index 100% rename from persistence-modules/spring-persistence-simple/src/main/resources/persistence-mysql.properties rename to persistence-modules/spring-jpa-2/src/main/resources/persistence-mysql.properties diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/hibernate/bootstrap/HibernateBootstrapIntegrationTest.java b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/hibernate/bootstrap/HibernateBootstrapIntegrationTest.java similarity index 100% rename from persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/hibernate/bootstrap/HibernateBootstrapIntegrationTest.java rename to persistence-modules/spring-jpa-2/src/test/java/com/baeldung/hibernate/bootstrap/HibernateBootstrapIntegrationTest.java diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/hibernate/bootstrap/HibernateXMLBootstrapIntegrationTest.java b/persistence-modules/spring-jpa-2/src/test/java/com/baeldung/hibernate/bootstrap/HibernateXMLBootstrapIntegrationTest.java similarity index 100% rename from persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/hibernate/bootstrap/HibernateXMLBootstrapIntegrationTest.java rename to persistence-modules/spring-jpa-2/src/test/java/com/baeldung/hibernate/bootstrap/HibernateXMLBootstrapIntegrationTest.java diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/config/PersistenceConfig.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java similarity index 94% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/config/PersistenceConfig.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java index 99f50abf4c..d1f8864357 100644 --- a/persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/config/PersistenceConfig.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc.autogenkey.config; +package com.baeldung.spring.jdbc.autogenkey.config; import javax.sql.DataSource; diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java similarity index 92% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java index cf0dbe4681..0f47473bd7 100644 --- a/persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc.autogenkey.repository; +package com.baeldung.spring.jdbc.autogenkey.repository; import java.sql.PreparedStatement; diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java b/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java similarity index 90% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java rename to persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java index 022ea29ed6..247fbf28c2 100644 --- a/persistence-modules/spring-jpa/src/main/java/com/baeldung/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java +++ b/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc.autogenkey.repository; +package com.baeldung.spring.jdbc.autogenkey.repository; import java.util.HashMap; import java.util.Map; diff --git a/persistence-modules/spring-jpa/src/test/java/com/baeldung/jdbc/autogenkey/GetAutoGenKeyByJDBC.java b/persistence-modules/spring-jpa/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java similarity index 79% rename from persistence-modules/spring-jpa/src/test/java/com/baeldung/jdbc/autogenkey/GetAutoGenKeyByJDBC.java rename to persistence-modules/spring-jpa/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java index aa4d061997..f0ad853c2a 100644 --- a/persistence-modules/spring-jpa/src/test/java/com/baeldung/jdbc/autogenkey/GetAutoGenKeyByJDBC.java +++ b/persistence-modules/spring-jpa/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc.autogenkey; +package com.baeldung.spring.jdbc.autogenkey; import static org.junit.Assert.assertEquals; @@ -9,14 +9,14 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.jdbc.autogenkey.repository.MessageRepositoryJDBCTemplate; -import com.baeldung.jdbc.autogenkey.repository.MessageRepositorySimpleJDBCInsert; +import com.baeldung.spring.jdbc.autogenkey.repository.MessageRepositoryJDBCTemplate; +import com.baeldung.spring.jdbc.autogenkey.repository.MessageRepositorySimpleJDBCInsert; @RunWith(SpringRunner.class) public class GetAutoGenKeyByJDBC { @Configuration - @ComponentScan(basePackages = { "com.baeldung.jdbc.autogenkey" }) + @ComponentScan(basePackages = {"com.baeldung.spring.jdbc.autogenkey"}) public static class SpringConfig { } diff --git a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/Employee.java b/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/Employee.java similarity index 95% rename from persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/Employee.java rename to persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/Employee.java index bd6fe0fb15..adc2255ca4 100644 --- a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/Employee.java +++ b/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/Employee.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; public class Employee { private int id; diff --git a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java b/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java similarity index 98% rename from persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java rename to persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java index 2ea42381eb..6e2ad9682d 100644 --- a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java +++ b/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import java.util.ArrayList; import java.util.Collections; diff --git a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java b/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOUnitTest.java similarity index 99% rename from persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java rename to persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOUnitTest.java index 369725bafd..bbc688293b 100644 --- a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java +++ b/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jdbc; +package com.baeldung.spring.jdbc; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/persistence-modules/spring-persistence-simple/.gitignore b/persistence-modules/spring-persistence-simple/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/persistence-modules/spring-persistence-simple/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.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/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md deleted file mode 100644 index d665433eef..0000000000 --- a/persistence-modules/spring-persistence-simple/README.md +++ /dev/null @@ -1,25 +0,0 @@ -========= - -## Spring Persistence Example Project - - -### Relevant Articles: -- [A Guide to JPA with Spring](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) -- [Bootstrapping Hibernate 5 with Spring](http://www.baeldung.com/hibernate-5-spring) -- [The DAO with Spring and Hibernate](https://www.baeldung.com/persistence-layer-with-spring-and-hibernate) -- [Simplify the DAO with Spring and Java Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) -- [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) -- [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) -- [Spring Data JPA @Query](http://www.baeldung.com/spring-data-jpa-query) -- [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate) -- [Transaction Propagation and Isolation in Spring @Transactional](https://www.baeldung.com/spring-transactional-propagation-isolation) - -### Eclipse Config -After importing the project into Eclipse, you may see the following error: -"No persistence xml file found in project" - -This can be ignored: -- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" -Or: -- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator - diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml deleted file mode 100644 index 7318ec55bd..0000000000 --- a/persistence-modules/spring-persistence-simple/pom.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - 4.0.0 - spring-persistence-simple - 0.1-SNAPSHOT - spring-persistence-simple - - - com.baeldung - persistence-modules - 1.0.0-SNAPSHOT - - - - - - org.springframework - spring-orm - ${org.springframework.version} - - - org.springframework - spring-context - ${org.springframework.version} - - - org.springframework - spring-aspects - ${org.springframework.version} - - - - org.hibernate - hibernate-core - ${hibernate.version} - - - javax.transaction - jta - ${jta.version} - - - org.hibernate - hibernate-entitymanager - ${hibernate.version} - - - mysql - mysql-connector-java - ${mysql-connector-java.version} - runtime - - - org.springframework.data - spring-data-jpa - ${spring-data-jpa.version} - - - com.h2database - h2 - ${h2.version} - - - - org.apache.tomcat - tomcat-dbcp - ${tomcat-dbcp.version} - - - - - - com.google.guava - guava - ${guava.version} - - - org.assertj - assertj-core - ${assertj.version} - - - - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - test - - - - org.springframework - spring-test - ${org.springframework.version} - test - - - com.querydsl - querydsl-jpa - ${querydsl.version} - - - com.querydsl - querydsl-apt - ${querydsl.version} - - - - - - - com.mysema.maven - apt-maven-plugin - ${apt-maven-plugin.version} - - - generate-sources - - process - - - target/generated-sources - com.querydsl.apt.jpa.JPAAnnotationProcessor - - - - - - - - - - 5.2.6.RELEASE - - - 5.4.13.Final - 8.0.19 - 1.4.200 - 2.2.7.RELEASE - 9.0.0.M26 - 1.1 - 4.2.1 - - - 21.0 - 3.8.0 - 1.1.3 - - - \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceConfig.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceConfig.java deleted file mode 100644 index cdddbaa787..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceConfig.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.baeldung.config; - -import com.baeldung.persistence.service.FooService; -import com.google.common.base.Preconditions; -import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; -import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.orm.hibernate5.HibernateTransactionManager; -import org.springframework.orm.hibernate5.LocalSessionFactoryBean; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.JpaVendorAdapter; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.sql.DataSource; -import java.util.Properties; - -@Configuration -@EnableTransactionManagement -@EnableJpaAuditing -@PropertySource({ "classpath:persistence-mysql.properties" }) -@ComponentScan(basePackages = { "com.baeldung.persistence.dao", "com.baeldung.jpa.dao" }) -public class PersistenceConfig { - - @Autowired - private Environment env; - - public PersistenceConfig() { - super(); - } - - @Bean - public LocalSessionFactoryBean sessionFactory() { - final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); - sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan("com.baeldung.persistence.model"); - sessionFactory.setHibernateProperties(hibernateProperties()); - - return sessionFactory; - } - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); - emf.setDataSource(restDataSource()); - emf.setPackagesToScan("com.baeldung.persistence.model"); - - final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - emf.setJpaVendorAdapter(vendorAdapter); - emf.setJpaProperties(hibernateProperties()); - - return emf; - } - - @Bean - public DataSource restDataSource() { - final BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Bean - public PlatformTransactionManager hibernateTransactionManager() { - final HibernateTransactionManager transactionManager = new HibernateTransactionManager(); - transactionManager.setSessionFactory(sessionFactory().getObject()); - return transactionManager; - } - - @Bean - public PlatformTransactionManager jpaTransactionManager() { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); - return transactionManager; - } - - @Bean - public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { - return new PersistenceExceptionTranslationPostProcessor(); - } - - @Bean - public FooService fooService() { - return new FooService(); - } - - private Properties hibernateProperties() { - final Properties hibernateProperties = new Properties(); - hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); - hibernateProperties.setProperty("hibernate.show_sql", "true"); - - // Envers properties - hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix")); - - return hibernateProperties; - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/FooDao.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/FooDao.java deleted file mode 100644 index e79a44a0c2..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/FooDao.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.jpa.dao; - -import com.baeldung.persistence.model.Foo; -import org.springframework.stereotype.Repository; - -@Repository -public class FooDao extends AbstractJpaDAO implements IFooDao { - - public FooDao() { - super(); - - setClazz(Foo.class); - } - - // API - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java deleted file mode 100644 index 5a6c76a93a..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; - -import com.google.common.base.Preconditions; - -public abstract class AbstractDao implements IOperations { - - protected Class clazz; - - protected final void setClazz(final Class clazzToSet) { - clazz = Preconditions.checkNotNull(clazzToSet); - } -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java deleted file mode 100644 index 8d8af18394..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; - -public interface IGenericDao extends IOperations { - // -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Bar.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Bar.java deleted file mode 100644 index 5a88ecc6cf..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Bar.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.baeldung.persistence.model; - -import java.io.Serializable; -import java.util.List; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.OneToMany; -import javax.persistence.OrderBy; - -@Entity -public class Bar implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private long id; - - @Column(nullable = false) - private String name; - - @OneToMany(mappedBy = "bar", fetch = FetchType.EAGER, cascade = CascadeType.ALL) - @OrderBy("name ASC") - List fooList; - - public Bar() { - super(); - } - - public Bar(final String name) { - super(); - - this.name = name; - } - - // API - - public long getId() { - return id; - } - - public void setId(final long id) { - - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public List getFooList() { - return fooList; - } - - public void setFooList(final List fooList) { - this.fooList = fooList; - } - - // - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final Bar other = (Bar) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Bar [name=").append(name).append("]"); - return builder.toString(); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/service/FooService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/service/FooService.java deleted file mode 100644 index efe9743670..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/service/FooService.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.persistence.service; - -import java.util.List; - -import com.baeldung.jpa.dao.IFooDao; -import com.baeldung.persistence.model.Foo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class FooService { - - @Autowired - private IFooDao dao; - - public FooService() { - super(); - } - - // API - - public void create(final Foo entity) { - dao.create(entity); - } - - public Foo findOne(final long id) { - return dao.findOne(id); - } - - public List findAll() { - return dao.findAll(); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Possession.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Possession.java deleted file mode 100644 index 44ca9fc62e..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Possession.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.baeldung.spring.data.persistence.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table -public class Possession { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private long id; - - private String name; - - public Possession() { - super(); - } - - public Possession(final String name) { - super(); - - this.name = name; - } - - public long getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = (prime * result) + (int) (id ^ (id >>> 32)); - result = (prime * result) + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final Possession other = (Possession) obj; - if (id != other.id) { - return false; - } - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Possesion [id=").append(id).append(", name=").append(name).append("]"); - return builder.toString(); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCustomImpl.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCustomImpl.java deleted file mode 100644 index 366b2c54d0..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCustomImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.baeldung.spring.data.persistence.repository; - -import com.baeldung.spring.data.persistence.model.User; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.criteria.*; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class UserRepositoryCustomImpl implements UserRepositoryCustom { - - @PersistenceContext - private EntityManager entityManager; - - @Override - public List findUserByEmails(Set emails) { - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery query = cb.createQuery(User.class); - Root user = query.from(User.class); - - Path emailPath = user.get("email"); - - List predicates = new ArrayList<>(); - for (String email : emails) { - - predicates.add(cb.like(emailPath, email)); - - } - query.select(user) - .where(cb.or(predicates.toArray(new Predicate[predicates.size()]))); - - return entityManager.createQuery(query) - .getResultList(); - } - - @Override - public List findAllUsersByPredicates(Collection> predicates) { - List allUsers = entityManager.createQuery("select u from User u", User.class).getResultList(); - Stream allUsersStream = allUsers.stream(); - for (java.util.function.Predicate predicate : predicates) { - allUsersStream = allUsersStream.filter(predicate); - } - - return allUsersStream.collect(Collectors.toList()); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/IFooService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/IFooService.java deleted file mode 100644 index 00e7ac01e4..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/IFooService.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.spring.data.persistence.service; - -import com.baeldung.spring.data.persistence.model.Foo; - -import com.baeldung.persistence.dao.common.IOperations; - -public interface IFooService extends IOperations { - - Foo retrieveByName(String name); - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/common/AbstractService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/common/AbstractService.java deleted file mode 100644 index 61c7d6fcaa..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/common/AbstractService.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.baeldung.spring.data.persistence.service.common; - -import java.io.Serializable; -import java.util.List; - -import org.springframework.data.repository.PagingAndSortingRepository; -import org.springframework.transaction.annotation.Transactional; - -import com.baeldung.persistence.dao.common.IOperations; -import com.google.common.collect.Lists; - -@Transactional -public abstract class AbstractService implements IOperations { - - // read - one - - @Override - @Transactional(readOnly = true) - public T findOne(final long id) { - return getDao().findById(id).orElse(null); - } - - // read - all - - @Override - @Transactional(readOnly = true) - public List findAll() { - return Lists.newArrayList(getDao().findAll()); - } - - // write - - @Override - public T create(final T entity) { - return getDao().save(entity); - } - - @Override - public T update(final T entity) { - return getDao().save(entity); - } - - @Override - public void delete(T entity) { - getDao().delete(entity); - } - - @Override - public void deleteById(long entityId) { - T entity = findOne(entityId); - delete(entity); - } - - protected abstract PagingAndSortingRepository getDao(); - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/impl/FooService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/impl/FooService.java deleted file mode 100644 index c1406b8602..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/impl/FooService.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.spring.data.persistence.service.impl; - - -import com.baeldung.spring.data.persistence.model.Foo; -import com.baeldung.spring.data.persistence.repository.IFooDao; -import com.baeldung.spring.data.persistence.service.IFooService; -import com.baeldung.spring.data.persistence.service.common.AbstractService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.repository.PagingAndSortingRepository; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service -@Transactional -public class FooService extends AbstractService implements IFooService { - - @Autowired - private IFooDao dao; - - public FooService() { - super(); - } - - // API - - @Override - protected PagingAndSortingRepository getDao() { - return dao; - } - - // custom methods - - @Override - public Foo retrieveByName(final String name) { - return dao.retrieveByName(name); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/util/IDUtil.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/util/IDUtil.java deleted file mode 100644 index 45e72e046d..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/util/IDUtil.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.util; - -import java.util.Random; - -public final class IDUtil { - - private IDUtil() { - throw new AssertionError(); - } - - // API - - public static String randomPositiveLongAsString() { - return Long.toString(randomPositiveLong()); - } - - public static String randomNegativeLongAsString() { - return Long.toString(randomNegativeLong()); - } - - public static long randomPositiveLong() { - long id = new Random().nextLong() * 10000; - id = (id < 0) ? (-1 * id) : id; - return id; - } - - private static long randomNegativeLong() { - long id = new Random().nextLong() * 10000; - id = (id > 0) ? (-1 * id) : id; - return id; - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/hibernate5Config.xml b/persistence-modules/spring-persistence-simple/src/main/resources/hibernate5Config.xml deleted file mode 100644 index 55546a862a..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/resources/hibernate5Config.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - ${hibernate.hbm2ddl.auto} - ${hibernate.dialect} - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/springJdbc-config.xml b/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/springJdbc-config.xml deleted file mode 100644 index e3d7452eb1..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/springJdbc-config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/logback.xml b/persistence-modules/spring-persistence-simple/src/main/resources/logback.xml deleted file mode 100644 index ec0dc2469a..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/resources/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - web - %date [%thread] %-5level %logger{36} - %message%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/stored_procedure.sql b/persistence-modules/spring-persistence-simple/src/main/resources/stored_procedure.sql deleted file mode 100644 index 9cedb75c37..0000000000 --- a/persistence-modules/spring-persistence-simple/src/main/resources/stored_procedure.sql +++ /dev/null @@ -1,20 +0,0 @@ -DELIMITER // - CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255)) - LANGUAGE SQL - DETERMINISTIC - SQL SECURITY DEFINER - BEGIN - SELECT * FROM foo WHERE name = fooName; - END // -DELIMITER ; - - -DELIMITER // - CREATE PROCEDURE GetAllFoos() - LANGUAGE SQL - DETERMINISTIC - SQL SECURITY DEFINER - BEGIN - SELECT * FROM foo; - END // -DELIMITER ; \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooPaginationPersistenceIntegrationTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooPaginationPersistenceIntegrationTest.java deleted file mode 100644 index fbda459d65..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooPaginationPersistenceIntegrationTest.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.baeldung.persistence.service; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.lessThan; -import static org.junit.Assert.assertThat; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Root; - -import com.baeldung.config.PersistenceJPAConfig; -import com.baeldung.persistence.model.Foo; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class) -@DirtiesContext -public class FooPaginationPersistenceIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private FooService fooService; - - @Before - public final void before() { - final int minimalNumberOfEntities = 25; - if (fooService.findAll().size() <= minimalNumberOfEntities) { - for (int i = 0; i < minimalNumberOfEntities; i++) { - fooService.create(new Foo(randomAlphabetic(6))); - } - } - } - - // tests - - @Test - public final void whenContextIsBootstrapped_thenNoExceptions() { - // - } - - @SuppressWarnings("unchecked") - @Test - public final void givenEntitiesExist_whenRetrievingFirstPage_thenCorrect() { - final int pageSize = 10; - - final Query query = entityManager.createQuery("From Foo"); - configurePagination(query, 1, pageSize); - - // When - final List fooList = query.getResultList(); - - // Then - assertThat(fooList, hasSize(pageSize)); - } - - @SuppressWarnings("unchecked") - @Test - public final void givenEntitiesExist_whenRetrievingLastPage_thenCorrect() { - final int pageSize = 10; - final Query queryTotal = entityManager.createQuery("Select count(f.id) from Foo f"); - final long countResult = (long) queryTotal.getSingleResult(); - - final Query query = entityManager.createQuery("Select f from Foo as f order by f.id"); - final int lastPage = (int) ((countResult / pageSize) + 1); - configurePagination(query, lastPage, pageSize); - final List fooList = query.getResultList(); - - // Then - assertThat(fooList, hasSize(lessThan(pageSize + 1))); - } - - @SuppressWarnings("unchecked") - @Test - public final void givenEntitiesExist_whenRetrievingPage_thenCorrect() { - final int pageSize = 10; - - final Query queryIds = entityManager.createQuery("Select f.id from Foo f order by f.name"); - final List fooIds = queryIds.getResultList(); - - final Query query = entityManager.createQuery("Select f from Foo as f where f.id in :ids"); - query.setParameter("ids", fooIds.subList(0, pageSize)); - - final List fooList = query.getResultList(); - - // Then - assertThat(fooList, hasSize(pageSize)); - } - - @Test - public final void givenEntitiesExist_whenRetrievingPageViaCriteria_thenCorrect() { - final int pageSize = 10; - final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); - final CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Foo.class); - final Root from = criteriaQuery.from(Foo.class); - final CriteriaQuery select = criteriaQuery.select(from); - final TypedQuery typedQuery = entityManager.createQuery(select); - typedQuery.setFirstResult(0); - typedQuery.setMaxResults(pageSize); - final List fooList = typedQuery.getResultList(); - - // Then - assertThat(fooList, hasSize(pageSize)); - } - - @Test - public final void givenEntitiesExist_whenRetrievingPageViaCriteria_thenNoExceptions() { - int pageNumber = 1; - final int pageSize = 10; - final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); - - final CriteriaQuery countQuery = criteriaBuilder.createQuery(Long.class); - countQuery.select(criteriaBuilder.count(countQuery.from(Foo.class))); - final Long count = entityManager.createQuery(countQuery).getSingleResult(); - - final CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Foo.class); - final Root from = criteriaQuery.from(Foo.class); - final CriteriaQuery select = criteriaQuery.select(from); - - TypedQuery typedQuery; - while (pageNumber < count.intValue()) { - typedQuery = entityManager.createQuery(select); - typedQuery.setFirstResult(pageNumber - 1); - typedQuery.setMaxResults(pageSize); - System.out.println("Current page: " + typedQuery.getResultList()); - pageNumber += pageSize; - } - - } - - // UTIL - - final int determineLastPage(final int pageSize, final long countResult) { - return (int) (countResult / pageSize) + 1; - } - - final void configurePagination(final Query query, final int pageNumber, final int pageSize) { - query.setFirstResult((pageNumber - 1) * pageSize); - query.setMaxResults(pageSize); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java deleted file mode 100644 index f4b70a7fde..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.baeldung.persistence.service; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; - -import com.baeldung.config.PersistenceJPAConfig; -import com.baeldung.persistence.model.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.dao.InvalidDataAccessApiUsageException; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class) -@DirtiesContext -public class FooServicePersistenceIntegrationTest { - - @Autowired - private FooService service; - - // tests - - @Test - public final void whenContextIsBootstrapped_thenNoExceptions() { - // - } - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Foo(randomAlphabetic(6))); - } - - @Test(expected = DataIntegrityViolationException.class) - public final void whenInvalidEntityIsCreated_thenDataException() { - service.create(new Foo(randomAlphabetic(2048))); - } - - @Test(expected = DataIntegrityViolationException.class) - public final void whenEntityWithLongNameIsCreated_thenDataException() { - service.create(new Foo(randomAlphabetic(2048))); - } - - @Test(expected = InvalidDataAccessApiUsageException.class) - public final void whenSameEntityIsCreatedTwice_thenDataException() { - final Foo entity = new Foo(randomAlphabetic(8)); - service.create(entity); - service.create(entity); - } - - @Test(expected = DataAccessException.class) - public final void temp_whenInvalidEntityIsCreated_thenDataException() { - service.create(new Foo(randomAlphabetic(2048))); - } - - @Test - public final void whenEntityIsCreated_thenFound() { - final Foo fooEntity = new Foo("abc"); - service.create(fooEntity); - final Foo found = service.findOne(fooEntity.getId()); - Assert.assertNotNull(found); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServiceSortingIntegrationTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServiceSortingIntegrationTest.java deleted file mode 100644 index c3db45ab41..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServiceSortingIntegrationTest.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.baeldung.persistence.service; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Root; - -import com.baeldung.config.PersistenceJPAConfig; -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.model.Foo; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class) -@DirtiesContext -@SuppressWarnings("unchecked") -public class FooServiceSortingIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - // tests - - @Test - public final void whenSortingByOneAttributeDefaultOrder_thenPrintSortedResult() { - final String jql = "Select f from Foo as f order by f.id"; - final Query sortQuery = entityManager.createQuery(jql); - final List fooList = sortQuery.getResultList(); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName() + "-------Id:" + foo.getId()); - } - } - - @Test - public final void whenSortingByOneAttributeSetOrder_thenSortedPrintResult() { - final String jql = "Select f from Foo as f order by f.id desc"; - final Query sortQuery = entityManager.createQuery(jql); - final List fooList = sortQuery.getResultList(); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName() + "-------Id:" + foo.getId()); - } - } - - @Test - public final void whenSortingByTwoAttributes_thenPrintSortedResult() { - final String jql = "Select f from Foo as f order by f.name asc, f.id desc"; - final Query sortQuery = entityManager.createQuery(jql); - final List fooList = sortQuery.getResultList(); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName() + "-------Id:" + foo.getId()); - } - } - - @Test - public final void whenSortingFooByBar_thenBarsSorted() { - final String jql = "Select f from Foo as f order by f.name, f.bar.id"; - final Query barJoinQuery = entityManager.createQuery(jql); - final List fooList = barJoinQuery.getResultList(); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName()); - if (foo.getBar() != null) { - System.out.print("-------BarId:" + foo.getBar().getId()); - } - } - } - - @Test - public final void whenSortinfBar_thenPrintBarsSortedWithFoos() { - final String jql = "Select b from Bar as b order by b.id"; - final Query barQuery = entityManager.createQuery(jql); - final List barList = barQuery.getResultList(); - for (final Bar bar : barList) { - System.out.println("Bar Id:" + bar.getId()); - for (final Foo foo : bar.getFooList()) { - System.out.println("FooName:" + foo.getName()); - } - } - } - - @Test - public final void whenSortingFooWithCriteria_thenPrintSortedFoos() { - final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); - final CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Foo.class); - final Root from = criteriaQuery.from(Foo.class); - final CriteriaQuery select = criteriaQuery.select(from); - criteriaQuery.orderBy(criteriaBuilder.asc(from.get("name"))); - final TypedQuery typedQuery = entityManager.createQuery(select); - final List fooList = typedQuery.getResultList(); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName() + "--------Id:" + foo.getId()); - } - } - - @Test - public final void whenSortingFooWithCriteriaAndMultipleAttributes_thenPrintSortedFoos() { - final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); - final CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Foo.class); - final Root from = criteriaQuery.from(Foo.class); - final CriteriaQuery select = criteriaQuery.select(from); - criteriaQuery.orderBy(criteriaBuilder.asc(from.get("name")), criteriaBuilder.desc(from.get("id"))); - final TypedQuery typedQuery = entityManager.createQuery(select); - final List fooList = typedQuery.getResultList(); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName() + "-------Id:" + foo.getId()); - } - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServiceSortingWitNullsManualIntegrationTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServiceSortingWitNullsManualIntegrationTest.java deleted file mode 100644 index 103321fc64..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooServiceSortingWitNullsManualIntegrationTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.baeldung.persistence.service; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.junit.Assert.assertNull; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -import com.baeldung.config.PersistenceJPAConfig; -import com.baeldung.persistence.model.Foo; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class) -@DirtiesContext -public class FooServiceSortingWitNullsManualIntegrationTest { - - @PersistenceContext - private EntityManager entityManager; - - @Autowired - private FooService service; - - // tests - - @SuppressWarnings("unchecked") - @Test - public final void whenSortingByStringNullLast_thenLastNull() { - service.create(new Foo()); - service.create(new Foo(randomAlphabetic(6))); - - final String jql = "Select f from Foo as f order by f.name desc NULLS LAST"; - final Query sortQuery = entityManager.createQuery(jql); - final List fooList = sortQuery.getResultList(); - assertNull(fooList.get(fooList.toArray().length - 1).getName()); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName()); - } - } - - @SuppressWarnings("unchecked") - @Test - public final void whenSortingByStringNullFirst_thenFirstNull() { - service.create(new Foo()); - - final String jql = "Select f from Foo as f order by f.name desc NULLS FIRST"; - final Query sortQuery = entityManager.createQuery(jql); - final List fooList = sortQuery.getResultList(); - assertNull(fooList.get(0).getName()); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName()); - } - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java deleted file mode 100644 index 32a94ea3cb..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.baeldung.persistence.service; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.junit.Assert.assertEquals; - -import java.util.List; - -import com.baeldung.config.PersistenceConfig; -import com.baeldung.persistence.model.Foo; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.exception.SQLGrammarException; -import org.hibernate.query.NativeQuery; -import org.hibernate.query.Query; -import org.junit.After; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class FooStoredProceduresLiveTest { - - private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class); - - @Autowired - private SessionFactory sessionFactory; - - @Autowired - private FooService fooService; - - private Session session; - - @Before - public final void before() { - session = sessionFactory.openSession(); - Assume.assumeTrue(getAllFoosExists()); - Assume.assumeTrue(getFoosByNameExists()); - } - - private boolean getFoosByNameExists() { - try { - @SuppressWarnings("unchecked") - NativeQuery sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - sqlQuery.list(); - return true; - } catch (SQLGrammarException e) { - LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e); - return false; - } - } - - private boolean getAllFoosExists() { - try { - @SuppressWarnings("unchecked") - NativeQuery sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - sqlQuery.list(); - return true; - } catch (SQLGrammarException e) { - LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e); - return false; - } - } - - @After - public final void after() { - session.close(); - } - - @Test - public final void getAllFoosUsingStoredProcedures() { - - fooService.create(new Foo(randomAlphabetic(6))); - - // Stored procedure getAllFoos using createSQLQuery - @SuppressWarnings("unchecked") - NativeQuery sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - List allFoos = sqlQuery.list(); - for (Foo foo : allFoos) { - LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName()); - } - assertEquals(allFoos.size(), fooService.findAll().size()); - - // Stored procedure getAllFoos using a Named Query - @SuppressWarnings("unchecked") - Query namedQuery = session.getNamedQuery("callGetAllFoos"); - List allFoos2 = namedQuery.list(); - for (Foo foo : allFoos2) { - LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName()); - } - assertEquals(allFoos2.size(), fooService.findAll().size()); - } - - @Test - public final void getFoosByNameUsingStoredProcedures() { - - fooService.create(new Foo("NewFooName")); - - // Stored procedure getFoosByName using createSQLQuery() - @SuppressWarnings("unchecked") - Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName"); - List allFoosByName = sqlQuery.list(); - for (Foo foo : allFoosByName) { - LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString()); - } - - // Stored procedure getFoosByName using getNamedQuery() - @SuppressWarnings("unchecked") - Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName"); - List allFoosByName2 = namedQuery.list(); - for (Foo foo : allFoosByName2) { - LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString()); - } - - } -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/transactional/FooTransactionalUnitTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/transactional/FooTransactionalUnitTest.java deleted file mode 100644 index 6f2a499bc5..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/transactional/FooTransactionalUnitTest.java +++ /dev/null @@ -1,250 +0,0 @@ -package com.baeldung.persistence.service.transactional; - -import com.baeldung.persistence.model.Foo; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import org.junit.After; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Repository; -import org.springframework.stereotype.Service; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.transaction.IllegalTransactionStateException; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.transaction.support.TransactionTemplate; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTransactionalTestConfig.class }, loader = AnnotationConfigContextLoader.class) -@DirtiesContext -public class FooTransactionalUnitTest { - - static abstract class BasicFooDao { - @PersistenceContext private EntityManager entityManager; - - public Foo findOne(final long id) { - return entityManager.find(Foo.class, id); - } - - public Foo create(final Foo entity) { - entityManager.persist(entity); - return entity; - } - } - - @Repository - static class RequiredTransactionalFooDao extends BasicFooDao { - @Override - @Transactional(propagation = Propagation.REQUIRED) - public Foo create(Foo entity) { - return super.create(entity); - } - } - - @Repository - static class RequiresNewTransactionalFooDao extends BasicFooDao { - @Override - @Transactional(propagation = Propagation.REQUIRES_NEW) - public Foo create(Foo entity) { - return super.create(entity); - } - } - - @Repository - static class SupportTransactionalFooDao extends BasicFooDao { - @Override - @Transactional(propagation = Propagation.SUPPORTS) - public Foo create(Foo entity) { - return super.create(entity); - } - } - - @Repository - static class MandatoryTransactionalFooDao extends BasicFooDao { - @Override - @Transactional(propagation = Propagation.MANDATORY) - public Foo create(Foo entity) { - return super.create(entity); - } - } - - @Repository - static class SupportTransactionalFooService { - @Transactional(propagation = Propagation.SUPPORTS) - public Foo identity(Foo entity) { - return entity; - } - } - - @Service - static class MandatoryTransactionalFooService { - @Transactional(propagation = Propagation.MANDATORY) - public Foo identity(Foo entity) { - return entity; - } - } - - @Service - static class NotSupportedTransactionalFooService { - @Transactional(propagation = Propagation.NOT_SUPPORTED) - public Foo identity(Foo entity) { - return entity; - } - } - - @Service - static class NeverTransactionalFooService { - @Transactional(propagation = Propagation.NEVER) - public Foo identity(Foo entity) { - return entity; - } - } - - @Autowired private TransactionTemplate transactionTemplate; - - @Autowired private RequiredTransactionalFooDao requiredTransactionalFooDao; - - @Autowired private RequiresNewTransactionalFooDao requiresNewTransactionalFooDao; - - @Autowired private SupportTransactionalFooDao supportTransactionalFooDao; - - @Autowired private MandatoryTransactionalFooDao mandatoryTransactionalFooDao; - - @Autowired private MandatoryTransactionalFooService mandatoryTransactionalFooService; - - @Autowired private NeverTransactionalFooService neverTransactionalFooService; - - @Autowired private NotSupportedTransactionalFooService notSupportedTransactionalFooService; - - @Autowired private SupportTransactionalFooService supportTransactionalFooService; - - @After - public void tearDown(){ - PersistenceTransactionalTestConfig.clearSpy(); - } - - @Test - public void givenRequiredWithNoActiveTransaction_whenCallCreate_thenExpect1NewAnd0Suspend() { - requiredTransactionalFooDao.create(new Foo("baeldung")); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(1, transactionSpy.getCreate()); - } - - - - @Test - public void givenRequiresNewWithNoActiveTransaction_whenCallCreate_thenExpect1NewAnd0Suspend() { - requiresNewTransactionalFooDao.create(new Foo("baeldung")); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(1, transactionSpy.getCreate()); - } - - @Test - public void givenSupportWithNoActiveTransaction_whenCallService_thenExpect0NewAnd0Suspend() { - supportTransactionalFooService.identity(new Foo("baeldung")); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(0, transactionSpy.getCreate()); - } - - @Test(expected = IllegalTransactionStateException.class) - public void givenMandatoryWithNoActiveTransaction_whenCallService_thenExpectIllegalTransactionStateExceptionWith0NewAnd0Suspend() { - mandatoryTransactionalFooService.identity(new Foo("baeldung")); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(0, transactionSpy.getCreate()); - } - - @Test - public void givenNotSupportWithNoActiveTransaction_whenCallService_thenExpect0NewAnd0Suspend() { - notSupportedTransactionalFooService.identity(new Foo("baeldung")); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(0, transactionSpy.getCreate()); - } - - @Test - public void givenNeverWithNoActiveTransaction_whenCallService_thenExpect0NewAnd0Suspend() { - neverTransactionalFooService.identity(new Foo("baeldung")); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(0, transactionSpy.getCreate()); - } - - @Test - public void givenRequiredWithActiveTransaction_whenCallCreate_thenExpect0NewAnd0Suspend() { - transactionTemplate.execute(status -> { - Foo foo = new Foo("baeldung"); - return requiredTransactionalFooDao.create(foo); - }); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(1, transactionSpy.getCreate()); - } - - @Test - public void givenRequiresNewWithActiveTransaction_whenCallCreate_thenExpect1NewAnd1Suspend() { - transactionTemplate.execute(status -> { - Foo foo = new Foo("baeldung"); - return requiresNewTransactionalFooDao.create(foo); - }); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(1, transactionSpy.getSuspend()); - Assert.assertEquals(2, transactionSpy.getCreate()); - } - - @Test - public void givenSupportWithActiveTransaction_whenCallCreate_thenExpect0NewAnd0Suspend() { - transactionTemplate.execute(status -> { - Foo foo = new Foo("baeldung"); - return supportTransactionalFooDao.create(foo); - }); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(1, transactionSpy.getCreate()); - } - - @Test - public void givenMandatoryWithActiveTransaction_whenCallCreate_thenExpect0NewAnd0Suspend() { - - transactionTemplate.execute(status -> { - Foo foo = new Foo("baeldung"); - return mandatoryTransactionalFooDao.create(foo); - }); - - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(1, transactionSpy.getCreate()); - } - - @Test - public void givenNotSupportWithActiveTransaction_whenCallCreate_thenExpect0NewAnd1Suspend() { - transactionTemplate.execute(status -> { - Foo foo = new Foo("baeldung"); - return notSupportedTransactionalFooService.identity(foo); - }); - - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(1, transactionSpy.getSuspend()); - Assert.assertEquals(1, transactionSpy.getCreate()); - } - - @Test(expected = IllegalTransactionStateException.class) - public void givenNeverWithActiveTransaction_whenCallCreate_thenExpectIllegalTransactionStateExceptionWith0NewAnd0Suspend() { - transactionTemplate.execute(status -> { - Foo foo = new Foo("baeldung"); - return neverTransactionalFooService.identity(foo); - }); - PersistenceTransactionalTestConfig.TransactionSynchronizationAdapterSpy transactionSpy = PersistenceTransactionalTestConfig.getSpy(); - Assert.assertEquals(0, transactionSpy.getSuspend()); - Assert.assertEquals(1, transactionSpy.getCreate()); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/transactional/PersistenceTransactionalTestConfig.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/transactional/PersistenceTransactionalTestConfig.java deleted file mode 100644 index 72031a2232..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/persistence/service/transactional/PersistenceTransactionalTestConfig.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.baeldung.persistence.service.transactional; - -import com.google.common.base.Preconditions; -import java.util.Properties; -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.JpaVendorAdapter; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.transaction.support.DefaultTransactionStatus; -import org.springframework.transaction.support.TransactionSynchronizationAdapter; -import org.springframework.transaction.support.TransactionSynchronizationManager; -import org.springframework.transaction.support.TransactionTemplate; - -@Configuration -@EnableTransactionManagement -@PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "com.baeldung.persistence","com.baeldung.jpa.dao" }) -@EnableJpaRepositories(basePackages = "com.baeldung.jpa.dao") -public class PersistenceTransactionalTestConfig { - - public static class TransactionSynchronizationAdapterSpy extends TransactionSynchronizationAdapter { - private int create, suspend; - - public int getSuspend() { - return suspend; - } - - public int getCreate() { - return create; - } - - public void create() { - create++; - } - - @Override - public void suspend() { - suspend++; - super.suspend(); - } - } - - - public static class JpaTransactionManagerSpy extends JpaTransactionManager { - @Override - protected void prepareSynchronization(DefaultTransactionStatus status, TransactionDefinition definition) { - super.prepareSynchronization(status, definition); - if (status.isNewTransaction()) { - if ( adapterSpyThreadLocal.get() == null ){ - TransactionSynchronizationAdapterSpy spy = new TransactionSynchronizationAdapterSpy(); - TransactionSynchronizationManager.registerSynchronization(spy); - adapterSpyThreadLocal.set(spy); - } - adapterSpyThreadLocal.get().create(); - } - } - } - - private static ThreadLocal adapterSpyThreadLocal = new ThreadLocal<>(); - - @Autowired - private Environment env; - - public PersistenceTransactionalTestConfig() { - super(); - } - - public static TransactionSynchronizationAdapterSpy getSpy(){ - if ( adapterSpyThreadLocal.get() == null ) - return new TransactionSynchronizationAdapterSpy(); - return adapterSpyThreadLocal.get(); - } - - public static void clearSpy(){ - adapterSpyThreadLocal.set(null); - } - - // beans - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); - - final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - em.setJpaVendorAdapter(vendorAdapter); - em.setJpaProperties(additionalProperties()); - - return em; - } - - @Bean - public DataSource dataSource() { - final DriverManagerDataSource dataSource = new DriverManagerDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - - - @Bean - public PlatformTransactionManager transactionManager(final EntityManagerFactory emf) { - final JpaTransactionManagerSpy transactionManager = new JpaTransactionManagerSpy(); - transactionManager.setEntityManagerFactory(emf); - return transactionManager; - } - - @Bean - public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { - return new PersistenceExceptionTranslationPostProcessor(); - } - - final Properties additionalProperties() { - final Properties hibernateProperties = new Properties(); - hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); - hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", "false"); - return hibernateProperties; - } - - - @Bean - public TransactionTemplate transactionTemplate(PlatformTransactionManager transactionManager){ - TransactionTemplate template = new TransactionTemplate(transactionManager); - template.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); - return template; - } - - -} \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCommon.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCommon.java deleted file mode 100644 index 13b5b4357d..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/repository/UserRepositoryCommon.java +++ /dev/null @@ -1,555 +0,0 @@ -package com.baeldung.spring.data.persistence.repository; - -import com.baeldung.spring.data.persistence.config.PersistenceConfig; -import com.baeldung.spring.data.persistence.model.User; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort; -import org.springframework.data.jpa.domain.JpaSort; -import org.springframework.data.mapping.PropertyReferenceException; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.transaction.annotation.Transactional; - -import javax.persistence.EntityManager; -import javax.persistence.Query; -import java.time.LocalDate; -import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.*; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -@DirtiesContext -public class UserRepositoryCommon { - - final String USER_EMAIL = "email@example.com"; - final String USER_EMAIL2 = "email2@example.com"; - final String USER_EMAIL3 = "email3@example.com"; - final String USER_EMAIL4 = "email4@example.com"; - final Integer INACTIVE_STATUS = 0; - final Integer ACTIVE_STATUS = 1; - final String USER_EMAIL5 = "email5@example.com"; - final String USER_EMAIL6 = "email6@example.com"; - final String USER_NAME_ADAM = "Adam"; - final String USER_NAME_PETER = "Peter"; - - @Autowired - protected UserRepository userRepository; - @Autowired - private EntityManager entityManager; - - @Test - @Transactional - public void givenUsersWithSameNameInDB_WhenFindAllByName_ThenReturnStreamOfUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - userRepository.save(user3); - - User user4 = new User(); - user4.setName("SAMPLE"); - user4.setEmail(USER_EMAIL4); - userRepository.save(user4); - - try (Stream foundUsersStream = userRepository.findAllByName(USER_NAME_ADAM)) { - assertThat(foundUsersStream.count()).isEqualTo(3l); - } - } - - @Test - public void givenUsersInDB_WhenFindAllWithQueryAnnotation_ThenReturnCollectionWithActiveUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - user1.setStatus(ACTIVE_STATUS); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - user3.setStatus(INACTIVE_STATUS); - userRepository.save(user3); - - Collection allActiveUsers = userRepository.findAllActiveUsers(); - - assertThat(allActiveUsers.size()).isEqualTo(2); - } - - @Test - public void givenUsersInDB_WhenFindAllWithQueryAnnotationNative_ThenReturnCollectionWithActiveUsers() { - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - user1.setStatus(ACTIVE_STATUS); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_ADAM); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User user3 = new User(); - user3.setName(USER_NAME_ADAM); - user3.setEmail(USER_EMAIL3); - user3.setStatus(INACTIVE_STATUS); - userRepository.save(user3); - - Collection allActiveUsers = userRepository.findAllActiveUsersNative(); - - assertThat(allActiveUsers.size()).isEqualTo(2); - } - - @Test - public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotation_ThenReturnActiveUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByStatus(ACTIVE_STATUS); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUserInDB_WhenFindUserByStatusWithQueryAnnotationNative_ThenReturnActiveUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByStatusNative(ACTIVE_STATUS); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationIndexedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndName(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndNameNamedParams(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNativeNamedParams_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByStatusAndNameNamedParamsNative(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByStatusAndNameWithQueryAnnotationNamedParamsCustomNames_ThenReturnOneUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - user2.setStatus(ACTIVE_STATUS); - userRepository.save(user2); - - User userByStatus = userRepository.findUserByUserStatusAndUserName(ACTIVE_STATUS, USER_NAME_ADAM); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationIndexedParams_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLike("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNamedParams_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLikeNamedParam("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindUserByNameLikeWithQueryAnnotationNative_ThenReturnUser() { - User user = new User(); - user.setName(USER_NAME_ADAM); - user.setEmail(USER_EMAIL); - user.setStatus(ACTIVE_STATUS); - userRepository.save(user); - - User userByStatus = userRepository.findUserByNameLikeNative("Ad"); - - assertThat(userByStatus.getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllWithSortByName_ThenReturnUsersSorted() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - List usersSortByName = userRepository.findAll(Sort.by(Sort.Direction.ASC, "name")); - - assertThat(usersSortByName.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test(expected = PropertyReferenceException.class) - public void givenUsersInDB_WhenFindAllSortWithFunction_ThenThrowException() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - userRepository.findAll(Sort.by(Sort.Direction.ASC, "name")); - - List usersSortByNameLength = userRepository.findAll(Sort.by("LENGTH(name)")); - - assertThat(usersSortByNameLength.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllSortWithFunctionQueryAnnotationJPQL_ThenReturnUsersSorted() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - - userRepository.findAllUsers(Sort.by("name")); - - List usersSortByNameLength = userRepository.findAllUsers(JpaSort.unsafe("LENGTH(name)")); - - assertThat(usersSortByNameLength.get(0) - .getName()).isEqualTo(USER_NAME_ADAM); - } - - @Test - public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationJPQL_ThenReturnPageOfUsers() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL4, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE2", LocalDate.now(), USER_EMAIL5, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL6, INACTIVE_STATUS)); - - Page usersPage = userRepository.findAllUsersWithPagination(PageRequest.of(1, 3)); - - assertThat(usersPage.getContent() - .get(0) - .getName()).isEqualTo("SAMPLE1"); - } - - @Test - public void givenUsersInDB_WhenFindAllWithPageRequestQueryAnnotationNative_ThenReturnPageOfUsers() { - userRepository.save(new User(USER_NAME_ADAM, LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User(USER_NAME_PETER, LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL4, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE2", LocalDate.now(), USER_EMAIL5, INACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL6, INACTIVE_STATUS)); - - Page usersSortByNameLength = userRepository.findAllUsersWithPaginationNative(PageRequest.of(1, 3)); - - assertThat(usersSortByNameLength.getContent() - .get(0) - .getName()).isEqualTo(USER_NAME_PETER); - } - - @Test - @Transactional - public void givenUsersInDB_WhenUpdateStatusForNameModifyingQueryAnnotationJPQL_ThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - - int updatedUsersSize = userRepository.updateUserSetStatusForName(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } - - @Test - public void givenUsersInDB_WhenFindByEmailsWithDynamicQuery_ThenReturnCollection() { - - User user1 = new User(); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - User user3 = new User(); - user3.setEmail(USER_EMAIL3); - userRepository.save(user3); - - Set emails = new HashSet<>(); - emails.add(USER_EMAIL2); - emails.add(USER_EMAIL3); - - Collection usersWithEmails = userRepository.findUserByEmails(emails); - - assertThat(usersWithEmails.size()).isEqualTo(2); - } - - @Test - public void givenUsersInDBWhenFindByNameListReturnCollection() { - - User user1 = new User(); - user1.setName(USER_NAME_ADAM); - user1.setEmail(USER_EMAIL); - userRepository.save(user1); - - User user2 = new User(); - user2.setName(USER_NAME_PETER); - user2.setEmail(USER_EMAIL2); - userRepository.save(user2); - - List names = Arrays.asList(USER_NAME_ADAM, USER_NAME_PETER); - - List usersWithNames = userRepository.findUserByNameList(names); - - assertThat(usersWithNames.size()).isEqualTo(2); - } - - - @Test - @Transactional - public void whenInsertedWithQuery_ThenUserIsPersisted() { - userRepository.insertUser(USER_NAME_ADAM, 1, USER_EMAIL, ACTIVE_STATUS, true); - userRepository.insertUser(USER_NAME_PETER, 1, USER_EMAIL2, ACTIVE_STATUS, true); - - User userAdam = userRepository.findUserByNameLike(USER_NAME_ADAM); - User userPeter = userRepository.findUserByNameLike(USER_NAME_PETER); - - assertThat(userAdam).isNotNull(); - assertThat(userAdam.getEmail()).isEqualTo(USER_EMAIL); - assertThat(userPeter).isNotNull(); - assertThat(userPeter.getEmail()).isEqualTo(USER_EMAIL2); - } - - - @Test - @Transactional - public void givenTwoUsers_whenFindByNameUsr01_ThenUserUsr01() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - try (Stream users = userRepository.findAllByName("usr01")) { - assertTrue(users.allMatch(usr -> usr.equals(usr01))); - } - } - - @Test - @Transactional - public void givenTwoUsers_whenFindByNameUsr00_ThenNoUsers() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - try (Stream users = userRepository.findAllByName("usr00")) { - assertEquals(0, users.count()); - } - } - - @Test - public void givenTwoUsers_whenFindUsersWithGmailAddress_ThenUserUsr02() { - User usr01 = new User("usr01", LocalDate.now(), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.now(), "usr02@gmail.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - System.out.println(TimeZone.getDefault()); - - List users = userRepository.findUsersWithGmailAddress(); - assertEquals(1, users.size()); - assertEquals(usr02, users.get(0)); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeleteAllByCreationDateAfter_ThenOneUserRemains() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.com", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.deleteAllByCreationDateAfter(LocalDate.of(2018, 5, 1)); - - List users = userRepository.findAll(); - - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - } - - @Test - public void givenTwoUsers_whenFindAllUsersByPredicates_ThenUserUsr01() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - - userRepository.save(usr01); - userRepository.save(usr02); - - List> predicates = new ArrayList<>(); - predicates.add(usr -> usr.getCreationDate().isAfter(LocalDate.of(2017, 12, 31))); - predicates.add(usr -> usr.getEmail().endsWith(".com")); - - List users = userRepository.findAllUsersByPredicates(predicates); - - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeactivateUsersNotLoggedInSince_ThenUserUsr02Deactivated() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.deactivateUsersNotLoggedInSince(LocalDate.of(2018, 8, 1)); - - List users = userRepository.findAllUsers(Sort.by(Sort.Order.asc("name"))); - assertTrue(users.get(0).isActive()); - assertFalse(users.get(1).isActive()); - } - - @Test - @Transactional - public void givenTwoUsers_whenDeleteDeactivatedUsers_ThenUserUsr02Deleted() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.com", 0); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - usr02.setActive(false); - - userRepository.save(usr01); - userRepository.save(usr02); - - int deletedUsersCount = userRepository.deleteDeactivatedUsers(); - - List users = userRepository.findAll(); - assertEquals(1, users.size()); - assertEquals(usr01, users.get(0)); - assertEquals(1, deletedUsersCount); - } - - @Test - @Transactional - public void givenTwoUsers_whenAddDeletedColumn_ThenUsersHaveDeletedColumn() { - User usr01 = new User("usr01", LocalDate.of(2018, 1, 1), "usr01@baeldung.com", 1); - usr01.setLastLoginDate(LocalDate.now()); - User usr02 = new User("usr02", LocalDate.of(2018, 6, 1), "usr02@baeldung.org", 1); - usr02.setLastLoginDate(LocalDate.of(2018, 7, 20)); - usr02.setActive(false); - - userRepository.save(usr01); - userRepository.save(usr02); - - userRepository.addDeletedColumn(); - - Query nativeQuery = entityManager.createNativeQuery("select deleted from USERS where NAME = 'usr01'"); - assertEquals(0, nativeQuery.getResultList().get(0)); - } - - @After - public void cleanUp() { - userRepository.deleteAll(); - } -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/repository/UserRepositoryIntegrationTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/repository/UserRepositoryIntegrationTest.java deleted file mode 100644 index c76e345fdd..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/repository/UserRepositoryIntegrationTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.spring.data.persistence.repository; - -import com.baeldung.spring.data.persistence.config.PersistenceConfig; -import com.baeldung.spring.data.persistence.model.User; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDate; - -import static org.assertj.core.api.Assertions.assertThat; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -@DirtiesContext -public class UserRepositoryIntegrationTest extends UserRepositoryCommon { - - @Test - @Transactional - public void givenUsersInDBWhenUpdateStatusForNameModifyingQueryAnnotationNativeThenModifyMatchingUsers() { - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE1", LocalDate.now(), USER_EMAIL2, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE", LocalDate.now(), USER_EMAIL3, ACTIVE_STATUS)); - userRepository.save(new User("SAMPLE3", LocalDate.now(), USER_EMAIL4, ACTIVE_STATUS)); - userRepository.flush(); - - int updatedUsersSize = userRepository.updateUserSetStatusForNameNative(INACTIVE_STATUS, "SAMPLE"); - - assertThat(updatedUsersSize).isEqualTo(2); - } -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/service/AbstractServicePersistenceIntegrationTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/service/AbstractServicePersistenceIntegrationTest.java deleted file mode 100644 index 2bccada9fe..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/service/AbstractServicePersistenceIntegrationTest.java +++ /dev/null @@ -1,256 +0,0 @@ -package com.baeldung.spring.data.persistence.service; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.hamcrest.Matchers.hasItem; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; - -import java.io.Serializable; -import java.util.List; - -import com.baeldung.spring.data.persistence.model.Foo; -import com.baeldung.util.IDUtil; -import org.hamcrest.Matchers; -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.dao.DataAccessException; - -import com.baeldung.persistence.dao.common.IOperations; - -public abstract class AbstractServicePersistenceIntegrationTest { - - // tests - - // find - one - - @Test - /**/public final void givenResourceDoesNotExist_whenResourceIsRetrieved_thenNoResourceIsReceived() { - // When - final Foo createdResource = getApi().findOne(IDUtil.randomPositiveLong()); - - // Then - assertNull(createdResource); - } - - @Test - public void givenResourceExists_whenResourceIsRetrieved_thenNoExceptions() { - final Foo existingResource = persistNewEntity(); - getApi().findOne(existingResource.getId()); - } - - @Test - public void givenResourceDoesNotExist_whenResourceIsRetrieved_thenNoExceptions() { - getApi().findOne(IDUtil.randomPositiveLong()); - } - - @Test - public void givenResourceExists_whenResourceIsRetrieved_thenTheResultIsNotNull() { - final Foo existingResource = persistNewEntity(); - final Foo retrievedResource = getApi().findOne(existingResource.getId()); - assertNotNull(retrievedResource); - } - - @Test - public void givenResourceExists_whenResourceIsRetrieved_thenResourceIsRetrievedCorrectly() { - final Foo existingResource = persistNewEntity(); - final Foo retrievedResource = getApi().findOne(existingResource.getId()); - assertEquals(existingResource, retrievedResource); - } - - // find - one - by name - - // find - all - - @Test - /**/public void whenAllResourcesAreRetrieved_thenNoExceptions() { - getApi().findAll(); - } - - @Test - /**/public void whenAllResourcesAreRetrieved_thenTheResultIsNotNull() { - final List resources = getApi().findAll(); - - assertNotNull(resources); - } - - @Test - /**/public void givenAtLeastOneResourceExists_whenAllResourcesAreRetrieved_thenRetrievedResourcesAreNotEmpty() { - persistNewEntity(); - - // When - final List allResources = getApi().findAll(); - - // Then - assertThat(allResources, not(Matchers. empty())); - } - - @Test - /**/public void givenAnResourceExists_whenAllResourcesAreRetrieved_thenTheExistingResourceIsIndeedAmongThem() { - final Foo existingResource = persistNewEntity(); - - final List resources = getApi().findAll(); - - assertThat(resources, hasItem(existingResource)); - } - - @Test - /**/public void whenAllResourcesAreRetrieved_thenResourcesHaveIds() { - persistNewEntity(); - - // When - final List allResources = getApi().findAll(); - - // Then - for (final Foo resource : allResources) { - assertNotNull(resource.getId()); - } - } - - // create - - @Test(expected = RuntimeException.class) - /**/public void whenNullResourceIsCreated_thenException() { - getApi().create(null); - } - - @Test - /**/public void whenResourceIsCreated_thenNoExceptions() { - persistNewEntity(); - } - - @Test - /**/public void whenResourceIsCreated_thenResourceIsRetrievable() { - final Foo existingResource = persistNewEntity(); - - assertNotNull(getApi().findOne(existingResource.getId())); - } - - @Test - /**/public void whenResourceIsCreated_thenSavedResourceIsEqualToOriginalResource() { - final Foo originalResource = createNewEntity(); - final Foo savedResource = getApi().create(originalResource); - - assertEquals(originalResource, savedResource); - } - - @Test(expected = RuntimeException.class) - public void whenResourceWithFailedConstraintsIsCreated_thenException() { - final Foo invalidResource = createNewEntity(); - invalidate(invalidResource); - - getApi().create(invalidResource); - } - - /** - * -- specific to the persistence engine - */ - @Test(expected = DataAccessException.class) - @Ignore("Hibernate simply ignores the id silently and still saved (tracking this)") - public void whenResourceWithIdIsCreated_thenDataAccessException() { - final Foo resourceWithId = createNewEntity(); - resourceWithId.setId(IDUtil.randomPositiveLong()); - - getApi().create(resourceWithId); - } - - // update - - @Test(expected = RuntimeException.class) - /**/public void whenNullResourceIsUpdated_thenException() { - getApi().update(null); - } - - @Test - /**/public void givenResourceExists_whenResourceIsUpdated_thenNoExceptions() { - // Given - final Foo existingResource = persistNewEntity(); - - // When - getApi().update(existingResource); - } - - /** - * - can also be the ConstraintViolationException which now occurs on the update operation will not be translated; as a consequence, it will be a TransactionSystemException - */ - @Test(expected = RuntimeException.class) - public void whenResourceIsUpdatedWithFailedConstraints_thenException() { - final Foo existingResource = persistNewEntity(); - invalidate(existingResource); - - getApi().update(existingResource); - } - - @Test - /**/public void givenResourceExists_whenResourceIsUpdated_thenUpdatesArePersisted() { - // Given - final Foo existingResource = persistNewEntity(); - - // When - change(existingResource); - getApi().update(existingResource); - - final Foo updatedResource = getApi().findOne(existingResource.getId()); - - // Then - assertEquals(existingResource, updatedResource); - } - - // delete - - // @Test(expected = RuntimeException.class) - // public void givenResourceDoesNotExists_whenResourceIsDeleted_thenException() { - // // When - // getApi().delete(IDUtil.randomPositiveLong()); - // } - // - // @Test(expected = RuntimeException.class) - // public void whenResourceIsDeletedByNegativeId_thenException() { - // // When - // getApi().delete(IDUtil.randomNegativeLong()); - // } - // - // @Test - // public void givenResourceExists_whenResourceIsDeleted_thenNoExceptions() { - // // Given - // final Foo existingResource = persistNewEntity(); - // - // // When - // getApi().delete(existingResource.getId()); - // } - // - // @Test - // /**/public final void givenResourceExists_whenResourceIsDeleted_thenResourceNoLongerExists() { - // // Given - // final Foo existingResource = persistNewEntity(); - // - // // When - // getApi().delete(existingResource.getId()); - // - // // Then - // assertNull(getApi().findOne(existingResource.getId())); - // } - - // template method - - protected Foo createNewEntity() { - return new Foo(randomAlphabetic(6)); - } - - protected abstract IOperations getApi(); - - private final void invalidate(final Foo entity) { - entity.setName(null); - } - - private final void change(final Foo entity) { - entity.setName(randomAlphabetic(6)); - } - - protected Foo persistNewEntity() { - return getApi().create(createNewEntity()); - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/service/FooServicePersistenceIntegrationTest.java deleted file mode 100644 index 8f628c5615..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/data/persistence/service/FooServicePersistenceIntegrationTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.baeldung.spring.data.persistence.service; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.junit.Assert.assertNotNull; - -import com.baeldung.spring.data.persistence.model.Foo; -import com.baeldung.spring.data.persistence.config.PersistenceConfig; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.dao.InvalidDataAccessApiUsageException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.dao.common.IOperations; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class FooServicePersistenceIntegrationTest extends AbstractServicePersistenceIntegrationTest { - - @Autowired - private IFooService service; - - // tests - - @Test - public final void whenContextIsBootstrapped_thenNoExceptions() { - // - } - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Foo(randomAlphabetic(6))); - } - - @Test(expected = DataIntegrityViolationException.class) - public final void whenInvalidEntityIsCreated_thenDataException() { - service.create(new Foo()); - } - - @Test(expected = DataIntegrityViolationException.class) - public final void whenEntityWithLongNameIsCreated_thenDataException() { - service.create(new Foo(randomAlphabetic(2048))); - } - - // custom Query method - - @Test - public final void givenUsingCustomQuery_whenRetrievingEntity_thenFound() { - final String name = randomAlphabetic(6); - service.create(new Foo(name)); - - final Foo retrievedByName = service.retrieveByName(name); - assertNotNull(retrievedByName); - } - - // work in progress - - @Test(expected = InvalidDataAccessApiUsageException.class) - @Ignore("Right now, persist has saveOrUpdate semantics, so this will no longer fail") - public final void whenSameEntityIsCreatedTwice_thenDataException() { - final Foo entity = new Foo(randomAlphabetic(8)); - service.create(entity); - service.create(entity); - } - - // API - - @Override - protected final IOperations getApi() { - return service; - } - -} diff --git a/persistence-modules/spring-persistence-simple/src/test/resources/.gitignore b/persistence-modules/spring-persistence-simple/src/test/resources/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/resources/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file From eb4c3064512dd995d4ea0fe414ef564531df600d Mon Sep 17 00:00:00 2001 From: fdpro Date: Sun, 30 Aug 2020 15:59:35 +0200 Subject: [PATCH 0636/1862] [JAVA-2306] Moved articles from spring-persistence-simple-2 * https://www.baeldung.com/spring-jdbctemplate-testing went to spring-jdbc * https://www.baeldung.com/spring-jdbctemplate-in-list went to spring-jdbc * https://www.baeldung.com/spring-mock-jndi-datasource went to spring-persistence-simple * Deleted spring-persistence-simple-2 module as all articles have been moved --- persistence-modules/pom.xml | 2 +- .../guide}/CustomSQLErrorCodeTranslator.java | 2 +- .../jdbc/{ => template/guide}/Employee.java | 2 +- .../{ => template/guide}/EmployeeDAO.java | 2 +- .../guide}/EmployeeRowMapper.java | 2 +- .../guide}/config/SpringJdbcConfig.java | 6 +- .../jdbc/template/inclause/Employee.java | 42 ++++++++++++++ .../jdbc/template/inclause}/EmployeeDAO.java | 28 ++++------ .../jdbc/template/testing}/Employee.java | 2 +- .../jdbc/template/testing/EmployeeDAO.java | 19 +++++++ .../template/guide}/application.properties | 0 .../spring/jdbc/template/guide}/schema.sql | 0 .../spring/jdbc/template/guide}/test-data.sql | 0 .../spring/jdbc/template/inclause/schema.sql | 7 +++ .../jdbc/template/inclause/test-data.sql | 7 +++ .../spring/jdbc/template/testing/schema.sql | 7 +++ .../jdbc/template/testing/test-data.sql | 7 +++ .../guide}/EmployeeDAOIntegrationTest.java | 6 +- .../inclause}/EmployeeDAOUnitTest.java | 45 +++------------ .../template/testing/EmployeeDAOUnitTest.java | 56 +++++++++++++++++++ .../spring-persistence-simple-2/README.md | 6 -- .../src/main/resources/jdbc/schema.sql | 6 -- .../src/main/resources/jdbc/test-data.sql | 4 -- .../spring-persistence-simple/.gitignore | 13 +++++ .../spring-persistence-simple/README.md | 25 +++++++++ .../pom.xml | 11 ++-- .../datasource/mock}/datasource.properties | 0 .../src/main/resources/jndi.properties | 2 +- .../datasource/mock}/SimpleJNDIUnitTest.java | 2 +- .../SimpleNamingContextBuilderManualTest.java | 2 +- 30 files changed, 224 insertions(+), 89 deletions(-) rename persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/{ => template/guide}/CustomSQLErrorCodeTranslator.java (93%) rename persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/{ => template/guide}/Employee.java (93%) rename persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/{ => template/guide}/EmployeeDAO.java (99%) rename persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/{ => template/guide}/EmployeeRowMapper.java (92%) rename persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/{ => template/guide}/config/SpringJdbcConfig.java (82%) create mode 100644 persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/inclause/Employee.java rename persistence-modules/{spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc => spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/inclause}/EmployeeDAO.java (88%) rename persistence-modules/{spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc => spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing}/Employee.java (93%) create mode 100644 persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAO.java rename persistence-modules/spring-jdbc/src/main/resources/{ => com/baeldung/spring/jdbc/template/guide}/application.properties (100%) rename persistence-modules/spring-jdbc/src/main/resources/{jdbc => com/baeldung/spring/jdbc/template/guide}/schema.sql (100%) rename persistence-modules/spring-jdbc/src/main/resources/{jdbc => com/baeldung/spring/jdbc/template/guide}/test-data.sql (100%) create mode 100644 persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/inclause/schema.sql create mode 100644 persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/inclause/test-data.sql create mode 100644 persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/testing/schema.sql create mode 100644 persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/testing/test-data.sql rename persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/{ => template/guide}/EmployeeDAOIntegrationTest.java (94%) rename persistence-modules/{spring-persistence-simple-2/src/test/java/com/baeldung/spring/jdbc => spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/inclause}/EmployeeDAOUnitTest.java (69%) create mode 100644 persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAOUnitTest.java delete mode 100644 persistence-modules/spring-persistence-simple-2/README.md delete mode 100644 persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/schema.sql delete mode 100644 persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/test-data.sql create mode 100644 persistence-modules/spring-persistence-simple/.gitignore create mode 100644 persistence-modules/spring-persistence-simple/README.md rename persistence-modules/{spring-persistence-simple-2 => spring-persistence-simple}/pom.xml (91%) rename persistence-modules/{spring-persistence-simple-2/src/main/resources/jndi => spring-persistence-simple/src/main/resources/com/baeldung/spring/jndi/datasource/mock}/datasource.properties (100%) rename persistence-modules/{spring-persistence-simple-2 => spring-persistence-simple}/src/main/resources/jndi.properties (69%) rename persistence-modules/{spring-persistence-simple-2/src/test/java/com/baeldung/jndi/datasource => spring-persistence-simple/src/test/java/com/baeldung/spring/jndi/datasource/mock}/SimpleJNDIUnitTest.java (95%) rename persistence-modules/{spring-persistence-simple-2/src/test/java/com/baeldung/jndi/datasource => spring-persistence-simple/src/test/java/com/baeldung/spring/jndi/datasource/mock}/SimpleNamingContextBuilderManualTest.java (96%) diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 1a5ca8df70..4e46c9204b 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -86,7 +86,7 @@ spring-jpa-2 spring-jdbc - spring-persistence-simple-2 + spring-persistence-simple diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/CustomSQLErrorCodeTranslator.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/CustomSQLErrorCodeTranslator.java similarity index 93% rename from persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/CustomSQLErrorCodeTranslator.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/CustomSQLErrorCodeTranslator.java index aa0ffde00c..9beed9f9df 100644 --- a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/CustomSQLErrorCodeTranslator.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/CustomSQLErrorCodeTranslator.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.jdbc; +package com.baeldung.spring.jdbc.template.guide; import java.sql.SQLException; diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/Employee.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/Employee.java similarity index 93% rename from persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/Employee.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/Employee.java index 84780e30da..32ca9ad0d3 100644 --- a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/Employee.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/Employee.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.jdbc; +package com.baeldung.spring.jdbc.template.guide; public class Employee { private int id; diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/EmployeeDAO.java similarity index 99% rename from persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/EmployeeDAO.java index a6d0fe2f3b..11ecd84000 100644 --- a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/EmployeeDAO.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.jdbc; +package com.baeldung.spring.jdbc.template.guide; import java.sql.PreparedStatement; import java.sql.SQLException; diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeRowMapper.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/EmployeeRowMapper.java similarity index 92% rename from persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeRowMapper.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/EmployeeRowMapper.java index bf55d6160d..f4ea5ac7b6 100644 --- a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/EmployeeRowMapper.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/EmployeeRowMapper.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.jdbc; +package com.baeldung.spring.jdbc.template.guide; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/config/SpringJdbcConfig.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/config/SpringJdbcConfig.java similarity index 82% rename from persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/config/SpringJdbcConfig.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/config/SpringJdbcConfig.java index d7eb039637..0e81babd9a 100644 --- a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/config/SpringJdbcConfig.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/config/SpringJdbcConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.jdbc.config; +package com.baeldung.spring.jdbc.template.guide.config; import javax.sql.DataSource; @@ -17,8 +17,8 @@ public class SpringJdbcConfig { public DataSource dataSource() { return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) - .addScript("classpath:jdbc/schema.sql") - .addScript("classpath:jdbc/test-data.sql") + .addScript("classpath:com/baeldung/spring/jdbc/template/guide/schema.sql") + .addScript("classpath:com/baeldung/spring/jdbc/template/guide/test-data.sql") .build(); } diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/inclause/Employee.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/inclause/Employee.java new file mode 100644 index 0000000000..c771033649 --- /dev/null +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/inclause/Employee.java @@ -0,0 +1,42 @@ +package com.baeldung.spring.jdbc.template.inclause; + +public class Employee { + private int id; + + private String firstName; + + private String lastName; + + + public Employee(int id, String firstName, String lastName) { + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + } + + public int getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(final String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(final String lastName) { + this.lastName = lastName; + } + + +} diff --git a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/inclause/EmployeeDAO.java similarity index 88% rename from persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/inclause/EmployeeDAO.java index 6e2ad9682d..38b4a58355 100644 --- a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/EmployeeDAO.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/inclause/EmployeeDAO.java @@ -1,10 +1,4 @@ -package com.baeldung.spring.jdbc; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.sql.DataSource; +package com.baeldung.spring.jdbc.template.inclause; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; @@ -12,6 +6,11 @@ import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.core.namedparam.SqlParameterSource; import org.springframework.stereotype.Repository; +import javax.sql.DataSource; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + @Repository public class EmployeeDAO { private JdbcTemplate jdbcTemplate; @@ -22,15 +21,11 @@ public class EmployeeDAO { namedJdbcTemplate = new NamedParameterJdbcTemplate(dataSource); } - public int getCountOfEmployees() { - return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class); - } - public List getEmployeesFromIdListNamed(List ids) { SqlParameterSource parameters = new MapSqlParameterSource("ids", ids); List employees = namedJdbcTemplate.query( - "SELECT * FROM EMPLOYEE WHERE id IN (:ids)", - parameters, + "SELECT * FROM EMPLOYEE WHERE id IN (:ids)", + parameters, (rs, rowNum) -> new Employee(rs.getInt("id"), rs.getString("first_name"), rs.getString("last_name"))); return employees; @@ -39,8 +34,8 @@ public class EmployeeDAO { public List getEmployeesFromIdList(List ids) { String inSql = String.join(",", Collections.nCopies(ids.size(), "?")); List employees = jdbcTemplate.query( - String.format("SELECT * FROM EMPLOYEE WHERE id IN (%s)", inSql), - ids.toArray(), + String.format("SELECT * FROM EMPLOYEE WHERE id IN (%s)", inSql), + ids.toArray(), (rs, rowNum) -> new Employee(rs.getInt("id"), rs.getString("first_name"), rs.getString("last_name"))); return employees; @@ -56,12 +51,11 @@ public class EmployeeDAO { jdbcTemplate.batchUpdate("INSERT INTO employee_tmp VALUES(?)", employeeIds); List employees = jdbcTemplate.query( - "SELECT * FROM EMPLOYEE WHERE id IN (SELECT id FROM employee_tmp)", + "SELECT * FROM EMPLOYEE WHERE id IN (SELECT id FROM employee_tmp)", (rs, rowNum) -> new Employee(rs.getInt("id"), rs.getString("first_name"), rs.getString("last_name"))); jdbcTemplate.update("DELETE FROM employee_tmp"); return employees; } - } diff --git a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/Employee.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/Employee.java similarity index 93% rename from persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/Employee.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/Employee.java index adc2255ca4..80be897827 100644 --- a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/spring/jdbc/Employee.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/Employee.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.jdbc; +package com.baeldung.spring.jdbc.template.testing; public class Employee { private int id; diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAO.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAO.java new file mode 100644 index 0000000000..64b146fd47 --- /dev/null +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAO.java @@ -0,0 +1,19 @@ +package com.baeldung.spring.jdbc.template.testing; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +import javax.sql.DataSource; + +@Repository +public class EmployeeDAO { + private JdbcTemplate jdbcTemplate; + + public void setDataSource(DataSource dataSource) { + jdbcTemplate = new JdbcTemplate(dataSource); + } + + public int getCountOfEmployees() { + return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-jdbc/src/main/resources/application.properties b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/guide/application.properties similarity index 100% rename from persistence-modules/spring-jdbc/src/main/resources/application.properties rename to persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/guide/application.properties diff --git a/persistence-modules/spring-jdbc/src/main/resources/jdbc/schema.sql b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/guide/schema.sql similarity index 100% rename from persistence-modules/spring-jdbc/src/main/resources/jdbc/schema.sql rename to persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/guide/schema.sql diff --git a/persistence-modules/spring-jdbc/src/main/resources/jdbc/test-data.sql b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/guide/test-data.sql similarity index 100% rename from persistence-modules/spring-jdbc/src/main/resources/jdbc/test-data.sql rename to persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/guide/test-data.sql diff --git a/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/inclause/schema.sql b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/inclause/schema.sql new file mode 100644 index 0000000000..ef4460e267 --- /dev/null +++ b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/inclause/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE EMPLOYEE +( + ID int NOT NULL PRIMARY KEY, + FIRST_NAME varchar(255), + LAST_NAME varchar(255), + ADDRESS varchar(255) +); \ No newline at end of file diff --git a/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/inclause/test-data.sql b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/inclause/test-data.sql new file mode 100644 index 0000000000..b9ef8fec25 --- /dev/null +++ b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/inclause/test-data.sql @@ -0,0 +1,7 @@ +INSERT INTO EMPLOYEE VALUES (1, 'James', 'Gosling', 'Canada'); + +INSERT INTO EMPLOYEE VALUES (2, 'Donald', 'Knuth', 'USA'); + +INSERT INTO EMPLOYEE VALUES (3, 'Linus', 'Torvalds', 'Finland'); + +INSERT INTO EMPLOYEE VALUES (4, 'Dennis', 'Ritchie', 'USA'); \ No newline at end of file diff --git a/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/testing/schema.sql b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/testing/schema.sql new file mode 100644 index 0000000000..ef4460e267 --- /dev/null +++ b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/testing/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE EMPLOYEE +( + ID int NOT NULL PRIMARY KEY, + FIRST_NAME varchar(255), + LAST_NAME varchar(255), + ADDRESS varchar(255) +); \ No newline at end of file diff --git a/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/testing/test-data.sql b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/testing/test-data.sql new file mode 100644 index 0000000000..b9ef8fec25 --- /dev/null +++ b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/template/testing/test-data.sql @@ -0,0 +1,7 @@ +INSERT INTO EMPLOYEE VALUES (1, 'James', 'Gosling', 'Canada'); + +INSERT INTO EMPLOYEE VALUES (2, 'Donald', 'Knuth', 'USA'); + +INSERT INTO EMPLOYEE VALUES (3, 'Linus', 'Torvalds', 'Finland'); + +INSERT INTO EMPLOYEE VALUES (4, 'Dennis', 'Ritchie', 'USA'); \ No newline at end of file diff --git a/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOIntegrationTest.java b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/guide/EmployeeDAOIntegrationTest.java similarity index 94% rename from persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOIntegrationTest.java rename to persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/guide/EmployeeDAOIntegrationTest.java index 10f47402be..c29d5c4534 100644 --- a/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOIntegrationTest.java +++ b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/guide/EmployeeDAOIntegrationTest.java @@ -1,9 +1,11 @@ -package com.baeldung.spring.jdbc; +package com.baeldung.spring.jdbc.template.guide; import java.util.ArrayList; import java.util.List; -import com.baeldung.spring.jdbc.config.SpringJdbcConfig; +import com.baeldung.spring.jdbc.template.guide.Employee; +import com.baeldung.spring.jdbc.template.guide.EmployeeDAO; +import com.baeldung.spring.jdbc.template.guide.config.SpringJdbcConfig; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOUnitTest.java b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/inclause/EmployeeDAOUnitTest.java similarity index 69% rename from persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOUnitTest.java rename to persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/inclause/EmployeeDAOUnitTest.java index bbc688293b..d9a858302b 100644 --- a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/spring/jdbc/EmployeeDAOUnitTest.java +++ b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/inclause/EmployeeDAOUnitTest.java @@ -1,22 +1,19 @@ -package com.baeldung.spring.jdbc; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import javax.sql.DataSource; +package com.baeldung.spring.jdbc.template.inclause; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.test.util.ReflectionTestUtils; + +import javax.sql.DataSource; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; @RunWith(MockitoJUnitRunner.class) @@ -30,33 +27,9 @@ public class EmployeeDAOUnitTest { public void setup() { dataSource = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2) .generateUniqueName(true) - .addScript("classpath:jdbc/schema.sql") - .addScript("classpath:jdbc/test-data.sql") + .addScript("classpath:com/baeldung/spring/jdbc/template/inclause/schema.sql") + .addScript("classpath:com/baeldung/spring/jdbc/template/inclause/test-data.sql") .build(); - - } - - @Test - public void whenMockJdbcTemplate_thenReturnCorrectEmployeeCount() { - EmployeeDAO employeeDAO = new EmployeeDAO(); - ReflectionTestUtils.setField(employeeDAO, "jdbcTemplate", jdbcTemplate); - Mockito.when(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class)) - .thenReturn(4); - - assertEquals(4, employeeDAO.getCountOfEmployees()); - - Mockito.when(jdbcTemplate.queryForObject(Mockito.anyString(), Mockito.eq(Integer.class))) - .thenReturn(3); - - assertEquals(3, employeeDAO.getCountOfEmployees()); - } - - @Test - public void whenInjectInMemoryDataSource_thenReturnCorrectEmployeeCount() { - EmployeeDAO employeeDAO = new EmployeeDAO(); - employeeDAO.setDataSource(dataSource); - - assertEquals(4, employeeDAO.getCountOfEmployees()); } @Test diff --git a/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAOUnitTest.java b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAOUnitTest.java new file mode 100644 index 0000000000..3609300c2d --- /dev/null +++ b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAOUnitTest.java @@ -0,0 +1,56 @@ +package com.baeldung.spring.jdbc.template.testing; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.test.util.ReflectionTestUtils; + +import javax.sql.DataSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@RunWith(MockitoJUnitRunner.class) +public class EmployeeDAOUnitTest { + @Mock + JdbcTemplate jdbcTemplate; + + DataSource dataSource; + + @Before + public void setup() { + dataSource = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2) + .generateUniqueName(true) + .addScript("classpath:com/baeldung/spring/jdbc/template/testing/schema.sql") + .addScript("classpath:com/baeldung/spring/jdbc/template/testing/test-data.sql") + .build(); + } + + @Test + public void whenMockJdbcTemplate_thenReturnCorrectEmployeeCount() { + EmployeeDAO employeeDAO = new EmployeeDAO(); + ReflectionTestUtils.setField(employeeDAO, "jdbcTemplate", jdbcTemplate); + Mockito.when(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class)) + .thenReturn(4); + + assertEquals(4, employeeDAO.getCountOfEmployees()); + + Mockito.when(jdbcTemplate.queryForObject(Mockito.anyString(), Mockito.eq(Integer.class))) + .thenReturn(3); + + assertEquals(3, employeeDAO.getCountOfEmployees()); + } + + @Test + public void whenInjectInMemoryDataSource_thenReturnCorrectEmployeeCount() { + EmployeeDAO employeeDAO = new EmployeeDAO(); + employeeDAO.setDataSource(dataSource); + + assertEquals(4, employeeDAO.getCountOfEmployees()); + } +} diff --git a/persistence-modules/spring-persistence-simple-2/README.md b/persistence-modules/spring-persistence-simple-2/README.md deleted file mode 100644 index d80c7efc57..0000000000 --- a/persistence-modules/spring-persistence-simple-2/README.md +++ /dev/null @@ -1,6 +0,0 @@ -### Relevant Articles: - -- [Spring JdbcTemplate Unit Testing](https://www.baeldung.com/spring-jdbctemplate-testing) -- [Using a List of Values in a JdbcTemplate IN Clause](https://www.baeldung.com/spring-jdbctemplate-in-list) -- [Transactional Annotations: Spring vs. JTA](https://www.baeldung.com/spring-vs-jta-transactional) -- [Test a Mock JNDI Datasource with Spring](https://www.baeldung.com/spring-mock-jndi-datasource) diff --git a/persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/schema.sql b/persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/schema.sql deleted file mode 100644 index be102431ca..0000000000 --- a/persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/schema.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE EMPLOYEE -( - ID int NOT NULL PRIMARY KEY, - FIRST_NAME varchar(255), - LAST_NAME varchar(255) -); \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/test-data.sql b/persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/test-data.sql deleted file mode 100644 index 5421c09849..0000000000 --- a/persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/test-data.sql +++ /dev/null @@ -1,4 +0,0 @@ -INSERT INTO EMPLOYEE VALUES (1, 'James', 'Gosling'); -INSERT INTO EMPLOYEE VALUES (2, 'Donald', 'Knuth'); -INSERT INTO EMPLOYEE VALUES (3, 'Linus', 'Torvalds'); -INSERT INTO EMPLOYEE VALUES (4, 'Dennis', 'Ritchie'); \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/.gitignore b/persistence-modules/spring-persistence-simple/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/persistence-modules/spring-persistence-simple/.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/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md new file mode 100644 index 0000000000..d665433eef --- /dev/null +++ b/persistence-modules/spring-persistence-simple/README.md @@ -0,0 +1,25 @@ +========= + +## Spring Persistence Example Project + + +### Relevant Articles: +- [A Guide to JPA with Spring](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) +- [Bootstrapping Hibernate 5 with Spring](http://www.baeldung.com/hibernate-5-spring) +- [The DAO with Spring and Hibernate](https://www.baeldung.com/persistence-layer-with-spring-and-hibernate) +- [Simplify the DAO with Spring and Java Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) +- [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) +- [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) +- [Spring Data JPA @Query](http://www.baeldung.com/spring-data-jpa-query) +- [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate) +- [Transaction Propagation and Isolation in Spring @Transactional](https://www.baeldung.com/spring-transactional-propagation-isolation) + +### Eclipse Config +After importing the project into Eclipse, you may see the following error: +"No persistence xml file found in project" + +This can be ignored: +- Project -> Properties -> Java Persistance -> JPA -> Error/Warnings -> Select Ignore on "No persistence xml file found in project" +Or: +- Eclipse -> Preferences - Validation - disable the "Build" execution of the JPA Validator + diff --git a/persistence-modules/spring-persistence-simple-2/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml similarity index 91% rename from persistence-modules/spring-persistence-simple-2/pom.xml rename to persistence-modules/spring-persistence-simple/pom.xml index b8f3b384a2..6ca0f3f025 100644 --- a/persistence-modules/spring-persistence-simple-2/pom.xml +++ b/persistence-modules/spring-persistence-simple/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-persistence-simple-2 + spring-persistence-simple 0.1-SNAPSHOT - spring-persistence-simple-2 + spring-persistence-simple com.baeldung @@ -32,7 +32,7 @@ ${h2.version} test - + com.github.h-thurow @@ -48,9 +48,9 @@ test - org.mockito + org.mockito mockito-core - ${mockito.version} + ${mockito.version} test @@ -65,5 +65,4 @@ 3.3.3
    - \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple-2/src/main/resources/jndi/datasource.properties b/persistence-modules/spring-persistence-simple/src/main/resources/com/baeldung/spring/jndi/datasource/mock/datasource.properties similarity index 100% rename from persistence-modules/spring-persistence-simple-2/src/main/resources/jndi/datasource.properties rename to persistence-modules/spring-persistence-simple/src/main/resources/com/baeldung/spring/jndi/datasource/mock/datasource.properties diff --git a/persistence-modules/spring-persistence-simple-2/src/main/resources/jndi.properties b/persistence-modules/spring-persistence-simple/src/main/resources/jndi.properties similarity index 69% rename from persistence-modules/spring-persistence-simple-2/src/main/resources/jndi.properties rename to persistence-modules/spring-persistence-simple/src/main/resources/jndi.properties index d976f16c02..4ab5b3ba8b 100644 --- a/persistence-modules/spring-persistence-simple-2/src/main/resources/jndi.properties +++ b/persistence-modules/spring-persistence-simple/src/main/resources/jndi.properties @@ -3,4 +3,4 @@ org.osjava.sj.jndi.shared=true org.osjava.sj.delimiter=. jndi.syntax.separator=/ org.osjava.sj.space=java:/comp/env -org.osjava.sj.root=src/main/resources/jndi +org.osjava.sj.root=src/main/resources/com/baeldung/spring/jndi/datasource/mock diff --git a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jndi/datasource/SimpleJNDIUnitTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/jndi/datasource/mock/SimpleJNDIUnitTest.java similarity index 95% rename from persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jndi/datasource/SimpleJNDIUnitTest.java rename to persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/jndi/datasource/mock/SimpleJNDIUnitTest.java index 37f33b1192..6576962609 100644 --- a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jndi/datasource/SimpleJNDIUnitTest.java +++ b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/jndi/datasource/mock/SimpleJNDIUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jndi.datasource; +package com.baeldung.spring.jndi.datasource.mock; import static org.junit.Assert.assertEquals; diff --git a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jndi/datasource/SimpleNamingContextBuilderManualTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/jndi/datasource/mock/SimpleNamingContextBuilderManualTest.java similarity index 96% rename from persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jndi/datasource/SimpleNamingContextBuilderManualTest.java rename to persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/jndi/datasource/mock/SimpleNamingContextBuilderManualTest.java index ac33be1c6f..f4c3e012f9 100644 --- a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jndi/datasource/SimpleNamingContextBuilderManualTest.java +++ b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/spring/jndi/datasource/mock/SimpleNamingContextBuilderManualTest.java @@ -1,4 +1,4 @@ -package com.baeldung.jndi.datasource; +package com.baeldung.spring.jndi.datasource.mock; import static org.junit.Assert.assertNotNull; From 910bda6ef1215e1e8933ccbbe2de0a4b5bd1f1e5 Mon Sep 17 00:00:00 2001 From: fdpro Date: Mon, 31 Aug 2020 15:46:07 +0200 Subject: [PATCH 0637/1862] [JAVA-2306] Fixed READMEs * spring-jpa-2 * spring-data-jpa-repo-2 * spring-data-jpa-query-2 * spring-jdbc * spring-persistence-simple --- persistence-modules/spring-data-jpa-query-2/README.md | 1 + persistence-modules/spring-data-jpa-query/README.md | 1 - persistence-modules/spring-data-jpa-repo-2/README.md | 5 +++++ persistence-modules/spring-data-jpa-repo/README.md | 1 + persistence-modules/spring-jdbc/README.md | 6 ++++++ persistence-modules/spring-jpa-2/README.md | 5 +++++ persistence-modules/spring-persistence-simple/README.md | 9 +-------- 7 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 persistence-modules/spring-data-jpa-repo-2/README.md create mode 100644 persistence-modules/spring-jdbc/README.md diff --git a/persistence-modules/spring-data-jpa-query-2/README.md b/persistence-modules/spring-data-jpa-query-2/README.md index a4d657d4c6..1cb3d54da9 100644 --- a/persistence-modules/spring-data-jpa-query-2/README.md +++ b/persistence-modules/spring-data-jpa-query-2/README.md @@ -4,6 +4,7 @@ This module contains articles about querying data using Spring Data JPA ### Relevant Articles: - [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries) +- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) - More articles: [[<-- prev]](../spring-data-jpa-query) ### Eclipse Config diff --git a/persistence-modules/spring-data-jpa-query/README.md b/persistence-modules/spring-data-jpa-query/README.md index 34e397394b..27443c2026 100644 --- a/persistence-modules/spring-data-jpa-query/README.md +++ b/persistence-modules/spring-data-jpa-query/README.md @@ -3,7 +3,6 @@ This module contains articles about querying data using Spring Data JPA ### Relevant Articles: -- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) - [The Exists Query in Spring Data](https://www.baeldung.com/spring-data-exists-query) - [Customizing the Result of JPA Queries with Aggregation Functions](https://www.baeldung.com/jpa-queries-custom-result-with-aggregation-functions) - [Limiting Query Results with JPA and Spring Data JPA](https://www.baeldung.com/jpa-limit-query-results) diff --git a/persistence-modules/spring-data-jpa-repo-2/README.md b/persistence-modules/spring-data-jpa-repo-2/README.md new file mode 100644 index 0000000000..de5188c1ad --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-2/README.md @@ -0,0 +1,5 @@ +## Spring Data JPA - Repositories + +### Relevant Articles: +- [Introduction to Spring Data JPA](https://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) +- More articles: [[<-- prev]](/spring-data-jpa-repo/) \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/README.md b/persistence-modules/spring-data-jpa-repo/README.md index 284a7ac2b5..1a95340a97 100644 --- a/persistence-modules/spring-data-jpa-repo/README.md +++ b/persistence-modules/spring-data-jpa-repo/README.md @@ -11,6 +11,7 @@ This module contains articles about repositories in Spring Data JPA - [Spring Data Composable Repositories](https://www.baeldung.com/spring-data-composable-repositories) - [Spring Data JPA Repository Populators](https://www.baeldung.com/spring-data-jpa-repository-populators) - [Calling Stored Procedures from Spring Data JPA Repositories](https://www.baeldung.com/spring-data-jpa-stored-procedures) +- More articles: [[--> next]](/spring-data-jpa-repo-2/) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/persistence-modules/spring-jdbc/README.md b/persistence-modules/spring-jdbc/README.md new file mode 100644 index 0000000000..58d7bdec43 --- /dev/null +++ b/persistence-modules/spring-jdbc/README.md @@ -0,0 +1,6 @@ +## Spring JDBC + +### Relevant Articles: +- [Spring JDBC Template](https://www.baeldung.com/spring-jdbc-jdbctemplate) +- [Spring JDBC Template Testing](https://www.baeldung.com/spring-jdbctemplate-testing) +- [Spring JDBC Template In Clause](https://www.baeldung.com/spring-jdbctemplate-in-list) \ No newline at end of file diff --git a/persistence-modules/spring-jpa-2/README.md b/persistence-modules/spring-jpa-2/README.md index b1786f49bd..fe661c2f28 100644 --- a/persistence-modules/spring-jpa-2/README.md +++ b/persistence-modules/spring-jpa-2/README.md @@ -2,4 +2,9 @@ ### Relevant Articles: - [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many) +- [A Guide to JPA with Spring](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) +- [Bootstrapping Hibernate 5 with Spring](https://www.baeldung.com/hibernate-5-spring) +- [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) +- [The DAO with Spring and Hibernate](https://www.baeldung.com/persistence-layer-with-spring-and-hibernate) +- [Simplify the DAO with Spring and Java Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) - More articles: [[<-- prev]](/spring-jpa) \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index d665433eef..3239ec993b 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -4,15 +4,8 @@ ### Relevant Articles: -- [A Guide to JPA with Spring](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) -- [Bootstrapping Hibernate 5 with Spring](http://www.baeldung.com/hibernate-5-spring) -- [The DAO with Spring and Hibernate](https://www.baeldung.com/persistence-layer-with-spring-and-hibernate) -- [Simplify the DAO with Spring and Java Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) -- [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) -- [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) -- [Spring Data JPA @Query](http://www.baeldung.com/spring-data-jpa-query) -- [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate) - [Transaction Propagation and Isolation in Spring @Transactional](https://www.baeldung.com/spring-transactional-propagation-isolation) +- [Mock JNDI Datasource](https://www.baeldung.com/spring-mock-jndi-datasource) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From 3b41d6352dafe7dc2788fb32d37adb6df803f486 Mon Sep 17 00:00:00 2001 From: fdpro Date: Mon, 31 Aug 2020 16:29:31 +0200 Subject: [PATCH 0638/1862] [JAVA-2306] Moved last article to spring-jdbc --- .../spring/jdbc/autogenkey/config/PersistenceConfig.java | 2 +- .../autogenkey/repository/MessageRepositoryJDBCTemplate.java | 0 .../repository/MessageRepositorySimpleJDBCInsert.java | 0 .../com/baeldung/spring/jdbc/autogenkey}/autogenkey-schema.sql | 0 .../baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) rename persistence-modules/{spring-jpa => spring-jdbc}/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java (90%) rename persistence-modules/{spring-jpa => spring-jdbc}/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java (100%) rename persistence-modules/{spring-jpa => spring-jdbc}/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java (100%) rename persistence-modules/{spring-jpa/src/main/resources => spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/autogenkey}/autogenkey-schema.sql (100%) rename persistence-modules/{spring-jpa => spring-jdbc}/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java (93%) diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java similarity index 90% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java index d1f8864357..6d36ac709f 100644 --- a/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/autogenkey/config/PersistenceConfig.java @@ -16,7 +16,7 @@ public class PersistenceConfig { public DataSource dataSource(Environment env) { return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) - .addScript("autogenkey-schema.sql") + .addScript("com/baeldung/spring/jdbc/autogenkey/autogenkey-schema.sql") .build(); } diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositoryJDBCTemplate.java diff --git a/persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java similarity index 100% rename from persistence-modules/spring-jpa/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java rename to persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/autogenkey/repository/MessageRepositorySimpleJDBCInsert.java diff --git a/persistence-modules/spring-jpa/src/main/resources/autogenkey-schema.sql b/persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/autogenkey/autogenkey-schema.sql similarity index 100% rename from persistence-modules/spring-jpa/src/main/resources/autogenkey-schema.sql rename to persistence-modules/spring-jdbc/src/main/resources/com/baeldung/spring/jdbc/autogenkey/autogenkey-schema.sql diff --git a/persistence-modules/spring-jpa/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java similarity index 93% rename from persistence-modules/spring-jpa/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java rename to persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java index f0ad853c2a..86a23ecc3e 100644 --- a/persistence-modules/spring-jpa/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java +++ b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/autogenkey/GetAutoGenKeyByJDBC.java @@ -7,6 +7,7 @@ import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; import org.springframework.test.context.junit4.SpringRunner; import com.baeldung.spring.jdbc.autogenkey.repository.MessageRepositoryJDBCTemplate; @@ -35,7 +36,6 @@ public class GetAutoGenKeyByJDBC { String loadedMessage = messageRepositoryJDBCTemplate.getMessageById(key); assertEquals(MESSAGE_CONTENT, loadedMessage); - } @Test From 16f3fdd81b66fd5ccb1689b5c7d185dc2fe23b36 Mon Sep 17 00:00:00 2001 From: fdpro Date: Tue, 1 Sep 2020 20:05:04 +0200 Subject: [PATCH 0639/1862] [JAVA-2306] Added .sdkmanrc to .gitignore --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fe56746dfd..88c5e49808 100644 --- a/.gitignore +++ b/.gitignore @@ -87,4 +87,7 @@ transaction.log apache-cxf/cxf-aegis/baeldung.xml testing-modules/report-*.json -libraries-2/*.db \ No newline at end of file +libraries-2/*.db + +# SDKMan +.sdkmanrc From 285890231d8a206eed1db8d0b9a16779f5f3654e Mon Sep 17 00:00:00 2001 From: fdpro Date: Tue, 1 Sep 2020 20:15:58 +0200 Subject: [PATCH 0640/1862] [JAVA-2306] Removed unnecessary Bar field in Foo class --- .../java/com/baeldung/spring/dao/generics/Foo.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/Foo.java b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/Foo.java index 7849abb25f..33284d9b8e 100644 --- a/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/Foo.java +++ b/persistence-modules/spring-jpa-2/src/main/java/com/baeldung/spring/dao/generics/Foo.java @@ -30,18 +30,6 @@ public class Foo implements Serializable { @Column(name = "NAME") private String name; - @ManyToOne(targetEntity = Bar.class, fetch = FetchType.EAGER) - @JoinColumn(name = "BAR_ID") - private Bar bar; - - public Bar getBar() { - return bar; - } - - public void setBar(final Bar bar) { - this.bar = bar; - } - public Long getId() { return id; } @@ -89,5 +77,4 @@ public class Foo implements Serializable { builder.append("Foo [name=").append(name).append("]"); return builder.toString(); } - } From 3fd89261458d9f3dad82047428d2df583b2d0a8a Mon Sep 17 00:00:00 2001 From: Maciej Glowka Date: Wed, 2 Sep 2020 23:56:02 +0200 Subject: [PATCH 0641/1862] BAEL-4297: fixed unsynchronized classes naming, added slf4j logging --- .../illegalmonitorstate/SynchronizedReceiver.java | 8 ++++++-- .../illegalmonitorstate/SynchronizedSender.java | 8 ++++++-- ...izedReceiver.java => UnsynchronizedReceiver.java} | 12 ++++++++---- ...hronizedSender.java => UnsynchronizedSender.java} | 12 ++++++++---- .../IllegalMonitorStateExceptionUnitTest.java | 4 ++-- 5 files changed, 30 insertions(+), 14 deletions(-) rename core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/{UnSynchronizedReceiver.java => UnsynchronizedReceiver.java} (66%) rename core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/{UnSynchronizedSender.java => UnsynchronizedSender.java} (64%) diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedReceiver.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedReceiver.java index 3dffb7b30a..ff6b926cdc 100644 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedReceiver.java +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedReceiver.java @@ -1,6 +1,10 @@ package com.baeldung.exceptions.illegalmonitorstate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class SynchronizedReceiver implements Runnable { + private static Logger log = LoggerFactory.getLogger(SynchronizedReceiver.class); private final Data data; private String message; private boolean illegalMonitorStateExceptionOccurred; @@ -16,10 +20,10 @@ public class SynchronizedReceiver implements Runnable { data.wait(); this.message = data.receive(); } catch (InterruptedException e) { - e.printStackTrace(); + log.error("thread was interrupted", e); Thread.currentThread().interrupt(); } catch (IllegalMonitorStateException e) { - e.printStackTrace(); + log.error("illegal monitor state exception occurred", e); illegalMonitorStateExceptionOccurred = true; } } diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedSender.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedSender.java index 04bac03e77..1618bc8efa 100644 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedSender.java +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/SynchronizedSender.java @@ -1,6 +1,10 @@ package com.baeldung.exceptions.illegalmonitorstate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class SynchronizedSender implements Runnable { + private static Logger log = LoggerFactory.getLogger(SynchronizedSender.class); private final Data data; private boolean illegalMonitorStateExceptionOccurred; @@ -18,10 +22,10 @@ public class SynchronizedSender implements Runnable { data.notifyAll(); } catch (InterruptedException e) { - e.printStackTrace(); + log.error("thread was interrupted", e); Thread.currentThread().interrupt(); } catch (IllegalMonitorStateException e) { - e.printStackTrace(); + log.error("illegal monitor state exception occurred", e); illegalMonitorStateExceptionOccurred = true; } } diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedReceiver.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnsynchronizedReceiver.java similarity index 66% rename from core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedReceiver.java rename to core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnsynchronizedReceiver.java index a8e8befc4d..3a0b72e6cd 100644 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedReceiver.java +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnsynchronizedReceiver.java @@ -1,11 +1,15 @@ package com.baeldung.exceptions.illegalmonitorstate; -public class UnSynchronizedReceiver implements Runnable { +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class UnsynchronizedReceiver implements Runnable { + private static Logger log = LoggerFactory.getLogger(UnsynchronizedReceiver.class); private final Data data; private String message; private boolean illegalMonitorStateExceptionOccurred; - public UnSynchronizedReceiver(Data data) { + public UnsynchronizedReceiver(Data data) { this.data = data; } @@ -15,10 +19,10 @@ public class UnSynchronizedReceiver implements Runnable { data.wait(); this.message = data.receive(); } catch (InterruptedException e) { - e.printStackTrace(); + log.error("thread was interrupted", e); Thread.currentThread().interrupt(); } catch (IllegalMonitorStateException e) { - e.printStackTrace(); + log.error("illegal monitor state exception occurred", e); illegalMonitorStateExceptionOccurred = true; } } diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedSender.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnsynchronizedSender.java similarity index 64% rename from core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedSender.java rename to core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnsynchronizedSender.java index eb6fa16649..7f15418bfa 100644 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnSynchronizedSender.java +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/illegalmonitorstate/UnsynchronizedSender.java @@ -1,10 +1,14 @@ package com.baeldung.exceptions.illegalmonitorstate; -public class UnSynchronizedSender implements Runnable { +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class UnsynchronizedSender implements Runnable { + private static Logger log = LoggerFactory.getLogger(UnsynchronizedSender.class); private final Data data; private boolean illegalMonitorStateExceptionOccurred; - public UnSynchronizedSender(Data data) { + public UnsynchronizedSender(Data data) { this.data = data; } @@ -17,10 +21,10 @@ public class UnSynchronizedSender implements Runnable { data.notifyAll(); } catch (InterruptedException e) { - e.printStackTrace(); + log.error("thread was interrupted", e); Thread.currentThread().interrupt(); } catch (IllegalMonitorStateException e) { - e.printStackTrace(); + log.error("illegal monitor state exception occurred", e); illegalMonitorStateExceptionOccurred = true; } } diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/illegalmonitorstate/IllegalMonitorStateExceptionUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/illegalmonitorstate/IllegalMonitorStateExceptionUnitTest.java index 800cdc4a7b..a729facdbd 100644 --- a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/illegalmonitorstate/IllegalMonitorStateExceptionUnitTest.java +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/illegalmonitorstate/IllegalMonitorStateExceptionUnitTest.java @@ -30,7 +30,7 @@ public class IllegalMonitorStateExceptionUnitTest { void whenSyncSenderAndUnSyncReceiverAreUsed_thenIllegalMonitorExceptionShouldNotBeThrown() throws InterruptedException { Data data = new Data(); - UnSynchronizedReceiver receiver = new UnSynchronizedReceiver(data); + UnsynchronizedReceiver receiver = new UnsynchronizedReceiver(data); Thread receiverThread = new Thread(receiver, "receiver-thread"); receiverThread.start(); @@ -55,7 +55,7 @@ public class IllegalMonitorStateExceptionUnitTest { Thread receiverThread = new Thread(receiver, "receiver-thread"); receiverThread.start(); - UnSynchronizedSender sender = new UnSynchronizedSender(data); + UnsynchronizedSender sender = new UnsynchronizedSender(data); Thread senderThread = new Thread(sender, "sender-thread"); senderThread.start(); From 3146226399b94c536a51e6f87bbe21099b185f23 Mon Sep 17 00:00:00 2001 From: Meysam Tamkin Date: Thu, 3 Sep 2020 10:16:45 +0430 Subject: [PATCH 0642/1862] Fix it some changes --- ...icTest.java => BeforeAndAfterAnnotationsUnitTest.java} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/{BeforeAfterAllNonStaticTest.java => BeforeAndAfterAnnotationsUnitTest.java} (70%) diff --git a/testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAfterAllNonStaticTest.java b/testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java similarity index 70% rename from testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAfterAllNonStaticTest.java rename to testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java index 8dbe95ddf8..1bfea8447b 100644 --- a/testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAfterAllNonStaticTest.java +++ b/testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java @@ -3,7 +3,7 @@ package com.baeldung.junit5.nonstatic; import org.junit.jupiter.api.*; @TestInstance(TestInstance.Lifecycle.PER_CLASS) -public class BeforeAfterAllNonStaticTest { +public class BeforeAndAfterAnnotationsUnitTest { String input; Long result; @@ -15,11 +15,13 @@ public class BeforeAfterAllNonStaticTest { @AfterAll public void teardown() { - Assertions.assertEquals(77l, result); + input = null; + result = null; } @Test - public void testConvertStringToLong() { + public void whenConvertStringToLong_thenResultShouldBeLong() { result = Long.valueOf(input); + Assertions.assertEquals(77l, result); } } From 1d5b20e70589e7311ebfdf353e8ca232a7c1f3ea Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Thu, 3 Sep 2020 15:46:48 +0300 Subject: [PATCH 0643/1862] BAEL-4371: Simplified examples --- gradle-5/cmd-line-args/build.gradle | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/gradle-5/cmd-line-args/build.gradle b/gradle-5/cmd-line-args/build.gradle index 57c48e36c3..5399db4815 100644 --- a/gradle-5/cmd-line-args/build.gradle +++ b/gradle-5/cmd-line-args/build.gradle @@ -10,21 +10,17 @@ application { task propertyTypes(){ doLast{ - project.getProperties().values().each { - println "Project property ["+it+"]" - } - - System.getProperties().each { - println "System property ["+it+"]" + if (project.hasProperty("args")) { + println "Our input argument with project property ["+project.getProperty("args")+"]" } + println "Our input argument with system property ["+System.getProperty("args")+"]" } } if (project.hasProperty("args")) { ext.cmdargs = project.getProperty("args") - ext.cmdargsarray = cmdargs.split() } else { - ext.cmdargs = "" + ext.cmdargs = "ls" } task cmdLineJavaExec(type: JavaExec) { @@ -32,15 +28,11 @@ task cmdLineJavaExec(type: JavaExec) { description = "Run the main class with JavaExecTask" classpath = sourceSets.main.runtimeClasspath main = javaMainClass - args cmdargsarray + args cmdargs.split() } -ext.cmdarray = ["java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(), javaMainClass] -cmdarray = (cmdarray << cmdargsarray).flatten() - task cmdLineExec(type: Exec) { - dependsOn build group = "Execution" - description = "Run the main class with ExecTask" - commandLine cmdarray + description = "Run the an external program with ExecTask" + commandLine cmdargs.split() } From 5b20bb3d2a4608a4523827f2bfc85159bae454ef Mon Sep 17 00:00:00 2001 From: Marco Denisi Date: Thu, 3 Sep 2020 16:59:07 +0200 Subject: [PATCH 0644/1862] BAEL-3619 - add swagger samples --- .../openapi-3-date-format.yaml | 36 +++++++++++++++++++ .../openapi-3-date-pattern.yaml | 36 +++++++++++++++++++ .../openapi-3-datetime-format.yaml | 36 +++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-date-format.yaml create mode 100644 spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-date-pattern.yaml create mode 100644 spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-datetime-format.yaml diff --git a/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-date-format.yaml b/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-date-format.yaml new file mode 100644 index 0000000000..7ee581d3d8 --- /dev/null +++ b/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-date-format.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.1 +info: + title: API Title + description: This is a sample API. + version: 1.0.0 +servers: + - url: https://host/ +paths: + /users: + get: + summary: Get Users + operationId: getUsers + responses: + 200: + description: Valid input + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' +components: + schemas: + User: + type: object + properties: + id: + type: integer + format: int64 + createdAt: + type: string + format: date + description: Creation date + example: "2021-01-30" + username: + type: string \ No newline at end of file diff --git a/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-date-pattern.yaml b/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-date-pattern.yaml new file mode 100644 index 0000000000..ffba36f3da --- /dev/null +++ b/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-date-pattern.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.1 +info: + title: API Title + description: This is a sample API. + version: 1.0.0 +servers: + - url: https://host/ +paths: + /users: + get: + summary: Get Users + operationId: getUsers + responses: + 200: + description: Valid input + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' +components: + schemas: + User: + type: object + properties: + id: + type: integer + format: int64 + customDate: + type: string + pattern: '^\d{4}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$' + description: Custom date + example: "20210130" + username: + type: string \ No newline at end of file diff --git a/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-datetime-format.yaml b/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-datetime-format.yaml new file mode 100644 index 0000000000..8bf4ddd2dc --- /dev/null +++ b/spring-rest-http/src/main/resources/openapi-dates-definitions/openapi-3-datetime-format.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.1 +info: + title: API Title + description: This is a sample API. + version: 1.0.0 +servers: + - url: https://host/ +paths: + /users: + get: + summary: Get Users + operationId: getUsers + responses: + 200: + description: Valid input + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' +components: + schemas: + User: + type: object + properties: + id: + type: integer + format: int64 + createdAt: + type: string + format: date-time + description: Creation date and time + example: "2021-01-30T08:30:00Z" + username: + type: string \ No newline at end of file From 53360080dbb38bc7ee81f6fff8e573f766b6ec66 Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Thu, 3 Sep 2020 20:49:20 -0500 Subject: [PATCH 0645/1862] BAEL-4387 Change Module --- .../baeldung/arrayconversion/ArrayToListConversionUnitTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {core-java-modules/core-java-string-operations-3 => java-collections-conversions-2}/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java (100%) diff --git a/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java similarity index 100% rename from core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java rename to java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java From 68b732beb0103af02a3d5a40aa041a7bfb05a5f1 Mon Sep 17 00:00:00 2001 From: fdpro Date: Sat, 5 Sep 2020 14:59:15 +0200 Subject: [PATCH 0646/1862] [JAVA-2306] Fixes after Loredana's review * Brought back UserRepositoryCustomImpl.java * Added link to https://www.baeldung.com/spring-data-jpa-query in spring-data-jpa-query-2 README * Migrated code for https://www.baeldung.com/spring-data-jpa-query-by-date * Migrated https://www.baeldung.com/spring-vs-jta-transactional to spring-persistence-simple --- .../spring-data-jpa-query-2/README.md | 1 + .../jpa/query/UserRepositoryCustomImpl.java | 48 +++++++++++++++++++ .../data/jpa/query/datetime/Application.java} | 25 +++++----- .../data/jpa/query/datetime}/Article.java | 2 +- .../query/datetime}/ArticleRepository.java | 4 +- .../src/main/resources/import_entities.sql | 0 .../ArticleRepositoryIntegrationTest.java | 16 +++---- .../spring-persistence-simple/README.md | 1 + .../spring-persistence-simple/pom.xml | 29 +++++++++++ .../baeldung/spring/transactional}/Car.java | 2 +- .../spring/transactional}/CarRepository.java | 3 +- .../spring/transactional}/CarService.java | 4 +- .../spring/transactional}/RentalService.java | 4 +- 13 files changed, 105 insertions(+), 34 deletions(-) create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepositoryCustomImpl.java rename persistence-modules/{spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/TransactionalCompareApplication.java => spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/Application.java} (55%) rename persistence-modules/{spring-data-jpa-query/src/main/java/com/baeldung/boot/domain => spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime}/Article.java (88%) rename persistence-modules/{spring-data-jpa-query/src/main/java/com/baeldung/boot/daos => spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime}/ArticleRepository.java (90%) rename persistence-modules/{spring-data-jpa-query => spring-data-jpa-query-2}/src/main/resources/import_entities.sql (100%) rename persistence-modules/{spring-data-jpa-query/src/test/java/com/baeldung/boot/daos => spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime}/ArticleRepositoryIntegrationTest.java (96%) rename persistence-modules/{spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/entity => spring-persistence-simple/src/main/java/com/baeldung/spring/transactional}/Car.java (95%) rename persistence-modules/{spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/repository => spring-persistence-simple/src/main/java/com/baeldung/spring/transactional}/CarRepository.java (55%) rename persistence-modules/{spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/service => spring-persistence-simple/src/main/java/com/baeldung/spring/transactional}/CarService.java (83%) rename persistence-modules/{spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/service => spring-persistence-simple/src/main/java/com/baeldung/spring/transactional}/RentalService.java (75%) diff --git a/persistence-modules/spring-data-jpa-query-2/README.md b/persistence-modules/spring-data-jpa-query-2/README.md index 1cb3d54da9..fdb4ce3db7 100644 --- a/persistence-modules/spring-data-jpa-query-2/README.md +++ b/persistence-modules/spring-data-jpa-query-2/README.md @@ -3,6 +3,7 @@ This module contains articles about querying data using Spring Data JPA ### Relevant Articles: +- [Spring Data JPA @Query Annotation](https://www.baeldung.com/spring-data-jpa-query) - [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries) - [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) - More articles: [[<-- prev]](../spring-data-jpa-query) diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepositoryCustomImpl.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepositoryCustomImpl.java new file mode 100644 index 0000000000..033f61fdd3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/UserRepositoryCustomImpl.java @@ -0,0 +1,48 @@ +package com.baeldung.spring.data.jpa.query; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.criteria.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class UserRepositoryCustomImpl implements UserRepositoryCustom { + @PersistenceContext + private EntityManager entityManager; + + @Override + public List findUserByEmails(Set emails) { + CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + CriteriaQuery query = cb.createQuery(User.class); + Root user = query.from(User.class); + + Path emailPath = user.get("email"); + + List predicates = new ArrayList<>(); + for (String email : emails) { + + predicates.add(cb.like(emailPath, email)); + + } + query.select(user) + .where(cb.or(predicates.toArray(new Predicate[predicates.size()]))); + + return entityManager.createQuery(query) + .getResultList(); + } + + @Override + public List findAllUsersByPredicates(Collection> predicates) { + List allUsers = entityManager.createQuery("select u from User u", User.class).getResultList(); + Stream allUsersStream = allUsers.stream(); + for (java.util.function.Predicate predicate : predicates) { + allUsersStream = allUsersStream.filter(predicate); + } + + return allUsersStream.collect(Collectors.toList()); + } +} diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/TransactionalCompareApplication.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/Application.java similarity index 55% rename from persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/TransactionalCompareApplication.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/Application.java index 7fee55be8a..81e5a2f790 100644 --- a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/TransactionalCompareApplication.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/Application.java @@ -1,12 +1,13 @@ -package com.baeldung.spring.transactional; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -class TransactionalCompareApplication { - - public static void main(String[] args) { - SpringApplication.run(TransactionalCompareApplication.class, args); - } -} +package com.baeldung.spring.data.jpa.query.datetime; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + +} diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/domain/Article.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/Article.java similarity index 88% rename from persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/domain/Article.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/Article.java index de4dbed1a0..bb0e4e88df 100644 --- a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/domain/Article.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/Article.java @@ -1,4 +1,4 @@ -package com.baeldung.boot.domain; +package com.baeldung.spring.data.jpa.query.datetime; import javax.persistence.*; import java.util.Date; diff --git a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/daos/ArticleRepository.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepository.java similarity index 90% rename from persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/daos/ArticleRepository.java rename to persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepository.java index 73397ad42e..9ec14884f4 100644 --- a/persistence-modules/spring-data-jpa-query/src/main/java/com/baeldung/boot/daos/ArticleRepository.java +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepository.java @@ -1,11 +1,9 @@ -package com.baeldung.boot.daos; +package com.baeldung.spring.data.jpa.query.datetime; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; -import com.baeldung.boot.domain.Article; - import java.util.Date; import java.util.List; diff --git a/persistence-modules/spring-data-jpa-query/src/main/resources/import_entities.sql b/persistence-modules/spring-data-jpa-query-2/src/main/resources/import_entities.sql similarity index 100% rename from persistence-modules/spring-data-jpa-query/src/main/resources/import_entities.sql rename to persistence-modules/spring-data-jpa-query-2/src/main/resources/import_entities.sql diff --git a/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java similarity index 96% rename from persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java rename to persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java index 20fc3cbeaf..38fd804195 100644 --- a/persistence-modules/spring-data-jpa-query/src/test/java/com/baeldung/boot/daos/ArticleRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java @@ -1,11 +1,4 @@ -package com.baeldung.boot.daos; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; +package com.baeldung.spring.data.jpa.query.datetime; import org.junit.Test; import org.junit.runner.RunWith; @@ -13,7 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.boot.domain.Article; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) @DataJpaTest(properties="spring.datasource.data=classpath:import_entities.sql") diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index 3239ec993b..baa9107f4e 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -5,6 +5,7 @@ ### Relevant Articles: - [Transaction Propagation and Isolation in Spring @Transactional](https://www.baeldung.com/spring-transactional-propagation-isolation) +- [JTA Transaction with Spring](https://www.baeldung.com/spring-vs-jta-transactional) - [Mock JNDI Datasource](https://www.baeldung.com/spring-mock-jndi-datasource) ### Eclipse Config diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml index 6ca0f3f025..a069f70994 100644 --- a/persistence-modules/spring-persistence-simple/pom.xml +++ b/persistence-modules/spring-persistence-simple/pom.xml @@ -26,6 +26,31 @@ + + javax.persistence + javax.persistence-api + ${persistence-api.version} + + + org.springframework.data + spring-data-jpa + ${spring-data-jpa.version} + + + javax.transaction + javax.transaction-api + ${transaction-api.version} + + + org.springframework + spring-tx + ${org.springframework.version} + + + org.springframework.boot + spring-boot-starter + ${spring-boot-starter.version} + com.h2database h2 @@ -58,7 +83,11 @@ 5.2.4.RELEASE + 2.3.3.RELEASE + 2.2 + 1.3 + 2.2.7.RELEASE 1.4.200 0.23.0 diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/entity/Car.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/Car.java similarity index 95% rename from persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/entity/Car.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/Car.java index 1219111ffa..cb0dc21f7d 100644 --- a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/entity/Car.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/Car.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.transactional.entity; +package com.baeldung.spring.transactional; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/repository/CarRepository.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/CarRepository.java similarity index 55% rename from persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/repository/CarRepository.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/CarRepository.java index f8ecc8f550..ca82954751 100644 --- a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/repository/CarRepository.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/CarRepository.java @@ -1,6 +1,5 @@ -package com.baeldung.spring.transactional.repository; +package com.baeldung.spring.transactional; -import com.baeldung.spring.transactional.entity.Car; import org.springframework.data.jpa.repository.JpaRepository; public interface CarRepository extends JpaRepository { diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/service/CarService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/CarService.java similarity index 83% rename from persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/service/CarService.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/CarService.java index 0821ddb02b..00396d191a 100644 --- a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/service/CarService.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/CarService.java @@ -1,7 +1,5 @@ -package com.baeldung.spring.transactional.service; +package com.baeldung.spring.transactional; -import com.baeldung.spring.transactional.entity.Car; -import com.baeldung.spring.transactional.repository.CarRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/service/RentalService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/RentalService.java similarity index 75% rename from persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/service/RentalService.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/RentalService.java index 0aa0815a98..468ac2e53d 100644 --- a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/spring/transactional/service/RentalService.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/transactional/RentalService.java @@ -1,7 +1,5 @@ -package com.baeldung.spring.transactional.service; +package com.baeldung.spring.transactional; -import com.baeldung.spring.transactional.entity.Car; -import com.baeldung.spring.transactional.repository.CarRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; From a7dc3199ad223524a76a56a000fbfb9dacf9967f Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Sat, 5 Sep 2020 18:46:57 +0100 Subject: [PATCH 0647/1862] BAEL-3326, "Optimizing JSON Schema for production use": Added domain classes and JUnit tests. --- json/pom.xml | 5 + .../baeldung/jsonoptimization/Customer.java | 123 ++ .../CustomerDeserializer.java | 44 + .../jsonoptimization/CustomerNoNull.java | 36 + .../jsonoptimization/CustomerSerializer.java | 34 + .../jsonoptimization/CustomerShortNames.java | 138 +++ .../CustomerShortNamesNoNull.java | 38 + .../jsonoptimization/CustomerSlim.java | 74 ++ .../JsonOptimizationUnitTest.java | 145 +++ .../json_optimization_mock_data.json | 1000 +++++++++++++++++ 10 files changed, 1637 insertions(+) create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/Customer.java create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java create mode 100644 json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java create mode 100644 json/src/test/resources/json_optimization_mock_data.json diff --git a/json/pom.xml b/json/pom.xml index bd901b526e..99fcfed362 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -45,6 +45,11 @@ jackson-databind ${jackson.version} + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + javax.json.bind javax.json.bind-api diff --git a/json/src/main/java/com/baeldung/jsonoptimization/Customer.java b/json/src/main/java/com/baeldung/jsonoptimization/Customer.java new file mode 100644 index 0000000000..81a74971ea --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/Customer.java @@ -0,0 +1,123 @@ +package com.baeldung.jsonoptimization; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class Customer { + + private long id; + private String firstName; + private String lastName; + private String street; + private String postalCode; + private String city; + private String state; + private String phoneNumber; + private String email; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public int hashCode() { + return Objects.hash(city, email, firstName, id, lastName, phoneNumber, postalCode, state, street); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof Customer)) { + return false; + } + Customer other = (Customer) obj; + return Objects.equals(city, other.city) && Objects.equals(email, other.email) && Objects.equals(firstName, other.firstName) && id == other.id && Objects.equals(lastName, other.lastName) && Objects.equals(phoneNumber, other.phoneNumber) + && Objects.equals(postalCode, other.postalCode) && Objects.equals(state, other.state) && Objects.equals(street, other.street); + } + + @Override + public String toString() { + return "Customer [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", street=" + street + ", postalCode=" + postalCode + ", city=" + city + ", state=" + state + ", phoneNumber=" + phoneNumber + ", email=" + email + "]"; + } + + public static Customer[] fromMockFile() throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + InputStream jsonFile = new FileInputStream("src/test/resources/json_optimization_mock_data.json"); + Customer[] feedback = objectMapper.readValue(jsonFile, Customer[].class); + return feedback; + } +} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java new file mode 100644 index 0000000000..1f478ed446 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java @@ -0,0 +1,44 @@ +package com.baeldung.jsonoptimization; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class CustomerDeserializer extends StdDeserializer { + private static final long serialVersionUID = 1L; + + public CustomerDeserializer() { + this(null); + } + + public CustomerDeserializer(Class t) { + super(t); + } + + @Override + public Customer deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { + Customer feedback = new Customer(); + ObjectCodec codec = parser.getCodec(); + JsonNode node = codec.readTree(parser); + + feedback.setId(node.get(0).asLong()); + feedback.setFirstName(node.get(1).asText()); + feedback.setLastName(node.get(2).asText()); + feedback.setStreet(node.get(3).asText()); + feedback.setPostalCode(node.get(4).asText()); + feedback.setCity(node.get(5).asText()); + feedback.setState(node.get(6).asText()); + JsonNode phoneNumber = node.get(7); + feedback.setPhoneNumber(phoneNumber.isNull() ? null : phoneNumber.asText()); + JsonNode email = node.get(8); + feedback.setEmail(email.isNull() ? null : email.asText()); + return feedback; + } +} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java new file mode 100644 index 0000000000..1ee76f762a --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java @@ -0,0 +1,36 @@ +package com.baeldung.jsonoptimization; + +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CustomerNoNull extends Customer { + + @Override + public String toString() { + return "CustomerNoNull [toString()=" + super.toString() + "]"; + } + + public static CustomerNoNull[] fromCustomers(Customer[] customers) { + CustomerNoNull[] feedback = new CustomerNoNull[customers.length]; + + for(int i = 0; i < customers.length; i++) { + Customer aCustomer = customers[i]; + CustomerNoNull newOne = new CustomerNoNull(); + + newOne.setId(aCustomer.getId()); + newOne.setFirstName(aCustomer.getFirstName()); + newOne.setLastName(aCustomer.getLastName()); + newOne.setStreet(aCustomer.getStreet()); + newOne.setCity(aCustomer.getCity()); + newOne.setPostalCode(aCustomer.getPostalCode()); + newOne.setState(aCustomer.getState()); + newOne.setPhoneNumber(aCustomer.getPhoneNumber()); + newOne.setEmail(aCustomer.getEmail()); + + feedback[i] = newOne; + } + + return feedback; + } + +} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java new file mode 100644 index 0000000000..7e58010640 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java @@ -0,0 +1,34 @@ +package com.baeldung.jsonoptimization; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class CustomerSerializer extends StdSerializer { + private static final long serialVersionUID = 1L; + + public CustomerSerializer() { + this(null); + } + + public CustomerSerializer(Class t) { + super(t); + } + + @Override + public void serialize(Customer customer, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { + jsonGenerator.writeStartArray(); + jsonGenerator.writeNumber(customer.getId()); + jsonGenerator.writeString(customer.getFirstName()); + jsonGenerator.writeString(customer.getLastName()); + jsonGenerator.writeString(customer.getStreet()); + jsonGenerator.writeString(customer.getPostalCode()); + jsonGenerator.writeString(customer.getCity()); + jsonGenerator.writeString(customer.getState()); + jsonGenerator.writeString(customer.getPhoneNumber()); + jsonGenerator.writeString(customer.getEmail()); + jsonGenerator.writeEndArray(); + } +} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java new file mode 100644 index 0000000000..ffa10f786d --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java @@ -0,0 +1,138 @@ +package com.baeldung.jsonoptimization; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonGetter; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CustomerShortNames { + + private long id; + + @JsonProperty("f") + private String firstName; + + @JsonProperty("l") + private String lastName; + + @JsonProperty("s") + private String street; + + @JsonProperty("p") + private String postalCode; + + @JsonProperty("c") + private String city; + + @JsonProperty("a") + private String state; + + @JsonProperty("o") + private String phoneNumber; + + @JsonProperty("e") + private String email; + + public long getId() { + return id; + } + public void setId(long id) { + this.id = id; + } + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } + public String getStreet() { + return street; + } + public void setStreet(String street) { + this.street = street; + } + public String getPostalCode() { + return postalCode; + } + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + public String getCity() { + return city; + } + public void setCity(String city) { + this.city = city; + } + public String getState() { + return state; + } + public void setState(String state) { + this.state = state; + } + public String getPhoneNumber() { + return phoneNumber; + } + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + + @Override + public int hashCode() { + return Objects.hash(city, email, firstName, id, lastName, phoneNumber, postalCode, state, street); + } + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CustomerShortNames)) { + return false; + } + CustomerShortNames other = (CustomerShortNames) obj; + return Objects.equals(city, other.city) && Objects.equals(email, other.email) && Objects.equals(firstName, other.firstName) && id == other.id && Objects.equals(lastName, other.lastName) && Objects.equals(phoneNumber, other.phoneNumber) + && Objects.equals(postalCode, other.postalCode) && Objects.equals(state, other.state) && Objects.equals(street, other.street); + } + + @Override + public String toString() { + return "CustomerWithShorterAttributes [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", street=" + street + ", postalCode=" + postalCode + ", city=" + city + ", state=" + state + ", phoneNumber=" + phoneNumber + ", email=" + email + + "]"; + } + + public static CustomerShortNames[] fromCustomers(Customer[] customers) { + CustomerShortNames[] feedback = new CustomerShortNames[customers.length]; + + for(int i = 0; i < customers.length; i++) { + Customer aCustomer = customers[i]; + CustomerShortNames newOne = new CustomerShortNames(); + + newOne.setId(aCustomer.getId()); + newOne.setFirstName(aCustomer.getFirstName()); + newOne.setLastName(aCustomer.getLastName()); + newOne.setStreet(aCustomer.getStreet()); + newOne.setCity(aCustomer.getCity()); + newOne.setPostalCode(aCustomer.getPostalCode()); + newOne.setState(aCustomer.getState()); + newOne.setPhoneNumber(aCustomer.getPhoneNumber()); + newOne.setEmail(aCustomer.getEmail()); + + feedback[i] = newOne; + } + + return feedback; + } + +} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java new file mode 100644 index 0000000000..d3e9648a98 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java @@ -0,0 +1,38 @@ +package com.baeldung.jsonoptimization; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class CustomerShortNamesNoNull extends CustomerShortNames { + + + @Override + public String toString() { + return "CustomerShortNamesNoNull [toString()=" + super.toString() + "]"; + } + + public static CustomerShortNamesNoNull[] fromCustomers(Customer[] customers) { + CustomerShortNamesNoNull[] feedback = new CustomerShortNamesNoNull[customers.length]; + + for(int i = 0; i < customers.length; i++) { + Customer aCustomer = customers[i]; + CustomerShortNamesNoNull newOne = new CustomerShortNamesNoNull(); + + newOne.setId(aCustomer.getId()); + newOne.setFirstName(aCustomer.getFirstName()); + newOne.setLastName(aCustomer.getLastName()); + newOne.setStreet(aCustomer.getStreet()); + newOne.setCity(aCustomer.getCity()); + newOne.setPostalCode(aCustomer.getPostalCode()); + newOne.setState(aCustomer.getState()); + newOne.setPhoneNumber(aCustomer.getPhoneNumber()); + newOne.setEmail(aCustomer.getEmail()); + + feedback[i] = newOne; + } + + return feedback; + } + +} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java new file mode 100644 index 0000000000..cdfaa4e329 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java @@ -0,0 +1,74 @@ +package com.baeldung.jsonoptimization; + +import java.util.Objects; + +public class CustomerSlim { + private long id; + private String name; + private String address; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public int hashCode() { + return Objects.hash(address, id, name); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CustomerSlim)) { + return false; + } + CustomerSlim other = (CustomerSlim) obj; + return Objects.equals(address, other.address) && id == other.id && Objects.equals(name, other.name); + } + + @Override + public String toString() { + return "CustomerSlim [id=" + id + ", name=" + name + ", address=" + address + "]"; + } + + public static CustomerSlim[] fromCustomers(Customer[] customers) { + CustomerSlim[] feedback = new CustomerSlim[customers.length]; + + for(int i = 0; i < customers.length; i++) { + Customer aCustomer = customers[i]; + CustomerSlim newOne = new CustomerSlim(); + + newOne.setId(aCustomer.getId()); + newOne.setName(aCustomer.getFirstName() + " " + aCustomer.getLastName()); + newOne.setAddress(aCustomer.getStreet() + ", " + aCustomer.getCity() + " " + aCustomer.getState() + " " + aCustomer.getPostalCode()); + + feedback[i] = newOne; + } + + return feedback; + } + + +} diff --git a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java new file mode 100644 index 0000000000..e754978cd5 --- /dev/null +++ b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java @@ -0,0 +1,145 @@ +package com.baeldung.jsonoptimization; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.DecimalFormat; +import java.util.zip.GZIPOutputStream; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.module.SimpleModule; + +class JsonOptimizationUnitTest { + private static final String TEST_LABEL_DEFAULT_JSON = "Default JSON"; + private static final String TEST_LABEL_DEFAULT_JSON_NO_NULL = "Default JSON without null"; + private static final String TEST_LABEL_SHORTER_ATTRIBUTE_NAMES = "Shorter Attribute Names"; + private static final String TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL = "Shorter Attribute Names without null"; + private static final String TEST_LABEL_CUSTOM_SERIALIZER = "Custom Serializer"; + private static final String TEST_LABEL_SLIM_CUSTOMER = "Slim customer"; + private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###,###"); + private static Customer[] customers; + private ObjectMapper mapper; + + @BeforeAll + static void setUpOnce() throws Exception { + customers = Customer.fromMockFile(); + } + + @BeforeEach + void setUp() { + mapper = new ObjectMapper(); + } + + @Test + void testSetUp() { + assertEquals(1000, customers.length, "There should be a 1000 customers"); + } + + @Test + void testDefaultJson() throws IOException { + printBanner(TEST_LABEL_DEFAULT_JSON); + byte[] plainJson = createPlainJson(TEST_LABEL_DEFAULT_JSON, customers); + compressJson(TEST_LABEL_DEFAULT_JSON, plainJson); + } + + @Test + void testDefaultNoNull() throws IOException { + printBanner(TEST_LABEL_DEFAULT_JSON_NO_NULL); + CustomerNoNull[] defaultNoNull = CustomerNoNull.fromCustomers(customers); + byte[] plainJson = createPlainJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, defaultNoNull); + compressJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, plainJson); + } + + @Test + void testShorterAttributes() throws IOException { + printBanner(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES); + CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); + byte[] shorterJson = createPlainJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES, shorterOnes); + compressJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES, shorterJson); + } + + @Test + void testShorterAttributesNoNull() throws IOException { + printBanner(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL); + CustomerShortNamesNoNull[] shorterOnesNoNull = CustomerShortNamesNoNull.fromCustomers(customers); + byte[] shorterJson = createPlainJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL, shorterOnesNoNull); + compressJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL, shorterJson); + } + + @Test + void testSlim() throws IOException { + printBanner(TEST_LABEL_SLIM_CUSTOMER); + CustomerSlim[] slimOnes = CustomerSlim.fromCustomers(customers); + byte[] slimJson = createPlainJson(TEST_LABEL_SLIM_CUSTOMER, slimOnes); + compressJson(TEST_LABEL_SLIM_CUSTOMER, slimJson); + } + + @Test + void testCustomSerializer() throws IOException { + printBanner(TEST_LABEL_CUSTOM_SERIALIZER); + + SimpleModule serializer = new SimpleModule("CustomCustomerSerializer", new Version(1, 0, 0, null, null, null)); + serializer.addSerializer(Customer.class, new CustomerSerializer()); + mapper.registerModule(serializer); + + SimpleModule deserializer = new SimpleModule("CustomCustomerDeserializer", new Version(1, 0, 0, null, null, null)); + deserializer.addDeserializer(Customer.class, new CustomerDeserializer()); + mapper.registerModule(deserializer); + + byte[] plainJson = createPlainJson(TEST_LABEL_CUSTOM_SERIALIZER, customers); + compressJson(TEST_LABEL_CUSTOM_SERIALIZER, plainJson); + } + + private void printBanner(String name) { + System.out.println(); + System.out.println("************************************************"); + System.out.println("Testing " + name); + System.out.println(); + } + + void compressJson(String label, byte[] plainJson) throws IOException { + ByteArrayOutputStream outpuStream = new ByteArrayOutputStream(); + GZIPOutputStream gzipStream = new GZIPOutputStream(outpuStream); + gzipStream.write(plainJson); + gzipStream.close(); + byte[] gzippedJson = outpuStream.toByteArray(); + System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(gzippedJson.length)); + assertTrue(plainJson.length > gzippedJson.length, label + " should be longer than GZIPped data"); + } + + private byte[] createPlainJson(String label, Object[] customers) throws IOException { + System.out.println(label + " sample: "); + ObjectWriter prettyWritter = mapper.writerWithDefaultPrettyPrinter(); + System.out.println(prettyWritter.writeValueAsString(customers[0])); + + byte[] feedback = mapper.writeValueAsBytes(customers); + System.out.println(label + " length: " + LENGTH_FORMATTER.format(feedback.length)); + assertTrue(feedback.length > 1, label + " should be there"); + + String prefix = label.replaceAll(" ", "-") + .toLowerCase(); + File tempFile = File.createTempFile("jon-optimization-" + prefix, ".json"); + FileOutputStream fos = new FileOutputStream(tempFile); + fos.write(feedback); + fos.close(); + System.out.println(label + " file: " + tempFile.toString()); + + Object[] restoredOnes = mapper.readValue(feedback, customers.getClass()); + assertArrayEquals(TEST_LABEL_DEFAULT_JSON + ": restoring from JSON should work", customers, restoredOnes); + + return feedback; + } + +} diff --git a/json/src/test/resources/json_optimization_mock_data.json b/json/src/test/resources/json_optimization_mock_data.json new file mode 100644 index 0000000000..e09517cf61 --- /dev/null +++ b/json/src/test/resources/json_optimization_mock_data.json @@ -0,0 +1,1000 @@ +[{"id":1,"firstName":"Horatius","lastName":"Strognell","street":"4848 New Castle Point","postalCode":"33432","city":"Boca Raton","state":"FL","phoneNumber":"561-824-9105","email":"hstrognell0@dailymail.co.uk"}, +{"id":2,"firstName":"Kerri","lastName":"Arend","street":"4 Welch Pass","postalCode":"60669","city":"Chicago","state":"IL","phoneNumber":"312-303-5993"}, +{"id":3,"firstName":"Silvano","lastName":"Bartholomaus","street":"2491 Arkansas Center","postalCode":"30195","city":"Duluth","state":"GA","email":"sbartholomaus2@prlog.org"}, +{"id":4,"firstName":"Venita","lastName":"Burgoine","street":"63894 Sage Park","postalCode":"67215","city":"Wichita","state":"KS","email":"vburgoine3@telegraph.co.uk"}, +{"id":5,"firstName":"Meghan","lastName":"Westover","street":"76 Pleasure Way","postalCode":"77388","city":"Spring","state":"TX","phoneNumber":"832-926-0689","email":"mwestover4@cnn.com"}, +{"id":6,"firstName":"Mia","lastName":"Baversor","street":"50 Sommers Road","postalCode":"43204","city":"Columbus","state":"OH","email":"mbaversor5@wsj.com"}, +{"id":7,"firstName":"Winna","lastName":"Buggy","street":"05 Jenna Street","postalCode":"68144","city":"Omaha","state":"NE","phoneNumber":"402-740-7818"}, +{"id":8,"firstName":"Antonin","lastName":"Autrie","street":"9 Fieldstone Terrace","postalCode":"85754","city":"Tucson","state":"AZ"}, +{"id":9,"firstName":"Maddi","lastName":"Ollerearnshaw","street":"061 Crowley Trail","postalCode":"48335","city":"Farmington","state":"MI","phoneNumber":"248-709-8128"}, +{"id":10,"firstName":"Fawnia","lastName":"Cristofaro","street":"92571 Kinsman Alley","postalCode":"77271","city":"Houston","state":"TX","email":"fcristofaro9@ox.ac.uk"}, +{"id":11,"firstName":"Zachariah","lastName":"Rouby","street":"2439 Hudson Circle","postalCode":"25313","city":"Charleston","state":"WV","phoneNumber":"304-587-5444"}, +{"id":12,"firstName":"Brier","lastName":"Benech","street":"3144 Sutteridge Place","postalCode":"20380","city":"Washington","state":"DC","phoneNumber":"202-740-8851","email":"bbenechb@zdnet.com"}, +{"id":13,"firstName":"Merry","lastName":"Leming","street":"419 Kropf Terrace","postalCode":"45440","city":"Dayton","state":"OH","email":"mlemingc@ow.ly"}, +{"id":14,"firstName":"Audrey","lastName":"Dilleston","street":"61 Melrose Trail","postalCode":"97306","city":"Salem","state":"OR","phoneNumber":"503-480-6254"}, +{"id":15,"firstName":"De witt","lastName":"Kedge","street":"819 Kingsford Point","postalCode":"84135","city":"Salt Lake City","state":"UT"}, +{"id":16,"firstName":"Charita","lastName":"de Clerc","street":"42 Loftsgordon Hill","postalCode":"28289","city":"Charlotte","state":"NC","phoneNumber":"704-532-8850","email":"cdeclercf@comsenz.com"}, +{"id":17,"firstName":"Edgard","lastName":"Bloore","street":"1659 Donald Trail","postalCode":"20051","city":"Washington","state":"DC"}, +{"id":18,"firstName":"Kristi","lastName":"Richichi","street":"11306 Longview Hill","postalCode":"75372","city":"Dallas","state":"TX","email":"krichichih@cloudflare.com"}, +{"id":19,"firstName":"Denna","lastName":"Cornford","street":"4 Gale Junction","postalCode":"10014","city":"New York City","state":"NY","phoneNumber":"646-273-3067","email":"dcornfordi@ebay.co.uk"}, +{"id":20,"firstName":"Randall","lastName":"McQuaid","street":"55712 Stone Corner Circle","postalCode":"10203","city":"New York City","state":"NY","email":"rmcquaidj@facebook.com"}, +{"id":21,"firstName":"Kirbie","lastName":"Walczak","street":"9 Coleman Road","postalCode":"99252","city":"Spokane","state":"WA","email":"kwalczakk@spotify.com"}, +{"id":22,"firstName":"Zedekiah","lastName":"Westby","street":"9 Victoria Road","postalCode":"22093","city":"Ashburn","state":"VA","phoneNumber":"571-642-0111","email":"zwestbyl@ox.ac.uk"}, +{"id":23,"firstName":"Corri","lastName":"Snar","street":"4 Service Terrace","postalCode":"68517","city":"Lincoln","state":"NE","email":"csnarm@tinyurl.com"}, +{"id":24,"firstName":"Manny","lastName":"Marchington","street":"942 Westend Center","postalCode":"22119","city":"Merrifield","state":"VA","email":"mmarchingtonn@opensource.org"}, +{"id":25,"firstName":"Ashla","lastName":"Grigoroni","street":"755 Lerdahl Parkway","postalCode":"55423","city":"Minneapolis","state":"MN","phoneNumber":"612-797-7928","email":"agrigoronio@cam.ac.uk"}, +{"id":26,"firstName":"Rita","lastName":"Sharratt","street":"710 Buena Vista Avenue","postalCode":"40576","city":"Lexington","state":"KY","phoneNumber":"859-727-0697"}, +{"id":27,"firstName":"Karrie","lastName":"Crathorne","street":"02 Loeprich Place","postalCode":"39505","city":"Gulfport","state":"MS"}, +{"id":28,"firstName":"Lothario","lastName":"Merck","street":"46 Golden Leaf Park","postalCode":"35205","city":"Birmingham","state":"AL"}, +{"id":29,"firstName":"Renault","lastName":"Banister","street":"7 Garrison Plaza","postalCode":"85072","city":"Phoenix","state":"AZ"}, +{"id":30,"firstName":"Wanda","lastName":"Burkart","street":"10 Mendota Place","postalCode":"48258","city":"Detroit","state":"MI","phoneNumber":"248-870-5185","email":"wburkartt@wikipedia.org"}, +{"id":31,"firstName":"Maggy","lastName":"Timby","street":"37 Crest Line Center","postalCode":"50305","city":"Des Moines","state":"IA","email":"mtimbyu@cnbc.com"}, +{"id":32,"firstName":"Chet","lastName":"Origan","street":"767 Bashford Lane","postalCode":"30919","city":"Augusta","state":"GA","email":"coriganv@behance.net"}, +{"id":33,"firstName":"Jammie","lastName":"Aslie","street":"7174 Hoffman Circle","postalCode":"23464","city":"Virginia Beach","state":"VA"}, +{"id":34,"firstName":"Dill","lastName":"Kingdon","street":"75 Corben Crossing","postalCode":"33013","city":"Hialeah","state":"FL","email":"dkingdonx@ibm.com"}, +{"id":35,"firstName":"Berenice","lastName":"Blodget","street":"8 Eliot Junction","postalCode":"93907","city":"Salinas","state":"CA","email":"bblodgety@blogs.com"}, +{"id":36,"firstName":"Kimberley","lastName":"Streatley","street":"56 Welch Center","postalCode":"77070","city":"Houston","state":"TX"}, +{"id":37,"firstName":"Warde","lastName":"Woodwind","street":"773 Gerald Park","postalCode":"35295","city":"Birmingham","state":"AL","email":"wwoodwind10@wsj.com"}, +{"id":38,"firstName":"Husain","lastName":"Christofe","street":"35118 Forest Dale Avenue","postalCode":"10175","city":"New York City","state":"NY","phoneNumber":"212-611-7995","email":"hchristofe11@seesaa.net"}, +{"id":39,"firstName":"Gertrud","lastName":"Defraine","street":"568 Walton Way","postalCode":"37405","city":"Chattanooga","state":"TN","phoneNumber":"423-125-5719","email":"gdefraine12@xrea.com"}, +{"id":40,"firstName":"Yulma","lastName":"Ramshay","street":"9976 Iowa Drive","postalCode":"87121","city":"Albuquerque","state":"NM","phoneNumber":"505-914-5281"}, +{"id":41,"firstName":"Bride","lastName":"Amsberger","street":"3 Service Lane","postalCode":"28272","city":"Charlotte","state":"NC","email":"bamsberger14@forbes.com"}, +{"id":42,"firstName":"Kaiser","lastName":"Froud","street":"7 Starling Lane","postalCode":"99507","city":"Anchorage","state":"AK","email":"kfroud15@cloudflare.com"}, +{"id":43,"firstName":"Leona","lastName":"Sciusscietto","street":"06392 East Lane","postalCode":"60193","city":"Schaumburg","state":"IL","phoneNumber":"630-981-3986","email":"lsciusscietto16@mit.edu"}, +{"id":44,"firstName":"Sibel","lastName":"Ripsher","street":"8672 Bayside Road","postalCode":"32511","city":"Pensacola","state":"FL","phoneNumber":"850-975-6365","email":"sripsher17@sitemeter.com"}, +{"id":45,"firstName":"Megen","lastName":"Dymond","street":"0547 Harper Place","postalCode":"28220","city":"Charlotte","state":"NC","phoneNumber":"704-632-5850"}, +{"id":46,"firstName":"Vitoria","lastName":"Niese","street":"365 Colorado Plaza","postalCode":"15279","city":"Pittsburgh","state":"PA","phoneNumber":"412-864-8563"}, +{"id":47,"firstName":"Cherianne","lastName":"Daveran","street":"5 Esch Parkway","postalCode":"36104","city":"Montgomery","state":"AL","email":"cdaveran1a@ft.com"}, +{"id":48,"firstName":"Harriott","lastName":"Mallam","street":"9 Monterey Place","postalCode":"20215","city":"Washington","state":"DC","phoneNumber":"202-727-0645"}, +{"id":49,"firstName":"Jozef","lastName":"Stranger","street":"07 Warner Drive","postalCode":"84199","city":"Salt Lake City","state":"UT","phoneNumber":"801-741-5946"}, +{"id":50,"firstName":"Teena","lastName":"Broggio","street":"287 Luster Park","postalCode":"78285","city":"San Antonio","state":"TX","phoneNumber":"210-482-0822","email":"tbroggio1d@craigslist.org"}, +{"id":51,"firstName":"Robin","lastName":"Membry","street":"0736 Forest Dale Crossing","postalCode":"45408","city":"Dayton","state":"OH","phoneNumber":"937-335-4964","email":"rmembry1e@toplist.cz"}, +{"id":52,"firstName":"Holly","lastName":"Lowcock","street":"819 Aberg Pass","postalCode":"28815","city":"Asheville","state":"NC","email":"hlowcock1f@bbc.co.uk"}, +{"id":53,"firstName":"Shandee","lastName":"Blowick","street":"81600 Moose Lane","postalCode":"46867","city":"Fort Wayne","state":"IN","phoneNumber":"260-904-5622"}, +{"id":54,"firstName":"Chaim","lastName":"Stilliard","street":"91 Spohn Court","postalCode":"28305","city":"Fayetteville","state":"NC","phoneNumber":"910-721-3938"}, +{"id":55,"firstName":"Maximilien","lastName":"Purkis","street":"66997 Algoma Park","postalCode":"10150","city":"New York City","state":"NY","phoneNumber":"212-824-3363","email":"mpurkis1i@unblog.fr"}, +{"id":56,"firstName":"Ferguson","lastName":"Whiles","street":"0550 Bowman Street","postalCode":"33142","city":"Miami","state":"FL","phoneNumber":"786-416-2947","email":"fwhiles1j@artisteer.com"}, +{"id":57,"firstName":"Elena","lastName":"Poyle","street":"54 Warner Court","postalCode":"28055","city":"Gastonia","state":"NC","email":"epoyle1k@tripod.com"}, +{"id":58,"firstName":"Carney","lastName":"Pengilly","street":"050 Welch Junction","postalCode":"76147","city":"Fort Worth","state":"TX","phoneNumber":"817-525-7801","email":"cpengilly1l@yellowpages.com"}, +{"id":59,"firstName":"Krispin","lastName":"Pouck","street":"03554 Twin Pines Point","postalCode":"55551","city":"Young America","state":"MN","email":"kpouck1m@nymag.com"}, +{"id":60,"firstName":"Kylie","lastName":"Osmar","street":"7 Milwaukee Plaza","postalCode":"45228","city":"Cincinnati","state":"OH","phoneNumber":"513-940-5020","email":"kosmar1n@storify.com"}, +{"id":61,"firstName":"Trudi","lastName":"Standrin","street":"526 Onsgard Park","postalCode":"12237","city":"Albany","state":"NY","email":"tstandrin1o@sfgate.com"}, +{"id":62,"firstName":"Frank","lastName":"Belt","street":"52 Stang Lane","postalCode":"27455","city":"Greensboro","state":"NC"}, +{"id":63,"firstName":"Nerita","lastName":"Daulton","street":"03 Sutherland Court","postalCode":"55417","city":"Minneapolis","state":"MN","phoneNumber":"651-796-2028"}, +{"id":64,"firstName":"Urbanus","lastName":"Camm","street":"6802 Weeping Birch Circle","postalCode":"92115","city":"San Diego","state":"CA","email":"ucamm1r@ucoz.com"}, +{"id":65,"firstName":"Perry","lastName":"Struther","street":"63916 Corry Alley","postalCode":"28805","city":"Asheville","state":"NC","phoneNumber":"828-821-0824","email":"pstruther1s@nih.gov"}, +{"id":66,"firstName":"Zorina","lastName":"Uc","street":"99 Merry Circle","postalCode":"37250","city":"Nashville","state":"TN","phoneNumber":"615-364-4726","email":"zuc1t@cbc.ca"}, +{"id":67,"firstName":"Ajay","lastName":"Rediers","street":"6872 Armistice Lane","postalCode":"92812","city":"Anaheim","state":"CA","phoneNumber":"714-845-0143"}, +{"id":68,"firstName":"Brendis","lastName":"Goor","street":"94 Mccormick Place","postalCode":"77346","city":"Humble","state":"TX","phoneNumber":"713-910-5956"}, +{"id":69,"firstName":"Barbey","lastName":"Konneke","street":"75613 Miller Trail","postalCode":"30328","city":"Atlanta","state":"GA","phoneNumber":"770-208-1453"}, +{"id":70,"firstName":"Adlai","lastName":"Colly","street":"4446 Loftsgordon Place","postalCode":"40576","city":"Lexington","state":"KY","email":"acolly1x@phpbb.com"}, +{"id":71,"firstName":"Libby","lastName":"Wherton","street":"9313 Buell Road","postalCode":"70116","city":"New Orleans","state":"LA","email":"lwherton1y@flickr.com"}, +{"id":72,"firstName":"Niko","lastName":"Stockell","street":"61 Havey Park","postalCode":"10034","city":"New York City","state":"NY","phoneNumber":"646-814-6395","email":"nstockell1z@xrea.com"}, +{"id":73,"firstName":"Phillip","lastName":"Dadley","street":"14534 Victoria Street","postalCode":"33906","city":"Fort Myers","state":"FL","email":"pdadley20@studiopress.com"}, +{"id":74,"firstName":"Leann","lastName":"Hebburn","street":"9 Center Place","postalCode":"84140","city":"Salt Lake City","state":"UT","email":"lhebburn21@1688.com"}, +{"id":75,"firstName":"Raynor","lastName":"Gernier","street":"5923 Gale Plaza","postalCode":"79118","city":"Amarillo","state":"TX"}, +{"id":76,"firstName":"Elmore","lastName":"Frankton","street":"770 Wayridge Crossing","postalCode":"14619","city":"Rochester","state":"NY"}, +{"id":77,"firstName":"Teresina","lastName":"Rives","street":"51261 Sycamore Terrace","postalCode":"63180","city":"Saint Louis","state":"MO","email":"trives24@cbsnews.com"}, +{"id":78,"firstName":"Pancho","lastName":"Thebeaud","street":"72 Pierstorff Way","postalCode":"33705","city":"Saint Petersburg","state":"FL","phoneNumber":"813-335-3556"}, +{"id":79,"firstName":"Deanne","lastName":"Crighton","street":"95 Duke Plaza","postalCode":"71151","city":"Shreveport","state":"LA","phoneNumber":"318-218-7196","email":"dcrighton26@sphinn.com"}, +{"id":80,"firstName":"Brucie","lastName":"Bury","street":"8948 Knutson Lane","postalCode":"93740","city":"Fresno","state":"CA","email":"bbury27@twitter.com"}, +{"id":81,"firstName":"Joleen","lastName":"Flack","street":"8007 Morningstar Street","postalCode":"33283","city":"Miami","state":"FL","phoneNumber":"305-459-0365"}, +{"id":82,"firstName":"Antonino","lastName":"Matelyunas","street":"2585 Gale Road","postalCode":"20591","city":"Washington","state":"DC","phoneNumber":"202-780-3589"}, +{"id":83,"firstName":"Vinnie","lastName":"Syne","street":"6 Fallview Pass","postalCode":"20231","city":"Washington","state":"DC","phoneNumber":"202-648-5977","email":"vsyne2a@etsy.com"}, +{"id":84,"firstName":"Sig","lastName":"Guillotin","street":"6 Buell Lane","postalCode":"46015","city":"Anderson","state":"IN","phoneNumber":"765-948-7663","email":"sguillotin2b@cisco.com"}, +{"id":85,"firstName":"Gabriel","lastName":"Vasyukhichev","street":"25801 Grasskamp Junction","postalCode":"45408","city":"Dayton","state":"OH","email":"gvasyukhichev2c@mac.com"}, +{"id":86,"firstName":"Casie","lastName":"Burgill","street":"0 Dapin Alley","postalCode":"37410","city":"Chattanooga","state":"TN"}, +{"id":87,"firstName":"Kristan","lastName":"Chalice","street":"5118 Calypso Junction","postalCode":"78721","city":"Austin","state":"TX","phoneNumber":"512-831-2347"}, +{"id":88,"firstName":"Brear","lastName":"Pruckner","street":"2 Corscot Street","postalCode":"53790","city":"Madison","state":"WI"}, +{"id":89,"firstName":"Estella","lastName":"Orpyne","street":"293 Hansons Plaza","postalCode":"55579","city":"Maple Plain","state":"MN","phoneNumber":"952-666-6951","email":"eorpyne2g@examiner.com"}, +{"id":90,"firstName":"Conroy","lastName":"de Banke","street":"40636 Farmco Park","postalCode":"30316","city":"Atlanta","state":"GA","phoneNumber":"404-199-0073","email":"cdebanke2h@prweb.com"}, +{"id":91,"firstName":"Elmira","lastName":"Bracken","street":"10 Macpherson Place","postalCode":"85099","city":"Phoenix","state":"AZ","phoneNumber":"602-991-7768","email":"ebracken2i@sourceforge.net"}, +{"id":92,"firstName":"Carlota","lastName":"Vasilechko","street":"33 American Ash Point","postalCode":"75507","city":"Texarkana","state":"TX","phoneNumber":"903-312-0610","email":"cvasilechko2j@nba.com"}, +{"id":93,"firstName":"Jamesy","lastName":"Valentelli","street":"59634 Charing Cross Trail","postalCode":"31416","city":"Savannah","state":"GA","phoneNumber":"912-657-6729","email":"jvalentelli2k@nifty.com"}, +{"id":94,"firstName":"Hildagarde","lastName":"Sandels","street":"1 Lotheville Lane","postalCode":"32277","city":"Jacksonville","state":"FL","phoneNumber":"904-981-2753","email":"hsandels2l@a8.net"}, +{"id":95,"firstName":"Kip","lastName":"Cranidge","street":"2 South Road","postalCode":"19160","city":"Philadelphia","state":"PA"}, +{"id":96,"firstName":"Tobit","lastName":"Jarrette","street":"777 Mallard Trail","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-706-1988"}, +{"id":97,"firstName":"Tibold","lastName":"Michie","street":"87796 Nevada Junction","postalCode":"22093","city":"Ashburn","state":"VA","phoneNumber":"571-188-4893","email":"tmichie2o@mapy.cz"}, +{"id":98,"firstName":"Maximo","lastName":"Ifill","street":"8307 Tony Point","postalCode":"22225","city":"Arlington","state":"VA","phoneNumber":"571-404-1412"}, +{"id":99,"firstName":"Patti","lastName":"Autry","street":"901 Iowa Crossing","postalCode":"55551","city":"Young America","state":"MN","phoneNumber":"952-772-9107","email":"pautry2q@scientificamerican.com"}, +{"id":100,"firstName":"Cathe","lastName":"Jost","street":"4400 Menomonie Road","postalCode":"21211","city":"Baltimore","state":"MD","phoneNumber":"410-800-4683","email":"cjost2r@tuttocitta.it"}, +{"id":101,"firstName":"Byron","lastName":"Maddams","street":"10729 Oak Trail","postalCode":"78255","city":"San Antonio","state":"TX","phoneNumber":"830-263-4129"}, +{"id":102,"firstName":"Sosanna","lastName":"Paley","street":"82207 Park Meadow Court","postalCode":"77010","city":"Houston","state":"TX","phoneNumber":"832-740-8766","email":"spaley2t@salon.com"}, +{"id":103,"firstName":"Elysia","lastName":"Skerratt","street":"88708 Cambridge Drive","postalCode":"31217","city":"Macon","state":"GA","phoneNumber":"478-265-6579","email":"eskerratt2u@japanpost.jp"}, +{"id":104,"firstName":"Nealson","lastName":"Sieur","street":"1286 Elmside Plaza","postalCode":"20904","city":"Silver Spring","state":"MD"}, +{"id":105,"firstName":"Yasmeen","lastName":"Bazire","street":"91904 Elmside Point","postalCode":"73167","city":"Oklahoma City","state":"OK"}, +{"id":106,"firstName":"Mandy","lastName":"Ewart","street":"91 Norway Maple Street","postalCode":"21239","city":"Baltimore","state":"MD","email":"mewart2x@weebly.com"}, +{"id":107,"firstName":"Chlo","lastName":"Keedy","street":"560 Oak Valley Avenue","postalCode":"20420","city":"Washington","state":"DC"}, +{"id":108,"firstName":"Benedicta","lastName":"Dinneen","street":"9 Cottonwood Circle","postalCode":"60686","city":"Chicago","state":"IL","email":"bdinneen2z@nydailynews.com"}, +{"id":109,"firstName":"Nanon","lastName":"Corsar","street":"40001 Barby Drive","postalCode":"95818","city":"Sacramento","state":"CA","email":"ncorsar30@house.gov"}, +{"id":110,"firstName":"Babette","lastName":"Scarsbrick","street":"96095 Loomis Terrace","postalCode":"94622","city":"Oakland","state":"CA","email":"bscarsbrick31@smugmug.com"}, +{"id":111,"firstName":"Cornall","lastName":"Christauffour","street":"9 Springview Alley","postalCode":"84170","city":"Salt Lake City","state":"UT","phoneNumber":"801-935-1246","email":"cchristauffour32@booking.com"}, +{"id":112,"firstName":"Micki","lastName":"Labell","street":"77729 Heath Place","postalCode":"25336","city":"Charleston","state":"WV"}, +{"id":113,"firstName":"Marissa","lastName":"Bricksey","street":"1 Jackson Pass","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"917-552-4280"}, +{"id":114,"firstName":"Alex","lastName":"Lyptrade","street":"74 Bunting Circle","postalCode":"40591","city":"Lexington","state":"KY","phoneNumber":"859-177-0753"}, +{"id":115,"firstName":"Tove","lastName":"Bielfeldt","street":"95 Mallard Hill","postalCode":"70894","city":"Baton Rouge","state":"LA","email":"tbielfeldt36@goo.gl"}, +{"id":116,"firstName":"Rodrigo","lastName":"Chestle","street":"53625 1st Junction","postalCode":"43635","city":"Toledo","state":"OH","phoneNumber":"419-928-0953","email":"rchestle37@princeton.edu"}, +{"id":117,"firstName":"Ulrike","lastName":"Kendle","street":"0 Cardinal Alley","postalCode":"80925","city":"Colorado Springs","state":"CO","phoneNumber":"719-796-1992","email":"ukendle38@naver.com"}, +{"id":118,"firstName":"Sandor","lastName":"Warwick","street":"8 Spaight Crossing","postalCode":"92030","city":"Escondido","state":"CA","email":"swarwick39@about.com"}, +{"id":119,"firstName":"Selina","lastName":"Slowcock","street":"7 7th Circle","postalCode":"50335","city":"Des Moines","state":"IA","phoneNumber":"515-865-9809"}, +{"id":120,"firstName":"Maxine","lastName":"Placstone","street":"42056 Sycamore Plaza","postalCode":"20244","city":"Washington","state":"DC"}, +{"id":121,"firstName":"Ardine","lastName":"Reven","street":"10634 Nancy Way","postalCode":"10175","city":"New York City","state":"NY","email":"areven3c@diigo.com"}, +{"id":122,"firstName":"Dilan","lastName":"Widdows","street":"37 Park Meadow Way","postalCode":"68144","city":"Omaha","state":"NE","phoneNumber":"402-383-9020"}, +{"id":123,"firstName":"Kevina","lastName":"Praten","street":"8531 Elmside Point","postalCode":"27610","city":"Raleigh","state":"NC","email":"kpraten3e@craigslist.org"}, +{"id":124,"firstName":"Sherman","lastName":"Jurczak","street":"8281 Acker Alley","postalCode":"07522","city":"Paterson","state":"NJ","email":"sjurczak3f@github.com"}, +{"id":125,"firstName":"Beckie","lastName":"Disney","street":"3 Butterfield Drive","postalCode":"49518","city":"Grand Rapids","state":"MI","phoneNumber":"616-493-1284","email":"bdisney3g@china.com.cn"}, +{"id":126,"firstName":"Blaine","lastName":"Leak","street":"369 Norway Maple Lane","postalCode":"03804","city":"Portsmouth","state":"NH","email":"bleak3h@lulu.com"}, +{"id":127,"firstName":"Dare","lastName":"Marney","street":"50 Lake View Alley","postalCode":"06505","city":"New Haven","state":"CT","phoneNumber":"203-876-6938","email":"dmarney3i@delicious.com"}, +{"id":128,"firstName":"Darby","lastName":"Sackler","street":"841 Ridgeview Trail","postalCode":"80279","city":"Denver","state":"CO"}, +{"id":129,"firstName":"Aurilia","lastName":"Seabrocke","street":"670 Schmedeman Road","postalCode":"11254","city":"Brooklyn","state":"NY","email":"aseabrocke3k@engadget.com"}, +{"id":130,"firstName":"Griz","lastName":"Riccioppo","street":"2204 Moland Circle","postalCode":"45218","city":"Cincinnati","state":"OH","email":"griccioppo3l@cisco.com"}, +{"id":131,"firstName":"Zahara","lastName":"Quinion","street":"4979 Mallory Circle","postalCode":"24515","city":"Lynchburg","state":"VA","email":"zquinion3m@sfgate.com"}, +{"id":132,"firstName":"Holly-anne","lastName":"Fontel","street":"60752 Hallows Circle","postalCode":"76705","city":"Waco","state":"TX","phoneNumber":"254-822-2565","email":"hfontel3n@exblog.jp"}, +{"id":133,"firstName":"Johannes","lastName":"Lemonby","street":"3 Grover Terrace","postalCode":"25709","city":"Huntington","state":"WV","phoneNumber":"304-342-4911","email":"jlemonby3o@woothemes.com"}, +{"id":134,"firstName":"Melvin","lastName":"Kain","street":"16 Pond Junction","postalCode":"85215","city":"Mesa","state":"AZ","phoneNumber":"602-146-3701"}, +{"id":135,"firstName":"Letta","lastName":"Smelley","street":"537 Helena Circle","postalCode":"22119","city":"Merrifield","state":"VA","phoneNumber":"571-472-5640"}, +{"id":136,"firstName":"Clerc","lastName":"Mc Ilwrick","street":"7050 Northfield Street","postalCode":"90050","city":"Los Angeles","state":"CA","email":"cmcilwrick3r@abc.net.au"}, +{"id":137,"firstName":"Abba","lastName":"Sutherns","street":"8087 Monterey Lane","postalCode":"83757","city":"Boise","state":"ID","phoneNumber":"208-110-3153","email":"asutherns3s@dropbox.com"}, +{"id":138,"firstName":"Karola","lastName":"Symper","street":"4596 Clyde Gallagher Road","postalCode":"28815","city":"Asheville","state":"NC","email":"ksymper3t@parallels.com"}, +{"id":139,"firstName":"Jessamyn","lastName":"Deacock","street":"19557 Bobwhite Way","postalCode":"19725","city":"Newark","state":"DE","phoneNumber":"302-174-2938"}, +{"id":140,"firstName":"Iggy","lastName":"Impey","street":"8 Brown Place","postalCode":"27499","city":"Greensboro","state":"NC"}, +{"id":141,"firstName":"Kary","lastName":"Mably","street":"75 Porter Avenue","postalCode":"70174","city":"New Orleans","state":"LA","email":"kmably3w@miibeian.gov.cn"}, +{"id":142,"firstName":"Ciel","lastName":"Tidbold","street":"54 Mitchell Lane","postalCode":"90055","city":"Los Angeles","state":"CA"}, +{"id":143,"firstName":"Dyana","lastName":"Orcott","street":"2 Kinsman Street","postalCode":"90005","city":"Los Angeles","state":"CA","phoneNumber":"310-366-6987"}, +{"id":144,"firstName":"Damien","lastName":"Haking","street":"2 Elmside Point","postalCode":"62705","city":"Springfield","state":"IL","email":"dhaking3z@drupal.org"}, +{"id":145,"firstName":"Ricardo","lastName":"Bille","street":"3 Mesta Hill","postalCode":"98411","city":"Tacoma","state":"WA","email":"rbille40@ebay.co.uk"}, +{"id":146,"firstName":"Carlene","lastName":"Roget","street":"8 Granby Avenue","postalCode":"35225","city":"Birmingham","state":"AL","phoneNumber":"205-762-4907","email":"croget41@statcounter.com"}, +{"id":147,"firstName":"Sharlene","lastName":"Antusch","street":"02445 Stang Parkway","postalCode":"55480","city":"Minneapolis","state":"MN","email":"santusch42@mtv.com"}, +{"id":148,"firstName":"Goober","lastName":"Danielczyk","street":"474 Union Court","postalCode":"70505","city":"Lafayette","state":"LA","phoneNumber":"337-779-0312","email":"gdanielczyk43@dion.ne.jp"}, +{"id":149,"firstName":"Janette","lastName":"Mauro","street":"1231 Commercial Crossing","postalCode":"97201","city":"Portland","state":"OR","phoneNumber":"971-423-7259"}, +{"id":150,"firstName":"Melinda","lastName":"Shitliffe","street":"244 Derek Drive","postalCode":"23208","city":"Richmond","state":"VA","phoneNumber":"804-864-5845"}, +{"id":151,"firstName":"Constance","lastName":"Fardon","street":"3 Lien Point","postalCode":"89105","city":"Las Vegas","state":"NV"}, +{"id":152,"firstName":"Tedd","lastName":"Storey","street":"2551 Luster Point","postalCode":"19151","city":"Philadelphia","state":"PA","phoneNumber":"215-622-9273","email":"tstorey47@google.com.au"}, +{"id":153,"firstName":"Brigitte","lastName":"Slograve","street":"8130 Waubesa Hill","postalCode":"11499","city":"Jamaica","state":"NY","email":"bslograve48@yandex.ru"}, +{"id":154,"firstName":"Ralph","lastName":"Comberbeach","street":"88140 Anderson Avenue","postalCode":"90076","city":"Los Angeles","state":"CA"}, +{"id":155,"firstName":"Deloria","lastName":"Thomazet","street":"666 Center Crossing","postalCode":"38119","city":"Memphis","state":"TN","phoneNumber":"615-840-7916"}, +{"id":156,"firstName":"Fidel","lastName":"MacClay","street":"01 Fairfield Point","postalCode":"24034","city":"Roanoke","state":"VA","email":"fmacclay4b@sitemeter.com"}, +{"id":157,"firstName":"Amalee","lastName":"Menzies","street":"6 Judy Drive","postalCode":"84605","city":"Provo","state":"UT"}, +{"id":158,"firstName":"Ansel","lastName":"Jory","street":"3 Nobel Park","postalCode":"32505","city":"Pensacola","state":"FL","phoneNumber":"850-394-8201"}, +{"id":159,"firstName":"Teodor","lastName":"Longhorn","street":"563 Sutherland Avenue","postalCode":"98008","city":"Bellevue","state":"WA"}, +{"id":160,"firstName":"Margarita","lastName":"Rewcassell","street":"64711 Beilfuss Point","postalCode":"79764","city":"Odessa","state":"TX","phoneNumber":"432-413-2196"}, +{"id":161,"firstName":"Tarra","lastName":"Albro","street":"2 Graceland Way","postalCode":"78405","city":"Corpus Christi","state":"TX"}, +{"id":162,"firstName":"Whitaker","lastName":"Brizell","street":"6 Luster Place","postalCode":"33694","city":"Tampa","state":"FL","email":"wbrizell4h@naver.com"}, +{"id":163,"firstName":"Gauthier","lastName":"Getsham","street":"0820 Duke Plaza","postalCode":"28263","city":"Charlotte","state":"NC","phoneNumber":"704-510-2908"}, +{"id":164,"firstName":"Thane","lastName":"Discombe","street":"56809 Aberg Street","postalCode":"63167","city":"Saint Louis","state":"MO"}, +{"id":165,"firstName":"Felicia","lastName":"Barthrup","street":"904 Stuart Junction","postalCode":"32220","city":"Jacksonville","state":"FL"}, +{"id":166,"firstName":"Emeline","lastName":"Jobes","street":"2670 Prairieview Plaza","postalCode":"10120","city":"New York City","state":"NY","email":"ejobes4l@newyorker.com"}, +{"id":167,"firstName":"Felicle","lastName":"Bowie","street":"9715 Lighthouse Bay Parkway","postalCode":"11210","city":"Brooklyn","state":"NY","email":"fbowie4m@auda.org.au"}, +{"id":168,"firstName":"Clare","lastName":"Miskelly","street":"8 Towne Trail","postalCode":"44555","city":"Youngstown","state":"OH"}, +{"id":169,"firstName":"Mort","lastName":"Danat","street":"6833 Shoshone Lane","postalCode":"12255","city":"Albany","state":"NY","phoneNumber":"518-967-9791","email":"mdanat4o@privacy.gov.au"}, +{"id":170,"firstName":"Ailey","lastName":"Scatchar","street":"3 Northfield Point","postalCode":"76505","city":"Temple","state":"TX"}, +{"id":171,"firstName":"Kevina","lastName":"Darwent","street":"8165 Reinke Alley","postalCode":"94132","city":"San Francisco","state":"CA","email":"kdarwent4q@artisteer.com"}, +{"id":172,"firstName":"My","lastName":"Buston","street":"715 Saint Paul Center","postalCode":"31416","city":"Savannah","state":"GA","phoneNumber":"912-281-8654"}, +{"id":173,"firstName":"Emera","lastName":"Lingner","street":"943 Eastlawn Hill","postalCode":"90605","city":"Whittier","state":"CA"}, +{"id":174,"firstName":"Drucie","lastName":"Byer","street":"988 4th Court","postalCode":"06816","city":"Danbury","state":"CT","email":"dbyer4t@xinhuanet.com"}, +{"id":175,"firstName":"Modestine","lastName":"Madeley","street":"1 Delaware Terrace","postalCode":"80126","city":"Littleton","state":"CO"}, +{"id":176,"firstName":"Selie","lastName":"O'Mohun","street":"42 Monument Trail","postalCode":"55590","city":"Monticello","state":"MN","phoneNumber":"763-384-5166"}, +{"id":177,"firstName":"Shayla","lastName":"Pesselt","street":"7 Pawling Center","postalCode":"20099","city":"Washington","state":"DC","phoneNumber":"202-816-7300","email":"spesselt4w@posterous.com"}, +{"id":178,"firstName":"Raeann","lastName":"Layland","street":"06548 Longview Alley","postalCode":"77005","city":"Houston","state":"TX","phoneNumber":"214-899-1257","email":"rlayland4x@pcworld.com"}, +{"id":179,"firstName":"Dael","lastName":"Christaeas","street":"375 Northfield Street","postalCode":"23509","city":"Norfolk","state":"VA","phoneNumber":"757-391-2798","email":"dchristaeas4y@sciencedaily.com"}, +{"id":180,"firstName":"Nicolas","lastName":"Baxill","street":"9 Autumn Leaf Terrace","postalCode":"77005","city":"Houston","state":"TX","email":"nbaxill4z@edublogs.org"}, +{"id":181,"firstName":"Onida","lastName":"Pengilly","street":"61 Commercial Junction","postalCode":"24029","city":"Roanoke","state":"VA","email":"opengilly50@slideshare.net"}, +{"id":182,"firstName":"Muffin","lastName":"Thrasher","street":"1 Morning Hill","postalCode":"64082","city":"Lees Summit","state":"MO"}, +{"id":183,"firstName":"Ignaz","lastName":"McLugish","street":"3936 Columbus Point","postalCode":"35263","city":"Birmingham","state":"AL"}, +{"id":184,"firstName":"Guillaume","lastName":"Gillings","street":"75541 Sheridan Center","postalCode":"68510","city":"Lincoln","state":"NE","email":"ggillings53@unblog.fr"}, +{"id":185,"firstName":"Kalli","lastName":"Branche","street":"33740 Manitowish Court","postalCode":"96805","city":"Honolulu","state":"HI"}, +{"id":186,"firstName":"Winthrop","lastName":"Barszczewski","street":"9 Luster Terrace","postalCode":"60158","city":"Carol Stream","state":"IL","phoneNumber":"309-633-3125","email":"wbarszczewski55@eventbrite.com"}, +{"id":187,"firstName":"Renaud","lastName":"Nitto","street":"1 Crownhardt Place","postalCode":"10310","city":"Staten Island","state":"NY","phoneNumber":"914-568-4524","email":"rnitto56@typepad.com"}, +{"id":188,"firstName":"Pollyanna","lastName":"Wherrett","street":"31380 Upham Street","postalCode":"76134","city":"Fort Worth","state":"TX","phoneNumber":"817-198-3301","email":"pwherrett57@bluehost.com"}, +{"id":189,"firstName":"Lilly","lastName":"Gatchell","street":"7 Elka Road","postalCode":"94064","city":"Redwood City","state":"CA","email":"lgatchell58@patch.com"}, +{"id":190,"firstName":"Leopold","lastName":"Leavey","street":"9 Darwin Crossing","postalCode":"20268","city":"Washington","state":"DC","phoneNumber":"202-964-5932","email":"lleavey59@aol.com"}, +{"id":191,"firstName":"Byram","lastName":"Stuckes","street":"782 Northport Alley","postalCode":"55436","city":"Minneapolis","state":"MN"}, +{"id":192,"firstName":"Cull","lastName":"Whiterod","street":"2586 Banding Terrace","postalCode":"80249","city":"Denver","state":"CO","email":"cwhiterod5b@skype.com"}, +{"id":193,"firstName":"Gretel","lastName":"Tacey","street":"6382 Fremont Avenue","postalCode":"25305","city":"Charleston","state":"WV"}, +{"id":194,"firstName":"Tudor","lastName":"Piff","street":"0 Monterey Circle","postalCode":"00214","city":"Portsmouth","state":"NH","email":"tpiff5d@eepurl.com"}, +{"id":195,"firstName":"Julienne","lastName":"Adshed","street":"91839 Lawn Avenue","postalCode":"92519","city":"Riverside","state":"CA"}, +{"id":196,"firstName":"Arnold","lastName":"Fearns","street":"7 West Trail","postalCode":"35242","city":"Birmingham","state":"AL","email":"afearns5f@bravesites.com"}, +{"id":197,"firstName":"Dunc","lastName":"Khoter","street":"048 Clove Lane","postalCode":"89505","city":"Reno","state":"NV","phoneNumber":"775-120-9532","email":"dkhoter5g@bbb.org"}, +{"id":198,"firstName":"Stevana","lastName":"Lush","street":"6 Dovetail Plaza","postalCode":"79945","city":"El Paso","state":"TX","email":"slush5h@economist.com"}, +{"id":199,"firstName":"Iggy","lastName":"Verryan","street":"5 Sommers Road","postalCode":"34114","city":"Naples","state":"FL","phoneNumber":"239-205-8767"}, +{"id":200,"firstName":"Breena","lastName":"Rubbert","street":"5 Kensington Crossing","postalCode":"90510","city":"Torrance","state":"CA","email":"brubbert5j@phpbb.com"}, +{"id":201,"firstName":"Jervis","lastName":"Doree","street":"2947 Center Plaza","postalCode":"70160","city":"New Orleans","state":"LA","phoneNumber":"504-278-7497","email":"jdoree5k@shutterfly.com"}, +{"id":202,"firstName":"Odelia","lastName":"Lidierth","street":"36699 Aberg Park","postalCode":"62764","city":"Springfield","state":"IL"}, +{"id":203,"firstName":"Ree","lastName":"Lammerding","street":"3542 Lerdahl Court","postalCode":"88558","city":"El Paso","state":"TX","phoneNumber":"915-384-9334","email":"rlammerding5m@msu.edu"}, +{"id":204,"firstName":"Davy","lastName":"Orniz","street":"49 Graedel Parkway","postalCode":"48295","city":"Detroit","state":"MI","email":"dorniz5n@examiner.com"}, +{"id":205,"firstName":"Syd","lastName":"Buckoke","street":"70 Pepper Wood Alley","postalCode":"74156","city":"Tulsa","state":"OK","phoneNumber":"918-604-5799"}, +{"id":206,"firstName":"Ginger","lastName":"Calkin","street":"7 Thompson Trail","postalCode":"71115","city":"Shreveport","state":"LA","phoneNumber":"318-650-6046"}, +{"id":207,"firstName":"Anissa","lastName":"Ivashinnikov","street":"61905 Chive Circle","postalCode":"40745","city":"London","state":"KY","email":"aivashinnikov5q@google.cn"}, +{"id":208,"firstName":"Vikky","lastName":"Kesley","street":"1 Grayhawk Street","postalCode":"06538","city":"New Haven","state":"CT","phoneNumber":"203-944-7163"}, +{"id":209,"firstName":"Alisha","lastName":"Lampke","street":"26940 Kensington Park","postalCode":"55446","city":"Minneapolis","state":"MN","phoneNumber":"612-814-9814","email":"alampke5s@apple.com"}, +{"id":210,"firstName":"Davidde","lastName":"Phlipon","street":"2044 Ruskin Road","postalCode":"07188","city":"Newark","state":"NJ","email":"dphlipon5t@shareasale.com"}, +{"id":211,"firstName":"Joly","lastName":"Crottagh","street":"532 Dawn Plaza","postalCode":"85083","city":"Phoenix","state":"AZ","phoneNumber":"602-533-4064"}, +{"id":212,"firstName":"Aggie","lastName":"Niesing","street":"3 Tony Drive","postalCode":"57110","city":"Sioux Falls","state":"SD","email":"aniesing5v@pbs.org"}, +{"id":213,"firstName":"Daron","lastName":"Baudassi","street":"2411 Melvin Court","postalCode":"40581","city":"Lexington","state":"KY","phoneNumber":"859-754-2542","email":"dbaudassi5w@joomla.org"}, +{"id":214,"firstName":"Thadeus","lastName":"Kleiser","street":"1394 Warner Street","postalCode":"87592","city":"Santa Fe","state":"NM","email":"tkleiser5x@bloomberg.com"}, +{"id":215,"firstName":"Terri","lastName":"Perrat","street":"0080 Upham Plaza","postalCode":"52245","city":"Iowa City","state":"IA"}, +{"id":216,"firstName":"Marlena","lastName":"Gatchell","street":"60888 Annamark Street","postalCode":"90060","city":"Los Angeles","state":"CA","phoneNumber":"323-121-6985","email":"mgatchell5z@ibm.com"}, +{"id":217,"firstName":"Locke","lastName":"Orcott","street":"459 Warner Lane","postalCode":"45020","city":"Hamilton","state":"OH","phoneNumber":"937-115-3187"}, +{"id":218,"firstName":"Wilmer","lastName":"Bewick","street":"0 Ohio Center","postalCode":"98166","city":"Seattle","state":"WA","phoneNumber":"253-805-8855","email":"wbewick61@seesaa.net"}, +{"id":219,"firstName":"Marena","lastName":"MacShirrie","street":"607 Badeau Circle","postalCode":"98008","city":"Bellevue","state":"WA","email":"mmacshirrie62@wikia.com"}, +{"id":220,"firstName":"Nathanial","lastName":"Sexty","street":"43 Basil Place","postalCode":"85020","city":"Phoenix","state":"AZ"}, +{"id":221,"firstName":"Wadsworth","lastName":"Iacovuzzi","street":"9610 Donald Crossing","postalCode":"88530","city":"El Paso","state":"TX","phoneNumber":"915-889-7936","email":"wiacovuzzi64@prnewswire.com"}, +{"id":222,"firstName":"Sutton","lastName":"Stych","street":"9 Brentwood Terrace","postalCode":"20546","city":"Washington","state":"DC","phoneNumber":"202-538-6355","email":"sstych65@wikimedia.org"}, +{"id":223,"firstName":"Gaspar","lastName":"Wabey","street":"3061 Bluejay Terrace","postalCode":"10110","city":"New York City","state":"NY","phoneNumber":"917-939-0802","email":"gwabey66@technorati.com"}, +{"id":224,"firstName":"Herminia","lastName":"Guyot","street":"91 Express Drive","postalCode":"85715","city":"Tucson","state":"AZ","phoneNumber":"520-777-1670","email":"hguyot67@admin.ch"}, +{"id":225,"firstName":"Udale","lastName":"Beurich","street":"675 Karstens Crossing","postalCode":"46852","city":"Fort Wayne","state":"IN","phoneNumber":"260-580-8627","email":"ubeurich68@bigcartel.com"}, +{"id":226,"firstName":"Kerrie","lastName":"Girauld","street":"56132 Charing Cross Court","postalCode":"71137","city":"Shreveport","state":"LA","email":"kgirauld69@nationalgeographic.com"}, +{"id":227,"firstName":"Irvin","lastName":"Nix","street":"0676 Aberg Terrace","postalCode":"97075","city":"Beaverton","state":"OR","email":"inix6a@xing.com"}, +{"id":228,"firstName":"Corene","lastName":"Spencock","street":"90 Meadow Ridge Drive","postalCode":"73173","city":"Oklahoma City","state":"OK","phoneNumber":"405-577-1312","email":"cspencock6b@shinystat.com"}, +{"id":229,"firstName":"Christos","lastName":"McIlreavy","street":"673 Jana Trail","postalCode":"23471","city":"Virginia Beach","state":"VA","email":"cmcilreavy6c@mayoclinic.com"}, +{"id":230,"firstName":"Bennett","lastName":"Melding","street":"4 Cardinal Lane","postalCode":"55448","city":"Minneapolis","state":"MN","email":"bmelding6d@t-online.de"}, +{"id":231,"firstName":"Winny","lastName":"de Leon","street":"941 Scoville Place","postalCode":"94611","city":"Oakland","state":"CA","phoneNumber":"510-230-4168","email":"wdeleon6e@dell.com"}, +{"id":232,"firstName":"Nike","lastName":"Iacobassi","street":"956 Service Junction","postalCode":"71914","city":"Hot Springs National Park","state":"AR","phoneNumber":"501-266-4142"}, +{"id":233,"firstName":"Gillan","lastName":"Baumann","street":"11 8th Alley","postalCode":"31190","city":"Atlanta","state":"GA","phoneNumber":"404-703-5154","email":"gbaumann6g@edublogs.org"}, +{"id":234,"firstName":"Brandtr","lastName":"Gadman","street":"5 Marquette Hill","postalCode":"32511","city":"Pensacola","state":"FL","phoneNumber":"850-834-0058","email":"bgadman6h@marriott.com"}, +{"id":235,"firstName":"Kenn","lastName":"Cage","street":"3759 Spohn Point","postalCode":"94126","city":"San Francisco","state":"CA","email":"kcage6i@earthlink.net"}, +{"id":236,"firstName":"Butch","lastName":"Causby","street":"02 Basil Crossing","postalCode":"10110","city":"New York City","state":"NY","phoneNumber":"212-190-1702","email":"bcausby6j@scribd.com"}, +{"id":237,"firstName":"Haleigh","lastName":"Parsonson","street":"8 Ruskin Trail","postalCode":"87201","city":"Albuquerque","state":"NM","phoneNumber":"505-987-1352"}, +{"id":238,"firstName":"Bartel","lastName":"Ruppeli","street":"7538 Red Cloud Center","postalCode":"37410","city":"Chattanooga","state":"TN","phoneNumber":"423-804-1016","email":"bruppeli6l@etsy.com"}, +{"id":239,"firstName":"Gretchen","lastName":"Le feaver","street":"7 Orin Way","postalCode":"98042","city":"Kent","state":"WA","phoneNumber":"253-205-3092","email":"glefeaver6m@mayoclinic.com"}, +{"id":240,"firstName":"Trumaine","lastName":"Dearden","street":"1 Vernon Trail","postalCode":"06127","city":"West Hartford","state":"CT","phoneNumber":"860-939-3865","email":"tdearden6n@goo.gl"}, +{"id":241,"firstName":"Aggie","lastName":"Dubs","street":"3601 Walton Trail","postalCode":"62764","city":"Springfield","state":"IL","phoneNumber":"217-834-6059","email":"adubs6o@cbsnews.com"}, +{"id":242,"firstName":"Shelly","lastName":"Skechley","street":"16 Morning Lane","postalCode":"60567","city":"Naperville","state":"IL","email":"sskechley6p@technorati.com"}, +{"id":243,"firstName":"Karin","lastName":"Fausch","street":"7532 Eggendart Way","postalCode":"19810","city":"Wilmington","state":"DE","phoneNumber":"302-548-2991"}, +{"id":244,"firstName":"Sal","lastName":"Harrow","street":"2632 Lien Way","postalCode":"33982","city":"Punta Gorda","state":"FL","phoneNumber":"941-904-5187","email":"sharrow6r@joomla.org"}, +{"id":245,"firstName":"Albie","lastName":"Strelitzki","street":"8436 Eggendart Terrace","postalCode":"49505","city":"Grand Rapids","state":"MI","email":"astrelitzki6s@google.com.br"}, +{"id":246,"firstName":"Augy","lastName":"Usherwood","street":"9078 Clemons Street","postalCode":"80915","city":"Colorado Springs","state":"CO","email":"ausherwood6t@wikimedia.org"}, +{"id":247,"firstName":"Solomon","lastName":"D'eathe","street":"778 Rockefeller Parkway","postalCode":"84199","city":"Salt Lake City","state":"UT"}, +{"id":248,"firstName":"Talya","lastName":"Joseff","street":"14 Graedel Court","postalCode":"99220","city":"Spokane","state":"WA","email":"tjoseff6v@amazon.de"}, +{"id":249,"firstName":"Anatol","lastName":"Self","street":"2 Stoughton Junction","postalCode":"85255","city":"Scottsdale","state":"AZ"}, +{"id":250,"firstName":"Elinore","lastName":"Bruhnke","street":"3 Bashford Alley","postalCode":"17105","city":"Harrisburg","state":"PA","email":"ebruhnke6x@usnews.com"}, +{"id":251,"firstName":"Stanfield","lastName":"Jagiello","street":"0804 Amoth Road","postalCode":"20067","city":"Washington","state":"DC"}, +{"id":252,"firstName":"Isak","lastName":"Venour","street":"04 Orin Court","postalCode":"78210","city":"San Antonio","state":"TX","email":"ivenour6z@springer.com"}, +{"id":253,"firstName":"Abigale","lastName":"Woolgar","street":"74 Porter Terrace","postalCode":"62705","city":"Springfield","state":"IL"}, +{"id":254,"firstName":"Phylys","lastName":"Casperri","street":"07 Delaware Street","postalCode":"33069","city":"Pompano Beach","state":"FL","phoneNumber":"954-224-4577"}, +{"id":255,"firstName":"Melania","lastName":"Fee","street":"194 Luster Point","postalCode":"70154","city":"New Orleans","state":"LA","phoneNumber":"504-168-6959","email":"mfee72@comsenz.com"}, +{"id":256,"firstName":"Joli","lastName":"Colquite","street":"9 Bayside Court","postalCode":"27425","city":"Greensboro","state":"NC","email":"jcolquite73@comcast.net"}, +{"id":257,"firstName":"Rahel","lastName":"Late","street":"2 Meadow Ridge Alley","postalCode":"32204","city":"Jacksonville","state":"FL"}, +{"id":258,"firstName":"Carny","lastName":"Fewell","street":"21826 Cardinal Pass","postalCode":"98140","city":"Seattle","state":"WA"}, +{"id":259,"firstName":"Lesly","lastName":"Vanyatin","street":"7730 South Court","postalCode":"25356","city":"Charleston","state":"WV","email":"lvanyatin76@histats.com"}, +{"id":260,"firstName":"Fianna","lastName":"Thomason","street":"2576 Holmberg Trail","postalCode":"27710","city":"Durham","state":"NC"}, +{"id":261,"firstName":"Bobinette","lastName":"Gowdridge","street":"6780 Superior Place","postalCode":"37605","city":"Johnson City","state":"TN","phoneNumber":"423-490-4990","email":"bgowdridge78@icio.us"}, +{"id":262,"firstName":"Karmen","lastName":"Megson","street":"34 Messerschmidt Point","postalCode":"97229","city":"Portland","state":"OR","email":"kmegson79@apache.org"}, +{"id":263,"firstName":"Thaddeus","lastName":"Padilla","street":"42 Corben Road","postalCode":"90010","city":"Los Angeles","state":"CA","phoneNumber":"213-659-3136","email":"tpadilla7a@hud.gov"}, +{"id":264,"firstName":"Hanna","lastName":"Baswall","street":"9 Old Shore Lane","postalCode":"53710","city":"Madison","state":"WI","email":"hbaswall7b@ezinearticles.com"}, +{"id":265,"firstName":"Tania","lastName":"McMorland","street":"4333 Commercial Point","postalCode":"45408","city":"Dayton","state":"OH"}, +{"id":266,"firstName":"Gifford","lastName":"Arne","street":"0 Drewry Point","postalCode":"24048","city":"Roanoke","state":"VA","email":"garne7d@samsung.com"}, +{"id":267,"firstName":"Tomasina","lastName":"Linch","street":"64992 Maple Wood Point","postalCode":"98447","city":"Tacoma","state":"WA","email":"tlinch7e@theglobeandmail.com"}, +{"id":268,"firstName":"Merrick","lastName":"Garvan","street":"7220 Melody Trail","postalCode":"90005","city":"Los Angeles","state":"CA","email":"mgarvan7f@mozilla.org"}, +{"id":269,"firstName":"Carmita","lastName":"Sailes","street":"3 Bay Lane","postalCode":"55428","city":"Minneapolis","state":"MN","email":"csailes7g@devhub.com"}, +{"id":270,"firstName":"Lesly","lastName":"Eslemont","street":"93302 Mcbride Terrace","postalCode":"19810","city":"Wilmington","state":"DE","email":"leslemont7h@wunderground.com"}, +{"id":271,"firstName":"Adelaida","lastName":"Keggins","street":"4 Birchwood Pass","postalCode":"97405","city":"Eugene","state":"OR","phoneNumber":"541-387-1319"}, +{"id":272,"firstName":"Peadar","lastName":"Forte","street":"1 Montana Center","postalCode":"32505","city":"Pensacola","state":"FL","email":"pforte7j@xing.com"}, +{"id":273,"firstName":"Godfrey","lastName":"Swatland","street":"477 Maple Wood Road","postalCode":"93034","city":"Oxnard","state":"CA","phoneNumber":"805-267-0614","email":"gswatland7k@photobucket.com"}, +{"id":274,"firstName":"Marten","lastName":"Jelleman","street":"57 Pennsylvania Plaza","postalCode":"20057","city":"Washington","state":"DC","email":"mjelleman7l@phoca.cz"}, +{"id":275,"firstName":"Sharity","lastName":"Keady","street":"753 Sauthoff Place","postalCode":"77505","city":"Pasadena","state":"TX"}, +{"id":276,"firstName":"Gabbie","lastName":"Pally","street":"45 Fallview Park","postalCode":"97255","city":"Portland","state":"OR","phoneNumber":"971-412-2293","email":"gpally7n@dyndns.org"}, +{"id":277,"firstName":"Betsy","lastName":"Rhelton","street":"9 Jackson Road","postalCode":"85040","city":"Phoenix","state":"AZ"}, +{"id":278,"firstName":"Patty","lastName":"Schooling","street":"4 Moulton Point","postalCode":"25705","city":"Huntington","state":"WV","phoneNumber":"304-908-8211","email":"pschooling7p@parallels.com"}, +{"id":279,"firstName":"Katlin","lastName":"O'Hallagan","street":"8418 Petterle Plaza","postalCode":"60636","city":"Chicago","state":"IL","email":"kohallagan7q@hao123.com"}, +{"id":280,"firstName":"Anne","lastName":"Wealleans","street":"3 Sachtjen Court","postalCode":"48609","city":"Saginaw","state":"MI"}, +{"id":281,"firstName":"Flory","lastName":"Pley","street":"6322 Golf View Court","postalCode":"19104","city":"Philadelphia","state":"PA"}, +{"id":282,"firstName":"Maryellen","lastName":"Baszkiewicz","street":"54165 Hanson Trail","postalCode":"93726","city":"Fresno","state":"CA","phoneNumber":"209-198-4916","email":"mbaszkiewicz7t@google.com.br"}, +{"id":283,"firstName":"Moyna","lastName":"Caddens","street":"17 Melrose Lane","postalCode":"11236","city":"Brooklyn","state":"NY","phoneNumber":"917-518-3987","email":"mcaddens7u@amazon.co.uk"}, +{"id":284,"firstName":"Lawton","lastName":"Ramiro","street":"2 Muir Park","postalCode":"48092","city":"Warren","state":"MI","phoneNumber":"810-472-5208","email":"lramiro7v@senate.gov"}, +{"id":285,"firstName":"Agnella","lastName":"Phelip","street":"24566 Colorado Pass","postalCode":"84145","city":"Salt Lake City","state":"UT","phoneNumber":"801-709-8696","email":"aphelip7w@woothemes.com"}, +{"id":286,"firstName":"Tracee","lastName":"Tighe","street":"41013 Cascade Lane","postalCode":"02142","city":"Cambridge","state":"MA"}, +{"id":287,"firstName":"Shelden","lastName":"Sowrey","street":"87 Glacier Hill Court","postalCode":"55557","city":"Young America","state":"MN","email":"ssowrey7y@sfgate.com"}, +{"id":288,"firstName":"Letizia","lastName":"Sallery","street":"65052 Shasta Court","postalCode":"44905","city":"Mansfield","state":"OH","phoneNumber":"419-752-9141"}, +{"id":289,"firstName":"Hilly","lastName":"Oyley","street":"7 Waywood Trail","postalCode":"30323","city":"Atlanta","state":"GA","email":"hoyley80@upenn.edu"}, +{"id":290,"firstName":"Sabra","lastName":"Grigoryev","street":"856 Michigan Trail","postalCode":"33705","city":"Saint Petersburg","state":"FL"}, +{"id":291,"firstName":"Nathanil","lastName":"Bodham","street":"536 Ridgeview Way","postalCode":"79984","city":"El Paso","state":"TX","email":"nbodham82@wikimedia.org"}, +{"id":292,"firstName":"Niven","lastName":"Hartzenberg","street":"5 Carpenter Hill","postalCode":"73167","city":"Oklahoma City","state":"OK","email":"nhartzenberg83@bandcamp.com"}, +{"id":293,"firstName":"Rachael","lastName":"Birdsall","street":"61484 Mendota Point","postalCode":"90410","city":"Santa Monica","state":"CA","email":"rbirdsall84@gmpg.org"}, +{"id":294,"firstName":"Gypsy","lastName":"Rallin","street":"4 Spohn Drive","postalCode":"77346","city":"Humble","state":"TX","phoneNumber":"713-508-2912","email":"grallin85@privacy.gov.au"}, +{"id":295,"firstName":"Skye","lastName":"Arsey","street":"49126 Maryland Lane","postalCode":"02119","city":"Boston","state":"MA"}, +{"id":296,"firstName":"Karalee","lastName":"Biddiss","street":"0327 Coleman Lane","postalCode":"10203","city":"New York City","state":"NY","email":"kbiddiss87@studiopress.com"}, +{"id":297,"firstName":"Russ","lastName":"O' Mahony","street":"7831 Caliangt Avenue","postalCode":"37665","city":"Kingsport","state":"TN","phoneNumber":"423-292-1177","email":"romahony88@umich.edu"}, +{"id":298,"firstName":"Gerianne","lastName":"Morfey","street":"1 Jay Hill","postalCode":"97229","city":"Portland","state":"OR","email":"gmorfey89@techcrunch.com"}, +{"id":299,"firstName":"Griz","lastName":"Vellacott","street":"44 Parkside Court","postalCode":"64149","city":"Kansas City","state":"MO","phoneNumber":"816-120-1692"}, +{"id":300,"firstName":"Parker","lastName":"Mantz","street":"3 Arkansas Lane","postalCode":"90005","city":"Los Angeles","state":"CA","email":"pmantz8b@va.gov"}, +{"id":301,"firstName":"Drugi","lastName":"Acaster","street":"426 Hagan Park","postalCode":"20599","city":"Washington","state":"DC","email":"dacaster8c@ihg.com"}, +{"id":302,"firstName":"Peder","lastName":"Monget","street":"9 Wayridge Parkway","postalCode":"92862","city":"Orange","state":"CA","phoneNumber":"714-532-0867","email":"pmonget8d@biblegateway.com"}, +{"id":303,"firstName":"Zilvia","lastName":"Grocutt","street":"1 Stuart Circle","postalCode":"34642","city":"Seminole","state":"FL"}, +{"id":304,"firstName":"Clyve","lastName":"Gunby","street":"75 Dunning Junction","postalCode":"79977","city":"El Paso","state":"TX","email":"cgunby8f@microsoft.com"}, +{"id":305,"firstName":"Zacharias","lastName":"Tomasini","street":"48488 Thackeray Way","postalCode":"40210","city":"Louisville","state":"KY","email":"ztomasini8g@harvard.edu"}, +{"id":306,"firstName":"Ferdinand","lastName":"McGuinley","street":"30366 Kipling Drive","postalCode":"23208","city":"Richmond","state":"VA","email":"fmcguinley8h@archive.org"}, +{"id":307,"firstName":"Ebonee","lastName":"Brumfitt","street":"18765 Division Terrace","postalCode":"30033","city":"Decatur","state":"GA","phoneNumber":"404-684-8364","email":"ebrumfitt8i@sourceforge.net"}, +{"id":308,"firstName":"Christy","lastName":"Cuniam","street":"6 Homewood Road","postalCode":"78744","city":"Austin","state":"TX","phoneNumber":"361-677-9833","email":"ccuniam8j@51.la"}, +{"id":309,"firstName":"Emelen","lastName":"Casin","street":"91 Thompson Plaza","postalCode":"33954","city":"Port Charlotte","state":"FL","email":"ecasin8k@webnode.com"}, +{"id":310,"firstName":"Babara","lastName":"Robberecht","street":"603 Oak Terrace","postalCode":"37450","city":"Chattanooga","state":"TN","email":"brobberecht8l@cargocollective.com"}, +{"id":311,"firstName":"Cesar","lastName":"Whitecross","street":"024 Oxford Junction","postalCode":"20226","city":"Washington","state":"DC","phoneNumber":"202-772-2936"}, +{"id":312,"firstName":"Frieda","lastName":"Sliman","street":"4 Beilfuss Hill","postalCode":"23324","city":"Chesapeake","state":"VA","email":"fsliman8n@bigcartel.com"}, +{"id":313,"firstName":"Dylan","lastName":"Paige","street":"26 Gina Parkway","postalCode":"55448","city":"Minneapolis","state":"MN","email":"dpaige8o@trellian.com"}, +{"id":314,"firstName":"Waring","lastName":"Labon","street":"2843 Spenser Center","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-274-0766","email":"wlabon8p@ucla.edu"}, +{"id":315,"firstName":"Conny","lastName":"Duinkerk","street":"65 Lunder Circle","postalCode":"45426","city":"Dayton","state":"OH","email":"cduinkerk8q@economist.com"}, +{"id":316,"firstName":"Nessie","lastName":"Stucksbury","street":"91449 Browning Drive","postalCode":"25705","city":"Huntington","state":"WV","phoneNumber":"304-182-0766"}, +{"id":317,"firstName":"Corrine","lastName":"Kohlert","street":"00706 Carioca Plaza","postalCode":"45223","city":"Cincinnati","state":"OH","email":"ckohlert8s@wunderground.com"}, +{"id":318,"firstName":"Horatio","lastName":"Greengrass","street":"0 Cascade Park","postalCode":"79905","city":"El Paso","state":"TX","email":"hgreengrass8t@ameblo.jp"}, +{"id":319,"firstName":"Jana","lastName":"McLae","street":"919 Esch Place","postalCode":"55428","city":"Minneapolis","state":"MN","email":"jmclae8u@nytimes.com"}, +{"id":320,"firstName":"Maressa","lastName":"Rehor","street":"55 Talisman Junction","postalCode":"90505","city":"Torrance","state":"CA","email":"mrehor8v@vinaora.com"}, +{"id":321,"firstName":"Filide","lastName":"Riehm","street":"0 Karstens Lane","postalCode":"95054","city":"Santa Clara","state":"CA"}, +{"id":322,"firstName":"Bunnie","lastName":"Mumbey","street":"9369 Bayside Circle","postalCode":"46216","city":"Indianapolis","state":"IN","email":"bmumbey8x@scribd.com"}, +{"id":323,"firstName":"Maxi","lastName":"Jentgens","street":"2970 Rowland Circle","postalCode":"84189","city":"Salt Lake City","state":"UT","phoneNumber":"801-423-8854","email":"mjentgens8y@ihg.com"}, +{"id":324,"firstName":"Florri","lastName":"Okenden","street":"2180 Cody Point","postalCode":"70187","city":"New Orleans","state":"LA","phoneNumber":"504-913-1989","email":"fokenden8z@networksolutions.com"}, +{"id":325,"firstName":"Imogen","lastName":"Grisard","street":"8 Westerfield Avenue","postalCode":"92668","city":"Orange","state":"CA","email":"igrisard90@tamu.edu"}, +{"id":326,"firstName":"Edwina","lastName":"Montes","street":"92 Carpenter Avenue","postalCode":"97216","city":"Portland","state":"OR","phoneNumber":"503-544-7296","email":"emontes91@reference.com"}, +{"id":327,"firstName":"Renelle","lastName":"MacCambridge","street":"77 Talmadge Circle","postalCode":"08638","city":"Trenton","state":"NJ","phoneNumber":"609-150-9438","email":"rmaccambridge92@springer.com"}, +{"id":328,"firstName":"Sterne","lastName":"Taberner","street":"642 6th Terrace","postalCode":"10120","city":"New York City","state":"NY","email":"staberner93@miibeian.gov.cn"}, +{"id":329,"firstName":"Garvy","lastName":"Pankethman","street":"8618 Kennedy Terrace","postalCode":"79405","city":"Lubbock","state":"TX","phoneNumber":"806-470-8784","email":"gpankethman94@free.fr"}, +{"id":330,"firstName":"Nathanil","lastName":"Holston","street":"27247 Eliot Avenue","postalCode":"31190","city":"Atlanta","state":"GA","email":"nholston95@drupal.org"}, +{"id":331,"firstName":"Caresse","lastName":"Kilty","street":"514 Manufacturers Pass","postalCode":"76205","city":"Denton","state":"TX","email":"ckilty96@umich.edu"}, +{"id":332,"firstName":"Arlinda","lastName":"Brenstuhl","street":"2 Sunnyside Avenue","postalCode":"55470","city":"Minneapolis","state":"MN","email":"abrenstuhl97@wisc.edu"}, +{"id":333,"firstName":"Darcy","lastName":"Dunne","street":"3 Badeau Park","postalCode":"91328","city":"Northridge","state":"CA"}, +{"id":334,"firstName":"Malva","lastName":"Grew","street":"2242 Huxley Hill","postalCode":"68510","city":"Lincoln","state":"NE","email":"mgrew99@com.com"}, +{"id":335,"firstName":"Sukey","lastName":"Winspur","street":"475 Melvin Way","postalCode":"68524","city":"Lincoln","state":"NE","phoneNumber":"402-816-9401"}, +{"id":336,"firstName":"Beth","lastName":"O'Dougherty","street":"450 Eastlawn Park","postalCode":"93591","city":"Palmdale","state":"CA","phoneNumber":"661-845-8781"}, +{"id":337,"firstName":"Cortney","lastName":"Meers","street":"9 Chive Drive","postalCode":"93762","city":"Fresno","state":"CA","email":"cmeers9c@diigo.com"}, +{"id":338,"firstName":"Geralda","lastName":"Brocket","street":"0686 La Follette Avenue","postalCode":"80126","city":"Littleton","state":"CO","phoneNumber":"720-641-1371","email":"gbrocket9d@youku.com"}, +{"id":339,"firstName":"Lishe","lastName":"Maliphant","street":"5 Erie Plaza","postalCode":"63169","city":"Saint Louis","state":"MO","email":"lmaliphant9e@sfgate.com"}, +{"id":340,"firstName":"Brod","lastName":"Dobrovsky","street":"9 Gateway Park","postalCode":"79405","city":"Lubbock","state":"TX"}, +{"id":341,"firstName":"Philippe","lastName":"Argile","street":"4 Red Cloud Plaza","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-633-5495"}, +{"id":342,"firstName":"Sadye","lastName":"Sally","street":"07 Mendota Terrace","postalCode":"75507","city":"Texarkana","state":"TX","email":"ssally9h@e-recht24.de"}, +{"id":343,"firstName":"Napoleon","lastName":"Piggott","street":"3968 Roxbury Point","postalCode":"35905","city":"Gadsden","state":"AL","email":"npiggott9i@cnbc.com"}, +{"id":344,"firstName":"Jere","lastName":"Larn","street":"5086 Dahle Crossing","postalCode":"39534","city":"Biloxi","state":"MS","email":"jlarn9j@twitter.com"}, +{"id":345,"firstName":"Bevon","lastName":"Stidson","street":"7 Armistice Court","postalCode":"23436","city":"Suffolk","state":"VA","email":"bstidson9k@alexa.com"}, +{"id":346,"firstName":"Drugi","lastName":"Ewbach","street":"6032 5th Avenue","postalCode":"02208","city":"Boston","state":"MA","email":"dewbach9l@techcrunch.com"}, +{"id":347,"firstName":"Milka","lastName":"Caizley","street":"7 Anderson Junction","postalCode":"37228","city":"Nashville","state":"TN","phoneNumber":"615-305-6985","email":"mcaizley9m@cyberchimps.com"}, +{"id":348,"firstName":"Wilton","lastName":"Biagi","street":"80833 6th Crossing","postalCode":"40215","city":"Louisville","state":"KY","email":"wbiagi9n@vinaora.com"}, +{"id":349,"firstName":"Dilly","lastName":"Spradbrow","street":"5 Harbort Street","postalCode":"45419","city":"Dayton","state":"OH","email":"dspradbrow9o@marketwatch.com"}, +{"id":350,"firstName":"Gan","lastName":"Gookey","street":"8387 Bultman Terrace","postalCode":"75241","city":"Dallas","state":"TX"}, +{"id":351,"firstName":"Nanon","lastName":"Mulrenan","street":"47257 Reindahl Drive","postalCode":"22119","city":"Merrifield","state":"VA","phoneNumber":"571-637-8154","email":"nmulrenan9q@godaddy.com"}, +{"id":352,"firstName":"Frederique","lastName":"Watkiss","street":"61 Heath Pass","postalCode":"70124","city":"New Orleans","state":"LA","phoneNumber":"504-891-7051"}, +{"id":353,"firstName":"Sinclare","lastName":"MacCurlye","street":"514 Meadow Ridge Place","postalCode":"97240","city":"Portland","state":"OR","phoneNumber":"971-190-5174","email":"smaccurlye9s@google.ru"}, +{"id":354,"firstName":"Jessie","lastName":"Newlands","street":"80509 Northland Pass","postalCode":"33111","city":"Miami","state":"FL","phoneNumber":"786-557-9193"}, +{"id":355,"firstName":"Jamaal","lastName":"Molder","street":"90 Mcbride Trail","postalCode":"78764","city":"Austin","state":"TX","phoneNumber":"512-320-8728"}, +{"id":356,"firstName":"Benni","lastName":"Sherel","street":"7 Springs Road","postalCode":"15235","city":"Pittsburgh","state":"PA","email":"bsherel9v@hostgator.com"}, +{"id":357,"firstName":"Dene","lastName":"Brigge","street":"8560 Sutteridge Parkway","postalCode":"32412","city":"Panama City","state":"FL"}, +{"id":358,"firstName":"Timoteo","lastName":"Iban","street":"52858 Oak Valley Hill","postalCode":"93750","city":"Fresno","state":"CA","email":"tiban9x@europa.eu"}, +{"id":359,"firstName":"Dar","lastName":"Quillinane","street":"2 Carberry Junction","postalCode":"66276","city":"Shawnee Mission","state":"KS","phoneNumber":"913-977-7562","email":"dquillinane9y@msn.com"}, +{"id":360,"firstName":"Claudian","lastName":"Tinson","street":"445 Novick Avenue","postalCode":"79968","city":"El Paso","state":"TX","email":"ctinson9z@google.cn"}, +{"id":361,"firstName":"Clarice","lastName":"Deneve","street":"94 Meadow Ridge Road","postalCode":"37131","city":"Murfreesboro","state":"TN","phoneNumber":"615-780-7667"}, +{"id":362,"firstName":"Hilary","lastName":"Bithell","street":"20 Russell Trail","postalCode":"81010","city":"Pueblo","state":"CO","email":"hbithella1@list-manage.com"}, +{"id":363,"firstName":"Mathew","lastName":"Scrivin","street":"4 Elgar Point","postalCode":"90081","city":"Los Angeles","state":"CA","phoneNumber":"213-898-6650","email":"mscrivina2@about.me"}, +{"id":364,"firstName":"Idell","lastName":"Rambadt","street":"6 Cherokee Hill","postalCode":"90840","city":"Long Beach","state":"CA","email":"irambadta3@ustream.tv"}, +{"id":365,"firstName":"Nealon","lastName":"Schoolfield","street":"1 Northland Point","postalCode":"74133","city":"Tulsa","state":"OK"}, +{"id":366,"firstName":"Gregorius","lastName":"Bartot","street":"24636 Eagle Crest Crossing","postalCode":"32215","city":"Jacksonville","state":"FL","email":"gbartota5@blogger.com"}, +{"id":367,"firstName":"Inessa","lastName":"Hullin","street":"559 Bartillon Trail","postalCode":"33142","city":"Miami","state":"FL","phoneNumber":"305-381-6621","email":"ihullina6@pcworld.com"}, +{"id":368,"firstName":"Andie","lastName":"Bampford","street":"5204 Meadow Valley Street","postalCode":"92825","city":"Anaheim","state":"CA","email":"abampforda7@sun.com"}, +{"id":369,"firstName":"Duane","lastName":"MacShirrie","street":"5077 Kings Parkway","postalCode":"92725","city":"Santa Ana","state":"CA","email":"dmacshirriea8@rambler.ru"}, +{"id":370,"firstName":"Sydel","lastName":"Deerr","street":"1 Commercial Road","postalCode":"30356","city":"Atlanta","state":"GA","phoneNumber":"404-209-0194","email":"sdeerra9@phpbb.com"}, +{"id":371,"firstName":"Mel","lastName":"Miles","street":"28164 Melody Plaza","postalCode":"90847","city":"Long Beach","state":"CA","phoneNumber":"562-932-1172"}, +{"id":372,"firstName":"Jone","lastName":"Drinkel","street":"946 Reindahl Point","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-547-0653"}, +{"id":373,"firstName":"Marcellus","lastName":"MacGilmartin","street":"10568 Westerfield Way","postalCode":"32868","city":"Orlando","state":"FL","phoneNumber":"407-874-6188","email":"mmacgilmartinac@fotki.com"}, +{"id":374,"firstName":"Bret","lastName":"Hardan","street":"9 Hayes Crossing","postalCode":"32309","city":"Tallahassee","state":"FL","email":"bhardanad@mit.edu"}, +{"id":375,"firstName":"Heddie","lastName":"Cesaric","street":"502 Cody Crossing","postalCode":"95397","city":"Modesto","state":"CA"}, +{"id":376,"firstName":"Tansy","lastName":"Maeer","street":"526 Messerschmidt Court","postalCode":"94089","city":"Sunnyvale","state":"CA","email":"tmaeeraf@arizona.edu"}, +{"id":377,"firstName":"Waverly","lastName":"West-Frimley","street":"02 Quincy Trail","postalCode":"20575","city":"Washington","state":"DC","phoneNumber":"202-493-3304","email":"wwestfrimleyag@ft.com"}, +{"id":378,"firstName":"Dido","lastName":"de Clercq","street":"7 Norway Maple Center","postalCode":"84125","city":"Salt Lake City","state":"UT","email":"ddeclercqah@trellian.com"}, +{"id":379,"firstName":"Vic","lastName":"Samuels","street":"2 Kipling Drive","postalCode":"31190","city":"Atlanta","state":"GA","email":"vsamuelsai@goo.gl"}, +{"id":380,"firstName":"Jeno","lastName":"Freiburger","street":"431 Golden Leaf Parkway","postalCode":"32610","city":"Gainesville","state":"FL","email":"jfreiburgeraj@theguardian.com"}, +{"id":381,"firstName":"Christine","lastName":"Basketter","street":"4 Lotheville Terrace","postalCode":"39305","city":"Meridian","state":"MS","phoneNumber":"601-702-1546"}, +{"id":382,"firstName":"Karry","lastName":"Corsan","street":"09189 Lakeland Point","postalCode":"27409","city":"Greensboro","state":"NC","phoneNumber":"336-445-0006","email":"kcorsanal@usgs.gov"}, +{"id":383,"firstName":"Barri","lastName":"Brinsden","street":"53 Shelley Drive","postalCode":"35225","city":"Birmingham","state":"AL","email":"bbrinsdenam@1und1.de"}, +{"id":384,"firstName":"Hyacintha","lastName":"Boddam","street":"45 Sugar Circle","postalCode":"10160","city":"New York City","state":"NY","phoneNumber":"212-794-6062"}, +{"id":385,"firstName":"Brande","lastName":"Remnant","street":"283 Stone Corner Road","postalCode":"31904","city":"Columbus","state":"GA","phoneNumber":"706-211-4851","email":"bremnantao@people.com.cn"}, +{"id":386,"firstName":"Tally","lastName":"Bygraves","street":"54833 Northport Pass","postalCode":"85072","city":"Phoenix","state":"AZ","email":"tbygravesap@jigsy.com"}, +{"id":387,"firstName":"Garfield","lastName":"Pressnell","street":"63077 Hudson Court","postalCode":"30061","city":"Marietta","state":"GA","email":"gpressnellaq@archive.org"}, +{"id":388,"firstName":"Romonda","lastName":"Stiggles","street":"17 Russell Parkway","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-600-9676"}, +{"id":389,"firstName":"Dedie","lastName":"Ralling","street":"8 Judy Plaza","postalCode":"94137","city":"San Francisco","state":"CA","email":"drallingas@wikia.com"}, +{"id":390,"firstName":"Maddi","lastName":"Cornau","street":"5 Oriole Way","postalCode":"92105","city":"San Diego","state":"CA","phoneNumber":"619-388-6359","email":"mcornauat@adobe.com"}, +{"id":391,"firstName":"Zeke","lastName":"Jennery","street":"65332 Sommers Avenue","postalCode":"48206","city":"Detroit","state":"MI","email":"zjenneryau@elegantthemes.com"}, +{"id":392,"firstName":"Danya","lastName":"Fairlaw","street":"343 Logan Alley","postalCode":"33111","city":"Miami","state":"FL","email":"dfairlawav@irs.gov"}, +{"id":393,"firstName":"Rabi","lastName":"Petheridge","street":"7 Monica Alley","postalCode":"64054","city":"Independence","state":"MO","phoneNumber":"816-501-9452"}, +{"id":394,"firstName":"Ebba","lastName":"Skellen","street":"2655 Iowa Terrace","postalCode":"63150","city":"Saint Louis","state":"MO","phoneNumber":"314-695-7831","email":"eskellenax@nbcnews.com"}, +{"id":395,"firstName":"Marie-ann","lastName":"Glaysher","street":"4 Lakewood Hill","postalCode":"12247","city":"Albany","state":"NY","phoneNumber":"518-634-2425"}, +{"id":396,"firstName":"Arne","lastName":"Quincey","street":"162 Redwing Way","postalCode":"83711","city":"Boise","state":"ID"}, +{"id":397,"firstName":"Clarita","lastName":"Okroy","street":"05 Delaware Way","postalCode":"45218","city":"Cincinnati","state":"OH","email":"cokroyb0@stumbleupon.com"}, +{"id":398,"firstName":"Renault","lastName":"Weighell","street":"498 Dovetail Place","postalCode":"79710","city":"Midland","state":"TX","phoneNumber":"432-955-1408"}, +{"id":399,"firstName":"Roderich","lastName":"Mankor","street":"07 Dayton Way","postalCode":"92160","city":"San Diego","state":"CA"}, +{"id":400,"firstName":"Arv","lastName":"Sunnex","street":"89 Ronald Regan Terrace","postalCode":"91109","city":"Pasadena","state":"CA","email":"asunnexb3@vkontakte.ru"}, +{"id":401,"firstName":"Sonia","lastName":"Cowperthwaite","street":"77 Dennis Point","postalCode":"16550","city":"Erie","state":"PA"}, +{"id":402,"firstName":"Buddie","lastName":"Goscomb","street":"85675 Eastlawn Pass","postalCode":"20535","city":"Washington","state":"DC"}, +{"id":403,"firstName":"Brandi","lastName":"Swaine","street":"39961 Del Mar Lane","postalCode":"39705","city":"Columbus","state":"MS","phoneNumber":"662-306-2164","email":"bswaineb6@miibeian.gov.cn"}, +{"id":404,"firstName":"Jenny","lastName":"Cabbell","street":"743 Fordem Center","postalCode":"78285","city":"San Antonio","state":"TX","phoneNumber":"210-491-9874","email":"jcabbellb7@techcrunch.com"}, +{"id":405,"firstName":"Vincent","lastName":"People","street":"83 Tennessee Way","postalCode":"77293","city":"Houston","state":"TX","phoneNumber":"281-261-1928","email":"vpeopleb8@github.io"}, +{"id":406,"firstName":"Reinald","lastName":"Roles","street":"2 Division Road","postalCode":"53785","city":"Madison","state":"WI","phoneNumber":"608-568-7958","email":"rrolesb9@google.fr"}, +{"id":407,"firstName":"Kale","lastName":"Wanek","street":"7 Crescent Oaks Terrace","postalCode":"46852","city":"Fort Wayne","state":"IN","phoneNumber":"260-844-9669","email":"kwanekba@scribd.com"}, +{"id":408,"firstName":"Charisse","lastName":"Perse","street":"94449 Gateway Street","postalCode":"91117","city":"Pasadena","state":"CA","email":"cpersebb@ycombinator.com"}, +{"id":409,"firstName":"Konstantin","lastName":"Aslum","street":"08 Kings Trail","postalCode":"80328","city":"Boulder","state":"CO","email":"kaslumbc@opera.com"}, +{"id":410,"firstName":"Tyson","lastName":"O'Hartigan","street":"75122 Crowley Place","postalCode":"95173","city":"San Jose","state":"CA","phoneNumber":"408-879-0901","email":"tohartiganbd@devhub.com"}, +{"id":411,"firstName":"Fallon","lastName":"Haysman","street":"477 High Crossing Place","postalCode":"23293","city":"Richmond","state":"VA"}, +{"id":412,"firstName":"Svend","lastName":"Scarlet","street":"2856 Merrick Circle","postalCode":"90087","city":"Los Angeles","state":"CA","email":"sscarletbf@clickbank.net"}, +{"id":413,"firstName":"Gabey","lastName":"Colter","street":"7 2nd Alley","postalCode":"90610","city":"Whittier","state":"CA"}, +{"id":414,"firstName":"Hart","lastName":"Densell","street":"2687 Elka Alley","postalCode":"99599","city":"Anchorage","state":"AK","phoneNumber":"907-286-6079"}, +{"id":415,"firstName":"Claresta","lastName":"Folger","street":"5 Amoth Alley","postalCode":"27116","city":"Winston Salem","state":"NC"}, +{"id":416,"firstName":"Rica","lastName":"Lightowlers","street":"54303 Mayer Drive","postalCode":"61825","city":"Champaign","state":"IL","email":"rlightowlersbj@so-net.ne.jp"}, +{"id":417,"firstName":"Paula","lastName":"Treadaway","street":"8 Anniversary Road","postalCode":"20456","city":"Washington","state":"DC"}, +{"id":418,"firstName":"Francoise","lastName":"Gooderick","street":"13 Knutson Lane","postalCode":"33325","city":"Fort Lauderdale","state":"FL","email":"fgooderickbl@dedecms.com"}, +{"id":419,"firstName":"Ferdy","lastName":"Nannizzi","street":"578 Esker Trail","postalCode":"25321","city":"Charleston","state":"WV","email":"fnannizzibm@rambler.ru"}, +{"id":420,"firstName":"Dody","lastName":"Gettone","street":"9 Veith Court","postalCode":"62711","city":"Springfield","state":"IL"}, +{"id":421,"firstName":"Ronna","lastName":"Godleman","street":"6 Jenna Trail","postalCode":"22301","city":"Alexandria","state":"VA","email":"rgodlemanbo@hexun.com"}, +{"id":422,"firstName":"Adey","lastName":"Waith","street":"2 Mayer Avenue","postalCode":"12325","city":"Schenectady","state":"NY"}, +{"id":423,"firstName":"Stanislaw","lastName":"Garahan","street":"660 Merry Avenue","postalCode":"62723","city":"Springfield","state":"IL","phoneNumber":"217-587-6734"}, +{"id":424,"firstName":"Westley","lastName":"Knowles","street":"67430 Lakeland Circle","postalCode":"53263","city":"Milwaukee","state":"WI","email":"wknowlesbr@msu.edu"}, +{"id":425,"firstName":"Dion","lastName":"Jamson","street":"696 Birchwood Circle","postalCode":"80015","city":"Aurora","state":"CO","phoneNumber":"720-486-4494"}, +{"id":426,"firstName":"Glynis","lastName":"Bourhill","street":"091 Harper Park","postalCode":"40250","city":"Louisville","state":"KY"}, +{"id":427,"firstName":"Massimo","lastName":"Briand","street":"37 Northview Junction","postalCode":"75507","city":"Texarkana","state":"TX","email":"mbriandbu@etsy.com"}, +{"id":428,"firstName":"Tremayne","lastName":"Cadore","street":"6721 Anthes Point","postalCode":"94605","city":"Oakland","state":"CA","email":"tcadorebv@mozilla.com"}, +{"id":429,"firstName":"Lea","lastName":"Wildman","street":"52 Dixon Point","postalCode":"50310","city":"Des Moines","state":"IA","phoneNumber":"515-536-2096"}, +{"id":430,"firstName":"Ambur","lastName":"Oxlade","street":"356 Porter Center","postalCode":"44485","city":"Warren","state":"OH"}, +{"id":431,"firstName":"Jyoti","lastName":"Gillet","street":"13 Del Mar Parkway","postalCode":"81505","city":"Grand Junction","state":"CO","phoneNumber":"970-598-0357"}, +{"id":432,"firstName":"Sascha","lastName":"Stanyan","street":"77289 Blue Bill Park Alley","postalCode":"06120","city":"Hartford","state":"CT","email":"sstanyanbz@geocities.jp"}, +{"id":433,"firstName":"Spenser","lastName":"Harry","street":"2021 Oak Place","postalCode":"32835","city":"Orlando","state":"FL","email":"sharryc0@privacy.gov.au"}, +{"id":434,"firstName":"Clim","lastName":"Penrose","street":"8 Warrior Road","postalCode":"15255","city":"Pittsburgh","state":"PA","email":"cpenrosec1@blogtalkradio.com"}, +{"id":435,"firstName":"Jewell","lastName":"McKinnon","street":"4 Delladonna Street","postalCode":"36114","city":"Montgomery","state":"AL","email":"jmckinnonc2@tinypic.com"}, +{"id":436,"firstName":"Estrellita","lastName":"Amburgy","street":"5538 Tennessee Plaza","postalCode":"17121","city":"Harrisburg","state":"PA","phoneNumber":"717-274-8930","email":"eamburgyc3@forbes.com"}, +{"id":437,"firstName":"Sarah","lastName":"Fears","street":"61 Springs Park","postalCode":"93034","city":"Oxnard","state":"CA","email":"sfearsc4@wisc.edu"}, +{"id":438,"firstName":"Nixie","lastName":"Peddie","street":"7 Armistice Way","postalCode":"10155","city":"New York City","state":"NY","email":"npeddiec5@free.fr"}, +{"id":439,"firstName":"Ardisj","lastName":"Rohmer","street":"726 Crowley Point","postalCode":"93399","city":"Bakersfield","state":"CA","email":"arohmerc6@google.nl"}, +{"id":440,"firstName":"Wallie","lastName":"Johanssen","street":"9555 Jana Park","postalCode":"28410","city":"Wilmington","state":"NC","phoneNumber":"910-160-4520","email":"wjohanssenc7@boston.com"}, +{"id":441,"firstName":"Allan","lastName":"Jodlkowski","street":"31585 Kedzie Park","postalCode":"89150","city":"Las Vegas","state":"NV","phoneNumber":"702-782-3289","email":"ajodlkowskic8@sogou.com"}, +{"id":442,"firstName":"Harris","lastName":"Cadden","street":"96829 Fieldstone Park","postalCode":"16565","city":"Erie","state":"PA","phoneNumber":"814-745-1099"}, +{"id":443,"firstName":"Nigel","lastName":"Girardengo","street":"24703 Red Cloud Road","postalCode":"90310","city":"Inglewood","state":"CA","email":"ngirardengoca@ow.ly"}, +{"id":444,"firstName":"Aila","lastName":"Tinniswood","street":"62812 Stephen Parkway","postalCode":"13205","city":"Syracuse","state":"NY","phoneNumber":"315-847-2259","email":"atinniswoodcb@google.com.br"}, +{"id":445,"firstName":"Genni","lastName":"Geockle","street":"81 Bobwhite Plaza","postalCode":"93721","city":"Fresno","state":"CA","email":"ggeocklecc@furl.net"}, +{"id":446,"firstName":"Madison","lastName":"Brikner","street":"166 Coolidge Trail","postalCode":"07208","city":"Elizabeth","state":"NJ","email":"mbriknercd@myspace.com"}, +{"id":447,"firstName":"Akim","lastName":"Gotthard.sf","street":"0017 Heffernan Parkway","postalCode":"71914","city":"Hot Springs National Park","state":"AR","email":"agotthardsfce@google.com.au"}, +{"id":448,"firstName":"Andria","lastName":"Cardello","street":"1089 Stang Road","postalCode":"96835","city":"Honolulu","state":"HI","phoneNumber":"808-372-6528"}, +{"id":449,"firstName":"Laureen","lastName":"Crawshaw","street":"13 Manitowish Avenue","postalCode":"23504","city":"Norfolk","state":"VA","phoneNumber":"757-220-4043"}, +{"id":450,"firstName":"Henderson","lastName":"Parmley","street":"3408 Superior Street","postalCode":"28410","city":"Wilmington","state":"NC","email":"hparmleych@diigo.com"}, +{"id":451,"firstName":"Henri","lastName":"Arnley","street":"54 Knutson Park","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"718-365-7389"}, +{"id":452,"firstName":"Phil","lastName":"Trunkfield","street":"07 Arizona Way","postalCode":"85030","city":"Phoenix","state":"AZ","email":"ptrunkfieldcj@cisco.com"}, +{"id":453,"firstName":"Chery","lastName":"Nangle","street":"03 Merrick Way","postalCode":"88569","city":"El Paso","state":"TX","phoneNumber":"915-959-5535","email":"cnangleck@tumblr.com"}, +{"id":454,"firstName":"Leora","lastName":"Fields","street":"0260 Eastlawn Lane","postalCode":"85311","city":"Glendale","state":"AZ","email":"lfieldscl@nyu.edu"}, +{"id":455,"firstName":"Ronnica","lastName":"Pocknoll","street":"786 Hovde Plaza","postalCode":"78410","city":"Corpus Christi","state":"TX","email":"rpocknollcm@unesco.org"}, +{"id":456,"firstName":"Valida","lastName":"Romayn","street":"1108 Hudson Drive","postalCode":"34615","city":"Clearwater","state":"FL","email":"vromayncn@usatoday.com"}, +{"id":457,"firstName":"Randee","lastName":"Strowther","street":"441 Cordelia Point","postalCode":"27710","city":"Durham","state":"NC","phoneNumber":"919-463-1516","email":"rstrowtherco@trellian.com"}, +{"id":458,"firstName":"Ansell","lastName":"Blacklock","street":"9393 Kedzie Point","postalCode":"75358","city":"Dallas","state":"TX","phoneNumber":"214-949-3912"}, +{"id":459,"firstName":"Bailie","lastName":"Wing","street":"79459 Buhler Way","postalCode":"15279","city":"Pittsburgh","state":"PA","phoneNumber":"412-431-5446"}, +{"id":460,"firstName":"Leesa","lastName":"Wellbeloved","street":"4553 Dakota Circle","postalCode":"40215","city":"Louisville","state":"KY","phoneNumber":"502-145-8496","email":"lwellbelovedcr@go.com"}, +{"id":461,"firstName":"Sarge","lastName":"Tocknell","street":"9884 North Alley","postalCode":"80249","city":"Denver","state":"CO","phoneNumber":"303-603-8315","email":"stocknellcs@artisteer.com"}, +{"id":462,"firstName":"Loralyn","lastName":"Grimolbie","street":"3620 Clyde Gallagher Junction","postalCode":"91103","city":"Pasadena","state":"CA","email":"lgrimolbiect@purevolume.com"}, +{"id":463,"firstName":"Ki","lastName":"Youdell","street":"3 Gina Center","postalCode":"81005","city":"Pueblo","state":"CO"}, +{"id":464,"firstName":"Katerine","lastName":"Herreros","street":"70 Westend Place","postalCode":"57105","city":"Sioux Falls","state":"SD"}, +{"id":465,"firstName":"Frasquito","lastName":"Nockolds","street":"21 Dwight Park","postalCode":"11236","city":"Brooklyn","state":"NY","phoneNumber":"917-761-0549"}, +{"id":466,"firstName":"Krystalle","lastName":"Brierly","street":"7797 Forest Dale Lane","postalCode":"90410","city":"Santa Monica","state":"CA","email":"kbrierlycx@simplemachines.org"}, +{"id":467,"firstName":"Tobin","lastName":"Guillford","street":"501 Messerschmidt Alley","postalCode":"98195","city":"Seattle","state":"WA","phoneNumber":"206-862-7413","email":"tguillfordcy@fastcompany.com"}, +{"id":468,"firstName":"Lorita","lastName":"Sikorski","street":"83 Corscot Junction","postalCode":"44905","city":"Mansfield","state":"OH","phoneNumber":"419-278-2324","email":"lsikorskicz@intel.com"}, +{"id":469,"firstName":"Hermon","lastName":"Chomley","street":"696 Talisman Lane","postalCode":"35290","city":"Birmingham","state":"AL"}, +{"id":470,"firstName":"Karolina","lastName":"Andrault","street":"49738 Maple Wood Place","postalCode":"99709","city":"Fairbanks","state":"AK","phoneNumber":"907-337-1698","email":"kandraultd1@bloglines.com"}, +{"id":471,"firstName":"Lev","lastName":"Pankhurst.","street":"442 Pennsylvania Crossing","postalCode":"23605","city":"Newport News","state":"VA","phoneNumber":"757-832-3631"}, +{"id":472,"firstName":"Bianca","lastName":"Garfath","street":"7 Forest Run Center","postalCode":"71914","city":"Hot Springs National Park","state":"AR","email":"bgarfathd3@youku.com"}, +{"id":473,"firstName":"Walden","lastName":"Van der Linde","street":"6 Namekagon Parkway","postalCode":"70187","city":"New Orleans","state":"LA","email":"wvanderlinded4@netscape.com"}, +{"id":474,"firstName":"Alexandra","lastName":"Vasyukhin","street":"471 School Alley","postalCode":"80910","city":"Colorado Springs","state":"CO","email":"avasyukhind5@samsung.com"}, +{"id":475,"firstName":"Perry","lastName":"Spere","street":"33 Autumn Leaf Street","postalCode":"79994","city":"El Paso","state":"TX","email":"pspered6@tamu.edu"}, +{"id":476,"firstName":"Cristobal","lastName":"Afonso","street":"5 Lake View Way","postalCode":"19136","city":"Philadelphia","state":"PA","email":"cafonsod7@themeforest.net"}, +{"id":477,"firstName":"Sebastien","lastName":"Annets","street":"4229 Bowman Trail","postalCode":"43699","city":"Toledo","state":"OH","phoneNumber":"419-981-8630","email":"sannetsd8@guardian.co.uk"}, +{"id":478,"firstName":"Prentice","lastName":"Desorts","street":"54 Mendota Drive","postalCode":"31196","city":"Atlanta","state":"GA","phoneNumber":"404-235-6736","email":"pdesortsd9@who.int"}, +{"id":479,"firstName":"Rubin","lastName":"Dunkerk","street":"035 Myrtle Park","postalCode":"94297","city":"Sacramento","state":"CA","phoneNumber":"916-658-2157","email":"rdunkerkda@columbia.edu"}, +{"id":480,"firstName":"Jesselyn","lastName":"Bidnall","street":"2353 Norway Maple Court","postalCode":"07522","city":"Paterson","state":"NJ","email":"jbidnalldb@4shared.com"}, +{"id":481,"firstName":"Arleta","lastName":"Massy","street":"2 Bluejay Lane","postalCode":"10310","city":"Staten Island","state":"NY"}, +{"id":482,"firstName":"Trescha","lastName":"Joncic","street":"052 Summit Way","postalCode":"13217","city":"Syracuse","state":"NY"}, +{"id":483,"firstName":"Joshuah","lastName":"Galbreth","street":"16 Elka Place","postalCode":"08922","city":"New Brunswick","state":"NJ","email":"jgalbrethde@rambler.ru"}, +{"id":484,"firstName":"Clywd","lastName":"Henlon","street":"26 Thackeray Pass","postalCode":"90040","city":"Los Angeles","state":"CA","email":"chenlondf@unesco.org"}, +{"id":485,"firstName":"Glenda","lastName":"Grayley","street":"6326 Ohio Plaza","postalCode":"91411","city":"Van Nuys","state":"CA"}, +{"id":486,"firstName":"Glynda","lastName":"Stokell","street":"6 Schmedeman Court","postalCode":"60641","city":"Chicago","state":"IL","email":"gstokelldh@ted.com"}, +{"id":487,"firstName":"Kath","lastName":"Harrap","street":"43769 Barby Plaza","postalCode":"32304","city":"Tallahassee","state":"FL","email":"kharrapdi@cargocollective.com"}, +{"id":488,"firstName":"Dickie","lastName":"Domotor","street":"2954 Toban Lane","postalCode":"98133","city":"Seattle","state":"WA","email":"ddomotordj@hhs.gov"}, +{"id":489,"firstName":"Ceciley","lastName":"Hitzke","street":"9102 Westport Pass","postalCode":"40618","city":"Frankfort","state":"KY","phoneNumber":"502-545-5506","email":"chitzkedk@newsvine.com"}, +{"id":490,"firstName":"Adler","lastName":"Webb-Bowen","street":"5 Hanover Street","postalCode":"32123","city":"Daytona Beach","state":"FL"}, +{"id":491,"firstName":"Fergus","lastName":"Domerq","street":"06 Hansons Road","postalCode":"58106","city":"Fargo","state":"ND","phoneNumber":"701-656-3778"}, +{"id":492,"firstName":"Kimbra","lastName":"Petherick","street":"867 Mayer Drive","postalCode":"39236","city":"Jackson","state":"MS"}, +{"id":493,"firstName":"Geneva","lastName":"Hobgen","street":"74 Vernon Parkway","postalCode":"53710","city":"Madison","state":"WI","email":"ghobgendo@google.de"}, +{"id":494,"firstName":"Jillane","lastName":"Skitral","street":"9747 Ruskin Point","postalCode":"22405","city":"Fredericksburg","state":"VA","email":"jskitraldp@mysql.com"}, +{"id":495,"firstName":"Carolin","lastName":"Pimblotte","street":"8 Union Way","postalCode":"75358","city":"Dallas","state":"TX","phoneNumber":"214-109-7114","email":"cpimblottedq@cargocollective.com"}, +{"id":496,"firstName":"Wandis","lastName":"Andreasson","street":"3 Nancy Parkway","postalCode":"70033","city":"Metairie","state":"LA","email":"wandreassondr@topsy.com"}, +{"id":497,"firstName":"Baily","lastName":"Dalliston","street":"602 Melrose Way","postalCode":"25331","city":"Charleston","state":"WV","email":"bdallistonds@storify.com"}, +{"id":498,"firstName":"Kissie","lastName":"Lammiman","street":"4 Memorial Terrace","postalCode":"06510","city":"New Haven","state":"CT","phoneNumber":"203-724-3731","email":"klammimandt@barnesandnoble.com"}, +{"id":499,"firstName":"Cloris","lastName":"Dorning","street":"4 Lien Road","postalCode":"37235","city":"Nashville","state":"TN","email":"cdorningdu@unesco.org"}, +{"id":500,"firstName":"Jemimah","lastName":"Juppe","street":"979 Tennessee Pass","postalCode":"85305","city":"Glendale","state":"AZ"}, +{"id":501,"firstName":"Fanchette","lastName":"Marlor","street":"90 Waywood Circle","postalCode":"44511","city":"Youngstown","state":"OH","email":"fmarlordw@is.gd"}, +{"id":502,"firstName":"Carmelle","lastName":"Stillmann","street":"9124 Sachtjen Way","postalCode":"74184","city":"Tulsa","state":"OK","email":"cstillmanndx@telegraph.co.uk"}, +{"id":503,"firstName":"Joelle","lastName":"Mumford","street":"5 Susan Point","postalCode":"28410","city":"Wilmington","state":"NC","email":"jmumforddy@yellowbook.com"}, +{"id":504,"firstName":"Vicky","lastName":"Danzelman","street":"472 Pond Junction","postalCode":"11220","city":"Brooklyn","state":"NY","email":"vdanzelmandz@stumbleupon.com"}, +{"id":505,"firstName":"Baudoin","lastName":"Grenshiels","street":"4703 Tony Circle","postalCode":"76198","city":"Fort Worth","state":"TX","email":"bgrenshielse0@devhub.com"}, +{"id":506,"firstName":"Rosetta","lastName":"Wennington","street":"3 Kensington Crossing","postalCode":"14619","city":"Rochester","state":"NY"}, +{"id":507,"firstName":"Eudora","lastName":"Murtell","street":"97 Mockingbird Circle","postalCode":"92867","city":"Orange","state":"CA","phoneNumber":"949-899-3967"}, +{"id":508,"firstName":"Sonnie","lastName":"Hawkin","street":"76669 Green Ridge Crossing","postalCode":"79491","city":"Lubbock","state":"TX","email":"shawkine3@wikia.com"}, +{"id":509,"firstName":"Ulysses","lastName":"Uman","street":"4 Fieldstone Circle","postalCode":"32128","city":"Daytona Beach","state":"FL","phoneNumber":"386-761-6071","email":"uumane4@multiply.com"}, +{"id":510,"firstName":"Alidia","lastName":"Kowalski","street":"3915 Harper Plaza","postalCode":"75221","city":"Dallas","state":"TX","email":"akowalskie5@simplemachines.org"}, +{"id":511,"firstName":"Willis","lastName":"Jeaneau","street":"8 Northport Center","postalCode":"37939","city":"Knoxville","state":"TN","phoneNumber":"865-336-2729","email":"wjeaneaue6@furl.net"}, +{"id":512,"firstName":"Clement","lastName":"Taudevin","street":"25062 Amoth Pass","postalCode":"31914","city":"Columbus","state":"GA","email":"ctaudevine7@mapquest.com"}, +{"id":513,"firstName":"Tally","lastName":"Arnatt","street":"5745 Nancy Terrace","postalCode":"95054","city":"Santa Clara","state":"CA","email":"tarnatte8@umich.edu"}, +{"id":514,"firstName":"Eldon","lastName":"Munnings","street":"17 Dayton Parkway","postalCode":"27690","city":"Raleigh","state":"NC","email":"emunningse9@gmpg.org"}, +{"id":515,"firstName":"Duffie","lastName":"Sibary","street":"840 Springview Avenue","postalCode":"48275","city":"Detroit","state":"MI","email":"dsibaryea@livejournal.com"}, +{"id":516,"firstName":"Winny","lastName":"Dobell","street":"0426 Lindbergh Street","postalCode":"81015","city":"Pueblo","state":"CO","phoneNumber":"719-882-3553","email":"wdobelleb@bizjournals.com"}, +{"id":517,"firstName":"Pancho","lastName":"Pointon","street":"79 Clyde Gallagher Park","postalCode":"97306","city":"Salem","state":"OR","phoneNumber":"503-151-2205"}, +{"id":518,"firstName":"Elston","lastName":"Warwicker","street":"96 Schmedeman Park","postalCode":"44705","city":"Canton","state":"OH","email":"ewarwickered@arstechnica.com"}, +{"id":519,"firstName":"Nicolle","lastName":"Shellcross","street":"23982 Cambridge Parkway","postalCode":"80940","city":"Colorado Springs","state":"CO","email":"nshellcrossee@hibu.com"}, +{"id":520,"firstName":"Bethanne","lastName":"Briggdale","street":"026 Portage Circle","postalCode":"43215","city":"Columbus","state":"OH","phoneNumber":"513-925-3139","email":"bbriggdaleef@flickr.com"}, +{"id":521,"firstName":"Elsey","lastName":"McCorry","street":"781 International Parkway","postalCode":"94286","city":"Sacramento","state":"CA","phoneNumber":"916-879-2104","email":"emccorryeg@sakura.ne.jp"}, +{"id":522,"firstName":"Abran","lastName":"Vasyuchov","street":"64 Grim Place","postalCode":"44177","city":"Cleveland","state":"OH"}, +{"id":523,"firstName":"Rhoda","lastName":"Grieveson","street":"50687 Towne Pass","postalCode":"11220","city":"Brooklyn","state":"NY","email":"rgrievesonei@mit.edu"}, +{"id":524,"firstName":"Florette","lastName":"Eke","street":"85057 Anzinger Lane","postalCode":"66225","city":"Shawnee Mission","state":"KS","phoneNumber":"913-299-0032","email":"fekeej@fema.gov"}, +{"id":525,"firstName":"Sheff","lastName":"Baigrie","street":"80366 Lawn Hill","postalCode":"02203","city":"Boston","state":"MA","phoneNumber":"617-556-4978","email":"sbaigrieek@aboutads.info"}, +{"id":526,"firstName":"Clarisse","lastName":"Hubbuck","street":"435 Truax Trail","postalCode":"02458","city":"Newton","state":"MA","phoneNumber":"781-641-2937"}, +{"id":527,"firstName":"Gilberte","lastName":"Yanele","street":"413 Glacier Hill Park","postalCode":"90610","city":"Whittier","state":"CA","phoneNumber":"562-451-1686","email":"gyaneleem@dot.gov"}, +{"id":528,"firstName":"Lefty","lastName":"Dufore","street":"957 Straubel Street","postalCode":"35220","city":"Birmingham","state":"AL","email":"lduforeen@slideshare.net"}, +{"id":529,"firstName":"Saul","lastName":"Shepperd","street":"44805 Sunnyside Place","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-904-7271"}, +{"id":530,"firstName":"Hadrian","lastName":"Cockhill","street":"479 Mayer Way","postalCode":"22119","city":"Merrifield","state":"VA","email":"hcockhillep@xrea.com"}, +{"id":531,"firstName":"Amalia","lastName":"Geare","street":"63075 Glendale Trail","postalCode":"90065","city":"Los Angeles","state":"CA","email":"ageareeq@vistaprint.com"}, +{"id":532,"firstName":"Adan","lastName":"Ibbeson","street":"5 Cambridge Lane","postalCode":"73142","city":"Oklahoma City","state":"OK"}, +{"id":533,"firstName":"Nicol","lastName":"Garbutt","street":"3 8th Street","postalCode":"50393","city":"Des Moines","state":"IA","phoneNumber":"515-946-8077"}, +{"id":534,"firstName":"Lilas","lastName":"Estcot","street":"1927 Mitchell Avenue","postalCode":"75185","city":"Mesquite","state":"TX","email":"lestcotet@ezinearticles.com"}, +{"id":535,"firstName":"Valina","lastName":"Dellenbrok","street":"1 Victoria Hill","postalCode":"45249","city":"Cincinnati","state":"OH","phoneNumber":"513-958-5055","email":"vdellenbrokeu@upenn.edu"}, +{"id":536,"firstName":"Gwen","lastName":"Harwell","street":"64275 Bartelt Terrace","postalCode":"93721","city":"Fresno","state":"CA"}, +{"id":537,"firstName":"Adriena","lastName":"Lochead","street":"0088 Hintze Point","postalCode":"43231","city":"Columbus","state":"OH","phoneNumber":"614-506-5616","email":"alocheadew@paypal.com"}, +{"id":538,"firstName":"Jacobo","lastName":"Jills","street":"809 Anderson Park","postalCode":"55557","city":"Young America","state":"MN","phoneNumber":"952-580-6574","email":"jjillsex@xing.com"}, +{"id":539,"firstName":"Saree","lastName":"Jeanequin","street":"0212 Clyde Gallagher Alley","postalCode":"32891","city":"Orlando","state":"FL","email":"sjeanequiney@who.int"}, +{"id":540,"firstName":"Kin","lastName":"Dewar","street":"3 Emmet Center","postalCode":"20244","city":"Washington","state":"DC","email":"kdewarez@discovery.com"}, +{"id":541,"firstName":"Kaleena","lastName":"Godfray","street":"4350 Eliot Parkway","postalCode":"76134","city":"Fort Worth","state":"TX","phoneNumber":"817-332-6412","email":"kgodfrayf0@webmd.com"}, +{"id":542,"firstName":"Wallace","lastName":"Poytres","street":"78157 Dovetail Crossing","postalCode":"14683","city":"Rochester","state":"NY","email":"wpoytresf1@springer.com"}, +{"id":543,"firstName":"Dur","lastName":"Burgise","street":"2 Weeping Birch Court","postalCode":"89130","city":"Las Vegas","state":"NV"}, +{"id":544,"firstName":"Sheridan","lastName":"Gardiner","street":"26 Gateway Crossing","postalCode":"64193","city":"Kansas City","state":"MO","phoneNumber":"816-647-4434","email":"sgardinerf3@jugem.jp"}, +{"id":545,"firstName":"Nickolaus","lastName":"Thomassen","street":"130 Anderson Drive","postalCode":"33330","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-339-0290"}, +{"id":546,"firstName":"Boris","lastName":"Cortez","street":"55 Center Court","postalCode":"10184","city":"New York City","state":"NY","phoneNumber":"212-549-8414","email":"bcortezf5@mail.ru"}, +{"id":547,"firstName":"Candra","lastName":"Codner","street":"24078 Superior Point","postalCode":"93715","city":"Fresno","state":"CA","phoneNumber":"209-495-8135"}, +{"id":548,"firstName":"Ashton","lastName":"Hugin","street":"33 Fuller Place","postalCode":"63143","city":"Saint Louis","state":"MO"}, +{"id":549,"firstName":"Miguelita","lastName":"Lanceley","street":"34877 Arizona Street","postalCode":"80045","city":"Aurora","state":"CO","email":"mlanceleyf8@trellian.com"}, +{"id":550,"firstName":"Law","lastName":"Skim","street":"1795 Farmco Street","postalCode":"28230","city":"Charlotte","state":"NC","email":"lskimf9@bravesites.com"}, +{"id":551,"firstName":"Carlita","lastName":"Kindall","street":"7 Scofield Road","postalCode":"93709","city":"Fresno","state":"CA","email":"ckindallfa@zimbio.com"}, +{"id":552,"firstName":"Mehetabel","lastName":"Stawell","street":"648 Upham Plaza","postalCode":"75277","city":"Dallas","state":"TX","phoneNumber":"214-597-5958","email":"mstawellfb@ehow.com"}, +{"id":553,"firstName":"Charlena","lastName":"MacAlpyne","street":"2 Village Terrace","postalCode":"33758","city":"Clearwater","state":"FL","phoneNumber":"813-452-9764","email":"cmacalpynefc@xinhuanet.com"}, +{"id":554,"firstName":"Gayel","lastName":"Litel","street":"34782 Birchwood Road","postalCode":"46406","city":"Gary","state":"IN","phoneNumber":"219-156-8377","email":"glitelfd@alibaba.com"}, +{"id":555,"firstName":"Prisca","lastName":"Kanzler","street":"67 Miller Terrace","postalCode":"08619","city":"Trenton","state":"NJ","phoneNumber":"609-352-4487"}, +{"id":556,"firstName":"Marlowe","lastName":"Idenden","street":"396 Beilfuss Park","postalCode":"74103","city":"Tulsa","state":"OK","phoneNumber":"918-254-3102"}, +{"id":557,"firstName":"Ashley","lastName":"Skule","street":"2327 Valley Edge Terrace","postalCode":"93794","city":"Fresno","state":"CA","phoneNumber":"559-558-9123"}, +{"id":558,"firstName":"Trista","lastName":"Naptine","street":"646 Dahle Court","postalCode":"06538","city":"New Haven","state":"CT","phoneNumber":"203-257-3017","email":"tnaptinefh@hugedomains.com"}, +{"id":559,"firstName":"Hasheem","lastName":"Ottery","street":"004 Clemons Street","postalCode":"28815","city":"Asheville","state":"NC","phoneNumber":"828-768-3824","email":"hotteryfi@gmpg.org"}, +{"id":560,"firstName":"Alisa","lastName":"Bernhardt","street":"49 Cody Center","postalCode":"84120","city":"Salt Lake City","state":"UT","phoneNumber":"801-808-4005","email":"abernhardtfj@census.gov"}, +{"id":561,"firstName":"Isadora","lastName":"Hatchett","street":"78644 Hoepker Junction","postalCode":"77015","city":"Houston","state":"TX","email":"ihatchettfk@spiegel.de"}, +{"id":562,"firstName":"Valdemar","lastName":"Stithe","street":"75 East Street","postalCode":"48206","city":"Detroit","state":"MI","email":"vstithefl@marriott.com"}, +{"id":563,"firstName":"Elden","lastName":"Rebert","street":"2 Florence Place","postalCode":"65110","city":"Jefferson City","state":"MO","phoneNumber":"573-753-8030"}, +{"id":564,"firstName":"Stormie","lastName":"Trewartha","street":"59 Shoshone Lane","postalCode":"19136","city":"Philadelphia","state":"PA","phoneNumber":"215-466-6832"}, +{"id":565,"firstName":"Bernhard","lastName":"Boulsher","street":"50888 Dwight Drive","postalCode":"02114","city":"Boston","state":"MA","email":"bboulsherfo@zdnet.com"}, +{"id":566,"firstName":"Twyla","lastName":"Yerrill","street":"526 Clove Terrace","postalCode":"40745","city":"London","state":"KY","email":"tyerrillfp@smugmug.com"}, +{"id":567,"firstName":"Sullivan","lastName":"Dudeney","street":"953 Swallow Crossing","postalCode":"19160","city":"Philadelphia","state":"PA","email":"sdudeneyfq@kickstarter.com"}, +{"id":568,"firstName":"Estell","lastName":"Kiggel","street":"8170 Rusk Alley","postalCode":"20442","city":"Washington","state":"DC","phoneNumber":"202-645-5828","email":"ekiggelfr@imgur.com"}, +{"id":569,"firstName":"Jonis","lastName":"Pymer","street":"21296 International Pass","postalCode":"77844","city":"College Station","state":"TX","email":"jpymerfs@nymag.com"}, +{"id":570,"firstName":"Linea","lastName":"Cranmor","street":"2541 Thackeray Hill","postalCode":"31210","city":"Macon","state":"GA"}, +{"id":571,"firstName":"Starlin","lastName":"Reven","street":"7692 Mifflin Hill","postalCode":"66611","city":"Topeka","state":"KS","email":"srevenfu@nba.com"}, +{"id":572,"firstName":"Augusta","lastName":"Heustice","street":"947 Ramsey Lane","postalCode":"10292","city":"New York City","state":"NY","phoneNumber":"212-194-3346","email":"aheusticefv@cloudflare.com"}, +{"id":573,"firstName":"Glen","lastName":"O'Mailey","street":"90 6th Court","postalCode":"33982","city":"Punta Gorda","state":"FL","phoneNumber":"941-381-2231"}, +{"id":574,"firstName":"Astrix","lastName":"Bister","street":"505 Artisan Crossing","postalCode":"23324","city":"Chesapeake","state":"VA","phoneNumber":"757-469-4444","email":"abisterfx@uol.com.br"}, +{"id":575,"firstName":"Shaw","lastName":"Lidbetter","street":"70 New Castle Trail","postalCode":"10474","city":"Bronx","state":"NY","phoneNumber":"917-917-9173"}, +{"id":576,"firstName":"Yovonnda","lastName":"Wych","street":"97472 Derek Drive","postalCode":"90410","city":"Santa Monica","state":"CA","email":"ywychfz@symantec.com"}, +{"id":577,"firstName":"Harcourt","lastName":"Faier","street":"056 Northridge Street","postalCode":"16510","city":"Erie","state":"PA","email":"hfaierg0@cloudflare.com"}, +{"id":578,"firstName":"Archibold","lastName":"Kos","street":"6 Forster Park","postalCode":"63104","city":"Saint Louis","state":"MO","phoneNumber":"314-967-5566","email":"akosg1@soup.io"}, +{"id":579,"firstName":"Nataniel","lastName":"Beldom","street":"1 Sullivan Street","postalCode":"02453","city":"Waltham","state":"MA","email":"nbeldomg2@alibaba.com"}, +{"id":580,"firstName":"Felisha","lastName":"Bamfield","street":"970 Washington Avenue","postalCode":"12305","city":"Schenectady","state":"NY","email":"fbamfieldg3@jimdo.com"}, +{"id":581,"firstName":"Colly","lastName":"Rugge","street":"8 Golf Course Avenue","postalCode":"55172","city":"Saint Paul","state":"MN","phoneNumber":"651-450-9347","email":"cruggeg4@tmall.com"}, +{"id":582,"firstName":"Patti","lastName":"Maddrell","street":"0483 Coolidge Drive","postalCode":"74193","city":"Tulsa","state":"OK"}, +{"id":583,"firstName":"Antin","lastName":"Gabbetis","street":"93510 Clemons Drive","postalCode":"68583","city":"Lincoln","state":"NE","email":"agabbetisg6@java.com"}, +{"id":584,"firstName":"Bree","lastName":"Million","street":"3 Columbus Avenue","postalCode":"61614","city":"Peoria","state":"IL","phoneNumber":"309-360-1909","email":"bmilliong7@gnu.org"}, +{"id":585,"firstName":"Taber","lastName":"Lorait","street":"4 Melrose Way","postalCode":"62764","city":"Springfield","state":"IL","phoneNumber":"217-436-2021","email":"tloraitg8@cargocollective.com"}, +{"id":586,"firstName":"Roley","lastName":"Di Carlo","street":"981 Bowman Center","postalCode":"87505","city":"Santa Fe","state":"NM"}, +{"id":587,"firstName":"Seline","lastName":"Oxenham","street":"65051 Forest Run Center","postalCode":"94064","city":"Redwood City","state":"CA","email":"soxenhamga@fastcompany.com"}, +{"id":588,"firstName":"Costa","lastName":"Tomblin","street":"7 Arapahoe Alley","postalCode":"33315","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-239-1335"}, +{"id":589,"firstName":"Opalina","lastName":"Cake","street":"88 Commercial Avenue","postalCode":"40215","city":"Louisville","state":"KY","email":"ocakegc@examiner.com"}, +{"id":590,"firstName":"Suzanne","lastName":"Giuroni","street":"73 Twin Pines Terrace","postalCode":"99260","city":"Spokane","state":"WA"}, +{"id":591,"firstName":"Faustine","lastName":"Croysdale","street":"01 Delladonna Point","postalCode":"48295","city":"Detroit","state":"MI"}, +{"id":592,"firstName":"Sheffie","lastName":"Aldine","street":"4 Hansons Junction","postalCode":"74108","city":"Tulsa","state":"OK"}, +{"id":593,"firstName":"Bret","lastName":"Birrane","street":"745 Mayer Junction","postalCode":"77030","city":"Houston","state":"TX","phoneNumber":"832-374-7571","email":"bbirranegg@opera.com"}, +{"id":594,"firstName":"Lennard","lastName":"Mowbury","street":"5 Dwight Road","postalCode":"94522","city":"Concord","state":"CA","email":"lmowburygh@1und1.de"}, +{"id":595,"firstName":"Albie","lastName":"Pert","street":"23705 Fieldstone Plaza","postalCode":"08922","city":"New Brunswick","state":"NJ","phoneNumber":"732-587-7312","email":"apertgi@netlog.com"}, +{"id":596,"firstName":"Stevie","lastName":"Pressnell","street":"0077 Ronald Regan Point","postalCode":"85020","city":"Phoenix","state":"AZ","phoneNumber":"623-991-0482","email":"spressnellgj@skype.com"}, +{"id":597,"firstName":"Eddy","lastName":"McIlreavy","street":"04 Luster Lane","postalCode":"94126","city":"San Francisco","state":"CA"}, +{"id":598,"firstName":"Webb","lastName":"Titterell","street":"94323 Kedzie Alley","postalCode":"91505","city":"Burbank","state":"CA","phoneNumber":"818-220-9105","email":"wtitterellgl@bandcamp.com"}, +{"id":599,"firstName":"Jeffrey","lastName":"Benito","street":"7487 Scott Lane","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"917-379-2592","email":"jbenitogm@deviantart.com"}, +{"id":600,"firstName":"Nollie","lastName":"Arsey","street":"7282 Summerview Plaza","postalCode":"55811","city":"Duluth","state":"MN","email":"narseygn@imageshack.us"}, +{"id":601,"firstName":"Petra","lastName":"Turpey","street":"43920 Evergreen Junction","postalCode":"77255","city":"Houston","state":"TX","phoneNumber":"713-446-0144"}, +{"id":602,"firstName":"Harwilll","lastName":"Lashbrook","street":"8063 Grasskamp Parkway","postalCode":"27621","city":"Raleigh","state":"NC","phoneNumber":"919-142-9887","email":"hlashbrookgp@seattletimes.com"}, +{"id":603,"firstName":"Tedman","lastName":"Steinor","street":"80230 Hanson Hill","postalCode":"47134","city":"Jeffersonville","state":"IN","email":"tsteinorgq@dmoz.org"}, +{"id":604,"firstName":"Georgette","lastName":"Tupper","street":"37 Lillian Avenue","postalCode":"33543","city":"Zephyrhills","state":"FL","phoneNumber":"813-743-2425","email":"gtuppergr@qq.com"}, +{"id":605,"firstName":"Torrance","lastName":"Welsh","street":"95802 Doe Crossing Crossing","postalCode":"13217","city":"Syracuse","state":"NY","phoneNumber":"315-145-4503","email":"twelshgs@imgur.com"}, +{"id":606,"firstName":"Silvie","lastName":"Souster","street":"52827 Fuller Place","postalCode":"99709","city":"Fairbanks","state":"AK"}, +{"id":607,"firstName":"Pauline","lastName":"Dulwitch","street":"8 Aberg Drive","postalCode":"17105","city":"Harrisburg","state":"PA","phoneNumber":"717-228-4960","email":"pdulwitchgu@aboutads.info"}, +{"id":608,"firstName":"Roberta","lastName":"Castanie","street":"182 Mosinee Avenue","postalCode":"75185","city":"Mesquite","state":"TX"}, +{"id":609,"firstName":"Percival","lastName":"Kristoffersen","street":"4 Del Mar Park","postalCode":"48335","city":"Farmington","state":"MI","phoneNumber":"248-438-1650","email":"pkristoffersengw@chron.com"}, +{"id":610,"firstName":"Caryl","lastName":"Boame","street":"094 Springview Avenue","postalCode":"78255","city":"San Antonio","state":"TX","email":"cboamegx@example.com"}, +{"id":611,"firstName":"Steve","lastName":"Simakov","street":"323 Brickson Park Trail","postalCode":"32244","city":"Jacksonville","state":"FL","phoneNumber":"904-468-9377","email":"ssimakovgy@angelfire.com"}, +{"id":612,"firstName":"Carl","lastName":"Tumayan","street":"93854 Clyde Gallagher Circle","postalCode":"98447","city":"Tacoma","state":"WA","email":"ctumayangz@1und1.de"}, +{"id":613,"firstName":"Gayle","lastName":"Blaker","street":"5930 Grasskamp Drive","postalCode":"12262","city":"Albany","state":"NY","email":"gblakerh0@spiegel.de"}, +{"id":614,"firstName":"Darrick","lastName":"Harefoot","street":"359 Waywood Trail","postalCode":"20189","city":"Dulles","state":"VA"}, +{"id":615,"firstName":"Sayer","lastName":"Eversfield","street":"86 Park Meadow Crossing","postalCode":"53263","city":"Milwaukee","state":"WI","email":"seversfieldh2@multiply.com"}, +{"id":616,"firstName":"Loralyn","lastName":"Poyner","street":"28530 Magdeline Crossing","postalCode":"84125","city":"Salt Lake City","state":"UT","phoneNumber":"801-363-2593"}, +{"id":617,"firstName":"Petrina","lastName":"Ridewood","street":"91782 Oriole Parkway","postalCode":"80235","city":"Denver","state":"CO","phoneNumber":"720-131-3660","email":"pridewoodh4@walmart.com"}, +{"id":618,"firstName":"Leroi","lastName":"Marde","street":"7992 Prairieview Junction","postalCode":"02142","city":"Cambridge","state":"MA","phoneNumber":"781-623-9420","email":"lmardeh5@oracle.com"}, +{"id":619,"firstName":"Brannon","lastName":"Janata","street":"79706 Wayridge Alley","postalCode":"24515","city":"Lynchburg","state":"VA","phoneNumber":"434-255-0721"}, +{"id":620,"firstName":"Berry","lastName":"Joska","street":"301 6th Alley","postalCode":"10150","city":"New York City","state":"NY","email":"bjoskah7@360.cn"}, +{"id":621,"firstName":"Blinnie","lastName":"Basten","street":"047 Canary Parkway","postalCode":"30343","city":"Atlanta","state":"GA","phoneNumber":"404-794-2760"}, +{"id":622,"firstName":"Inesita","lastName":"Abbitt","street":"8 Sachtjen Plaza","postalCode":"60681","city":"Chicago","state":"IL"}, +{"id":623,"firstName":"Nickie","lastName":"Ellicombe","street":"1067 Ridge Oak Terrace","postalCode":"38131","city":"Memphis","state":"TN","phoneNumber":"901-695-3826","email":"nellicombeha@imgur.com"}, +{"id":624,"firstName":"Barney","lastName":"Sheeres","street":"1 Rutledge Avenue","postalCode":"29208","city":"Columbia","state":"SC","phoneNumber":"803-166-1398"}, +{"id":625,"firstName":"Ogdan","lastName":"Lelievre","street":"27 Weeping Birch Plaza","postalCode":"27264","city":"High Point","state":"NC","phoneNumber":"336-416-3966","email":"olelievrehc@exblog.jp"}, +{"id":626,"firstName":"Zora","lastName":"Exter","street":"7 Ronald Regan Pass","postalCode":"33673","city":"Tampa","state":"FL"}, +{"id":627,"firstName":"Travus","lastName":"Jaulme","street":"3159 Montana Circle","postalCode":"79176","city":"Amarillo","state":"TX","phoneNumber":"806-894-9411"}, +{"id":628,"firstName":"Krishna","lastName":"Beckingham","street":"58 Fair Oaks Lane","postalCode":"30311","city":"Atlanta","state":"GA","email":"kbeckinghamhf@usnews.com"}, +{"id":629,"firstName":"Bartolomeo","lastName":"Bosanko","street":"753 Victoria Place","postalCode":"79699","city":"Abilene","state":"TX","phoneNumber":"325-223-9615","email":"bbosankohg@merriam-webster.com"}, +{"id":630,"firstName":"Umberto","lastName":"McGinly","street":"30 Upham Parkway","postalCode":"80945","city":"Colorado Springs","state":"CO","email":"umcginlyhh@cdc.gov"}, +{"id":631,"firstName":"Launce","lastName":"Fatkin","street":"03246 Esch Place","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-916-7032","email":"lfatkinhi@blogs.com"}, +{"id":632,"firstName":"Simone","lastName":"Soars","street":"9969 Forest Run Crossing","postalCode":"90101","city":"Los Angeles","state":"CA","phoneNumber":"213-282-8462"}, +{"id":633,"firstName":"Clerissa","lastName":"Leason","street":"59731 Mayfield Street","postalCode":"89510","city":"Reno","state":"NV"}, +{"id":634,"firstName":"Rutter","lastName":"Sultan","street":"697 Spenser Way","postalCode":"77245","city":"Houston","state":"TX"}, +{"id":635,"firstName":"Shannon","lastName":"De Carteret","street":"2 Grover Avenue","postalCode":"92717","city":"Irvine","state":"CA","phoneNumber":"714-410-2360","email":"sdecarterethm@simplemachines.org"}, +{"id":636,"firstName":"Sawyere","lastName":"Cardno","street":"428 Golf Course Drive","postalCode":"33111","city":"Miami","state":"FL"}, +{"id":637,"firstName":"Paulie","lastName":"Bucktharp","street":"5398 Sugar Park","postalCode":"10039","city":"New York City","state":"NY","phoneNumber":"646-197-4123","email":"pbucktharpho@businessweek.com"}, +{"id":638,"firstName":"Kippy","lastName":"Guisler","street":"2161 Claremont Trail","postalCode":"20546","city":"Washington","state":"DC","phoneNumber":"202-138-6171","email":"kguislerhp@ox.ac.uk"}, +{"id":639,"firstName":"Yoshiko","lastName":"Tolson","street":"2 Glendale Court","postalCode":"27415","city":"Greensboro","state":"NC","email":"ytolsonhq@example.com"}, +{"id":640,"firstName":"Page","lastName":"Chillingsworth","street":"8 Loomis Drive","postalCode":"55470","city":"Minneapolis","state":"MN","email":"pchillingsworthhr@wunderground.com"}, +{"id":641,"firstName":"Jillana","lastName":"O'Siaghail","street":"13517 Del Mar Road","postalCode":"29215","city":"Columbia","state":"SC","phoneNumber":"803-420-8597","email":"josiaghailhs@reuters.com"}, +{"id":642,"firstName":"Phedra","lastName":"Bagnold","street":"7059 Hallows Street","postalCode":"55470","city":"Minneapolis","state":"MN","email":"pbagnoldht@howstuffworks.com"}, +{"id":643,"firstName":"Bellina","lastName":"Gouldie","street":"7567 Bultman Way","postalCode":"88514","city":"El Paso","state":"TX","email":"bgouldiehu@salon.com"}, +{"id":644,"firstName":"Devi","lastName":"Bohden","street":"68833 Northview Hill","postalCode":"84115","city":"Salt Lake City","state":"UT"}, +{"id":645,"firstName":"Peggi","lastName":"Gobert","street":"667 Sauthoff Hill","postalCode":"44710","city":"Canton","state":"OH","email":"pgoberthw@mapy.cz"}, +{"id":646,"firstName":"Madelina","lastName":"Gurys","street":"70 Del Sol Trail","postalCode":"20420","city":"Washington","state":"DC","phoneNumber":"202-747-9276","email":"mguryshx@hibu.com"}, +{"id":647,"firstName":"Ikey","lastName":"Aubri","street":"76 Sutteridge Hill","postalCode":"36205","city":"Anniston","state":"AL","phoneNumber":"256-945-5095","email":"iaubrihy@mayoclinic.com"}, +{"id":648,"firstName":"Ginevra","lastName":"Duffitt","street":"25 Eagan Circle","postalCode":"31217","city":"Macon","state":"GA"}, +{"id":649,"firstName":"Cissiee","lastName":"Gozzard","street":"40240 Lillian Park","postalCode":"60609","city":"Chicago","state":"IL","email":"cgozzardi0@columbia.edu"}, +{"id":650,"firstName":"Sonny","lastName":"Jobern","street":"8 Green Trail","postalCode":"77065","city":"Houston","state":"TX","email":"sjoberni1@ucoz.com"}, +{"id":651,"firstName":"Mitch","lastName":"Guidera","street":"0 Dorton Junction","postalCode":"35210","city":"Birmingham","state":"AL","phoneNumber":"205-224-0177"}, +{"id":652,"firstName":"Dorey","lastName":"Marks","street":"81562 Maywood Crossing","postalCode":"71208","city":"Monroe","state":"LA","phoneNumber":"318-492-5487"}, +{"id":653,"firstName":"Pavla","lastName":"Conneely","street":"4007 Mifflin Lane","postalCode":"20456","city":"Washington","state":"DC"}, +{"id":654,"firstName":"Kym","lastName":"Gecks","street":"72638 Namekagon Plaza","postalCode":"61656","city":"Peoria","state":"IL","email":"kgecksi5@nature.com"}, +{"id":655,"firstName":"Prudence","lastName":"Peert","street":"91 Tomscot Parkway","postalCode":"32209","city":"Jacksonville","state":"FL","phoneNumber":"904-277-2945","email":"ppeerti6@usa.gov"}, +{"id":656,"firstName":"Elston","lastName":"Paolo","street":"4 Jenna Crossing","postalCode":"95155","city":"San Jose","state":"CA","email":"epaoloi7@umn.edu"}, +{"id":657,"firstName":"Indira","lastName":"Splaven","street":"8853 Vermont Drive","postalCode":"38188","city":"Memphis","state":"TN","phoneNumber":"901-706-3908","email":"isplaveni8@fda.gov"}, +{"id":658,"firstName":"Paul","lastName":"Mc Meekin","street":"56 Vidon Drive","postalCode":"08695","city":"Trenton","state":"NJ","phoneNumber":"609-361-1580"}, +{"id":659,"firstName":"Hadley","lastName":"Windmill","street":"31384 Evergreen Point","postalCode":"16550","city":"Erie","state":"PA","email":"hwindmillia@yale.edu"}, +{"id":660,"firstName":"Jay","lastName":"Yesichev","street":"675 Starling Pass","postalCode":"89150","city":"Las Vegas","state":"NV"}, +{"id":661,"firstName":"Ranna","lastName":"Dowtry","street":"303 Nevada Pass","postalCode":"48550","city":"Flint","state":"MI","phoneNumber":"810-164-4521","email":"rdowtryic@amazon.co.jp"}, +{"id":662,"firstName":"Annabel","lastName":"Pellamont","street":"277 Merrick Crossing","postalCode":"36605","city":"Mobile","state":"AL","phoneNumber":"251-595-3594","email":"apellamontid@reverbnation.com"}, +{"id":663,"firstName":"Kaitlynn","lastName":"Tracey","street":"612 Magdeline Road","postalCode":"97296","city":"Portland","state":"OR","email":"ktraceyie@ycombinator.com"}, +{"id":664,"firstName":"Matthiew","lastName":"Jills","street":"65 Walton Circle","postalCode":"93750","city":"Fresno","state":"CA","email":"mjillsif@addthis.com"}, +{"id":665,"firstName":"Bartlet","lastName":"Roe","street":"51573 Mandrake Park","postalCode":"02109","city":"Boston","state":"MA","phoneNumber":"617-460-5377","email":"broeig@nasa.gov"}, +{"id":666,"firstName":"Ban","lastName":"Knotton","street":"174 Westridge Parkway","postalCode":"32405","city":"Panama City","state":"FL","phoneNumber":"850-939-6502","email":"bknottonih@businesswire.com"}, +{"id":667,"firstName":"Cordelie","lastName":"O'Dee","street":"1733 Linden Avenue","postalCode":"80940","city":"Colorado Springs","state":"CO","phoneNumber":"719-966-3402","email":"codeeii@amazonaws.com"}, +{"id":668,"firstName":"Hardy","lastName":"Lob","street":"4 Bultman Road","postalCode":"75074","city":"Plano","state":"TX","email":"hlobij@dropbox.com"}, +{"id":669,"firstName":"Rosabelle","lastName":"Tonner","street":"1 Holy Cross Trail","postalCode":"36670","city":"Mobile","state":"AL","phoneNumber":"251-606-9437","email":"rtonnerik@google.ru"}, +{"id":670,"firstName":"Bernardina","lastName":"Mardy","street":"65 Myrtle Center","postalCode":"96845","city":"Honolulu","state":"HI","email":"bmardyil@wordpress.com"}, +{"id":671,"firstName":"Hynda","lastName":"Soldner","street":"88 Hazelcrest Drive","postalCode":"55470","city":"Minneapolis","state":"MN","email":"hsoldnerim@webeden.co.uk"}, +{"id":672,"firstName":"Quinn","lastName":"Templeton","street":"5 Village Way","postalCode":"19131","city":"Philadelphia","state":"PA","email":"qtempletonin@diigo.com"}, +{"id":673,"firstName":"Torrence","lastName":"Askwith","street":"1 Namekagon Point","postalCode":"31410","city":"Savannah","state":"GA","phoneNumber":"912-552-5239","email":"taskwithio@people.com.cn"}, +{"id":674,"firstName":"Bonnie","lastName":"Robilliard","street":"731 Johnson Lane","postalCode":"24515","city":"Lynchburg","state":"VA","phoneNumber":"434-382-5496"}, +{"id":675,"firstName":"Daphna","lastName":"D'Souza","street":"1549 Loftsgordon Center","postalCode":"91406","city":"Van Nuys","state":"CA","phoneNumber":"818-773-9088"}, +{"id":676,"firstName":"Palm","lastName":"Gandrich","street":"9 4th Pass","postalCode":"87121","city":"Albuquerque","state":"NM","phoneNumber":"505-815-5555"}, +{"id":677,"firstName":"Danie","lastName":"Gaydon","street":"382 Bayside Junction","postalCode":"55441","city":"Minneapolis","state":"MN","phoneNumber":"952-744-9400","email":"dgaydonis@seesaa.net"}, +{"id":678,"firstName":"Tabatha","lastName":"Caddock","street":"3858 Mccormick Road","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-996-7653","email":"tcaddockit@gizmodo.com"}, +{"id":679,"firstName":"Sergent","lastName":"Cade","street":"7 Riverside Crossing","postalCode":"13505","city":"Utica","state":"NY","email":"scadeiu@google.co.uk"}, +{"id":680,"firstName":"Shina","lastName":"Dumphry","street":"483 Del Mar Terrace","postalCode":"73109","city":"Oklahoma City","state":"OK","phoneNumber":"405-261-3364","email":"sdumphryiv@mediafire.com"}, +{"id":681,"firstName":"Aaron","lastName":"O'Neal","street":"669 Crowley Road","postalCode":"87140","city":"Albuquerque","state":"NM","phoneNumber":"505-451-6591","email":"aonealiw@npr.org"}, +{"id":682,"firstName":"Cynthea","lastName":"Wippermann","street":"109 Kinsman Parkway","postalCode":"06606","city":"Bridgeport","state":"CT","phoneNumber":"203-799-4552"}, +{"id":683,"firstName":"Stoddard","lastName":"Hullett","street":"06200 Mesta Park","postalCode":"78769","city":"Austin","state":"TX","phoneNumber":"512-190-7003"}, +{"id":684,"firstName":"Margit","lastName":"Comusso","street":"54 Springs Center","postalCode":"33737","city":"Saint Petersburg","state":"FL","phoneNumber":"727-144-3743","email":"mcomussoiz@drupal.org"}, +{"id":685,"firstName":"Dur","lastName":"Manns","street":"464 Park Meadow Road","postalCode":"90015","city":"Los Angeles","state":"CA","email":"dmannsj0@nymag.com"}, +{"id":686,"firstName":"Hollie","lastName":"Aldersey","street":"12195 Mallory Court","postalCode":"21405","city":"Annapolis","state":"MD","email":"halderseyj1@businessinsider.com"}, +{"id":687,"firstName":"Ralina","lastName":"Crepin","street":"13313 Clyde Gallagher Way","postalCode":"78285","city":"San Antonio","state":"TX"}, +{"id":688,"firstName":"Lyell","lastName":"Graveston","street":"20 Talisman Crossing","postalCode":"27157","city":"Winston Salem","state":"NC","phoneNumber":"336-638-3366","email":"lgravestonj3@webmd.com"}, +{"id":689,"firstName":"Anny","lastName":"Potell","street":"0 Ludington Circle","postalCode":"32803","city":"Orlando","state":"FL","email":"apotellj4@microsoft.com"}, +{"id":690,"firstName":"Harriot","lastName":"Klimpke","street":"8 Southridge Alley","postalCode":"22047","city":"Falls Church","state":"VA","phoneNumber":"571-470-2688","email":"hklimpkej5@slashdot.org"}, +{"id":691,"firstName":"Stacia","lastName":"Stainsby","street":"78 Mcbride Avenue","postalCode":"46862","city":"Fort Wayne","state":"IN"}, +{"id":692,"firstName":"Zacharia","lastName":"Willmont","street":"24 Everett Center","postalCode":"73135","city":"Oklahoma City","state":"OK","phoneNumber":"405-167-0584","email":"zwillmontj7@tuttocitta.it"}, +{"id":693,"firstName":"Dorelia","lastName":"Flexman","street":"0 Hauk Crossing","postalCode":"95298","city":"Stockton","state":"CA","phoneNumber":"209-759-3308"}, +{"id":694,"firstName":"Rubi","lastName":"Karran","street":"586 Eggendart Pass","postalCode":"64082","city":"Lees Summit","state":"MO","email":"rkarranj9@yahoo.com"}, +{"id":695,"firstName":"Edlin","lastName":"Davidsen","street":"5646 Arrowood Park","postalCode":"20591","city":"Washington","state":"DC","phoneNumber":"202-800-5817","email":"edavidsenja@purevolume.com"}, +{"id":696,"firstName":"Oralle","lastName":"Coneybeare","street":"0 Lakewood Parkway","postalCode":"08695","city":"Trenton","state":"NJ","email":"oconeybearejb@booking.com"}, +{"id":697,"firstName":"Scotti","lastName":"Cereceres","street":"2 Golf Hill","postalCode":"38119","city":"Memphis","state":"TN"}, +{"id":698,"firstName":"Hermione","lastName":"Mingotti","street":"14 Shoshone Alley","postalCode":"44511","city":"Youngstown","state":"OH","phoneNumber":"330-505-0585"}, +{"id":699,"firstName":"Janka","lastName":"Merredy","street":"877 Reinke Park","postalCode":"45233","city":"Cincinnati","state":"OH","email":"jmerredyje@furl.net"}, +{"id":700,"firstName":"Phillida","lastName":"Gannicleff","street":"48778 Sheridan Center","postalCode":"99210","city":"Spokane","state":"WA","email":"pgannicleffjf@github.io"}, +{"id":701,"firstName":"Bryn","lastName":"Shury","street":"82609 Surrey Road","postalCode":"78240","city":"San Antonio","state":"TX","phoneNumber":"210-361-9404","email":"bshuryjg@arstechnica.com"}, +{"id":702,"firstName":"Bobbe","lastName":"Yurocjhin","street":"54904 Southridge Parkway","postalCode":"33633","city":"Tampa","state":"FL","email":"byurocjhinjh@tumblr.com"}, +{"id":703,"firstName":"Noell","lastName":"Trewman","street":"63703 Fair Oaks Point","postalCode":"91520","city":"Burbank","state":"CA"}, +{"id":704,"firstName":"Adelind","lastName":"Marr","street":"68 Lotheville Park","postalCode":"02912","city":"Providence","state":"RI","email":"amarrjj@hexun.com"}, +{"id":705,"firstName":"Arabelle","lastName":"Oultram","street":"7927 Waxwing Place","postalCode":"77085","city":"Houston","state":"TX","email":"aoultramjk@diigo.com"}, +{"id":706,"firstName":"Derril","lastName":"Whylie","street":"1 Summerview Terrace","postalCode":"91606","city":"North Hollywood","state":"CA","phoneNumber":"323-244-3266","email":"dwhyliejl@auda.org.au"}, +{"id":707,"firstName":"Isadore","lastName":"Airth","street":"08897 Hauk Court","postalCode":"73104","city":"Oklahoma City","state":"OK","phoneNumber":"405-488-1807"}, +{"id":708,"firstName":"Barbara","lastName":"Feast","street":"420 Bayside Circle","postalCode":"63136","city":"Saint Louis","state":"MO","phoneNumber":"314-919-9094"}, +{"id":709,"firstName":"Engracia","lastName":"Laxtonne","street":"189 Oneill Center","postalCode":"22047","city":"Falls Church","state":"VA","email":"elaxtonnejo@addthis.com"}, +{"id":710,"firstName":"Dorice","lastName":"Dearle","street":"655 Union Way","postalCode":"47705","city":"Evansville","state":"IN","phoneNumber":"812-812-8795","email":"ddearlejp@mail.ru"}, +{"id":711,"firstName":"Crissie","lastName":"Leall","street":"1 1st Drive","postalCode":"36689","city":"Mobile","state":"AL","phoneNumber":"251-112-1542","email":"clealljq@nyu.edu"}, +{"id":712,"firstName":"Rica","lastName":"Wilshin","street":"0 Miller Way","postalCode":"79705","city":"Midland","state":"TX","phoneNumber":"432-935-1867"}, +{"id":713,"firstName":"Annie","lastName":"Thorns","street":"297 Thompson Park","postalCode":"32412","city":"Panama City","state":"FL","phoneNumber":"850-594-4049"}, +{"id":714,"firstName":"Lilah","lastName":"Beining","street":"1566 American Ash Avenue","postalCode":"25326","city":"Charleston","state":"WV","email":"lbeiningjt@mayoclinic.com"}, +{"id":715,"firstName":"Leeann","lastName":"Dorant","street":"5530 Mcguire Alley","postalCode":"93407","city":"San Luis Obispo","state":"CA","email":"ldorantju@homestead.com"}, +{"id":716,"firstName":"Elinor","lastName":"James","street":"2 Waxwing Terrace","postalCode":"88579","city":"El Paso","state":"TX","email":"ejamesjv@europa.eu"}, +{"id":717,"firstName":"Novelia","lastName":"Durman","street":"7 Hermina Junction","postalCode":"77050","city":"Houston","state":"TX","email":"ndurmanjw@fc2.com"}, +{"id":718,"firstName":"Sharai","lastName":"Pickervance","street":"739 Lien Junction","postalCode":"73167","city":"Oklahoma City","state":"OK","email":"spickervancejx@independent.co.uk"}, +{"id":719,"firstName":"Gilberte","lastName":"Stilling","street":"29950 Annamark Trail","postalCode":"89178","city":"Las Vegas","state":"NV","phoneNumber":"702-604-4240","email":"gstillingjy@feedburner.com"}, +{"id":720,"firstName":"Rosabelle","lastName":"Guinan","street":"13078 Sutherland Center","postalCode":"83757","city":"Boise","state":"ID","phoneNumber":"208-792-6705"}, +{"id":721,"firstName":"Karin","lastName":"Ackermann","street":"3 Susan Hill","postalCode":"48919","city":"Lansing","state":"MI","phoneNumber":"517-579-7811","email":"kackermannk0@csmonitor.com"}, +{"id":722,"firstName":"Reeta","lastName":"Attwell","street":"96 Alpine Junction","postalCode":"66622","city":"Topeka","state":"KS"}, +{"id":723,"firstName":"Dru","lastName":"Linck","street":"37 Wayridge Place","postalCode":"49505","city":"Grand Rapids","state":"MI","phoneNumber":"616-197-1837"}, +{"id":724,"firstName":"Frances","lastName":"Collingridge","street":"273 Ludington Crossing","postalCode":"77255","city":"Houston","state":"TX"}, +{"id":725,"firstName":"Wilmette","lastName":"Haimes","street":"8408 Shopko Circle","postalCode":"98907","city":"Yakima","state":"WA","phoneNumber":"509-821-5948"}, +{"id":726,"firstName":"Isahella","lastName":"Rubrow","street":"25 Melby Crossing","postalCode":"59105","city":"Billings","state":"MT","email":"irubrowk5@edublogs.org"}, +{"id":727,"firstName":"Walden","lastName":"Sappson","street":"1 3rd Hill","postalCode":"60435","city":"Joliet","state":"IL","email":"wsappsonk6@ameblo.jp"}, +{"id":728,"firstName":"Blondie","lastName":"Godehard.sf","street":"4606 Caliangt Circle","postalCode":"20709","city":"Laurel","state":"MD"}, +{"id":729,"firstName":"Dion","lastName":"Wingeatt","street":"098 Ridgeview Alley","postalCode":"78769","city":"Austin","state":"TX","phoneNumber":"512-948-4113","email":"dwingeattk8@clickbank.net"}, +{"id":730,"firstName":"Antoni","lastName":"Tibbles","street":"9 Muir Court","postalCode":"25313","city":"Charleston","state":"WV","phoneNumber":"304-298-6149","email":"atibblesk9@usa.gov"}, +{"id":731,"firstName":"Quinn","lastName":"McKevin","street":"063 Washington Parkway","postalCode":"55470","city":"Minneapolis","state":"MN","phoneNumber":"612-140-1997"}, +{"id":732,"firstName":"Rita","lastName":"Hallam","street":"4 Chive Court","postalCode":"85025","city":"Phoenix","state":"AZ","email":"rhallamkb@list-manage.com"}, +{"id":733,"firstName":"Cliff","lastName":"McCrum","street":"30841 Scoville Street","postalCode":"38150","city":"Memphis","state":"TN","phoneNumber":"901-983-7713","email":"cmccrumkc@yellowpages.com"}, +{"id":734,"firstName":"Allyson","lastName":"Petkov","street":"057 Grover Trail","postalCode":"55487","city":"Minneapolis","state":"MN","phoneNumber":"612-706-7185"}, +{"id":735,"firstName":"Tanney","lastName":"Cicccitti","street":"84959 Calypso Way","postalCode":"66629","city":"Topeka","state":"KS","phoneNumber":"785-516-0753","email":"tcicccittike@netscape.com"}, +{"id":736,"firstName":"Brendin","lastName":"Behnke","street":"3057 Browning Parkway","postalCode":"38181","city":"Memphis","state":"TN","email":"bbehnkekf@answers.com"}, +{"id":737,"firstName":"Sydelle","lastName":"Lestor","street":"6 Old Shore Way","postalCode":"73167","city":"Oklahoma City","state":"OK"}, +{"id":738,"firstName":"Nilson","lastName":"Nelthorp","street":"5 Gerald Trail","postalCode":"60567","city":"Naperville","state":"IL","phoneNumber":"630-718-5304","email":"nnelthorpkh@scribd.com"}, +{"id":739,"firstName":"Randy","lastName":"Boller","street":"64 Roth Junction","postalCode":"95354","city":"Modesto","state":"CA","phoneNumber":"209-795-8532","email":"rbollerki@nature.com"}, +{"id":740,"firstName":"Vicki","lastName":"De Vaan","street":"08 Mariners Cove Terrace","postalCode":"62776","city":"Springfield","state":"IL","email":"vdevaankj@disqus.com"}, +{"id":741,"firstName":"Romain","lastName":"Castri","street":"7 Atwood Road","postalCode":"02905","city":"Providence","state":"RI","phoneNumber":"401-865-9950","email":"rcastrikk@google.com.br"}, +{"id":742,"firstName":"Adlai","lastName":"Keppel","street":"6 Farragut Circle","postalCode":"76705","city":"Waco","state":"TX","phoneNumber":"254-852-6322"}, +{"id":743,"firstName":"Arlyne","lastName":"Whalley","street":"6 Esker Terrace","postalCode":"83727","city":"Boise","state":"ID","email":"awhalleykm@amazon.co.uk"}, +{"id":744,"firstName":"Alistair","lastName":"Jennins","street":"6 Loeprich Center","postalCode":"21684","city":"Ridgely","state":"MD","phoneNumber":"410-494-2201","email":"ajenninskn@sciencedaily.com"}, +{"id":745,"firstName":"Farr","lastName":"Steer","street":"8569 Eliot Lane","postalCode":"93381","city":"Bakersfield","state":"CA","phoneNumber":"661-416-1609","email":"fsteerko@usgs.gov"}, +{"id":746,"firstName":"Analise","lastName":"Balasini","street":"8901 Lyons Parkway","postalCode":"23242","city":"Richmond","state":"VA","email":"abalasinikp@imgur.com"}, +{"id":747,"firstName":"Gilbert","lastName":"Lockton","street":"3 Leroy Court","postalCode":"49018","city":"Battle Creek","state":"MI","email":"glocktonkq@google.nl"}, +{"id":748,"firstName":"Hamlen","lastName":"Massie","street":"469 Mallory Drive","postalCode":"77250","city":"Houston","state":"TX","email":"hmassiekr@admin.ch"}, +{"id":749,"firstName":"Ebony","lastName":"Loker","street":"21173 Raven Point","postalCode":"21265","city":"Baltimore","state":"MD"}, +{"id":750,"firstName":"Kristina","lastName":"Deeble","street":"479 Warner Park","postalCode":"92013","city":"Carlsbad","state":"CA","phoneNumber":"760-377-7198","email":"kdeeblekt@ezinearticles.com"}, +{"id":751,"firstName":"Jabez","lastName":"Mummery","street":"1 East Point","postalCode":"52809","city":"Davenport","state":"IA","email":"jmummeryku@sfgate.com"}, +{"id":752,"firstName":"Perrine","lastName":"Aldwinckle","street":"98 Montana Avenue","postalCode":"85030","city":"Phoenix","state":"AZ","phoneNumber":"602-224-2810","email":"paldwincklekv@eepurl.com"}, +{"id":753,"firstName":"Humfried","lastName":"Pendleton","street":"843 Swallow Park","postalCode":"89115","city":"Las Vegas","state":"NV","phoneNumber":"702-524-6047"}, +{"id":754,"firstName":"Dario","lastName":"Chesshire","street":"638 Westport Place","postalCode":"96845","city":"Honolulu","state":"HI","phoneNumber":"808-718-1386"}, +{"id":755,"firstName":"Cherianne","lastName":"Hearfield","street":"15 Quincy Street","postalCode":"14233","city":"Buffalo","state":"NY","email":"chearfieldky@technorati.com"}, +{"id":756,"firstName":"Jemima","lastName":"Oxnam","street":"22276 Maple Street","postalCode":"92165","city":"San Diego","state":"CA","email":"joxnamkz@addtoany.com"}, +{"id":757,"firstName":"Tedmund","lastName":"Chandler","street":"81 Katie Point","postalCode":"44310","city":"Akron","state":"OH","phoneNumber":"330-336-2279","email":"tchandlerl0@webeden.co.uk"}, +{"id":758,"firstName":"Tobie","lastName":"Risley","street":"82996 Reindahl Junction","postalCode":"17140","city":"Harrisburg","state":"PA","phoneNumber":"717-272-9110","email":"trisleyl1@youtu.be"}, +{"id":759,"firstName":"Tomi","lastName":"Crevagh","street":"91791 Buhler Park","postalCode":"33715","city":"Saint Petersburg","state":"FL"}, +{"id":760,"firstName":"Luce","lastName":"Gwatkin","street":"424 Lunder Crossing","postalCode":"31416","city":"Savannah","state":"GA"}, +{"id":761,"firstName":"Vinita","lastName":"Hannon","street":"90 Claremont Trail","postalCode":"39236","city":"Jackson","state":"MS"}, +{"id":762,"firstName":"Ruby","lastName":"O'Cosgra","street":"304 Dayton Avenue","postalCode":"07188","city":"Newark","state":"NJ"}, +{"id":763,"firstName":"Amandi","lastName":"Vasiltsov","street":"98188 Killdeer Alley","postalCode":"93399","city":"Bakersfield","state":"CA","email":"avasiltsovl6@smh.com.au"}, +{"id":764,"firstName":"Juliana","lastName":"Goldspink","street":"93 Maryland Terrace","postalCode":"06705","city":"Waterbury","state":"CT","email":"jgoldspinkl7@guardian.co.uk"}, +{"id":765,"firstName":"Giorgi","lastName":"Yakovl","street":"24240 Shasta Drive","postalCode":"46814","city":"Fort Wayne","state":"IN","phoneNumber":"260-754-5907"}, +{"id":766,"firstName":"Aleksandr","lastName":"Justun","street":"06 Fulton Terrace","postalCode":"85025","city":"Phoenix","state":"AZ"}, +{"id":767,"firstName":"Cornela","lastName":"Grindell","street":"1 Hazelcrest Lane","postalCode":"53285","city":"Milwaukee","state":"WI"}, +{"id":768,"firstName":"Liv","lastName":"Madrell","street":"623 Cordelia Terrace","postalCode":"17105","city":"Harrisburg","state":"PA","email":"lmadrelllb@1688.com"}, +{"id":769,"firstName":"Konstance","lastName":"Rosebotham","street":"8930 Utah Terrace","postalCode":"20029","city":"Washington","state":"DC","email":"krosebothamlc@studiopress.com"}, +{"id":770,"firstName":"Theo","lastName":"Scotland","street":"454 Hintze Park","postalCode":"45238","city":"Cincinnati","state":"OH"}, +{"id":771,"firstName":"Trefor","lastName":"Rein","street":"9 Redwing Plaza","postalCode":"22184","city":"Vienna","state":"VA","email":"treinle@barnesandnoble.com"}, +{"id":772,"firstName":"Angelina","lastName":"Bromehead","street":"62477 Walton Circle","postalCode":"14683","city":"Rochester","state":"NY","email":"abromeheadlf@php.net"}, +{"id":773,"firstName":"Thornie","lastName":"Ivanishin","street":"0 Sunbrook Court","postalCode":"34665","city":"Pinellas Park","state":"FL","email":"tivanishinlg@aol.com"}, +{"id":774,"firstName":"Dyana","lastName":"McNickle","street":"2696 Lakewood Gardens Pass","postalCode":"20456","city":"Washington","state":"DC","phoneNumber":"202-653-8740"}, +{"id":775,"firstName":"Humfried","lastName":"Suero","street":"643 Pearson Junction","postalCode":"28410","city":"Wilmington","state":"NC"}, +{"id":776,"firstName":"Jessamine","lastName":"Stockings","street":"739 Moose Street","postalCode":"94137","city":"San Francisco","state":"CA","phoneNumber":"415-641-0091","email":"jstockingslj@skype.com"}, +{"id":777,"firstName":"Laryssa","lastName":"Grahl","street":"0538 Bultman Point","postalCode":"81505","city":"Grand Junction","state":"CO"}, +{"id":778,"firstName":"Susan","lastName":"Stonnell","street":"7 Dennis Parkway","postalCode":"67215","city":"Wichita","state":"KS","phoneNumber":"316-966-3243","email":"sstonnellll@nps.gov"}, +{"id":779,"firstName":"Melinde","lastName":"Segoe","street":"9 Dottie Place","postalCode":"19125","city":"Philadelphia","state":"PA","phoneNumber":"215-119-3801"}, +{"id":780,"firstName":"Skip","lastName":"Sedgebeer","street":"1 Eliot Drive","postalCode":"20005","city":"Washington","state":"DC","email":"ssedgebeerln@blogtalkradio.com"}, +{"id":781,"firstName":"Annabel","lastName":"Schusterl","street":"6094 Talisman Lane","postalCode":"68510","city":"Lincoln","state":"NE","phoneNumber":"402-355-7934","email":"aschusterllo@cargocollective.com"}, +{"id":782,"firstName":"Emiline","lastName":"Whittlesey","street":"5 Claremont Lane","postalCode":"77040","city":"Houston","state":"TX","phoneNumber":"832-835-1321","email":"ewhittleseylp@geocities.com"}, +{"id":783,"firstName":"Frasquito","lastName":"Loukes","street":"47 Merchant Pass","postalCode":"27499","city":"Greensboro","state":"NC","phoneNumber":"336-265-5719","email":"floukeslq@google.it"}, +{"id":784,"firstName":"Jerald","lastName":"Fairholm","street":"5939 Mariners Cove Road","postalCode":"76598","city":"Gatesville","state":"TX","email":"jfairholmlr@smh.com.au"}, +{"id":785,"firstName":"Melisent","lastName":"Strange","street":"50 Glendale Trail","postalCode":"10606","city":"White Plains","state":"NY"}, +{"id":786,"firstName":"Aaron","lastName":"Mixter","street":"14347 Darwin Place","postalCode":"33124","city":"Miami","state":"FL","phoneNumber":"786-244-1856","email":"amixterlt@dmoz.org"}, +{"id":787,"firstName":"Margy","lastName":"Falla","street":"5 Caliangt Trail","postalCode":"40287","city":"Louisville","state":"KY","email":"mfallalu@booking.com"}, +{"id":788,"firstName":"Malinde","lastName":"Ashdown","street":"97234 Anniversary Hill","postalCode":"06152","city":"Hartford","state":"CT","phoneNumber":"860-140-7408","email":"mashdownlv@economist.com"}, +{"id":789,"firstName":"Carolynn","lastName":"Dulany","street":"33 Melby Road","postalCode":"74116","city":"Tulsa","state":"OK","phoneNumber":"918-140-7039","email":"cdulanylw@yelp.com"}, +{"id":790,"firstName":"Kissee","lastName":"Escale","street":"1470 Hanson Parkway","postalCode":"92812","city":"Anaheim","state":"CA","phoneNumber":"714-466-6376"}, +{"id":791,"firstName":"Rebeka","lastName":"Moralee","street":"898 Oak Street","postalCode":"34108","city":"Naples","state":"FL","email":"rmoraleely@shutterfly.com"}, +{"id":792,"firstName":"Cort","lastName":"Arter","street":"35039 Menomonie Way","postalCode":"50936","city":"Des Moines","state":"IA","email":"carterlz@surveymonkey.com"}, +{"id":793,"firstName":"Kirsteni","lastName":"Heady","street":"473 Lawn Street","postalCode":"32092","city":"Saint Augustine","state":"FL","phoneNumber":"904-424-3526","email":"kheadym0@usda.gov"}, +{"id":794,"firstName":"Ettie","lastName":"Overil","street":"1085 Waubesa Lane","postalCode":"18105","city":"Allentown","state":"PA"}, +{"id":795,"firstName":"Evey","lastName":"Tesimon","street":"9 Cordelia Place","postalCode":"55127","city":"Saint Paul","state":"MN"}, +{"id":796,"firstName":"Hersh","lastName":"Lebond","street":"5265 Bartelt Park","postalCode":"34282","city":"Bradenton","state":"FL","phoneNumber":"941-114-7090"}, +{"id":797,"firstName":"Hendrika","lastName":"Govan","street":"27747 La Follette Avenue","postalCode":"21229","city":"Baltimore","state":"MD","email":"hgovanm4@cam.ac.uk"}, +{"id":798,"firstName":"Renado","lastName":"Hambly","street":"5211 Schmedeman Drive","postalCode":"68105","city":"Omaha","state":"NE","phoneNumber":"402-183-0376","email":"rhamblym5@netlog.com"}, +{"id":799,"firstName":"Brewer","lastName":"Boyn","street":"3161 Novick Lane","postalCode":"77055","city":"Houston","state":"TX","email":"bboynm6@google.it"}, +{"id":800,"firstName":"Patrick","lastName":"Speck","street":"57052 Ronald Regan Way","postalCode":"30306","city":"Atlanta","state":"GA","phoneNumber":"770-764-6971","email":"pspeckm7@live.com"}, +{"id":801,"firstName":"Skipper","lastName":"Conybear","street":"75 Autumn Leaf Alley","postalCode":"79968","city":"El Paso","state":"TX","phoneNumber":"915-705-5594","email":"sconybearm8@jimdo.com"}, +{"id":802,"firstName":"Elmore","lastName":"Quilty","street":"027 Warbler Court","postalCode":"35210","city":"Birmingham","state":"AL","email":"equiltym9@ebay.co.uk"}, +{"id":803,"firstName":"Estella","lastName":"Jorck","street":"52695 Holy Cross Trail","postalCode":"47134","city":"Jeffersonville","state":"IN","email":"ejorckma@bluehost.com"}, +{"id":804,"firstName":"Scotti","lastName":"Goodale","street":"7551 Dottie Pass","postalCode":"77713","city":"Beaumont","state":"TX","email":"sgoodalemb@nba.com"}, +{"id":805,"firstName":"Catha","lastName":"Shekle","street":"38839 Derek Terrace","postalCode":"62718","city":"Springfield","state":"IL","email":"csheklemc@tmall.com"}, +{"id":806,"firstName":"Clemens","lastName":"Chuter","street":"015 Charing Cross Pass","postalCode":"30306","city":"Atlanta","state":"GA"}, +{"id":807,"firstName":"Kiley","lastName":"Vasiltsov","street":"8 Reindahl Hill","postalCode":"33432","city":"Boca Raton","state":"FL","email":"kvasiltsovme@google.nl"}, +{"id":808,"firstName":"Korrie","lastName":"McGauhy","street":"188 Golf Lane","postalCode":"89110","city":"Las Vegas","state":"NV","phoneNumber":"702-647-1620","email":"kmcgauhymf@goodreads.com"}, +{"id":809,"firstName":"Giustina","lastName":"Hentze","street":"62244 Roth Way","postalCode":"48604","city":"Saginaw","state":"MI","email":"ghentzemg@pcworld.com"}, +{"id":810,"firstName":"Emilia","lastName":"Virgoe","street":"13910 Alpine Lane","postalCode":"33994","city":"Fort Myers","state":"FL","phoneNumber":"239-993-2041","email":"evirgoemh@mediafire.com"}, +{"id":811,"firstName":"Gordan","lastName":"Trimming","street":"38168 Transport Avenue","postalCode":"38131","city":"Memphis","state":"TN","email":"gtrimmingmi@spiegel.de"}, +{"id":812,"firstName":"Tadeo","lastName":"Vannoort","street":"41476 Pond Alley","postalCode":"20851","city":"Rockville","state":"MD","phoneNumber":"240-432-6489","email":"tvannoortmj@privacy.gov.au"}, +{"id":813,"firstName":"Joseito","lastName":"Viant","street":"1390 Kropf Court","postalCode":"04109","city":"Portland","state":"ME"}, +{"id":814,"firstName":"Blake","lastName":"Tailby","street":"5 Bultman Terrace","postalCode":"31914","city":"Columbus","state":"GA"}, +{"id":815,"firstName":"Cynthie","lastName":"Victor","street":"64 Hoard Avenue","postalCode":"46221","city":"Indianapolis","state":"IN","phoneNumber":"317-836-2511","email":"cvictormm@bizjournals.com"}, +{"id":816,"firstName":"Kristoforo","lastName":"Luckman","street":"019 Ohio Avenue","postalCode":"58505","city":"Bismarck","state":"ND","phoneNumber":"701-921-3472"}, +{"id":817,"firstName":"Celinka","lastName":"Brakewell","street":"5702 Tennessee Pass","postalCode":"92612","city":"Irvine","state":"CA","phoneNumber":"714-584-5599","email":"cbrakewellmo@house.gov"}, +{"id":818,"firstName":"Analiese","lastName":"Debenham","street":"7 Straubel Pass","postalCode":"31704","city":"Albany","state":"GA","phoneNumber":"229-600-4384","email":"adebenhammp@dell.com"}, +{"id":819,"firstName":"Sebastiano","lastName":"Eskriett","street":"0 Northridge Pass","postalCode":"34114","city":"Naples","state":"FL","phoneNumber":"239-651-1326","email":"seskriettmq@berkeley.edu"}, +{"id":820,"firstName":"Jermaine","lastName":"Donisthorpe","street":"69319 Hollow Ridge Park","postalCode":"62794","city":"Springfield","state":"IL","phoneNumber":"217-510-3030","email":"jdonisthorpemr@istockphoto.com"}, +{"id":821,"firstName":"Tera","lastName":"Smalecombe","street":"646 Oakridge Avenue","postalCode":"43699","city":"Toledo","state":"OH","email":"tsmalecombems@tripod.com"}, +{"id":822,"firstName":"Issie","lastName":"Cohane","street":"79078 Fair Oaks Circle","postalCode":"40233","city":"Louisville","state":"KY","email":"icohanemt@wired.com"}, +{"id":823,"firstName":"Nanete","lastName":"Erb","street":"02 Truax Place","postalCode":"88563","city":"El Paso","state":"TX","phoneNumber":"915-234-2792"}, +{"id":824,"firstName":"Benetta","lastName":"Roger","street":"822 Fallview Alley","postalCode":"33625","city":"Tampa","state":"FL","phoneNumber":"813-715-8911","email":"brogermv@ca.gov"}, +{"id":825,"firstName":"Sascha","lastName":"Hillyatt","street":"06 Fisk Plaza","postalCode":"11407","city":"Jamaica","state":"NY"}, +{"id":826,"firstName":"Britt","lastName":"Gilderoy","street":"64312 Delaware Place","postalCode":"89135","city":"Las Vegas","state":"NV"}, +{"id":827,"firstName":"Sterne","lastName":"Frissell","street":"69121 Sycamore Way","postalCode":"06912","city":"Stamford","state":"CT"}, +{"id":828,"firstName":"Lonny","lastName":"Petersen","street":"6 Golf Course Crossing","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-245-3289","email":"lpetersenmz@msu.edu"}, +{"id":829,"firstName":"Maridel","lastName":"Clunie","street":"0312 Dryden Street","postalCode":"80328","city":"Boulder","state":"CO","phoneNumber":"303-848-1116","email":"mclunien0@china.com.cn"}, +{"id":830,"firstName":"Annabal","lastName":"Pruckner","street":"98481 Anhalt Pass","postalCode":"30340","city":"Atlanta","state":"GA","email":"aprucknern1@bandcamp.com"}, +{"id":831,"firstName":"Carin","lastName":"Ambrois","street":"7982 Vahlen Road","postalCode":"85010","city":"Phoenix","state":"AZ"}, +{"id":832,"firstName":"Consuela","lastName":"Grubey","street":"1 Lillian Circle","postalCode":"89714","city":"Carson City","state":"NV","email":"cgrubeyn3@google.pl"}, +{"id":833,"firstName":"Friedrick","lastName":"Ventom","street":"703 Almo Crossing","postalCode":"43215","city":"Columbus","state":"OH"}, +{"id":834,"firstName":"Shalom","lastName":"Rosten","street":"4460 Parkside Road","postalCode":"37215","city":"Nashville","state":"TN","email":"srostenn5@e-recht24.de"}, +{"id":835,"firstName":"Sofia","lastName":"Pottie","street":"89885 Golf Course Junction","postalCode":"27635","city":"Raleigh","state":"NC","email":"spottien6@weather.com"}, +{"id":836,"firstName":"Ed","lastName":"Cecely","street":"38576 Gina Trail","postalCode":"85305","city":"Glendale","state":"AZ","email":"ececelyn7@friendfeed.com"}, +{"id":837,"firstName":"Ruthann","lastName":"Bignold","street":"202 Monterey Alley","postalCode":"19104","city":"Philadelphia","state":"PA","phoneNumber":"610-892-3949"}, +{"id":838,"firstName":"Vonnie","lastName":"Leeming","street":"5 Farmco Center","postalCode":"18706","city":"Wilkes Barre","state":"PA"}, +{"id":839,"firstName":"Diandra","lastName":"Gredden","street":"68178 Parkside Hill","postalCode":"89120","city":"Las Vegas","state":"NV","phoneNumber":"702-952-4026"}, +{"id":840,"firstName":"Donny","lastName":"Bruckent","street":"6 Dapin Way","postalCode":"98127","city":"Seattle","state":"WA","email":"dbruckentnb@stumbleupon.com"}, +{"id":841,"firstName":"Mill","lastName":"Finlay","street":"9 Meadow Valley Terrace","postalCode":"94405","city":"San Mateo","state":"CA","email":"mfinlaync@hibu.com"}, +{"id":842,"firstName":"Garv","lastName":"Feldberger","street":"5916 Marquette Lane","postalCode":"98127","city":"Seattle","state":"WA"}, +{"id":843,"firstName":"Micheal","lastName":"Favela","street":"41587 Dunning Road","postalCode":"47712","city":"Evansville","state":"IN"}, +{"id":844,"firstName":"Shannon","lastName":"Alvaro","street":"86377 Becker Avenue","postalCode":"33315","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-661-6648","email":"salvaronf@usa.gov"}, +{"id":845,"firstName":"Corenda","lastName":"Aldcorn","street":"19 Bowman Court","postalCode":"67220","city":"Wichita","state":"KS","phoneNumber":"316-835-1638","email":"caldcornng@ebay.com"}, +{"id":846,"firstName":"Alvy","lastName":"Mahood","street":"0814 Spohn Hill","postalCode":"50347","city":"Des Moines","state":"IA","phoneNumber":"515-865-3669","email":"amahoodnh@toplist.cz"}, +{"id":847,"firstName":"Alexandr","lastName":"Stut","street":"8672 Anderson Court","postalCode":"78410","city":"Corpus Christi","state":"TX"}, +{"id":848,"firstName":"Gale","lastName":"Chaperling","street":"78873 Bellgrove Alley","postalCode":"10009","city":"New York City","state":"NY","phoneNumber":"212-978-6798","email":"gchaperlingnj@livejournal.com"}, +{"id":849,"firstName":"Eunice","lastName":"Dadson","street":"340 Dwight Hill","postalCode":"52809","city":"Davenport","state":"IA","phoneNumber":"563-787-9869","email":"edadsonnk@businessinsider.com"}, +{"id":850,"firstName":"Florentia","lastName":"Camin","street":"68733 Orin Point","postalCode":"46867","city":"Fort Wayne","state":"IN","phoneNumber":"260-920-3928","email":"fcaminnl@technorati.com"}, +{"id":851,"firstName":"Norina","lastName":"Vannacci","street":"585 Karstens Circle","postalCode":"45233","city":"Cincinnati","state":"OH"}, +{"id":852,"firstName":"Syd","lastName":"Gianolo","street":"99755 Arrowood Hill","postalCode":"33673","city":"Tampa","state":"FL","phoneNumber":"813-878-8150","email":"sgianolonn@uol.com.br"}, +{"id":853,"firstName":"Timofei","lastName":"Serle","street":"1081 Cascade Park","postalCode":"94257","city":"Sacramento","state":"CA","email":"tserleno@behance.net"}, +{"id":854,"firstName":"Moina","lastName":"Ciobutaro","street":"502 Stone Corner Circle","postalCode":"33018","city":"Hialeah","state":"FL","email":"mciobutaronp@ycombinator.com"}, +{"id":855,"firstName":"Nikolaos","lastName":"Gavaghan","street":"47136 Golf Junction","postalCode":"97255","city":"Portland","state":"OR"}, +{"id":856,"firstName":"Gallard","lastName":"Jenks","street":"2 Carioca Terrace","postalCode":"35263","city":"Birmingham","state":"AL","email":"gjenksnr@blogtalkradio.com"}, +{"id":857,"firstName":"Dare","lastName":"Nielson","street":"3 Carberry Hill","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-211-0944"}, +{"id":858,"firstName":"Cecilius","lastName":"Fasse","street":"1 Novick Street","postalCode":"68583","city":"Lincoln","state":"NE","phoneNumber":"402-342-4624","email":"cfassent@zimbio.com"}, +{"id":859,"firstName":"Kevon","lastName":"Doxsey","street":"152 Warrior Pass","postalCode":"91616","city":"North Hollywood","state":"CA","phoneNumber":"213-339-9582"}, +{"id":860,"firstName":"Matti","lastName":"Gras","street":"4567 Bunting Way","postalCode":"94544","city":"Hayward","state":"CA"}, +{"id":861,"firstName":"Nathan","lastName":"Longfut","street":"3178 Mockingbird Alley","postalCode":"97255","city":"Portland","state":"OR","phoneNumber":"971-206-3004"}, +{"id":862,"firstName":"Willetta","lastName":"Fitzpayn","street":"87 Alpine Drive","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-698-7578","email":"wfitzpaynnx@geocities.jp"}, +{"id":863,"firstName":"Emanuel","lastName":"Jikylls","street":"42 Heffernan Court","postalCode":"33884","city":"Winter Haven","state":"FL","email":"ejikyllsny@biglobe.ne.jp"}, +{"id":864,"firstName":"Lenard","lastName":"Nore","street":"7 Nevada Avenue","postalCode":"77343","city":"Huntsville","state":"TX","phoneNumber":"936-267-6742","email":"lnorenz@netscape.com"}, +{"id":865,"firstName":"Jeanine","lastName":"MacTurlough","street":"26343 Gale Crossing","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-865-6630","email":"jmacturlougho0@scientificamerican.com"}, +{"id":866,"firstName":"Jaquenetta","lastName":"Dorn","street":"3963 Novick Way","postalCode":"19495","city":"Valley Forge","state":"PA","email":"jdorno1@about.com"}, +{"id":867,"firstName":"Amity","lastName":"Titterrell","street":"3216 Lindbergh Court","postalCode":"90071","city":"Los Angeles","state":"CA","phoneNumber":"626-416-1494","email":"atitterrello2@psu.edu"}, +{"id":868,"firstName":"Rafaelia","lastName":"Melly","street":"6 Westridge Center","postalCode":"61825","city":"Champaign","state":"IL","email":"rmellyo3@ovh.net"}, +{"id":869,"firstName":"Cordi","lastName":"Martinovsky","street":"38 Forest Dale Terrace","postalCode":"50362","city":"Des Moines","state":"IA","email":"cmartinovskyo4@tuttocitta.it"}, +{"id":870,"firstName":"Humfrid","lastName":"Varne","street":"858 Farwell Street","postalCode":"06127","city":"West Hartford","state":"CT","email":"hvarneo5@yolasite.com"}, +{"id":871,"firstName":"Ford","lastName":"Pinchback","street":"363 Lien Pass","postalCode":"20599","city":"Washington","state":"DC","email":"fpinchbacko6@nytimes.com"}, +{"id":872,"firstName":"Maible","lastName":"Haresign","street":"809 Monica Point","postalCode":"28230","city":"Charlotte","state":"NC"}, +{"id":873,"firstName":"Rozamond","lastName":"Challis","street":"312 Mcbride Plaza","postalCode":"77266","city":"Houston","state":"TX","email":"rchalliso8@google.ca"}, +{"id":874,"firstName":"Myrah","lastName":"Menendez","street":"21 Garrison Plaza","postalCode":"23208","city":"Richmond","state":"VA","email":"mmenendezo9@msn.com"}, +{"id":875,"firstName":"Roberto","lastName":"Lamb","street":"3339 Cottonwood Pass","postalCode":"43699","city":"Toledo","state":"OH","phoneNumber":"419-633-9671"}, +{"id":876,"firstName":"Foster","lastName":"Delyth","street":"91500 Carpenter Point","postalCode":"79928","city":"El Paso","state":"TX","phoneNumber":"915-782-9005"}, +{"id":877,"firstName":"Nicholle","lastName":"Pickring","street":"8083 Talmadge Lane","postalCode":"14624","city":"Rochester","state":"NY","email":"npickringoc@tuttocitta.it"}, +{"id":878,"firstName":"Theodosia","lastName":"Bayliss","street":"6 Marcy Parkway","postalCode":"33954","city":"Port Charlotte","state":"FL"}, +{"id":879,"firstName":"Araldo","lastName":"Dowzell","street":"8376 Carpenter Court","postalCode":"71151","city":"Shreveport","state":"LA","email":"adowzelloe@army.mil"}, +{"id":880,"firstName":"Hugues","lastName":"McColgan","street":"990 Southridge Point","postalCode":"93591","city":"Palmdale","state":"CA","phoneNumber":"661-978-2646","email":"hmccolganof@netvibes.com"}, +{"id":881,"firstName":"Annissa","lastName":"Mordue","street":"62114 Ludington Lane","postalCode":"30911","city":"Augusta","state":"GA","phoneNumber":"706-152-3967","email":"amordueog@tripod.com"}, +{"id":882,"firstName":"Tierney","lastName":"Claughton","street":"3 Twin Pines Trail","postalCode":"88563","city":"El Paso","state":"TX","phoneNumber":"915-784-7980"}, +{"id":883,"firstName":"Rey","lastName":"Fleckno","street":"49 Oakridge Point","postalCode":"27605","city":"Raleigh","state":"NC"}, +{"id":884,"firstName":"Stacee","lastName":"Rewcastle","street":"19 Glendale Point","postalCode":"78278","city":"San Antonio","state":"TX","phoneNumber":"210-454-3087","email":"srewcastleoj@ustream.tv"}, +{"id":885,"firstName":"Delano","lastName":"Bragger","street":"0 Hoffman Center","postalCode":"47725","city":"Evansville","state":"IN","email":"dbraggerok@ifeng.com"}, +{"id":886,"firstName":"Redford","lastName":"Bare","street":"801 Garrison Court","postalCode":"08638","city":"Trenton","state":"NJ"}, +{"id":887,"firstName":"Grantham","lastName":"Arlidge","street":"69 Shelley Parkway","postalCode":"34210","city":"Bradenton","state":"FL","email":"garlidgeom@google.nl"}, +{"id":888,"firstName":"Debbie","lastName":"Tommaseo","street":"295 Crowley Alley","postalCode":"98516","city":"Olympia","state":"WA","email":"dtommaseoon@xrea.com"}, +{"id":889,"firstName":"Ragnar","lastName":"O' Byrne","street":"88163 Manitowish Terrace","postalCode":"20260","city":"Washington","state":"DC","phoneNumber":"202-982-3050","email":"robyrneoo@ft.com"}, +{"id":890,"firstName":"Leopold","lastName":"Woodington","street":"44 Vera Pass","postalCode":"24009","city":"Roanoke","state":"VA","email":"lwoodingtonop@engadget.com"}, +{"id":891,"firstName":"Farrah","lastName":"Conniam","street":"2078 Bunting Parkway","postalCode":"68134","city":"Omaha","state":"NE","email":"fconniamoq@github.com"}, +{"id":892,"firstName":"Augustus","lastName":"Morrish","street":"430 Sauthoff Plaza","postalCode":"27710","city":"Durham","state":"NC","phoneNumber":"919-266-8155","email":"amorrishor@naver.com"}, +{"id":893,"firstName":"Cassaundra","lastName":"Deaves","street":"32 Clarendon Way","postalCode":"40266","city":"Louisville","state":"KY","phoneNumber":"502-138-7158"}, +{"id":894,"firstName":"Glynn","lastName":"Shewan","street":"989 Susan Avenue","postalCode":"95194","city":"San Jose","state":"CA","email":"gshewanot@reuters.com"}, +{"id":895,"firstName":"Neils","lastName":"Niesing","street":"488 Jana Road","postalCode":"48232","city":"Detroit","state":"MI","email":"nniesingou@cafepress.com"}, +{"id":896,"firstName":"Alix","lastName":"Cleeton","street":"8 Merrick Crossing","postalCode":"18018","city":"Bethlehem","state":"PA","email":"acleetonov@ask.com"}, +{"id":897,"firstName":"Kyrstin","lastName":"Alejandro","street":"45487 Carey Way","postalCode":"37919","city":"Knoxville","state":"TN","email":"kalejandroow@scribd.com"}, +{"id":898,"firstName":"Waylin","lastName":"De Caroli","street":"9237 Ludington Plaza","postalCode":"77554","city":"Galveston","state":"TX","email":"wdecaroliox@washingtonpost.com"}, +{"id":899,"firstName":"Lian","lastName":"Brade","street":"704 Lotheville Drive","postalCode":"24014","city":"Roanoke","state":"VA","phoneNumber":"540-712-7147"}, +{"id":900,"firstName":"Griz","lastName":"Elgie","street":"435 Northridge Point","postalCode":"93399","city":"Bakersfield","state":"CA","email":"gelgieoz@hao123.com"}, +{"id":901,"firstName":"Georgeanna","lastName":"Gilberthorpe","street":"6 Tomscot Park","postalCode":"37931","city":"Knoxville","state":"TN","phoneNumber":"865-664-6191","email":"ggilberthorpep0@typepad.com"}, +{"id":902,"firstName":"Korrie","lastName":"Goldstraw","street":"00 Lindbergh Plaza","postalCode":"14225","city":"Buffalo","state":"NY","email":"kgoldstrawp1@yellowbook.com"}, +{"id":903,"firstName":"Hervey","lastName":"Wyse","street":"27 Buell Road","postalCode":"75044","city":"Garland","state":"TX","phoneNumber":"972-243-9031","email":"hwysep2@deliciousdays.com"}, +{"id":904,"firstName":"Georgeta","lastName":"Buckam","street":"0 Continental Hill","postalCode":"65810","city":"Springfield","state":"MO","phoneNumber":"417-682-2553","email":"gbuckamp3@java.com"}, +{"id":905,"firstName":"Hussein","lastName":"Jacson","street":"478 Vermont Court","postalCode":"95354","city":"Modesto","state":"CA","phoneNumber":"209-714-7362","email":"hjacsonp4@squarespace.com"}, +{"id":906,"firstName":"Chrysler","lastName":"Heddy","street":"913 Steensland Parkway","postalCode":"20709","city":"Laurel","state":"MD","phoneNumber":"410-691-9748"}, +{"id":907,"firstName":"Jourdan","lastName":"Frise","street":"35 Erie Point","postalCode":"94245","city":"Sacramento","state":"CA","email":"jfrisep6@eepurl.com"}, +{"id":908,"firstName":"Roxie","lastName":"Gimber","street":"9237 Vermont Pass","postalCode":"88553","city":"El Paso","state":"TX","email":"rgimberp7@mayoclinic.com"}, +{"id":909,"firstName":"Jenilee","lastName":"MacNab","street":"23 Union Alley","postalCode":"29579","city":"Myrtle Beach","state":"SC","email":"jmacnabp8@mit.edu"}, +{"id":910,"firstName":"Lola","lastName":"Bier","street":"371 Bartillon Avenue","postalCode":"71105","city":"Shreveport","state":"LA","phoneNumber":"318-818-1659","email":"lbierp9@goo.gl"}, +{"id":911,"firstName":"Fayina","lastName":"Brosel","street":"3255 Macpherson Pass","postalCode":"55166","city":"Saint Paul","state":"MN","email":"fbroselpa@rakuten.co.jp"}, +{"id":912,"firstName":"Ellerey","lastName":"Darell","street":"735 Leroy Road","postalCode":"07544","city":"Paterson","state":"NJ"}, +{"id":913,"firstName":"Lorianne","lastName":"McLanachan","street":"22 Alpine Point","postalCode":"77293","city":"Houston","state":"TX","email":"lmclanachanpc@dmoz.org"}, +{"id":914,"firstName":"Merrill","lastName":"Searson","street":"8447 Namekagon Hill","postalCode":"55114","city":"Saint Paul","state":"MN","phoneNumber":"651-567-8380","email":"msearsonpd@census.gov"}, +{"id":915,"firstName":"Nisse","lastName":"Larive","street":"976 Forest Dale Way","postalCode":"10004","city":"New York City","state":"NY","phoneNumber":"347-192-6897","email":"nlarivepe@drupal.org"}, +{"id":916,"firstName":"Cazzie","lastName":"Brenard","street":"647 Gulseth Plaza","postalCode":"02283","city":"Boston","state":"MA","phoneNumber":"781-248-3572","email":"cbrenardpf@uiuc.edu"}, +{"id":917,"firstName":"Gael","lastName":"Ramirez","street":"161 Basil Terrace","postalCode":"93786","city":"Fresno","state":"CA","phoneNumber":"559-692-2653","email":"gramirezpg@ucoz.ru"}, +{"id":918,"firstName":"Culver","lastName":"Le Brun","street":"73906 Muir Terrace","postalCode":"95973","city":"Chico","state":"CA","email":"clebrunph@jigsy.com"}, +{"id":919,"firstName":"Bordie","lastName":"Muskett","street":"27 Nobel Trail","postalCode":"20599","city":"Washington","state":"DC","phoneNumber":"202-872-5253"}, +{"id":920,"firstName":"Riccardo","lastName":"Miskin","street":"778 Eagan Place","postalCode":"55407","city":"Minneapolis","state":"MN","email":"rmiskinpj@slideshare.net"}, +{"id":921,"firstName":"Cristabel","lastName":"Gowlett","street":"5 Quincy Lane","postalCode":"62525","city":"Decatur","state":"IL","email":"cgowlettpk@cafepress.com"}, +{"id":922,"firstName":"Crawford","lastName":"Huby","street":"6 Gina Lane","postalCode":"94913","city":"San Rafael","state":"CA","phoneNumber":"415-133-8552","email":"chubypl@jugem.jp"}, +{"id":923,"firstName":"Cherish","lastName":"Mutch","street":"8 Oak Valley Lane","postalCode":"20719","city":"Bowie","state":"MD","phoneNumber":"240-982-9087"}, +{"id":924,"firstName":"Jerrie","lastName":"Latek","street":"9462 Moulton Terrace","postalCode":"52809","city":"Davenport","state":"IA","phoneNumber":"563-687-6664","email":"jlatekpn@gov.uk"}, +{"id":925,"firstName":"Lacey","lastName":"Maris","street":"1 Carpenter Hill","postalCode":"61605","city":"Peoria","state":"IL","phoneNumber":"309-570-3216"}, +{"id":926,"firstName":"Daffy","lastName":"Binion","street":"8 Milwaukee Parkway","postalCode":"33129","city":"Miami","state":"FL","phoneNumber":"305-579-9009"}, +{"id":927,"firstName":"Melita","lastName":"Valde","street":"629 Packers Crossing","postalCode":"06140","city":"Hartford","state":"CT","phoneNumber":"860-747-5927","email":"mvaldepq@storify.com"}, +{"id":928,"firstName":"Cherlyn","lastName":"Rosenshine","street":"764 Pepper Wood Place","postalCode":"72204","city":"Little Rock","state":"AR","phoneNumber":"501-823-8134"}, +{"id":929,"firstName":"Morty","lastName":"Stanger","street":"3286 Charing Cross Court","postalCode":"08603","city":"Trenton","state":"NJ","email":"mstangerps@yellowpages.com"}, +{"id":930,"firstName":"Bernete","lastName":"Hirth","street":"83 Granby Center","postalCode":"95194","city":"San Jose","state":"CA","phoneNumber":"408-738-2333","email":"bhirthpt@people.com.cn"}, +{"id":931,"firstName":"Elena","lastName":"Wace","street":"98 Grover Trail","postalCode":"33742","city":"Saint Petersburg","state":"FL","phoneNumber":"727-883-2239","email":"ewacepu@merriam-webster.com"}, +{"id":932,"firstName":"Giselbert","lastName":"Sisland","street":"2214 Sheridan Pass","postalCode":"40225","city":"Louisville","state":"KY"}, +{"id":933,"firstName":"Herb","lastName":"Voyce","street":"628 Basil Pass","postalCode":"21265","city":"Baltimore","state":"MD"}, +{"id":934,"firstName":"Vina","lastName":"Antonetti","street":"6 Springview Terrace","postalCode":"20430","city":"Washington","state":"DC","phoneNumber":"202-955-4578"}, +{"id":935,"firstName":"Bard","lastName":"De Avenell","street":"2775 Clarendon Avenue","postalCode":"53215","city":"Milwaukee","state":"WI"}, +{"id":936,"firstName":"Briana","lastName":"Pinshon","street":"43 Del Sol Street","postalCode":"33615","city":"Tampa","state":"FL","email":"bpinshonpz@java.com"}, +{"id":937,"firstName":"Hilly","lastName":"Aysh","street":"37 Doe Crossing Terrace","postalCode":"23705","city":"Portsmouth","state":"VA","phoneNumber":"757-992-8124"}, +{"id":938,"firstName":"Marylin","lastName":"Ciotto","street":"3957 Browning Pass","postalCode":"94807","city":"Richmond","state":"CA"}, +{"id":939,"firstName":"Cam","lastName":"Kurth","street":"155 Walton Point","postalCode":"92867","city":"Orange","state":"CA","phoneNumber":"949-955-2248"}, +{"id":940,"firstName":"Rawley","lastName":"Bickle","street":"54 Macpherson Point","postalCode":"93762","city":"Fresno","state":"CA","phoneNumber":"559-331-2187","email":"rbickleq3@delicious.com"}, +{"id":941,"firstName":"Merlina","lastName":"Dunster","street":"70557 Toban Trail","postalCode":"20005","city":"Washington","state":"DC","phoneNumber":"202-999-8731"}, +{"id":942,"firstName":"Kennie","lastName":"MacCoughan","street":"04566 Browning Parkway","postalCode":"75507","city":"Texarkana","state":"TX","phoneNumber":"903-622-7509","email":"kmaccoughanq5@reuters.com"}, +{"id":943,"firstName":"Jase","lastName":"Cholomin","street":"21497 Blaine Road","postalCode":"33777","city":"Largo","state":"FL","email":"jcholominq6@cocolog-nifty.com"}, +{"id":944,"firstName":"Cirstoforo","lastName":"Billingsley","street":"1306 Summer Ridge Court","postalCode":"02124","city":"Boston","state":"MA","email":"cbillingsleyq7@google.es"}, +{"id":945,"firstName":"Berkly","lastName":"Lawles","street":"80400 Milwaukee Way","postalCode":"64082","city":"Lees Summit","state":"MO","email":"blawlesq8@jiathis.com"}, +{"id":946,"firstName":"Otha","lastName":"Key","street":"59639 Center Circle","postalCode":"35405","city":"Tuscaloosa","state":"AL","email":"okeyq9@deliciousdays.com"}, +{"id":947,"firstName":"Anselma","lastName":"Debow","street":"5 Spohn Parkway","postalCode":"80241","city":"Denver","state":"CO","email":"adebowqa@yelp.com"}, +{"id":948,"firstName":"Auria","lastName":"Beric","street":"5 Anderson Way","postalCode":"20022","city":"Washington","state":"DC","email":"abericqb@a8.net"}, +{"id":949,"firstName":"Eirena","lastName":"Caswall","street":"4648 Fulton Street","postalCode":"64054","city":"Independence","state":"MO","phoneNumber":"816-406-0779","email":"ecaswallqc@i2i.jp"}, +{"id":950,"firstName":"Tracy","lastName":"Sperwell","street":"4 Heath Drive","postalCode":"91499","city":"Van Nuys","state":"CA"}, +{"id":951,"firstName":"Cherilyn","lastName":"Faint","street":"814 Anniversary Lane","postalCode":"24503","city":"Lynchburg","state":"VA","phoneNumber":"434-722-2344","email":"cfaintqe@amazon.de"}, +{"id":952,"firstName":"Sela","lastName":"Darcey","street":"002 Walton Hill","postalCode":"78703","city":"Austin","state":"TX","email":"sdarceyqf@lycos.com"}, +{"id":953,"firstName":"Freddie","lastName":"Klagge","street":"842 Schlimgen Road","postalCode":"29905","city":"Beaufort","state":"SC","email":"fklaggeqg@1und1.de"}, +{"id":954,"firstName":"Eunice","lastName":"Walrond","street":"4 Mifflin Terrace","postalCode":"68117","city":"Omaha","state":"NE","email":"ewalrondqh@arstechnica.com"}, +{"id":955,"firstName":"Adelbert","lastName":"Meuse","street":"971 Doe Crossing Court","postalCode":"27157","city":"Winston Salem","state":"NC"}, +{"id":956,"firstName":"Caitlin","lastName":"Windham","street":"29 Cordelia Alley","postalCode":"76210","city":"Denton","state":"TX","phoneNumber":"214-498-2801","email":"cwindhamqj@trellian.com"}, +{"id":957,"firstName":"Jere","lastName":"Presho","street":"7 Monica Plaza","postalCode":"75710","city":"Tyler","state":"TX","email":"jpreshoqk@e-recht24.de"}, +{"id":958,"firstName":"Lonny","lastName":"Cotter","street":"5686 Rutledge Place","postalCode":"40596","city":"Lexington","state":"KY","email":"lcotterql@last.fm"}, +{"id":959,"firstName":"Sarah","lastName":"Earnshaw","street":"69 Prentice Point","postalCode":"60669","city":"Chicago","state":"IL","email":"searnshawqm@ycombinator.com"}, +{"id":960,"firstName":"Claire","lastName":"Minette","street":"3145 Butterfield Terrace","postalCode":"43204","city":"Columbus","state":"OH","phoneNumber":"614-157-5341","email":"cminetteqn@upenn.edu"}, +{"id":961,"firstName":"Traci","lastName":"Farnes","street":"2 Service Circle","postalCode":"06905","city":"Stamford","state":"CT","phoneNumber":"203-311-5859","email":"tfarnesqo@merriam-webster.com"}, +{"id":962,"firstName":"Storm","lastName":"de Werk","street":"9 Jenifer Alley","postalCode":"98121","city":"Seattle","state":"WA","phoneNumber":"425-172-3688"}, +{"id":963,"firstName":"Neile","lastName":"Mackrill","street":"5046 Schurz Point","postalCode":"28299","city":"Charlotte","state":"NC"}, +{"id":964,"firstName":"Temple","lastName":"Howlings","street":"8831 Randy Street","postalCode":"71161","city":"Shreveport","state":"LA","phoneNumber":"318-859-6319","email":"thowlingsqr@smugmug.com"}, +{"id":965,"firstName":"Roda","lastName":"Drissell","street":"16621 Mandrake Lane","postalCode":"78744","city":"Austin","state":"TX","email":"rdrissellqs@mayoclinic.com"}, +{"id":966,"firstName":"Francoise","lastName":"Lawman","street":"7 Calypso Point","postalCode":"14614","city":"Rochester","state":"NY","phoneNumber":"585-995-3882"}, +{"id":967,"firstName":"Helen","lastName":"Kigelman","street":"613 Manley Plaza","postalCode":"01905","city":"Lynn","state":"MA","email":"hkigelmanqu@shutterfly.com"}, +{"id":968,"firstName":"Dudley","lastName":"Cansdall","street":"153 Schmedeman Place","postalCode":"93715","city":"Fresno","state":"CA","email":"dcansdallqv@naver.com"}, +{"id":969,"firstName":"Shelby","lastName":"Fayers","street":"94681 Knutson Point","postalCode":"10039","city":"New York City","state":"NY"}, +{"id":970,"firstName":"Sileas","lastName":"Jalland","street":"2199 Buhler Circle","postalCode":"10029","city":"New York City","state":"NY","phoneNumber":"917-902-1667","email":"sjallandqx@rakuten.co.jp"}, +{"id":971,"firstName":"Zeke","lastName":"Duffett","street":"5 Coolidge Park","postalCode":"37995","city":"Knoxville","state":"TN","phoneNumber":"865-814-8540","email":"zduffettqy@wikispaces.com"}, +{"id":972,"firstName":"Tabby","lastName":"Mathieu","street":"78 Donald Circle","postalCode":"55114","city":"Saint Paul","state":"MN","email":"tmathieuqz@rediff.com"}, +{"id":973,"firstName":"Zsa zsa","lastName":"Knights","street":"208 Kingsford Park","postalCode":"15250","city":"Pittsburgh","state":"PA","phoneNumber":"412-652-8956","email":"zknightsr0@privacy.gov.au"}, +{"id":974,"firstName":"Tildi","lastName":"Knewstub","street":"8572 Gina Hill","postalCode":"32909","city":"Palm Bay","state":"FL","email":"tknewstubr1@archive.org"}, +{"id":975,"firstName":"Eric","lastName":"Wharrier","street":"9 Marcy Alley","postalCode":"38126","city":"Memphis","state":"TN","phoneNumber":"901-378-1545","email":"ewharrierr2@people.com.cn"}, +{"id":976,"firstName":"Jilleen","lastName":"Durgan","street":"7 Lien Plaza","postalCode":"75241","city":"Dallas","state":"TX","email":"jdurganr3@google.pl"}, +{"id":977,"firstName":"Ingeberg","lastName":"Whipp","street":"489 Bartillon Street","postalCode":"22205","city":"Arlington","state":"VA","phoneNumber":"703-356-7728","email":"iwhippr4@un.org"}, +{"id":978,"firstName":"Drake","lastName":"McCreagh","street":"735 Mcguire Lane","postalCode":"20530","city":"Washington","state":"DC","email":"dmccreaghr5@mediafire.com"}, +{"id":979,"firstName":"Byron","lastName":"Eades","street":"931 Hollow Ridge Avenue","postalCode":"23285","city":"Richmond","state":"VA","phoneNumber":"804-728-5669","email":"beadesr6@npr.org"}, +{"id":980,"firstName":"Free","lastName":"Tungate","street":"7037 Ramsey Crossing","postalCode":"64153","city":"Kansas City","state":"MO","email":"ftungater7@macromedia.com"}, +{"id":981,"firstName":"Augustus","lastName":"Benardet","street":"398 Bultman Circle","postalCode":"70165","city":"New Orleans","state":"LA"}, +{"id":982,"firstName":"Sanders","lastName":"Sullens","street":"75785 Westend Terrace","postalCode":"43656","city":"Toledo","state":"OH","phoneNumber":"419-314-1134"}, +{"id":983,"firstName":"Ynes","lastName":"Troup","street":"328 Schurz Trail","postalCode":"98907","city":"Yakima","state":"WA","phoneNumber":"509-696-5645"}, +{"id":984,"firstName":"Siana","lastName":"Bernath","street":"968 Sommers Lane","postalCode":"55487","city":"Minneapolis","state":"MN","phoneNumber":"612-351-3016"}, +{"id":985,"firstName":"Ellary","lastName":"Enders","street":"2 Charing Cross Court","postalCode":"06505","city":"New Haven","state":"CT","phoneNumber":"203-608-5058"}, +{"id":986,"firstName":"Mariann","lastName":"Damerell","street":"885 Pennsylvania Crossing","postalCode":"15220","city":"Pittsburgh","state":"PA","phoneNumber":"412-667-1349","email":"mdamerellrd@moonfruit.com"}, +{"id":987,"firstName":"Timotheus","lastName":"Muncer","street":"293 Hoepker Center","postalCode":"32405","city":"Panama City","state":"FL","phoneNumber":"850-740-2501","email":"tmuncerre@ifeng.com"}, +{"id":988,"firstName":"Hermina","lastName":"Tetsall","street":"9354 Nobel Road","postalCode":"55585","city":"Monticello","state":"MN","phoneNumber":"763-292-3970","email":"htetsallrf@wsj.com"}, +{"id":989,"firstName":"Dorelia","lastName":"Howship","street":"747 Namekagon Way","postalCode":"14269","city":"Buffalo","state":"NY","phoneNumber":"716-470-3584","email":"dhowshiprg@un.org"}, +{"id":990,"firstName":"Peggy","lastName":"Coutts","street":"34 Village Green Road","postalCode":"19131","city":"Philadelphia","state":"PA"}, +{"id":991,"firstName":"Dacey","lastName":"Inglefield","street":"05227 Buell Avenue","postalCode":"45414","city":"Dayton","state":"OH"}, +{"id":992,"firstName":"Hollyanne","lastName":"Hobbema","street":"684 La Follette Drive","postalCode":"45218","city":"Cincinnati","state":"OH","phoneNumber":"513-346-0258"}, +{"id":993,"firstName":"Freedman","lastName":"Whorlow","street":"291 Maywood Pass","postalCode":"48098","city":"Troy","state":"MI","phoneNumber":"248-890-5937"}, +{"id":994,"firstName":"Karine","lastName":"Gerring","street":"163 Graceland Street","postalCode":"95397","city":"Modesto","state":"CA"}, +{"id":995,"firstName":"Sonya","lastName":"Giercke","street":"1801 Rowland Junction","postalCode":"66215","city":"Shawnee Mission","state":"KS","email":"sgierckerm@mapquest.com"}, +{"id":996,"firstName":"Fabiano","lastName":"O'Hear","street":"87555 Sunnyside Plaza","postalCode":"33330","city":"Fort Lauderdale","state":"FL","email":"fohearrn@china.com.cn"}, +{"id":997,"firstName":"Lelia","lastName":"Gillman","street":"29838 Eagan Junction","postalCode":"78783","city":"Austin","state":"TX","phoneNumber":"512-515-1461","email":"lgillmanro@amazon.co.jp"}, +{"id":998,"firstName":"Ophelie","lastName":"Richardet","street":"9 Bay Point","postalCode":"94042","city":"Mountain View","state":"CA"}, +{"id":999,"firstName":"Batholomew","lastName":"Janzen","street":"9 Rigney Alley","postalCode":"95113","city":"San Jose","state":"CA"}, +{"id":1000,"firstName":"Kirstyn","lastName":"Bixley","street":"2 Cascade Trail","postalCode":"80015","city":"Aurora","state":"CO","phoneNumber":"303-339-2309","email":"kbixleyrr@i2i.jp"}] \ No newline at end of file From fb4041073bc3bd9e154f2def47b4bbcf70b9b2bd Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Sat, 5 Sep 2020 18:48:35 +0100 Subject: [PATCH 0648/1862] BAEL-3326, "Optimizing JSON Schema for production use": Optimized imports and formatted source. --- .../baeldung/jsonoptimization/Customer.java | 2 +- .../CustomerDeserializer.java | 32 +++++----- .../jsonoptimization/CustomerNoNull.java | 16 ++--- .../jsonoptimization/CustomerSerializer.java | 8 +-- .../jsonoptimization/CustomerShortNames.java | 58 ++++++++++++------- .../CustomerShortNamesNoNull.java | 18 +++--- .../jsonoptimization/CustomerSlim.java | 13 ++--- 7 files changed, 82 insertions(+), 65 deletions(-) diff --git a/json/src/main/java/com/baeldung/jsonoptimization/Customer.java b/json/src/main/java/com/baeldung/jsonoptimization/Customer.java index 81a74971ea..85451731e9 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/Customer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/Customer.java @@ -116,7 +116,7 @@ public class Customer { public static Customer[] fromMockFile() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); - InputStream jsonFile = new FileInputStream("src/test/resources/json_optimization_mock_data.json"); + InputStream jsonFile = new FileInputStream("src/test/resources/json_optimization_mock_data.json"); Customer[] feedback = objectMapper.readValue(jsonFile, Customer[].class); return feedback; } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java index 1f478ed446..04ab15556a 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java @@ -2,39 +2,43 @@ package com.baeldung.jsonoptimization; import java.io.IOException; -import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.ObjectCodec; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -public class CustomerDeserializer extends StdDeserializer { +public class CustomerDeserializer extends StdDeserializer { private static final long serialVersionUID = 1L; public CustomerDeserializer() { this(null); } - + public CustomerDeserializer(Class t) { super(t); } - + @Override public Customer deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { Customer feedback = new Customer(); ObjectCodec codec = parser.getCodec(); JsonNode node = codec.readTree(parser); - - feedback.setId(node.get(0).asLong()); - feedback.setFirstName(node.get(1).asText()); - feedback.setLastName(node.get(2).asText()); - feedback.setStreet(node.get(3).asText()); - feedback.setPostalCode(node.get(4).asText()); - feedback.setCity(node.get(5).asText()); - feedback.setState(node.get(6).asText()); + + feedback.setId(node.get(0) + .asLong()); + feedback.setFirstName(node.get(1) + .asText()); + feedback.setLastName(node.get(2) + .asText()); + feedback.setStreet(node.get(3) + .asText()); + feedback.setPostalCode(node.get(4) + .asText()); + feedback.setCity(node.get(5) + .asText()); + feedback.setState(node.get(6) + .asText()); JsonNode phoneNumber = node.get(7); feedback.setPhoneNumber(phoneNumber.isNull() ? null : phoneNumber.asText()); JsonNode email = node.get(8); diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java index 1ee76f762a..62cf526f78 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java @@ -4,19 +4,19 @@ import com.fasterxml.jackson.annotation.JsonInclude; @JsonInclude(JsonInclude.Include.NON_NULL) public class CustomerNoNull extends Customer { - + @Override public String toString() { return "CustomerNoNull [toString()=" + super.toString() + "]"; } public static CustomerNoNull[] fromCustomers(Customer[] customers) { - CustomerNoNull[] feedback = new CustomerNoNull[customers.length]; - - for(int i = 0; i < customers.length; i++) { + CustomerNoNull[] feedback = new CustomerNoNull[customers.length]; + + for (int i = 0; i < customers.length; i++) { Customer aCustomer = customers[i]; CustomerNoNull newOne = new CustomerNoNull(); - + newOne.setId(aCustomer.getId()); newOne.setFirstName(aCustomer.getFirstName()); newOne.setLastName(aCustomer.getLastName()); @@ -26,11 +26,11 @@ public class CustomerNoNull extends Customer { newOne.setState(aCustomer.getState()); newOne.setPhoneNumber(aCustomer.getPhoneNumber()); newOne.setEmail(aCustomer.getEmail()); - + feedback[i] = newOne; } - + return feedback; } - + } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java index 7e58010640..0f631ee85b 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java @@ -6,21 +6,21 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; -public class CustomerSerializer extends StdSerializer { +public class CustomerSerializer extends StdSerializer { private static final long serialVersionUID = 1L; public CustomerSerializer() { this(null); } - + public CustomerSerializer(Class t) { super(t); } - + @Override public void serialize(Customer customer, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { jsonGenerator.writeStartArray(); - jsonGenerator.writeNumber(customer.getId()); + jsonGenerator.writeNumber(customer.getId()); jsonGenerator.writeString(customer.getFirstName()); jsonGenerator.writeString(customer.getLastName()); jsonGenerator.writeString(customer.getStreet()); diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java index ffa10f786d..2a47a4bbac 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java @@ -2,97 +2,113 @@ package com.baeldung.jsonoptimization; import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; public class CustomerShortNames { private long id; - + @JsonProperty("f") private String firstName; - + @JsonProperty("l") private String lastName; - + @JsonProperty("s") private String street; - + @JsonProperty("p") private String postalCode; - + @JsonProperty("c") private String city; - + @JsonProperty("a") private String state; - + @JsonProperty("o") private String phoneNumber; - + @JsonProperty("e") private String email; - + public long getId() { return id; } + public void setId(long id) { this.id = id; } + public String getFirstName() { return firstName; } + public void setFirstName(String firstName) { this.firstName = firstName; } + public String getLastName() { return lastName; } + public void setLastName(String lastName) { this.lastName = lastName; } + public String getStreet() { return street; } + public void setStreet(String street) { this.street = street; } + public String getPostalCode() { return postalCode; } + public void setPostalCode(String postalCode) { this.postalCode = postalCode; } + public String getCity() { return city; } + public void setCity(String city) { this.city = city; } + public String getState() { return state; } + public void setState(String state) { this.state = state; } + public String getPhoneNumber() { return phoneNumber; } + public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } - + @Override public int hashCode() { return Objects.hash(city, email, firstName, id, lastName, phoneNumber, postalCode, state, street); } + @Override public boolean equals(Object obj) { if (this == obj) { @@ -105,20 +121,20 @@ public class CustomerShortNames { return Objects.equals(city, other.city) && Objects.equals(email, other.email) && Objects.equals(firstName, other.firstName) && id == other.id && Objects.equals(lastName, other.lastName) && Objects.equals(phoneNumber, other.phoneNumber) && Objects.equals(postalCode, other.postalCode) && Objects.equals(state, other.state) && Objects.equals(street, other.street); } - + @Override public String toString() { return "CustomerWithShorterAttributes [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", street=" + street + ", postalCode=" + postalCode + ", city=" + city + ", state=" + state + ", phoneNumber=" + phoneNumber + ", email=" + email + "]"; - } + } public static CustomerShortNames[] fromCustomers(Customer[] customers) { - CustomerShortNames[] feedback = new CustomerShortNames[customers.length]; - - for(int i = 0; i < customers.length; i++) { + CustomerShortNames[] feedback = new CustomerShortNames[customers.length]; + + for (int i = 0; i < customers.length; i++) { Customer aCustomer = customers[i]; CustomerShortNames newOne = new CustomerShortNames(); - + newOne.setId(aCustomer.getId()); newOne.setFirstName(aCustomer.getFirstName()); newOne.setLastName(aCustomer.getLastName()); @@ -128,11 +144,11 @@ public class CustomerShortNames { newOne.setState(aCustomer.getState()); newOne.setPhoneNumber(aCustomer.getPhoneNumber()); newOne.setEmail(aCustomer.getEmail()); - + feedback[i] = newOne; } - + return feedback; } - + } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java index d3e9648a98..1b62fb2c06 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java @@ -1,24 +1,22 @@ package com.baeldung.jsonoptimization; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; @JsonInclude(JsonInclude.Include.NON_NULL) public class CustomerShortNamesNoNull extends CustomerShortNames { - - + @Override public String toString() { return "CustomerShortNamesNoNull [toString()=" + super.toString() + "]"; } - + public static CustomerShortNamesNoNull[] fromCustomers(Customer[] customers) { - CustomerShortNamesNoNull[] feedback = new CustomerShortNamesNoNull[customers.length]; - - for(int i = 0; i < customers.length; i++) { + CustomerShortNamesNoNull[] feedback = new CustomerShortNamesNoNull[customers.length]; + + for (int i = 0; i < customers.length; i++) { Customer aCustomer = customers[i]; CustomerShortNamesNoNull newOne = new CustomerShortNamesNoNull(); - + newOne.setId(aCustomer.getId()); newOne.setFirstName(aCustomer.getFirstName()); newOne.setLastName(aCustomer.getLastName()); @@ -28,10 +26,10 @@ public class CustomerShortNamesNoNull extends CustomerShortNames { newOne.setState(aCustomer.getState()); newOne.setPhoneNumber(aCustomer.getPhoneNumber()); newOne.setEmail(aCustomer.getEmail()); - + feedback[i] = newOne; } - + return feedback; } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java index cdfaa4e329..e2ef4664cf 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java @@ -54,21 +54,20 @@ public class CustomerSlim { } public static CustomerSlim[] fromCustomers(Customer[] customers) { - CustomerSlim[] feedback = new CustomerSlim[customers.length]; - - for(int i = 0; i < customers.length; i++) { + CustomerSlim[] feedback = new CustomerSlim[customers.length]; + + for (int i = 0; i < customers.length; i++) { Customer aCustomer = customers[i]; CustomerSlim newOne = new CustomerSlim(); - + newOne.setId(aCustomer.getId()); newOne.setName(aCustomer.getFirstName() + " " + aCustomer.getLastName()); newOne.setAddress(aCustomer.getStreet() + ", " + aCustomer.getCity() + " " + aCustomer.getState() + " " + aCustomer.getPostalCode()); - + feedback[i] = newOne; } - + return feedback; } - } From 1ab520e63a4c148f16a76c890632e6ea9c802a75 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Sat, 5 Sep 2020 18:48:35 +0100 Subject: [PATCH 0649/1862] BAEL-3326, "Optimizing JSON Schema for production use": Optimized imports and formatted source. --- .../baeldung/jsonoptimization/Customer.java | 2 +- .../CustomerDeserializer.java | 32 +++++----- .../jsonoptimization/CustomerNoNull.java | 16 ++--- .../jsonoptimization/CustomerSerializer.java | 8 +-- .../jsonoptimization/CustomerShortNames.java | 58 ++++++++++++------- .../CustomerShortNamesNoNull.java | 18 +++--- .../jsonoptimization/CustomerSlim.java | 13 ++--- .../JsonOptimizationUnitTest.java | 9 ++- 8 files changed, 86 insertions(+), 70 deletions(-) diff --git a/json/src/main/java/com/baeldung/jsonoptimization/Customer.java b/json/src/main/java/com/baeldung/jsonoptimization/Customer.java index 81a74971ea..85451731e9 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/Customer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/Customer.java @@ -116,7 +116,7 @@ public class Customer { public static Customer[] fromMockFile() throws IOException { ObjectMapper objectMapper = new ObjectMapper(); - InputStream jsonFile = new FileInputStream("src/test/resources/json_optimization_mock_data.json"); + InputStream jsonFile = new FileInputStream("src/test/resources/json_optimization_mock_data.json"); Customer[] feedback = objectMapper.readValue(jsonFile, Customer[].class); return feedback; } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java index 1f478ed446..04ab15556a 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java @@ -2,39 +2,43 @@ package com.baeldung.jsonoptimization; import java.io.IOException; -import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.ObjectCodec; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -public class CustomerDeserializer extends StdDeserializer { +public class CustomerDeserializer extends StdDeserializer { private static final long serialVersionUID = 1L; public CustomerDeserializer() { this(null); } - + public CustomerDeserializer(Class t) { super(t); } - + @Override public Customer deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { Customer feedback = new Customer(); ObjectCodec codec = parser.getCodec(); JsonNode node = codec.readTree(parser); - - feedback.setId(node.get(0).asLong()); - feedback.setFirstName(node.get(1).asText()); - feedback.setLastName(node.get(2).asText()); - feedback.setStreet(node.get(3).asText()); - feedback.setPostalCode(node.get(4).asText()); - feedback.setCity(node.get(5).asText()); - feedback.setState(node.get(6).asText()); + + feedback.setId(node.get(0) + .asLong()); + feedback.setFirstName(node.get(1) + .asText()); + feedback.setLastName(node.get(2) + .asText()); + feedback.setStreet(node.get(3) + .asText()); + feedback.setPostalCode(node.get(4) + .asText()); + feedback.setCity(node.get(5) + .asText()); + feedback.setState(node.get(6) + .asText()); JsonNode phoneNumber = node.get(7); feedback.setPhoneNumber(phoneNumber.isNull() ? null : phoneNumber.asText()); JsonNode email = node.get(8); diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java index 1ee76f762a..62cf526f78 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java @@ -4,19 +4,19 @@ import com.fasterxml.jackson.annotation.JsonInclude; @JsonInclude(JsonInclude.Include.NON_NULL) public class CustomerNoNull extends Customer { - + @Override public String toString() { return "CustomerNoNull [toString()=" + super.toString() + "]"; } public static CustomerNoNull[] fromCustomers(Customer[] customers) { - CustomerNoNull[] feedback = new CustomerNoNull[customers.length]; - - for(int i = 0; i < customers.length; i++) { + CustomerNoNull[] feedback = new CustomerNoNull[customers.length]; + + for (int i = 0; i < customers.length; i++) { Customer aCustomer = customers[i]; CustomerNoNull newOne = new CustomerNoNull(); - + newOne.setId(aCustomer.getId()); newOne.setFirstName(aCustomer.getFirstName()); newOne.setLastName(aCustomer.getLastName()); @@ -26,11 +26,11 @@ public class CustomerNoNull extends Customer { newOne.setState(aCustomer.getState()); newOne.setPhoneNumber(aCustomer.getPhoneNumber()); newOne.setEmail(aCustomer.getEmail()); - + feedback[i] = newOne; } - + return feedback; } - + } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java index 7e58010640..0f631ee85b 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java @@ -6,21 +6,21 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; -public class CustomerSerializer extends StdSerializer { +public class CustomerSerializer extends StdSerializer { private static final long serialVersionUID = 1L; public CustomerSerializer() { this(null); } - + public CustomerSerializer(Class t) { super(t); } - + @Override public void serialize(Customer customer, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { jsonGenerator.writeStartArray(); - jsonGenerator.writeNumber(customer.getId()); + jsonGenerator.writeNumber(customer.getId()); jsonGenerator.writeString(customer.getFirstName()); jsonGenerator.writeString(customer.getLastName()); jsonGenerator.writeString(customer.getStreet()); diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java index ffa10f786d..2a47a4bbac 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java @@ -2,97 +2,113 @@ package com.baeldung.jsonoptimization; import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; public class CustomerShortNames { private long id; - + @JsonProperty("f") private String firstName; - + @JsonProperty("l") private String lastName; - + @JsonProperty("s") private String street; - + @JsonProperty("p") private String postalCode; - + @JsonProperty("c") private String city; - + @JsonProperty("a") private String state; - + @JsonProperty("o") private String phoneNumber; - + @JsonProperty("e") private String email; - + public long getId() { return id; } + public void setId(long id) { this.id = id; } + public String getFirstName() { return firstName; } + public void setFirstName(String firstName) { this.firstName = firstName; } + public String getLastName() { return lastName; } + public void setLastName(String lastName) { this.lastName = lastName; } + public String getStreet() { return street; } + public void setStreet(String street) { this.street = street; } + public String getPostalCode() { return postalCode; } + public void setPostalCode(String postalCode) { this.postalCode = postalCode; } + public String getCity() { return city; } + public void setCity(String city) { this.city = city; } + public String getState() { return state; } + public void setState(String state) { this.state = state; } + public String getPhoneNumber() { return phoneNumber; } + public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } + public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } - + @Override public int hashCode() { return Objects.hash(city, email, firstName, id, lastName, phoneNumber, postalCode, state, street); } + @Override public boolean equals(Object obj) { if (this == obj) { @@ -105,20 +121,20 @@ public class CustomerShortNames { return Objects.equals(city, other.city) && Objects.equals(email, other.email) && Objects.equals(firstName, other.firstName) && id == other.id && Objects.equals(lastName, other.lastName) && Objects.equals(phoneNumber, other.phoneNumber) && Objects.equals(postalCode, other.postalCode) && Objects.equals(state, other.state) && Objects.equals(street, other.street); } - + @Override public String toString() { return "CustomerWithShorterAttributes [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", street=" + street + ", postalCode=" + postalCode + ", city=" + city + ", state=" + state + ", phoneNumber=" + phoneNumber + ", email=" + email + "]"; - } + } public static CustomerShortNames[] fromCustomers(Customer[] customers) { - CustomerShortNames[] feedback = new CustomerShortNames[customers.length]; - - for(int i = 0; i < customers.length; i++) { + CustomerShortNames[] feedback = new CustomerShortNames[customers.length]; + + for (int i = 0; i < customers.length; i++) { Customer aCustomer = customers[i]; CustomerShortNames newOne = new CustomerShortNames(); - + newOne.setId(aCustomer.getId()); newOne.setFirstName(aCustomer.getFirstName()); newOne.setLastName(aCustomer.getLastName()); @@ -128,11 +144,11 @@ public class CustomerShortNames { newOne.setState(aCustomer.getState()); newOne.setPhoneNumber(aCustomer.getPhoneNumber()); newOne.setEmail(aCustomer.getEmail()); - + feedback[i] = newOne; } - + return feedback; } - + } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java index d3e9648a98..1b62fb2c06 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java @@ -1,24 +1,22 @@ package com.baeldung.jsonoptimization; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; @JsonInclude(JsonInclude.Include.NON_NULL) public class CustomerShortNamesNoNull extends CustomerShortNames { - - + @Override public String toString() { return "CustomerShortNamesNoNull [toString()=" + super.toString() + "]"; } - + public static CustomerShortNamesNoNull[] fromCustomers(Customer[] customers) { - CustomerShortNamesNoNull[] feedback = new CustomerShortNamesNoNull[customers.length]; - - for(int i = 0; i < customers.length; i++) { + CustomerShortNamesNoNull[] feedback = new CustomerShortNamesNoNull[customers.length]; + + for (int i = 0; i < customers.length; i++) { Customer aCustomer = customers[i]; CustomerShortNamesNoNull newOne = new CustomerShortNamesNoNull(); - + newOne.setId(aCustomer.getId()); newOne.setFirstName(aCustomer.getFirstName()); newOne.setLastName(aCustomer.getLastName()); @@ -28,10 +26,10 @@ public class CustomerShortNamesNoNull extends CustomerShortNames { newOne.setState(aCustomer.getState()); newOne.setPhoneNumber(aCustomer.getPhoneNumber()); newOne.setEmail(aCustomer.getEmail()); - + feedback[i] = newOne; } - + return feedback; } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java index cdfaa4e329..e2ef4664cf 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java @@ -54,21 +54,20 @@ public class CustomerSlim { } public static CustomerSlim[] fromCustomers(Customer[] customers) { - CustomerSlim[] feedback = new CustomerSlim[customers.length]; - - for(int i = 0; i < customers.length; i++) { + CustomerSlim[] feedback = new CustomerSlim[customers.length]; + + for (int i = 0; i < customers.length; i++) { Customer aCustomer = customers[i]; CustomerSlim newOne = new CustomerSlim(); - + newOne.setId(aCustomer.getId()); newOne.setName(aCustomer.getFirstName() + " " + aCustomer.getLastName()); newOne.setAddress(aCustomer.getStreet() + ", " + aCustomer.getCity() + " " + aCustomer.getState() + " " + aCustomer.getPostalCode()); - + feedback[i] = newOne; } - + return feedback; } - } diff --git a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java index e754978cd5..a1dbe08fed 100644 --- a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java +++ b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java @@ -15,7 +15,6 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.Version; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; @@ -77,7 +76,7 @@ class JsonOptimizationUnitTest { byte[] shorterJson = createPlainJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL, shorterOnesNoNull); compressJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL, shorterJson); } - + @Test void testSlim() throws IOException { printBanner(TEST_LABEL_SLIM_CUSTOMER); @@ -89,11 +88,11 @@ class JsonOptimizationUnitTest { @Test void testCustomSerializer() throws IOException { printBanner(TEST_LABEL_CUSTOM_SERIALIZER); - + SimpleModule serializer = new SimpleModule("CustomCustomerSerializer", new Version(1, 0, 0, null, null, null)); serializer.addSerializer(Customer.class, new CustomerSerializer()); mapper.registerModule(serializer); - + SimpleModule deserializer = new SimpleModule("CustomCustomerDeserializer", new Version(1, 0, 0, null, null, null)); deserializer.addDeserializer(Customer.class, new CustomerDeserializer()); mapper.registerModule(deserializer); @@ -135,7 +134,7 @@ class JsonOptimizationUnitTest { fos.write(feedback); fos.close(); System.out.println(label + " file: " + tempFile.toString()); - + Object[] restoredOnes = mapper.readValue(feedback, customers.getClass()); assertArrayEquals(TEST_LABEL_DEFAULT_JSON + ": restoring from JSON should work", customers, restoredOnes); From 777aa4b4ea5da91cb0ca78132bbe33c7adc1c2b8 Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 6 Sep 2020 00:31:09 +0530 Subject: [PATCH 0650/1862] updated spring-data-mongo and used compatible mongo version --- persistence-modules/spring-data-mongodb/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index 46dbc270c3..ec7aa14c36 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -121,7 +121,7 @@ 4.1.0 3.2.0.RELEASE Lovelace-SR9 - 4.1.0 + 4.0.5 From 8415ee8096e64e7b7a57fb0fe85d17024a4d6884 Mon Sep 17 00:00:00 2001 From: Usman Mohyuddin Date: Sun, 6 Sep 2020 00:07:33 +0500 Subject: [PATCH 0651/1862] update the test names as whenX_thenY update the test names as whenX_thenY --- .../com/baeldung/removeprefix/RemovePrefixTest.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy index 568e5fdde8..aa9e65d98d 100644 --- a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy +++ b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy @@ -7,7 +7,7 @@ class RemovePrefixTest { @Test - public void givenWhenCasePrefixIsRemoved_thenReturnTrue() { + public void whenCasePrefixIsRemoved_thenReturnTrue() { def trimPrefix = { it.startsWith('Groovy') ? it.minus('Groovy') : it } @@ -16,7 +16,7 @@ class RemovePrefixTest { } @Test - public void givenWhenPrefixIsRemoved_thenReturnTrue() { + public void whenPrefixIsRemovedWithIgnoreCase_thenReturnTrue() { String prefix = "groovy-" String trimPrefix = "Groovy-Tutorials at Baeldung" @@ -29,7 +29,7 @@ class RemovePrefixTest { } @Test - public void givenWhenPrefixIsRemovedUsingRegex_thenReturnTrue() { + public void whenPrefixIsRemovedUsingRegex_thenReturnTrue() { def regex = ~"^([Gg])roovy-" String trimPrefix = "Groovy-Tutorials at Baeldung" @@ -38,7 +38,7 @@ class RemovePrefixTest { Assert.assertEquals("Tutorials at Baeldung", result) } - @Test public void givenWhenPrefixIsRemovedUsingReplaceFirst_thenReturnTrue() { + @Test public void whenPrefixIsRemovedUsingReplaceFirst_thenReturnTrue() { def regex = ~"^groovy" String trimPrefix = "groovyTutorials at Baeldung's groovy page" String result = trimPrefix.replaceFirst(regex, "") @@ -47,7 +47,7 @@ class RemovePrefixTest { } @Test - public void givenWhenPrefixIsRemovedUsingReplaceAll_thenReturnTrue() { + public void whenPrefixIsRemovedUsingReplaceAll_thenReturnTrue() { String trimPrefix = "groovyTutorials at Baeldung groovy" String result = trimPrefix.replaceAll(/^groovy/, "") From 9d326b55bc5436251c917ecb2c6ddb05493dc2ae Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Sun, 6 Sep 2020 13:23:34 +0100 Subject: [PATCH 0652/1862] BAEL-3326, "Optimizing JSON Schema for production use": More code for slim customer. --- .../CustomerDeserializer.java | 1 + .../jsonoptimization/CustomerShortNames.java | 1 + .../CustomerSlimDeserializer.java | 37 +++++++++ .../CustomerSlimSerializer.java | 28 +++++++ .../CustomerSlimShortNames.java | 81 +++++++++++++++++++ .../JsonOptimizationUnitTest.java | 57 ++++++++----- 6 files changed, 187 insertions(+), 18 deletions(-) create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java create mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java index 04ab15556a..1815c5f202 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java @@ -43,6 +43,7 @@ public class CustomerDeserializer extends StdDeserializer { feedback.setPhoneNumber(phoneNumber.isNull() ? null : phoneNumber.asText()); JsonNode email = node.get(8); feedback.setEmail(email.isNull() ? null : email.asText()); + return feedback; } } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java index 2a47a4bbac..b94fbb1033 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class CustomerShortNames { + @JsonProperty("i") private long id; @JsonProperty("f") diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java new file mode 100644 index 0000000000..9da7b7c873 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java @@ -0,0 +1,37 @@ +package com.baeldung.jsonoptimization; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + +public class CustomerSlimDeserializer extends StdDeserializer { + private static final long serialVersionUID = 1L; + + public CustomerSlimDeserializer() { + this(null); + } + + public CustomerSlimDeserializer(Class t) { + super(t); + } + + @Override + public CustomerSlim deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { + CustomerSlim feedback = new CustomerSlim(); + ObjectCodec codec = parser.getCodec(); + JsonNode node = codec.readTree(parser); + + feedback.setId(node.get(0) + .asLong()); + feedback.setName(node.get(1) + .asText()); + feedback.setAddress(node.get(2) + .asText()); + + return feedback; + } +} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java new file mode 100644 index 0000000000..520c541da6 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java @@ -0,0 +1,28 @@ +package com.baeldung.jsonoptimization; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class CustomerSlimSerializer extends StdSerializer { + private static final long serialVersionUID = 1L; + + public CustomerSlimSerializer() { + this(null); + } + + public CustomerSlimSerializer(Class t) { + super(t); + } + + @Override + public void serialize(CustomerSlim customer, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { + jsonGenerator.writeStartArray(); + jsonGenerator.writeNumber(customer.getId()); + jsonGenerator.writeString(customer.getName()); + jsonGenerator.writeString(customer.getAddress()); + jsonGenerator.writeEndArray(); + } +} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java new file mode 100644 index 0000000000..7bb20a7453 --- /dev/null +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java @@ -0,0 +1,81 @@ +package com.baeldung.jsonoptimization; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CustomerSlimShortNames { + + @JsonProperty("i") + private long id; + + @JsonProperty("n") + private String name; + + @JsonProperty("a") + private String address; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public int hashCode() { + return Objects.hash(address, id, name); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CustomerSlimShortNames)) { + return false; + } + CustomerSlimShortNames other = (CustomerSlimShortNames) obj; + return Objects.equals(address, other.address) && id == other.id && Objects.equals(name, other.name); + } + + @Override + public String toString() { + return "CustomerSlim [id=" + id + ", name=" + name + ", address=" + address + "]"; + } + + public static CustomerSlimShortNames[] fromCustomers(Customer[] customers) { + CustomerSlimShortNames[] feedback = new CustomerSlimShortNames[customers.length]; + + for (int i = 0; i < customers.length; i++) { + Customer aCustomer = customers[i]; + CustomerSlimShortNames newOne = new CustomerSlimShortNames(); + + newOne.setId(aCustomer.getId()); + newOne.setName(aCustomer.getFirstName() + " " + aCustomer.getLastName()); + newOne.setAddress(aCustomer.getStreet() + ", " + aCustomer.getCity() + " " + aCustomer.getState() + " " + aCustomer.getPostalCode()); + + feedback[i] = newOne; + } + + return feedback; + } + +} diff --git a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java index a1dbe08fed..dd5703543f 100644 --- a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java +++ b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java @@ -23,10 +23,12 @@ import com.fasterxml.jackson.databind.module.SimpleModule; class JsonOptimizationUnitTest { private static final String TEST_LABEL_DEFAULT_JSON = "Default JSON"; private static final String TEST_LABEL_DEFAULT_JSON_NO_NULL = "Default JSON without null"; - private static final String TEST_LABEL_SHORTER_ATTRIBUTE_NAMES = "Shorter Attribute Names"; - private static final String TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL = "Shorter Attribute Names without null"; - private static final String TEST_LABEL_CUSTOM_SERIALIZER = "Custom Serializer"; + private static final String TEST_LABEL_SHORT_NAMES = "Shorter attribute names"; + private static final String TEST_LABEL_SHORT_NAMES_NO_NULL = "Shorter attribute names without null"; + private static final String TEST_LABEL_CUSTOM_SERIALIZER = "Custom serializer"; + private static final String TEST_LABEL_SLIM_CUSTOM_SERIALIZER = "Slim custom serializer"; private static final String TEST_LABEL_SLIM_CUSTOMER = "Slim customer"; + private static final String TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES = "Slim customer with shorter attribute names"; private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###,###"); private static Customer[] customers; private ObjectMapper mapper; @@ -62,19 +64,19 @@ class JsonOptimizationUnitTest { } @Test - void testShorterAttributes() throws IOException { - printBanner(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES); + void testShortNames() throws IOException { + printBanner(TEST_LABEL_SHORT_NAMES); CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); - byte[] shorterJson = createPlainJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES, shorterOnes); - compressJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES, shorterJson); + byte[] shorterJson = createPlainJson(TEST_LABEL_SHORT_NAMES, shorterOnes); + compressJson(TEST_LABEL_SHORT_NAMES, shorterJson); } @Test - void testShorterAttributesNoNull() throws IOException { - printBanner(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL); + void testShortNamesNoNull() throws IOException { + printBanner(TEST_LABEL_SHORT_NAMES_NO_NULL); CustomerShortNamesNoNull[] shorterOnesNoNull = CustomerShortNamesNoNull.fromCustomers(customers); - byte[] shorterJson = createPlainJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL, shorterOnesNoNull); - compressJson(TEST_LABEL_SHORTER_ATTRIBUTE_NAMES_NO_NULL, shorterJson); + byte[] shorterJson = createPlainJson(TEST_LABEL_SHORT_NAMES_NO_NULL, shorterOnesNoNull); + compressJson(TEST_LABEL_SHORT_NAMES_NO_NULL, shorterJson); } @Test @@ -85,21 +87,40 @@ class JsonOptimizationUnitTest { compressJson(TEST_LABEL_SLIM_CUSTOMER, slimJson); } + @Test + void testSlimShortNames() throws IOException { + printBanner(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES); + CustomerSlimShortNames[] slimOnes = CustomerSlimShortNames.fromCustomers(customers); + byte[] slimJson = createPlainJson(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimOnes); + compressJson(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimJson); + } + @Test void testCustomSerializer() throws IOException { printBanner(TEST_LABEL_CUSTOM_SERIALIZER); - - SimpleModule serializer = new SimpleModule("CustomCustomerSerializer", new Version(1, 0, 0, null, null, null)); + + SimpleModule serializer = new SimpleModule("CustomDeSerializer", new Version(1, 0, 0, null, null, null)); serializer.addSerializer(Customer.class, new CustomerSerializer()); + serializer.addDeserializer(Customer.class, new CustomerDeserializer()); mapper.registerModule(serializer); - - SimpleModule deserializer = new SimpleModule("CustomCustomerDeserializer", new Version(1, 0, 0, null, null, null)); - deserializer.addDeserializer(Customer.class, new CustomerDeserializer()); - mapper.registerModule(deserializer); - + byte[] plainJson = createPlainJson(TEST_LABEL_CUSTOM_SERIALIZER, customers); compressJson(TEST_LABEL_CUSTOM_SERIALIZER, plainJson); } + + @Test + void testSlimCustomSerializer() throws IOException { + printBanner(TEST_LABEL_SLIM_CUSTOM_SERIALIZER); + + SimpleModule serializer = new SimpleModule("SlimCustomDeSerializer", new Version(1, 0, 0, null, null, null)); + serializer.addSerializer(CustomerSlim.class, new CustomerSlimSerializer()); + serializer.addDeserializer(CustomerSlim.class, new CustomerSlimDeserializer()); + mapper.registerModule(serializer); + + CustomerSlim[] slimOnes = CustomerSlim.fromCustomers(customers); + byte[] plainJson = createPlainJson(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, slimOnes); + compressJson(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, plainJson); + } private void printBanner(String name) { System.out.println(); From 2c78247c95f456fd4ecb8ea197615f002327d922 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Sun, 6 Sep 2020 13:48:39 +0100 Subject: [PATCH 0653/1862] BAEL-3326, "Optimizing JSON Schema for production use": Added percentages, fixed formatting. --- .../jsonoptimization/CustomerDeserializer.java | 2 +- .../CustomerSlimDeserializer.java | 2 +- .../jsonoptimization/CustomerSlimShortNames.java | 6 +++--- .../JsonOptimizationUnitTest.java | 16 +++++++++++----- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java index 1815c5f202..16b66311ad 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java @@ -43,7 +43,7 @@ public class CustomerDeserializer extends StdDeserializer { feedback.setPhoneNumber(phoneNumber.isNull() ? null : phoneNumber.asText()); JsonNode email = node.get(8); feedback.setEmail(email.isNull() ? null : email.asText()); - + return feedback; } } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java index 9da7b7c873..296ee6fdf6 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java @@ -31,7 +31,7 @@ public class CustomerSlimDeserializer extends StdDeserializer { .asText()); feedback.setAddress(node.get(2) .asText()); - + return feedback; } } diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java index 7bb20a7453..bf00e847ac 100644 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java +++ b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java @@ -5,13 +5,13 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; public class CustomerSlimShortNames { - + @JsonProperty("i") private long id; - + @JsonProperty("n") private String name; - + @JsonProperty("a") private String address; diff --git a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java index dd5703543f..2573b34414 100644 --- a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java +++ b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java @@ -32,10 +32,14 @@ class JsonOptimizationUnitTest { private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###,###"); private static Customer[] customers; private ObjectMapper mapper; + private static int defaultJsonLength; @BeforeAll static void setUpOnce() throws Exception { customers = Customer.fromMockFile(); + ObjectMapper oneTimeMapper = new ObjectMapper(); + byte[] feedback = oneTimeMapper.writeValueAsBytes(customers); + defaultJsonLength = feedback.length; } @BeforeEach @@ -98,16 +102,16 @@ class JsonOptimizationUnitTest { @Test void testCustomSerializer() throws IOException { printBanner(TEST_LABEL_CUSTOM_SERIALIZER); - + SimpleModule serializer = new SimpleModule("CustomDeSerializer", new Version(1, 0, 0, null, null, null)); serializer.addSerializer(Customer.class, new CustomerSerializer()); serializer.addDeserializer(Customer.class, new CustomerDeserializer()); mapper.registerModule(serializer); - + byte[] plainJson = createPlainJson(TEST_LABEL_CUSTOM_SERIALIZER, customers); compressJson(TEST_LABEL_CUSTOM_SERIALIZER, plainJson); } - + @Test void testSlimCustomSerializer() throws IOException { printBanner(TEST_LABEL_SLIM_CUSTOM_SERIALIZER); @@ -135,7 +139,8 @@ class JsonOptimizationUnitTest { gzipStream.write(plainJson); gzipStream.close(); byte[] gzippedJson = outpuStream.toByteArray(); - System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(gzippedJson.length)); + int percent = gzippedJson.length * 100 / defaultJsonLength; + System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(gzippedJson.length / 1024) + "kB (" + percent + "%)"); assertTrue(plainJson.length > gzippedJson.length, label + " should be longer than GZIPped data"); } @@ -145,7 +150,8 @@ class JsonOptimizationUnitTest { System.out.println(prettyWritter.writeValueAsString(customers[0])); byte[] feedback = mapper.writeValueAsBytes(customers); - System.out.println(label + " length: " + LENGTH_FORMATTER.format(feedback.length)); + int percent = feedback.length * 100 / defaultJsonLength; + System.out.println(label + " length: " + LENGTH_FORMATTER.format(feedback.length / 1024) + "kB (" + percent + "%)"); assertTrue(feedback.length > 1, label + " should be there"); String prefix = label.replaceAll(" ", "-") From 09e0e958bca4cb749c9608294f1a9ef447685a14 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Sun, 6 Sep 2020 13:49:24 +0100 Subject: [PATCH 0654/1862] BAEL-3326, "Optimizing JSON Schema for production use" Percentages now rounded. --- .../jsonoptimization/JsonOptimizationUnitTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java index 2573b34414..e9bd044869 100644 --- a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java +++ b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java @@ -29,7 +29,8 @@ class JsonOptimizationUnitTest { private static final String TEST_LABEL_SLIM_CUSTOM_SERIALIZER = "Slim custom serializer"; private static final String TEST_LABEL_SLIM_CUSTOMER = "Slim customer"; private static final String TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES = "Slim customer with shorter attribute names"; - private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###,###"); + private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###"); + private static DecimalFormat PERCENT_FORMATTER = new DecimalFormat("###"); private static Customer[] customers; private ObjectMapper mapper; private static int defaultJsonLength; @@ -139,8 +140,9 @@ class JsonOptimizationUnitTest { gzipStream.write(plainJson); gzipStream.close(); byte[] gzippedJson = outpuStream.toByteArray(); - int percent = gzippedJson.length * 100 / defaultJsonLength; - System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(gzippedJson.length / 1024) + "kB (" + percent + "%)"); + double percent = Math.round(gzippedJson.length * 100d / defaultJsonLength); + System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(gzippedJson.length / 1024) + + "kB (" + PERCENT_FORMATTER.format(percent) + "%)"); assertTrue(plainJson.length > gzippedJson.length, label + " should be longer than GZIPped data"); } @@ -150,8 +152,9 @@ class JsonOptimizationUnitTest { System.out.println(prettyWritter.writeValueAsString(customers[0])); byte[] feedback = mapper.writeValueAsBytes(customers); - int percent = feedback.length * 100 / defaultJsonLength; - System.out.println(label + " length: " + LENGTH_FORMATTER.format(feedback.length / 1024) + "kB (" + percent + "%)"); + double percent = Math.round(feedback.length * 100d / defaultJsonLength); + System.out.println(label + " length: " + LENGTH_FORMATTER.format(feedback.length / 1024) + + "kB (" + PERCENT_FORMATTER.format(percent) + "%)"); assertTrue(feedback.length > 1, label + " should be there"); String prefix = label.replaceAll(" ", "-") From be8c51e3e0b585afbb72cb365045722bc8a5cb35 Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 6 Sep 2020 20:05:15 +0530 Subject: [PATCH 0655/1862] removed unwanted dependency from pom --- persistence-modules/spring-data-mongodb/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index ec7aa14c36..fdcaf1d49b 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -19,12 +19,6 @@ ${org.springframework.data.version} - - org.mongodb - mongodb-driver-core - ${mongodb-driver.version} - - org.mongodb mongodb-driver-sync From 1927bb1b460752245b26b441a637138e0eebaaa2 Mon Sep 17 00:00:00 2001 From: developerDiv <34768329+developerDiv@users.noreply.github.com> Date: Sun, 6 Sep 2020 16:27:59 +0100 Subject: [PATCH 0656/1862] BAEL-4287 - Rolling Back Migrations with Flyway (#9910) * First commit - Flyway Undo * Simplify migrations Move to own package --- .../db/undo/V1_0__create_book_table.sql | 6 +++ .../db/undo/V2_0__drop_table_book.sql | 1 + .../FlywayUndoMigrationIntegrationTest.java | 39 +++++++++++++++++++ .../flywayundo/FlywayUndoTestConfig.java | 21 ++++++++++ 4 files changed, 67 insertions(+) create mode 100644 persistence-modules/flyway/src/main/resources/db/undo/V1_0__create_book_table.sql create mode 100644 persistence-modules/flyway/src/main/resources/db/undo/V2_0__drop_table_book.sql create mode 100644 persistence-modules/flyway/src/test/java/com/baeldung/flywayundo/FlywayUndoMigrationIntegrationTest.java create mode 100644 persistence-modules/flyway/src/test/java/com/baeldung/flywayundo/FlywayUndoTestConfig.java diff --git a/persistence-modules/flyway/src/main/resources/db/undo/V1_0__create_book_table.sql b/persistence-modules/flyway/src/main/resources/db/undo/V1_0__create_book_table.sql new file mode 100644 index 0000000000..105da7a0c0 --- /dev/null +++ b/persistence-modules/flyway/src/main/resources/db/undo/V1_0__create_book_table.sql @@ -0,0 +1,6 @@ +create table book ( + id numeric, + title varchar(128), + author varchar(256), + constraint pk_book primary key (id) +); \ No newline at end of file diff --git a/persistence-modules/flyway/src/main/resources/db/undo/V2_0__drop_table_book.sql b/persistence-modules/flyway/src/main/resources/db/undo/V2_0__drop_table_book.sql new file mode 100644 index 0000000000..cd800b00b7 --- /dev/null +++ b/persistence-modules/flyway/src/main/resources/db/undo/V2_0__drop_table_book.sql @@ -0,0 +1 @@ +drop table book; \ No newline at end of file diff --git a/persistence-modules/flyway/src/test/java/com/baeldung/flywayundo/FlywayUndoMigrationIntegrationTest.java b/persistence-modules/flyway/src/test/java/com/baeldung/flywayundo/FlywayUndoMigrationIntegrationTest.java new file mode 100644 index 0000000000..03004baf60 --- /dev/null +++ b/persistence-modules/flyway/src/test/java/com/baeldung/flywayundo/FlywayUndoMigrationIntegrationTest.java @@ -0,0 +1,39 @@ +package com.baeldung.flywayundo; + +import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.MigrationInfo; +import org.flywaydb.core.api.MigrationState; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.sql.DataSource; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@ContextConfiguration(classes = FlywayUndoTestConfig.class) +@SpringBootTest +public class FlywayUndoMigrationIntegrationTest { + + @Autowired + private DataSource dataSource; + + @Test + public void givenMigrationsExist_whenApplyMigrations_migrationsAreSuccessful() { + Flyway flyway = Flyway.configure() + .dataSource(dataSource) + .schemas("undo") + .locations("db/undo") + .load(); + + flyway.migrate(); + + for (MigrationInfo info : flyway.info().all()) { + assertThat(info.getState()).isEqualTo(MigrationState.SUCCESS); + } + } +} diff --git a/persistence-modules/flyway/src/test/java/com/baeldung/flywayundo/FlywayUndoTestConfig.java b/persistence-modules/flyway/src/test/java/com/baeldung/flywayundo/FlywayUndoTestConfig.java new file mode 100644 index 0000000000..5f00626179 --- /dev/null +++ b/persistence-modules/flyway/src/test/java/com/baeldung/flywayundo/FlywayUndoTestConfig.java @@ -0,0 +1,21 @@ +package com.baeldung.flywayundo; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; + +import javax.sql.DataSource; + +@Configuration +public class FlywayUndoTestConfig { + + @Bean + public DataSource createDatasource() { + EmbeddedDatabaseBuilder dbBuilder = new EmbeddedDatabaseBuilder(); + return dbBuilder.setType(EmbeddedDatabaseType.H2) + .setName("DATABASE") + .build(); + } + +} From b7328395a3d893b309dc6d5eda4c877b93242c0d Mon Sep 17 00:00:00 2001 From: Harihar Das Date: Sun, 6 Sep 2020 18:33:35 +0200 Subject: [PATCH 0657/1862] generated gradle wrapper files --- gradle-wrapper/gradle/wrapper/README.md | 35 ++++ .../gradle/wrapper/gradle-wrapper.properties | 5 + gradle-wrapper/gradlew | 183 ++++++++++++++++++ gradle-wrapper/gradlew.bat | 103 ++++++++++ 4 files changed, 326 insertions(+) create mode 100644 gradle-wrapper/gradle/wrapper/README.md create mode 100644 gradle-wrapper/gradle/wrapper/gradle-wrapper.properties create mode 100755 gradle-wrapper/gradlew create mode 100644 gradle-wrapper/gradlew.bat diff --git a/gradle-wrapper/gradle/wrapper/README.md b/gradle-wrapper/gradle/wrapper/README.md new file mode 100644 index 0000000000..892f7a23cb --- /dev/null +++ b/gradle-wrapper/gradle/wrapper/README.md @@ -0,0 +1,35 @@ +The files in this project were generated using gradle wrapper command. +`gradle wrapper` + +To test, download this project on your machine and run the following: +`./wrapper tasks` + +This should generate output similar to: +``` +> Task :tasks + +------------------------------------------------------------ +Tasks runnable from root project +------------------------------------------------------------ + +Build Setup tasks +----------------- +init - Initializes a new Gradle build. +wrapper - Generates Gradle wrapper files. + +Help tasks +---------- +buildEnvironment - Displays all buildscript dependencies declared in root project 'gradle-wrapper'. +components - Displays the components produced by root project 'gradle-wrapper'. [incubating] +dependencies - Displays all dependencies declared in root project 'gradle-wrapper'. +dependencyInsight - Displays the insight into a specific dependency in root project 'gradle-wrapper'. +dependentComponents - Displays the dependent components of components in root project 'gradle-wrapper'. [incubating] +help - Displays a help message. +model - Displays the configuration model of root project 'gradle-wrapper'. [incubating] +outgoingVariants - Displays the outgoing variants of root project 'gradle-wrapper'. +projects - Displays the sub-projects of root project 'gradle-wrapper'. +properties - Displays the properties of root project 'gradle-wrapper'. +tasks - Displays the tasks runnable from root project 'gradle-wrapper'. + +To see all tasks and more detail, run gradlew tasks --all +``` \ No newline at end of file diff --git a/gradle-wrapper/gradle/wrapper/gradle-wrapper.properties b/gradle-wrapper/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..a4b4429748 --- /dev/null +++ b/gradle-wrapper/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradle-wrapper/gradlew b/gradle-wrapper/gradlew new file mode 100755 index 0000000000..2fe81a7d95 --- /dev/null +++ b/gradle-wrapper/gradlew @@ -0,0 +1,183 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradle-wrapper/gradlew.bat b/gradle-wrapper/gradlew.bat new file mode 100644 index 0000000000..9109989e3c --- /dev/null +++ b/gradle-wrapper/gradlew.bat @@ -0,0 +1,103 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega From eed6c93543b18001962ed6c80e62a364d3f97612 Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Sun, 6 Sep 2020 23:29:31 +0200 Subject: [PATCH 0658/1862] Fix dynamic parameter Wrong Gatling usage: randCustId() was only called once. One needs to pass a function. --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index f9b3837759..d253ecab83 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -20,7 +20,7 @@ class RewardsScenario extends Simulation { .repeat(10){ exec(http("transactions_add") .post("/transactions/add/") - .body(StringBody("""{ "customerRewardsId":null,"customerId":""""+ randCustId() + """","transactionDate":null }""")).asJson + .body(StringBody(_ => s"""{ "customerRewardsId":null,"customerId":"${randCustId()}","transactionDate":null }""")).asJson .check(jsonPath("$.id").saveAs("txnId")) .check(jsonPath("$.transactionDate").saveAs("txtDate")) .check(jsonPath("$.customerId").saveAs("custId"))) From bbdce526c75236aebe0d28a06f8eda6868a1ddf6 Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Sun, 6 Sep 2020 23:32:19 +0200 Subject: [PATCH 0659/1862] Fix random cust id generation to reduce collisions The current range causes lots of collisions and the application doesn't handle them gracefully, causing lots of exceptions to get logged and hamerring performance. Use 100,000 like the JMeter test, see https://github.com/slandelle/tutorials/blob/master/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test%20Plan.jmx#L203 --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index d253ecab83..70c7d51748 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -7,7 +7,7 @@ import scala.concurrent.duration._ class RewardsScenario extends Simulation { - def randCustId() = Random.nextInt(99) + def randCustId() = Random.nextInt(100000) val httpProtocol = http.baseUrl("http://localhost:8080") .acceptHeader("text/html,application/json;q=0.9,*/*;q=0.8") From b2643fc0dded537af91306146b72de583fd47bd2 Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Sun, 6 Sep 2020 23:33:17 +0200 Subject: [PATCH 0660/1862] Use ThreadLocalRandom instead of Random which is synchronized --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index 70c7d51748..28314dca08 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -7,7 +7,7 @@ import scala.concurrent.duration._ class RewardsScenario extends Simulation { - def randCustId() = Random.nextInt(100000) + def randCustId() = java.util.concurrent.ThreadLocalRandom.current().nextInt(1, 10000) val httpProtocol = http.baseUrl("http://localhost:8080") .acceptHeader("text/html,application/json;q=0.9,*/*;q=0.8") From a3626ba16c9fbad2f5f8c04390db655cc0ef873c Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Sun, 6 Sep 2020 23:34:37 +0200 Subject: [PATCH 0661/1862] Add missing optional option on the check that captures the reward This shouldn't be an error, it's an expected situation as described in the article. --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index 28314dca08..bda5e07c28 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -28,7 +28,7 @@ class RewardsScenario extends Simulation { .exec(http("get_reward") .get("/rewards/find/${custId}") - .check(jsonPath("$.id").saveAs("rwdId"))) + .check(jsonPath("$.id").optional.saveAs("rwdId"))) .pause(1) .doIf("${rwdId.isUndefined()}"){ From 7c41e378296080881ec0eabf7b394c3e0b063090 Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Sun, 6 Sep 2020 23:37:51 +0200 Subject: [PATCH 0662/1862] Remove the unfair 1 second pauses between requests Those pauses don't exist in the JMeter test. They just artificially reduce the Gatling test's throughput. --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 3 --- 1 file changed, 3 deletions(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index bda5e07c28..f17f5f6124 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -24,12 +24,10 @@ class RewardsScenario extends Simulation { .check(jsonPath("$.id").saveAs("txnId")) .check(jsonPath("$.transactionDate").saveAs("txtDate")) .check(jsonPath("$.customerId").saveAs("custId"))) - .pause(1) .exec(http("get_reward") .get("/rewards/find/${custId}") .check(jsonPath("$.id").optional.saveAs("rwdId"))) - .pause(1) .doIf("${rwdId.isUndefined()}"){ exec(http("rewards_add") @@ -41,7 +39,6 @@ class RewardsScenario extends Simulation { .exec(http("transactions_add") .post("/transactions/add/") .body(StringBody("""{ "customerRewardsId":"${rwdId}","customerId":"${custId}","transactionDate":"${txtDate}" }""")).asJson) - .pause(1) .exec(http("get_reward") .get("/transactions/findAll/${rwdId}")) From 74efd2530ef142902a10b44431d6981d789f577c Mon Sep 17 00:00:00 2001 From: fanatixan Date: Mon, 7 Sep 2020 04:13:25 +0200 Subject: [PATCH 0663/1862] added code snippets for bael-4554 (#9979) --- .../mockito/whenvsdomethods/Employee.java | 11 +++ .../IAmOnHolidayException.java | 5 ++ .../WhenVsDoMethodsUnitTest.java | 90 +++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/whenvsdomethods/Employee.java create mode 100644 testing-modules/mockito-2/src/main/java/com/baeldung/mockito/whenvsdomethods/IAmOnHolidayException.java create mode 100644 testing-modules/mockito-2/src/test/java/com/baeldung/mockito/whenvsdomethods/WhenVsDoMethodsUnitTest.java diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/whenvsdomethods/Employee.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/whenvsdomethods/Employee.java new file mode 100644 index 0000000000..4bbd2843f2 --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/whenvsdomethods/Employee.java @@ -0,0 +1,11 @@ +package com.baeldung.mockito.whenvsdomethods; + +import java.time.DayOfWeek; + +public interface Employee { + + String greet(); + + void work(DayOfWeek day); + +} diff --git a/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/whenvsdomethods/IAmOnHolidayException.java b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/whenvsdomethods/IAmOnHolidayException.java new file mode 100644 index 0000000000..24276ba958 --- /dev/null +++ b/testing-modules/mockito-2/src/main/java/com/baeldung/mockito/whenvsdomethods/IAmOnHolidayException.java @@ -0,0 +1,5 @@ +package com.baeldung.mockito.whenvsdomethods; + +public class IAmOnHolidayException extends RuntimeException { + +} diff --git a/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/whenvsdomethods/WhenVsDoMethodsUnitTest.java b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/whenvsdomethods/WhenVsDoMethodsUnitTest.java new file mode 100644 index 0000000000..8c2b86daf1 --- /dev/null +++ b/testing-modules/mockito-2/src/test/java/com/baeldung/mockito/whenvsdomethods/WhenVsDoMethodsUnitTest.java @@ -0,0 +1,90 @@ +package com.baeldung.mockito.whenvsdomethods; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.BDDMockito.given; +import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.when; + +import java.time.DayOfWeek; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +public class WhenVsDoMethodsUnitTest { + + @Mock + private Employee employee; + + @BeforeEach + void setup() { + MockitoAnnotations.initMocks(this); + } + + @Test + void givenNonVoidMethod_callingWhen_shouldConfigureBehavior() { + // given + when(employee.greet()).thenReturn("Hello"); + + // when + String greeting = employee.greet(); + + // then + assertThat(greeting, is("Hello")); + } + + @Test + void givenNonVoidMethod_callingDoReturn_shouldConfigureBehavior() { + // given + doReturn("Hello").when(employee).greet(); + + // when + String greeting = employee.greet(); + + // then + assertThat(greeting, is("Hello")); + } + + @Test + void givenVoidMethod_callingDoThrow_shouldConfigureBehavior() { + // given + doThrow(new IAmOnHolidayException()).when(employee).work(DayOfWeek.SUNDAY); + + // when + Executable workCall = () -> employee.work(DayOfWeek.SUNDAY); + + // then + assertThrows(IAmOnHolidayException.class, workCall); + } + + @Test + void givenNonVoidMethod_callingGiven_shouldConfigureBehavior() { + // given + given(employee.greet()).willReturn("Hello"); + + // when + String greeting = employee.greet(); + + // then + assertThat(greeting, is("Hello")); + } + + @Test + void givenVoidMethod_callingWillThrow_shouldConfigureBehavior() { + // given + willThrow(new IAmOnHolidayException()).given(employee).work(DayOfWeek.SUNDAY); + + // when + Executable workCall = () -> employee.work(DayOfWeek.SUNDAY); + + // then + assertThrows(IAmOnHolidayException.class, workCall); + } + +} From 8278cc272a86dd4d9f8eb438d809c8aac3e17f30 Mon Sep 17 00:00:00 2001 From: majajoksovic Date: Mon, 7 Sep 2020 04:19:12 +0200 Subject: [PATCH 0664/1862] added braces (#9972) --- .../src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java | 2 +- .../src/main/java/com/baeldung/ssh/jsch/JschDemo.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java b/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java index 05d8034040..8a394640c7 100644 --- a/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java +++ b/libraries-security/src/main/java/com/baeldung/ssh/apachesshd/SshdDemo.java @@ -32,7 +32,7 @@ public class SshdDemo { .getSession()) { session.addPasswordIdentity(password); session.auth() - .verify(5L, TimeUnit.SECONDS); + .verify(defaultTimeoutSeconds, TimeUnit.SECONDS); try (ByteArrayOutputStream responseStream = new ByteArrayOutputStream(); ByteArrayOutputStream errorResponseStream = new ByteArrayOutputStream(); ClientChannel channel = session.createChannel(Channel.CHANNEL_SHELL)) { diff --git a/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java b/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java index 34a40318bb..8a6567bfee 100644 --- a/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java +++ b/libraries-security/src/main/java/com/baeldung/ssh/jsch/JschDemo.java @@ -42,10 +42,12 @@ public class JschDemo { throw new Exception(errorResponse); } } finally { - if (session != null) + if (session != null) { session.disconnect(); - if (channel != null) + } + if (channel != null) { channel.disconnect(); + } } return response; } From d994a5bdbf1353382cccc88a7fc2db51bbd8268f Mon Sep 17 00:00:00 2001 From: Meysam Tamkin Date: Mon, 7 Sep 2020 13:35:07 +0430 Subject: [PATCH 0665/1862] Fix it some changes --- .../junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename testing-modules/junit-5/src/{main => test}/java/com/baeldung/junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java (100%) diff --git a/testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java similarity index 100% rename from testing-modules/junit-5/src/main/java/com/baeldung/junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java rename to testing-modules/junit-5/src/test/java/com/baeldung/junit5/nonstatic/BeforeAndAfterAnnotationsUnitTest.java From 56f09fa1d58d9b3ff3906218e481bc27b2e5c8b8 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Mon, 7 Sep 2020 10:31:03 +0100 Subject: [PATCH 0666/1862] BAEL-3326, "Optimizing JSON Schema for production use" Replaced per-class omission of null values with Jackson setting. --- .../jsonoptimization/CustomerNoNull.java | 36 ----------------- .../CustomerShortNamesNoNull.java | 36 ----------------- .../JsonOptimizationUnitTest.java | 40 +++++++++++-------- 3 files changed, 24 insertions(+), 88 deletions(-) delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java deleted file mode 100644 index 62cf526f78..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerNoNull.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.jsonoptimization; - -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class CustomerNoNull extends Customer { - - @Override - public String toString() { - return "CustomerNoNull [toString()=" + super.toString() + "]"; - } - - public static CustomerNoNull[] fromCustomers(Customer[] customers) { - CustomerNoNull[] feedback = new CustomerNoNull[customers.length]; - - for (int i = 0; i < customers.length; i++) { - Customer aCustomer = customers[i]; - CustomerNoNull newOne = new CustomerNoNull(); - - newOne.setId(aCustomer.getId()); - newOne.setFirstName(aCustomer.getFirstName()); - newOne.setLastName(aCustomer.getLastName()); - newOne.setStreet(aCustomer.getStreet()); - newOne.setCity(aCustomer.getCity()); - newOne.setPostalCode(aCustomer.getPostalCode()); - newOne.setState(aCustomer.getState()); - newOne.setPhoneNumber(aCustomer.getPhoneNumber()); - newOne.setEmail(aCustomer.getEmail()); - - feedback[i] = newOne; - } - - return feedback; - } - -} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java deleted file mode 100644 index 1b62fb2c06..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNamesNoNull.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.jsonoptimization; - -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_NULL) -public class CustomerShortNamesNoNull extends CustomerShortNames { - - @Override - public String toString() { - return "CustomerShortNamesNoNull [toString()=" + super.toString() + "]"; - } - - public static CustomerShortNamesNoNull[] fromCustomers(Customer[] customers) { - CustomerShortNamesNoNull[] feedback = new CustomerShortNamesNoNull[customers.length]; - - for (int i = 0; i < customers.length; i++) { - Customer aCustomer = customers[i]; - CustomerShortNamesNoNull newOne = new CustomerShortNamesNoNull(); - - newOne.setId(aCustomer.getId()); - newOne.setFirstName(aCustomer.getFirstName()); - newOne.setLastName(aCustomer.getLastName()); - newOne.setStreet(aCustomer.getStreet()); - newOne.setCity(aCustomer.getCity()); - newOne.setPostalCode(aCustomer.getPostalCode()); - newOne.setState(aCustomer.getState()); - newOne.setPhoneNumber(aCustomer.getPhoneNumber()); - newOne.setEmail(aCustomer.getEmail()); - - feedback[i] = newOne; - } - - return feedback; - } - -} diff --git a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java index e9bd044869..5734518fad 100644 --- a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java +++ b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java @@ -15,6 +15,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.Version; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; @@ -23,14 +24,14 @@ import com.fasterxml.jackson.databind.module.SimpleModule; class JsonOptimizationUnitTest { private static final String TEST_LABEL_DEFAULT_JSON = "Default JSON"; private static final String TEST_LABEL_DEFAULT_JSON_NO_NULL = "Default JSON without null"; - private static final String TEST_LABEL_SHORT_NAMES = "Shorter attribute names"; - private static final String TEST_LABEL_SHORT_NAMES_NO_NULL = "Shorter attribute names without null"; + private static final String TEST_LABEL_SHORT_NAMES = "Shorter field names"; + private static final String TEST_LABEL_SHORT_NAMES_NO_NULL = "Shorter field names without null"; private static final String TEST_LABEL_CUSTOM_SERIALIZER = "Custom serializer"; private static final String TEST_LABEL_SLIM_CUSTOM_SERIALIZER = "Slim custom serializer"; private static final String TEST_LABEL_SLIM_CUSTOMER = "Slim customer"; - private static final String TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES = "Slim customer with shorter attribute names"; - private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###"); - private static DecimalFormat PERCENT_FORMATTER = new DecimalFormat("###"); + private static final String TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES = "Slim customer with shorter field names"; + private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###.0"); + private static DecimalFormat PERCENT_FORMATTER = new DecimalFormat("###.0"); private static Customer[] customers; private ObjectMapper mapper; private static int defaultJsonLength; @@ -41,6 +42,9 @@ class JsonOptimizationUnitTest { ObjectMapper oneTimeMapper = new ObjectMapper(); byte[] feedback = oneTimeMapper.writeValueAsBytes(customers); defaultJsonLength = feedback.length; + System.out.println(); + System.out.println("Default JSON length: " + defaultJsonLength); + System.out.println(); } @BeforeEach @@ -63,8 +67,8 @@ class JsonOptimizationUnitTest { @Test void testDefaultNoNull() throws IOException { printBanner(TEST_LABEL_DEFAULT_JSON_NO_NULL); - CustomerNoNull[] defaultNoNull = CustomerNoNull.fromCustomers(customers); - byte[] plainJson = createPlainJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, defaultNoNull); + mapper.setSerializationInclusion(Include.NON_NULL); + byte[] plainJson = createPlainJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, customers); compressJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, plainJson); } @@ -79,8 +83,9 @@ class JsonOptimizationUnitTest { @Test void testShortNamesNoNull() throws IOException { printBanner(TEST_LABEL_SHORT_NAMES_NO_NULL); - CustomerShortNamesNoNull[] shorterOnesNoNull = CustomerShortNamesNoNull.fromCustomers(customers); - byte[] shorterJson = createPlainJson(TEST_LABEL_SHORT_NAMES_NO_NULL, shorterOnesNoNull); + CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); + mapper.setSerializationInclusion(Include.NON_NULL); + byte[] shorterJson = createPlainJson(TEST_LABEL_SHORT_NAMES_NO_NULL, shorterOnes); compressJson(TEST_LABEL_SHORT_NAMES_NO_NULL, shorterJson); } @@ -135,13 +140,15 @@ class JsonOptimizationUnitTest { } void compressJson(String label, byte[] plainJson) throws IOException { - ByteArrayOutputStream outpuStream = new ByteArrayOutputStream(); - GZIPOutputStream gzipStream = new GZIPOutputStream(outpuStream); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + GZIPOutputStream gzipStream = new GZIPOutputStream(outputStream); gzipStream.write(plainJson); gzipStream.close(); - byte[] gzippedJson = outpuStream.toByteArray(); - double percent = Math.round(gzippedJson.length * 100d / defaultJsonLength); - System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(gzippedJson.length / 1024) + outputStream.close(); + byte[] gzippedJson = outputStream.toByteArray(); + double length = gzippedJson.length / 1024d; + double percent = gzippedJson.length * 100d / defaultJsonLength; + System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(length) + "kB (" + PERCENT_FORMATTER.format(percent) + "%)"); assertTrue(plainJson.length > gzippedJson.length, label + " should be longer than GZIPped data"); } @@ -152,8 +159,9 @@ class JsonOptimizationUnitTest { System.out.println(prettyWritter.writeValueAsString(customers[0])); byte[] feedback = mapper.writeValueAsBytes(customers); - double percent = Math.round(feedback.length * 100d / defaultJsonLength); - System.out.println(label + " length: " + LENGTH_FORMATTER.format(feedback.length / 1024) + double length = feedback.length / 1024d; + double percent = feedback.length * 100d / defaultJsonLength; + System.out.println(label + " length: " + LENGTH_FORMATTER.format(length) + "kB (" + PERCENT_FORMATTER.format(percent) + "%)"); assertTrue(feedback.length > 1, label + " should be there"); From 8695b88a3ea901cdf982f6171a3067e1fb1b4e51 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Mon, 7 Sep 2020 12:22:18 +0100 Subject: [PATCH 0667/1862] BAEL-3326, "Optimizing JSON Schema for production use": Added article to README.md. --- json/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/json/README.md b/json/README.md index 0e50dcfddb..cfee611f4a 100644 --- a/json/README.md +++ b/json/README.md @@ -13,3 +13,4 @@ This module contains articles about JSON. - [Get a Value by Key in a JSONArray](https://www.baeldung.com/java-jsonarray-get-value-by-key) - [Iterating Over an Instance of org.json.JSONObject](https://www.baeldung.com/jsonobject-iteration) - [Escape JSON String in Java](https://www.baeldung.com/java-json-escaping) +- [Reducing JSON Data Size](https://www.baeldung.com/reducing-json-data-size) From f5b4367c1cc0e9802806e966e488a37552a0bf11 Mon Sep 17 00:00:00 2001 From: Loredana Date: Mon, 7 Sep 2020 14:53:22 +0300 Subject: [PATCH 0668/1862] formatting, remove unneeded dependency --- persistence-modules/spring-data-mongodb/pom.xml | 9 --------- .../src/main/java/com/baeldung/config/MongoConfig.java | 2 +- .../baeldung/transaction/MongoTransactionalLiveTest.java | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index fdcaf1d49b..60e59f5186 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -24,14 +24,6 @@ mongodb-driver-sync ${mongodb-driver.version} - - - - org.springframework.data - spring-data-releasetrain - ${spring-releasetrain} - pom - org.mongodb @@ -114,7 +106,6 @@ 1.1.3 4.1.0 3.2.0.RELEASE - Lovelace-SR9 4.0.5 diff --git a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java index 6851b5df6e..8036bbbca2 100644 --- a/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java +++ b/persistence-modules/spring-data-mongodb/src/main/java/com/baeldung/config/MongoConfig.java @@ -81,7 +81,7 @@ public class MongoConfig extends AbstractMongoClientConfiguration { @Bean MongoTransactionManager transactionManager(MongoDatabaseFactory dbFactory) { - return new MongoTransactionManager(dbFactory); + return new MongoTransactionManager(dbFactory); } } diff --git a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalLiveTest.java b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalLiveTest.java index 6cd9657006..d92296beab 100644 --- a/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalLiveTest.java +++ b/persistence-modules/spring-data-mongodb/src/test/java/com/baeldung/transaction/MongoTransactionalLiveTest.java @@ -2,7 +2,6 @@ package com.baeldung.transaction; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; import java.util.List; @@ -22,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional; import com.baeldung.config.MongoConfig; import com.baeldung.model.User; import com.baeldung.repository.UserRepository; -import com.mongodb.MongoCommandException; /** * From 9c5ed84bd40e660a3a9be21a6f2352f68f49ad31 Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Mon, 7 Sep 2020 21:15:50 +0530 Subject: [PATCH 0669/1862] JAVA-2422: Merge spring-groovy into spring-boot-groovy (#9970) * JAVA-2422: Moved article to spring-boot-groovy * JAVA-2422: removed module spring-groovy * JAVA-2422: Moved spring-boot-groovy inside spring-boot-modules module * JAVA-2422: Added entry to spring-boot-module's pom * JAVA-2422: main pom changes for module movements * JAVA-2422: Renamed test as it needs the app up and running * JAVA-2422: Renamed test to live as it needs App to be running --- pom.xml | 8 +-- spring-boot-groovy/README.md | 3 - spring-boot-modules/pom.xml | 1 + .../spring-boot-groovy/README.md | 9 +++ .../spring-boot-groovy}/pom.xml | 4 +- .../SpringBootGroovyApplication.groovy | 0 .../controller/TodoController.groovy | 0 .../springwithgroovy/entity/Todo.groovy | 0 .../repository/TodoRepository.groovy | 0 .../service/TodoService.groovy | 0 .../service/impl/TodoServiceImpl.groovy | 0 .../com/baeldung}/groovyconfig/BandsBean.java | 2 +- .../groovyconfig/GroovyBeanConfig.groovy | 2 +- .../groovyconfig/JavaBeanConfig.java | 2 +- .../groovyconfig/JavaPersonBean.java | 2 +- .../java/com/baeldung}/spring_groovy/App.java | 2 +- .../baeldung}/spring_groovy/TestConfig.java | 2 +- .../src/main/resources/application.properties | 0 .../main/resources/groovyContextConfig.groovy | 0 .../src/main/resources/logback.xml | 0 .../src/main/resources/xml-bean-config.xml | 2 +- .../springwithgroovy/TodoAppLiveTest.groovy | 7 +- .../GroovyConfigurationUnitTest.java | 7 +- .../JavaConfigurationUnitTest.java | 5 +- .../XmlConfigurationUnitTest.java | 4 +- .../baeldung}/spring_groovy/AppUnitTest.java | 2 +- spring-groovy/.gitignore | 7 -- spring-groovy/README.md | 7 -- spring-groovy/pom.xml | 67 ------------------- 29 files changed, 39 insertions(+), 106 deletions(-) delete mode 100644 spring-boot-groovy/README.md create mode 100644 spring-boot-modules/spring-boot-groovy/README.md rename {spring-boot-groovy => spring-boot-modules/spring-boot-groovy}/pom.xml (94%) rename {spring-boot-groovy => spring-boot-modules/spring-boot-groovy}/src/main/groovy/com/baeldung/springwithgroovy/SpringBootGroovyApplication.groovy (100%) rename {spring-boot-groovy => spring-boot-modules/spring-boot-groovy}/src/main/groovy/com/baeldung/springwithgroovy/controller/TodoController.groovy (100%) rename {spring-boot-groovy => spring-boot-modules/spring-boot-groovy}/src/main/groovy/com/baeldung/springwithgroovy/entity/Todo.groovy (100%) rename {spring-boot-groovy => spring-boot-modules/spring-boot-groovy}/src/main/groovy/com/baeldung/springwithgroovy/repository/TodoRepository.groovy (100%) rename {spring-boot-groovy => spring-boot-modules/spring-boot-groovy}/src/main/groovy/com/baeldung/springwithgroovy/service/TodoService.groovy (100%) rename {spring-boot-groovy => spring-boot-modules/spring-boot-groovy}/src/main/groovy/com/baeldung/springwithgroovy/service/impl/TodoServiceImpl.groovy (100%) rename {spring-groovy/src/main/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung}/groovyconfig/BandsBean.java (89%) rename {spring-groovy/src/main/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung}/groovyconfig/GroovyBeanConfig.groovy (90%) rename {spring-groovy/src/main/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung}/groovyconfig/JavaBeanConfig.java (93%) rename {spring-groovy/src/main/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung}/groovyconfig/JavaPersonBean.java (96%) rename {spring-groovy/src/main/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung}/spring_groovy/App.java (80%) rename {spring-groovy/src/main/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung}/spring_groovy/TestConfig.java (71%) rename {spring-boot-groovy => spring-boot-modules/spring-boot-groovy}/src/main/resources/application.properties (100%) rename {spring-groovy => spring-boot-modules/spring-boot-groovy}/src/main/resources/groovyContextConfig.groovy (100%) rename {spring-groovy => spring-boot-modules/spring-boot-groovy}/src/main/resources/logback.xml (100%) rename {spring-groovy => spring-boot-modules/spring-boot-groovy}/src/main/resources/xml-bean-config.xml (86%) rename spring-boot-groovy/src/test/groovy/com/baeldung/springwithgroovy/TodoAppUnitTest.groovy => spring-boot-modules/spring-boot-groovy/src/test/groovy/com/baeldung/springwithgroovy/TodoAppLiveTest.groovy (93%) rename {spring-groovy/src/test/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung}/groovyconfig/GroovyConfigurationUnitTest.java (90%) rename {spring-groovy/src/test/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung}/groovyconfig/JavaConfigurationUnitTest.java (82%) rename {spring-groovy/src/test/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung}/groovyconfig/XmlConfigurationUnitTest.java (88%) rename {spring-groovy/src/test/java/com/baeldug => spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung}/spring_groovy/AppUnitTest.java (94%) delete mode 100644 spring-groovy/.gitignore delete mode 100644 spring-groovy/README.md delete mode 100644 spring-groovy/pom.xml diff --git a/pom.xml b/pom.xml index ffdfe4cffa..a2e09c0f91 100644 --- a/pom.xml +++ b/pom.xml @@ -655,9 +655,7 @@ spring-ejb spring-exceptions - spring-freemarker - - spring-groovy + spring-freemarker spring-integration @@ -1159,9 +1157,7 @@ spring-ejb spring-exceptions - spring-freemarker - - spring-groovy + spring-freemarker spring-integration diff --git a/spring-boot-groovy/README.md b/spring-boot-groovy/README.md deleted file mode 100644 index d2472a11d0..0000000000 --- a/spring-boot-groovy/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: - -- [Building a Simple Web Application with Spring Boot and Groovy](https://www.baeldung.com/spring-boot-groovy-web-app) diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index 109be01db3..527f7dcad8 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -41,6 +41,7 @@ spring-boot-environment spring-boot-exceptions spring-boot-flowable + spring-boot-groovy spring-boot-jasypt spring-boot-keycloak diff --git a/spring-boot-modules/spring-boot-groovy/README.md b/spring-boot-modules/spring-boot-groovy/README.md new file mode 100644 index 0000000000..73edafb9c0 --- /dev/null +++ b/spring-boot-modules/spring-boot-groovy/README.md @@ -0,0 +1,9 @@ +## Spring Boot Groovy + +This module contains articles about Spring with Groovy + + +### Relevant Articles: + +- [Building a Simple Web Application with Spring Boot and Groovy](https://www.baeldung.com/spring-boot-groovy-web-app) +- [Groovy Bean Definitions](https://www.baeldung.com/spring-groovy-beans) \ No newline at end of file diff --git a/spring-boot-groovy/pom.xml b/spring-boot-modules/spring-boot-groovy/pom.xml similarity index 94% rename from spring-boot-groovy/pom.xml rename to spring-boot-modules/spring-boot-groovy/pom.xml index 9ea8d7b2a9..3392532081 100644 --- a/spring-boot-groovy/pom.xml +++ b/spring-boot-modules/spring-boot-groovy/pom.xml @@ -14,7 +14,7 @@ com.baeldung parent-boot-2 0.0.1-SNAPSHOT - ../parent-boot-2 + ../../parent-boot-2 @@ -72,7 +72,7 @@ - com.baeldung.app.SpringBootGroovyApplication + com.baeldung.springwithgroovy.SpringBootGroovyApplication diff --git a/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/SpringBootGroovyApplication.groovy b/spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/SpringBootGroovyApplication.groovy similarity index 100% rename from spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/SpringBootGroovyApplication.groovy rename to spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/SpringBootGroovyApplication.groovy diff --git a/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/controller/TodoController.groovy b/spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/controller/TodoController.groovy similarity index 100% rename from spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/controller/TodoController.groovy rename to spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/controller/TodoController.groovy diff --git a/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/entity/Todo.groovy b/spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/entity/Todo.groovy similarity index 100% rename from spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/entity/Todo.groovy rename to spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/entity/Todo.groovy diff --git a/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/repository/TodoRepository.groovy b/spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/repository/TodoRepository.groovy similarity index 100% rename from spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/repository/TodoRepository.groovy rename to spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/repository/TodoRepository.groovy diff --git a/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/service/TodoService.groovy b/spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/service/TodoService.groovy similarity index 100% rename from spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/service/TodoService.groovy rename to spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/service/TodoService.groovy diff --git a/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/service/impl/TodoServiceImpl.groovy b/spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/service/impl/TodoServiceImpl.groovy similarity index 100% rename from spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/service/impl/TodoServiceImpl.groovy rename to spring-boot-modules/spring-boot-groovy/src/main/groovy/com/baeldung/springwithgroovy/service/impl/TodoServiceImpl.groovy diff --git a/spring-groovy/src/main/java/com/baeldug/groovyconfig/BandsBean.java b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/BandsBean.java similarity index 89% rename from spring-groovy/src/main/java/com/baeldug/groovyconfig/BandsBean.java rename to spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/BandsBean.java index 1deba5d2f6..29f143c66c 100644 --- a/spring-groovy/src/main/java/com/baeldug/groovyconfig/BandsBean.java +++ b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/BandsBean.java @@ -1,4 +1,4 @@ -package com.baeldug.groovyconfig; +package com.baeldung.groovyconfig; import java.util.ArrayList; import java.util.List; diff --git a/spring-groovy/src/main/java/com/baeldug/groovyconfig/GroovyBeanConfig.groovy b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/GroovyBeanConfig.groovy similarity index 90% rename from spring-groovy/src/main/java/com/baeldug/groovyconfig/GroovyBeanConfig.groovy rename to spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/GroovyBeanConfig.groovy index 32a6fedff0..3237226877 100644 --- a/spring-groovy/src/main/java/com/baeldug/groovyconfig/GroovyBeanConfig.groovy +++ b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/GroovyBeanConfig.groovy @@ -1,4 +1,4 @@ -package com.baeldug.groovyconfig; +package com.baeldung.groovyconfig; beans { javaPesronBean(JavaPersonBean) { diff --git a/spring-groovy/src/main/java/com/baeldug/groovyconfig/JavaBeanConfig.java b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/JavaBeanConfig.java similarity index 93% rename from spring-groovy/src/main/java/com/baeldug/groovyconfig/JavaBeanConfig.java rename to spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/JavaBeanConfig.java index 7c4238ae28..64926f606b 100644 --- a/spring-groovy/src/main/java/com/baeldug/groovyconfig/JavaBeanConfig.java +++ b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/JavaBeanConfig.java @@ -1,4 +1,4 @@ -package com.baeldug.groovyconfig; +package com.baeldung.groovyconfig; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-groovy/src/main/java/com/baeldug/groovyconfig/JavaPersonBean.java b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/JavaPersonBean.java similarity index 96% rename from spring-groovy/src/main/java/com/baeldug/groovyconfig/JavaPersonBean.java rename to spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/JavaPersonBean.java index db988d4abf..da0b92451e 100644 --- a/spring-groovy/src/main/java/com/baeldug/groovyconfig/JavaPersonBean.java +++ b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/groovyconfig/JavaPersonBean.java @@ -1,4 +1,4 @@ -package com.baeldug.groovyconfig; +package com.baeldung.groovyconfig; public class JavaPersonBean { diff --git a/spring-groovy/src/main/java/com/baeldug/spring_groovy/App.java b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/spring_groovy/App.java similarity index 80% rename from spring-groovy/src/main/java/com/baeldug/spring_groovy/App.java rename to spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/spring_groovy/App.java index 1df6681c42..2465683c5f 100644 --- a/spring-groovy/src/main/java/com/baeldug/spring_groovy/App.java +++ b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/spring_groovy/App.java @@ -1,4 +1,4 @@ -package com.baeldug.spring_groovy; +package com.baeldung.spring_groovy; /** * Hello world! diff --git a/spring-groovy/src/main/java/com/baeldug/spring_groovy/TestConfig.java b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/spring_groovy/TestConfig.java similarity index 71% rename from spring-groovy/src/main/java/com/baeldug/spring_groovy/TestConfig.java rename to spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/spring_groovy/TestConfig.java index 474216de4e..04ff38c475 100644 --- a/spring-groovy/src/main/java/com/baeldug/spring_groovy/TestConfig.java +++ b/spring-boot-modules/spring-boot-groovy/src/main/java/com/baeldung/spring_groovy/TestConfig.java @@ -1,4 +1,4 @@ -package com.baeldug.spring_groovy; +package com.baeldung.spring_groovy; import org.springframework.stereotype.Component; diff --git a/spring-boot-groovy/src/main/resources/application.properties b/spring-boot-modules/spring-boot-groovy/src/main/resources/application.properties similarity index 100% rename from spring-boot-groovy/src/main/resources/application.properties rename to spring-boot-modules/spring-boot-groovy/src/main/resources/application.properties diff --git a/spring-groovy/src/main/resources/groovyContextConfig.groovy b/spring-boot-modules/spring-boot-groovy/src/main/resources/groovyContextConfig.groovy similarity index 100% rename from spring-groovy/src/main/resources/groovyContextConfig.groovy rename to spring-boot-modules/spring-boot-groovy/src/main/resources/groovyContextConfig.groovy diff --git a/spring-groovy/src/main/resources/logback.xml b/spring-boot-modules/spring-boot-groovy/src/main/resources/logback.xml similarity index 100% rename from spring-groovy/src/main/resources/logback.xml rename to spring-boot-modules/spring-boot-groovy/src/main/resources/logback.xml diff --git a/spring-groovy/src/main/resources/xml-bean-config.xml b/spring-boot-modules/spring-boot-groovy/src/main/resources/xml-bean-config.xml similarity index 86% rename from spring-groovy/src/main/resources/xml-bean-config.xml rename to spring-boot-modules/spring-boot-groovy/src/main/resources/xml-bean-config.xml index 3b880bbd70..b26f28f7b1 100644 --- a/spring-groovy/src/main/resources/xml-bean-config.xml +++ b/spring-boot-modules/spring-boot-groovy/src/main/resources/xml-bean-config.xml @@ -2,7 +2,7 @@ - + diff --git a/spring-boot-groovy/src/test/groovy/com/baeldung/springwithgroovy/TodoAppUnitTest.groovy b/spring-boot-modules/spring-boot-groovy/src/test/groovy/com/baeldung/springwithgroovy/TodoAppLiveTest.groovy similarity index 93% rename from spring-boot-groovy/src/test/groovy/com/baeldung/springwithgroovy/TodoAppUnitTest.groovy rename to spring-boot-modules/spring-boot-groovy/src/test/groovy/com/baeldung/springwithgroovy/TodoAppLiveTest.groovy index bf8b0ff27f..6ae6ffcd73 100644 --- a/spring-boot-groovy/src/test/groovy/com/baeldung/springwithgroovy/TodoAppUnitTest.groovy +++ b/spring-boot-modules/spring-boot-groovy/src/test/groovy/com/baeldung/springwithgroovy/TodoAppLiveTest.groovy @@ -17,8 +17,11 @@ import com.baeldung.springwithgroovy.entity.Todo import io.restassured.RestAssured import io.restassured.response.Response -class TodoAppUnitTest { - static API_ROOT = 'http://localhost:8081/todo' +// This test requires the com.baeldung.springwithgroovy.SpringBootGroovyApplication to be up +// For that, run the maven build - spring-boot:run on the module + +class TodoAppLiveTest { + static API_ROOT = 'http://localhost:8080/todo' static readingTodoId static writingTodoId diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java b/spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/GroovyConfigurationUnitTest.java similarity index 90% rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java rename to spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/GroovyConfigurationUnitTest.java index dbefba5ba5..bd46ded977 100644 --- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java +++ b/spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/GroovyConfigurationUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldug.groovyconfig; +package com.baeldung.groovyconfig; import static org.junit.Assert.assertEquals; @@ -7,10 +7,13 @@ import java.io.File; import org.junit.Test; import org.springframework.context.support.GenericGroovyApplicationContext; +import com.baeldung.groovyconfig.BandsBean; +import com.baeldung.groovyconfig.JavaPersonBean; + public class GroovyConfigurationUnitTest { private static final String FILE_NAME = "GroovyBeanConfig.groovy"; - private static final String FILE_PATH = "src/main/java/com/baeldug/groovyconfig/"; + private static final String FILE_PATH = "src/main/java/com/baeldung/groovyconfig/"; @Test public void whenGroovyConfig_thenCorrectPerson() throws Exception { diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java b/spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/JavaConfigurationUnitTest.java similarity index 82% rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java rename to spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/JavaConfigurationUnitTest.java index c1e16f1b62..2ab1998853 100644 --- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java +++ b/spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/JavaConfigurationUnitTest.java @@ -1,10 +1,13 @@ -package com.baeldug.groovyconfig; +package com.baeldung.groovyconfig; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import com.baeldung.groovyconfig.JavaBeanConfig; +import com.baeldung.groovyconfig.JavaPersonBean; + public class JavaConfigurationUnitTest { @Test diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java b/spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/XmlConfigurationUnitTest.java similarity index 88% rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java rename to spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/XmlConfigurationUnitTest.java index b8d341ee39..aa9f3bd8f7 100644 --- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java +++ b/spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/groovyconfig/XmlConfigurationUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldug.groovyconfig; +package com.baeldung.groovyconfig; import static org.junit.Assert.*; @@ -6,6 +6,8 @@ import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; +import com.baeldung.groovyconfig.JavaPersonBean; + public class XmlConfigurationUnitTest { @Test diff --git a/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java b/spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/spring_groovy/AppUnitTest.java similarity index 94% rename from spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java rename to spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/spring_groovy/AppUnitTest.java index 3d8fa3e2d8..9702e98ab8 100644 --- a/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java +++ b/spring-boot-modules/spring-boot-groovy/src/test/java/com/baeldung/spring_groovy/AppUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldug.spring_groovy; +package com.baeldung.spring_groovy; import junit.framework.Test; import junit.framework.TestCase; diff --git a/spring-groovy/.gitignore b/spring-groovy/.gitignore deleted file mode 100644 index c17c227305..0000000000 --- a/spring-groovy/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/target/ -/project/ -.classpath -.settings -.eclipse -.idea -.project diff --git a/spring-groovy/README.md b/spring-groovy/README.md deleted file mode 100644 index c3bb5636ba..0000000000 --- a/spring-groovy/README.md +++ /dev/null @@ -1,7 +0,0 @@ -## Spring Groovy - -This module contains articles about Spring with Groovy - -## Relevant Articles: - -- [Groovy Bean Definitions](https://www.baeldung.com/spring-groovy-beans) diff --git a/spring-groovy/pom.xml b/spring-groovy/pom.xml deleted file mode 100644 index ef5613adf6..0000000000 --- a/spring-groovy/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - com.baeldug - spring-groovy - 0.0.1-SNAPSHOT - spring-groovy - jar - http://maven.apache.org - - - com.baeldung - parent-spring-4 - 0.0.1-SNAPSHOT - ../parent-spring-4 - - - - - org.springframework.integration - spring-integration-groovy - ${spring-integration-groovy.version} - - - org.codehaus.groovy - groovy-all - ${groovy-all.version} - - - - - - - maven-compiler-plugin - ${maven-compiler-plugin.version} - - groovy-eclipse-compiler - true - ${java.version} - ${java.version} - ${project.build.sourceEncoding} - - - - org.codehaus.groovy - groovy-eclipse-compiler - ${groovy-eclipse-compiler.version} - - - org.codehaus.groovy - groovy-eclipse-batch - ${groovy-eclipse-batch.version} - - - - - - - - 2.9.2-01 - 2.4.3-01 - 4.3.7.RELEASE - 2.4.12 - - - From 30e4e277e0c6de6c1b43a507787e20fe4858924b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Mon, 7 Sep 2020 18:02:25 +0200 Subject: [PATCH 0670/1862] [JAVA-2427] Migrated spring-drools to parent-spring-5 (#9964) * [JAVA-2427] Migrated spring-drools to parent-spring-5 * [JAVA-2427] Added spring dependencies so that they all have the last version --- spring-drools/pom.xml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/spring-drools/pom.xml b/spring-drools/pom.xml index 5adef4b2a9..8b105158ec 100644 --- a/spring-drools/pom.xml +++ b/spring-drools/pom.xml @@ -8,8 +8,9 @@ com.baeldung - parent-modules - 1.0.0-SNAPSHOT + parent-spring-5 + 0.0.1-SNAPSHOT + ../parent-spring-5 @@ -40,17 +41,40 @@ kie-spring ${drools-version} + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-expression + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + org.springframework spring-test - ${spring-framework.version} + ${spring.version} test 7.0.0.Final - 4.3.3.RELEASE - \ No newline at end of file From b7813034ea4b1d9eaf218f2dfbfda67097c50970 Mon Sep 17 00:00:00 2001 From: fdpro Date: Tue, 8 Sep 2020 11:26:57 +0200 Subject: [PATCH 0671/1862] [JAVA-2540] Deactivate frontend-maven-plugin when using default-first or default-second profile --- .../spring-security-web-react/pom.xml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/spring-security-modules/spring-security-web-react/pom.xml b/spring-security-modules/spring-security-web-react/pom.xml index d0ca6f8c8d..459793f496 100644 --- a/spring-security-modules/spring-security-web-react/pom.xml +++ b/spring-security-modules/spring-security-web-react/pom.xml @@ -163,6 +163,63 @@ + + + default-first + + + + + com.github.eirslett + frontend-maven-plugin + + + + install node and npm + none + + + npm install + none + + + npm run build + none + + + + + + + + default-second + + + + + com.github.eirslett + frontend-maven-plugin + + + + install node and npm + none + + + npm install + none + + + npm run build + none + + + + + + + + 4.3.6.RELEASE From 98bdb5df3650304912a8731e925a5a4c91bf148c Mon Sep 17 00:00:00 2001 From: fdpro Date: Tue, 8 Sep 2020 11:53:26 +0200 Subject: [PATCH 0672/1862] [JAVA-2429] Migrated spring-data-solr module to parent-boot-5 --- persistence-modules/spring-data-solr/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/persistence-modules/spring-data-solr/pom.xml b/persistence-modules/spring-data-solr/pom.xml index 9d96c75082..5386c4f9e1 100644 --- a/persistence-modules/spring-data-solr/pom.xml +++ b/persistence-modules/spring-data-solr/pom.xml @@ -8,9 +8,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-4 + ../../parent-spring-5 From 760d54eb438820d73cfe99d7db03a4c9a346717b Mon Sep 17 00:00:00 2001 From: fdpro Date: Tue, 8 Sep 2020 11:48:05 +0200 Subject: [PATCH 0673/1862] [JAVA-2430] Migrated spring-data-cassandra to parent-boot-5 --- .../spring-data-cassandra/pom.xml | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/persistence-modules/spring-data-cassandra/pom.xml b/persistence-modules/spring-data-cassandra/pom.xml index 0f0aae4ebf..b44324dc46 100644 --- a/persistence-modules/spring-data-cassandra/pom.xml +++ b/persistence-modules/spring-data-cassandra/pom.xml @@ -8,9 +8,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-4 + ../../parent-spring-5 @@ -30,6 +30,31 @@ + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-expression + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + org.springframework spring-test From 924517d16369041874fe5feaf9468b2f31e2400d Mon Sep 17 00:00:00 2001 From: Ricardo Caldas Date: Tue, 8 Sep 2020 12:11:29 -0300 Subject: [PATCH 0674/1862] BAEL-2503 Add a new section in Lombok builder article --- .../builder/RequiredFieldAnnotation.java | 19 ++++++++++++++++++ .../lombok/builder/RequiredFieldOverload.java | 20 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java create mode 100644 lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldOverload.java diff --git a/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java new file mode 100644 index 0000000000..f09f59baea --- /dev/null +++ b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java @@ -0,0 +1,19 @@ +package com.baeldung.lombok.builder; + +import lombok.Builder; +import lombok.NonNull; + +@Builder(builderMethodName = "hiddenBuilder") +public class RequiredFieldAnnotation { + @NonNull + private String name; + private String description; + + public static RequiredFieldAnnotationBuilder builder(String name) { + return hiddenBuilder().name(name); + } + + public void example() { + RequiredFieldAnnotation.builder("NameField").description("Field Description").build(); + } +} diff --git a/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldOverload.java b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldOverload.java new file mode 100644 index 0000000000..6b123e3cbe --- /dev/null +++ b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldOverload.java @@ -0,0 +1,20 @@ +package com.baeldung.lombok.builder; + +import lombok.Builder; +import lombok.NonNull; + +@Builder +public class RequiredFieldOverload { + @NonNull + private String name; + private String description; + + public static RequiredFieldOverloadBuilder builder(String name) { + return new RequiredFieldOverloadBuilder().name(name); + } + + public void example() { + RequiredFieldAnnotation.builder("NameField").description("Field Description").build(); + } + +} From b331b1779ffbc6fdb004333d212f314c4a2c993d Mon Sep 17 00:00:00 2001 From: akeshri Date: Tue, 8 Sep 2020 21:04:43 +0530 Subject: [PATCH 0675/1862] first pair code --- .../mapfirstpair/MapFirstPairService.java | 17 +++ .../mapfirstpair/MapFirstPairServiceImpl.java | 40 ++++++ .../MapFirstPairServiceUnitTest.java | 125 ++++++++++++++++++ hexagonal-architecture/README.md | 17 --- hexagonal-architecture/pom.xml | 48 ------- .../baeldung/hexagonal/architecture/App.java | 16 --- .../hexagonal/architecture/ConsoleApp.java | 50 ------- .../controller/ProductController.java | 55 -------- .../architecture/dtos/ProductDto.java | 72 ---------- .../hexagonal/architecture/model/Product.java | 85 ------------ .../repository/ProductRepository.java | 14 -- .../architecture/service/ProductService.java | 21 --- .../service/ProductServiceImpl.java | 44 ------ .../resources/application-batch.properties | 9 -- .../resources/application-test.properties | 8 -- .../src/main/resources/application.properties | 8 -- .../src/main/resources/db/PRODUCT.sql | 9 -- .../service/ProductServiceTest.java | 43 ------ 18 files changed, 182 insertions(+), 499 deletions(-) create mode 100644 core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairService.java create mode 100644 core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceImpl.java create mode 100644 core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceUnitTest.java delete mode 100644 hexagonal-architecture/README.md delete mode 100644 hexagonal-architecture/pom.xml delete mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java delete mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java delete mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java delete mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java delete mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java delete mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java delete mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java delete mode 100644 hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java delete mode 100644 hexagonal-architecture/src/main/resources/application-batch.properties delete mode 100644 hexagonal-architecture/src/main/resources/application-test.properties delete mode 100644 hexagonal-architecture/src/main/resources/application.properties delete mode 100644 hexagonal-architecture/src/main/resources/db/PRODUCT.sql delete mode 100644 hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairService.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairService.java new file mode 100644 index 0000000000..5d3c4fac32 --- /dev/null +++ b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairService.java @@ -0,0 +1,17 @@ +/** + * + */ +package com.baeldung.collections.mapfirstpair; + +import java.util.Map; + +/** + * @author ASHWINI + * + */ +public interface MapFirstPairService { + + Map.Entry getFirstPairUsingIterator(Map map); + + Map.Entry getFirstPairUsingStream(Map map); +} diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceImpl.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceImpl.java new file mode 100644 index 0000000000..aff6430216 --- /dev/null +++ b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceImpl.java @@ -0,0 +1,40 @@ +/** + * + */ +package com.baeldung.collections.mapfirstpair; + +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +/** + * @author ASHWINI + * + */ +public class MapFirstPairServiceImpl implements MapFirstPairService { + + public Map.Entry getFirstPairUsingIterator(Map map) { + if (map == null || map.size() == 0) + return null; + + Iterator> iterator = map.entrySet() + .iterator(); + + if (iterator.hasNext()) + return iterator.next(); + + return null; + } + + public Map.Entry getFirstPairUsingStream(Map map) { + if (map == null || map.size() == 0) + return null; + + Set> entrySet = map.entrySet(); + + return entrySet.stream() + .findFirst() + .get(); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceUnitTest.java b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceUnitTest.java new file mode 100644 index 0000000000..56e293ffc5 --- /dev/null +++ b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceUnitTest.java @@ -0,0 +1,125 @@ +package com.baeldung.collections.mapfirstpair; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import java.util.AbstractMap; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +public class MapFirstPairServiceUnitTest { + + private MapFirstPairService mapFirstPairService; + + @Before + public void Setup() { + + mapFirstPairService = new MapFirstPairServiceImpl(); + } + + private void populateMapValues(Map map) { + if (map != null) { + map.put(5, "A"); + map.put(1, "B"); + map.put(2, "C"); + } + } + + @Test + public void whenUsingIteratorForHashMap() { + Map hashMap = new HashMap<>(); + populateMapValues(hashMap); + + Map.Entry actualValue = mapFirstPairService.getFirstPairUsingIterator(hashMap); + Map.Entry expectedValue = new AbstractMap.SimpleEntry(1, "B"); + Map.Entry pairInsertedFirst = new AbstractMap.SimpleEntry(5, "A"); + + assertEquals(expectedValue, actualValue); + assertNotEquals(pairInsertedFirst, actualValue); + } + + @Test + public void whenUsingStreamForHashMap() { + Map hashMap = new HashMap<>(); + populateMapValues(hashMap); + Map.Entry actualValue = mapFirstPairService.getFirstPairUsingStream(hashMap); + Map.Entry expectedValue = new AbstractMap.SimpleEntry(1, "B"); + Map.Entry pairInsertedFirst = new AbstractMap.SimpleEntry(5, "A"); + + assertEquals(expectedValue, actualValue); + assertNotEquals(pairInsertedFirst, actualValue); + } + + @Test + public void whenUsingIteratorForLinkedHashMap() { + Map linkedHashMap = new LinkedHashMap<>(); + populateMapValues(linkedHashMap); + Map.Entry actualValue = mapFirstPairService.getFirstPairUsingIterator(linkedHashMap); + Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); + + assertEquals(expectedValue, actualValue); + } + + @Test + public void whenUsingStreamForLinkedHashMap() { + Map linkedHashMap = new LinkedHashMap<>(); + populateMapValues(linkedHashMap); + + Map.Entry actualValue = mapFirstPairService.getFirstPairUsingStream(linkedHashMap); + Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); + + assertEquals(expectedValue, actualValue); + } + + @Test + public void whenAddedAnElementInHashMap_thenFirstPairChangedUsingIterator() { + Map hashMap = new HashMap<>(); + populateMapValues(hashMap); + + hashMap.put(0, "D"); + Map.Entry actualValue = mapFirstPairService.getFirstPairUsingIterator(hashMap); + Map.Entry expectedValue = new AbstractMap.SimpleEntry(0, "D"); + + assertEquals(expectedValue, actualValue); + } + + @Test + public void whenAddedAnElementInHashMap_thenFirstPairChangedUsingStream() { + Map hashMap = new HashMap<>(); + populateMapValues(hashMap); + + hashMap.put(0, "D"); + Map.Entry actualValue = mapFirstPairService.getFirstPairUsingStream(hashMap); + Map.Entry expectedValue = new AbstractMap.SimpleEntry(0, "D"); + + assertEquals(expectedValue, actualValue); + } + + @Test + public void whenAddedAnElementInLinkedHashMap_thenFirstPairRemainUnchangedUsingIterator() { + Map linkedHashMap = new LinkedHashMap<>(); + populateMapValues(linkedHashMap); + + linkedHashMap.put(0, "D"); + Map.Entry actualValue = mapFirstPairService.getFirstPairUsingIterator(linkedHashMap); + Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); + + assertEquals(expectedValue, actualValue); + } + + @Test + public void whenAddedAnElementInLinkedHashMap_thenFirstPairRemainUnchangedUsingStream() { + Map linkedHashMap = new LinkedHashMap<>(); + populateMapValues(linkedHashMap); + + linkedHashMap.put(0, "D"); + Map.Entry actualValue = mapFirstPairService.getFirstPairUsingStream(linkedHashMap); + Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); + + assertEquals(expectedValue, actualValue); + } +} diff --git a/hexagonal-architecture/README.md b/hexagonal-architecture/README.md deleted file mode 100644 index 4dd10368e0..0000000000 --- a/hexagonal-architecture/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Hexagonal Architecture -A quick and practical example of Hexagonal Architecture using Spring boot. - -This application is using h2 database,which can be accessible http:/localhost:8080/h2 - -Main Application schema : hexagonal - -Test Application Schema : hexagonal_test - -1. Rest Api : execute [App](https://github.com/akeshri/tutorials/blob/master/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java) - - Get All products : http://localhost:8080/api/v1/product/all - - Get product by id : http://localhost:8080/api/v1/product/{productId} - - Add a product : http://localhost:8080/api/v1/product/add - For more detail refer [ProductController](https://github.com/akeshri/tutorials/blob/master/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java) - -2. Batch processing : We need to configure active profile as batch i.e. -Dspring.profiles.active=batch and execute [ConsoleApp](https://github.com/akeshri/tutorials/blob/master/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java) -3. Test case : [ProductServiceTest](https://github.com/akeshri/tutorials/blob/master/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java) diff --git a/hexagonal-architecture/pom.xml b/hexagonal-architecture/pom.xml deleted file mode 100644 index d014617639..0000000000 --- a/hexagonal-architecture/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - 4.0.0 - - com.article - hexagonal-architecture - 0.0.1-SNAPSHOT - jar - - org.springframework.boot - spring-boot-starter-parent - 1.3.1.RELEASE - - - hexagonal-architecture - http://maven.apache.org - - - UTF-8 - 1.8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-data-jpa - - - com.h2database - h2 - - - org.springframework.boot - spring-boot-starter-test - test - - - com.fasterxml.jackson.dataformat - jackson-dataformat-csv - - - diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java deleted file mode 100644 index 29dbec470f..0000000000 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/App.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.hexagonal.architecture; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * @author AshwiniKeshri - * - */ - -@SpringBootApplication -public class App { - public static void main(String[] args) { - SpringApplication.run(App.class, args); - } -} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java deleted file mode 100644 index 6aef791893..0000000000 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/ConsoleApp.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baeldung.hexagonal.architecture; - -import java.io.File; -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration; -import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; - -import com.baeldung.hexagonal.architecture.model.Product; -import com.baeldung.hexagonal.architecture.service.ProductService; -import com.fasterxml.jackson.dataformat.csv.CsvMapper; -import com.fasterxml.jackson.dataformat.csv.CsvSchema; - -/** - * @author AshwiniKeshri - * - */ - -@SpringBootApplication(exclude = { EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class }) -public class ConsoleApp implements CommandLineRunner { - @Autowired - private ProductService productService; - - public static void main(String[] args) { - SpringApplication.run(ConsoleApp.class, args); - } - - @Override - public void run(String... args) throws Exception { - String filePath = ""; - if (args != null && args.length == 2 && "Product".equalsIgnoreCase(args[0]) && (filePath = args[1]).length() > 0) { - File sourceFile = new File(filePath); - if (sourceFile.exists()) { - CsvMapper mapper = new CsvMapper(); - List products = mapper.readerFor(Product.class) - .with(CsvSchema.emptySchema() - .withHeader()) - . readValues(sourceFile) - .readAll(); - productService.saveAll(products); - } - - } - - } -} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java deleted file mode 100644 index f54d3268df..0000000000 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/controller/ProductController.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baeldung.hexagonal.architecture.controller; - -import java.util.List; -import java.util.stream.Collectors; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import com.baeldung.hexagonal.architecture.dtos.ProductDto; -import com.baeldung.hexagonal.architecture.model.Product; -import com.baeldung.hexagonal.architecture.service.ProductService; - -/** - * @author AshwiniKeshri - * - */ - -@RestController -@RequestMapping("api/v1/product") -public class ProductController { - - @Autowired - private ProductService productService; - - @RequestMapping(value = "/all", method = RequestMethod.GET) - public List list() { - return productService.findAll() - .stream() - .map(p -> new ProductDto(p)) - .collect(Collectors.toList()); - } - - @RequestMapping(value = "/{productId}", method = RequestMethod.GET) - public ProductDto get(@PathVariable long productId) { - Product p = productService.findById(productId); - return p != null ? new ProductDto(p) : null; - } - - @RequestMapping(value = "/add", method = RequestMethod.POST) - public ProductDto create(@RequestBody ProductDto product) { - Product p = new Product(); - p.setDescription(product.getDescription()); - p.setName(product.getName()); - p.setPrice(product.getPrice()); - p.setQuantity(product.getQuantity()); - Long id = productService.create(p); - product.setId(id); - return product; - } - -} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java deleted file mode 100644 index 51692f56aa..0000000000 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/dtos/ProductDto.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baeldung.hexagonal.architecture.dtos; - -import com.baeldung.hexagonal.architecture.model.Product; - -/** - * @author AshwiniKeshri - * - */ -public class ProductDto { - - private Long id; - - private String name; - - private Long quantity; - - private Double price; - - private String description; - - public ProductDto() { - } - - public ProductDto(Product product) { - this.description = product.getDescription(); - this.id = product.getId(); - this.name = product.getName(); - this.price = product.getPrice(); - this.quantity = product.getQuantity(); - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Long getQuantity() { - return quantity; - } - - public void setQuantity(Long quantity) { - this.quantity = quantity; - } - - public Double getPrice() { - return price; - } - - public void setPrice(Double price) { - this.price = price; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - -} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java deleted file mode 100644 index 697ff68b50..0000000000 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/model/Product.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * - */ -package com.baeldung.hexagonal.architecture.model; - -import java.io.Serializable; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -/** - * @author AshwiniKeshri - * - */ - -@Entity -@Table(name = "PRODUCT") -public class Product implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 4000353732860709995L; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - private Long id; - - @Column(name = "NAME") - private String name; - - @Column(name = "QUANTITY") - private Long quantity; - - @Column(name = "PRICE") - private Double price; - - @Column(name = "DESCRIPTION") - private String description; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Long getQuantity() { - return quantity; - } - - public void setQuantity(Long quantity) { - this.quantity = quantity > 0 ? quantity : 0; - } - - public Double getPrice() { - return price; - } - - public void setPrice(Double price) { - this.price = price == null ? 0.0 : price; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - -} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java deleted file mode 100644 index ec50e86dc3..0000000000 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/repository/ProductRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.hexagonal.architecture.repository; - -import org.springframework.data.jpa.repository.JpaRepository; - -import com.baeldung.hexagonal.architecture.model.Product; - -/** - * @author AshwiniKeshri - * - */ - -public interface ProductRepository extends JpaRepository { - -} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java deleted file mode 100644 index 4844723140..0000000000 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.hexagonal.architecture.service; - -import java.util.List; - -import com.baeldung.hexagonal.architecture.model.Product; - -/** - * @author AshwiniKeshri - * - */ - -public interface ProductService { - - List findAll(); - - Product findById(long id); - - Long create(Product product); - - void saveAll(List products); -} diff --git a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java b/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java deleted file mode 100644 index e2d182a954..0000000000 --- a/hexagonal-architecture/src/main/java/com/baeldung/hexagonal/architecture/service/ProductServiceImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.hexagonal.architecture.service; - -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.baeldung.hexagonal.architecture.model.Product; -import com.baeldung.hexagonal.architecture.repository.ProductRepository; - -/** - * @author AshwiniKeshri - * - */ - -@Service -public class ProductServiceImpl implements ProductService { - - private Logger logger = LoggerFactory.getLogger(ProductServiceImpl.class); - - @Autowired - private ProductRepository productRepository; - - public List findAll() { - return productRepository.findAll(); - } - - public Product findById(long id) { - return productRepository.findOne(id); - } - - public Long create(Product product) { - product = productRepository.saveAndFlush(product); - return product.getId(); - } - - @Override - public void saveAll(List products) { - productRepository.save(products); - } - -} diff --git a/hexagonal-architecture/src/main/resources/application-batch.properties b/hexagonal-architecture/src/main/resources/application-batch.properties deleted file mode 100644 index 8c83d19f74..0000000000 --- a/hexagonal-architecture/src/main/resources/application-batch.properties +++ /dev/null @@ -1,9 +0,0 @@ -spring.main.web-environment=false -spring.jpa.hibernate.ddl-auto=false; -spring.h2.console.enabled=true -spring.h2.console.path=/h2 - -spring.datasource.url=jdbc:h2:file:~/hexagonal -spring.datasource.username=sa -spring.datasource.password= -spring.datasource.driver-class-name=org.h2.Driver \ No newline at end of file diff --git a/hexagonal-architecture/src/main/resources/application-test.properties b/hexagonal-architecture/src/main/resources/application-test.properties deleted file mode 100644 index 701313a878..0000000000 --- a/hexagonal-architecture/src/main/resources/application-test.properties +++ /dev/null @@ -1,8 +0,0 @@ -spring.jpa.hibernate.ddl-auto=false; -spring.h2.console.enabled=true -spring.h2.console.path=/h2 - -spring.datasource.url=jdbc:h2:file:~/hexagonal_test -spring.datasource.username=sa -spring.datasource.password= -spring.datasource.driver-class-name=org.h2.Driver \ No newline at end of file diff --git a/hexagonal-architecture/src/main/resources/application.properties b/hexagonal-architecture/src/main/resources/application.properties deleted file mode 100644 index 14c80a1af4..0000000000 --- a/hexagonal-architecture/src/main/resources/application.properties +++ /dev/null @@ -1,8 +0,0 @@ -spring.jpa.hibernate.ddl-auto=false; -spring.h2.console.enabled=true -spring.h2.console.path=/h2 - -spring.datasource.url=jdbc:h2:file:~/hexagonal -spring.datasource.username=sa -spring.datasource.password= -spring.datasource.driver-class-name=org.h2.Driver \ No newline at end of file diff --git a/hexagonal-architecture/src/main/resources/db/PRODUCT.sql b/hexagonal-architecture/src/main/resources/db/PRODUCT.sql deleted file mode 100644 index a0fef3a710..0000000000 --- a/hexagonal-architecture/src/main/resources/db/PRODUCT.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE PRODUCT( - ID INT AUTO_INCREMENT, - NAME VARCHAR(255), - QUANTITY INTEGER, - PRICE DOUBLE, - DESCRIPTION VARCHAR(1000), -); - -INSERT INTO PRODUCT(NAME,QUANTITY,PRICE,DESCRIPTION) VALUES ('iPhone 11 Pro',10,300,'First triple camera system'); \ No newline at end of file diff --git a/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java b/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java deleted file mode 100644 index 748df3c0d0..0000000000 --- a/hexagonal-architecture/src/test/java/com/baeldung/hexagonal/architecture/service/ProductServiceTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * - */ -package com.baeldung.hexagonal.architecture.service; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.SpringApplicationConfiguration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.context.annotation.PropertySources; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.hexagonal.architecture.App; -import com.baeldung.hexagonal.architecture.model.Product; -import com.baeldung.hexagonal.architecture.service.ProductService; - -/** - * @author AshwiniKeshri - * - */ -@RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(App.class) -@ActiveProfiles(value = "test") -public class ProductServiceTest { - - @Autowired - private ProductService productService; - - @Test - public void testCreateProduct() { - Product product = new Product(); - product.setDescription("test product"); - product.setName("Product1"); - product.setPrice(10.0); - product.setQuantity(100l); - Long id = productService.create(product); - Assert.assertTrue(id > 0); - } - -} From 64b7dec1b0c761e322c304a1176ecdc8b38579ab Mon Sep 17 00:00:00 2001 From: akeshri Date: Tue, 8 Sep 2020 21:14:28 +0530 Subject: [PATCH 0676/1862] changes --- map-first-key-tutorial/README.md | 4 -- .../com/baeldung/article/HashMapExample.java | 36 ------------------ .../article/LinkedHashMapExample.java | 37 ------------------- 3 files changed, 77 deletions(-) delete mode 100644 map-first-key-tutorial/README.md delete mode 100644 map-first-key-tutorial/src/com/baeldung/article/HashMapExample.java delete mode 100644 map-first-key-tutorial/src/com/baeldung/article/LinkedHashMapExample.java diff --git a/map-first-key-tutorial/README.md b/map-first-key-tutorial/README.md deleted file mode 100644 index 13fb71643b..0000000000 --- a/map-first-key-tutorial/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# HashMap - Getting First Key And Value -A example on how to get first key and value from HashMap. - -- JDK 1.8 and above \ No newline at end of file diff --git a/map-first-key-tutorial/src/com/baeldung/article/HashMapExample.java b/map-first-key-tutorial/src/com/baeldung/article/HashMapExample.java deleted file mode 100644 index 3292d995ab..0000000000 --- a/map-first-key-tutorial/src/com/baeldung/article/HashMapExample.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.article; - -import java.util.AbstractMap; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -/** - * @author AshwiniKeshri - * - */ -public class HashMapExample { - public static void main(String[] args) { - - Map hashmap = new HashMap<>(); - hashmap.put(5, "A"); - hashmap.put(1, "B"); - hashmap.put(2, "C"); - // hashmap.put(0, "D"); - - System.out.println(hashmap); - - Set> entrySet = hashmap.entrySet(); - - Iterator> iterator = entrySet.iterator(); - - if (iterator.hasNext()) - System.out.println("Using Iteraor: " + iterator.next()); - - System.out.println("Using Stream: " + entrySet.stream() - .findFirst() - .orElse(new AbstractMap.SimpleEntry(-1, "DEFAULT"))); - - } -} diff --git a/map-first-key-tutorial/src/com/baeldung/article/LinkedHashMapExample.java b/map-first-key-tutorial/src/com/baeldung/article/LinkedHashMapExample.java deleted file mode 100644 index 249b9a0585..0000000000 --- a/map-first-key-tutorial/src/com/baeldung/article/LinkedHashMapExample.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.article; - -import java.util.AbstractMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -/** - * @author AshwiniKeshri - * - */ -public class LinkedHashMapExample { - - public static void main(String[] args) { - - LinkedHashMap linkedHashMap = new LinkedHashMap<>(); - linkedHashMap.put(5, "A"); - linkedHashMap.put(1, "B"); - linkedHashMap.put(2, "C"); - // linkedHashMap.put(0, "D"); - - System.out.println(linkedHashMap); - - Set> entrySet = linkedHashMap.entrySet(); - - Iterator> iterator = entrySet.iterator(); - - if (iterator.hasNext()) - System.out.println("Using Iterator: " + iterator.next()); - - System.out.println("Using Stream: " + entrySet.stream() - .findFirst() - .orElse(new AbstractMap.SimpleEntry(0, "DEFAULT"))); - } - -} From 0748a7534ff97866d1418f45eb0783db476439d7 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Tue, 8 Sep 2020 21:09:16 +0430 Subject: [PATCH 0677/1862] Non-Local Returns (#9934) --- .../main/kotlin/com/baeldung/inline/Inline.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt index 3b179642ba..aaa6616ed1 100644 --- a/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt @@ -22,6 +22,30 @@ fun main() { numbers.each { println(random * it) } // capturing the random variable } +fun namedFunction(): Int { + return 42 +} + +fun anonymous(): () -> Int { + return fun(): Int { + return 42 + } +} + +inline fun List.eachIndexed(f: (Int, T) -> Unit) { + for (i in indices) { + f(i, this[i]) + } +} + +fun List.indexOf(x: T): Int { + eachIndexed { index, value -> + if (value == x) return index + } + + return -1 +} + /** * Generates a random number. */ From bf63939b9666a0ec8e122ebc837ed2126d78de57 Mon Sep 17 00:00:00 2001 From: Sam Millington Date: Tue, 8 Sep 2020 17:44:31 +0100 Subject: [PATCH 0678/1862] Revert "Non-Local Returns (#9934)" This reverts commit 0748a7534ff97866d1418f45eb0783db476439d7. --- .../main/kotlin/com/baeldung/inline/Inline.kt | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt index aaa6616ed1..3b179642ba 100644 --- a/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt +++ b/core-kotlin-modules/core-kotlin-lang/src/main/kotlin/com/baeldung/inline/Inline.kt @@ -22,30 +22,6 @@ fun main() { numbers.each { println(random * it) } // capturing the random variable } -fun namedFunction(): Int { - return 42 -} - -fun anonymous(): () -> Int { - return fun(): Int { - return 42 - } -} - -inline fun List.eachIndexed(f: (Int, T) -> Unit) { - for (i in indices) { - f(i, this[i]) - } -} - -fun List.indexOf(x: T): Int { - eachIndexed { index, value -> - if (value == x) return index - } - - return -1 -} - /** * Generates a random number. */ From ece4d65065f96f074e21c3ab59fbf6258fc9f6b9 Mon Sep 17 00:00:00 2001 From: akeshri Date: Wed, 9 Sep 2020 09:34:10 +0530 Subject: [PATCH 0679/1862] changes --- .../mapfirstpair/MapFirstPairExample.java | 42 +++++++++++++++ .../mapfirstpair/MapFirstPairService.java | 17 ------ .../mapfirstpair/MapFirstPairServiceImpl.java | 40 -------------- ...nitTest.java => MapFirstPairUnitTest.java} | 54 ++++++++----------- 4 files changed, 65 insertions(+), 88 deletions(-) create mode 100644 core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairExample.java delete mode 100644 core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairService.java delete mode 100644 core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceImpl.java rename core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/{MapFirstPairServiceUnitTest.java => MapFirstPairUnitTest.java} (61%) diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairExample.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairExample.java new file mode 100644 index 0000000000..8e5fc296d4 --- /dev/null +++ b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairExample.java @@ -0,0 +1,42 @@ +package com.baeldung.collections.mapfirstpair; + +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +public class MapFirstPairExample { + + public Map.Entry getFirstPairUsingIterator(Map map) { + if (map == null || map.size() == 0) + return null; + + Iterator> iterator = map.entrySet() + .iterator(); + + if (iterator.hasNext()) + return iterator.next(); + + return null; + } + + public Map.Entry getFirstPairUsingStream(Map map) { + if (map == null || map.size() == 0) + return null; + + Set> entrySet = map.entrySet(); + + return entrySet.stream() + .findFirst() + .get(); + } + + public Map populateMapValues(Map map) { + if (map != null) { + map.put(5, "A"); + map.put(1, "B"); + map.put(2, "C"); + } + return map; + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairService.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairService.java deleted file mode 100644 index 5d3c4fac32..0000000000 --- a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairService.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * - */ -package com.baeldung.collections.mapfirstpair; - -import java.util.Map; - -/** - * @author ASHWINI - * - */ -public interface MapFirstPairService { - - Map.Entry getFirstPairUsingIterator(Map map); - - Map.Entry getFirstPairUsingStream(Map map); -} diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceImpl.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceImpl.java deleted file mode 100644 index aff6430216..0000000000 --- a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - */ -package com.baeldung.collections.mapfirstpair; - -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -/** - * @author ASHWINI - * - */ -public class MapFirstPairServiceImpl implements MapFirstPairService { - - public Map.Entry getFirstPairUsingIterator(Map map) { - if (map == null || map.size() == 0) - return null; - - Iterator> iterator = map.entrySet() - .iterator(); - - if (iterator.hasNext()) - return iterator.next(); - - return null; - } - - public Map.Entry getFirstPairUsingStream(Map map) { - if (map == null || map.size() == 0) - return null; - - Set> entrySet = map.entrySet(); - - return entrySet.stream() - .findFirst() - .get(); - } - -} \ No newline at end of file diff --git a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceUnitTest.java b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java similarity index 61% rename from core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceUnitTest.java rename to core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java index 56e293ffc5..c8198bcc02 100644 --- a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairServiceUnitTest.java +++ b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java @@ -11,30 +11,22 @@ import java.util.Map; import org.junit.Before; import org.junit.Test; -public class MapFirstPairServiceUnitTest { +public class MapFirstPairUnitTest { - private MapFirstPairService mapFirstPairService; + private MapFirstPairExample mapFirstPairExample; @Before public void Setup() { - mapFirstPairService = new MapFirstPairServiceImpl(); - } - - private void populateMapValues(Map map) { - if (map != null) { - map.put(5, "A"); - map.put(1, "B"); - map.put(2, "C"); - } + mapFirstPairExample = new MapFirstPairExample(); } @Test - public void whenUsingIteratorForHashMap() { + public void whenUsingIteratorForHashMap_thenFirstPairWhichWasNotInsertedFirst() { Map hashMap = new HashMap<>(); - populateMapValues(hashMap); + hashMap = mapFirstPairExample.populateMapValues(hashMap); - Map.Entry actualValue = mapFirstPairService.getFirstPairUsingIterator(hashMap); + Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingIterator(hashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(1, "B"); Map.Entry pairInsertedFirst = new AbstractMap.SimpleEntry(5, "A"); @@ -43,10 +35,10 @@ public class MapFirstPairServiceUnitTest { } @Test - public void whenUsingStreamForHashMap() { + public void whenUsingStreamForHashMap_thenFirstPairWhichWasNotInsertedFirst() { Map hashMap = new HashMap<>(); - populateMapValues(hashMap); - Map.Entry actualValue = mapFirstPairService.getFirstPairUsingStream(hashMap); + hashMap = mapFirstPairExample.populateMapValues(hashMap); + Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingStream(hashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(1, "B"); Map.Entry pairInsertedFirst = new AbstractMap.SimpleEntry(5, "A"); @@ -55,21 +47,21 @@ public class MapFirstPairServiceUnitTest { } @Test - public void whenUsingIteratorForLinkedHashMap() { + public void whenUsingIteratorForLinkedHashMap_thenFirstPairWhichWasInsertedFirst() { Map linkedHashMap = new LinkedHashMap<>(); - populateMapValues(linkedHashMap); - Map.Entry actualValue = mapFirstPairService.getFirstPairUsingIterator(linkedHashMap); + linkedHashMap = mapFirstPairExample.populateMapValues(linkedHashMap); + Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingIterator(linkedHashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); assertEquals(expectedValue, actualValue); } @Test - public void whenUsingStreamForLinkedHashMap() { + public void whenUsingStreamForLinkedHashMap_thenFirstPairWhichWasInsertedFirst() { Map linkedHashMap = new LinkedHashMap<>(); - populateMapValues(linkedHashMap); + linkedHashMap = mapFirstPairExample.populateMapValues(linkedHashMap); - Map.Entry actualValue = mapFirstPairService.getFirstPairUsingStream(linkedHashMap); + Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingStream(linkedHashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); assertEquals(expectedValue, actualValue); @@ -78,10 +70,10 @@ public class MapFirstPairServiceUnitTest { @Test public void whenAddedAnElementInHashMap_thenFirstPairChangedUsingIterator() { Map hashMap = new HashMap<>(); - populateMapValues(hashMap); + hashMap = mapFirstPairExample.populateMapValues(hashMap); hashMap.put(0, "D"); - Map.Entry actualValue = mapFirstPairService.getFirstPairUsingIterator(hashMap); + Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingIterator(hashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(0, "D"); assertEquals(expectedValue, actualValue); @@ -90,10 +82,10 @@ public class MapFirstPairServiceUnitTest { @Test public void whenAddedAnElementInHashMap_thenFirstPairChangedUsingStream() { Map hashMap = new HashMap<>(); - populateMapValues(hashMap); + hashMap = mapFirstPairExample.populateMapValues(hashMap); hashMap.put(0, "D"); - Map.Entry actualValue = mapFirstPairService.getFirstPairUsingStream(hashMap); + Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingStream(hashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(0, "D"); assertEquals(expectedValue, actualValue); @@ -102,10 +94,10 @@ public class MapFirstPairServiceUnitTest { @Test public void whenAddedAnElementInLinkedHashMap_thenFirstPairRemainUnchangedUsingIterator() { Map linkedHashMap = new LinkedHashMap<>(); - populateMapValues(linkedHashMap); + linkedHashMap = mapFirstPairExample.populateMapValues(linkedHashMap); linkedHashMap.put(0, "D"); - Map.Entry actualValue = mapFirstPairService.getFirstPairUsingIterator(linkedHashMap); + Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingIterator(linkedHashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); assertEquals(expectedValue, actualValue); @@ -114,10 +106,10 @@ public class MapFirstPairServiceUnitTest { @Test public void whenAddedAnElementInLinkedHashMap_thenFirstPairRemainUnchangedUsingStream() { Map linkedHashMap = new LinkedHashMap<>(); - populateMapValues(linkedHashMap); + linkedHashMap = mapFirstPairExample.populateMapValues(linkedHashMap); linkedHashMap.put(0, "D"); - Map.Entry actualValue = mapFirstPairService.getFirstPairUsingStream(linkedHashMap); + Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingStream(linkedHashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); assertEquals(expectedValue, actualValue); From 1876f16449519f8240b1519a0f62e555a78b9e25 Mon Sep 17 00:00:00 2001 From: fdpro Date: Wed, 9 Sep 2020 10:02:27 +0200 Subject: [PATCH 0680/1862] [JAVA-2433] Inherited from parent-spring-5 --- .../spring-security-web-digest-auth/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-security-modules/spring-security-web-digest-auth/pom.xml b/spring-security-modules/spring-security-web-digest-auth/pom.xml index 2579a11f97..39433c1295 100644 --- a/spring-security-modules/spring-security-web-digest-auth/pom.xml +++ b/spring-security-modules/spring-security-web-digest-auth/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-4 + ../../parent-spring-5 From 1624cd3387f6a2f02d59d7fd75d72d0cee4d4470 Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Wed, 9 Sep 2020 08:18:38 -0500 Subject: [PATCH 0681/1862] Update core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java Co-authored-by: KevinGilmore --- .../checkclassexistence/CheckClassExistenceUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java index 2e500b390f..04c1ad0115 100644 --- a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java @@ -13,7 +13,7 @@ public class CheckClassExistenceUnitTest { } @Test(expected = ClassNotFoundException.class) //thrown when class does not exist - public void givenNonExistingClass_whenUsingForName_classNotFound() throws ClassNotFoundException { + public void givenNonExistingClass_whenUsingForName_thenClassNotFound() throws ClassNotFoundException { Class.forName("class.that.does.not.exist"); } From 576d3c5f425ae49caf9f5f0eb255bd70ef0a05c5 Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Wed, 9 Sep 2020 08:18:46 -0500 Subject: [PATCH 0682/1862] Update core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java Co-authored-by: KevinGilmore --- .../checkclassexistence/CheckClassExistenceUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java index 04c1ad0115..aef7e686b5 100644 --- a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java @@ -18,7 +18,7 @@ public class CheckClassExistenceUnitTest { } @Test - public void givenExistingClass_whenUsingForName_noException() throws ClassNotFoundException { + public void givenExistingClass_whenUsingForName_thenNoException() throws ClassNotFoundException { Class.forName("java.lang.String"); } From 10efba315d22e7d69e8ee1b775b753a94d54d95c Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Wed, 9 Sep 2020 08:18:51 -0500 Subject: [PATCH 0683/1862] Update core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java Co-authored-by: KevinGilmore --- .../checkclassexistence/CheckClassExistenceUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java index aef7e686b5..cf455a6e35 100644 --- a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java @@ -23,7 +23,7 @@ public class CheckClassExistenceUnitTest { } @Test(expected = ExceptionInInitializerError.class) //thrown when exception occurs inside of a static initialization block - public void givenInitializingClass_whenUsingForName_initializationError() throws ClassNotFoundException { + public void givenInitializingClass_whenUsingForName_thenInitializationError() throws ClassNotFoundException { Class.forName("com.baeldung.checkclassexistence.CheckClassExistenceUnitTest$InitializingClass"); } From cf15c1b002d0aa5ff917f6f906631298ac424e05 Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Wed, 9 Sep 2020 08:18:57 -0500 Subject: [PATCH 0684/1862] Update core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java Co-authored-by: KevinGilmore --- .../checkclassexistence/CheckClassExistenceUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java index cf455a6e35..b565f9de31 100644 --- a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/checkclassexistence/CheckClassExistenceUnitTest.java @@ -28,7 +28,7 @@ public class CheckClassExistenceUnitTest { } @Test - public void givenInitializingClass_whenUsingForNameWithoutInitialization_noException() throws ClassNotFoundException { + public void givenInitializingClass_whenUsingForNameWithoutInitialization_thenNoException() throws ClassNotFoundException { Class.forName("com.baeldung.checkclassexistence.CheckClassExistenceUnitTest$InitializingClass", false, getClass().getClassLoader()); } } From 99381e0b1528cfe703b30de3d38eea7aaa839df5 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Wed, 9 Sep 2020 18:35:31 +0200 Subject: [PATCH 0685/1862] BAEL-4588: Update Guide To Java 8 Optional (#9995) * BAEL-4588: Fix maven-shade-plugin version * BAEL-4588: Add empty core-java-11-2 module structure * BAEL-4588: Move Guide To Java 8 Optional to core-java-11-2 * BAEL-4588: Add Java 10 orElseThrow() example --- core-java-modules/core-java-11-2/README.md | 7 +++ core-java-modules/core-java-11-2/pom.xml | 48 +++++++++++++++++++ .../java/com/baeldung/optional/Modem.java | 0 .../java/com/baeldung/optional/Person.java | 0 .../optional/OptionalChainingUnitTest.java | 4 +- .../baeldung/optional/OptionalUnitTest.java | 10 +++- core-java-modules/core-java-11/pom.xml | 2 +- .../core-java-optional/README.md | 1 - 8 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 core-java-modules/core-java-11-2/README.md create mode 100644 core-java-modules/core-java-11-2/pom.xml rename core-java-modules/{core-java-optional => core-java-11-2}/src/main/java/com/baeldung/optional/Modem.java (100%) rename core-java-modules/{core-java-optional => core-java-11-2}/src/main/java/com/baeldung/optional/Person.java (100%) rename core-java-modules/{core-java-optional => core-java-11-2}/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java (96%) rename core-java-modules/{core-java-optional => core-java-11-2}/src/test/java/com/baeldung/optional/OptionalUnitTest.java (96%) diff --git a/core-java-modules/core-java-11-2/README.md b/core-java-modules/core-java-11-2/README.md new file mode 100644 index 0000000000..f65a043819 --- /dev/null +++ b/core-java-modules/core-java-11-2/README.md @@ -0,0 +1,7 @@ +## Core Java 11 + +This module contains articles about Java 11 core features + +### Relevant articles +- [Guide to Java 8 Optional](https://www.baeldung.com/java-optional) + diff --git a/core-java-modules/core-java-11-2/pom.xml b/core-java-modules/core-java-11-2/pom.xml new file mode 100644 index 0000000000..d20b0f23f0 --- /dev/null +++ b/core-java-modules/core-java-11-2/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + core-java-11-2 + 0.1.0-SNAPSHOT + core-java-11-2 + jar + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../.. + + + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source.version} + ${maven.compiler.target.version} + + + + + + + 11 + 11 + 3.17.2 + + + diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/Modem.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/optional/Modem.java similarity index 100% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/Modem.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/optional/Modem.java diff --git a/core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/Person.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/optional/Person.java similarity index 100% rename from core-java-modules/core-java-optional/src/main/java/com/baeldung/optional/Person.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/optional/Person.java diff --git a/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java similarity index 96% rename from core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java rename to core-java-modules/core-java-11-2/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java index 9ef156501b..65b9e22f44 100644 --- a/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java +++ b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/optional/OptionalChainingUnitTest.java @@ -7,7 +7,9 @@ import java.util.Optional; import java.util.function.Supplier; import java.util.stream.Stream; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class OptionalChainingUnitTest { diff --git a/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalUnitTest.java b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/optional/OptionalUnitTest.java similarity index 96% rename from core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalUnitTest.java rename to core-java-modules/core-java-11-2/src/test/java/com/baeldung/optional/OptionalUnitTest.java index de16e9b635..1b0a2d4445 100644 --- a/core-java-modules/core-java-optional/src/test/java/com/baeldung/optional/OptionalUnitTest.java +++ b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/optional/OptionalUnitTest.java @@ -9,7 +9,9 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.Optional; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class OptionalUnitTest { @@ -262,6 +264,12 @@ public class OptionalUnitTest { .orElseThrow(IllegalArgumentException::new); } + @Test(expected = NoSuchElementException.class) + public void whenNoArgOrElseThrowWorks_thenCorrect() { + String nullName = null; + String name = Optional.ofNullable(nullName).orElseThrow(); + } + public String getMyDefault() { LOG.debug("Getting default value..."); return "Default Value"; diff --git a/core-java-modules/core-java-11/pom.xml b/core-java-modules/core-java-11/pom.xml index bbc4219eaa..2f7f5a6bcf 100644 --- a/core-java-modules/core-java-11/pom.xml +++ b/core-java-modules/core-java-11/pom.xml @@ -107,7 +107,7 @@ benchmarks 1.22 10.0.0 - 10.0.0 + 3.2.4 diff --git a/core-java-modules/core-java-optional/README.md b/core-java-modules/core-java-optional/README.md index d9d2fe813b..6c83003ea2 100644 --- a/core-java-modules/core-java-optional/README.md +++ b/core-java-modules/core-java-optional/README.md @@ -4,7 +4,6 @@ This module contains articles about Java Optional. ### Relevant Articles: - [Java Optional as Return Type](https://www.baeldung.com/java-optional-return) -- [Guide to Java 8 Optional](https://www.baeldung.com/java-optional) - [Java Optional – orElse() vs orElseGet()](https://www.baeldung.com/java-optional-or-else-vs-or-else-get) - [Transforming an Empty String into an Empty Optional](https://www.baeldung.com/java-empty-string-to-empty-optional) - [Filtering a Stream of Optionals in Java](https://www.baeldung.com/java-filter-stream-of-optional) From 20a6e042f2c90c8de5c1613370cf2862822de9af Mon Sep 17 00:00:00 2001 From: "sahil.singla" Date: Thu, 10 Sep 2020 00:24:37 +0530 Subject: [PATCH 0686/1862] BAEL-4558: Article for stopping execution after a certain time --- .../com/baeldung/concurrent/stopexecution/StopExecution.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java diff --git a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java new file mode 100644 index 0000000000..618801f57b --- /dev/null +++ b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java @@ -0,0 +1,4 @@ +package com.baeldung.concurrent.stopexecution; + +public class StopExecution { +} From 213d5cfe39a9dd4c616d1ba9002de53ddf6d7ea5 Mon Sep 17 00:00:00 2001 From: "sahil.singla" Date: Thu, 10 Sep 2020 00:29:18 +0530 Subject: [PATCH 0687/1862] BAEL-4558: Article for stopping execution after a certain time --- .../stopexecution/StopExecution.java | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) diff --git a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java index 618801f57b..2eb807020c 100644 --- a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java +++ b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java @@ -1,4 +1,268 @@ package com.baeldung.concurrent.stopexecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.ArrayList; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + public class StopExecution { + private static final Logger LOG = LoggerFactory.getLogger(StopExecution.class); + + public static void main(String[] args) { + StopExecution stopExecution = new StopExecution(); + //stopExecution.testUsingLoop(); + //stopExecution.testTimer(); + stopExecution.testScheduledExecutor(); + LOG.info("done"); + } + + + public void testUsingLoop(){ + long start = System.currentTimeMillis(); + long end = start + 5000; + List items = new ArrayList<>(); + int counter = 0; + + // Let this loop run only upto 5 seconds + while (System.currentTimeMillis() < end && counter < items.size()) + { + // Fetch the item from the list. + // Some expensive operation on the item. + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + counter++; + } + } + + public static void testThreads(){ + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + LOG.info("inside run"); + + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + LOG.info("exit run"); + } + }); + thread.start(); + while (thread.getState() != Thread.State.TERMINATED){ + LOG.info(thread.getState().name()); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + public static void testExecutor(){ + final ExecutorService service = Executors.newSingleThreadExecutor(); + Future f = null; + try { + f = service.submit(() -> { + // Do you long running calculation here + try { + Thread.sleep(2737); // Simulate some delay + } + catch (InterruptedException e){ + LOG.info("Interrupted"); + return "interrupted"; + } + LOG.info("Sleep finished"); + return "42"; + }); + + LOG.info(f.get(2, TimeUnit.SECONDS)); + } catch (final TimeoutException e) { + f.cancel(true); + LOG.error("Calculation took to long"); + } catch (final Exception e) { + throw new RuntimeException(e); + } finally { + service.shutdown(); + } + } + + + public void testExecutor2(){ + final ExecutorService service = Executors.newSingleThreadExecutor(); + Future f = null; + try { + f = service.submit(new LongRunningTask()); + LOG.info("testExecutor2"); + f.get(1, TimeUnit.SECONDS); + } catch (final TimeoutException e) { + f.cancel(true); + LOG.error("Calculation took to long"); + } catch (final Exception e) { + throw new RuntimeException(e); + } finally { + service.shutdownNow(); + } + } + + public void testScheduledExecutor(){ + LOG.info("testScheduledExecutor"); + ScheduledExecutorService executor = Executors.newScheduledThreadPool(2); + Future future = executor.submit(new LongRunningTask()); + executor.schedule(new Runnable(){ + public void run(){ + future.cancel(true); + } + }, 1000, TimeUnit.MILLISECONDS); + executor.shutdown(); + } + public void testThreadAndInterrupt(){ + + Thread t; + try { + t = new Thread(new LongRunningTask()); + + LOG.info("testExecutor3"); + long end = System.currentTimeMillis() + 2000; + t.start(); + while (t.isAlive() && System.currentTimeMillis() < end){ + Thread.sleep(50); + } + t.interrupt(); + } catch (final Exception e) { + throw new RuntimeException(e); + } + } + public void testTimer(){ + LOG.info("Timer test"); + Thread t = new Thread(new LongRunningTask()); + Timer timeoutTimer = new Timer(); + timeoutTimer.schedule(new TimeOutTask(t, timeoutTimer), 1000); + t.start(); + } + + class MyRunnableTask implements Runnable{ + public void run() + { + try + { + LOG.info("MyRunnable..."); + Thread.sleep(10000); + } + catch (InterruptedException ie) + { + LOG.info("MyRunnable interrupted..."); + } + } + } + + + class TimeOutTask extends TimerTask { + private Thread t; + private Timer timer; + + TimeOutTask(Thread t, Timer timer){ + this.t = t; + this.timer = timer; + } + public void run() { + if (t != null && t.isAlive()) { + t.interrupt(); + timer.cancel(); + } + } + } + + class LongRunningTask implements Runnable{ + @Override + public void run() { + longRunningSort(); + } + + private void longRunningOperation(){ + LOG.info("long Running operation started"); + + try { + //Thread.sleep(500); + longFileRead(); + LOG.info("long running operation finished"); + } + catch (InterruptedException e){ + LOG.info("long Running operation interrupted"); + } + } + + private void longRunningSort(){ + LOG.info("long Running task started"); + // Do you long running calculation here + int len = 100000; + List numbers = new ArrayList<>(); + try { + for (int i = len; i > 0; i--) { + //Thread.sleep(5) + numbers.add(i); + } + + int i = 0; + for (i = 0; i < len; i++) { + int minIndex = i; + for (int j = i + 1; j < len; j++) { + if (numbers.get(minIndex) > numbers.get(j)) + minIndex = j; + } + if (minIndex != i) { + int temp = numbers.get(i); + numbers.set(i, numbers.get(minIndex)); + numbers.set(minIndex, temp); + } + throwExceptionOnThreadInterrupt(); + } + LOG.info("Index position: " + i); + LOG.info("Long running task finished"); + }catch (InterruptedException e){ + LOG.info("long Running operation interrupted"); + } + } + + private void longFileRead() throws InterruptedException{ + String file = "input.txt"; + ClassLoader classloader = getClass().getClassLoader(); + + try (InputStream inputStream = classloader.getResourceAsStream(file)){ + Reader inputStreamReader = new InputStreamReader(inputStream); + + int data = inputStreamReader.read(); + while (data != -1) { + char theChar = (char) data; + data = inputStreamReader.read(); + throwExceptionOnThreadInterrupt(); + } + } catch (IOException e){ + LOG.error("Exception: ", e); + } + } + private void throwExceptionOnThreadInterrupt() throws InterruptedException{ + if (Thread.currentThread().interrupted()){ + throw new InterruptedException(); + } + } + } + } + + From ae5ee571b9c7528f70e47dc7d12b038376032fc2 Mon Sep 17 00:00:00 2001 From: mikr Date: Thu, 10 Sep 2020 01:08:03 +0200 Subject: [PATCH 0688/1862] Java-2394 Create default and integration profile for JDK-9 and above modules --- .../{AppTest.java => AppUnitTest.java} | 6 +- core-java-modules/core-java-11/pom.xml | 2 +- ...ingAPITest.java => StringAPIUnitTest.java} | 2 +- .../{PersonTest.java => PersonUnitTest.java} | 2 +- core-java-modules/core-java-9/pom.xml | 11 +++ ...esTest.java => MethodHandlesUnitTest.java} | 2 +- ...> TimestampToStringConverterUnitTest.java} | 2 +- .../consumermodule/pom.xml | 2 +- .../decoupling-pattern1/servicemodule/pom.xml | 3 +- .../providermodule/pom.xml | 2 +- .../decoupling-pattern2/servicemodule/pom.xml | 3 +- ...a => CurrentDirectoryFetcherUnitTest.java} | 2 +- .../multimodulemavenproject/daomodule/pom.xml | 4 + .../entitymodule/pom.xml | 4 + .../mainappmodule/pom.xml | 4 + .../userdaomodule/pom.xml | 4 + core-java-modules/pom.xml | 20 ---- pom.xml | 98 +++++++++++++++++++ 18 files changed, 140 insertions(+), 33 deletions(-) rename core-java-modules/core-java-10/src/test/java/com/baeldung/{AppTest.java => AppUnitTest.java} (82%) rename core-java-modules/core-java-12/src/test/java/com/baeldung/string/{StringAPITest.java => StringAPIUnitTest.java} (97%) rename core-java-modules/core-java-14/src/test/java/com/baeldung/java14/record/{PersonTest.java => PersonUnitTest.java} (99%) rename core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/{MethodHandlesTest.java => MethodHandlesUnitTest.java} (99%) rename core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/timestamp/{TimestampToStringConverterTest.java => TimestampToStringConverterUnitTest.java} (91%) rename core-java-modules/core-java-os/src/test/java/com/baeldung/core/pwd/{CurrentDirectoryFetcherTest.java => CurrentDirectoryFetcherUnitTest.java} (95%) diff --git a/core-java-modules/core-java-10/src/test/java/com/baeldung/AppTest.java b/core-java-modules/core-java-10/src/test/java/com/baeldung/AppUnitTest.java similarity index 82% rename from core-java-modules/core-java-10/src/test/java/com/baeldung/AppTest.java rename to core-java-modules/core-java-10/src/test/java/com/baeldung/AppUnitTest.java index c9f61455bd..73eb8e661a 100644 --- a/core-java-modules/core-java-10/src/test/java/com/baeldung/AppTest.java +++ b/core-java-modules/core-java-10/src/test/java/com/baeldung/AppUnitTest.java @@ -7,7 +7,7 @@ import junit.framework.TestSuite; /** * Unit test for simple App. */ -public class AppTest +public class AppUnitTest extends TestCase { /** @@ -15,7 +15,7 @@ public class AppTest * * @param testName name of the test case */ - public AppTest( String testName ) + public AppUnitTest(String testName ) { super( testName ); } @@ -25,7 +25,7 @@ public class AppTest */ public static Test suite() { - return new TestSuite( AppTest.class ); + return new TestSuite( AppUnitTest.class ); } /** diff --git a/core-java-modules/core-java-11/pom.xml b/core-java-modules/core-java-11/pom.xml index bbc4219eaa..2f7f5a6bcf 100644 --- a/core-java-modules/core-java-11/pom.xml +++ b/core-java-modules/core-java-11/pom.xml @@ -107,7 +107,7 @@ benchmarks 1.22 10.0.0 - 10.0.0 + 3.2.4 diff --git a/core-java-modules/core-java-12/src/test/java/com/baeldung/string/StringAPITest.java b/core-java-modules/core-java-12/src/test/java/com/baeldung/string/StringAPIUnitTest.java similarity index 97% rename from core-java-modules/core-java-12/src/test/java/com/baeldung/string/StringAPITest.java rename to core-java-modules/core-java-12/src/test/java/com/baeldung/string/StringAPIUnitTest.java index 3d80a36bf6..e5f21bb25f 100644 --- a/core-java-modules/core-java-12/src/test/java/com/baeldung/string/StringAPITest.java +++ b/core-java-modules/core-java-12/src/test/java/com/baeldung/string/StringAPIUnitTest.java @@ -5,7 +5,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; -public class StringAPITest { +public class StringAPIUnitTest { @Test public void whenPositiveArgument_thenReturnIndentedString() { diff --git a/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/record/PersonTest.java b/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/record/PersonUnitTest.java similarity index 99% rename from core-java-modules/core-java-14/src/test/java/com/baeldung/java14/record/PersonTest.java rename to core-java-modules/core-java-14/src/test/java/com/baeldung/java14/record/PersonUnitTest.java index 9bed3dab8f..594ced56cd 100644 --- a/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/record/PersonTest.java +++ b/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/record/PersonUnitTest.java @@ -7,7 +7,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -public class PersonTest { +public class PersonUnitTest { @Test public void givenSameNameAndAddress_whenEquals_thenPersonsEqual() { diff --git a/core-java-modules/core-java-9/pom.xml b/core-java-modules/core-java-9/pom.xml index 0669d6f597..d7894934b1 100644 --- a/core-java-modules/core-java-9/pom.xml +++ b/core-java-modules/core-java-9/pom.xml @@ -44,6 +44,16 @@ commons-collections4 ${commons-collections4.version} + + org.apache.commons + commons-lang3 + 3.11 + + + commons-io + commons-io + 2.7 + @@ -77,6 +87,7 @@ 1.9 25.1-jre 4.1 + 3.2.2 diff --git a/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesTest.java b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesUnitTest.java similarity index 99% rename from core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesTest.java rename to core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesUnitTest.java index 7646755358..7aa74a490f 100644 --- a/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesTest.java +++ b/core-java-modules/core-java-9/src/test/java/com/baeldung/java9/methodhandles/MethodHandlesUnitTest.java @@ -17,7 +17,7 @@ import org.junit.Test; /** * Test case for the {@link MethodHandles} API */ -public class MethodHandlesTest { +public class MethodHandlesUnitTest { @Test public void givenConcatMethodHandle_whenInvoked_thenCorrectlyConcatenated() throws Throwable { diff --git a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/timestamp/TimestampToStringConverterTest.java b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/timestamp/TimestampToStringConverterUnitTest.java similarity index 91% rename from core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/timestamp/TimestampToStringConverterTest.java rename to core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/timestamp/TimestampToStringConverterUnitTest.java index b25ff2edb3..b928047a9a 100644 --- a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/timestamp/TimestampToStringConverterTest.java +++ b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/timestamp/TimestampToStringConverterUnitTest.java @@ -6,7 +6,7 @@ import org.junit.jupiter.api.Test; import java.sql.Timestamp; import java.time.format.DateTimeFormatter; -public class TimestampToStringConverterTest { +public class TimestampToStringConverterUnitTest { @Test public void givenDatePattern_whenFormatting_thenResultingStringIsCorrect() { diff --git a/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml index fe6689dcc3..fb6d2b1065 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern1/consumermodule/pom.xml @@ -17,7 +17,7 @@ com.baeldung.servicemodule - servicemodule + servicemodule1 ${servicemodule.version} diff --git a/core-java-modules/core-java-jpms/decoupling-pattern1/servicemodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern1/servicemodule/pom.xml index c2da228ce6..4c811ea866 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern1/servicemodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern1/servicemodule/pom.xml @@ -4,7 +4,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - servicemodule + com.baeldung.servicemodule + servicemodule1 jar diff --git a/core-java-modules/core-java-jpms/decoupling-pattern2/providermodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern2/providermodule/pom.xml index 3e8d5c0c39..1e29df7053 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern2/providermodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern2/providermodule/pom.xml @@ -17,7 +17,7 @@ com.baeldung.servicemodule - servicemodule + servicemodule2 ${servicemodule.version} diff --git a/core-java-modules/core-java-jpms/decoupling-pattern2/servicemodule/pom.xml b/core-java-modules/core-java-jpms/decoupling-pattern2/servicemodule/pom.xml index 51d64998df..9a687c9ae7 100644 --- a/core-java-modules/core-java-jpms/decoupling-pattern2/servicemodule/pom.xml +++ b/core-java-modules/core-java-jpms/decoupling-pattern2/servicemodule/pom.xml @@ -4,7 +4,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - servicemodule + com.baeldung.servicemodule + servicemodule2 1.0 diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/core/pwd/CurrentDirectoryFetcherTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/core/pwd/CurrentDirectoryFetcherUnitTest.java similarity index 95% rename from core-java-modules/core-java-os/src/test/java/com/baeldung/core/pwd/CurrentDirectoryFetcherTest.java rename to core-java-modules/core-java-os/src/test/java/com/baeldung/core/pwd/CurrentDirectoryFetcherUnitTest.java index dbaad211d9..c92049816f 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/core/pwd/CurrentDirectoryFetcherTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/core/pwd/CurrentDirectoryFetcherUnitTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; -public class CurrentDirectoryFetcherTest { +public class CurrentDirectoryFetcherUnitTest { private static final String CURRENT_DIR = "core-java-os"; diff --git a/core-java-modules/multimodulemavenproject/daomodule/pom.xml b/core-java-modules/multimodulemavenproject/daomodule/pom.xml index 15f1215d89..56c2d70d24 100644 --- a/core-java-modules/multimodulemavenproject/daomodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/daomodule/pom.xml @@ -20,6 +20,10 @@ org.apache.maven.plugins maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + diff --git a/core-java-modules/multimodulemavenproject/entitymodule/pom.xml b/core-java-modules/multimodulemavenproject/entitymodule/pom.xml index 3e5a478299..00ad56b3ab 100644 --- a/core-java-modules/multimodulemavenproject/entitymodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/entitymodule/pom.xml @@ -20,6 +20,10 @@ org.apache.maven.plugins maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + diff --git a/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml b/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml index 196e58a419..a9fe04b108 100644 --- a/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/mainappmodule/pom.xml @@ -38,6 +38,10 @@ org.apache.maven.plugins maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + diff --git a/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml b/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml index f4a7e5c8f8..150c10b68f 100644 --- a/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml +++ b/core-java-modules/multimodulemavenproject/userdaomodule/pom.xml @@ -33,6 +33,10 @@ org.apache.maven.plugins maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 36fca8de93..a6aecef741 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -18,20 +18,9 @@ core-java - - - - - core-java-8 core-java-8-2 - - - - - - core-java-annotations core-java-arrays-sorting @@ -51,7 +40,6 @@ core-java-collections-maps core-java-collections-maps-2 core-java-collections-maps-3 - core-java-concurrency-2 core-java-concurrency-advanced @@ -65,10 +53,7 @@ core-java-8-datetime-2 - core-java-date-operations-2 - - core-java-8-datetime core-java-exceptions @@ -85,7 +70,6 @@ core-java-jar core-java-jndi - core-java-jvm core-java-jvm-2 @@ -113,7 +97,6 @@ core-java-nio-2 core-java-optional - core-java-perf @@ -138,9 +121,6 @@ core-java-sun core-java-regex - - - pre-jpms diff --git a/pom.xml b/pom.xml index ffdfe4cffa..6d5c810784 100644 --- a/pom.xml +++ b/pom.xml @@ -1340,6 +1340,104 @@ + + default-jdk9-and-above + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + 3 + true + + SpringContextTest + **/*UnitTest + + + **/*IntegrationTest.java + **/*IntTest.java + **/*LongRunningUnitTest.java + **/*ManualTest.java + **/JdbcTest.java + **/*LiveTest.java + + + + + + + + + core-java-modules/core-java-9 + core-java-modules/core-java-9-improvements + + + core-java-modules/core-java-9-streams + core-java-modules/core-java-10 + + + + + core-java-modules/core-java-collections-set + + + + core-java-modules/core-java-jpms + + + core-java-modules/multimodulemavenproject + + + + + + integration-jdk9-and-above + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*ManualTest.java + **/*LiveTest.java + + + **/*IntegrationTest.java + **/*IntTest.java + + + + + + + + core-java-modules/core-java-9 + core-java-modules/core-java-9-improvements + + + core-java-modules/core-java-9-streams + core-java-modules/core-java-10 + + + + + core-java-modules/core-java-collections-set + + + + core-java-modules/core-java-jpms + + + core-java-modules/multimodulemavenproject + + + From bc36751276ff2f2d9224cd180887b9e53ca95a16 Mon Sep 17 00:00:00 2001 From: Anshul BANSAL Date: Sat, 12 Sep 2020 06:30:35 +0300 Subject: [PATCH 0689/1862] BAEL-4507 - UserSocialMedia class added --- .../baeldung/repositoryvsdaopattern/User.java | 12 ------------ .../UserRepositoryImpl.java | 5 +++-- .../repositoryvsdaopattern/UserSocialMedia.java | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserSocialMedia.java diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/User.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/User.java index 86d3554f7e..8cd4fd0a00 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/User.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/User.java @@ -1,7 +1,5 @@ package com.baeldung.repositoryvsdaopattern; -import java.util.List; - public class User { private Long id; @@ -10,8 +8,6 @@ public class User { private String lastName; private String email; - private List tweets; - public Long getId() { return id; } @@ -51,13 +47,5 @@ public class User { public void setEmail(String email) { this.email = email; } - - public List getTweets() { - return tweets; - } - - public void setTweets(List tweets) { - this.tweets = tweets; - } } diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepositoryImpl.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepositoryImpl.java index 6d7334c1ab..806b44e9d5 100644 --- a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepositoryImpl.java +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserRepositoryImpl.java @@ -9,7 +9,7 @@ public class UserRepositoryImpl implements UserRepository { @Override public User get(Long id) { - User user = userDaoImpl.read(id); + UserSocialMedia user = (UserSocialMedia) userDaoImpl.read(id); List tweets = tweetDaoImpl.fetchTweets(user.getEmail()); user.setTweets(tweets); @@ -34,7 +34,8 @@ public class UserRepositoryImpl implements UserRepository { @Override public List fetchTweets(User user) { - return null; + return tweetDaoImpl.fetchTweets(user.getEmail()); + } @Override diff --git a/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserSocialMedia.java b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserSocialMedia.java new file mode 100644 index 0000000000..bf729620af --- /dev/null +++ b/patterns/design-patterns-architectural/src/main/java/com/baeldung/repositoryvsdaopattern/UserSocialMedia.java @@ -0,0 +1,17 @@ +package com.baeldung.repositoryvsdaopattern; + +import java.util.List; + +public class UserSocialMedia extends User { + + private List tweets; + + public List getTweets() { + return tweets; + } + + public void setTweets(List tweets) { + this.tweets = tweets; + } + +} From 2f918653634e0c3a10b425118496cc54d8a7c05b Mon Sep 17 00:00:00 2001 From: akeshri Date: Thu, 10 Sep 2020 09:26:24 +0530 Subject: [PATCH 0690/1862] changes --- .../mapfirstpair/MapFirstPairExample.java | 42 ------------ .../mapfirstpair/MapFirstPairUnitTest.java | 68 +++++++++++++------ 2 files changed, 47 insertions(+), 63 deletions(-) delete mode 100644 core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairExample.java diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairExample.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairExample.java deleted file mode 100644 index 8e5fc296d4..0000000000 --- a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/mapfirstpair/MapFirstPairExample.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.collections.mapfirstpair; - -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -public class MapFirstPairExample { - - public Map.Entry getFirstPairUsingIterator(Map map) { - if (map == null || map.size() == 0) - return null; - - Iterator> iterator = map.entrySet() - .iterator(); - - if (iterator.hasNext()) - return iterator.next(); - - return null; - } - - public Map.Entry getFirstPairUsingStream(Map map) { - if (map == null || map.size() == 0) - return null; - - Set> entrySet = map.entrySet(); - - return entrySet.stream() - .findFirst() - .get(); - } - - public Map populateMapValues(Map map) { - if (map != null) { - map.put(5, "A"); - map.put(1, "B"); - map.put(2, "C"); - } - return map; - } - -} \ No newline at end of file diff --git a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java index c8198bcc02..b25e0932d8 100644 --- a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java +++ b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java @@ -5,28 +5,54 @@ import static org.junit.Assert.assertNotEquals; import java.util.AbstractMap; import java.util.HashMap; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; -import org.junit.Before; import org.junit.Test; public class MapFirstPairUnitTest { - private MapFirstPairExample mapFirstPairExample; + private Map.Entry getFirstPairUsingIterator(Map map) { + if (map == null || map.size() == 0) + return null; - @Before - public void Setup() { + Iterator> iterator = map.entrySet() + .iterator(); - mapFirstPairExample = new MapFirstPairExample(); + if (iterator.hasNext()) + return iterator.next(); + + return null; + } + + private Map.Entry getFirstPairUsingStream(Map map) { + if (map == null || map.size() == 0) + return null; + + Set> entrySet = map.entrySet(); + + return entrySet.stream() + .findFirst() + .get(); + } + + private Map populateMapValues(Map map) { + if (map != null) { + map.put(5, "A"); + map.put(1, "B"); + map.put(2, "C"); + } + return map; } @Test public void whenUsingIteratorForHashMap_thenFirstPairWhichWasNotInsertedFirst() { Map hashMap = new HashMap<>(); - hashMap = mapFirstPairExample.populateMapValues(hashMap); + hashMap = populateMapValues(hashMap); - Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingIterator(hashMap); + Map.Entry actualValue = getFirstPairUsingIterator(hashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(1, "B"); Map.Entry pairInsertedFirst = new AbstractMap.SimpleEntry(5, "A"); @@ -37,8 +63,8 @@ public class MapFirstPairUnitTest { @Test public void whenUsingStreamForHashMap_thenFirstPairWhichWasNotInsertedFirst() { Map hashMap = new HashMap<>(); - hashMap = mapFirstPairExample.populateMapValues(hashMap); - Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingStream(hashMap); + hashMap = populateMapValues(hashMap); + Map.Entry actualValue = getFirstPairUsingStream(hashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(1, "B"); Map.Entry pairInsertedFirst = new AbstractMap.SimpleEntry(5, "A"); @@ -49,8 +75,8 @@ public class MapFirstPairUnitTest { @Test public void whenUsingIteratorForLinkedHashMap_thenFirstPairWhichWasInsertedFirst() { Map linkedHashMap = new LinkedHashMap<>(); - linkedHashMap = mapFirstPairExample.populateMapValues(linkedHashMap); - Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingIterator(linkedHashMap); + linkedHashMap = populateMapValues(linkedHashMap); + Map.Entry actualValue = getFirstPairUsingIterator(linkedHashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); assertEquals(expectedValue, actualValue); @@ -59,9 +85,9 @@ public class MapFirstPairUnitTest { @Test public void whenUsingStreamForLinkedHashMap_thenFirstPairWhichWasInsertedFirst() { Map linkedHashMap = new LinkedHashMap<>(); - linkedHashMap = mapFirstPairExample.populateMapValues(linkedHashMap); + linkedHashMap = populateMapValues(linkedHashMap); - Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingStream(linkedHashMap); + Map.Entry actualValue = getFirstPairUsingStream(linkedHashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); assertEquals(expectedValue, actualValue); @@ -70,10 +96,10 @@ public class MapFirstPairUnitTest { @Test public void whenAddedAnElementInHashMap_thenFirstPairChangedUsingIterator() { Map hashMap = new HashMap<>(); - hashMap = mapFirstPairExample.populateMapValues(hashMap); + hashMap = populateMapValues(hashMap); hashMap.put(0, "D"); - Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingIterator(hashMap); + Map.Entry actualValue = getFirstPairUsingIterator(hashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(0, "D"); assertEquals(expectedValue, actualValue); @@ -82,10 +108,10 @@ public class MapFirstPairUnitTest { @Test public void whenAddedAnElementInHashMap_thenFirstPairChangedUsingStream() { Map hashMap = new HashMap<>(); - hashMap = mapFirstPairExample.populateMapValues(hashMap); + hashMap = populateMapValues(hashMap); hashMap.put(0, "D"); - Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingStream(hashMap); + Map.Entry actualValue = getFirstPairUsingStream(hashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(0, "D"); assertEquals(expectedValue, actualValue); @@ -94,10 +120,10 @@ public class MapFirstPairUnitTest { @Test public void whenAddedAnElementInLinkedHashMap_thenFirstPairRemainUnchangedUsingIterator() { Map linkedHashMap = new LinkedHashMap<>(); - linkedHashMap = mapFirstPairExample.populateMapValues(linkedHashMap); + linkedHashMap = populateMapValues(linkedHashMap); linkedHashMap.put(0, "D"); - Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingIterator(linkedHashMap); + Map.Entry actualValue = getFirstPairUsingIterator(linkedHashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); assertEquals(expectedValue, actualValue); @@ -106,10 +132,10 @@ public class MapFirstPairUnitTest { @Test public void whenAddedAnElementInLinkedHashMap_thenFirstPairRemainUnchangedUsingStream() { Map linkedHashMap = new LinkedHashMap<>(); - linkedHashMap = mapFirstPairExample.populateMapValues(linkedHashMap); + linkedHashMap = populateMapValues(linkedHashMap); linkedHashMap.put(0, "D"); - Map.Entry actualValue = mapFirstPairExample.getFirstPairUsingStream(linkedHashMap); + Map.Entry actualValue = getFirstPairUsingStream(linkedHashMap); Map.Entry expectedValue = new AbstractMap.SimpleEntry(5, "A"); assertEquals(expectedValue, actualValue); From 1873207445bf0ea371055e1ca2f97d883badf6cc Mon Sep 17 00:00:00 2001 From: fdpro Date: Thu, 10 Sep 2020 11:47:44 +0200 Subject: [PATCH 0691/1862] [JAVA-2540] Migrated unit test to integration test as it bootsraps and calls a REST API --- ...eSpecUnitTest.java => HelloResourceSpecIntegrationTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename restx/src/test/java/restx/demo/rest/{HelloResourceSpecUnitTest.java => HelloResourceSpecIntegrationTest.java} (91%) diff --git a/restx/src/test/java/restx/demo/rest/HelloResourceSpecUnitTest.java b/restx/src/test/java/restx/demo/rest/HelloResourceSpecIntegrationTest.java similarity index 91% rename from restx/src/test/java/restx/demo/rest/HelloResourceSpecUnitTest.java rename to restx/src/test/java/restx/demo/rest/HelloResourceSpecIntegrationTest.java index f67e4565b3..6ff1a7aad4 100644 --- a/restx/src/test/java/restx/demo/rest/HelloResourceSpecUnitTest.java +++ b/restx/src/test/java/restx/demo/rest/HelloResourceSpecIntegrationTest.java @@ -7,7 +7,7 @@ import restx.tests.RestxSpecTestsRunner; @RunWith(RestxSpecTestsRunner.class) @FindSpecsIn("specs/hello") -public class HelloResourceSpecUnitTest { +public class HelloResourceSpecIntegrationTest { /** * Useless, thanks to both @RunWith(RestxSpecTestsRunner.class) & @FindSpecsIn() From 19f754618ab43d2ee0ce3261292f883806620c67 Mon Sep 17 00:00:00 2001 From: fdpro Date: Thu, 10 Sep 2020 12:22:23 +0200 Subject: [PATCH 0692/1862] [JAVA-1662] Migrated maven-surefire-plugin version to 2.22.2 --- logging-modules/flogger/pom.xml | 1 + logging-modules/log-mdc/pom.xml | 11 ++++++++++- logging-modules/log4j/pom.xml | 4 ++-- logging-modules/log4j2/pom.xml | 4 ++-- logging-modules/logback/pom.xml | 4 ++-- logging-modules/pom.xml | 11 ++++++++++- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/logging-modules/flogger/pom.xml b/logging-modules/flogger/pom.xml index f553a4a961..e9189c8460 100644 --- a/logging-modules/flogger/pom.xml +++ b/logging-modules/flogger/pom.xml @@ -9,6 +9,7 @@ com.baeldung logging-modules 1.0.0-SNAPSHOT + ../pom.xml diff --git a/logging-modules/log-mdc/pom.xml b/logging-modules/log-mdc/pom.xml index bc4800ea37..bc018690f9 100644 --- a/logging-modules/log-mdc/pom.xml +++ b/logging-modules/log-mdc/pom.xml @@ -79,6 +79,8 @@ + logging-service + @@ -93,7 +95,14 @@ - logging-service + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + diff --git a/logging-modules/log4j/pom.xml b/logging-modules/log4j/pom.xml index cc0996a45a..15cd2d530f 100644 --- a/logging-modules/log4j/pom.xml +++ b/logging-modules/log4j/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-modules + logging-modules 1.0.0-SNAPSHOT - ../../ + ../pom.xml diff --git a/logging-modules/log4j2/pom.xml b/logging-modules/log4j2/pom.xml index 03a4fd8ab0..e09cbd5d33 100644 --- a/logging-modules/log4j2/pom.xml +++ b/logging-modules/log4j2/pom.xml @@ -7,9 +7,9 @@ com.baeldung - parent-modules + logging-modules 1.0.0-SNAPSHOT - ../../ + ../pom.xml diff --git a/logging-modules/logback/pom.xml b/logging-modules/logback/pom.xml index ee430949df..9f5a3ef294 100644 --- a/logging-modules/logback/pom.xml +++ b/logging-modules/logback/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-modules + logging-modules 1.0.0-SNAPSHOT - ../../ + ../pom.xml diff --git a/logging-modules/pom.xml b/logging-modules/pom.xml index b9a1fe77c6..ad78fd20b9 100644 --- a/logging-modules/pom.xml +++ b/logging-modules/pom.xml @@ -10,7 +10,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT - .. + ../pom.xml @@ -21,4 +21,13 @@ flogger + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + From 1fd989f4a8f731a2312838af839a5588cb1e4ab1 Mon Sep 17 00:00:00 2001 From: fdpro Date: Thu, 10 Sep 2020 12:26:56 +0200 Subject: [PATCH 0693/1862] [JAVA-1662] Upgraded junit-jupiter version to 5.6.2 --- logging-modules/log-mdc/pom.xml | 3 ++- logging-modules/pom.xml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/logging-modules/log-mdc/pom.xml b/logging-modules/log-mdc/pom.xml index bc018690f9..5e2155fde9 100644 --- a/logging-modules/log-mdc/pom.xml +++ b/logging-modules/log-mdc/pom.xml @@ -80,7 +80,7 @@ logging-service - + @@ -109,6 +109,7 @@ 2.7 3.3.6 3.3.0.Final + 5.6.2 diff --git a/logging-modules/pom.xml b/logging-modules/pom.xml index ad78fd20b9..b5354c7c23 100644 --- a/logging-modules/pom.xml +++ b/logging-modules/pom.xml @@ -30,4 +30,8 @@ + + + 5.6.2 + From fe9e6fc55867c516c07024fd56a134f1be085a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Thu, 10 Sep 2020 17:21:30 +0200 Subject: [PATCH 0694/1862] [JAVA-2435] Migrate spring-security-web-sockets to parent-sprint-5 (#10000) * [JAVA-2435] Inherited from parent-boot-5 * [JAVA-2435] Upgraded version of spring-security as well --- spring-security-modules/spring-security-web-sockets/pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spring-security-modules/spring-security-web-sockets/pom.xml b/spring-security-modules/spring-security-web-sockets/pom.xml index 3a3ec47af5..4aecf296b4 100644 --- a/spring-security-modules/spring-security-web-sockets/pom.xml +++ b/spring-security-modules/spring-security-web-sockets/pom.xml @@ -10,9 +10,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-4 + ../../parent-spring-5 @@ -182,7 +182,6 @@ 5.2.10.Final - 4.2.3.RELEASE 1.11.3.RELEASE 1.2.3 1.5.10.RELEASE From b03fdd2c4b4be0cc5cfa5bbb6eb8d6c892c04924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Thu, 10 Sep 2020 17:25:13 +0200 Subject: [PATCH 0695/1862] [JAVA-2434] Inherited from parent-spring-5 (#9994) * [JAVA-2434] Inherited from parent-spring-5 * [JAVA-2434] Upgraded spring-security dependencies as well --- .../spring-security-web-react/pom.xml | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/spring-security-modules/spring-security-web-react/pom.xml b/spring-security-modules/spring-security-web-react/pom.xml index 459793f496..663c7d76c3 100644 --- a/spring-security-modules/spring-security-web-react/pom.xml +++ b/spring-security-modules/spring-security-web-react/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-spring-4 + parent-spring-5 0.0.1-SNAPSHOT - ../../parent-spring-4 + ../../parent-spring-5 @@ -21,17 +21,17 @@ org.springframework.security spring-security-web - ${org.springframework.security.version} + ${spring-security.version} org.springframework.security spring-security-config - ${org.springframework.security.version} + ${spring-security.version} org.springframework.security spring-security-taglibs - ${org.springframework.security.version} + ${spring-security.version} @@ -39,33 +39,33 @@ org.springframework spring-core - ${org.springframework.version} + ${spring.version} org.springframework spring-context - ${org.springframework.version} + ${spring.version} org.springframework spring-beans - ${org.springframework.version} + ${spring.version} org.springframework spring-aop - ${org.springframework.version} + ${spring.version} org.springframework spring-web - ${org.springframework.version} + ${spring.version} org.springframework spring-webmvc - ${org.springframework.version} + ${spring.version} @@ -221,10 +221,6 @@ - - 4.3.6.RELEASE - 4.2.1.RELEASE - 19.0 @@ -236,7 +232,5 @@ v8.11.3 6.1.0 - - \ No newline at end of file From 0acc6a25e1fca42328baf803b024ebe57e354f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Thu, 10 Sep 2020 17:27:24 +0200 Subject: [PATCH 0696/1862] [JAVA-2306] Fixed failing integration test (#9999) --- .../spring/jdbc/template/guide/config/SpringJdbcConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/config/SpringJdbcConfig.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/config/SpringJdbcConfig.java index 0e81babd9a..7cffe5342a 100644 --- a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/config/SpringJdbcConfig.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/guide/config/SpringJdbcConfig.java @@ -10,7 +10,7 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; @Configuration -@ComponentScan("com.baeldung.spring.jdbc") +@ComponentScan("com.baeldung.spring.jdbc.template.guide") public class SpringJdbcConfig { @Bean From 64d5c717cb769ebfda351b2a82f682291d1d42bd Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Thu, 10 Sep 2020 22:43:55 +0530 Subject: [PATCH 0697/1862] JAVA-2412: Update "Spring Template Engine" article --- spring-mvc-basics-2/pom.xml | 4 ++-- .../baeldung/spring/configuration/EmailConfiguration.java | 4 ++-- .../spring/configuration/ThymeleafConfiguration.java | 6 +++--- .../java/com/baeldung/spring/mail/EmailServiceImpl.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-mvc-basics-2/pom.xml b/spring-mvc-basics-2/pom.xml index 026ddf8e72..6bcb1e90e5 100644 --- a/spring-mvc-basics-2/pom.xml +++ b/spring-mvc-basics-2/pom.xml @@ -69,7 +69,7 @@ org.thymeleaf - thymeleaf-spring4 + thymeleaf-spring5 ${org.thymeleaf-version} @@ -164,7 +164,7 @@ 6.0.10.Final enter-location-of-server 1.3.2 - 3.0.7.RELEASE + 3.0.11.RELEASE 2.4.12 2.3.27-incubating 1.2.5 diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java index 1bbbc51304..4bd692f609 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java @@ -11,8 +11,8 @@ import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; -import org.thymeleaf.spring4.SpringTemplateEngine; -import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; +import org.thymeleaf.spring5.SpringTemplateEngine; +import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; @Configuration @ComponentScan(basePackages = { "com.baeldung.spring.mail" }) diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/ThymeleafConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/ThymeleafConfiguration.java index 257dbc718a..2f025c1ad2 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/ThymeleafConfiguration.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/ThymeleafConfiguration.java @@ -4,9 +4,9 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.thymeleaf.spring4.SpringTemplateEngine; -import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver; -import org.thymeleaf.spring4.view.ThymeleafViewResolver; +import org.thymeleaf.spring5.SpringTemplateEngine; +import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; +import org.thymeleaf.spring5.view.ThymeleafViewResolver; @Configuration @EnableWebMvc diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java index cbcb8f4e34..1eb7a5f8b4 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java @@ -19,7 +19,7 @@ import org.springframework.stereotype.Service; import org.springframework.ui.freemarker.FreeMarkerTemplateUtils; import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; import org.thymeleaf.context.Context; -import org.thymeleaf.spring4.SpringTemplateEngine; +import org.thymeleaf.spring5.SpringTemplateEngine; import freemarker.template.Template; import freemarker.template.TemplateException; From 2ccba495c562bfc2736448c6009d654210b5796a Mon Sep 17 00:00:00 2001 From: Loredana Date: Thu, 10 Sep 2020 20:19:19 +0300 Subject: [PATCH 0698/1862] fix package --- .../src/main/java/com/baeldung/optionalpathvars/Article.java | 2 +- .../baeldung/optionalpathvars/ArticleViewerController.java | 4 ++-- .../optionalpathvars/ArticleViewerWithMapParamController.java | 4 ++-- .../ArticleViewerWithOptionalParamController.java | 4 ++-- .../ArticleViewerWithRequiredAttributeController.java | 4 ++-- .../ArticleViewerWithTwoSeparateMethodsController.java | 4 ++-- .../ArticleViewerControllerIntegrationTest.java | 2 +- ...ticleViewerControllerWithOptionalParamIntegrationTest.java | 2 +- ...eViewerControllerWithRequiredAttributeIntegrationTest.java | 2 +- .../ArticleViewerWithMapParamIntegrationTest.java | 2 +- .../ArticleViewerWithTwoSeparateMethodsIntegrationTest.java | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/Article.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/Article.java index f6675295ed..5a9f406b56 100644 --- a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/Article.java +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/Article.java @@ -1,4 +1,4 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; public class Article { diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerController.java index 14b16e148b..1876798bd6 100644 --- a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerController.java +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerController.java @@ -1,6 +1,6 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; -import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; +import static com.baeldung.optionalpathvars.Article.DEFAULT_ARTICLE; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamController.java index 50744b6067..c989ddfa52 100644 --- a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamController.java +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamController.java @@ -1,6 +1,6 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; -import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; +import static com.baeldung.optionalpathvars.Article.DEFAULT_ARTICLE; import java.util.Map; diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithOptionalParamController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithOptionalParamController.java index ff645fbcc7..75e35bf799 100644 --- a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithOptionalParamController.java +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithOptionalParamController.java @@ -1,6 +1,6 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; -import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; +import static com.baeldung.optionalpathvars.Article.DEFAULT_ARTICLE; import java.util.Optional; diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithRequiredAttributeController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithRequiredAttributeController.java index 8cd1539391..7548747f05 100644 --- a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithRequiredAttributeController.java +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithRequiredAttributeController.java @@ -1,6 +1,6 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; -import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; +import static com.baeldung.optionalpathvars.Article.DEFAULT_ARTICLE; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java index 0ea401a589..beb520c1b4 100644 --- a/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsController.java @@ -1,6 +1,6 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; -import static com.baeldung.controller.optionalpathvars.Article.DEFAULT_ARTICLE; +import static com.baeldung.optionalpathvars.Article.DEFAULT_ARTICLE; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerIntegrationTest.java index 173ac165c3..0e2313c2ac 100644 --- a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerIntegrationTest.java +++ b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; import org.junit.Before; import org.junit.Test; diff --git a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java index 1fadfb7038..094995ba67 100644 --- a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java +++ b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithOptionalParamIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; import org.junit.Before; import org.junit.Test; diff --git a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java index 00d620ef9a..a4b12c7163 100644 --- a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java +++ b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerControllerWithRequiredAttributeIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; import org.junit.Before; import org.junit.Test; diff --git a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java index f7fff714a9..044a1c8bce 100644 --- a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java +++ b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithMapParamIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; import org.junit.Before; import org.junit.Test; diff --git a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java index b4e4c9ade5..1ca926277d 100644 --- a/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java +++ b/spring-mvc-basics-4/src/test/java/com/baeldung/optionalpathvars/ArticleViewerWithTwoSeparateMethodsIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.controller.optionalpathvars; +package com.baeldung.optionalpathvars; import org.junit.Before; import org.junit.Test; From c2ac81100963b02f318de566bfb0d7aaaf389151 Mon Sep 17 00:00:00 2001 From: Ashley Frieze Date: Sat, 29 Aug 2020 00:07:53 +0100 Subject: [PATCH 0699/1862] BAEL-3998-Aws Lambda with Hibernate --- aws-lambda/lambda/pom.xml | 100 ++++++++++++++++ .../sam-templates/template-implicit.yaml | 0 .../template-inline-swagger.yaml | 0 .../baeldung/lambda/LambdaMethodHandler.java | 0 .../baeldung/lambda/LambdaRequestHandler.java | 0 .../lambda/LambdaRequestStreamHandler.java | 0 .../lambda/apigateway/APIDemoHandler.java | 0 .../lambda/apigateway/model/Person.java | 0 .../lambda/dynamodb/SavePersonHandler.java | 0 .../lambda/dynamodb/bean/PersonRequest.java | 0 .../lambda/dynamodb/bean/PersonResponse.java | 0 .../src/main/resources/logback.xml | 0 aws-lambda/pom.xml | 90 ++------------- aws-lambda/shipping-tracker/.gitignore | 1 + .../shipping-tracker/ShippingFunction/pom.xml | 73 ++++++++++++ .../com/baeldung/lambda/shipping/App.java | 108 ++++++++++++++++++ .../com/baeldung/lambda/shipping/Checkin.java | 28 +++++ .../baeldung/lambda/shipping/Consignment.java | 77 +++++++++++++ .../com/baeldung/lambda/shipping/Item.java | 38 ++++++ .../baeldung/lambda/shipping/ShippingDao.java | 25 ++++ .../lambda/shipping/ShippingService.java | 62 ++++++++++ aws-lambda/shipping-tracker/template.yaml | 47 ++++++++ 22 files changed, 566 insertions(+), 83 deletions(-) create mode 100644 aws-lambda/lambda/pom.xml rename aws-lambda/{ => lambda}/sam-templates/template-implicit.yaml (100%) rename aws-lambda/{ => lambda}/sam-templates/template-inline-swagger.yaml (100%) rename aws-lambda/{ => lambda}/src/main/java/com/baeldung/lambda/LambdaMethodHandler.java (100%) rename aws-lambda/{ => lambda}/src/main/java/com/baeldung/lambda/LambdaRequestHandler.java (100%) rename aws-lambda/{ => lambda}/src/main/java/com/baeldung/lambda/LambdaRequestStreamHandler.java (100%) rename aws-lambda/{ => lambda}/src/main/java/com/baeldung/lambda/apigateway/APIDemoHandler.java (100%) rename aws-lambda/{ => lambda}/src/main/java/com/baeldung/lambda/apigateway/model/Person.java (100%) rename aws-lambda/{ => lambda}/src/main/java/com/baeldung/lambda/dynamodb/SavePersonHandler.java (100%) rename aws-lambda/{ => lambda}/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonRequest.java (100%) rename aws-lambda/{ => lambda}/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonResponse.java (100%) rename aws-lambda/{ => lambda}/src/main/resources/logback.xml (100%) create mode 100644 aws-lambda/shipping-tracker/.gitignore create mode 100644 aws-lambda/shipping-tracker/ShippingFunction/pom.xml create mode 100644 aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/App.java create mode 100644 aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Checkin.java create mode 100644 aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Consignment.java create mode 100644 aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Item.java create mode 100644 aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/ShippingDao.java create mode 100644 aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/ShippingService.java create mode 100644 aws-lambda/shipping-tracker/template.yaml diff --git a/aws-lambda/lambda/pom.xml b/aws-lambda/lambda/pom.xml new file mode 100644 index 0000000000..2d903aabc5 --- /dev/null +++ b/aws-lambda/lambda/pom.xml @@ -0,0 +1,100 @@ + + + 4.0.0 + aws-lambda-examples + 0.1.0-SNAPSHOT + aws-lambda-examples + jar + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + + + + + com.amazonaws + aws-java-sdk-dynamodb + ${aws-java-sdk.version} + + + com.amazonaws + aws-java-sdk-core + ${aws-java-sdk.version} + + + com.amazonaws + aws-lambda-java-core + ${aws-lambda-java-core.version} + + + commons-logging + commons-logging + + + + + com.amazonaws + aws-lambda-java-events + ${aws-lambda-java-events.version} + + + commons-logging + commons-logging + + + + + com.google.code.gson + gson + ${gson.version} + + + commons-io + commons-io + ${commons-io.version} + + + com.googlecode.json-simple + json-simple + ${json-simple.version} + + + + + + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + false + + + + package + + shade + + + + + + + + + 1.1.1 + 2.5 + 1.3.0 + 1.2.0 + 2.8.2 + 1.11.241 + 3.0.0 + + + diff --git a/aws-lambda/sam-templates/template-implicit.yaml b/aws-lambda/lambda/sam-templates/template-implicit.yaml similarity index 100% rename from aws-lambda/sam-templates/template-implicit.yaml rename to aws-lambda/lambda/sam-templates/template-implicit.yaml diff --git a/aws-lambda/sam-templates/template-inline-swagger.yaml b/aws-lambda/lambda/sam-templates/template-inline-swagger.yaml similarity index 100% rename from aws-lambda/sam-templates/template-inline-swagger.yaml rename to aws-lambda/lambda/sam-templates/template-inline-swagger.yaml diff --git a/aws-lambda/src/main/java/com/baeldung/lambda/LambdaMethodHandler.java b/aws-lambda/lambda/src/main/java/com/baeldung/lambda/LambdaMethodHandler.java similarity index 100% rename from aws-lambda/src/main/java/com/baeldung/lambda/LambdaMethodHandler.java rename to aws-lambda/lambda/src/main/java/com/baeldung/lambda/LambdaMethodHandler.java diff --git a/aws-lambda/src/main/java/com/baeldung/lambda/LambdaRequestHandler.java b/aws-lambda/lambda/src/main/java/com/baeldung/lambda/LambdaRequestHandler.java similarity index 100% rename from aws-lambda/src/main/java/com/baeldung/lambda/LambdaRequestHandler.java rename to aws-lambda/lambda/src/main/java/com/baeldung/lambda/LambdaRequestHandler.java diff --git a/aws-lambda/src/main/java/com/baeldung/lambda/LambdaRequestStreamHandler.java b/aws-lambda/lambda/src/main/java/com/baeldung/lambda/LambdaRequestStreamHandler.java similarity index 100% rename from aws-lambda/src/main/java/com/baeldung/lambda/LambdaRequestStreamHandler.java rename to aws-lambda/lambda/src/main/java/com/baeldung/lambda/LambdaRequestStreamHandler.java diff --git a/aws-lambda/src/main/java/com/baeldung/lambda/apigateway/APIDemoHandler.java b/aws-lambda/lambda/src/main/java/com/baeldung/lambda/apigateway/APIDemoHandler.java similarity index 100% rename from aws-lambda/src/main/java/com/baeldung/lambda/apigateway/APIDemoHandler.java rename to aws-lambda/lambda/src/main/java/com/baeldung/lambda/apigateway/APIDemoHandler.java diff --git a/aws-lambda/src/main/java/com/baeldung/lambda/apigateway/model/Person.java b/aws-lambda/lambda/src/main/java/com/baeldung/lambda/apigateway/model/Person.java similarity index 100% rename from aws-lambda/src/main/java/com/baeldung/lambda/apigateway/model/Person.java rename to aws-lambda/lambda/src/main/java/com/baeldung/lambda/apigateway/model/Person.java diff --git a/aws-lambda/src/main/java/com/baeldung/lambda/dynamodb/SavePersonHandler.java b/aws-lambda/lambda/src/main/java/com/baeldung/lambda/dynamodb/SavePersonHandler.java similarity index 100% rename from aws-lambda/src/main/java/com/baeldung/lambda/dynamodb/SavePersonHandler.java rename to aws-lambda/lambda/src/main/java/com/baeldung/lambda/dynamodb/SavePersonHandler.java diff --git a/aws-lambda/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonRequest.java b/aws-lambda/lambda/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonRequest.java similarity index 100% rename from aws-lambda/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonRequest.java rename to aws-lambda/lambda/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonRequest.java diff --git a/aws-lambda/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonResponse.java b/aws-lambda/lambda/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonResponse.java similarity index 100% rename from aws-lambda/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonResponse.java rename to aws-lambda/lambda/src/main/java/com/baeldung/lambda/dynamodb/bean/PersonResponse.java diff --git a/aws-lambda/src/main/resources/logback.xml b/aws-lambda/lambda/src/main/resources/logback.xml similarity index 100% rename from aws-lambda/src/main/resources/logback.xml rename to aws-lambda/lambda/src/main/resources/logback.xml diff --git a/aws-lambda/pom.xml b/aws-lambda/pom.xml index e1d2c7df27..116fc801aa 100644 --- a/aws-lambda/pom.xml +++ b/aws-lambda/pom.xml @@ -5,95 +5,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 aws-lambda - 0.1.0-SNAPSHOT aws-lambda - jar + pom com.baeldung parent-modules 1.0.0-SNAPSHOT + ../ - - - com.amazonaws - aws-java-sdk-dynamodb - ${aws-java-sdk.version} - - - com.amazonaws - aws-java-sdk-core - ${aws-java-sdk.version} - - - com.amazonaws - aws-lambda-java-core - ${aws-lambda-java-core.version} - - - commons-logging - commons-logging - - - - - com.amazonaws - aws-lambda-java-events - ${aws-lambda-java-events.version} - - - commons-logging - commons-logging - - - - - com.google.code.gson - gson - ${gson.version} - - - commons-io - commons-io - ${commons-io.version} - - - com.googlecode.json-simple - json-simple - ${json-simple.version} - - + + lambda + shipping-tracker/ShippingFunction + - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven-shade-plugin.version} - - false - - - - package - - shade - - - - - - - - - 1.1.1 - 2.5 - 1.3.0 - 1.2.0 - 2.8.2 - 1.11.241 - 3.0.0 - - - \ No newline at end of file + diff --git a/aws-lambda/shipping-tracker/.gitignore b/aws-lambda/shipping-tracker/.gitignore new file mode 100644 index 0000000000..9984c2e554 --- /dev/null +++ b/aws-lambda/shipping-tracker/.gitignore @@ -0,0 +1 @@ +.aws-sam/ diff --git a/aws-lambda/shipping-tracker/ShippingFunction/pom.xml b/aws-lambda/shipping-tracker/ShippingFunction/pom.xml new file mode 100644 index 0000000000..ac39c9ea54 --- /dev/null +++ b/aws-lambda/shipping-tracker/ShippingFunction/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + com.baeldung + ShippingFunction + 1.0 + jar + Shipping Tracker Lambda Function + + 1.8 + 1.8 + 5.4.21.Final + + + + + com.amazonaws + aws-lambda-java-core + 1.2.0 + + + com.amazonaws + aws-lambda-java-events + 3.1.0 + + + com.fasterxml.jackson.core + jackson-databind + 2.11.2 + + + junit + junit + 4.12 + test + + + org.hibernate + hibernate-core + ${hibernate.version} + + + org.hibernate + hibernate-hikaricp + ${hibernate.version} + + + org.postgresql + postgresql + 42.2.16 + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.1 + + + + + package + + shade + + + + + + + diff --git a/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/App.java b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/App.java new file mode 100644 index 0000000000..719725598c --- /dev/null +++ b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/App.java @@ -0,0 +1,108 @@ +package com.baeldung.lambda.shipping; + +import com.amazonaws.services.lambda.runtime.Context; +import com.amazonaws.services.lambda.runtime.RequestHandler; +import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; +import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.hibernate.SessionFactory; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.registry.StandardServiceRegistry; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; + +import java.util.HashMap; +import java.util.Map; + +import static org.hibernate.cfg.AvailableSettings.*; +import static org.hibernate.cfg.AvailableSettings.PASS; + +/** + * Handler for requests to Lambda function. + */ +public class App implements RequestHandler { +private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent input, Context context) { + try (SessionFactory sessionFactory = createSessionFactory()) { + ShippingService service = new ShippingService(sessionFactory, new ShippingDao()); + return routeRequest(input, service); + } + } + + private APIGatewayProxyResponseEvent routeRequest(APIGatewayProxyRequestEvent input, ShippingService service) { + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + headers.put("X-Custom-Header", "application/json"); + + Object result = "OK"; + + switch (input.getResource()) { + case "/consignment": + result = service.createConsignment( + fromJson(input.getBody(), Consignment.class)); + break; + case "/consignment/{id}": + result = service.view(input.getPathParameters().get("id")); + break; + case "/consignment/{id}/item": + service.addItem(input.getPathParameters().get("id"), + fromJson(input.getBody(), Item.class)); + break; + case "/consignment/{id}/checkin": + service.checkIn(input.getPathParameters().get("id"), + fromJson(input.getBody(), Checkin.class)); + break; + } + + return new APIGatewayProxyResponseEvent() + .withHeaders(headers) + .withStatusCode(200) + .withBody(toJson(result)); + } + + private static String toJson(T object) { + try { + return OBJECT_MAPPER.writeValueAsString(object); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + + private static T fromJson(String json, Class type) { + try { + return OBJECT_MAPPER.readValue(json, type); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + + private static SessionFactory createSessionFactory() { + Map settings = new HashMap<>(); + settings.put(URL, System.getenv("DB_URL")); + settings.put(DIALECT, "org.hibernate.dialect.PostgreSQLDialect"); + settings.put(DEFAULT_SCHEMA, "shipping"); + settings.put(DRIVER, "org.postgresql.Driver"); + settings.put(USER, System.getenv("DB_USER")); + settings.put(PASS, System.getenv("DB_PASSWORD")); + settings.put("hibernate.hikari.connectionTimeout", "20000"); + settings.put("hibernate.hikari.minimumIdle", "1"); + settings.put("hibernate.hikari.maximumPoolSize", "2"); + settings.put("hibernate.hikari.idleTimeout", "30000"); + +// commented out as we only need them on first use +// settings.put(HBM2DDL_AUTO, "create-only"); +// settings.put(HBM2DDL_DATABASE_ACTION, "create"); + + StandardServiceRegistry registry = new StandardServiceRegistryBuilder() + .applySettings(settings) + .build(); + + return new MetadataSources(registry) + .addAnnotatedClass(Consignment.class) + .addAnnotatedClass(Item.class) + .addAnnotatedClass(Checkin.class) + .buildMetadata() + .buildSessionFactory(); + } +} diff --git a/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Checkin.java b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Checkin.java new file mode 100644 index 0000000000..93e6404749 --- /dev/null +++ b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Checkin.java @@ -0,0 +1,28 @@ +package com.baeldung.lambda.shipping; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +@Embeddable +public class Checkin { + private String timeStamp; + private String location; + + @Column(name = "timestamp") + public String getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(String timeStamp) { + this.timeStamp = timeStamp; + } + + @Column(name = "location") + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } +} diff --git a/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Consignment.java b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Consignment.java new file mode 100644 index 0000000000..1a2371b37f --- /dev/null +++ b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Consignment.java @@ -0,0 +1,77 @@ +package com.baeldung.lambda.shipping; + +import javax.persistence.*; +import java.util.ArrayList; +import java.util.List; + +import static javax.persistence.FetchType.EAGER; + +@Entity(name = "consignment") +@Table(name = "consignment") +public class Consignment { + private String id; + private String source; + private String destination; + private boolean isDelivered; + private List items = new ArrayList<>(); + private List checkins = new ArrayList<>(); + + @Id + @Column(name = "consignment_id") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Column(name = "source") + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + @Column(name = "destination") + public String getDestination() { + return destination; + } + + public void setDestination(String destination) { + this.destination = destination; + } + + @Column(name = "delivered", columnDefinition = "boolean") + public boolean isDelivered() { + return isDelivered; + } + + public void setDelivered(boolean delivered) { + isDelivered = delivered; + } + + @ElementCollection(fetch = EAGER) + @CollectionTable(name = "consignment_item", joinColumns = @JoinColumn(name = "consignment_id")) + @OrderColumn(name = "item_index") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + @ElementCollection(fetch = EAGER) + @CollectionTable(name = "consignment_checkin", joinColumns = @JoinColumn(name = "consignment_id")) + @OrderColumn(name = "checkin_index") + public List getCheckins() { + return checkins; + } + + public void setCheckins(List checkins) { + this.checkins = checkins; + } +} diff --git a/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Item.java b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Item.java new file mode 100644 index 0000000000..de6194e180 --- /dev/null +++ b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/Item.java @@ -0,0 +1,38 @@ +package com.baeldung.lambda.shipping; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +@Embeddable +public class Item { + private String location; + private String description; + private String timeStamp; + + @Column(name = "location") + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + @Column(name = "description") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Column(name = "timestamp") + public String getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(String timeStamp) { + this.timeStamp = timeStamp; + } +} diff --git a/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/ShippingDao.java b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/ShippingDao.java new file mode 100644 index 0000000000..369dc33935 --- /dev/null +++ b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/ShippingDao.java @@ -0,0 +1,25 @@ +package com.baeldung.lambda.shipping; + +import org.hibernate.Session; +import org.hibernate.Transaction; + +import java.util.Optional; + +public class ShippingDao { + /** + * Save a consignment to the database + * @param consignment the consignment to save + */ + public void save(Session session, Consignment consignment) { + Transaction transaction = session.beginTransaction(); + session.save(consignment); + transaction.commit(); + } + + /** + * Find a consignment in the database by id + */ + public Optional find(Session session, String id) { + return Optional.ofNullable(session.get(Consignment.class, id)); + } +} diff --git a/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/ShippingService.java b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/ShippingService.java new file mode 100644 index 0000000000..4c951068ea --- /dev/null +++ b/aws-lambda/shipping-tracker/ShippingFunction/src/main/java/com/baeldung/lambda/shipping/ShippingService.java @@ -0,0 +1,62 @@ +package com.baeldung.lambda.shipping; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; + +import java.util.Comparator; +import java.util.UUID; + +public class ShippingService { + private SessionFactory sessionFactory; + private ShippingDao shippingDao; + + public ShippingService(SessionFactory sessionFactory, ShippingDao shippingDao) { + this.sessionFactory = sessionFactory; + this.shippingDao = shippingDao; + } + + public String createConsignment(Consignment consignment) { + try (Session session = sessionFactory.openSession()) { + consignment.setDelivered(false); + consignment.setId(UUID.randomUUID().toString()); + shippingDao.save(session, consignment); + return consignment.getId(); + } + } + + public void addItem(String consignmentId, Item item) { + try (Session session = sessionFactory.openSession()) { + shippingDao.find(session, consignmentId) + .ifPresent(consignment -> addItem(session, consignment, item)); + } + } + + private void addItem(Session session, Consignment consignment, Item item) { + consignment.getItems() + .add(item); + shippingDao.save(session, consignment); + } + + public void checkIn(String consignmentId, Checkin checkin) { + try (Session session = sessionFactory.openSession()) { + shippingDao.find(session, consignmentId) + .ifPresent(consignment -> checkIn(session, consignment, checkin)); + } + } + + private void checkIn(Session session, Consignment consignment, Checkin checkin) { + consignment.getCheckins().add(checkin); + consignment.getCheckins().sort(Comparator.comparing(Checkin::getTimeStamp)); + if (checkin.getLocation().equals(consignment.getDestination())) { + consignment.setDelivered(true); + } + shippingDao.save(session, consignment); + } + + public Consignment view(String consignmentId) { + try (Session session = sessionFactory.openSession()) { + return shippingDao.find(session, consignmentId) + .orElseGet(Consignment::new); + } + } +} diff --git a/aws-lambda/shipping-tracker/template.yaml b/aws-lambda/shipping-tracker/template.yaml new file mode 100644 index 0000000000..ec75c51ba1 --- /dev/null +++ b/aws-lambda/shipping-tracker/template.yaml @@ -0,0 +1,47 @@ +AWSTemplateFormatVersion: '2010-09-09' +Transform: AWS::Serverless-2016-10-31 +Description: > + shipping-tracker + + Sample SAM Template for shipping-tracker + +# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst +Globals: + Function: + Timeout: 20 + +Resources: + ShippingFunction: + Type: AWS::Serverless::Function + Properties: + CodeUri: ShippingFunction + Handler: com.baeldung.lambda.shipping.App::handleRequest + Runtime: java8 + MemorySize: 512 + Environment: + Variables: + DB_URL: jdbc:postgresql://postgres/postgres + DB_USER: postgres + DB_PASSWORD: password + Events: + CreateConsignment: + Type: Api + Properties: + Path: /consignment + Method: post + AddItem: + Type: Api + Properties: + Path: /consignment/{id}/item + Method: post + CheckIn: + Type: Api + Properties: + Path: /consignment/{id}/checkin + Method: post + ViewConsignment: + Type: Api + Properties: + Path: /consignment/{id} + Method: get + From fdc36375ff380dac6d98451c185205eac3507b6b Mon Sep 17 00:00:00 2001 From: Maiklins Date: Thu, 10 Sep 2020 19:26:04 +0200 Subject: [PATCH 0700/1862] Java-2602 Check spring-websockets PR (#10002) Co-authored-by: mikr --- .../{resources/chat.html => index.html} | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) rename spring-websockets/src/main/webapp/{resources/chat.html => index.html} (85%) diff --git a/spring-websockets/src/main/webapp/resources/chat.html b/spring-websockets/src/main/webapp/index.html similarity index 85% rename from spring-websockets/src/main/webapp/resources/chat.html rename to spring-websockets/src/main/webapp/index.html index 17c8494dd8..2bf36d59f5 100644 --- a/spring-websockets/src/main/webapp/resources/chat.html +++ b/spring-websockets/src/main/webapp/index.html @@ -2,63 +2,63 @@ Chat WebSocket - - + + From 43fb479c815a010c983560885f8b713eefd4347f Mon Sep 17 00:00:00 2001 From: Usman Mohyuddin Date: Thu, 10 Sep 2020 22:39:44 +0500 Subject: [PATCH 0701/1862] update the PR with removal of README file and update pom.xml files according to comments --- core-groovy-strings/README.md | 8 -- core-groovy-strings/pom.xml | 114 +++++++++++++----- .../removeprefix/RemovePrefixTest.groovy | 37 ++++-- pom.xml | 2 + 4 files changed, 108 insertions(+), 53 deletions(-) delete mode 100644 core-groovy-strings/README.md diff --git a/core-groovy-strings/README.md b/core-groovy-strings/README.md deleted file mode 100644 index e3202e2dd0..0000000000 --- a/core-groovy-strings/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Core Groovy Strings - -This module contains articles about core Groovy strings concepts - -## Relevant articles: - -- [Remove prefix in Groovy]() -- [[<-- Prev]](/core-groovy-strings) diff --git a/core-groovy-strings/pom.xml b/core-groovy-strings/pom.xml index 059b53662c..1144d748ee 100644 --- a/core-groovy-strings/pom.xml +++ b/core-groovy-strings/pom.xml @@ -3,70 +3,120 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - com.baeldung 4.0.0 core-groovy-strings 1.0-SNAPSHOT core-groovy-strings jar - + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + org.codehaus.groovy - groovy-all + groovy ${groovy.version} + + + org.codehaus.groovy + groovy-all + ${groovy-all.version} pom + + org.codehaus.groovy + groovy-dateutil + ${groovy.version} + + + org.codehaus.groovy + groovy-sql + ${groovy-sql.version} + org.junit.platform junit-platform-runner ${junit.platform.version} test + + org.hsqldb + hsqldb + ${hsqldb.version} + test + + + org.spockframework + spock-core + ${spock-core.version} + test + - src/main/groovy - src/main/java - org.codehaus.groovy - groovy-eclipse-compiler - ${groovy.compiler.version} - true + org.codehaus.gmavenplus + gmavenplus-plugin + ${gmavenplus-plugin.version} + + + + addSources + addTestSources + compile + compileTests + + + - maven-compiler-plugin - ${compiler.plugin.version} - - groovy-eclipse-compiler - ${java.version} - ${java.version} - + maven-failsafe-plugin + ${maven-failsafe-plugin.version} - org.codehaus.groovy - groovy-eclipse-compiler - ${groovy.compiler.version} - - - org.codehaus.groovy - groovy-eclipse-batch - ${groovy.version}-01 + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + + + junit5 + + integration-test + verify + + + + **/*Test5.java + + + + - + + + + central + https://jcenter.bintray.com + + + 1.0.0 - 1.1.3 - 2.5.7 - 2.20.1 - 3.8.0 - 3.3.0-01 - 1.8 + 2.5.6 + 2.5.6 + 2.5.6 + 2.4.0 + 1.1-groovy-2.4 + 1.6 - + \ No newline at end of file diff --git a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy index aa9e65d98d..4cdcb4ddfa 100644 --- a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy +++ b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy @@ -9,23 +9,28 @@ class RemovePrefixTest { @Test public void whenCasePrefixIsRemoved_thenReturnTrue() { def trimPrefix = { - it.startsWith('Groovy') ? it.minus('Groovy') : it + it.startsWith('Groovy-') ? it.minus('Groovy-') : it } + + def actual = trimPrefix("Groovy-Tutorials at Baeldung") + def expected = "Tutorials at Baeldung" - Assert.assertEquals(trimPrefix("GroovyTutorials at Baeldung"), "Tutorials at Baeldung") + Assert.assertEquals(expected, actual) } @Test - public void whenPrefixIsRemovedWithIgnoreCase_thenReturnTrue() { + public void whenPrefixIsRemoved_thenReturnTrue() { String prefix = "groovy-" String trimPrefix = "Groovy-Tutorials at Baeldung" - def result; + def actual; if(trimPrefix.startsWithIgnoreCase(prefix)) { - result = trimPrefix.substring(prefix.length()) + actual = trimPrefix.substring(prefix.length()) } + + def expected = "Tutorials at Baeldung" - Assert.assertEquals("Tutorials at Baeldung", result) + Assert.assertEquals(expected, actual) } @Test @@ -33,26 +38,32 @@ class RemovePrefixTest { def regex = ~"^([Gg])roovy-" String trimPrefix = "Groovy-Tutorials at Baeldung" - String result = trimPrefix - regex + String actual = trimPrefix - regex + + def expected = "Tutorials at Baeldung" - Assert.assertEquals("Tutorials at Baeldung", result) + Assert.assertEquals(expected, actual) } @Test public void whenPrefixIsRemovedUsingReplaceFirst_thenReturnTrue() { def regex = ~"^groovy" String trimPrefix = "groovyTutorials at Baeldung's groovy page" - String result = trimPrefix.replaceFirst(regex, "") + String actual = trimPrefix.replaceFirst(regex, "") - Assert.assertEquals("Tutorials at Baeldung's groovy page", result) + def expected = "Tutorials at Baeldung's groovy page" + + Assert.assertEquals(expected, actual) } @Test public void whenPrefixIsRemovedUsingReplaceAll_thenReturnTrue() { String trimPrefix = "groovyTutorials at Baeldung groovy" - String result = trimPrefix.replaceAll(/^groovy/, "") + String actual = trimPrefix.replaceAll(/^groovy/, "") + + def expected = "Tutorials at Baeldung groovy" - Assert.assertEquals("Tutorials at Baeldung groovy", result) + Assert.assertEquals(expected, actual) } -} +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index ffdfe4cffa..f43318bcaa 100644 --- a/pom.xml +++ b/pom.xml @@ -383,6 +383,7 @@ core-groovy core-groovy-2 core-groovy-collections + core-groovy-strings core-java-modules core-kotlin-modules @@ -898,6 +899,7 @@ core-groovy core-groovy-2 core-groovy-collections + core-groovy-strings core-java-modules core-kotlin-modules From 56cbfb1c6f7a6c60653f5c9f00a3c3c6a06645d9 Mon Sep 17 00:00:00 2001 From: Ricardo Caldas Date: Thu, 10 Sep 2020 17:16:46 -0300 Subject: [PATCH 0702/1862] BAEL-2503 Add a new section in Lombok builder article --- .../builder/RequiredFieldAnnotation.java | 16 +++++++------- .../lombok/builder/RequiredFieldOverload.java | 20 ------------------ .../builder/RequiredFieldAnnotationTest.java | 21 +++++++++++++++++++ 3 files changed, 28 insertions(+), 29 deletions(-) delete mode 100644 lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldOverload.java create mode 100644 lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationTest.java diff --git a/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java index f09f59baea..8781101613 100644 --- a/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java +++ b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java @@ -1,19 +1,17 @@ package com.baeldung.lombok.builder; import lombok.Builder; +import lombok.Getter; import lombok.NonNull; -@Builder(builderMethodName = "hiddenBuilder") +@Builder(builderMethodName = "internalBuilder") +@Getter public class RequiredFieldAnnotation { - @NonNull - private String name; - private String description; + + @NonNull String name; + String description; public static RequiredFieldAnnotationBuilder builder(String name) { - return hiddenBuilder().name(name); - } - - public void example() { - RequiredFieldAnnotation.builder("NameField").description("Field Description").build(); + return internalBuilder().name(name); } } diff --git a/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldOverload.java b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldOverload.java deleted file mode 100644 index 6b123e3cbe..0000000000 --- a/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldOverload.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.lombok.builder; - -import lombok.Builder; -import lombok.NonNull; - -@Builder -public class RequiredFieldOverload { - @NonNull - private String name; - private String description; - - public static RequiredFieldOverloadBuilder builder(String name) { - return new RequiredFieldOverloadBuilder().name(name); - } - - public void example() { - RequiredFieldAnnotation.builder("NameField").description("Field Description").build(); - } - -} diff --git a/lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationTest.java b/lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationTest.java new file mode 100644 index 0000000000..9d347327d4 --- /dev/null +++ b/lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationTest.java @@ -0,0 +1,21 @@ +package com.baeldung.lombok.builder; + +import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; + +import static org.junit.jupiter.api.Assertions.*; + +public class RequiredFieldAnnotationTest { + RequiredFieldAnnotation requiredFieldTest; + + @BeforeEach + void setUp() { + requiredFieldTest = RequiredFieldAnnotation.builder("NameField").description("Field Description").build(); + } + + @Test + public void givenBuilderWithRequiredParameter_thenParameterIsPresent() { + assertEquals(requiredFieldTest.getName(), "NameField"); + } + +} \ No newline at end of file From 751aa761594c834efae0f2074ac4fd1175706b6a Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Fri, 11 Sep 2020 01:08:12 +0200 Subject: [PATCH 0703/1862] [BAEL-4583] Improvement- Java Period --- .../com/baeldung/date/DateDiffUnitTest.java | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/date/DateDiffUnitTest.java b/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/date/DateDiffUnitTest.java index 226556d4bb..9a0779ccac 100644 --- a/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/date/DateDiffUnitTest.java +++ b/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/date/DateDiffUnitTest.java @@ -1,6 +1,8 @@ package com.baeldung.date; -import static org.junit.Assert.assertEquals; +import org.joda.time.Days; +import org.joda.time.Minutes; +import org.junit.Test; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -16,7 +18,7 @@ import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import static org.junit.Assert.*; public class DateDiffUnitTest { @@ -29,18 +31,39 @@ public class DateDiffUnitTest { long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); - assertEquals(diff, 6); + assertEquals(6, diff); } @Test - public void givenTwoDatesInJava8_whenDifferentiating_thenWeGetSix() { - LocalDate now = LocalDate.now(); - LocalDate sixDaysBehind = now.minusDays(6); + public void givenTwoDatesInJava8_whenUsingPeriodGetDays_thenWorks() { + LocalDate aDate = LocalDate.of(2020, 9, 11); + LocalDate sixDaysBehind = aDate.minusDays(6); - Period period = Period.between(now, sixDaysBehind); + Period period = Period.between(aDate, sixDaysBehind); int diff = Math.abs(period.getDays()); - assertEquals(diff, 6); + assertEquals(6, diff); + } + + @Test + public void givenTwoDatesInJava8_whenUsingPeriodGetDays_thenDoesNotWork() { + LocalDate aDate = LocalDate.of(2020, 9, 11); + LocalDate sixtyDaysBehind = aDate.minusDays(60); + Period period = Period.between(aDate, sixtyDaysBehind); + int diff = Math.abs(period.getDays()); + //not equals + assertNotEquals(60, diff); + } + + @Test + public void givenTwoDatesInJava8_whenUsingPeriod_thenWeGet0Year1Month29Days() { + LocalDate aDate = LocalDate.of(2020, 9, 11); + LocalDate sixtyDaysBehind = aDate.minusDays(60); + Period period = Period.between(aDate, sixtyDaysBehind); + int years = Math.abs(period.getYears()); + int months = Math.abs(period.getMonths()); + int days = Math.abs(period.getDays()); + assertArrayEquals(new int[] { 0, 1, 29 }, new int[] { years, months, days }); } @Test @@ -51,7 +74,7 @@ public class DateDiffUnitTest { Duration duration = Duration.between(now, sixMinutesBehind); long diff = Math.abs(duration.toMinutes()); - assertEquals(diff, 6); + assertEquals(6, diff); } @Test @@ -61,7 +84,7 @@ public class DateDiffUnitTest { long diff = ChronoUnit.SECONDS.between(now, tenSecondsLater); - assertEquals(diff, 10); + assertEquals(10, diff); } @Test @@ -69,9 +92,9 @@ public class DateDiffUnitTest { LocalDateTime ldt = LocalDateTime.now(); ZonedDateTime now = ldt.atZone(ZoneId.of("America/Montreal")); ZonedDateTime sixDaysBehind = now.withZoneSameInstant(ZoneId.of("Asia/Singapore")) - .minusDays(6); + .minusDays(6); long diff = ChronoUnit.DAYS.between(sixDaysBehind, now); - assertEquals(diff, 6); + assertEquals(6, diff); } @Test @@ -81,7 +104,7 @@ public class DateDiffUnitTest { long diff = now.until(tenSecondsLater, ChronoUnit.SECONDS); - assertEquals(diff, 10); + assertEquals(10, diff); } @Test @@ -89,10 +112,9 @@ public class DateDiffUnitTest { org.joda.time.LocalDate now = org.joda.time.LocalDate.now(); org.joda.time.LocalDate sixDaysBehind = now.minusDays(6); - org.joda.time.Period period = new org.joda.time.Period(now, sixDaysBehind); - long diff = Math.abs(period.getDays()); + long diff = Math.abs(Days.daysBetween(now, sixDaysBehind).getDays()); - assertEquals(diff, 6); + assertEquals(6, diff); } @Test @@ -100,8 +122,9 @@ public class DateDiffUnitTest { org.joda.time.LocalDateTime now = org.joda.time.LocalDateTime.now(); org.joda.time.LocalDateTime sixMinutesBehind = now.minusMinutes(6); - org.joda.time.Period period = new org.joda.time.Period(now, sixMinutesBehind); - long diff = Math.abs(period.getDays()); + long diff = Math.abs(Minutes.minutesBetween(now, sixMinutesBehind).getMinutes()); + assertEquals(6, diff); + } @Test @@ -111,6 +134,6 @@ public class DateDiffUnitTest { long diff = Math.abs(now.numDaysFrom(sixDaysBehind)); - assertEquals(diff, 6); + assertEquals(6, diff); } -} \ No newline at end of file +} From 4893af40f61ce902ea60a897a55e586661fb3972 Mon Sep 17 00:00:00 2001 From: Sebastian Luna Date: Thu, 10 Sep 2020 19:55:56 -0500 Subject: [PATCH 0704/1862] BAEL-4387 Add AssertJ assertions --- java-collections-conversions-2/pom.xml | 6 ++++++ .../ArrayToListConversionUnitTest.java | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/java-collections-conversions-2/pom.xml b/java-collections-conversions-2/pom.xml index 0f7cdadeb2..23f20276a3 100644 --- a/java-collections-conversions-2/pom.xml +++ b/java-collections-conversions-2/pom.xml @@ -15,6 +15,12 @@ + + org.assertj + assertj-core + 3.17.2 + test + org.apache.commons commons-lang3 diff --git a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java index 80e7b93b0c..565c938d48 100644 --- a/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java +++ b/java-collections-conversions-2/src/test/java/com/baeldung/arrayconversion/ArrayToListConversionUnitTest.java @@ -1,5 +1,6 @@ package com.baeldung.arrayconversion; +import org.assertj.core.api.ListAssert; import org.hamcrest.CoreMatchers; import org.junit.Test; @@ -7,8 +8,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertArrayEquals; +import static org.assertj.core.api.Assertions.assertThat; public class ArrayToListConversionUnitTest { @@ -17,8 +17,8 @@ public class ArrayToListConversionUnitTest { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = Arrays.asList(stringArray); stringList.set(0, "E"); - assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D")); - assertArrayEquals(stringArray, new String[] { "E", "B", "C", "D" }); + assertThat(stringList).containsExactly("E", "B", "C", "D"); + assertThat(stringArray).containsExactly("E", "B", "C", "D"); stringList.add("F"); } @@ -27,9 +27,9 @@ public class ArrayToListConversionUnitTest { String[] stringArray = new String[] { "A", "B", "C", "D" }; List stringList = new ArrayList<>(Arrays.asList(stringArray)); stringList.set(0, "E"); - assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D")); - assertArrayEquals(stringArray, new String[] { "A", "B", "C", "D" }); + assertThat(stringList).containsExactly("E", "B", "C", "D"); + assertThat(stringArray).containsExactly("A", "B", "C", "D"); stringList.add("F"); - assertThat(stringList, CoreMatchers.hasItems("E", "B", "C", "D", "F")); + assertThat(stringList).containsExactly("E", "B", "C", "D", "F"); } } From c3cd93fcdbdd4033dda418c8ac0bad89aacedb63 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 11 Sep 2020 14:49:02 +0200 Subject: [PATCH 0705/1862] JAVA-2563: Upgrade Spring Boot version to 2.3.3.RELEASE (#9985) * JAVA-2563: Upgrade Spring Boot version to 2.3.3.RELEASE * JAVA-2563: Downgrade spring-cloud-connectors-heroku to Spring Boot 2.2.6.RELEASE * JAVA-2563: Add joda-time version * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Use MongoClients factory instead of MongoClient directly * JAVA-2563: Downgrade spring-5-data-reactive to Spring Boot 2.2.6.RELEASE * JAVA-2563: Switch back to default bootstrap mode for JPA * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Switch from ServerHttpRequest to ServerWebExchange interface * JAVA-2563: Use OutputCaptureRule instead of OutputCapture * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Add spring-boot-starter-validation dependency * JAVA-2563: Fix Jackson dependency * JAVA-2563: Fix ManualEmbeddedMongoDbIntegrationTest * JAVA-2563: Replace validation-api with spring-boot-starter-validation * JAVA-2563: Fix usage of deprecated getErrorAttributes method * JAVA-2563: Downgrade spring-data-cassandra-reactive to Spring Boot 2.2.6.RELEASE * JAVA-2563: Set spring.datasource.generate-unique-name to false in spring-session-jdbc --- ddd/pom.xml | 4 +++ jmeter/pom.xml | 4 +++ parent-boot-2/pom.xml | 2 +- persistence-modules/r2dbc/pom.xml | 4 +++ .../ManualEmbeddedMongoDbIntegrationTest.java | 25 ++++++++++--------- .../spring-data-cassandra-reactive/pom.xml | 1 + .../src/main/resources/application.properties | 2 +- spring-5-data-reactive/pom.xml | 1 + spring-5-reactive-2/pom.xml | 4 +++ .../authresolver/CustomWebSecurityConfig.java | 9 ++++--- .../errorhandling/GlobalErrorAttributes.java | 10 +++----- .../GlobalErrorWebExceptionHandler.java | 3 ++- .../spring-boot-angular/pom.xml | 4 +++ .../spring-boot-autoconfiguration/pom.xml | 4 +++ spring-boot-modules/spring-boot-crud/pom.xml | 4 +++ spring-boot-modules/spring-boot-mvc-2/pom.xml | 5 ++++ .../spring-boot-properties/pom.xml | 4 +++ .../spring-boot-runtime/pom.xml | 5 ++++ .../spring-boot-springdoc/pom.xml | 4 +++ .../spring-boot-testing/pom.xml | 4 +++ ...ltiProfileTestLogLevelIntegrationTest.java | 4 +-- .../LogbackTestLogLevelIntegrationTest.java | 4 +-- ...estLogLevelWithProfileIntegrationTest.java | 4 +-- spring-boot-modules/spring-boot/pom.xml | 9 +++---- .../spring-cloud-connectors-heroku/pom.xml | 1 + spring-cloud/spring-cloud-vault/pom.xml | 4 +++ spring-jenkins-pipeline/pom.xml | 4 +++ spring-mvc-basics-3/pom.xml | 5 ++++ spring-mvc-basics/pom.xml | 4 +++ spring-mvc-java/pom.xml | 6 ----- spring-rest-hal-browser/pom.xml | 4 +++ spring-rest-http/pom.xml | 4 +++ .../src/main/resources/application.properties | 1 + spring-thymeleaf-2/pom.xml | 4 +++ spring-thymeleaf-3/pom.xml | 4 +++ testing-modules/rest-assured/pom.xml | 1 + 36 files changed, 124 insertions(+), 42 deletions(-) diff --git a/ddd/pom.xml b/ddd/pom.xml index 9f960502a3..a67719f8a6 100644 --- a/ddd/pom.xml +++ b/ddd/pom.xml @@ -78,6 +78,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-test diff --git a/jmeter/pom.xml b/jmeter/pom.xml index 945210edd7..e2830baef5 100644 --- a/jmeter/pom.xml +++ b/jmeter/pom.xml @@ -23,6 +23,10 @@ org.springframework.boot spring-boot-starter-data-rest + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-test diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index ed0f327b8c..dab9f015b3 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.2.6.RELEASE + 2.3.3.RELEASE 1.9.1 diff --git a/persistence-modules/r2dbc/pom.xml b/persistence-modules/r2dbc/pom.xml index 2da81cba06..119d0547e3 100644 --- a/persistence-modules/r2dbc/pom.xml +++ b/persistence-modules/r2dbc/pom.xml @@ -21,6 +21,10 @@ org.springframework.boot spring-boot-starter-webflux + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot diff --git a/persistence-modules/spring-boot-persistence-mongodb/src/test/java/com/baeldung/mongodb/ManualEmbeddedMongoDbIntegrationTest.java b/persistence-modules/spring-boot-persistence-mongodb/src/test/java/com/baeldung/mongodb/ManualEmbeddedMongoDbIntegrationTest.java index c49b99ed99..21cf56172e 100644 --- a/persistence-modules/spring-boot-persistence-mongodb/src/test/java/com/baeldung/mongodb/ManualEmbeddedMongoDbIntegrationTest.java +++ b/persistence-modules/spring-boot-persistence-mongodb/src/test/java/com/baeldung/mongodb/ManualEmbeddedMongoDbIntegrationTest.java @@ -1,18 +1,8 @@ package com.baeldung.mongodb; -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.data.mongodb.core.MongoTemplate; -import org.springframework.util.SocketUtils; - import com.mongodb.BasicDBObjectBuilder; import com.mongodb.DBObject; -import com.mongodb.MongoClient; - +import com.mongodb.client.MongoClients; import de.flapdoodle.embed.mongo.MongodExecutable; import de.flapdoodle.embed.mongo.MongodStarter; import de.flapdoodle.embed.mongo.config.IMongodConfig; @@ -20,8 +10,19 @@ import de.flapdoodle.embed.mongo.config.MongodConfigBuilder; import de.flapdoodle.embed.mongo.config.Net; import de.flapdoodle.embed.mongo.distribution.Version; import de.flapdoodle.embed.process.runtime.Network; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.util.SocketUtils; + +import static org.assertj.core.api.Assertions.assertThat; class ManualEmbeddedMongoDbIntegrationTest { + + private static final String CONNECTION_STRING = "mongodb://%s:%d"; + private MongodExecutable mongodExecutable; private MongoTemplate mongoTemplate; @@ -42,7 +43,7 @@ class ManualEmbeddedMongoDbIntegrationTest { MongodStarter starter = MongodStarter.getDefaultInstance(); mongodExecutable = starter.prepare(mongodConfig); mongodExecutable.start(); - mongoTemplate = new MongoTemplate(new MongoClient(ip, randomPort), "test"); + mongoTemplate = new MongoTemplate(MongoClients.create(String.format(CONNECTION_STRING, ip, randomPort)),"test"); } @DisplayName("Given object When save object using MongoDB template Then object can be found") diff --git a/persistence-modules/spring-data-cassandra-reactive/pom.xml b/persistence-modules/spring-data-cassandra-reactive/pom.xml index 70a5f556e2..16486bf380 100644 --- a/persistence-modules/spring-data-cassandra-reactive/pom.xml +++ b/persistence-modules/spring-data-cassandra-reactive/pom.xml @@ -51,6 +51,7 @@ + 2.2.6.RELEASE 3.11.2.0 diff --git a/software-security/sql-injection-samples/src/main/resources/application.properties b/software-security/sql-injection-samples/src/main/resources/application.properties index 8b13789179..953384eac4 100644 --- a/software-security/sql-injection-samples/src/main/resources/application.properties +++ b/software-security/sql-injection-samples/src/main/resources/application.properties @@ -1 +1 @@ - +spring.data.jpa.repositories.bootstrap-mode=default diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml index aeaf6daf1a..396f7f5959 100644 --- a/spring-5-data-reactive/pom.xml +++ b/spring-5-data-reactive/pom.xml @@ -224,6 +224,7 @@ 1.4.200 1.5.23 3.3.1.RELEASE + 2.2.6.RELEASE diff --git a/spring-5-reactive-2/pom.xml b/spring-5-reactive-2/pom.xml index 4cb85d879e..093be0f03c 100644 --- a/spring-5-reactive-2/pom.xml +++ b/spring-5-reactive-2/pom.xml @@ -20,6 +20,10 @@ org.springframework.boot spring-boot-starter-webflux + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-security diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/CustomWebSecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/CustomWebSecurityConfig.java index d07a991089..dc5eab3dd5 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/CustomWebSecurityConfig.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/authresolver/CustomWebSecurityConfig.java @@ -2,7 +2,6 @@ package com.baeldung.reactive.authresolver; import java.util.Collections; import org.springframework.context.annotation.Bean; -import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.security.authentication.ReactiveAuthenticationManager; import org.springframework.security.authentication.ReactiveAuthenticationManagerResolver; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -15,6 +14,7 @@ import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.security.web.server.authentication.AuthenticationWebFilter; +import org.springframework.web.server.ServerWebExchange; import reactor.core.publisher.Mono; @EnableWebFluxSecurity @@ -38,9 +38,10 @@ public class CustomWebSecurityConfig { return new AuthenticationWebFilter(resolver()); } - public ReactiveAuthenticationManagerResolver resolver() { - return request -> { - if (request + public ReactiveAuthenticationManagerResolver resolver() { + return exchange -> { + if (exchange + .getRequest() .getPath() .subPath(0) .value() diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/errorhandling/GlobalErrorAttributes.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/errorhandling/GlobalErrorAttributes.java index a50651ced7..5885ac50d0 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/errorhandling/GlobalErrorAttributes.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/errorhandling/GlobalErrorAttributes.java @@ -2,6 +2,8 @@ package com.baeldung.reactive.errorhandling; import java.util.Map; + +import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.reactive.error.DefaultErrorAttributes; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; @@ -13,13 +15,9 @@ public class GlobalErrorAttributes extends DefaultErrorAttributes{ private HttpStatus status = HttpStatus.BAD_REQUEST; private String message = "please provide a name"; - public GlobalErrorAttributes() { - super(false); - } - @Override - public Map getErrorAttributes(ServerRequest request, boolean includeStackTrace) { - Map map = super.getErrorAttributes(request, includeStackTrace); + public Map getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) { + Map map = super.getErrorAttributes(request, options); map.put("status", getStatus()); map.put("message", getMessage()); return map; diff --git a/spring-5-reactive/src/main/java/com/baeldung/reactive/errorhandling/GlobalErrorWebExceptionHandler.java b/spring-5-reactive/src/main/java/com/baeldung/reactive/errorhandling/GlobalErrorWebExceptionHandler.java index 09bccb0d5e..051e4b8df5 100644 --- a/spring-5-reactive/src/main/java/com/baeldung/reactive/errorhandling/GlobalErrorWebExceptionHandler.java +++ b/spring-5-reactive/src/main/java/com/baeldung/reactive/errorhandling/GlobalErrorWebExceptionHandler.java @@ -4,6 +4,7 @@ package com.baeldung.reactive.errorhandling; import java.util.Map; import org.springframework.boot.autoconfigure.web.ResourceProperties; import org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler; +import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.reactive.error.ErrorAttributes; import org.springframework.context.ApplicationContext; import org.springframework.core.annotation.Order; @@ -37,7 +38,7 @@ public class GlobalErrorWebExceptionHandler extends AbstractErrorWebExceptionHan private Mono renderErrorResponse(final ServerRequest request) { - final Map errorPropertiesMap = getErrorAttributes(request, false); + final Map errorPropertiesMap = getErrorAttributes(request, ErrorAttributeOptions.defaults()); return ServerResponse.status(HttpStatus.BAD_REQUEST) .contentType(MediaType.APPLICATION_JSON_UTF8) diff --git a/spring-boot-modules/spring-boot-angular/pom.xml b/spring-boot-modules/spring-boot-angular/pom.xml index 4b3ac27834..ac63d21bb8 100644 --- a/spring-boot-modules/spring-boot-angular/pom.xml +++ b/spring-boot-modules/spring-boot-angular/pom.xml @@ -26,6 +26,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + com.h2database h2 diff --git a/spring-boot-modules/spring-boot-autoconfiguration/pom.xml b/spring-boot-modules/spring-boot-autoconfiguration/pom.xml index 5709d1d796..269d87bbb9 100644 --- a/spring-boot-modules/spring-boot-autoconfiguration/pom.xml +++ b/spring-boot-modules/spring-boot-autoconfiguration/pom.xml @@ -26,6 +26,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-data-jpa diff --git a/spring-boot-modules/spring-boot-crud/pom.xml b/spring-boot-modules/spring-boot-crud/pom.xml index a4be360b0f..cf1bfe6da0 100644 --- a/spring-boot-modules/spring-boot-crud/pom.xml +++ b/spring-boot-modules/spring-boot-crud/pom.xml @@ -20,6 +20,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-thymeleaf diff --git a/spring-boot-modules/spring-boot-mvc-2/pom.xml b/spring-boot-modules/spring-boot-mvc-2/pom.xml index 0b9213a7ea..580224cfd0 100644 --- a/spring-boot-modules/spring-boot-mvc-2/pom.xml +++ b/spring-boot-modules/spring-boot-mvc-2/pom.xml @@ -23,6 +23,11 @@ spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + + org.springframework.boot spring-boot-devtools diff --git a/spring-boot-modules/spring-boot-properties/pom.xml b/spring-boot-modules/spring-boot-properties/pom.xml index a5594ee2de..cfdc71b8d6 100644 --- a/spring-boot-modules/spring-boot-properties/pom.xml +++ b/spring-boot-modules/spring-boot-properties/pom.xml @@ -27,6 +27,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-actuator diff --git a/spring-boot-modules/spring-boot-runtime/pom.xml b/spring-boot-modules/spring-boot-runtime/pom.xml index d3966beb65..ce6fa7ea93 100644 --- a/spring-boot-modules/spring-boot-runtime/pom.xml +++ b/spring-boot-modules/spring-boot-runtime/pom.xml @@ -29,6 +29,11 @@ spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + + org.springframework.boot spring-boot-starter-thymeleaf diff --git a/spring-boot-modules/spring-boot-springdoc/pom.xml b/spring-boot-modules/spring-boot-springdoc/pom.xml index 3e8d5175f7..ed272200da 100644 --- a/spring-boot-modules/spring-boot-springdoc/pom.xml +++ b/spring-boot-modules/spring-boot-springdoc/pom.xml @@ -24,6 +24,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-data-jpa diff --git a/spring-boot-modules/spring-boot-testing/pom.xml b/spring-boot-modules/spring-boot-testing/pom.xml index bd5ef901dd..5bf626f165 100644 --- a/spring-boot-modules/spring-boot-testing/pom.xml +++ b/spring-boot-modules/spring-boot-testing/pom.xml @@ -26,6 +26,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-tomcat diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackMultiProfileTestLogLevelIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackMultiProfileTestLogLevelIntegrationTest.java index ffe99672be..b3d80a7d8b 100644 --- a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackMultiProfileTestLogLevelIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackMultiProfileTestLogLevelIntegrationTest.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.rule.OutputCapture; +import org.springframework.boot.test.system.OutputCaptureRule; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.ResponseEntity; import org.springframework.test.annotation.DirtiesContext; @@ -29,7 +29,7 @@ public class LogbackMultiProfileTestLogLevelIntegrationTest { private TestRestTemplate restTemplate; @Rule - public OutputCapture outputCapture = new OutputCapture(); + public OutputCaptureRule outputCapture = new OutputCaptureRule(); private String baseUrl = "/testLogLevel"; diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackTestLogLevelIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackTestLogLevelIntegrationTest.java index cbd22e8087..f60a5e0ee3 100644 --- a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackTestLogLevelIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/LogbackTestLogLevelIntegrationTest.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.rule.OutputCapture; +import org.springframework.boot.test.system.OutputCaptureRule; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.ResponseEntity; import org.springframework.test.annotation.DirtiesContext; @@ -29,7 +29,7 @@ public class LogbackTestLogLevelIntegrationTest { private TestRestTemplate restTemplate; @Rule - public OutputCapture outputCapture = new OutputCapture(); + public OutputCaptureRule outputCapture = new OutputCaptureRule(); private String baseUrl = "/testLogLevel"; diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/TestLogLevelWithProfileIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/TestLogLevelWithProfileIntegrationTest.java index 571b826b80..e59b673a1c 100644 --- a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/TestLogLevelWithProfileIntegrationTest.java +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/testloglevel/TestLogLevelWithProfileIntegrationTest.java @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.rule.OutputCapture; +import org.springframework.boot.test.system.OutputCaptureRule; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.http.ResponseEntity; import org.springframework.test.annotation.DirtiesContext; @@ -29,7 +29,7 @@ public class TestLogLevelWithProfileIntegrationTest { private TestRestTemplate restTemplate; @Rule - public OutputCapture outputCapture = new OutputCapture(); + public OutputCaptureRule outputCapture = new OutputCaptureRule(); private String baseUrl = "/testLogLevel"; diff --git a/spring-boot-modules/spring-boot/pom.xml b/spring-boot-modules/spring-boot/pom.xml index 5efcffdf03..c1f1ea3072 100644 --- a/spring-boot-modules/spring-boot/pom.xml +++ b/spring-boot-modules/spring-boot/pom.xml @@ -27,6 +27,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-data-jpa @@ -98,11 +102,6 @@ rome ${rome.version} - - - javax.validation - validation-api - diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index c09a282197..7d85e07bb8 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -60,6 +60,7 @@ + 2.2.6.RELEASE Hoxton.SR4 42.2.10 1.10.10 diff --git a/spring-cloud/spring-cloud-vault/pom.xml b/spring-cloud/spring-cloud-vault/pom.xml index a5a29d9024..d9ae6b515f 100644 --- a/spring-cloud/spring-cloud-vault/pom.xml +++ b/spring-cloud/spring-cloud-vault/pom.xml @@ -62,6 +62,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-data-jpa diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml index 38d4ed15de..152e107409 100644 --- a/spring-jenkins-pipeline/pom.xml +++ b/spring-jenkins-pipeline/pom.xml @@ -24,6 +24,10 @@ org.springframework.boot spring-boot-starter-data-rest + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-test diff --git a/spring-mvc-basics-3/pom.xml b/spring-mvc-basics-3/pom.xml index 1dea8f9e93..a929337b25 100644 --- a/spring-mvc-basics-3/pom.xml +++ b/spring-mvc-basics-3/pom.xml @@ -21,6 +21,11 @@ spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + + org.springframework.boot spring-boot-starter-test diff --git a/spring-mvc-basics/pom.xml b/spring-mvc-basics/pom.xml index 159dda955f..d212bc425a 100644 --- a/spring-mvc-basics/pom.xml +++ b/spring-mvc-basics/pom.xml @@ -20,6 +20,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.apache.tomcat.embed diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index 9e3457aa8a..a45e9c8521 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -42,12 +42,6 @@ tomcat-embed-jasper provided - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - net.sourceforge.htmlunit diff --git a/spring-rest-hal-browser/pom.xml b/spring-rest-hal-browser/pom.xml index 7b629dba44..c8066b89a4 100644 --- a/spring-rest-hal-browser/pom.xml +++ b/spring-rest-hal-browser/pom.xml @@ -20,6 +20,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot diff --git a/spring-rest-http/pom.xml b/spring-rest-http/pom.xml index 32d2804220..18b7e0af05 100644 --- a/spring-rest-http/pom.xml +++ b/spring-rest-http/pom.xml @@ -20,6 +20,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework spring-oxm diff --git a/spring-session/spring-session-jdbc/src/main/resources/application.properties b/spring-session/spring-session-jdbc/src/main/resources/application.properties index 119638de31..bb9dd24590 100644 --- a/spring-session/spring-session-jdbc/src/main/resources/application.properties +++ b/spring-session/spring-session-jdbc/src/main/resources/application.properties @@ -1,3 +1,4 @@ +spring.datasource.generate-unique-name=false spring.session.store-type=jdbc spring.h2.console.enabled=true spring.h2.console.path=/h2-console \ No newline at end of file diff --git a/spring-thymeleaf-2/pom.xml b/spring-thymeleaf-2/pom.xml index 24c159dab9..43f36d9887 100644 --- a/spring-thymeleaf-2/pom.xml +++ b/spring-thymeleaf-2/pom.xml @@ -18,6 +18,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-thymeleaf diff --git a/spring-thymeleaf-3/pom.xml b/spring-thymeleaf-3/pom.xml index 7677e50d79..7c58115d11 100644 --- a/spring-thymeleaf-3/pom.xml +++ b/spring-thymeleaf-3/pom.xml @@ -18,6 +18,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-thymeleaf diff --git a/testing-modules/rest-assured/pom.xml b/testing-modules/rest-assured/pom.xml index 0b027312d6..eeb5389f49 100644 --- a/testing-modules/rest-assured/pom.xml +++ b/testing-modules/rest-assured/pom.xml @@ -102,6 +102,7 @@ joda-time joda-time + ${joda-time.version} From ebf5019635ff6745b4947b42e1ba26798f626b6e Mon Sep 17 00:00:00 2001 From: kwoyke Date: Sat, 12 Sep 2020 09:44:47 +0200 Subject: [PATCH 0706/1862] BAEL-4589: Update Guide to Java 8's Collectors (#10009) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * BAEL-4589: Move Guide to Java 8’s Collectors to core-java-11-2 * BAEL-4589: Add Java 10 unmodifiable* collectors examples --- core-java-modules/core-java-11-2/README.md | 1 + core-java-modules/core-java-11-2/pom.xml | 6 +++ .../collectors/Java8CollectorsUnitTest.java | 50 +++++++++++-------- .../core-java-streams-3/README.md | 1 - 4 files changed, 35 insertions(+), 23 deletions(-) rename core-java-modules/{core-java-streams-3/src/test/java/com/baeldung/streams => core-java-11-2/src/test/java/com/baeldung}/collectors/Java8CollectorsUnitTest.java (87%) diff --git a/core-java-modules/core-java-11-2/README.md b/core-java-modules/core-java-11-2/README.md index f65a043819..d77bf748a8 100644 --- a/core-java-modules/core-java-11-2/README.md +++ b/core-java-modules/core-java-11-2/README.md @@ -4,4 +4,5 @@ This module contains articles about Java 11 core features ### Relevant articles - [Guide to Java 8 Optional](https://www.baeldung.com/java-optional) +- [Guide to Java 8’s Collectors](https://www.baeldung.com/java-8-collectors) diff --git a/core-java-modules/core-java-11-2/pom.xml b/core-java-modules/core-java-11-2/pom.xml index d20b0f23f0..e2b129ae00 100644 --- a/core-java-modules/core-java-11-2/pom.xml +++ b/core-java-modules/core-java-11-2/pom.xml @@ -17,6 +17,11 @@ + + com.google.guava + guava + ${guava.version} + org.assertj assertj-core @@ -42,6 +47,7 @@ 11 11 + 29.0-jre 3.17.2 diff --git a/core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/collectors/Java8CollectorsUnitTest.java b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java similarity index 87% rename from core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/collectors/Java8CollectorsUnitTest.java rename to core-java-modules/core-java-11-2/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java index 6afc9f4182..7990b1fdb7 100644 --- a/core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/collectors/Java8CollectorsUnitTest.java +++ b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/collectors/Java8CollectorsUnitTest.java @@ -1,18 +1,11 @@ -package com.baeldung.streams.collectors; +package com.baeldung.collectors; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import org.junit.Test; -import java.util.Arrays; -import java.util.Comparator; -import java.util.DoubleSummaryStatistics; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.function.BiConsumer; import java.util.function.BinaryOperator; import java.util.function.Function; @@ -20,19 +13,7 @@ import java.util.function.Supplier; import java.util.stream.Collector; import static com.google.common.collect.Sets.newHashSet; -import static java.util.stream.Collectors.averagingDouble; -import static java.util.stream.Collectors.collectingAndThen; -import static java.util.stream.Collectors.counting; -import static java.util.stream.Collectors.groupingBy; -import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.maxBy; -import static java.util.stream.Collectors.partitioningBy; -import static java.util.stream.Collectors.summarizingDouble; -import static java.util.stream.Collectors.summingDouble; -import static java.util.stream.Collectors.toCollection; -import static java.util.stream.Collectors.toList; -import static java.util.stream.Collectors.toMap; -import static java.util.stream.Collectors.toSet; +import static java.util.stream.Collectors.*; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -48,6 +29,14 @@ public class Java8CollectorsUnitTest { assertThat(result).containsAll(givenList); } + @Test + public void whenCollectingToUnmodifiableList_shouldCollectToUnmodifiableList() { + final List result = givenList.stream().collect(toUnmodifiableList()); + + assertThatThrownBy(() -> result.add("foo")) + .isInstanceOf(UnsupportedOperationException.class); + } + @Test public void whenCollectingToSet_shouldCollectToSet() throws Exception { final Set result = givenList.stream().collect(toSet()); @@ -55,6 +44,14 @@ public class Java8CollectorsUnitTest { assertThat(result).containsAll(givenList); } + @Test + public void whenCollectingToUnmodifiableSet_shouldCollectToUnmodifiableSet() { + final Set result = givenList.stream().collect(toUnmodifiableSet()); + + assertThatThrownBy(() -> result.add("foo")) + .isInstanceOf(UnsupportedOperationException.class); + } + @Test public void givenContainsDuplicateElements_whenCollectingToSet_shouldAddDuplicateElementsOnlyOnce() throws Exception { final Set result = listWithDuplicates.stream().collect(toSet()); @@ -84,6 +81,15 @@ public class Java8CollectorsUnitTest { assertThat(result).containsEntry("a", 1).containsEntry("bb", 2).containsEntry("ccc", 3).containsEntry("dd", 2); } + @Test + public void whenCollectingToUnmodifiableMap_shouldCollectToUnmodifiableMap() { + final Map result = givenList.stream() + .collect(toUnmodifiableMap(Function.identity(), String::length)); + + assertThatThrownBy(() -> result.put("foo", 3)) + .isInstanceOf(UnsupportedOperationException.class); + } + @Test public void whenCollectingToMapwWithDuplicates_shouldCollectToMapMergingTheIdenticalItems() throws Exception { final Map result = listWithDuplicates.stream().collect( diff --git a/core-java-modules/core-java-streams-3/README.md b/core-java-modules/core-java-streams-3/README.md index 65713aa04f..9adde005e6 100644 --- a/core-java-modules/core-java-streams-3/README.md +++ b/core-java-modules/core-java-streams-3/README.md @@ -6,7 +6,6 @@ This module contains articles about the Stream API in Java. - [The Difference Between map() and flatMap()](https://www.baeldung.com/java-difference-map-and-flatmap) - [How to Use if/else Logic in Java 8 Streams](https://www.baeldung.com/java-8-streams-if-else-logic) - [The Difference Between Collection.stream().forEach() and Collection.forEach()](https://www.baeldung.com/java-collection-stream-foreach) -- [Guide to Java 8’s Collectors](https://www.baeldung.com/java-8-collectors) - [Primitive Type Streams in Java 8](https://www.baeldung.com/java-8-primitive-streams) - [Debugging Java 8 Streams with IntelliJ](https://www.baeldung.com/intellij-debugging-java-streams) - [Add BigDecimals using the Stream API](https://www.baeldung.com/java-stream-add-bigdecimals) From 8f19db031e2f999d9dde8b3b9c587e2ed6c3dcf6 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sat, 12 Sep 2020 17:54:33 +0530 Subject: [PATCH 0707/1862] JAVA-2411: Update spring-thymeleaf module and articles --- spring-thymeleaf/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-thymeleaf/pom.xml b/spring-thymeleaf/pom.xml index c37c66a36d..30f77dd73e 100644 --- a/spring-thymeleaf/pom.xml +++ b/spring-thymeleaf/pom.xml @@ -145,10 +145,10 @@ - 2.0.9.RELEASE - 3.0.9.RELEASE - 3.0.1.RELEASE - 2.3.0 + 2.3.2.RELEASE + 3.0.11.RELEASE + 3.0.4.RELEASE + 2.4.1 2.0.1.Final 6.0.11.Final From d910807be21a6973092f1b91738154033c6b7a24 Mon Sep 17 00:00:00 2001 From: Sorin Zamfir Date: Sat, 12 Sep 2020 18:59:15 +0300 Subject: [PATCH 0708/1862] Update gradle-5/cmd-line-args/build.gradle Co-authored-by: KevinGilmore --- gradle-5/cmd-line-args/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle-5/cmd-line-args/build.gradle b/gradle-5/cmd-line-args/build.gradle index 5399db4815..15c9288024 100644 --- a/gradle-5/cmd-line-args/build.gradle +++ b/gradle-5/cmd-line-args/build.gradle @@ -33,6 +33,6 @@ task cmdLineJavaExec(type: JavaExec) { task cmdLineExec(type: Exec) { group = "Execution" - description = "Run the an external program with ExecTask" + description = "Run an external program with ExecTask" commandLine cmdargs.split() } From 972ff966996282d8bfc4bf34dcf03592a53ea58c Mon Sep 17 00:00:00 2001 From: kwoyke Date: Sat, 12 Sep 2020 19:08:22 +0200 Subject: [PATCH 0709/1862] BAEL-4587: Update Guide to Java Reflection (#9997) * BAEL-4587: Migrate Guide to Java Reflection to core-java-11-2 * BAEL-4587: Replace deprecated isAccessible method with canAccess --- core-java-modules/core-java-11-2/README.md | 2 +- .../java/com/baeldung}/reflection/Animal.java | 2 +- .../java/com/baeldung}/reflection/Bird.java | 2 +- .../baeldung}/reflection/DynamicGreeter.java | 2 +- .../java/com/baeldung}/reflection/Eating.java | 2 +- .../java/com/baeldung}/reflection/Goat.java | 2 +- .../com/baeldung}/reflection/Greeter.java | 2 +- .../reflection/GreetingAnnotation.java | 2 +- .../com/baeldung}/reflection/Greetings.java | 2 +- .../com/baeldung}/reflection/Locomotion.java | 2 +- .../com/baeldung}/reflection/Operations.java | 2 +- .../java/com/baeldung}/reflection/Person.java | 2 +- .../reflection/OperationsUnitTest.java | 2 +- .../reflection/ReflectionUnitTest.java | 73 +++++++++---------- .../core-java-reflection/README.MD | 1 - 15 files changed, 46 insertions(+), 54 deletions(-) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Animal.java (90%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Bird.java (93%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/DynamicGreeter.java (91%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Eating.java (55%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Goat.java (90%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Greeter.java (83%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/GreetingAnnotation.java (98%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Greetings.java (61%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Locomotion.java (61%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Operations.java (90%) rename core-java-modules/{core-java-reflection/src/main/java/com/baeldung/reflection/java => core-java-11-2/src/main/java/com/baeldung}/reflection/Person.java (65%) rename core-java-modules/{core-java-reflection/src/test/java/com/baeldung/reflection/java => core-java-11-2/src/test/java/com/baeldung}/reflection/OperationsUnitTest.java (98%) rename core-java-modules/{core-java-reflection/src/test/java/com/baeldung/reflection/java => core-java-11-2/src/test/java/com/baeldung}/reflection/ReflectionUnitTest.java (77%) diff --git a/core-java-modules/core-java-11-2/README.md b/core-java-modules/core-java-11-2/README.md index d77bf748a8..834f310fce 100644 --- a/core-java-modules/core-java-11-2/README.md +++ b/core-java-modules/core-java-11-2/README.md @@ -4,5 +4,5 @@ This module contains articles about Java 11 core features ### Relevant articles - [Guide to Java 8 Optional](https://www.baeldung.com/java-optional) +- [Guide to Java Reflection](http://www.baeldung.com/java-reflection) - [Guide to Java 8’s Collectors](https://www.baeldung.com/java-8-collectors) - diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Animal.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Animal.java similarity index 90% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Animal.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Animal.java index 3f36243c29..364246ae64 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Animal.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Animal.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; public abstract class Animal implements Eating { diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Bird.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Bird.java similarity index 93% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Bird.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Bird.java index bd6f13094c..f5bb0f9b19 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Bird.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Bird.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; public class Bird extends Animal { private boolean walks; diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/DynamicGreeter.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/DynamicGreeter.java similarity index 91% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/DynamicGreeter.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/DynamicGreeter.java index 3776ef82e2..b7ff083daf 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/DynamicGreeter.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/DynamicGreeter.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; import java.lang.annotation.Annotation; diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Eating.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Eating.java similarity index 55% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Eating.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Eating.java index 479425cad4..c959becf00 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Eating.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Eating.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; public interface Eating { String eats(); diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Goat.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Goat.java similarity index 90% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Goat.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Goat.java index 503717ae5e..086d09d543 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Goat.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Goat.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; public class Goat extends Animal implements Locomotion { diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Greeter.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Greeter.java similarity index 83% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Greeter.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Greeter.java index 57aefdd169..d06a719312 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Greeter.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Greeter.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/GreetingAnnotation.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/GreetingAnnotation.java similarity index 98% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/GreetingAnnotation.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/GreetingAnnotation.java index 601306f5d2..f23c407c52 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/GreetingAnnotation.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/GreetingAnnotation.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; import java.lang.annotation.Annotation; import java.lang.reflect.Field; diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Greetings.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Greetings.java similarity index 61% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Greetings.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Greetings.java index 4f3a20c3b9..fc6dfe949b 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Greetings.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Greetings.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; @Greeter(greet="Good morning") public class Greetings { diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Locomotion.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Locomotion.java similarity index 61% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Locomotion.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Locomotion.java index 047c00cb13..230fd9a466 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Locomotion.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Locomotion.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; public interface Locomotion { String getLocomotion(); diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Operations.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Operations.java similarity index 90% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Operations.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Operations.java index da4b479b02..5264378524 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Operations.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Operations.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; public class Operations { diff --git a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Person.java b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Person.java similarity index 65% rename from core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Person.java rename to core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Person.java index f3d7f9f001..1a1fafef93 100644 --- a/core-java-modules/core-java-reflection/src/main/java/com/baeldung/reflection/java/reflection/Person.java +++ b/core-java-modules/core-java-11-2/src/main/java/com/baeldung/reflection/Person.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; public class Person { private String name; diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/java/reflection/OperationsUnitTest.java b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/reflection/OperationsUnitTest.java similarity index 98% rename from core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/java/reflection/OperationsUnitTest.java rename to core-java-modules/core-java-11-2/src/test/java/com/baeldung/reflection/OperationsUnitTest.java index 217910bffd..7584d5da94 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/java/reflection/OperationsUnitTest.java +++ b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/reflection/OperationsUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertFalse; diff --git a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/java/reflection/ReflectionUnitTest.java b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/reflection/ReflectionUnitTest.java similarity index 77% rename from core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/java/reflection/ReflectionUnitTest.java rename to core-java-modules/core-java-11-2/src/test/java/com/baeldung/reflection/ReflectionUnitTest.java index a791d64874..c73fa5f8e0 100644 --- a/core-java-modules/core-java-reflection/src/test/java/com/baeldung/reflection/java/reflection/ReflectionUnitTest.java +++ b/core-java-modules/core-java-11-2/src/test/java/com/baeldung/reflection/ReflectionUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.java.reflection; +package com.baeldung.reflection; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -32,23 +32,23 @@ public class ReflectionUnitTest { final Class clazz = goat.getClass(); assertEquals("Goat", clazz.getSimpleName()); - assertEquals("com.baeldung.java.reflection.Goat", clazz.getName()); - assertEquals("com.baeldung.java.reflection.Goat", clazz.getCanonicalName()); + assertEquals("com.baeldung.reflection.Goat", clazz.getName()); + assertEquals("com.baeldung.reflection.Goat", clazz.getCanonicalName()); } @Test public void givenClassName_whenCreatesObject_thenCorrect() throws ClassNotFoundException { - final Class clazz = Class.forName("com.baeldung.java.reflection.Goat"); + final Class clazz = Class.forName("com.baeldung.reflection.Goat"); assertEquals("Goat", clazz.getSimpleName()); - assertEquals("com.baeldung.java.reflection.Goat", clazz.getName()); - assertEquals("com.baeldung.java.reflection.Goat", clazz.getCanonicalName()); + assertEquals("com.baeldung.reflection.Goat", clazz.getName()); + assertEquals("com.baeldung.reflection.Goat", clazz.getCanonicalName()); } @Test public void givenClass_whenRecognisesModifiers_thenCorrect() throws ClassNotFoundException { - final Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); - final Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); + final Class goatClass = Class.forName("com.baeldung.reflection.Goat"); + final Class animalClass = Class.forName("com.baeldung.reflection.Animal"); final int goatMods = goatClass.getModifiers(); final int animalMods = animalClass.getModifiers(); @@ -63,7 +63,7 @@ public class ReflectionUnitTest { final Class goatClass = goat.getClass(); final Package pkg = goatClass.getPackage(); - assertEquals("com.baeldung.java.reflection", pkg.getName()); + assertEquals("com.baeldung.reflection", pkg.getName()); } @Test @@ -81,8 +81,8 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsImplementedInterfaces_thenCorrect() throws ClassNotFoundException { - final Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); - final Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); + final Class goatClass = Class.forName("com.baeldung.reflection.Goat"); + final Class animalClass = Class.forName("com.baeldung.reflection.Animal"); final Class[] goatInterfaces = goatClass.getInterfaces(); final Class[] animalInterfaces = animalClass.getInterfaces(); @@ -94,16 +94,16 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsConstructor_thenCorrect() throws ClassNotFoundException { - final Class goatClass = Class.forName("com.baeldung.java.reflection.Goat"); + final Class goatClass = Class.forName("com.baeldung.reflection.Goat"); final Constructor[] constructors = goatClass.getConstructors(); assertEquals(1, constructors.length); - assertEquals("com.baeldung.java.reflection.Goat", constructors[0].getName()); + assertEquals("com.baeldung.reflection.Goat", constructors[0].getName()); } @Test public void givenClass_whenGetsFields_thenCorrect() throws ClassNotFoundException { - final Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); + final Class animalClass = Class.forName("com.baeldung.reflection.Animal"); final Field[] fields = animalClass.getDeclaredFields(); final List actualFields = getFieldNames(fields); @@ -114,7 +114,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsMethods_thenCorrect() throws ClassNotFoundException { - final Class animalClass = Class.forName("com.baeldung.java.reflection.Animal"); + final Class animalClass = Class.forName("com.baeldung.reflection.Animal"); final Method[] methods = animalClass.getDeclaredMethods(); final List actualMethods = getMethodNames(methods); @@ -124,7 +124,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsAllConstructors_thenCorrect() throws ClassNotFoundException { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Constructor[] constructors = birdClass.getConstructors(); assertEquals(3, constructors.length); @@ -132,7 +132,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsEachConstructorByParamTypes_thenCorrect() throws Exception { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); birdClass.getConstructor(); birdClass.getConstructor(String.class); birdClass.getConstructor(String.class, boolean.class); @@ -140,7 +140,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenInstantiatesObjectsAtRuntime_thenCorrect() throws Exception { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Constructor cons1 = birdClass.getConstructor(); final Constructor cons2 = birdClass.getConstructor(String.class); @@ -159,7 +159,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsPublicFields_thenCorrect() throws ClassNotFoundException { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Field[] fields = birdClass.getFields(); assertEquals(1, fields.length); assertEquals("CATEGORY", fields[0].getName()); @@ -168,7 +168,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsPublicFieldByName_thenCorrect() throws Exception { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Field field = birdClass.getField("CATEGORY"); assertEquals("CATEGORY", field.getName()); @@ -176,7 +176,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsDeclaredFields_thenCorrect() throws ClassNotFoundException { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Field[] fields = birdClass.getDeclaredFields(); assertEquals(1, fields.length); assertEquals("walks", fields[0].getName()); @@ -184,7 +184,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsFieldsByName_thenCorrect() throws Exception { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Field field = birdClass.getDeclaredField("walks"); assertEquals("walks", field.getName()); @@ -192,14 +192,14 @@ public class ReflectionUnitTest { @Test public void givenClassField_whenGetsType_thenCorrect() throws Exception { - final Field field = Class.forName("com.baeldung.java.reflection.Bird").getDeclaredField("walks"); + final Field field = Class.forName("com.baeldung.reflection.Bird").getDeclaredField("walks"); final Class fieldClass = field.getType(); assertEquals("boolean", fieldClass.getSimpleName()); } @Test public void givenClassField_whenSetsAndGetsValue_thenCorrect() throws Exception { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Bird bird = (Bird) birdClass.getConstructor().newInstance(); final Field field = birdClass.getDeclaredField("walks"); field.setAccessible(true); @@ -216,7 +216,7 @@ public class ReflectionUnitTest { @Test public void givenClassField_whenGetsAndSetsWithNull_thenCorrect() throws Exception { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Field field = birdClass.getField("CATEGORY"); field.setAccessible(true); @@ -225,7 +225,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsAllPublicMethods_thenCorrect() throws ClassNotFoundException { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Method[] methods = birdClass.getMethods(); final List methodNames = getMethodNames(methods); @@ -235,7 +235,7 @@ public class ReflectionUnitTest { @Test public void givenClass_whenGetsOnlyDeclaredMethods_thenCorrect() throws ClassNotFoundException { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final List actualMethodNames = getMethodNames(birdClass.getDeclaredMethods()); final List expectedMethodNames = Arrays.asList("setWalks", "walks", "getSound", "eats"); @@ -248,24 +248,17 @@ public class ReflectionUnitTest { @Test public void givenMethodName_whenGetsMethod_thenCorrect() throws Exception { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); - final Method walksMethod = birdClass.getDeclaredMethod("walks"); - final Method setWalksMethod = birdClass.getDeclaredMethod("setWalks", boolean.class); - - assertFalse(walksMethod.isAccessible()); - assertFalse(setWalksMethod.isAccessible()); - - walksMethod.setAccessible(true); - setWalksMethod.setAccessible(true); - - assertTrue(walksMethod.isAccessible()); - assertTrue(setWalksMethod.isAccessible()); + final Bird bird = new Bird(); + final Method walksMethod = bird.getClass().getDeclaredMethod("walks"); + final Method setWalksMethod = bird.getClass().getDeclaredMethod("setWalks", boolean.class); + assertTrue(walksMethod.canAccess(bird)); + assertTrue(setWalksMethod.canAccess(bird)); } @Test public void givenMethod_whenInvokes_thenCorrect() throws Exception { - final Class birdClass = Class.forName("com.baeldung.java.reflection.Bird"); + final Class birdClass = Class.forName("com.baeldung.reflection.Bird"); final Bird bird = (Bird) birdClass.getConstructor().newInstance(); final Method setWalksMethod = birdClass.getDeclaredMethod("setWalks", boolean.class); final Method walksMethod = birdClass.getDeclaredMethod("walks"); diff --git a/core-java-modules/core-java-reflection/README.MD b/core-java-modules/core-java-reflection/README.MD index 5d8c54414b..62d8719981 100644 --- a/core-java-modules/core-java-reflection/README.MD +++ b/core-java-modules/core-java-reflection/README.MD @@ -3,7 +3,6 @@ - [Void Type in Java](https://www.baeldung.com/java-void-type) - [Retrieve Fields from a Java Class Using Reflection](https://www.baeldung.com/java-reflection-class-fields) - [Method Parameter Reflection in Java](http://www.baeldung.com/java-parameter-reflection) -- [Guide to Java Reflection](http://www.baeldung.com/java-reflection) - [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection) - [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params) - [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) From 2096c22d436935fb843b102a9ed553951c5c62c1 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Sat, 12 Sep 2020 16:50:40 -0600 Subject: [PATCH 0710/1862] BAEL-4453 Reversing a Linked List in Java --- .../linkedlist/LinkedListReversal.java | 30 ++++++++++ .../algorithms/linkedlist/ListNode.java | 28 +++++++++ .../LinkedListReversalUnitTest.java | 59 +++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/linkedlist/LinkedListReversal.java create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/linkedlist/ListNode.java create mode 100644 algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/linkedlist/LinkedListReversalUnitTest.java diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/linkedlist/LinkedListReversal.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/linkedlist/LinkedListReversal.java new file mode 100644 index 0000000000..93402133ff --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/linkedlist/LinkedListReversal.java @@ -0,0 +1,30 @@ +package com.baeldung.algorithms.linkedlist; + +public class LinkedListReversal { + + ListNode reverseList(ListNode head) { + ListNode previous = null; + ListNode current = head; + while (current != null) { + ListNode nextElement = current.getNext(); + current.setNext(previous); + previous = current; + current = nextElement; + } + return previous; + } + + ListNode reverseListRecursive(ListNode head) { + if (head == null) { + return null; + } + if (head.getNext() == null) { + return head; + } + ListNode node = reverseListRecursive(head.getNext()); + head.getNext().setNext(head); + head.setNext(null); + return node; + } + +} diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/linkedlist/ListNode.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/linkedlist/ListNode.java new file mode 100644 index 0000000000..de2e93a65c --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/linkedlist/ListNode.java @@ -0,0 +1,28 @@ +package com.baeldung.algorithms.linkedlist; + +public class ListNode { + + private int data; + private ListNode next; + + ListNode(int data) { + this.data = data; + this.next = null; + } + + public int getData() { + return data; + } + + public ListNode getNext() { + return next; + } + + public void setData(int data) { + this.data = data; + } + + public void setNext(ListNode next) { + this.next = next; + } +} diff --git a/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/linkedlist/LinkedListReversalUnitTest.java b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/linkedlist/LinkedListReversalUnitTest.java new file mode 100644 index 0000000000..0940677959 --- /dev/null +++ b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/linkedlist/LinkedListReversalUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.algorithms.linkedlist; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class LinkedListReversalUnitTest { + @Test + public void givenLinkedList_whenIterativeReverse_thenOutputCorrectResult() { + ListNode head = constructLinkedList(); + ListNode node = head; + for (int i = 1; i <= 5; i++) { + assertNotNull(node); + assertEquals(i, node.getData()); + node = node.getNext(); + } + LinkedListReversal reversal = new LinkedListReversal(); + node = reversal.reverseList(head); + for (int i = 5; i >= 1; i--) { + assertNotNull(node); + assertEquals(i, node.getData()); + node = node.getNext(); + } + } + + @Test + public void givenLinkedList_whenRecursiveReverse_thenOutputCorrectResult() { + ListNode head = constructLinkedList(); + ListNode node = head; + for (int i = 1; i <= 5; i++) { + assertNotNull(node); + assertEquals(i, node.getData()); + node = node.getNext(); + } + LinkedListReversal reversal = new LinkedListReversal(); + node = reversal.reverseListRecursive(head); + for (int i = 5; i >= 1; i--) { + assertNotNull(node); + assertEquals(i, node.getData()); + node = node.getNext(); + } + } + + private ListNode constructLinkedList() { + ListNode head = null; + ListNode tail = null; + for (int i = 1; i <= 5; i++) { + ListNode node = new ListNode(i); + if (head == null) { + head = node; + } else { + tail.setNext(node); + } + tail = node; + } + return head; + } +} From 1b55f0a27e96ec5ff35aca2ee3636788d5f11f3d Mon Sep 17 00:00:00 2001 From: Harihar Das Date: Sun, 13 Sep 2020 10:54:49 +0200 Subject: [PATCH 0711/1862] Make gradle-wrapper a subdrirectory of gradle --- .../gradle-wrapper}/gradle/wrapper/README.md | 0 .../gradle-wrapper}/gradle/wrapper/gradle-wrapper.properties | 0 {gradle-wrapper => gradle/gradle-wrapper}/gradlew | 0 {gradle-wrapper => gradle/gradle-wrapper}/gradlew.bat | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {gradle-wrapper => gradle/gradle-wrapper}/gradle/wrapper/README.md (100%) rename {gradle-wrapper => gradle/gradle-wrapper}/gradle/wrapper/gradle-wrapper.properties (100%) rename {gradle-wrapper => gradle/gradle-wrapper}/gradlew (100%) rename {gradle-wrapper => gradle/gradle-wrapper}/gradlew.bat (100%) diff --git a/gradle-wrapper/gradle/wrapper/README.md b/gradle/gradle-wrapper/gradle/wrapper/README.md similarity index 100% rename from gradle-wrapper/gradle/wrapper/README.md rename to gradle/gradle-wrapper/gradle/wrapper/README.md diff --git a/gradle-wrapper/gradle/wrapper/gradle-wrapper.properties b/gradle/gradle-wrapper/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from gradle-wrapper/gradle/wrapper/gradle-wrapper.properties rename to gradle/gradle-wrapper/gradle/wrapper/gradle-wrapper.properties diff --git a/gradle-wrapper/gradlew b/gradle/gradle-wrapper/gradlew similarity index 100% rename from gradle-wrapper/gradlew rename to gradle/gradle-wrapper/gradlew diff --git a/gradle-wrapper/gradlew.bat b/gradle/gradle-wrapper/gradlew.bat similarity index 100% rename from gradle-wrapper/gradlew.bat rename to gradle/gradle-wrapper/gradlew.bat From e756edec9296c722114e77b4bbe09d61f5f53fde Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 13 Sep 2020 21:05:10 +0530 Subject: [PATCH 0712/1862] add modules in parent pom build --- maven-modules/maven-plugins/pom.xml | 5 +++++ spring-cloud/pom.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/maven-modules/maven-plugins/pom.xml b/maven-modules/maven-plugins/pom.xml index 43bcf1f422..4877f00a92 100644 --- a/maven-modules/maven-plugins/pom.xml +++ b/maven-modules/maven-plugins/pom.xml @@ -14,6 +14,11 @@ ../.. + + + maven-enforcer + + diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 99fde0daf4..ee7b80ffc1 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -43,6 +43,7 @@ spring-cloud-ribbon-retry spring-cloud-circuit-breaker spring-cloud-eureka-self-preservation + From ed7ce4ce3469944b48c40de45364f32d56fc135d Mon Sep 17 00:00:00 2001 From: gupta-ashu01 <30566001+gupta-ashu01@users.noreply.github.com> Date: Sun, 13 Sep 2020 22:35:45 +0530 Subject: [PATCH 0713/1862] BAEL-4567 (#10007) * BAEL-4567 BAEL-4567 * Add files via upload * Add files via upload * Delete SendMailWithAttachment.java * Update pom.xml * Formatting fixes --- .../core-java-networking-2/pom.xml | 6 ++ .../MailWithAttachmentService.java | 83 +++++++++++++++++++ .../MailWithAttachmentServiceLiveTest.java | 48 +++++++++++ 3 files changed, 137 insertions(+) create mode 100644 core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentService.java create mode 100644 core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentServiceLiveTest.java diff --git a/core-java-modules/core-java-networking-2/pom.xml b/core-java-modules/core-java-networking-2/pom.xml index d79320eaef..89a98bbf8b 100644 --- a/core-java-modules/core-java-networking-2/pom.xml +++ b/core-java-modules/core-java-networking-2/pom.xml @@ -35,6 +35,12 @@ async-http-client ${async-http-client.version} + + com.icegreen + greenmail + 1.5.8 + test + diff --git a/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentService.java b/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentService.java new file mode 100644 index 0000000000..7d4dc57f10 --- /dev/null +++ b/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentService.java @@ -0,0 +1,83 @@ +package com.baeldung.mail.mailwithattachment; + +import java.io.File; +import java.io.IOException; +import java.util.Properties; +import javax.mail.BodyPart; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Multipart; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; + +public class MailWithAttachmentService { + + private String username = ""; + private String password = ""; + private String host = ""; + private String port = ""; + + MailWithAttachmentService() { + } + + MailWithAttachmentService(String username, String password, String host, String port) { + this.username = username; + this.password = password; + this.host = host; + this.port = port; + } + + public Session getSession() { + Properties props = new Properties(); + props.put("mail.smtp.auth", "true"); + props.put("mail.smtp.starttls.enable", "true"); + props.put("mail.smtp.host", this.host); + props.put("mail.smtp.port", this.port); + + Session session = Session.getInstance(props, new javax.mail.Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + return session; + } + + public Message createMail(Session session) throws AddressException, MessagingException, IOException { + Message message = new MimeMessage(session); + message.setFrom(new InternetAddress("mail@gmail.com")); + message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("mail@gmail.com")); + message.setSubject("Testing Subject"); + + BodyPart messageBodyPart = new MimeBodyPart(); + messageBodyPart.setText("This is message body"); + + Multipart multipart = new MimeMultipart(); + multipart.addBodyPart(messageBodyPart); + + MimeBodyPart attachmentPart = new MimeBodyPart(); + MimeBodyPart attachmentPart2 = new MimeBodyPart(); + + attachmentPart.attachFile(new File("C:\\Document1.txt")); + attachmentPart2.attachFile(new File("C:\\Document2.txt")); + + multipart.addBodyPart(attachmentPart); + multipart.addBodyPart(attachmentPart2); + + message.setContent(multipart); + + return message; + } + + public void sendMail(Session session) throws MessagingException, IOException { + + Message message = createMail(session); + Transport.send(message); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentServiceLiveTest.java b/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentServiceLiveTest.java new file mode 100644 index 0000000000..ef82657ab5 --- /dev/null +++ b/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentServiceLiveTest.java @@ -0,0 +1,48 @@ +package com.baeldung.mail.mailwithattachment; + +import static org.junit.Assert.*; +import javax.annotation.Resource; +import javax.mail.Session; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.baeldung.mail.mailwithattachment.MailWithAttachmentService; +import com.icegreen.greenmail.util.GreenMail; +import com.icegreen.greenmail.util.ServerSetupTest; + +public class MailWithAttachmentServiceLiveTest { + + @Resource + private MailWithAttachmentService emailService; + private GreenMail greenMail; + + @Before + public void startMailServer() { + emailService = new MailWithAttachmentService(); + greenMail = new GreenMail(ServerSetupTest.SMTP); + greenMail.start(); + } + + @After + public void stopMailServer() { + greenMail.stop(); + emailService = null; + } + + @Test + public void canSendMail() { + try { + Session testSession = greenMail.getSmtp() + .createSession(); + emailService.sendMail(testSession); + assertEquals(1, greenMail.getReceivedMessages().length); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + +} From fb115abd62fede31a07c8a9630dadeb2c2e4b2ed Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Sun, 13 Sep 2020 20:29:43 +0200 Subject: [PATCH 0714/1862] JAVA-2400: Fix EmailAnnotationPlugin implementation --- .../baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java index 22ca144fb4..59a7c97080 100644 --- a/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java +++ b/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/plugin/EmailAnnotationPlugin.java @@ -10,6 +10,7 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import springfox.bean.validators.plugins.Validators; +import springfox.documentation.builders.StringElementFacetBuilder; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.schema.ModelPropertyBuilderPlugin; import springfox.documentation.spi.schema.contexts.ModelPropertyContext; @@ -30,8 +31,9 @@ public class EmailAnnotationPlugin implements ModelPropertyBuilderPlugin { public void apply(ModelPropertyContext context) { Optional email = annotationFromBean(context, Email.class); if (email.isPresent()) { - context.getBuilder().pattern(email.get().regexp()); - context.getBuilder().example("email@email.com"); + context.getSpecificationBuilder().facetBuilder(StringElementFacetBuilder.class) + .pattern(email.get().regexp()); + context.getSpecificationBuilder().example("email@email.com"); } } From 57b66fa5788ff711f92716540f87205a1af38f80 Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Sun, 13 Sep 2020 21:40:14 +0200 Subject: [PATCH 0715/1862] JAVA-2404: Fix Spring MVC and Security config --- .../java/com/baeldung/spring/WebConfig.java | 2 +- .../src/main/webapp/WEB-INF/web.xml | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/WebConfig.java b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/WebConfig.java index 84b211a9bd..76e9abdbdb 100644 --- a/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/WebConfig.java +++ b/spring-security-modules/spring-security-web-rest/src/main/java/com/baeldung/spring/WebConfig.java @@ -12,7 +12,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration -@ComponentScan("com.baeldung.web") +@ComponentScan("com.baeldung") @EnableWebMvc @EnableAsync public class WebConfig implements WebMvcConfigurer { diff --git a/spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/web.xml index 663c17bc56..6321277c5b 100644 --- a/spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-modules/spring-security-web-rest/src/main/webapp/WEB-INF/web.xml @@ -20,9 +20,9 @@ com.baeldung.spring - - org.springframework.web.context.ContextLoaderListener - + + + @@ -40,17 +40,17 @@ - - springSecurityFilterChain - org.springframework.web.filter.DelegatingFilterProxy - true - - - springSecurityFilterChain - /* - REQUEST - ASYNC - + + + + + + + + + + + From 4e081b4fb65a03ccfa100f8f329e2e202e7b1b78 Mon Sep 17 00:00:00 2001 From: michaelisvy Date: Mon, 14 Sep 2020 08:16:56 +0800 Subject: [PATCH 0716/1862] added advanced Spring Retry example and removed Spring Retry xml config --- .../com/baeldung/springretry/AppConfig.java | 5 +- .../com/baeldung/springretry/MyService.java | 11 +++- .../baeldung/springretry/MyServiceImpl.java | 16 ++++++ .../src/main/resources/retryConfig.properties | 2 + .../src/main/resources/retryadvice.xml | 50 ------------------- .../SpringRetryIntegrationTest.java | 10 ++++ 6 files changed, 40 insertions(+), 54 deletions(-) create mode 100644 spring-scheduling/src/main/resources/retryConfig.properties delete mode 100644 spring-scheduling/src/main/resources/retryadvice.xml diff --git a/spring-scheduling/src/main/java/com/baeldung/springretry/AppConfig.java b/spring-scheduling/src/main/java/com/baeldung/springretry/AppConfig.java index e79beb370b..2ca9104e89 100644 --- a/spring-scheduling/src/main/java/com/baeldung/springretry/AppConfig.java +++ b/spring-scheduling/src/main/java/com/baeldung/springretry/AppConfig.java @@ -3,6 +3,7 @@ package com.baeldung.springretry; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; import org.springframework.retry.annotation.EnableRetry; import org.springframework.retry.backoff.FixedBackOffPolicy; import org.springframework.retry.policy.SimpleRetryPolicy; @@ -11,9 +12,7 @@ import org.springframework.retry.support.RetryTemplate; @Configuration @ComponentScan(basePackages = "com.baeldung.springretry") @EnableRetry -// Uncomment this two lines if we need XML configuration -// @EnableAspectJAutoProxy -// @ImportResource("classpath:/retryadvice.xml") +@PropertySource("classpath:retryConfig.properties") public class AppConfig { @Bean diff --git a/spring-scheduling/src/main/java/com/baeldung/springretry/MyService.java b/spring-scheduling/src/main/java/com/baeldung/springretry/MyService.java index 409bf25845..40e2c419fc 100644 --- a/spring-scheduling/src/main/java/com/baeldung/springretry/MyService.java +++ b/spring-scheduling/src/main/java/com/baeldung/springretry/MyService.java @@ -2,18 +2,27 @@ package com.baeldung.springretry; import java.sql.SQLException; +import org.springframework.context.annotation.PropertySource; import org.springframework.retry.annotation.Backoff; import org.springframework.retry.annotation.Recover; import org.springframework.retry.annotation.Retryable; + public interface MyService { @Retryable void retryService(); - @Retryable(value = { SQLException.class }, maxAttempts = 2, backoff = @Backoff(delay = 5000)) + @Retryable(value = SQLException.class) void retryServiceWithRecovery(String sql) throws SQLException; + @Retryable(value = { SQLException.class }, maxAttempts = 2, backoff = @Backoff(delay = 100)) + void retryServiceWithCustomization(String sql) throws SQLException; + + @Retryable( value = SQLException.class, maxAttemptsExpression = "${retry.maxAttempts}", + backoff = @Backoff(delayExpression = "${retry.maxDelay}")) + void retryServiceWithExternalConfiguration(String sql) throws SQLException; + @Recover void recover(SQLException e, String sql); diff --git a/spring-scheduling/src/main/java/com/baeldung/springretry/MyServiceImpl.java b/spring-scheduling/src/main/java/com/baeldung/springretry/MyServiceImpl.java index 3e4b5ed00d..7eb4328a47 100644 --- a/spring-scheduling/src/main/java/com/baeldung/springretry/MyServiceImpl.java +++ b/spring-scheduling/src/main/java/com/baeldung/springretry/MyServiceImpl.java @@ -26,6 +26,22 @@ public class MyServiceImpl implements MyService { } } + @Override + public void retryServiceWithCustomization(String sql) throws SQLException { + if (StringUtils.isEmpty(sql)) { + logger.info("throw SQLException in method retryServiceWithCustomization()"); + throw new SQLException(); + } + } + + @Override + public void retryServiceWithExternalConfiguration(String sql) throws SQLException { + if (StringUtils.isEmpty(sql)) { + logger.info("throw SQLException in method retryServiceWithExternalConfiguration()"); + throw new SQLException(); + } + } + @Override public void recover(SQLException e, String sql) { logger.info("In recover method"); diff --git a/spring-scheduling/src/main/resources/retryConfig.properties b/spring-scheduling/src/main/resources/retryConfig.properties new file mode 100644 index 0000000000..7cc360adc6 --- /dev/null +++ b/spring-scheduling/src/main/resources/retryConfig.properties @@ -0,0 +1,2 @@ +retry.maxAttempts=2 +retry.maxDelay=100 \ No newline at end of file diff --git a/spring-scheduling/src/main/resources/retryadvice.xml b/spring-scheduling/src/main/resources/retryadvice.xml deleted file mode 100644 index 8de7801a58..0000000000 --- a/spring-scheduling/src/main/resources/retryadvice.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Initial sleep interval value, default 300 ms - - - - - The maximum value of the backoff period in milliseconds. - - - - - The value to increment the exp seed with for each retry attempt. - - - - - \ No newline at end of file diff --git a/spring-scheduling/src/test/java/com/baeldung/springretry/SpringRetryIntegrationTest.java b/spring-scheduling/src/test/java/com/baeldung/springretry/SpringRetryIntegrationTest.java index 2e5fb75482..33ce2fff74 100644 --- a/spring-scheduling/src/test/java/com/baeldung/springretry/SpringRetryIntegrationTest.java +++ b/spring-scheduling/src/test/java/com/baeldung/springretry/SpringRetryIntegrationTest.java @@ -30,6 +30,16 @@ public class SpringRetryIntegrationTest { myService.retryServiceWithRecovery(null); } + @Test + public void givenRetryServiceWithCustomization_whenCallWithException_thenRetryRecover() throws SQLException { + myService.retryServiceWithCustomization(null); + } + + @Test + public void givenRetryServiceWithExternalConfiguration_whenCallWithException_thenRetryRecover() throws SQLException { + myService.retryServiceWithExternalConfiguration(null); + } + @Test(expected = RuntimeException.class) public void givenTemplateRetryService_whenCallWithException_thenRetry() { retryTemplate.execute(arg0 -> { From bd9ac72a7cc8bef1583c6f7761b3ce5dcf8fdc7b Mon Sep 17 00:00:00 2001 From: kwoyke Date: Mon, 14 Sep 2020 11:24:29 +0200 Subject: [PATCH 0717/1862] BAEL-3712: Fix entities names (#10028) --- .../multipledb/dao/user/PossessionRepository.java | 4 ++-- .../multipledb/dao/user/UserRepository.java | 4 ++-- .../{PossessionMultipleDB.java => Possession.java} | 8 ++++---- .../model/user/{UserMultipleDB.java => User.java} | 12 ++++++------ .../multipledb/JpaMultipleDBIntegrationTest.java | 14 +++++++------- 5 files changed, 21 insertions(+), 21 deletions(-) rename persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/{PossessionMultipleDB.java => Possession.java} (89%) rename persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/{UserMultipleDB.java => User.java} (82%) diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java index ae37fde20d..a5ceee5b1a 100644 --- a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/PossessionRepository.java @@ -2,8 +2,8 @@ package com.baeldung.multipledb.dao.user; import org.springframework.data.jpa.repository.JpaRepository; -import com.baeldung.multipledb.model.user.PossessionMultipleDB; +import com.baeldung.multipledb.model.user.Possession; -public interface PossessionRepository extends JpaRepository { +public interface PossessionRepository extends JpaRepository { } diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java index 267a61a93f..d3109bd311 100644 --- a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/dao/user/UserRepository.java @@ -2,7 +2,7 @@ package com.baeldung.multipledb.dao.user; import org.springframework.data.jpa.repository.JpaRepository; -import com.baeldung.multipledb.model.user.UserMultipleDB; +import com.baeldung.multipledb.model.user.User; -public interface UserRepository extends JpaRepository { +public interface UserRepository extends JpaRepository { } \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/Possession.java similarity index 89% rename from persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java rename to persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/Possession.java index a6a3c88bd0..af646ffd04 100644 --- a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/PossessionMultipleDB.java +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/Possession.java @@ -4,7 +4,7 @@ import javax.persistence.*; @Entity @Table -public class PossessionMultipleDB { +public class Possession { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -12,11 +12,11 @@ public class PossessionMultipleDB { private String name; - public PossessionMultipleDB() { + public Possession() { super(); } - public PossessionMultipleDB(final String name) { + public Possession(final String name) { super(); this.name = name; @@ -58,7 +58,7 @@ public class PossessionMultipleDB { if (getClass() != obj.getClass()) { return false; } - final PossessionMultipleDB other = (PossessionMultipleDB) obj; + final Possession other = (Possession) obj; if (id != other.id) { return false; } diff --git a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/User.java similarity index 82% rename from persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java rename to persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/User.java index c7cd07f7a1..1985c543d3 100644 --- a/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/UserMultipleDB.java +++ b/persistence-modules/spring-data-jpa-enterprise/src/main/java/com/baeldung/multipledb/model/user/User.java @@ -6,7 +6,7 @@ import java.util.List; @Entity @Table(name = "users") -public class UserMultipleDB { +public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -18,13 +18,13 @@ public class UserMultipleDB { private Integer status; @OneToMany - List possessionList; + List possessionList; - public UserMultipleDB() { + public User() { super(); } - public UserMultipleDB(String name, String email, Integer status) { + public User(String name, String email, Integer status) { this.name = name; this.email = email; this.status = status; @@ -70,11 +70,11 @@ public class UserMultipleDB { this.age = age; } - public List getPossessionList() { + public List getPossessionList() { return possessionList; } - public void setPossessionList(List possessionList) { + public void setPossessionList(List possessionList) { this.possessionList = possessionList; } diff --git a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java index a1f4a3fa2c..fb363e2ab3 100644 --- a/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java +++ b/persistence-modules/spring-data-jpa-enterprise/src/test/java/com/baeldung/multipledb/JpaMultipleDBIntegrationTest.java @@ -20,8 +20,8 @@ import com.baeldung.multipledb.dao.product.ProductRepository; import com.baeldung.multipledb.dao.user.PossessionRepository; import com.baeldung.multipledb.dao.user.UserRepository; import com.baeldung.multipledb.model.product.Product; -import com.baeldung.multipledb.model.user.PossessionMultipleDB; -import com.baeldung.multipledb.model.user.UserMultipleDB; +import com.baeldung.multipledb.model.user.Possession; +import com.baeldung.multipledb.model.user.User; @RunWith(SpringRunner.class) @SpringBootTest(classes=MultipleDbApplication.class) @@ -42,15 +42,15 @@ public class JpaMultipleDBIntegrationTest { @Test @Transactional("userTransactionManager") public void whenCreatingUser_thenCreated() { - UserMultipleDB user = new UserMultipleDB(); + User user = new User(); user.setName("John"); user.setEmail("john@test.com"); user.setAge(20); - PossessionMultipleDB p = new PossessionMultipleDB("sample"); + Possession p = new Possession("sample"); p = possessionRepository.save(p); user.setPossessionList(Collections.singletonList(p)); user = userRepository.save(user); - final Optional result = userRepository.findById(user.getId()); + final Optional result = userRepository.findById(user.getId()); assertTrue(result.isPresent()); System.out.println(result.get().getPossessionList()); assertEquals(1, result.get().getPossessionList().size()); @@ -59,14 +59,14 @@ public class JpaMultipleDBIntegrationTest { @Test @Transactional("userTransactionManager") public void whenCreatingUsersWithSameEmail_thenRollback() { - UserMultipleDB user1 = new UserMultipleDB(); + User user1 = new User(); user1.setName("John"); user1.setEmail("john@test.com"); user1.setAge(20); user1 = userRepository.save(user1); assertTrue(userRepository.findById(user1.getId()).isPresent()); - UserMultipleDB user2 = new UserMultipleDB(); + User user2 = new User(); user2.setName("Tom"); user2.setEmail("john@test.com"); user2.setAge(10); From 5d1439378863657b54591ade01ef11e51d0ab313 Mon Sep 17 00:00:00 2001 From: mikr Date: Mon, 14 Sep 2020 12:21:57 +0200 Subject: [PATCH 0718/1862] Java-2136 Update Jackson version in main pom --- pom.xml | 3 +-- spring-dispatcher-servlet/pom.xml | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index a2e09c0f91..49c9fd9413 100644 --- a/pom.xml +++ b/pom.xml @@ -1389,9 +1389,8 @@ 3.1.0 1.2 2.3.1 - 1.9.13 1.2 - 2.9.8 + 2.11.1 1.3 1.2.0 5.2.0 diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml index 46e40722f1..21324e6757 100644 --- a/spring-dispatcher-servlet/pom.xml +++ b/spring-dispatcher-servlet/pom.xml @@ -40,11 +40,6 @@ javax.servlet.jsp-api ${javax.servlet.jsp-api.version} - - org.codehaus.jackson - jackson-mapper-asl - ${jackson-mapper-asl.version} - javax.servlet jstl From 6927cc7237978851c174ea1e3daec27d32ffe254 Mon Sep 17 00:00:00 2001 From: mikr Date: Mon, 14 Sep 2020 13:11:59 +0200 Subject: [PATCH 0719/1862] Java-2136 Use Jackson version from main pom in all other applicable modules --- json-2/pom.xml | 4 ++-- libraries-data-2/pom.xml | 2 +- libraries-http-2/pom.xml | 2 +- libraries-http/pom.xml | 2 +- metrics/pom.xml | 6 +++--- persistence-modules/hibernate-libraries/pom.xml | 1 - spring-5-mvc/pom.xml | 1 - .../spring-openapi-generator-api-client/pom.xml | 6 +++--- testing-modules/mockito-2/pom.xml | 1 - 9 files changed, 11 insertions(+), 14 deletions(-) diff --git a/json-2/pom.xml b/json-2/pom.xml index f0215a375f..53091d6245 100644 --- a/json-2/pom.xml +++ b/json-2/pom.xml @@ -53,12 +53,12 @@ com.fasterxml.jackson.core jackson-annotations - 2.11.0 + ${jackson.version} com.fasterxml.jackson.core jackson-databind - 2.11.0 + ${jackson.version} com.io-informatics.oss diff --git a/libraries-data-2/pom.xml b/libraries-data-2/pom.xml index 26d8651cdd..0154823cca 100644 --- a/libraries-data-2/pom.xml +++ b/libraries-data-2/pom.xml @@ -168,7 +168,7 @@ 0.1.0 1.0.3 9.1.5.Final - 2.9.8 + 4.3.8.RELEASE 4.0.0 1.1.0 diff --git a/libraries-http-2/pom.xml b/libraries-http-2/pom.xml index 73fe6c66bd..3c0af51131 100644 --- a/libraries-http-2/pom.xml +++ b/libraries-http-2/pom.xml @@ -72,7 +72,7 @@ 3.14.2 2.8.5 3.14.2 - 2.9.8 + 1.0.3 9.4.19.v20190610 2.2.11 diff --git a/libraries-http/pom.xml b/libraries-http/pom.xml index cbc74ce132..74e00a7291 100644 --- a/libraries-http/pom.xml +++ b/libraries-http/pom.xml @@ -118,7 +118,7 @@ 2.8.5 4.5.3 - 2.9.8 + 3.6.2 3.14.2 1.23.0 diff --git a/metrics/pom.xml b/metrics/pom.xml index 92699c3fb8..07adf15936 100644 --- a/metrics/pom.xml +++ b/metrics/pom.xml @@ -66,12 +66,12 @@ com.fasterxml.jackson.core jackson-databind - ${fasterxml.jackson.version} + ${jackson.version} com.fasterxml.jackson.dataformat jackson-dataformat-smile - ${fasterxml.jackson.version} + ${jackson.version} @@ -93,7 +93,7 @@ 3.1.0 0.12.17 0.12.0.RELEASE - 2.9.1 + 2.0.7.RELEASE 3.11.1 1.1.0 diff --git a/persistence-modules/hibernate-libraries/pom.xml b/persistence-modules/hibernate-libraries/pom.xml index 808c47133c..f67309cf43 100644 --- a/persistence-modules/hibernate-libraries/pom.xml +++ b/persistence-modules/hibernate-libraries/pom.xml @@ -170,7 +170,6 @@ 29.0-jre 2.9.7 5.4.14.Final - 2.10.3 3.27.0-GA 2.3.1 2.0.0 diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index fd9868ad66..0bb69d8057 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -173,7 +173,6 @@ 2.9.0 - 2.9.9 1.2.71 4.5.8 com.baeldung.Spring5Application diff --git a/spring-swagger-codegen/spring-openapi-generator-api-client/pom.xml b/spring-swagger-codegen/spring-openapi-generator-api-client/pom.xml index 7c6de543ae..3074849e4c 100644 --- a/spring-swagger-codegen/spring-openapi-generator-api-client/pom.xml +++ b/spring-swagger-codegen/spring-openapi-generator-api-client/pom.xml @@ -90,7 +90,7 @@ com.fasterxml.jackson.core jackson-databind - ${jackson-databind-version} + ${jackson-version} com.fasterxml.jackson.jaxrs @@ -264,8 +264,8 @@ 1.5.22 4.3.9.RELEASE - 2.10.1 - 2.10.1 + 2.11.1 + 0.2.1 2.9.10 1.0.0 diff --git a/testing-modules/mockito-2/pom.xml b/testing-modules/mockito-2/pom.xml index 340af89c82..055debe615 100644 --- a/testing-modules/mockito-2/pom.xml +++ b/testing-modules/mockito-2/pom.xml @@ -30,7 +30,6 @@ 2.21.0 - 2.10.3 From c4396dd1bd453128dc0e83de26742c83415533e1 Mon Sep 17 00:00:00 2001 From: mikr Date: Mon, 14 Sep 2020 16:30:00 +0200 Subject: [PATCH 0720/1862] Java-2797 Cleanup maven-java-11/multimodule-maven-project --- .../entitymodule/pom.xml | 22 ---------- .../main/java/com/baeldung/entity/User.java | 19 --------- .../src/main/java/module-info.java | 3 -- .../mainappmodule/pom.xml | 41 ------------------- .../com/baeldung/mainapp/Application.java | 19 --------- .../src/main/java/module-info.java | 6 --- pom.xml | 2 - 7 files changed, 112 deletions(-) delete mode 100644 maven-java-11/multimodule-maven-project/entitymodule/pom.xml delete mode 100644 maven-java-11/multimodule-maven-project/entitymodule/src/main/java/com/baeldung/entity/User.java delete mode 100644 maven-java-11/multimodule-maven-project/entitymodule/src/main/java/module-info.java delete mode 100644 maven-java-11/multimodule-maven-project/mainappmodule/pom.xml delete mode 100644 maven-java-11/multimodule-maven-project/mainappmodule/src/main/java/com/baeldung/mainapp/Application.java delete mode 100644 maven-java-11/multimodule-maven-project/mainappmodule/src/main/java/module-info.java diff --git a/maven-java-11/multimodule-maven-project/entitymodule/pom.xml b/maven-java-11/multimodule-maven-project/entitymodule/pom.xml deleted file mode 100644 index 228619ed74..0000000000 --- a/maven-java-11/multimodule-maven-project/entitymodule/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - 4.0.0 - com.baeldung.entitymodule - entitymodule - 1.0 - entitymodule - jar - - - com.baeldung.multimodule-maven-project - multimodule-maven-project - 1.0 - - - - 11 - 11 - - - diff --git a/maven-java-11/multimodule-maven-project/entitymodule/src/main/java/com/baeldung/entity/User.java b/maven-java-11/multimodule-maven-project/entitymodule/src/main/java/com/baeldung/entity/User.java deleted file mode 100644 index 22022a2e6d..0000000000 --- a/maven-java-11/multimodule-maven-project/entitymodule/src/main/java/com/baeldung/entity/User.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.entity; - -public class User { - - private final String name; - - public User(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - @Override - public String toString() { - return "User{" + "name=" + name + '}'; - } -} diff --git a/maven-java-11/multimodule-maven-project/entitymodule/src/main/java/module-info.java b/maven-java-11/multimodule-maven-project/entitymodule/src/main/java/module-info.java deleted file mode 100644 index 67a3097352..0000000000 --- a/maven-java-11/multimodule-maven-project/entitymodule/src/main/java/module-info.java +++ /dev/null @@ -1,3 +0,0 @@ -module com.baeldung.entity { - exports com.baeldung.entity; -} diff --git a/maven-java-11/multimodule-maven-project/mainappmodule/pom.xml b/maven-java-11/multimodule-maven-project/mainappmodule/pom.xml deleted file mode 100644 index 1f4493c34c..0000000000 --- a/maven-java-11/multimodule-maven-project/mainappmodule/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - 4.0.0 - com.baeldung.mainappmodule - mainappmodule - 1.0 - mainappmodule - jar - - - com.baeldung.multimodule-maven-project - multimodule-maven-project - 1.0 - - - - - com.baeldung.entitymodule - entitymodule - ${entitymodule.version} - - - com.baeldung.daomodule - daomodule - ${daomodule.version} - - - com.baeldung.userdaomodule - userdaomodule - ${userdaomodule.version} - - - - - 1.0 - 1.0 - 1.0 - - - diff --git a/maven-java-11/multimodule-maven-project/mainappmodule/src/main/java/com/baeldung/mainapp/Application.java b/maven-java-11/multimodule-maven-project/mainappmodule/src/main/java/com/baeldung/mainapp/Application.java deleted file mode 100644 index 0c0df7461b..0000000000 --- a/maven-java-11/multimodule-maven-project/mainappmodule/src/main/java/com/baeldung/mainapp/Application.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.mainapp; - -import com.baeldung.dao.Dao; -import com.baeldung.entity.User; -import com.baeldung.userdao.UserDao; -import java.util.HashMap; -import java.util.Map; - -public class Application { - - public static void main(String[] args) { - Map users = new HashMap<>(); - users.put(1, new User("Julie")); - users.put(2, new User("David")); - Dao userDao = new UserDao(users); - userDao.findAll().forEach(System.out::println); - } - -} diff --git a/maven-java-11/multimodule-maven-project/mainappmodule/src/main/java/module-info.java b/maven-java-11/multimodule-maven-project/mainappmodule/src/main/java/module-info.java deleted file mode 100644 index c688fcf7de..0000000000 --- a/maven-java-11/multimodule-maven-project/mainappmodule/src/main/java/module-info.java +++ /dev/null @@ -1,6 +0,0 @@ -module com.baeldung.mainapp { - requires com.baeldung.entity; - requires com.baeldung.userdao; - requires com.baeldung.dao; - uses com.baeldung.dao.Dao; -} diff --git a/pom.xml b/pom.xml index a2e09c0f91..fe67bc835b 100644 --- a/pom.xml +++ b/pom.xml @@ -508,7 +508,6 @@ maven-modules maven-archetype - maven-polyglot mesos-marathon @@ -1019,7 +1018,6 @@ maven-modules maven-archetype - maven-polyglot mesos-marathon From 540e719c11bdd91c8e686785d495140778bef83e Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Mon, 14 Sep 2020 21:51:24 +0530 Subject: [PATCH 0721/1862] moved spring-security-web-jsonview module to spring-security-core (#10015) * moved spring-security-web-jsonview module to spring-security-core * removed deleted module from project build --- spring-security-modules/pom.xml | 1 - .../spring-security-core/README.md | 1 + .../java/com/baeldung/filterresponse/App.java | 13 ++ .../filterresponse/config}/AppConfig.java | 6 +- .../SecurityJsonViewControllerAdvice.java | 11 +- .../controller/ItemsController.java | 12 +- .../filterresponse}/controller/View.java | 5 +- .../baeldung/filterresponse}/model/Item.java | 4 +- ...SpringSecurityJsonViewIntegrationTest.java | 4 +- .../spring-security-web-jsonview/.gitignore | 13 -- .../spring-security-web-jsonview/README.md | 7 - .../spring-security-web-jsonview/pom.xml | 206 ------------------ .../java/com/baeldung/AppInitializer.java | 33 --- .../src/main/resources/logback.xml | 19 -- .../java/com/baeldung/SpringContextTest.java | 17 -- 15 files changed, 34 insertions(+), 318 deletions(-) create mode 100644 spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/App.java rename spring-security-modules/{spring-security-web-jsonview/src/main/java/com/baeldung/spring => spring-security-core/src/main/java/com/baeldung/filterresponse/config}/AppConfig.java (95%) rename spring-security-modules/{spring-security-web-jsonview/src/main/java/com/baeldung/spring => spring-security-core/src/main/java/com/baeldung/filterresponse/config}/SecurityJsonViewControllerAdvice.java (95%) rename spring-security-modules/{spring-security-web-jsonview/src/main/java/com/baeldung => spring-security-core/src/main/java/com/baeldung/filterresponse}/controller/ItemsController.java (68%) rename spring-security-modules/{spring-security-web-jsonview/src/main/java/com/baeldung => spring-security-core/src/main/java/com/baeldung/filterresponse}/controller/View.java (76%) rename spring-security-modules/{spring-security-web-jsonview/src/main/java/com/baeldung => spring-security-core/src/main/java/com/baeldung/filterresponse}/model/Item.java (85%) rename spring-security-modules/{spring-security-web-jsonview/src/test/java/com/baeldung/security => spring-security-core/src/test/java/com/baeldung/filterresponse}/SpringSecurityJsonViewIntegrationTest.java (97%) delete mode 100644 spring-security-modules/spring-security-web-jsonview/.gitignore delete mode 100644 spring-security-modules/spring-security-web-jsonview/README.md delete mode 100644 spring-security-modules/spring-security-web-jsonview/pom.xml delete mode 100644 spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/AppInitializer.java delete mode 100644 spring-security-modules/spring-security-web-jsonview/src/main/resources/logback.xml delete mode 100644 spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/SpringContextTest.java diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index b68138964b..d5c0c0dd6e 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -24,7 +24,6 @@ spring-security-web-boot-2 spring-security-web-mvc-custom spring-security-web-digest-auth - spring-security-web-jsonview spring-security-ldap spring-security-web-login spring-security-web-persisted-remember-me diff --git a/spring-security-modules/spring-security-core/README.md b/spring-security-modules/spring-security-core/README.md index f28b3abb2b..9f8e4dda53 100644 --- a/spring-security-modules/spring-security-core/README.md +++ b/spring-security-modules/spring-security-core/README.md @@ -9,6 +9,7 @@ This module contains articles about core Spring Security - [Overview and Need for DelegatingFilterProxy in Spring](https://www.baeldung.com/spring-delegating-filter-proxy) - [Deny Access on Missing @PreAuthorize to Spring Controller Methods](https://www.baeldung.com/spring-deny-access) - [Spring Security: Check If a User Has a Role in Java](https://www.baeldung.com/spring-security-check-user-role) +- [Filtering Jackson JSON Output Based on Spring Security Role](https://www.baeldung.com/spring-security-role-filter-json) ### Build the Project diff --git a/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/App.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/App.java new file mode 100644 index 0000000000..a5389e93d3 --- /dev/null +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/App.java @@ -0,0 +1,13 @@ +package com.baeldung.filterresponse; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class App { + + public static void main(String[] args) { + SpringApplication.run(App.class, args); + } + +} diff --git a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/AppConfig.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/config/AppConfig.java similarity index 95% rename from spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/AppConfig.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/config/AppConfig.java index 10b2d2447e..8ff6000129 100644 --- a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/AppConfig.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/config/AppConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.spring; +package com.baeldung.filterresponse.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -12,12 +12,10 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import java.util.Arrays; - @Configuration @EnableWebMvc @EnableWebSecurity -@ComponentScan("com.baeldung") +@ComponentScan("com.baeldung.filterresponse") public class AppConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer { @Override diff --git a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/config/SecurityJsonViewControllerAdvice.java similarity index 95% rename from spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/config/SecurityJsonViewControllerAdvice.java index d6d022a110..d0ba0adcf5 100644 --- a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/config/SecurityJsonViewControllerAdvice.java @@ -1,6 +1,9 @@ -package com.baeldung.spring; +package com.baeldung.filterresponse.config; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; -import com.baeldung.controller.View; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJacksonValue; @@ -11,9 +14,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.AbstractMappingJacksonResponseBodyAdvice; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; +import com.baeldung.filterresponse.controller.View; @RestControllerAdvice public class SecurityJsonViewControllerAdvice extends AbstractMappingJacksonResponseBodyAdvice { diff --git a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/ItemsController.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/controller/ItemsController.java similarity index 68% rename from spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/ItemsController.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/controller/ItemsController.java index 16268a239b..f5fd4ee7f1 100644 --- a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/ItemsController.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/controller/ItemsController.java @@ -1,14 +1,12 @@ -package com.baeldung.controller; +package com.baeldung.filterresponse.controller; + +import java.util.Arrays; +import java.util.Collection; -import com.baeldung.model.Item; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; +import com.baeldung.filterresponse.model.Item; @RestController public class ItemsController { diff --git a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/View.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/controller/View.java similarity index 76% rename from spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/View.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/controller/View.java index 10ae50adef..3099807578 100644 --- a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/controller/View.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/controller/View.java @@ -1,10 +1,11 @@ -package com.baeldung.controller; +package com.baeldung.filterresponse.controller; -import com.baeldung.spring.AppConfig.Role; import java.util.HashMap; import java.util.Map; +import com.baeldung.filterresponse.config.AppConfig.Role; + public class View { public static final Map MAPPING = new HashMap<>(); diff --git a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/model/Item.java b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/model/Item.java similarity index 85% rename from spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/model/Item.java rename to spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/model/Item.java index 002ee73e4f..9ebdc6bad0 100644 --- a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/model/Item.java +++ b/spring-security-modules/spring-security-core/src/main/java/com/baeldung/filterresponse/model/Item.java @@ -1,6 +1,6 @@ -package com.baeldung.model; +package com.baeldung.filterresponse.model; -import com.baeldung.controller.View; +import com.baeldung.filterresponse.controller.View; import com.fasterxml.jackson.annotation.JsonView; public class Item { diff --git a/spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/filterresponse/SpringSecurityJsonViewIntegrationTest.java similarity index 97% rename from spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java rename to spring-security-modules/spring-security-core/src/test/java/com/baeldung/filterresponse/SpringSecurityJsonViewIntegrationTest.java index 626c8cb497..fc821b5175 100644 --- a/spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/security/SpringSecurityJsonViewIntegrationTest.java +++ b/spring-security-modules/spring-security-core/src/test/java/com/baeldung/filterresponse/SpringSecurityJsonViewIntegrationTest.java @@ -1,6 +1,6 @@ -package com.baeldung.security; +package com.baeldung.filterresponse; -import com.baeldung.spring.AppConfig; +import com.baeldung.filterresponse.config.AppConfig; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.junit.Before; diff --git a/spring-security-modules/spring-security-web-jsonview/.gitignore b/spring-security-modules/spring-security-web-jsonview/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-security-modules/spring-security-web-jsonview/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.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/spring-security-modules/spring-security-web-jsonview/README.md b/spring-security-modules/spring-security-web-jsonview/README.md deleted file mode 100644 index 83f8106df9..0000000000 --- a/spring-security-modules/spring-security-web-jsonview/README.md +++ /dev/null @@ -1,7 +0,0 @@ -## Spring Security Web Json View - -This module contains articles about Spring Security with JSON - -### Relevant Articles: - -- [Filtering Jackson JSON Output Based on Spring Security Role](https://www.baeldung.com/spring-security-role-filter-json) diff --git a/spring-security-modules/spring-security-web-jsonview/pom.xml b/spring-security-modules/spring-security-web-jsonview/pom.xml deleted file mode 100644 index 0d1b0b09db..0000000000 --- a/spring-security-modules/spring-security-web-jsonview/pom.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - 4.0.0 - spring-security-web-jsonview - 0.1-SNAPSHOT - spring-security-web-jsonview - war - - - com.baeldung - parent-spring-5 - 0.0.1-SNAPSHOT - ../../parent-spring-5 - - - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - - - - org.springframework.security - spring-security-web - ${spring-security.version} - - - org.springframework.security - spring-security-config - ${spring-security.version} - - - org.springframework.security - spring-security-taglibs - ${spring-security.version} - - - - - - org.springframework - spring-core - ${spring.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-jdbc - ${spring.version} - - - org.springframework - spring-beans - ${spring.version} - - - org.springframework - spring-aop - ${spring.version} - - - org.springframework - spring-tx - ${spring.version} - - - org.springframework - spring-expression - ${spring.version} - - - - org.springframework - spring-web - ${spring.version} - - - org.springframework - spring-webmvc - ${spring.version} - - - - - - javax.servlet - javax.servlet-api - ${javax.servlet-api.version} - provided - - - - javax.servlet - jstl - ${jstl.version} - runtime - - - - - - org.springframework - spring-test - ${spring.version} - test - - - org.springframework.security - spring-security-test - ${spring-security.version} - test - - - com.jayway.jsonpath - json-path - ${json-path.version} - test - - - - - spring-security-mvc-jsonview - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - - default-war - prepare-package - - false - - - - - - - org.codehaus.cargo - cargo-maven2-plugin - ${cargo-maven2-plugin.version} - - - - ${project.build.directory}/${project.name}.war - war - - / - - - - - 2400000 - tomcat8x - embedded - - - - - - - 8084 - - - - - - - - - 1.6.1 - 2.4.0 - - - \ No newline at end of file diff --git a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/AppInitializer.java b/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/AppInitializer.java deleted file mode 100644 index 4f38d190eb..0000000000 --- a/spring-security-modules/spring-security-web-jsonview/src/main/java/com/baeldung/AppInitializer.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung; - -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRegistration; - -import org.springframework.web.WebApplicationInitializer; -import org.springframework.web.context.ContextLoaderListener; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.context.support.GenericWebApplicationContext; -import org.springframework.web.filter.DelegatingFilterProxy; -import org.springframework.web.servlet.DispatcherServlet; - -public class AppInitializer implements WebApplicationInitializer { - - @Override - public void onStartup(final ServletContext sc) throws ServletException { - - AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); - - root.scan("com.baeldung"); - sc.addListener(new ContextLoaderListener(root)); - - ServletRegistration.Dynamic appServlet = sc.addServlet("mvc", new DispatcherServlet(new GenericWebApplicationContext())); - appServlet.setLoadOnStartup(1); - appServlet.addMapping("/"); - - sc.addFilter("securityFilter", new DelegatingFilterProxy("springSecurityFilterChain")) - .addMappingForUrlPatterns(null, false, "/*"); - - } - -} diff --git a/spring-security-modules/spring-security-web-jsonview/src/main/resources/logback.xml b/spring-security-modules/spring-security-web-jsonview/src/main/resources/logback.xml deleted file mode 100644 index 56af2d397e..0000000000 --- a/spring-security-modules/spring-security-web-jsonview/src/main/resources/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/SpringContextTest.java deleted file mode 100644 index b1a3de714e..0000000000 --- a/spring-security-modules/spring-security-web-jsonview/src/test/java/com/baeldung/SpringContextTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung; - -import com.baeldung.spring.AppConfig; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.web.WebAppConfiguration; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = AppConfig.class) -@WebAppConfiguration -public class SpringContextTest { - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} From 3563524c09e51720fe60f845581063b392ef0323 Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Mon, 14 Sep 2020 21:53:09 +0530 Subject: [PATCH 0722/1862] moved spring-rest-hal-browser to spring-data-rest module (#10019) * moved spring-rest-hal-browser to spring-data-rest module * removed module from build --- pom.xml | 2 - spring-data-rest/README.md | 1 + spring-data-rest/pom.xml | 9 +++ .../java/com/baeldung/halbrowser}/App.java | 2 +- .../baeldung/halbrowser}/config/DBLoader.java | 11 ++-- .../halbrowser}/config/RestConfig.java | 2 +- .../halbrowser}/data/BookRepository.java | 6 +- .../com/baeldung/halbrowser}/model/Book.java | 2 +- spring-rest-hal-browser/README.md | 6 -- spring-rest-hal-browser/pom.xml | 62 ------------------- .../src/main/resources/application.properties | 0 .../src/main/resources/logback.xml | 13 ---- 12 files changed, 22 insertions(+), 94 deletions(-) rename {spring-rest-hal-browser/src/main/java/com/baeldung => spring-data-rest/src/main/java/com/baeldung/halbrowser}/App.java (88%) rename {spring-rest-hal-browser/src/main/java/com/baeldung => spring-data-rest/src/main/java/com/baeldung/halbrowser}/config/DBLoader.java (95%) rename {spring-rest-hal-browser/src/main/java/com/baeldung => spring-data-rest/src/main/java/com/baeldung/halbrowser}/config/RestConfig.java (95%) rename {spring-rest-hal-browser/src/main/java/com/baeldung => spring-data-rest/src/main/java/com/baeldung/halbrowser}/data/BookRepository.java (86%) rename {spring-rest-hal-browser/src/main/java/com/baeldung => spring-data-rest/src/main/java/com/baeldung/halbrowser}/model/Book.java (97%) delete mode 100644 spring-rest-hal-browser/README.md delete mode 100644 spring-rest-hal-browser/pom.xml delete mode 100644 spring-rest-hal-browser/src/main/resources/application.properties delete mode 100644 spring-rest-hal-browser/src/main/resources/logback.xml diff --git a/pom.xml b/pom.xml index a2e09c0f91..9406d2e180 100644 --- a/pom.xml +++ b/pom.xml @@ -697,7 +697,6 @@ spring-remoting spring-rest-angular spring-rest-compress - spring-rest-hal-browser spring-rest-http spring-rest-http-2 spring-rest-query-language @@ -1200,7 +1199,6 @@ spring-remoting spring-rest-angular spring-rest-compress - spring-rest-hal-browser spring-rest-http spring-rest-query-language spring-rest-shell diff --git a/spring-data-rest/README.md b/spring-data-rest/README.md index bae2fe8eaf..ab1991b08f 100644 --- a/spring-data-rest/README.md +++ b/spring-data-rest/README.md @@ -12,6 +12,7 @@ This module contains articles about Spring Data REST - [Customizing HTTP Endpoints in Spring Data REST](https://www.baeldung.com/spring-data-rest-customize-http-endpoints) - [Spring Boot with SQLite](https://www.baeldung.com/spring-boot-sqlite) - [Spring Data Web Support](https://www.baeldung.com/spring-data-web-support) +- [Spring REST and HAL Browser](https://www.baeldung.com/spring-rest-hal) ### The Course The "REST With Spring" Classes: http://bit.ly/restwithspring diff --git a/spring-data-rest/pom.xml b/spring-data-rest/pom.xml index 741d146fbf..63a42857f4 100644 --- a/spring-data-rest/pom.xml +++ b/spring-data-rest/pom.xml @@ -32,6 +32,15 @@ org.springframework.boot spring-boot-starter-data-jpa + + + org.springframework.data + spring-data-rest-hal-browser + + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-autoconfigure diff --git a/spring-rest-hal-browser/src/main/java/com/baeldung/App.java b/spring-data-rest/src/main/java/com/baeldung/halbrowser/App.java similarity index 88% rename from spring-rest-hal-browser/src/main/java/com/baeldung/App.java rename to spring-data-rest/src/main/java/com/baeldung/halbrowser/App.java index 14b6c201d5..6421b7ac33 100644 --- a/spring-rest-hal-browser/src/main/java/com/baeldung/App.java +++ b/spring-data-rest/src/main/java/com/baeldung/halbrowser/App.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.halbrowser; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-rest-hal-browser/src/main/java/com/baeldung/config/DBLoader.java b/spring-data-rest/src/main/java/com/baeldung/halbrowser/config/DBLoader.java similarity index 95% rename from spring-rest-hal-browser/src/main/java/com/baeldung/config/DBLoader.java rename to spring-data-rest/src/main/java/com/baeldung/halbrowser/config/DBLoader.java index 7251ef0e8c..3cd059ce63 100644 --- a/spring-rest-hal-browser/src/main/java/com/baeldung/config/DBLoader.java +++ b/spring-data-rest/src/main/java/com/baeldung/halbrowser/config/DBLoader.java @@ -1,14 +1,15 @@ -package com.baeldung.config; +package com.baeldung.halbrowser.config; + +import java.util.Random; +import java.util.stream.IntStream; -import com.baeldung.data.BookRepository; -import com.baeldung.model.Book; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; -import java.util.Random; -import java.util.stream.IntStream; +import com.baeldung.halbrowser.data.BookRepository; +import com.baeldung.halbrowser.model.Book; @Component public class DBLoader implements ApplicationRunner { diff --git a/spring-rest-hal-browser/src/main/java/com/baeldung/config/RestConfig.java b/spring-data-rest/src/main/java/com/baeldung/halbrowser/config/RestConfig.java similarity index 95% rename from spring-rest-hal-browser/src/main/java/com/baeldung/config/RestConfig.java rename to spring-data-rest/src/main/java/com/baeldung/halbrowser/config/RestConfig.java index 858371facc..73f7e0f26a 100644 --- a/spring-rest-hal-browser/src/main/java/com/baeldung/config/RestConfig.java +++ b/spring-data-rest/src/main/java/com/baeldung/halbrowser/config/RestConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.config; +package com.baeldung.halbrowser.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; diff --git a/spring-rest-hal-browser/src/main/java/com/baeldung/data/BookRepository.java b/spring-data-rest/src/main/java/com/baeldung/halbrowser/data/BookRepository.java similarity index 86% rename from spring-rest-hal-browser/src/main/java/com/baeldung/data/BookRepository.java rename to spring-data-rest/src/main/java/com/baeldung/halbrowser/data/BookRepository.java index d8e35974b1..375f6886ef 100644 --- a/spring-rest-hal-browser/src/main/java/com/baeldung/data/BookRepository.java +++ b/spring-data-rest/src/main/java/com/baeldung/halbrowser/data/BookRepository.java @@ -1,14 +1,14 @@ -package com.baeldung.data; +package com.baeldung.halbrowser.data; -import com.baeldung.model.Book; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RestResource; import org.springframework.stereotype.Repository; +import com.baeldung.halbrowser.model.Book; + @Repository public interface BookRepository extends PagingAndSortingRepository { diff --git a/spring-rest-hal-browser/src/main/java/com/baeldung/model/Book.java b/spring-data-rest/src/main/java/com/baeldung/halbrowser/model/Book.java similarity index 97% rename from spring-rest-hal-browser/src/main/java/com/baeldung/model/Book.java rename to spring-data-rest/src/main/java/com/baeldung/halbrowser/model/Book.java index b1dc1b41f3..06056df525 100644 --- a/spring-rest-hal-browser/src/main/java/com/baeldung/model/Book.java +++ b/spring-data-rest/src/main/java/com/baeldung/halbrowser/model/Book.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.halbrowser.model; import javax.persistence.*; import javax.validation.constraints.NotNull; diff --git a/spring-rest-hal-browser/README.md b/spring-rest-hal-browser/README.md deleted file mode 100644 index 90337aad1a..0000000000 --- a/spring-rest-hal-browser/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## Spring REST HAL Browser - -This module contains articles about Spring REST with the HAL browser - -### Relevant Articles: -- [Spring REST and HAL Browser](https://www.baeldung.com/spring-rest-hal) diff --git a/spring-rest-hal-browser/pom.xml b/spring-rest-hal-browser/pom.xml deleted file mode 100644 index c8066b89a4..0000000000 --- a/spring-rest-hal-browser/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - 4.0.0 - spring-rest-hal-browser - 1.0-SNAPSHOT - spring-rest-hal-browser - - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../parent-boot-2 - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-validation - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - - org.springframework.data - spring-data-rest-hal-browser - - - - com.h2database - h2 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${source.version} - ${target.version} - - - - - - - 1.8 - 1.8 - - - \ No newline at end of file diff --git a/spring-rest-hal-browser/src/main/resources/application.properties b/spring-rest-hal-browser/src/main/resources/application.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-rest-hal-browser/src/main/resources/logback.xml b/spring-rest-hal-browser/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/spring-rest-hal-browser/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file From cd89253474a9ab6ba174c5b79ee9d8aeffe107f1 Mon Sep 17 00:00:00 2001 From: Cavero Barca Date: Mon, 14 Sep 2020 23:58:12 +0200 Subject: [PATCH 0723/1862] Create the layers configuration, modify the pom and Dockerfile --- docker/docker-spring-boot/pom.xml | 1 + docker/docker-spring-boot/src/layers.xml | 27 +++++++++++++++++++ .../src/main/docker/Dockerfile | 1 + 3 files changed, 29 insertions(+) create mode 100644 docker/docker-spring-boot/src/layers.xml diff --git a/docker/docker-spring-boot/pom.xml b/docker/docker-spring-boot/pom.xml index b9c80bc43a..e8f6c134b1 100644 --- a/docker/docker-spring-boot/pom.xml +++ b/docker/docker-spring-boot/pom.xml @@ -45,6 +45,7 @@ true + ${project.basedir}/src/layers.xml diff --git a/docker/docker-spring-boot/src/layers.xml b/docker/docker-spring-boot/src/layers.xml new file mode 100644 index 0000000000..61c9bd9c39 --- /dev/null +++ b/docker/docker-spring-boot/src/layers.xml @@ -0,0 +1,27 @@ + + + + org/springframework/boot/loader/** + + + + + + *:*:*SNAPSHOT + + + com.baeldung.docker:*:* + + + + + dependencies + spring-boot-loader + internal-dependencies + snapshot-dependencies + application + + \ No newline at end of file diff --git a/docker/docker-spring-boot/src/main/docker/Dockerfile b/docker/docker-spring-boot/src/main/docker/Dockerfile index fa147dd69b..663cc94490 100644 --- a/docker/docker-spring-boot/src/main/docker/Dockerfile +++ b/docker/docker-spring-boot/src/main/docker/Dockerfile @@ -10,6 +10,7 @@ RUN java -Djarmode=layertools -jar application.jar extract FROM adoptopenjdk:11-jre-hotspot COPY --from=builder dependencies/ ./ COPY --from=builder snapshot-dependencies/ ./ +COPY --from=builder internal-dependencies/ ./ COPY --from=builder spring-boot-loader/ ./ COPY --from=builder application/ ./ ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] \ No newline at end of file From 12b3067cd20d09ed8f5753111c9bd23e29e50a98 Mon Sep 17 00:00:00 2001 From: AmitB Date: Tue, 15 Sep 2020 10:14:25 +0530 Subject: [PATCH 0724/1862] [BAEL-4495] Performance of removeAll() in a HashSet (#10011) * [BAEL-4495] Performance of removeAll() in a HashSet * [BAEL-4495] Add unit test for hashset removeAll() * [BAEL-4495] Update test methods to camelCase --- .../HashSetBenchmark.java | 86 +++++++++++++++++++ .../collections/hashset/HashSetUnitTest.java | 33 +++++++ 2 files changed, 119 insertions(+) create mode 100644 core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java create mode 100644 core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/hashset/HashSetUnitTest.java diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java new file mode 100644 index 0000000000..8ce58c865e --- /dev/null +++ b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java @@ -0,0 +1,86 @@ +package com.baeldung.collections.removeallperformance; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.lang3.RandomStringUtils; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import com.baeldung.collections.containsperformance.Employee; + +@BenchmarkMode(Mode.AverageTime) +@OutputTimeUnit(TimeUnit.NANOSECONDS) +@Warmup(iterations = 5) +public class HashSetBenchmark { + + @State(Scope.Thread) + public static class MyState { + private Set employeeSet1 = new HashSet<>(); + private List employeeList1 = new ArrayList<>(); + private Set employeeSet2 = new HashSet<>(); + private List employeeList2 = new ArrayList<>(); + + private long set1Size = 60000; + private long list1Size = 50000; + private long set2Size = 50000; + private long list2Size = 60000; + + @Setup(Level.Trial) + public void setUp() { + + for (long i = 0; i < set1Size; i++) { + employeeSet1.add(new Employee(i, RandomStringUtils.random(7, true, false))); + } + + for (long i = 0; i < list1Size; i++) { + employeeList1.add(new Employee(i, RandomStringUtils.random(7, true, false))); + } + + for (long i = 0; i < set2Size; i++) { + employeeSet2.add(new Employee(i, RandomStringUtils.random(7, true, false))); + } + + for (long i = 0; i < list2Size; i++) { + employeeList2.add(new Employee(i, RandomStringUtils.random(7, true, false))); + } + + } + + } + + @Benchmark + public boolean given_SizeOfHashsetGreaterThanSizeOfCollection_When_RemoveAllFromHashSet_Then_GoodPerformance(MyState state) { + return state.employeeSet1.removeAll(state.employeeList1); + } + + @Benchmark + public boolean given_SizeOfHashsetSmallerThanSizeOfCollection_When_RemoveAllFromHashSet_Then_BadPerformance(MyState state) { + return state.employeeSet2.removeAll(state.employeeList2); + } + + public static void main(String[] args) throws Exception { + Options options = new OptionsBuilder().include(HashSetBenchmark.class.getSimpleName()) + .threads(1) + .forks(1) + .shouldFailOnError(true) + .shouldDoGC(true) + .jvmArgs("-server") + .build(); + new Runner(options).run(); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/hashset/HashSetUnitTest.java b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/hashset/HashSetUnitTest.java new file mode 100644 index 0000000000..1c23538675 --- /dev/null +++ b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/hashset/HashSetUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.collections.hashset; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.junit.jupiter.api.Test; + +class HashSetUnitTest { + + @Test + void whenRemoveAllFromHashset_thenRemovesAllElementsFromHashsetThatArePresentInCollection() { + Set set = new HashSet<>(); + Collection collection = new ArrayList<>(); + set.add(1); + set.add(2); + set.add(3); + set.add(4); + collection.add(1); + collection.add(3); + + set.removeAll(collection); + + assertEquals(2, set.size()); + Integer[] actualElements = new Integer[set.size()]; + Integer[] expectedElements = new Integer[] { 2, 4 }; + assertArrayEquals(expectedElements, set.toArray(actualElements)); + } + +} From 0976c32038f17c07e0b2b2066c93a7017ebaf990 Mon Sep 17 00:00:00 2001 From: Reza Ebrahimpour Date: Tue, 15 Sep 2020 11:12:24 +0430 Subject: [PATCH 0725/1862] BAEL-4488 Create AvailableCiphers --- .../com/baeldung/cipher/AvailableCiphers.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 core-java-modules/core-java-security-2/src/main/java/com/baeldung/cipher/AvailableCiphers.java diff --git a/core-java-modules/core-java-security-2/src/main/java/com/baeldung/cipher/AvailableCiphers.java b/core-java-modules/core-java-security-2/src/main/java/com/baeldung/cipher/AvailableCiphers.java new file mode 100644 index 0000000000..f73433ffd2 --- /dev/null +++ b/core-java-modules/core-java-security-2/src/main/java/com/baeldung/cipher/AvailableCiphers.java @@ -0,0 +1,32 @@ +package com.baeldung.cipher; + +import java.security.Provider; +import java.security.Security; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +public class AvailableCiphers { + public static void main(String[] args) { + printAllCiphers(); + printCompatibleCiphers(); + } + + private static void printAllCiphers() { + for (Provider provider : Security.getProviders()) { + for (Provider.Service service : provider.getServices()) { + System.out.println(service.getAlgorithm()); + } + } + } + + private static void printCompatibleCiphers() { + List algorithms = Arrays.stream(Security.getProviders()) + .flatMap(provider -> provider.getServices().stream()) + .filter(service -> "Cipher".equals(service.getType())) + .map(Provider.Service::getAlgorithm) + .collect(Collectors.toList()); + + algorithms.forEach(System.out::println); + } +} From 27aa7c4cad3d469a1bfbb96d36e2bd5acdcd2161 Mon Sep 17 00:00:00 2001 From: mikr Date: Tue, 15 Sep 2020 10:16:09 +0200 Subject: [PATCH 0726/1862] Java-2136 Fix Unit tests + remove unnecessary println --- jackson-modules/jackson-custom-conversions/pom.xml | 7 +++++++ .../deserialization/CustomDeserializationUnitTest.java | 7 ++----- .../serialization/CustomSerializationUnitTest.java | 3 --- .../skipfields/IgnoreFieldsWithFilterUnitTest.java | 2 -- .../baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java | 8 -------- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/jackson-modules/jackson-custom-conversions/pom.xml b/jackson-modules/jackson-custom-conversions/pom.xml index c319891da9..78894bb403 100644 --- a/jackson-modules/jackson-custom-conversions/pom.xml +++ b/jackson-modules/jackson-custom-conversions/pom.xml @@ -23,6 +23,13 @@ jackson-datatype-joda ${jackson.version} + + com.fasterxml.jackson.core + jackson-core + 2.10.1 + + + diff --git a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java index f2a2502c3e..17016149a2 100644 --- a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java +++ b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/deserialization/CustomDeserializationUnitTest.java @@ -60,8 +60,6 @@ public class CustomDeserializationUnitTest { String converted = objectMapper.writeValueAsString(now); // restore an instance of ZonedDateTime from String ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class); - System.out.println("serialized: " + now); - System.out.println("restored: " + restored); assertThat(now, is(not(restored))); } @@ -70,15 +68,14 @@ public class CustomDeserializationUnitTest { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.findAndRegisterModules(); objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.enable(SerializationFeature.WRITE_DATES_WITH_ZONE_ID); objectMapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); // construct a new instance of ZonedDateTime ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Europe/Berlin")); String converted = objectMapper.writeValueAsString(now); // restore an instance of ZonedDateTime from String ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class); - System.out.println("serialized: " + now); - System.out.println("restored: " + restored); - assertThat(now, is(restored)); + assertThat(restored, is(now)); } } diff --git a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java index 6cb4019fa2..9c46a86fd8 100644 --- a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java +++ b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/serialization/CustomSerializationUnitTest.java @@ -24,7 +24,6 @@ public class CustomSerializationUnitTest { public final void whenSerializing_thenNoExceptions() throws JsonGenerationException, JsonMappingException, IOException { final Item myItem = new Item(1, "theItem", new User(2, "theUser")); final String serialized = new ObjectMapper().writeValueAsString(myItem); - System.out.println(serialized); } @Test @@ -38,7 +37,6 @@ public class CustomSerializationUnitTest { mapper.registerModule(simpleModule); final String serialized = mapper.writeValueAsString(myItem); - System.out.println(serialized); } @Test @@ -46,7 +44,6 @@ public class CustomSerializationUnitTest { final ItemWithSerializer myItem = new ItemWithSerializer(1, "theItem", new User(2, "theUser")); final String serialized = new ObjectMapper().writeValueAsString(myItem); - System.out.println(serialized); } } diff --git a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java index e71f31bc6a..ec753019b2 100644 --- a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java +++ b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/IgnoreFieldsWithFilterUnitTest.java @@ -37,7 +37,6 @@ public class IgnoreFieldsWithFilterUnitTest { assertThat(dtoAsString, not(containsString("intValue"))); assertThat(dtoAsString, containsString("booleanValue")); assertThat(dtoAsString, containsString("stringValue")); - System.out.println(dtoAsString); } @Test @@ -83,7 +82,6 @@ public class IgnoreFieldsWithFilterUnitTest { assertThat(dtoAsString, not(containsString("intValue"))); assertThat(dtoAsString, containsString("booleanValue")); assertThat(dtoAsString, containsString("stringValue")); - System.out.println(dtoAsString); } } diff --git a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java index 6ba14f7476..2fd59e2a82 100644 --- a/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java +++ b/jackson-modules/jackson-custom-conversions/src/test/java/com/baeldung/skipfields/JacksonDynamicIgnoreUnitTest.java @@ -51,8 +51,6 @@ public class JacksonDynamicIgnoreUnitTest { assertTrue(result.contains("john")); assertTrue(result.contains("address")); assertTrue(result.contains("usa")); - - System.out.println("Not Hidden = " + result); } @Test @@ -65,8 +63,6 @@ public class JacksonDynamicIgnoreUnitTest { assertTrue(result.contains("john")); assertFalse(result.contains("address")); assertFalse(result.contains("usa")); - - System.out.println("Address Hidden = " + result); } @Test @@ -76,8 +72,6 @@ public class JacksonDynamicIgnoreUnitTest { final String result = mapper.writeValueAsString(person); assertTrue(result.length() == 0); - - System.out.println("All Hidden = " + result); } @Test @@ -90,7 +84,5 @@ public class JacksonDynamicIgnoreUnitTest { final Person p3 = new Person("adam", ad3, false); final String result = mapper.writeValueAsString(Arrays.asList(p1, p2, p3)); - - System.out.println(result); } } From 4f148739678917085f9319c036e5f7b29ae0d2d5 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Tue, 15 Sep 2020 10:28:34 +0200 Subject: [PATCH 0727/1862] JAVA-2599: Update OS specific unit tests --- core-java-modules/core-java-io-3/README.md | 1 + .../emptiness/DirectoryEmptinessUnitTest.java | 5 +++-- .../TemporaryDirectoriesUnitTest.java | 15 +++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md index c4eacdf27a..06a2a5a0fc 100644 --- a/core-java-modules/core-java-io-3/README.md +++ b/core-java-modules/core-java-io-3/README.md @@ -9,4 +9,5 @@ This module contains articles about core Java input and output (IO) - [Check If a File or Directory Exists in Java](https://www.baeldung.com/java-file-directory-exists) - [Copy a Directory in Java](https://www.baeldung.com/java-copy-directory) - [Java Files Open Options](https://www.baeldung.com/java-file-options) +- [Creating Temporary Directories in Java](https://www.baeldung.com/java-temp-directories) - [[<-- Prev]](/core-java-modules/core-java-io-2) diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/emptiness/DirectoryEmptinessUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/emptiness/DirectoryEmptinessUnitTest.java index a44aea1383..7f7936494f 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/emptiness/DirectoryEmptinessUnitTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/emptiness/DirectoryEmptinessUnitTest.java @@ -4,6 +4,7 @@ import org.junit.Test; import java.io.File; import java.io.IOException; +import java.net.URISyntaxException; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; @@ -20,8 +21,8 @@ public class DirectoryEmptinessUnitTest { } @Test - public void givenPath_whenNotDirectory_thenReturnsFalse() throws IOException { - Path aFile = Paths.get(getClass().getResource("/notDir.txt").getPath()); + public void givenPath_whenNotDirectory_thenReturnsFalse() throws IOException, URISyntaxException { + Path aFile = Paths.get(getClass().getResource("/notDir.txt").toURI()); assertThat(isEmpty(aFile)).isFalse(); } diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/tempdirectory/TemporaryDirectoriesUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/tempdirectory/TemporaryDirectoriesUnitTest.java index 470e06ef96..5cf7d88cd6 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/tempdirectory/TemporaryDirectoriesUnitTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/tempdirectory/TemporaryDirectoriesUnitTest.java @@ -4,6 +4,7 @@ import org.apache.commons.io.FileUtils; import org.junit.Test; import java.io.IOException; +import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -66,10 +67,16 @@ public class TemporaryDirectoriesUnitTest { @Test public void givenTempDirWithPrefixWithFileAttrs_whenCreatePlainJava_thenAttributesAreSet() throws IOException { - final FileAttribute> attrs = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("r--------")); + boolean isPosix = FileSystems.getDefault().supportedFileAttributeViews().contains("posix"); - final Path tmpdir = Files.createTempDirectory(Paths.get("target"), "tmpDirPrefix", attrs); - assertThat(tmpdir.toFile().getPath()).startsWith("target"); - assertThat(tmpdir.toFile().canWrite()).isFalse(); + if(!isPosix){ + System.out.println("You must be under a Posix Compliant Filesystem to run this test."); + } else { + final FileAttribute> attrs = PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("r--------")); + + final Path tmpdir = Files.createTempDirectory(Paths.get("target"), "tmpDirPrefix", attrs); + assertThat(tmpdir.toFile().getPath()).startsWith("target"); + assertThat(tmpdir.toFile().canWrite()).isFalse(); + } } } From 5121313f65903725a7e883d0ac9cb6f98cd9d16a Mon Sep 17 00:00:00 2001 From: mikr Date: Tue, 15 Sep 2020 11:08:35 +0200 Subject: [PATCH 0728/1862] Java-2136 Correctly configure netty server --- .../reactive/security/SpringSecurity5Application.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java index 325923f577..d315bf8238 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java @@ -28,9 +28,7 @@ public class SpringSecurity5Application { HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context) .build(); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); - HttpServer httpServer = HttpServer.create(); - httpServer.host("localhost"); - httpServer.port(8080); + HttpServer httpServer = HttpServer.create().host("localhost").port(8080); return httpServer.handle(adapter).bindNow(); } From 40ebac5142a360131df2fb1f26bee8cb0b542511 Mon Sep 17 00:00:00 2001 From: Usman Mohyuddin Date: Tue, 15 Sep 2020 15:09:35 +0500 Subject: [PATCH 0729/1862] Split the @Test annotation in new line --- .../groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy index 4cdcb4ddfa..61b81fe1b2 100644 --- a/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy +++ b/core-groovy-strings/src/test/groovy/com/baeldung/removeprefix/RemovePrefixTest.groovy @@ -45,7 +45,8 @@ class RemovePrefixTest { Assert.assertEquals(expected, actual) } - @Test public void whenPrefixIsRemovedUsingReplaceFirst_thenReturnTrue() { + @Test + public void whenPrefixIsRemovedUsingReplaceFirst_thenReturnTrue() { def regex = ~"^groovy" String trimPrefix = "groovyTutorials at Baeldung's groovy page" String actual = trimPrefix.replaceFirst(regex, "") From 51c2e22324186f7b17b141635dc66a685014ec95 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Tue, 15 Sep 2020 20:32:07 +0530 Subject: [PATCH 0730/1862] Formatted code --- .../charencoding/CharacterEncodingDemo.java | 28 +++++++++---------- .../CharEncodingCheckController.java | 10 +++---- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/CharacterEncodingDemo.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/CharacterEncodingDemo.java index 453bad5633..fb02789258 100644 --- a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/CharacterEncodingDemo.java +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/CharacterEncodingDemo.java @@ -9,19 +9,19 @@ import org.springframework.web.filter.CharacterEncodingFilter; @SpringBootApplication public class CharacterEncodingDemo { - public static void main(String[] args) { - SpringApplication.run(CharacterEncodingDemo.class, args); - } + public static void main(String[] args) { + SpringApplication.run(CharacterEncodingDemo.class, args); + } - @Bean - public FilterRegistrationBean filterRegistrationBean() { - CharacterEncodingFilter filter = new CharacterEncodingFilter(); - filter.setEncoding("UTF-8"); - filter.setForceEncoding(true); - - FilterRegistrationBean registrationBean = new FilterRegistrationBean(); - registrationBean.setFilter(filter); - registrationBean.addUrlPatterns("/*"); - return registrationBean; - } + @Bean + public FilterRegistrationBean filterRegistrationBean() { + CharacterEncodingFilter filter = new CharacterEncodingFilter(); + filter.setEncoding("UTF-8"); + filter.setForceEncoding(true); + + FilterRegistrationBean registrationBean = new FilterRegistrationBean(); + registrationBean.setFilter(filter); + registrationBean.addUrlPatterns("/*"); + return registrationBean; + } } diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/controller/CharEncodingCheckController.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/controller/CharEncodingCheckController.java index 3257ca1f36..e1767f941e 100644 --- a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/controller/CharEncodingCheckController.java +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/charencoding/controller/CharEncodingCheckController.java @@ -5,9 +5,9 @@ import org.springframework.web.bind.annotation.GetMapping; @Controller public class CharEncodingCheckController { - - @GetMapping("/ping") - public String ping() { - return "path"; - } + + @GetMapping("/ping") + public String ping() { + return "path"; + } } From 4ae6ecbb39a37dde248f4d81521ba9d22dd044dc Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 15 Sep 2020 20:33:11 +0200 Subject: [PATCH 0731/1862] BAEL-4595: Upgrade to hazelcast-jet 4.2 (#10035) --- hazelcast/pom.xml | 10 +++----- .../hazelcast/cluster/NativeClient.java | 18 ++++++------- .../hazelcast/cluster/ServerNode.java | 10 ++++---- .../baeldung/hazelcast/jet/WordCounter.java | 25 ++++++++----------- .../hazelcast/jet/WordCounterUnitTest.java | 6 ++--- 5 files changed, 30 insertions(+), 39 deletions(-) diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml index 287542be33..69444308a3 100644 --- a/hazelcast/pom.xml +++ b/hazelcast/pom.xml @@ -1,8 +1,8 @@ + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 hazelcast 0.0.1-SNAPSHOT @@ -15,7 +15,6 @@ - com.hazelcast.jet hazelcast-jet @@ -34,8 +33,7 @@ - - 0.6 + 4.2 \ No newline at end of file diff --git a/hazelcast/src/main/java/com/baeldung/hazelcast/cluster/NativeClient.java b/hazelcast/src/main/java/com/baeldung/hazelcast/cluster/NativeClient.java index 697e362289..3e58897401 100644 --- a/hazelcast/src/main/java/com/baeldung/hazelcast/cluster/NativeClient.java +++ b/hazelcast/src/main/java/com/baeldung/hazelcast/cluster/NativeClient.java @@ -1,24 +1,20 @@ package com.baeldung.hazelcast.cluster; -import java.util.Map.Entry; - import com.hazelcast.client.HazelcastClient; import com.hazelcast.client.config.ClientConfig; -import com.hazelcast.config.GroupConfig; import com.hazelcast.core.HazelcastInstance; -import com.hazelcast.core.IMap; + +import java.util.Map; public class NativeClient { - public static void main(String[] args) throws InterruptedException { + public static void main(String[] args) { ClientConfig config = new ClientConfig(); - GroupConfig groupConfig = config.getGroupConfig(); - groupConfig.setName("dev"); - groupConfig.setPassword("dev-pass"); + config.setClusterName("dev"); HazelcastInstance hazelcastInstanceClient = HazelcastClient.newHazelcastClient(config); - IMap map = hazelcastInstanceClient.getMap("data"); - for (Entry entry : map.entrySet()) { - System.out.println(String.format("Key: %d, Value: %s", entry.getKey(), entry.getValue())); + Map map = hazelcastInstanceClient.getMap("data"); + for (Map.Entry entry : map.entrySet()) { + System.out.printf("Key: %d, Value: %s%n", entry.getKey(), entry.getValue()); } } } diff --git a/hazelcast/src/main/java/com/baeldung/hazelcast/cluster/ServerNode.java b/hazelcast/src/main/java/com/baeldung/hazelcast/cluster/ServerNode.java index 36028834a4..7c903e961a 100644 --- a/hazelcast/src/main/java/com/baeldung/hazelcast/cluster/ServerNode.java +++ b/hazelcast/src/main/java/com/baeldung/hazelcast/cluster/ServerNode.java @@ -1,19 +1,19 @@ package com.baeldung.hazelcast.cluster; -import java.util.Map; - import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; -import com.hazelcast.core.IdGenerator; +import com.hazelcast.flakeidgen.FlakeIdGenerator; + +import java.util.Map; public class ServerNode { public static void main(String[] args) { HazelcastInstance hazelcastInstance = Hazelcast.newHazelcastInstance(); Map map = hazelcastInstance.getMap("data"); - IdGenerator idGenerator = hazelcastInstance.getIdGenerator("newid"); + FlakeIdGenerator idGenerator = hazelcastInstance.getFlakeIdGenerator("newid"); for (int i = 0; i < 10; i++) { - map.put(idGenerator.newId(), "message" + 1); + map.put(idGenerator.newId(), "message" + i); } } } diff --git a/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java b/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java index 971986bcae..5d10650f89 100644 --- a/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java +++ b/hazelcast/src/main/java/com/baeldung/hazelcast/jet/WordCounter.java @@ -1,33 +1,31 @@ package com.baeldung.hazelcast.jet; -import java.util.List; -import java.util.Map; - -import static com.hazelcast.jet.Traversers.traverseArray; -import static com.hazelcast.jet.aggregate.AggregateOperations.counting; -import static com.hazelcast.jet.function.DistributedFunctions.wholeItem; - import com.hazelcast.jet.Jet; import com.hazelcast.jet.JetInstance; import com.hazelcast.jet.pipeline.Pipeline; import com.hazelcast.jet.pipeline.Sinks; import com.hazelcast.jet.pipeline.Sources; +import java.util.List; +import java.util.Map; + +import static com.hazelcast.function.Functions.wholeItem; +import static com.hazelcast.jet.Traversers.traverseArray; +import static com.hazelcast.jet.aggregate.AggregateOperations.counting; + public class WordCounter { private static final String LIST_NAME = "textList"; - private static final String MAP_NAME = "countMap"; private Pipeline createPipeLine() { Pipeline p = Pipeline.create(); - p.drawFrom(Sources. list(LIST_NAME)) - .flatMap(word -> traverseArray(word.toLowerCase() - .split("\\W+"))) + p.readFrom(Sources.list(LIST_NAME)) + .flatMap(word -> traverseArray(word.toLowerCase().split("\\W+"))) .filter(word -> !word.isEmpty()) .groupingKey(wholeItem()) .aggregate(counting()) - .drainTo(Sinks.map(MAP_NAME)); + .writeTo(Sinks.map(MAP_NAME)); return p; } @@ -38,8 +36,7 @@ public class WordCounter { List textList = jet.getList(LIST_NAME); textList.addAll(sentences); Pipeline p = createPipeLine(); - jet.newJob(p) - .join(); + jet.newJob(p).join(); Map counts = jet.getMap(MAP_NAME); count = counts.get(word); } finally { diff --git a/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java b/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java index 95596b3860..7a60cd9a01 100644 --- a/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java +++ b/hazelcast/src/test/java/com/baeldung/hazelcast/jet/WordCounterUnitTest.java @@ -1,11 +1,11 @@ package com.baeldung.hazelcast.jet; -import static org.junit.Assert.assertTrue; +import org.junit.Test; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import static org.junit.Assert.assertEquals; public class WordCounterUnitTest { @@ -15,7 +15,7 @@ public class WordCounterUnitTest { sentences.add("The first second was alright, but the second second was tough."); WordCounter wordCounter = new WordCounter(); long countSecond = wordCounter.countWord(sentences, "second"); - assertTrue(countSecond == 3); + assertEquals(3, countSecond); } } From 989acd5ed7859c29eb62aabae1255918707a587b Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Wed, 16 Sep 2020 10:11:58 +0200 Subject: [PATCH 0732/1862] JAVA-2599: Handle Windows specific exception in the ExistenceUnitTest --- .../baeldung/existence/ExistenceUnitTest.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/existence/ExistenceUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/existence/ExistenceUnitTest.java index c52e46e8c1..747ae85b65 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/existence/ExistenceUnitTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/existence/ExistenceUnitTest.java @@ -4,10 +4,7 @@ import org.junit.Test; import java.io.File; import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.LinkOption; -import java.nio.file.Path; -import java.nio.file.Paths; +import java.nio.file.*; import java.util.concurrent.ThreadLocalRandom; import static org.junit.Assert.assertFalse; @@ -47,8 +44,18 @@ public class ExistenceUnitTest { public void givenSymbolicLink_whenTargetDoesNotExists_thenFollowOrNotBasedOnTheOptions() throws IOException { Path target = Files.createTempFile("baeldung", "target"); Path symbol = Paths.get("test-link-" + ThreadLocalRandom.current().nextInt()); + Path symbolicLink = null; + + try { + symbolicLink = Files.createSymbolicLink(symbol, target); + } catch (FileSystemException ex) { + System.out.println("Your OS security policy prevents the current user from creating symbolic links.\n" + + "Most probably you're running Windows with UAC.\n" + + "If this is the case, please see - https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links\n" + + "You must change your security settings to run this test under Windows."); + return; + } - Path symbolicLink = Files.createSymbolicLink(symbol, target); assertTrue(Files.exists(symbolicLink)); assertTrue(Files.isSymbolicLink(symbolicLink)); assertFalse(Files.isSymbolicLink(target)); From 5cc62d43a36a1b484bd99871aebd5d833ee36090 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:40:09 +0800 Subject: [PATCH 0733/1862] Update README.md --- spring-cloud/spring-cloud-consul/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-cloud/spring-cloud-consul/README.md b/spring-cloud/spring-cloud-consul/README.md index 47dc39f0d5..e587572ffa 100644 --- a/spring-cloud/spring-cloud-consul/README.md +++ b/spring-cloud/spring-cloud-consul/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [A Quick Guide to Spring Cloud Consul](http://www.baeldung.com/spring-cloud-consul) +- [Leadership Election With Consul](https://www.baeldung.com/consul-leadership-election) From c30abba25f0e1c335c8bfe08aa7c5f9468e0316e Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:41:20 +0800 Subject: [PATCH 0734/1862] Update README.md --- spring-boot-modules/spring-boot-actuator/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-actuator/README.md b/spring-boot-modules/spring-boot-actuator/README.md index 6f31ee4a5e..3e8ef3411b 100644 --- a/spring-boot-modules/spring-boot-actuator/README.md +++ b/spring-boot-modules/spring-boot-actuator/README.md @@ -9,3 +9,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Liveness and Readiness Probes in Spring Boot](https://www.baeldung.com/spring-liveness-readiness-probes) - [Custom Information in Spring Boot Info Endpoint](https://www.baeldung.com/spring-boot-info-actuator-custom) +- [Health Indicators in Spring Boot](https://www.baeldung.com/spring-boot-health-indicators) From 9de2a7e7788418cc4824e6c71a69dde6747b9486 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:42:16 +0800 Subject: [PATCH 0735/1862] Update README.md --- spring-boot-modules/spring-boot-properties-3/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-properties-3/README.md b/spring-boot-modules/spring-boot-properties-3/README.md index d89f825c86..df272be7f4 100644 --- a/spring-boot-modules/spring-boot-properties-3/README.md +++ b/spring-boot-modules/spring-boot-properties-3/README.md @@ -6,4 +6,4 @@ ### Relevant Articles: - [How to Define a Map in YAML for a POJO?](https://www.baeldung.com/yaml-map-pojo) - +- [Using application.yml vs application.properties in Spring Boot](https://www.baeldung.com/spring-boot-yaml-vs-properties) From 29577bd7773b9a46ed1560c2c12d8f5bf65a2095 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:43:16 +0800 Subject: [PATCH 0736/1862] Update README.md --- core-java-modules/core-java-io-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md index 06a2a5a0fc..4b1a14ab3e 100644 --- a/core-java-modules/core-java-io-3/README.md +++ b/core-java-modules/core-java-io-3/README.md @@ -10,4 +10,5 @@ This module contains articles about core Java input and output (IO) - [Copy a Directory in Java](https://www.baeldung.com/java-copy-directory) - [Java Files Open Options](https://www.baeldung.com/java-file-options) - [Creating Temporary Directories in Java](https://www.baeldung.com/java-temp-directories) +- [Reading a Line at a Given Line Number From a File in Java](https://www.baeldung.com/java-read-line-at-number) - [[<-- Prev]](/core-java-modules/core-java-io-2) From 9c64b62ad6227f20286f5cfe15b26db0580a70c6 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:44:40 +0800 Subject: [PATCH 0737/1862] Update README.md --- spring-boot-modules/spring-boot-mvc-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-mvc-3/README.md b/spring-boot-modules/spring-boot-mvc-3/README.md index 0562224337..6627bd8eea 100644 --- a/spring-boot-modules/spring-boot-mvc-3/README.md +++ b/spring-boot-modules/spring-boot-mvc-3/README.md @@ -6,4 +6,5 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Circular View Path Error](https://www.baeldung.com/spring-circular-view-path-error) - [Download an Image or a File with Spring MVC](https://www.baeldung.com/spring-controller-return-image-file) +- [Spring MVC Async vs Spring WebFlux](https://www.baeldung.com/spring-mvc-async-vs-webflux) - More articles: [[prev -->]](/spring-boot-modules/spring-boot-mvc-2) From ee277ad5db39c020cdc6950068280a8babb94e3e Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:44:58 +0800 Subject: [PATCH 0738/1862] Update README.md --- spring-5-webflux/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-5-webflux/README.md b/spring-5-webflux/README.md index 55ab0b8af4..9f9a12f997 100644 --- a/spring-5-webflux/README.md +++ b/spring-5-webflux/README.md @@ -8,3 +8,4 @@ This module contains articles about Spring 5 WebFlux - [How to Return 404 with Spring WebFlux](https://www.baeldung.com/spring-webflux-404) - [Spring WebClient Requests with Parameters](https://www.baeldung.com/webflux-webclient-parameters) - [RSocket Using Spring Boot](https://www.baeldung.com/spring-boot-rsocket) +- [Spring MVC Async vs Spring WebFlux](https://www.baeldung.com/spring-mvc-async-vs-webflux) From 35fb40162c1f110d8d54c7e266e4ffb0f8beedba Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:46:47 +0800 Subject: [PATCH 0739/1862] Update README.md --- spring-rest-http-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-rest-http-2/README.md b/spring-rest-http-2/README.md index 74ec59e0b5..97cdc2d068 100644 --- a/spring-rest-http-2/README.md +++ b/spring-rest-http-2/README.md @@ -7,4 +7,4 @@ The "REST With Spring 2" Classes: http://bit.ly/restwithspring ### Relevant Articles: - +- [How to Turn Off Swagger-ui in Production](https://www.baeldung.com/swagger-ui-turn-off-in-production) From 647b0e9171155402037e7d07c5b5327224d5db31 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:47:55 +0800 Subject: [PATCH 0740/1862] Update README.md --- libraries-testing/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-testing/README.md b/libraries-testing/README.md index 43d7673e2d..447f3f32b9 100644 --- a/libraries-testing/README.md +++ b/libraries-testing/README.md @@ -12,3 +12,4 @@ This module contains articles about test libraries. - [Introduction to Hoverfly in Java](https://www.baeldung.com/hoverfly) - [Testing with Hamcrest](https://www.baeldung.com/java-junit-hamcrest-guide) - [Introduction To DBUnit](https://www.baeldung.com/java-dbunit) +- [Introduction to ArchUnit](https://www.baeldung.com/java-archunit-intro) From c79db10648fc596c485ec4abe62d0eb887967371 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:51:52 +0800 Subject: [PATCH 0741/1862] Update README.md --- core-java-modules/core-java-lang-math-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-math-2/README.md b/core-java-modules/core-java-lang-math-2/README.md index 09039f6ed0..69ee00b5a5 100644 --- a/core-java-modules/core-java-lang-math-2/README.md +++ b/core-java-modules/core-java-lang-math-2/README.md @@ -13,4 +13,5 @@ - [Convert Latitude and Longitude to a 2D Point in Java](https://www.baeldung.com/java-convert-latitude-longitude) - [Debugging with Eclipse](https://www.baeldung.com/eclipse-debugging) - [Matrix Multiplication in Java](https://www.baeldung.com/java-matrix-multiplication) +- [Largest Power of 2 That Is Less Than the Given Number](https://www.baeldung.com/java-largest-power-of-2-less-than-number) - More articles: [[<-- Prev]](/core-java-modules/core-java-lang-math) From c221c2fa0bdd2526e64e7773c5eac637909abccc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:52:52 +0800 Subject: [PATCH 0742/1862] Update README.md --- core-java-modules/core-java-exceptions-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-exceptions-3/README.md b/core-java-modules/core-java-exceptions-3/README.md index e6c7eda881..1b2db24bdc 100644 --- a/core-java-modules/core-java-exceptions-3/README.md +++ b/core-java-modules/core-java-exceptions-3/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [NoSuchMethodError in Java](https://www.baeldung.com/java-nosuchmethod-error) +- [IllegalArgumentException or NullPointerException for a Null Parameter?](https://www.baeldung.com/java-illegalargumentexception-or-nullpointerexception) From ede8e77f7ab04f42ee0dec9c5e6a873615141967 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:53:49 +0800 Subject: [PATCH 0743/1862] Update README.md --- quarkus/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/quarkus/README.md b/quarkus/README.md index 3ff08c6f9e..94b71dd954 100644 --- a/quarkus/README.md +++ b/quarkus/README.md @@ -1,3 +1,4 @@ ## Relevant Articles: - [Guide to QuarkusIO](https://www.baeldung.com/quarkus-io) +- [Testing Quarkus Applications](https://www.baeldung.com/java-quarkus-testing) From a6f195dab69b21df2b5e131978811f131c178430 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:55:08 +0800 Subject: [PATCH 0744/1862] Create README.md --- gradle-5/source-sets/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 gradle-5/source-sets/README.md diff --git a/gradle-5/source-sets/README.md b/gradle-5/source-sets/README.md new file mode 100644 index 0000000000..19fe1e1fae --- /dev/null +++ b/gradle-5/source-sets/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Gradle Source Sets](https://www.baeldung.com/gradle-source-sets) From 258f1be8ac1028d3d9c76530e3ca894ad1dcc0e8 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:56:33 +0800 Subject: [PATCH 0745/1862] Update README.md --- core-java-modules/core-java-arrays-guides/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-arrays-guides/README.md b/core-java-modules/core-java-arrays-guides/README.md index 621443e4a9..934833b31b 100644 --- a/core-java-modules/core-java-arrays-guides/README.md +++ b/core-java-modules/core-java-arrays-guides/README.md @@ -6,3 +6,4 @@ This module contains complete guides about arrays in Java - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) - [Guide to the java.util.Arrays Class](https://www.baeldung.com/java-util-arrays) - [What is \[Ljava.lang.Object;?](https://www.baeldung.com/java-tostring-array) +- [Guide to ArrayStoreException](https://www.baeldung.com/java-arraystoreexception) From 1d9cf597d8bbf31bc11f6fda449b3bc410e60414 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:57:59 +0800 Subject: [PATCH 0746/1862] Update README.md --- testing-modules/testing-assertions/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/testing-assertions/README.md b/testing-modules/testing-assertions/README.md index 08e2e66062..ea238af599 100644 --- a/testing-modules/testing-assertions/README.md +++ b/testing-modules/testing-assertions/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Asserting Log Messages With JUnit](https://www.baeldung.com/junit-asserting-logs) +- [Assert Two Lists for Equality Ignoring Order in Java](https://www.baeldung.com/java-assert-lists-equality-ignore-order) From d04fadfb9bc2bcadaa1a96b2a932f6b5ae5cd95a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 22:59:27 +0800 Subject: [PATCH 0747/1862] Update README.md --- spring-boot-modules/spring-boot-autoconfiguration/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-autoconfiguration/README.md b/spring-boot-modules/spring-boot-autoconfiguration/README.md index d1b5fde7ed..881c88467b 100644 --- a/spring-boot-modules/spring-boot-autoconfiguration/README.md +++ b/spring-boot-modules/spring-boot-autoconfiguration/README.md @@ -10,4 +10,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Create a Custom Auto-Configuration with Spring Boot](https://www.baeldung.com/spring-boot-custom-auto-configuration) - [Guide to ApplicationContextRunner in Spring Boot](https://www.baeldung.com/spring-boot-context-runner) - [A Guide to Spring Boot Configuration Metadata](https://www.baeldung.com/spring-boot-configuration-metadata) -- [Display Auto-Configuration Report in Spring Boot](https://www.baeldung.com/spring-boot-auto-configuration-report) \ No newline at end of file +- [Display Auto-Configuration Report in Spring Boot](https://www.baeldung.com/spring-boot-auto-configuration-report) +- [The Spring @ConditionalOnProperty Annotation](https://www.baeldung.com/spring-conditionalonproperty) From f9cd2c38078c720a8229d7a9b2b22ae61b18fc33 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:01:10 +0800 Subject: [PATCH 0748/1862] Update README.md --- testing-modules/spring-testing-2/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testing-modules/spring-testing-2/README.md b/testing-modules/spring-testing-2/README.md index 729105e3fd..702a02ff27 100644 --- a/testing-modules/spring-testing-2/README.md +++ b/testing-modules/spring-testing-2/README.md @@ -1 +1,3 @@ ## Relevant Articles: + +- [Guide to @DynamicPropertySource in Spring](https://www.baeldung.com/spring-dynamicpropertysource) From 459dc06432a68423cb2f9685110c0864180095f0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:34:14 +0800 Subject: [PATCH 0749/1862] Update README.md --- spring-thymeleaf-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-thymeleaf-3/README.md b/spring-thymeleaf-3/README.md index 34bd1b4b35..8bb8861daf 100644 --- a/spring-thymeleaf-3/README.md +++ b/spring-thymeleaf-3/README.md @@ -8,3 +8,4 @@ This module contains articles about Spring with Thymeleaf - [Formatting Currencies in Spring Using Thymeleaf](https://www.baeldung.com/spring-thymeleaf-currencies) - [Working with Select and Option in Thymeleaf](https://www.baeldung.com/thymeleaf-select-option) - [Conditional CSS Classes in Thymeleaf](https://www.baeldung.com/spring-mvc-thymeleaf-conditional-css-classes) +- [Using Hidden Inputs with Spring and Thymeleaf](https://www.baeldung.com/spring-thymeleaf-hidden-inputs) From b7ec39842bd155d4c1f94b9111e1050b94387981 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:37:50 +0800 Subject: [PATCH 0750/1862] Create README.md --- spring-boot-modules/spring-boot-swagger/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-boot-modules/spring-boot-swagger/README.md diff --git a/spring-boot-modules/spring-boot-swagger/README.md b/spring-boot-modules/spring-boot-swagger/README.md new file mode 100644 index 0000000000..1038031210 --- /dev/null +++ b/spring-boot-modules/spring-boot-swagger/README.md @@ -0,0 +1,3 @@ +## Relevant Articles: + +- [Hiding Endpoints From Swagger Documentation in Spring Boot](https://www.baeldung.com/spring-swagger-hiding-endpoints) From 35c25daa18843cd16a81bcc9c3282408fb6db419 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:39:49 +0800 Subject: [PATCH 0751/1862] Update README.md --- spring-boot-modules/spring-boot-keycloak/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-keycloak/README.md b/spring-boot-modules/spring-boot-keycloak/README.md index 2dfe3fc331..74fbbb6f09 100644 --- a/spring-boot-modules/spring-boot-keycloak/README.md +++ b/spring-boot-modules/spring-boot-keycloak/README.md @@ -4,3 +4,4 @@ This module contains articles about Keycloak in Spring Boot projects. ## Relevant articles: - [A Quick Guide to Using Keycloak with Spring Boot](https://www.baeldung.com/spring-boot-keycloak) +- [Custom User Attributes with Keycloak](https://www.baeldung.com/keycloak-custom-user-attributes) From 5c0391cf68d07994ed35d86441e9de893c6e7ddb Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:42:36 +0800 Subject: [PATCH 0752/1862] Update README.md --- core-java-modules/core-java-exceptions-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-exceptions-3/README.md b/core-java-modules/core-java-exceptions-3/README.md index 1b2db24bdc..4e3dd22bb8 100644 --- a/core-java-modules/core-java-exceptions-3/README.md +++ b/core-java-modules/core-java-exceptions-3/README.md @@ -2,3 +2,4 @@ - [NoSuchMethodError in Java](https://www.baeldung.com/java-nosuchmethod-error) - [IllegalArgumentException or NullPointerException for a Null Parameter?](https://www.baeldung.com/java-illegalargumentexception-or-nullpointerexception) +- [IllegalMonitorStateException in Java](https://www.baeldung.com/java-illegalmonitorstateexception) From 4d84d35754ae4d9e30911fd0ceb8e06f81310863 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:44:29 +0800 Subject: [PATCH 0753/1862] Update README.md --- spring-rest-http/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-rest-http/README.md b/spring-rest-http/README.md index bb4cfd829d..2271858f0a 100644 --- a/spring-rest-http/README.md +++ b/spring-rest-http/README.md @@ -14,3 +14,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Guide to DeferredResult in Spring](https://www.baeldung.com/spring-deferred-result) - [Using JSON Patch in Spring REST APIs](https://www.baeldung.com/spring-rest-json-patch) - [OpenAPI JSON Objects as Query Parameters](https://www.baeldung.com/openapi-json-query-parameters) +- [Dates in OpenAPI Files](https://www.baeldung.com/openapi-dates) From 1cf9a48f688f4f13f0a38b2708896a0754329c1c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:45:40 +0800 Subject: [PATCH 0754/1862] Update README.MD --- persistence-modules/flyway/README.MD | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/flyway/README.MD b/persistence-modules/flyway/README.MD index daeb9012b5..bd5f9bbe03 100644 --- a/persistence-modules/flyway/README.MD +++ b/persistence-modules/flyway/README.MD @@ -1,3 +1,4 @@ ### Relevant Articles: - [Database Migrations with Flyway](http://www.baeldung.com/database-migrations-with-flyway) - [A Guide to Flyway Callbacks](http://www.baeldung.com/flyway-callbacks) +- [Rolling Back Migrations with Flyway](https://www.baeldung.com/flyway-roll-back) From ce9e9a605e453609a9d6db9447d7335b6d9026b1 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:47:15 +0800 Subject: [PATCH 0755/1862] Update README.md --- libraries-security/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-security/README.md b/libraries-security/README.md index 5ec85a15e9..1a0e16a776 100644 --- a/libraries-security/README.md +++ b/libraries-security/README.md @@ -11,3 +11,4 @@ This module contains articles about security libraries. - [Intro to Jasypt](https://www.baeldung.com/jasypt) - [Digital Signatures in Java](https://www.baeldung.com/java-digital-signature) - [How to Read PEM File to Get Public and Private Keys](https://www.baeldung.com/java-read-pem-file-keys) +- [SSH Connection With Java](https://www.baeldung.com/java-ssh-connection) From 5ae7a913cf4c9879a5ce8ba9b1f112c2f029da34 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:48:50 +0800 Subject: [PATCH 0756/1862] Update README.md --- testing-modules/mockito-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md index 9ca5a38e2e..c7b62182b5 100644 --- a/testing-modules/mockito-2/README.md +++ b/testing-modules/mockito-2/README.md @@ -8,3 +8,4 @@ - [Introduction to Mockito’s AdditionalAnswers](https://www.baeldung.com/mockito-additionalanswers) - [Mockito – Using Spies](https://www.baeldung.com/mockito-spy) - [Using Mockito ArgumentCaptor](https://www.baeldung.com/mockito-argumentcaptor) +- [Difference Between when() and doXxx() Methods in Mockito](https://www.baeldung.com/java-mockito-when-vs-do) From fce5fac0c44524d321b4bb8d37c74fb1b32762ae Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:50:34 +0800 Subject: [PATCH 0757/1862] Update README.md --- patterns/design-patterns-architectural/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/patterns/design-patterns-architectural/README.md b/patterns/design-patterns-architectural/README.md index fbe4221752..5b6011c159 100644 --- a/patterns/design-patterns-architectural/README.md +++ b/patterns/design-patterns-architectural/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Service Locator Pattern](https://www.baeldung.com/java-service-locator-pattern) - [The DAO Pattern in Java](https://www.baeldung.com/java-dao-pattern) +- [DAO vs Repository Patterns](https://www.baeldung.com/java-dao-vs-repository) From d5ada37cc7d1c04175fe4e5ce8489186ed79b2c3 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:54:01 +0800 Subject: [PATCH 0758/1862] Update README.md --- aws-lambda/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/aws-lambda/README.md b/aws-lambda/README.md index 2fbdaace10..759c9dd506 100644 --- a/aws-lambda/README.md +++ b/aws-lambda/README.md @@ -5,3 +5,4 @@ This module contains articles about AWS Lambda ### Relevant Articles: - [Using AWS Lambda with API Gateway](https://www.baeldung.com/aws-lambda-api-gateway) - [Introduction to AWS Serverless Application Model](https://www.baeldung.com/aws-serverless) +- [How to Implement Hibernate in an AWS Lambda Function in Java](https://www.baeldung.com/java-aws-lambda-hibernate) From d30ba2c8f04284063ddec1e74b75b6c84d091d3e Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:55:27 +0800 Subject: [PATCH 0759/1862] Create README.md --- gradle-5/cmd-line-args/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 gradle-5/cmd-line-args/README.md diff --git a/gradle-5/cmd-line-args/README.md b/gradle-5/cmd-line-args/README.md new file mode 100644 index 0000000000..de797c8588 --- /dev/null +++ b/gradle-5/cmd-line-args/README.md @@ -0,0 +1,3 @@ +## Relevant Articles: + +- [Passing Command Line Arguments in Gradle](https://www.baeldung.com/gradle-command-line-arguments) From a61f3c9b54907b8024d5f837179d951306699181 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 16 Sep 2020 23:56:46 +0800 Subject: [PATCH 0760/1862] Update README.md --- core-java-modules/core-java-lang-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-3/README.md b/core-java-modules/core-java-lang-3/README.md index 0fa08ef397..121d30f20f 100644 --- a/core-java-modules/core-java-lang-3/README.md +++ b/core-java-modules/core-java-lang-3/README.md @@ -5,4 +5,5 @@ This module contains articles about core features in the Java language - [Class.isInstance vs Class.isAssignableFrom](https://www.baeldung.com/java-isinstance-isassignablefrom) - [Converting a Java String Into a Boolean](https://www.baeldung.com/java-string-to-boolean) - [When are Static Variables Initialized in Java?](https://www.baeldung.com/java-static-variables-initialization) +- [Checking if a Class Exists in Java](https://www.baeldung.com/java-check-class-exists) - [[<-- Prev]](/core-java-modules/core-java-lang-2) From 2cc967c01c535e59b42cf7f939fa2eed7bab878f Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 17 Sep 2020 00:09:56 +0800 Subject: [PATCH 0761/1862] Update README.md --- core-kotlin-modules/core-kotlin-collections-2/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-kotlin-modules/core-kotlin-collections-2/README.md b/core-kotlin-modules/core-kotlin-collections-2/README.md index 2dc180b5b3..64062ee704 100644 --- a/core-kotlin-modules/core-kotlin-collections-2/README.md +++ b/core-kotlin-modules/core-kotlin-collections-2/README.md @@ -2,6 +2,6 @@ This module contains articles about core Kotlin collections. -### Relevant articles: - +## Relevant articles: +- [Aggregate Operations in Kotlin](https://www.baeldung.com/kotlin/aggregate-operations) From c6f067c17f2351f845dab5bb9f83bcb6f1bf039b Mon Sep 17 00:00:00 2001 From: Vishal Date: Sun, 13 Sep 2020 23:05:36 +0530 Subject: [PATCH 0762/1862] Add examples to demo IndexOutOfBoundsException while using Collectins.copy method and other working demos to copy elements from one list to another list --- .../CopyListUsingAddAllMethodDemo.java | 24 +++++++++++++++++ ...opyListUsingCollectionsCopyMethodDemo.java | 21 +++++++++++++++ .../CopyListUsingConstructorDemo.java | 21 +++++++++++++++ .../com/baeldung/CopyListUsingJava10Demo.java | 18 +++++++++++++ .../CopyListUsingJava8StreamDemo.java | 22 +++++++++++++++ .../exception/IndexOutOfBoundsException.java | 27 +++++++++++++++++++ 6 files changed, 133 insertions(+) create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingAddAllMethodDemo.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingCollectionsCopyMethodDemo.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingConstructorDemo.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingJava10Demo.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingJava8StreamDemo.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/IndexOutOfBoundsException.java diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingAddAllMethodDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingAddAllMethodDemo.java new file mode 100644 index 0000000000..a7d24cdec8 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingAddAllMethodDemo.java @@ -0,0 +1,24 @@ +package com.baeldung; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class CopyListUsingAddAllMethodDemo { + + static List copyList(List source) { + List destination = new ArrayList<>(); + + destination.addAll(source); + + return destination; + } + + public static void main(String[] args) { + List source = Arrays.asList(11, 22, 33); + + List destination = copyList(source); + + System.out.println("copy = " + destination); + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingCollectionsCopyMethodDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingCollectionsCopyMethodDemo.java new file mode 100644 index 0000000000..bdf6726924 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingCollectionsCopyMethodDemo.java @@ -0,0 +1,21 @@ +package com.baeldung; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class CopyListUsingCollectionsCopyMethodDemo { + + static void copyList(List source, List destination) { + Collections.copy(destination, source); + } + + public static void main(String[] args) { + List source = Arrays.asList(11, 22, 33); + List destination = Arrays.asList(1, 2, 3, 4, 5); + + copyList(source, destination); + + System.out.println("copy = " + destination); + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingConstructorDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingConstructorDemo.java new file mode 100644 index 0000000000..b76a1448d4 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingConstructorDemo.java @@ -0,0 +1,21 @@ +package com.baeldung; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class CopyListUsingConstructorDemo { + + static List copyList(List source) { + + return new ArrayList<>(source); + } + + public static void main(String[] args) { + List source = Arrays.asList(11, 22, 33); + + List destination = copyList(source); + + System.out.println("copy = " + destination); + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingJava10Demo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingJava10Demo.java new file mode 100644 index 0000000000..1a32dcec4f --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingJava10Demo.java @@ -0,0 +1,18 @@ +package com.baeldung; + +import java.util.Arrays; +import java.util.List; + +public class CopyListUsingJava10Demo { + static List copyList(List source) { + return List.copyOf(source); + } + + public static void main(String[] args) { + List source = Arrays.asList(11, 22, 33); + + List destination = copyList(source); + + System.out.println("copy = " + destination); + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingJava8StreamDemo.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingJava8StreamDemo.java new file mode 100644 index 0000000000..81ae533505 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/CopyListUsingJava8StreamDemo.java @@ -0,0 +1,22 @@ +package com.baeldung; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +public class CopyListUsingJava8StreamDemo { + + static List copyList(List source) { + return source + .stream() + .collect(Collectors.toList()); + } + + public static void main(String[] args) { + List source = Arrays.asList(11, 22, 33); + + List destination = copyList(source); + + System.out.println("copy = " + destination); + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/IndexOutOfBoundsException.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/IndexOutOfBoundsException.java new file mode 100644 index 0000000000..a1b6bf1151 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exception/IndexOutOfBoundsException.java @@ -0,0 +1,27 @@ +package com.baeldung.exception; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * This example produces an IndexOutOfBoundsException, when we try to copy a list using the Collections.copy method. + * As the destination list doesn't have enough space/size to copy elements from source list. + */ +public class IndexOutOfBoundsException { + + static List copyList(List source) { + List destination = new ArrayList<>(source.size()); + Collections.copy(destination, source); + return destination; + } + + public static void main(String[] args) { + List source = Arrays.asList(1, 2, 3, 4, 5); + List copy = copyList(source); + + System.out.println("copy = " + copy); + } + +} From 8928164d224ca352b6db2a87e5bc092d9d86a62f Mon Sep 17 00:00:00 2001 From: kwoyke Date: Wed, 16 Sep 2020 20:53:28 +0200 Subject: [PATCH 0763/1862] BAEL-4595: Update hazelcast.xml config file (#10039) * BAEL-4595: Upgrade to hazelcast-jet 4.2 * BAEL-4595: Update hazelcast.xml config file --- hazelcast/src/main/resources/hazelcast.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hazelcast/src/main/resources/hazelcast.xml b/hazelcast/src/main/resources/hazelcast.xml index f29dc532b8..889e65801b 100644 --- a/hazelcast/src/main/resources/hazelcast.xml +++ b/hazelcast/src/main/resources/hazelcast.xml @@ -1,16 +1,16 @@ - + 5701 - - - - machine1 - localhost - + + + machine1 + localhost + \ No newline at end of file From 4ce6b34c063d33a52ec7695c2d9e321403b24833 Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Fri, 11 Sep 2020 01:08:12 +0200 Subject: [PATCH 0764/1862] [BAEL-4583] Improvement- Java Period --- .../com/baeldung/date/DateDiffUnitTest.java | 63 +++++++++++++------ 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/date/DateDiffUnitTest.java b/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/date/DateDiffUnitTest.java index 226556d4bb..9a0779ccac 100644 --- a/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/date/DateDiffUnitTest.java +++ b/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/date/DateDiffUnitTest.java @@ -1,6 +1,8 @@ package com.baeldung.date; -import static org.junit.Assert.assertEquals; +import org.joda.time.Days; +import org.joda.time.Minutes; +import org.junit.Test; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -16,7 +18,7 @@ import java.util.Locale; import java.util.TimeZone; import java.util.concurrent.TimeUnit; -import org.junit.Test; +import static org.junit.Assert.*; public class DateDiffUnitTest { @@ -29,18 +31,39 @@ public class DateDiffUnitTest { long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); - assertEquals(diff, 6); + assertEquals(6, diff); } @Test - public void givenTwoDatesInJava8_whenDifferentiating_thenWeGetSix() { - LocalDate now = LocalDate.now(); - LocalDate sixDaysBehind = now.minusDays(6); + public void givenTwoDatesInJava8_whenUsingPeriodGetDays_thenWorks() { + LocalDate aDate = LocalDate.of(2020, 9, 11); + LocalDate sixDaysBehind = aDate.minusDays(6); - Period period = Period.between(now, sixDaysBehind); + Period period = Period.between(aDate, sixDaysBehind); int diff = Math.abs(period.getDays()); - assertEquals(diff, 6); + assertEquals(6, diff); + } + + @Test + public void givenTwoDatesInJava8_whenUsingPeriodGetDays_thenDoesNotWork() { + LocalDate aDate = LocalDate.of(2020, 9, 11); + LocalDate sixtyDaysBehind = aDate.minusDays(60); + Period period = Period.between(aDate, sixtyDaysBehind); + int diff = Math.abs(period.getDays()); + //not equals + assertNotEquals(60, diff); + } + + @Test + public void givenTwoDatesInJava8_whenUsingPeriod_thenWeGet0Year1Month29Days() { + LocalDate aDate = LocalDate.of(2020, 9, 11); + LocalDate sixtyDaysBehind = aDate.minusDays(60); + Period period = Period.between(aDate, sixtyDaysBehind); + int years = Math.abs(period.getYears()); + int months = Math.abs(period.getMonths()); + int days = Math.abs(period.getDays()); + assertArrayEquals(new int[] { 0, 1, 29 }, new int[] { years, months, days }); } @Test @@ -51,7 +74,7 @@ public class DateDiffUnitTest { Duration duration = Duration.between(now, sixMinutesBehind); long diff = Math.abs(duration.toMinutes()); - assertEquals(diff, 6); + assertEquals(6, diff); } @Test @@ -61,7 +84,7 @@ public class DateDiffUnitTest { long diff = ChronoUnit.SECONDS.between(now, tenSecondsLater); - assertEquals(diff, 10); + assertEquals(10, diff); } @Test @@ -69,9 +92,9 @@ public class DateDiffUnitTest { LocalDateTime ldt = LocalDateTime.now(); ZonedDateTime now = ldt.atZone(ZoneId.of("America/Montreal")); ZonedDateTime sixDaysBehind = now.withZoneSameInstant(ZoneId.of("Asia/Singapore")) - .minusDays(6); + .minusDays(6); long diff = ChronoUnit.DAYS.between(sixDaysBehind, now); - assertEquals(diff, 6); + assertEquals(6, diff); } @Test @@ -81,7 +104,7 @@ public class DateDiffUnitTest { long diff = now.until(tenSecondsLater, ChronoUnit.SECONDS); - assertEquals(diff, 10); + assertEquals(10, diff); } @Test @@ -89,10 +112,9 @@ public class DateDiffUnitTest { org.joda.time.LocalDate now = org.joda.time.LocalDate.now(); org.joda.time.LocalDate sixDaysBehind = now.minusDays(6); - org.joda.time.Period period = new org.joda.time.Period(now, sixDaysBehind); - long diff = Math.abs(period.getDays()); + long diff = Math.abs(Days.daysBetween(now, sixDaysBehind).getDays()); - assertEquals(diff, 6); + assertEquals(6, diff); } @Test @@ -100,8 +122,9 @@ public class DateDiffUnitTest { org.joda.time.LocalDateTime now = org.joda.time.LocalDateTime.now(); org.joda.time.LocalDateTime sixMinutesBehind = now.minusMinutes(6); - org.joda.time.Period period = new org.joda.time.Period(now, sixMinutesBehind); - long diff = Math.abs(period.getDays()); + long diff = Math.abs(Minutes.minutesBetween(now, sixMinutesBehind).getMinutes()); + assertEquals(6, diff); + } @Test @@ -111,6 +134,6 @@ public class DateDiffUnitTest { long diff = Math.abs(now.numDaysFrom(sixDaysBehind)); - assertEquals(diff, 6); + assertEquals(6, diff); } -} \ No newline at end of file +} From 1509fa5ddc5b26a9148ec3a7476c2ebee2b353db Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Wed, 16 Sep 2020 22:20:32 +0200 Subject: [PATCH 0765/1862] JAVA-2904: Fix README.MD files extension --- core-java-modules/core-java-reflection/{README.MD => README.md} | 0 core-java-modules/pre-jpms/{README.MD => README.md} | 0 drools/{README.MD => README.md} | 0 libraries-primitive/{README.MD => README.md} | 0 persistence-modules/flyway-repair/{README.MD => README.md} | 0 persistence-modules/flyway/{README.MD => README.md} | 0 .../spring-boot-persistence/{README.MD => README.md} | 0 persistence-modules/spring-data-dynamodb/{README.MD => README.md} | 0 raml/{README.MD => README.md} | 0 spring-boot-modules/spring-boot-client/{README.MD => README.md} | 0 .../spring-boot-exceptions/{README.MD => README.md} | 0 spring-cloud-data-flow/apache-spark-job/{README.MD => README.md} | 0 spring-cloud-data-flow/batch-job/{README.MD => README.md} | 0 .../spring-cloud-data-flow-etl/{README.MD => README.md} | 0 .../{README.MD => README.md} | 0 spring-cloud/spring-cloud-functions/{README.MD => README.md} | 0 spring-cloud/spring-cloud-hystrix/{README.MD => README.md} | 0 17 files changed, 0 insertions(+), 0 deletions(-) rename core-java-modules/core-java-reflection/{README.MD => README.md} (100%) rename core-java-modules/pre-jpms/{README.MD => README.md} (100%) rename drools/{README.MD => README.md} (100%) rename libraries-primitive/{README.MD => README.md} (100%) rename persistence-modules/flyway-repair/{README.MD => README.md} (100%) rename persistence-modules/flyway/{README.MD => README.md} (100%) rename persistence-modules/spring-boot-persistence/{README.MD => README.md} (100%) rename persistence-modules/spring-data-dynamodb/{README.MD => README.md} (100%) rename raml/{README.MD => README.md} (100%) rename spring-boot-modules/spring-boot-client/{README.MD => README.md} (100%) rename spring-boot-modules/spring-boot-exceptions/{README.MD => README.md} (100%) rename spring-cloud-data-flow/apache-spark-job/{README.MD => README.md} (100%) rename spring-cloud-data-flow/batch-job/{README.MD => README.md} (100%) rename spring-cloud-data-flow/spring-cloud-data-flow-etl/{README.MD => README.md} (100%) rename spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/{README.MD => README.md} (100%) rename spring-cloud/spring-cloud-functions/{README.MD => README.md} (100%) rename spring-cloud/spring-cloud-hystrix/{README.MD => README.md} (100%) diff --git a/core-java-modules/core-java-reflection/README.MD b/core-java-modules/core-java-reflection/README.md similarity index 100% rename from core-java-modules/core-java-reflection/README.MD rename to core-java-modules/core-java-reflection/README.md diff --git a/core-java-modules/pre-jpms/README.MD b/core-java-modules/pre-jpms/README.md similarity index 100% rename from core-java-modules/pre-jpms/README.MD rename to core-java-modules/pre-jpms/README.md diff --git a/drools/README.MD b/drools/README.md similarity index 100% rename from drools/README.MD rename to drools/README.md diff --git a/libraries-primitive/README.MD b/libraries-primitive/README.md similarity index 100% rename from libraries-primitive/README.MD rename to libraries-primitive/README.md diff --git a/persistence-modules/flyway-repair/README.MD b/persistence-modules/flyway-repair/README.md similarity index 100% rename from persistence-modules/flyway-repair/README.MD rename to persistence-modules/flyway-repair/README.md diff --git a/persistence-modules/flyway/README.MD b/persistence-modules/flyway/README.md similarity index 100% rename from persistence-modules/flyway/README.MD rename to persistence-modules/flyway/README.md diff --git a/persistence-modules/spring-boot-persistence/README.MD b/persistence-modules/spring-boot-persistence/README.md similarity index 100% rename from persistence-modules/spring-boot-persistence/README.MD rename to persistence-modules/spring-boot-persistence/README.md diff --git a/persistence-modules/spring-data-dynamodb/README.MD b/persistence-modules/spring-data-dynamodb/README.md similarity index 100% rename from persistence-modules/spring-data-dynamodb/README.MD rename to persistence-modules/spring-data-dynamodb/README.md diff --git a/raml/README.MD b/raml/README.md similarity index 100% rename from raml/README.MD rename to raml/README.md diff --git a/spring-boot-modules/spring-boot-client/README.MD b/spring-boot-modules/spring-boot-client/README.md similarity index 100% rename from spring-boot-modules/spring-boot-client/README.MD rename to spring-boot-modules/spring-boot-client/README.md diff --git a/spring-boot-modules/spring-boot-exceptions/README.MD b/spring-boot-modules/spring-boot-exceptions/README.md similarity index 100% rename from spring-boot-modules/spring-boot-exceptions/README.MD rename to spring-boot-modules/spring-boot-exceptions/README.md diff --git a/spring-cloud-data-flow/apache-spark-job/README.MD b/spring-cloud-data-flow/apache-spark-job/README.md similarity index 100% rename from spring-cloud-data-flow/apache-spark-job/README.MD rename to spring-cloud-data-flow/apache-spark-job/README.md diff --git a/spring-cloud-data-flow/batch-job/README.MD b/spring-cloud-data-flow/batch-job/README.md similarity index 100% rename from spring-cloud-data-flow/batch-job/README.MD rename to spring-cloud-data-flow/batch-job/README.md diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-etl/README.MD b/spring-cloud-data-flow/spring-cloud-data-flow-etl/README.md similarity index 100% rename from spring-cloud-data-flow/spring-cloud-data-flow-etl/README.MD rename to spring-cloud-data-flow/spring-cloud-data-flow-etl/README.md diff --git a/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/README.MD b/spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/README.md similarity index 100% rename from spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/README.MD rename to spring-cloud-data-flow/spring-cloud-data-flow-stream-processing/README.md diff --git a/spring-cloud/spring-cloud-functions/README.MD b/spring-cloud/spring-cloud-functions/README.md similarity index 100% rename from spring-cloud/spring-cloud-functions/README.MD rename to spring-cloud/spring-cloud-functions/README.md diff --git a/spring-cloud/spring-cloud-hystrix/README.MD b/spring-cloud/spring-cloud-hystrix/README.md similarity index 100% rename from spring-cloud/spring-cloud-hystrix/README.MD rename to spring-cloud/spring-cloud-hystrix/README.md From 60b28c767bde255195c10c779259b1527a4c6d33 Mon Sep 17 00:00:00 2001 From: nguyennamthai Date: Thu, 17 Sep 2020 09:24:28 +0700 Subject: [PATCH 0766/1862] BAEL-3569: Jersey RESTful Web Services with Spring Security OAuth2 (#9949) * BAEL-3569 Jersey REST service with Spring Security OAuth * BAEL-3569 Fix indentation spaces --- spring-5-security-oauth/pom.xml | 6 +- .../baeldung/jersey/JerseyApplication.java | 13 ++++ .../com/baeldung/jersey/JerseyResource.java | 30 ++++++++ .../java/com/baeldung/jersey/RestConfig.java | 11 +++ .../com/baeldung/jersey/SecurityConfig.java | 21 ++++++ .../resources/jersey-application.properties | 3 + .../jersey/JerseyResourceUnitTest.java | 72 +++++++++++++++++++ 7 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/jersey/JerseyApplication.java create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/jersey/JerseyResource.java create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/jersey/RestConfig.java create mode 100644 spring-5-security-oauth/src/main/java/com/baeldung/jersey/SecurityConfig.java create mode 100644 spring-5-security-oauth/src/main/resources/jersey-application.properties create mode 100644 spring-5-security-oauth/src/test/java/com/baeldung/jersey/JerseyResourceUnitTest.java diff --git a/spring-5-security-oauth/pom.xml b/spring-5-security-oauth/pom.xml index 325aacea86..19aaa576c8 100644 --- a/spring-5-security-oauth/pom.xml +++ b/spring-5-security-oauth/pom.xml @@ -32,6 +32,10 @@ org.thymeleaf.extras thymeleaf-extras-springsecurity5 + + org.springframework.boot + spring-boot-starter-jersey + @@ -63,7 +67,7 @@ test - + com.baeldung.oauth2.SpringOAuthApplication diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/jersey/JerseyApplication.java b/spring-5-security-oauth/src/main/java/com/baeldung/jersey/JerseyApplication.java new file mode 100644 index 0000000000..6388c10bb3 --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/jersey/JerseyApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.jersey; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; + +@SpringBootApplication +@PropertySource("classpath:jersey-application.properties") +public class JerseyApplication { + public static void main(String[] args) { + SpringApplication.run(JerseyApplication.class, args); + } +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/jersey/JerseyResource.java b/spring-5-security-oauth/src/main/java/com/baeldung/jersey/JerseyResource.java new file mode 100644 index 0000000000..8968fefbf4 --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/jersey/JerseyResource.java @@ -0,0 +1,30 @@ +package com.baeldung.jersey; + +import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken; +import org.springframework.security.oauth2.core.OAuth2AuthenticatedPrincipal; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.SecurityContext; + +@Path("/") +public class JerseyResource { + @GET + @Path("login") + @Produces(MediaType.TEXT_HTML) + public String login() { + return "Log in with GitHub"; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String home(@Context SecurityContext securityContext) { + OAuth2AuthenticationToken authenticationToken = (OAuth2AuthenticationToken) securityContext.getUserPrincipal(); + OAuth2AuthenticatedPrincipal authenticatedPrincipal = authenticationToken.getPrincipal(); + String userName = authenticatedPrincipal.getAttribute("login"); + return "Hello " + userName; + } +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/jersey/RestConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/jersey/RestConfig.java new file mode 100644 index 0000000000..306677f261 --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/jersey/RestConfig.java @@ -0,0 +1,11 @@ +package com.baeldung.jersey; + +import org.glassfish.jersey.server.ResourceConfig; +import org.springframework.stereotype.Component; + +@Component +public class RestConfig extends ResourceConfig { + public RestConfig() { + register(JerseyResource.class); + } +} diff --git a/spring-5-security-oauth/src/main/java/com/baeldung/jersey/SecurityConfig.java b/spring-5-security-oauth/src/main/java/com/baeldung/jersey/SecurityConfig.java new file mode 100644 index 0000000000..5644856695 --- /dev/null +++ b/spring-5-security-oauth/src/main/java/com/baeldung/jersey/SecurityConfig.java @@ -0,0 +1,21 @@ +package com.baeldung.jersey; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +public class SecurityConfig extends WebSecurityConfigurerAdapter { + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .authorizeRequests() + .antMatchers("/login") + .permitAll() + .anyRequest() + .authenticated() + .and() + .oauth2Login() + .loginPage("/login"); + } +} diff --git a/spring-5-security-oauth/src/main/resources/jersey-application.properties b/spring-5-security-oauth/src/main/resources/jersey-application.properties new file mode 100644 index 0000000000..516b24eb67 --- /dev/null +++ b/spring-5-security-oauth/src/main/resources/jersey-application.properties @@ -0,0 +1,3 @@ +server.port=8083 +spring.security.oauth2.client.registration.github.client-id= +spring.security.oauth2.client.registration.github.client-secret= \ No newline at end of file diff --git a/spring-5-security-oauth/src/test/java/com/baeldung/jersey/JerseyResourceUnitTest.java b/spring-5-security-oauth/src/test/java/com/baeldung/jersey/JerseyResourceUnitTest.java new file mode 100644 index 0000000000..e6cc3be213 --- /dev/null +++ b/spring-5-security-oauth/src/test/java/com/baeldung/jersey/JerseyResourceUnitTest.java @@ -0,0 +1,72 @@ +package com.baeldung.jersey; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit4.SpringRunner; + +import java.net.URI; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; +import static org.springframework.http.MediaType.TEXT_HTML; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = RANDOM_PORT) +@TestPropertySource(properties = "spring.security.oauth2.client.registration.github.client-id:test-id") +public class JerseyResourceUnitTest { + @Autowired + private TestRestTemplate restTemplate; + + @LocalServerPort + private int port; + + private String basePath; + + @Before + public void setup() { + basePath = "http://localhost:" + port + "/"; + } + + @Test + public void whenUserIsUnauthenticated_thenTheyAreRedirectedToLoginPage() { + ResponseEntity response = restTemplate.getForEntity(basePath, Object.class); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.FOUND); + assertThat(response.getBody()).isNull(); + + URI redirectLocation = response.getHeaders().getLocation(); + assertThat(redirectLocation).isNotNull(); + assertThat(redirectLocation.toString()).isEqualTo(basePath + "login"); + } + + @Test + public void whenUserAttemptsToLogin_thenAuthorizationPathIsReturned() { + ResponseEntity response = restTemplate.getForEntity(basePath + "login", String.class); + assertThat(response.getHeaders().getContentType()).isEqualTo(TEXT_HTML); + assertThat(response.getBody()).isEqualTo("Log in with GitHub"); + } + + @Test + public void whenUserAccessesAuthorizationEndpoint_thenTheyAresRedirectedToProvider() { + ResponseEntity response = restTemplate.getForEntity(basePath + "oauth2/authorization/github", String.class); + assertThat(response.getStatusCode()).isEqualTo(HttpStatus.FOUND); + assertThat(response.getBody()).isNull(); + + URI redirectLocation = response.getHeaders().getLocation(); + assertThat(redirectLocation).isNotNull(); + assertThat(redirectLocation.getHost()).isEqualTo("github.com"); + assertThat(redirectLocation.getPath()).isEqualTo("/login/oauth/authorize"); + + String redirectionQuery = redirectLocation.getQuery(); + assertThat(redirectionQuery.contains("response_type=code")); + assertThat(redirectionQuery.contains("client_id=test-id")); + assertThat(redirectionQuery.contains("scope=read:user")); + } +} From 15ba49d0f40a7d498cee38829d8b9d97cda178a2 Mon Sep 17 00:00:00 2001 From: Reza Ebrahimpour Date: Thu, 17 Sep 2020 10:25:37 +0430 Subject: [PATCH 0767/1862] BAEL-4488 Convert class with main to UnitTest class --- .../cipher/AvailableCiphersUnitTest.java} | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) rename core-java-modules/core-java-security-2/src/{main/java/com/baeldung/cipher/AvailableCiphers.java => test/java/com/baeldung/cipher/AvailableCiphersUnitTest.java} (57%) diff --git a/core-java-modules/core-java-security-2/src/main/java/com/baeldung/cipher/AvailableCiphers.java b/core-java-modules/core-java-security-2/src/test/java/com/baeldung/cipher/AvailableCiphersUnitTest.java similarity index 57% rename from core-java-modules/core-java-security-2/src/main/java/com/baeldung/cipher/AvailableCiphers.java rename to core-java-modules/core-java-security-2/src/test/java/com/baeldung/cipher/AvailableCiphersUnitTest.java index f73433ffd2..48aaa5fb67 100644 --- a/core-java-modules/core-java-security-2/src/main/java/com/baeldung/cipher/AvailableCiphers.java +++ b/core-java-modules/core-java-security-2/src/test/java/com/baeldung/cipher/AvailableCiphersUnitTest.java @@ -1,32 +1,35 @@ package com.baeldung.cipher; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.security.Provider; import java.security.Security; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -public class AvailableCiphers { - public static void main(String[] args) { - printAllCiphers(); - printCompatibleCiphers(); - } +public class AvailableCiphersUnitTest { + private final Logger logger = LoggerFactory.getLogger(AvailableCiphersUnitTest.class); - private static void printAllCiphers() { + @Test + public void whenGetServices_thenGetAllCipherAlgorithms() { for (Provider provider : Security.getProviders()) { for (Provider.Service service : provider.getServices()) { - System.out.println(service.getAlgorithm()); + logger.info(service.getAlgorithm()); } } } - private static void printCompatibleCiphers() { + @Test + public void whenGetServicesWithFilter_thenGetAllCompatibleCipherAlgorithms() { List algorithms = Arrays.stream(Security.getProviders()) .flatMap(provider -> provider.getServices().stream()) .filter(service -> "Cipher".equals(service.getType())) .map(Provider.Service::getAlgorithm) .collect(Collectors.toList()); - algorithms.forEach(System.out::println); + algorithms.forEach(logger::info); } } From 0d3dafd25cce4ce11e248fff89c540685ebcf9bc Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Thu, 17 Sep 2020 08:37:41 +0200 Subject: [PATCH 0768/1862] [BAEL-4471] reduce number of parallel tests --- quarkus/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quarkus/pom.xml b/quarkus/pom.xml index 67356abdef..7fdf1557fb 100644 --- a/quarkus/pom.xml +++ b/quarkus/pom.xml @@ -99,6 +99,8 @@ maven-surefire-plugin ${surefire-plugin.version} + 1 + true org.jboss.logmanager.LogManager From a47ed70f36934c10bf4161efa5b6bd01e7612246 Mon Sep 17 00:00:00 2001 From: Vishal Date: Thu, 17 Sep 2020 16:41:47 +0530 Subject: [PATCH 0769/1862] Add maven compiler plugin for java 11 --- core-java-modules/core-java-exceptions-3/pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core-java-modules/core-java-exceptions-3/pom.xml b/core-java-modules/core-java-exceptions-3/pom.xml index b909572afe..19996f85af 100644 --- a/core-java-modules/core-java-exceptions-3/pom.xml +++ b/core-java-modules/core-java-exceptions-3/pom.xml @@ -26,6 +26,19 @@ + + + + org.apache.maven.plugins + maven-compiler-plugin + + 11 + 11 + 11 + + + + 3.10.0 From 6cbf1e87c5282415780c95fdb82ca4b8f48ed857 Mon Sep 17 00:00:00 2001 From: Rutuja Joshi <67615932+rutujavjoshi@users.noreply.github.com> Date: Thu, 17 Sep 2020 22:02:51 +0530 Subject: [PATCH 0770/1862] BAEL-4201 - Initial Commit (#9957) * BAEL-4201 - Initial commit * BAEL-4201 - Initial Commit * Update UserAccountController.java removed the additional brackets * Update UserAccountValidationTest.java Updated the tests * Bael - 4201 - recommit for github issue fix For 'This commit does not belong to any branch on this repository' - delete and recommitting controller * Bael - 4201 - recommit for github issue fix For 'This commit does not belong to any branch on this repository' - delete and recommitting test * Bael - 4201 - add for github issue fix For 'This commit does not belong to any branch on this repository' - adding controller again * Bael - 4201 - add for github issue fix For 'This commit does not belong to any branch on this repository' - adding test again * BAEL-4201: Initial Commit * Update UserAccountUnitTest.java * BAEL-4201: updated to fix the commit issue * BAEL-4201 - temporary deleting Deleting to fix branch issue * BAEL-4201 - commiting test again * BAEL-4201 Fixing build issues * BAEL-4201 Github commit issue * BAEL-4201 Github commit issue - webapp folder * BAEL-4201 - commiting test after view upload * Bael- 4201 ThymeLeaf related issues * Bael- 4201 ThymeLeaf related issues * Bael- 4201 ThymeLeaf related issues * Bael- 4201 ThymeLeaf related issues - added html * Bael- 4201 ThymeLeaf issue ; updated suffix- html * Bael - 4201 white label issue * Bael - 4201 white label issue * BAEL-4201 : moving html to templates * BAEL-4201 - moving to templates * BAEL-4201 - moving to templates * BAEL-4201 - review related updates * BAEL-4201 - review related updates * BAEL-4201 - review related updates * BAEL-4201 - review related updates * BAEL-4201 - review related updates * BAEL-4201 - review related updates * BAEL-4201 - review related updates * BAEL-4201 - added the spring-boot-starter-validation dependency --- spring-boot-modules/spring-boot-mvc-3/pom.xml | 6 +- .../springvalidation/ServletInitializer.java | 12 +++ .../SpringValidationApplication.java | 13 +++ .../controller/UserAccountController.java | 44 ++++++++++ .../springvalidation/domain/UserAccount.java | 80 +++++++++++++++++++ .../springvalidation/domain/UserAddress.java | 17 ++++ .../interfaces/AdvanceInfo.java | 6 ++ .../interfaces/BasicInfo.java | 6 ++ .../src/main/resources/application.properties | 2 + .../src/main/resources/templates/error.html | 10 +++ .../src/main/resources/templates/success.html | 10 +++ .../springvalidation/UserAccountUnitTest.java | 57 +++++++++++++ 12 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/ServletInitializer.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/SpringValidationApplication.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/controller/UserAccountController.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/domain/UserAccount.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/domain/UserAddress.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/interfaces/AdvanceInfo.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/interfaces/BasicInfo.java create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/resources/application.properties create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/resources/templates/error.html create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/main/resources/templates/success.html create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/springvalidation/UserAccountUnitTest.java diff --git a/spring-boot-modules/spring-boot-mvc-3/pom.xml b/spring-boot-modules/spring-boot-mvc-3/pom.xml index 31c43461d2..1290b0432f 100644 --- a/spring-boot-modules/spring-boot-mvc-3/pom.xml +++ b/spring-boot-modules/spring-boot-mvc-3/pom.xml @@ -22,6 +22,10 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-validation + org.springframework.boot spring-boot-starter-thymeleaf @@ -37,4 +41,4 @@ 2.7 - \ No newline at end of file + diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/ServletInitializer.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/ServletInitializer.java new file mode 100644 index 0000000000..f365582999 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/ServletInitializer.java @@ -0,0 +1,12 @@ +package com.baeldung.springvalidation; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(SpringValidationApplication.class); + } +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/SpringValidationApplication.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/SpringValidationApplication.java new file mode 100644 index 0000000000..ccfe990ce7 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/SpringValidationApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.springvalidation; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringValidationApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringValidationApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/controller/UserAccountController.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/controller/UserAccountController.java new file mode 100644 index 0000000000..48de7b35d0 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/controller/UserAccountController.java @@ -0,0 +1,44 @@ +package com.baeldung.springvalidation.controller; + +import javax.validation.Valid; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import com.baeldung.springvalidation.domain.UserAccount; +import com.baeldung.springvalidation.interfaces.BasicInfo; + +@Controller +public class UserAccountController { + + @GetMapping("/getUserForm") + public String showUserForm(Model theModel) { + UserAccount theUser = new UserAccount(); + theModel.addAttribute("useraccount", theUser); + return "userHome"; + } + + @RequestMapping(value = "/saveBasicInfo", method = RequestMethod.POST) + public String saveBasicInfo(@Valid @ModelAttribute("useraccount") UserAccount useraccount, BindingResult result, ModelMap model) { + if (result.hasErrors()) { + return "error"; + } + return "success"; + } + + @RequestMapping(value = "/saveBasicInfoStep1", method = RequestMethod.POST) + public String saveBasicInfoStep1(@Validated(BasicInfo.class) @ModelAttribute("useraccount") UserAccount useraccount, BindingResult result, ModelMap model) { + if (result.hasErrors()) { + return "error"; + } + return "success"; + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/domain/UserAccount.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/domain/UserAccount.java new file mode 100644 index 0000000000..fd5437fe5e --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/domain/UserAccount.java @@ -0,0 +1,80 @@ +package com.baeldung.springvalidation.domain; + +import javax.validation.Valid; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +import com.baeldung.springvalidation.interfaces.AdvanceInfo; +import com.baeldung.springvalidation.interfaces.BasicInfo; + +public class UserAccount { + + @NotNull(groups = BasicInfo.class) + @Size(min = 4, max = 15, groups = BasicInfo.class) + private String password; + + @NotBlank(groups = BasicInfo.class) + private String name; + + @Min(value = 18, message = "Age should not be less than 18", groups = AdvanceInfo.class) + private int age; + + @NotBlank(groups = AdvanceInfo.class) + private String phone; + + @Valid + @NotNull(groups = AdvanceInfo.class) + private UserAddress useraddress; + + public UserAddress getUseraddress() { + return useraddress; + } + + public void setUseraddress(UserAddress useraddress) { + this.useraddress = useraddress; + } + + public UserAccount() { + + } + + public UserAccount(String email, String password, String name, int age) { + this.password = password; + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/domain/UserAddress.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/domain/UserAddress.java new file mode 100644 index 0000000000..9aa9656eed --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/domain/UserAddress.java @@ -0,0 +1,17 @@ +package com.baeldung.springvalidation.domain; + +import javax.validation.constraints.NotBlank; +public class UserAddress { + + @NotBlank + private String countryCode; + + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/interfaces/AdvanceInfo.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/interfaces/AdvanceInfo.java new file mode 100644 index 0000000000..dd0c7c69d0 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/interfaces/AdvanceInfo.java @@ -0,0 +1,6 @@ +package com.baeldung.springvalidation.interfaces; + +public interface AdvanceInfo { + // validation group marker interface + +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/interfaces/BasicInfo.java b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/interfaces/BasicInfo.java new file mode 100644 index 0000000000..95d2b5e6a2 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/java/com/baeldung/springvalidation/interfaces/BasicInfo.java @@ -0,0 +1,6 @@ +package com.baeldung.springvalidation.interfaces; + +public interface BasicInfo { + // validation group marker interface + +} diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/resources/application.properties b/spring-boot-modules/spring-boot-mvc-3/src/main/resources/application.properties new file mode 100644 index 0000000000..89390eaace --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.mvc.view.prefix=/WEB-INF/views/ +spring.mvc.view.suffix=.html diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/resources/templates/error.html b/spring-boot-modules/spring-boot-mvc-3/src/main/resources/templates/error.html new file mode 100644 index 0000000000..341cc73603 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/resources/templates/error.html @@ -0,0 +1,10 @@ + + + +SpringValidation + + + +

    Error!!!

    + + \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-3/src/main/resources/templates/success.html b/spring-boot-modules/spring-boot-mvc-3/src/main/resources/templates/success.html new file mode 100644 index 0000000000..b422152153 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/main/resources/templates/success.html @@ -0,0 +1,10 @@ + + + +SpringValidation + + + +

    SUCCESS!!!

    + + \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/springvalidation/UserAccountUnitTest.java b/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/springvalidation/UserAccountUnitTest.java new file mode 100644 index 0000000000..507321bf8e --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/springvalidation/UserAccountUnitTest.java @@ -0,0 +1,57 @@ +package com.baeldung.springvalidation; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureMockMvc +public class UserAccountUnitTest { + + @Autowired + private MockMvc mockMvc; + + @Test + public void givenSaveBasicInfo_whenCorrectInput_thenSuccess() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.post("/saveBasicInfo") + .accept(MediaType.TEXT_HTML) + .param("name", "test123") + .param("password", "pass")) + .andExpect(view().name("success")) + .andExpect(status().isOk()) + .andDo(print()); + } + + @Test + public void givenSaveBasicInfoStep1_whenCorrectInput_thenSuccess() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.post("/saveBasicInfoStep1") + .accept(MediaType.TEXT_HTML) + .param("name", "test123") + .param("password", "pass")) + .andExpect(view().name("success")) + .andExpect(status().isOk()) + .andDo(print()); + } + + @Test + public void givenSaveBasicInfoStep1_whenIncorrectInput_thenError() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.post("/saveBasicInfoStep1") + .accept(MediaType.TEXT_HTML)) + // .param("name", "test123") + // .param("password", "pass")) + .andExpect(model().errorCount(2)) + // .andExpect(view().name("error")) + .andExpect(status().isOk()) + .andDo(print()); + } + +} From 4c39bcd6be91c5da7901d54e0cb4d5227d54da19 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Thu, 17 Sep 2020 19:57:53 +0200 Subject: [PATCH 0771/1862] BAEL-4610: Add {noop} example security config (#10046) --- ...InMemoryNoOpAuthWebSecurityConfigurer.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryNoOpAuthWebSecurityConfigurer.java diff --git a/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryNoOpAuthWebSecurityConfigurer.java b/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryNoOpAuthWebSecurityConfigurer.java new file mode 100644 index 0000000000..4b6494f666 --- /dev/null +++ b/spring-5-security/src/main/java/com/baeldung/inmemory/InMemoryNoOpAuthWebSecurityConfigurer.java @@ -0,0 +1,29 @@ +package com.baeldung.inmemory; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +//@Configuration +public class InMemoryNoOpAuthWebSecurityConfigurer extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth.inMemoryAuthentication() + .withUser("spring") + .password("{noop}secret") + .roles("USER"); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/private/**") + .authenticated() + .antMatchers("/public/**") + .permitAll() + .and() + .httpBasic(); + } +} From f8d53b4c6015d5646c74320151c1ee235f059967 Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Thu, 17 Sep 2020 22:00:57 +0200 Subject: [PATCH 0772/1862] BAEL-4437 - System Rules --- testing-modules/pom.xml | 3 +- testing-modules/testing-libraries-2/pom.xml | 43 ++++++++++++++++++ ...ClearSystemPropertiesWithRuleUnitTest.java | 19 ++++++++ .../ProvidesSystemPropertyUnitTest.java | 26 +++++++++++ ...rovidesSystemPropertyWithRuleUnitTest.java | 44 +++++++++++++++++++ .../systemrules/SystemErrPrintlnUnitTest.java | 24 ++++++++++ .../SystemErrPrintlnWithRuleUnitTest.java | 25 +++++++++++ .../systemrules/SystemExitUnitTest.java | 23 ++++++++++ .../SystemExitWithRuleUnitTest.java | 22 ++++++++++ .../systemrules/SystemInUnitTest.java | 27 ++++++++++++ .../systemrules/SystemInWithRuleUnitTest.java | 31 +++++++++++++ .../src/test/resources/test.properties | 2 + 12 files changed, 288 insertions(+), 1 deletion(-) create mode 100644 testing-modules/testing-libraries-2/pom.xml create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ClearSystemPropertiesWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/resources/test.properties diff --git a/testing-modules/pom.xml b/testing-modules/pom.xml index f1d30cd7a1..0416423239 100644 --- a/testing-modules/pom.xml +++ b/testing-modules/pom.xml @@ -41,7 +41,8 @@ junit-5-advanced xmlunit-2 junit-4 - testing-libraries + testing-libraries + testing-libraries-2 powermock diff --git a/testing-modules/testing-libraries-2/pom.xml b/testing-modules/testing-libraries-2/pom.xml new file mode 100644 index 0000000000..282583c882 --- /dev/null +++ b/testing-modules/testing-libraries-2/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + testing-libraries-2 + testing-libraries-2 + + + com.baeldung + testing-modules + 1.0.0-SNAPSHOT + + + + + com.github.stefanbirkner + system-rules + ${system-rules.version} + test + + + com.github.stefanbirkner + system-lambda + ${system-lambda.version} + test + + + + + testing-libraries + + + src/test/resources + true + + + + + + 1.19.0 + 1.0.0 + + diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ClearSystemPropertiesWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ClearSystemPropertiesWithRuleUnitTest.java new file mode 100644 index 0000000000..699b40bad9 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ClearSystemPropertiesWithRuleUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.systemrules; + +import static org.junit.Assert.assertNull; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.ClearSystemProperties; + +public class ClearSystemPropertiesWithRuleUnitTest { + + @Rule + public final ClearSystemProperties userNameIsClearedRule = new ClearSystemProperties("user.name"); + + @Test + public void givenClearUsernameProperty_whenGetUserName_thenNull() { + assertNull(System.getProperty("user.name")); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyUnitTest.java new file mode 100644 index 0000000000..361a338508 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.systemrules; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.restoreSystemProperties; +import static org.junit.Assert.assertEquals; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +class ProvidesSystemPropertyUnitTest { + + @BeforeAll + static void setUpBeforeClass() throws Exception { + System.setProperty("log_dir", "/tmp/baeldung/logs"); + } + + @Test + void givenSetSystemProperty_whenGetLogDir_thenLogDirIsProvidedSuccessfully() throws Exception { + restoreSystemProperties(() -> { + System.setProperty("log_dir", "test/resources"); + assertEquals("log_dir should be provided", "test/resources", System.getProperty("log_dir")); + }); + + assertEquals("log_dir should be provided", "/tmp/baeldung/logs", System.getProperty("log_dir")); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyWithRuleUnitTest.java new file mode 100644 index 0000000000..3a90592a0d --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyWithRuleUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.systemrules; + +import static org.junit.Assert.assertEquals; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.ProvideSystemProperty; + +public class ProvidesSystemPropertyWithRuleUnitTest { + + @Rule + public final ProvideSystemProperty providesSystemPropertyRule = new ProvideSystemProperty("log_dir", "test/resources").and("another_property", "another_value"); + + @Rule + public final ProvideSystemProperty providesSystemPropertyFromFileRule = ProvideSystemProperty.fromResource("/test.properties"); + + @BeforeClass + public static void setUpBeforeClass() { + setLogs(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + System.out.println(System.getProperty("log_dir")); + } + + @Test + public void givenProvideSystemProperty_whenGetLogDir_thenLogDirIsProvidedSuccessfully() { + assertEquals("log_dir should be provided", "test/resources", System.getProperty("log_dir")); + } + + @Test + public void givenProvideSystemPropertyFromFile_whenGetName_thenNameIsProvidedSuccessfully() { + assertEquals("name should be provided", "baeldung", System.getProperty("name")); + assertEquals("version should be provided", "1.0", System.getProperty("version")); + } + + private static void setLogs() { + System.setProperty("log_dir", "/tmp/baeldung/logs"); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnUnitTest.java new file mode 100644 index 0000000000..3345ddae8a --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.systemrules; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.tapSystemErr; + +import org.junit.Assert; +import org.junit.jupiter.api.Test; + +class SystemErrPrintlnUnitTest { + + @Test + void givenTapSystemErr_whenInvokePrintln_thenOutputIsReturnedSuccessfully() throws Exception { + + String text = tapSystemErr(() -> { + printError("An error occurred Baeldung Readers!!"); + }); + + Assert.assertEquals("An error occurred Baeldung Readers!!", text.trim()); + } + + private void printError(String output) { + System.err.println(output); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnWithRuleUnitTest.java new file mode 100644 index 0000000000..7994f91063 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnWithRuleUnitTest.java @@ -0,0 +1,25 @@ +package com.baeldung.systemrules; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.SystemErrRule; + +public class SystemErrPrintlnWithRuleUnitTest { + + @Rule + public final SystemErrRule systemErrRule = new SystemErrRule().enableLog(); + + @Test + public void givenSystemErrRule_whenInvokePrintln_thenLogSuccess() { + printError("An Error occurred Baeldung Readers!!"); + + Assert.assertEquals("An Error occurred Baeldung Readers!!", systemErrRule.getLog() + .trim()); + } + + private void printError(String output) { + System.err.println(output); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitUnitTest.java new file mode 100644 index 0000000000..1e2548e714 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.systemrules; + +import static org.junit.Assert.assertEquals; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.catchSystemExit; + +import org.junit.jupiter.api.Test; + +class SystemExitUnitTest { + + @Test + void givenCatchSystemExit_whenAppCallsSystemExit_thenStatusIsReturnedSuccessfully() throws Exception { + int statusCode = catchSystemExit(() -> { + exit(); + }); + assertEquals("status code should be 1:", 1, statusCode); + } + + private void exit() { + System.exit(1); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitWithRuleUnitTest.java new file mode 100644 index 0000000000..471aab1989 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitWithRuleUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.systemrules; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.ExpectedSystemExit; + +public class SystemExitWithRuleUnitTest { + + @Rule + public final ExpectedSystemExit exitRule = ExpectedSystemExit.none(); + + @Test + public void givenSystemExitRule_whenAppCallsSystemExit_thenExitRuleWorkssAsExpected() { + exitRule.expectSystemExitWithStatus(1); + exit(); + } + + private void exit() { + System.exit(1); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInUnitTest.java new file mode 100644 index 0000000000..96badb59d4 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.systemrules; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.withTextFromSystemIn; +import static org.junit.Assert.assertEquals; + +import java.util.Scanner; + +import org.junit.jupiter.api.Test; + +class SystemInUnitTest { + + @Test + void givenTwoNames_whenSystemInMock_thenNamesJoinedTogether() throws Exception { + withTextFromSystemIn("Jonathan", "Cook").execute(() -> { + assertEquals("Names should be concatenated", "Jonathan Cook", getFullname()); + }); + } + + private String getFullname() { + try (Scanner scanner = new Scanner(System.in)) { + String firstName = scanner.next(); + String surname = scanner.next(); + return String.join(" ", firstName, surname); + } + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInWithRuleUnitTest.java new file mode 100644 index 0000000000..5730e2f592 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInWithRuleUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.systemrules; + +import static org.junit.Assert.assertEquals; + +import java.util.Scanner; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.TextFromStandardInputStream; +import static org.junit.contrib.java.lang.system.TextFromStandardInputStream.emptyStandardInputStream; + +public class SystemInWithRuleUnitTest { + + @Rule + public final TextFromStandardInputStream systemInMock = emptyStandardInputStream(); + + @Test + public void givenTwoNames_whenSystemInMock_thenNamesJoinedTogether() { + systemInMock.provideLines("Jonathan", "Cook"); + assertEquals("Names should be concatenated", "Jonathan Cook", getFullname()); + } + + private String getFullname() { + try (Scanner scanner = new Scanner(System.in)) { + String firstName = scanner.next(); + String surname = scanner.next(); + return String.join(" ", firstName, surname); + } + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/resources/test.properties b/testing-modules/testing-libraries-2/src/test/resources/test.properties new file mode 100644 index 0000000000..144847cdb0 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/resources/test.properties @@ -0,0 +1,2 @@ +name=baeldung +version=1.0 \ No newline at end of file From f6adcd0cb3260807a55341744fb87e547432900a Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Thu, 17 Sep 2020 23:22:49 +0200 Subject: [PATCH 0773/1862] BAEL-4437 - System Rules (#10047) Co-authored-by: Jonathan Cook --- testing-modules/pom.xml | 3 +- testing-modules/testing-libraries-2/pom.xml | 43 ++++++++++++++++++ ...ClearSystemPropertiesWithRuleUnitTest.java | 19 ++++++++ .../ProvidesSystemPropertyUnitTest.java | 26 +++++++++++ ...rovidesSystemPropertyWithRuleUnitTest.java | 44 +++++++++++++++++++ .../systemrules/SystemErrPrintlnUnitTest.java | 24 ++++++++++ .../SystemErrPrintlnWithRuleUnitTest.java | 25 +++++++++++ .../systemrules/SystemExitUnitTest.java | 23 ++++++++++ .../SystemExitWithRuleUnitTest.java | 22 ++++++++++ .../systemrules/SystemInUnitTest.java | 27 ++++++++++++ .../systemrules/SystemInWithRuleUnitTest.java | 31 +++++++++++++ .../src/test/resources/test.properties | 2 + 12 files changed, 288 insertions(+), 1 deletion(-) create mode 100644 testing-modules/testing-libraries-2/pom.xml create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ClearSystemPropertiesWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInWithRuleUnitTest.java create mode 100644 testing-modules/testing-libraries-2/src/test/resources/test.properties diff --git a/testing-modules/pom.xml b/testing-modules/pom.xml index f1d30cd7a1..0416423239 100644 --- a/testing-modules/pom.xml +++ b/testing-modules/pom.xml @@ -41,7 +41,8 @@ junit-5-advanced xmlunit-2 junit-4 - testing-libraries + testing-libraries + testing-libraries-2 powermock diff --git a/testing-modules/testing-libraries-2/pom.xml b/testing-modules/testing-libraries-2/pom.xml new file mode 100644 index 0000000000..282583c882 --- /dev/null +++ b/testing-modules/testing-libraries-2/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + testing-libraries-2 + testing-libraries-2 + + + com.baeldung + testing-modules + 1.0.0-SNAPSHOT + + + + + com.github.stefanbirkner + system-rules + ${system-rules.version} + test + + + com.github.stefanbirkner + system-lambda + ${system-lambda.version} + test + + + + + testing-libraries + + + src/test/resources + true + + + + + + 1.19.0 + 1.0.0 + + diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ClearSystemPropertiesWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ClearSystemPropertiesWithRuleUnitTest.java new file mode 100644 index 0000000000..699b40bad9 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ClearSystemPropertiesWithRuleUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.systemrules; + +import static org.junit.Assert.assertNull; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.ClearSystemProperties; + +public class ClearSystemPropertiesWithRuleUnitTest { + + @Rule + public final ClearSystemProperties userNameIsClearedRule = new ClearSystemProperties("user.name"); + + @Test + public void givenClearUsernameProperty_whenGetUserName_thenNull() { + assertNull(System.getProperty("user.name")); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyUnitTest.java new file mode 100644 index 0000000000..361a338508 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.systemrules; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.restoreSystemProperties; +import static org.junit.Assert.assertEquals; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +class ProvidesSystemPropertyUnitTest { + + @BeforeAll + static void setUpBeforeClass() throws Exception { + System.setProperty("log_dir", "/tmp/baeldung/logs"); + } + + @Test + void givenSetSystemProperty_whenGetLogDir_thenLogDirIsProvidedSuccessfully() throws Exception { + restoreSystemProperties(() -> { + System.setProperty("log_dir", "test/resources"); + assertEquals("log_dir should be provided", "test/resources", System.getProperty("log_dir")); + }); + + assertEquals("log_dir should be provided", "/tmp/baeldung/logs", System.getProperty("log_dir")); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyWithRuleUnitTest.java new file mode 100644 index 0000000000..3a90592a0d --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/ProvidesSystemPropertyWithRuleUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.systemrules; + +import static org.junit.Assert.assertEquals; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.ProvideSystemProperty; + +public class ProvidesSystemPropertyWithRuleUnitTest { + + @Rule + public final ProvideSystemProperty providesSystemPropertyRule = new ProvideSystemProperty("log_dir", "test/resources").and("another_property", "another_value"); + + @Rule + public final ProvideSystemProperty providesSystemPropertyFromFileRule = ProvideSystemProperty.fromResource("/test.properties"); + + @BeforeClass + public static void setUpBeforeClass() { + setLogs(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + System.out.println(System.getProperty("log_dir")); + } + + @Test + public void givenProvideSystemProperty_whenGetLogDir_thenLogDirIsProvidedSuccessfully() { + assertEquals("log_dir should be provided", "test/resources", System.getProperty("log_dir")); + } + + @Test + public void givenProvideSystemPropertyFromFile_whenGetName_thenNameIsProvidedSuccessfully() { + assertEquals("name should be provided", "baeldung", System.getProperty("name")); + assertEquals("version should be provided", "1.0", System.getProperty("version")); + } + + private static void setLogs() { + System.setProperty("log_dir", "/tmp/baeldung/logs"); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnUnitTest.java new file mode 100644 index 0000000000..3345ddae8a --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnUnitTest.java @@ -0,0 +1,24 @@ +package com.baeldung.systemrules; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.tapSystemErr; + +import org.junit.Assert; +import org.junit.jupiter.api.Test; + +class SystemErrPrintlnUnitTest { + + @Test + void givenTapSystemErr_whenInvokePrintln_thenOutputIsReturnedSuccessfully() throws Exception { + + String text = tapSystemErr(() -> { + printError("An error occurred Baeldung Readers!!"); + }); + + Assert.assertEquals("An error occurred Baeldung Readers!!", text.trim()); + } + + private void printError(String output) { + System.err.println(output); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnWithRuleUnitTest.java new file mode 100644 index 0000000000..7994f91063 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemErrPrintlnWithRuleUnitTest.java @@ -0,0 +1,25 @@ +package com.baeldung.systemrules; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.SystemErrRule; + +public class SystemErrPrintlnWithRuleUnitTest { + + @Rule + public final SystemErrRule systemErrRule = new SystemErrRule().enableLog(); + + @Test + public void givenSystemErrRule_whenInvokePrintln_thenLogSuccess() { + printError("An Error occurred Baeldung Readers!!"); + + Assert.assertEquals("An Error occurred Baeldung Readers!!", systemErrRule.getLog() + .trim()); + } + + private void printError(String output) { + System.err.println(output); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitUnitTest.java new file mode 100644 index 0000000000..1e2548e714 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.systemrules; + +import static org.junit.Assert.assertEquals; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.catchSystemExit; + +import org.junit.jupiter.api.Test; + +class SystemExitUnitTest { + + @Test + void givenCatchSystemExit_whenAppCallsSystemExit_thenStatusIsReturnedSuccessfully() throws Exception { + int statusCode = catchSystemExit(() -> { + exit(); + }); + assertEquals("status code should be 1:", 1, statusCode); + } + + private void exit() { + System.exit(1); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitWithRuleUnitTest.java new file mode 100644 index 0000000000..471aab1989 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemExitWithRuleUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.systemrules; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.ExpectedSystemExit; + +public class SystemExitWithRuleUnitTest { + + @Rule + public final ExpectedSystemExit exitRule = ExpectedSystemExit.none(); + + @Test + public void givenSystemExitRule_whenAppCallsSystemExit_thenExitRuleWorkssAsExpected() { + exitRule.expectSystemExitWithStatus(1); + exit(); + } + + private void exit() { + System.exit(1); + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInUnitTest.java new file mode 100644 index 0000000000..96badb59d4 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInUnitTest.java @@ -0,0 +1,27 @@ +package com.baeldung.systemrules; + +import static com.github.stefanbirkner.systemlambda.SystemLambda.withTextFromSystemIn; +import static org.junit.Assert.assertEquals; + +import java.util.Scanner; + +import org.junit.jupiter.api.Test; + +class SystemInUnitTest { + + @Test + void givenTwoNames_whenSystemInMock_thenNamesJoinedTogether() throws Exception { + withTextFromSystemIn("Jonathan", "Cook").execute(() -> { + assertEquals("Names should be concatenated", "Jonathan Cook", getFullname()); + }); + } + + private String getFullname() { + try (Scanner scanner = new Scanner(System.in)) { + String firstName = scanner.next(); + String surname = scanner.next(); + return String.join(" ", firstName, surname); + } + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInWithRuleUnitTest.java b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInWithRuleUnitTest.java new file mode 100644 index 0000000000..5730e2f592 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/java/com/baeldung/systemrules/SystemInWithRuleUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.systemrules; + +import static org.junit.Assert.assertEquals; + +import java.util.Scanner; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.contrib.java.lang.system.TextFromStandardInputStream; +import static org.junit.contrib.java.lang.system.TextFromStandardInputStream.emptyStandardInputStream; + +public class SystemInWithRuleUnitTest { + + @Rule + public final TextFromStandardInputStream systemInMock = emptyStandardInputStream(); + + @Test + public void givenTwoNames_whenSystemInMock_thenNamesJoinedTogether() { + systemInMock.provideLines("Jonathan", "Cook"); + assertEquals("Names should be concatenated", "Jonathan Cook", getFullname()); + } + + private String getFullname() { + try (Scanner scanner = new Scanner(System.in)) { + String firstName = scanner.next(); + String surname = scanner.next(); + return String.join(" ", firstName, surname); + } + } + +} diff --git a/testing-modules/testing-libraries-2/src/test/resources/test.properties b/testing-modules/testing-libraries-2/src/test/resources/test.properties new file mode 100644 index 0000000000..144847cdb0 --- /dev/null +++ b/testing-modules/testing-libraries-2/src/test/resources/test.properties @@ -0,0 +1,2 @@ +name=baeldung +version=1.0 \ No newline at end of file From 7c482a8e6f53cead43e8c6addd794159d2bb9f0b Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Fri, 18 Sep 2020 22:40:10 +0200 Subject: [PATCH 0774/1862] JAVA-2975: Clean up the pom.xml in spring-boot-exceptions --- .../spring-boot-exceptions/pom.xml | 72 +------------------ 1 file changed, 1 insertion(+), 71 deletions(-) diff --git a/spring-boot-modules/spring-boot-exceptions/pom.xml b/spring-boot-modules/spring-boot-exceptions/pom.xml index 4b9d787b61..1bfe8e6751 100644 --- a/spring-boot-modules/spring-boot-exceptions/pom.xml +++ b/spring-boot-modules/spring-boot-exceptions/pom.xml @@ -14,15 +14,7 @@ jar spring-boot-exceptions - Demo project for working with Spring Boot exceptions - - - - org.springframework.boot - spring-boot-starter - ${spring-boot.version} - - + Demo project for working with Spring Boot exceptions spring-boot-exceptions @@ -32,68 +24,6 @@ true - - - - - org.apache.maven.plugins - maven-war-plugin - - - - org.apache.maven.plugins - maven-resources-plugin - - - @ - - false - - - - - - - autoconfiguration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - **/*IntegrationTest.java - **/*IntTest.java - - - **/AutoconfigurationTest.java - - - - - - - json - - - - - - - - - - - com.baeldung.intro.App - 2.2.3.RELEASE - From bca4b6bca5536884a4586589daeea587b61481dd Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 19 Sep 2020 13:20:07 +0200 Subject: [PATCH 0775/1862] Java-82 Update pom with reference to JAVA-2824 for failing tests --- pom.xml | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 6d5c810784..c460c080d8 100644 --- a/pom.xml +++ b/pom.xml @@ -1374,23 +1374,23 @@ core-java-modules/core-java-9 core-java-modules/core-java-9-improvements - - + + core-java-modules/core-java-9-streams core-java-modules/core-java-10 - - - - + + + + core-java-modules/core-java-collections-set - - - + + + core-java-modules/core-java-jpms - - + + core-java-modules/multimodulemavenproject - + @@ -1419,23 +1419,23 @@ core-java-modules/core-java-9 core-java-modules/core-java-9-improvements - - + + core-java-modules/core-java-9-streams core-java-modules/core-java-10 - - - - + + + + core-java-modules/core-java-collections-set - - - + + + core-java-modules/core-java-jpms - - + + core-java-modules/multimodulemavenproject - + From 23e39f4244414b15defde5bfc620383101187241 Mon Sep 17 00:00:00 2001 From: mikr Date: Sat, 19 Sep 2020 13:51:05 +0200 Subject: [PATCH 0776/1862] Java-82 Fix test --- apache-libraries/pom.xml | 5 +++++ jackson-modules/jackson-custom-conversions/pom.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apache-libraries/pom.xml b/apache-libraries/pom.xml index 9f800f1e0b..15404676cc 100644 --- a/apache-libraries/pom.xml +++ b/apache-libraries/pom.xml @@ -129,6 +129,11 @@ zookeeper ${zookeeper.version} + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + com.fasterxml.jackson.core jackson-databind diff --git a/jackson-modules/jackson-custom-conversions/pom.xml b/jackson-modules/jackson-custom-conversions/pom.xml index 78894bb403..f58b25781c 100644 --- a/jackson-modules/jackson-custom-conversions/pom.xml +++ b/jackson-modules/jackson-custom-conversions/pom.xml @@ -26,7 +26,7 @@ com.fasterxml.jackson.core jackson-core - 2.10.1 + ${jackson.version} From 8971f2dca29f863c3929aa69bd1f8b3bff5df20e Mon Sep 17 00:00:00 2001 From: Azhwani <13301425+azhwani@users.noreply.github.com> Date: Sat, 19 Sep 2020 14:52:49 +0100 Subject: [PATCH 0777/1862] BAEL-4327: JSON Parameters with Spring MVC (#10036) * first commit * update commit Co-authored-by: azhwani <> --- .../jsonparams/config/JsonParamsConfig.java | 36 ++++++++++ .../jsonparams/config/JsonParamsInit.java | 29 ++++++++ .../controller/ProductController.java | 57 +++++++++++++++ .../baeldung/jsonparams/model/Product.java | 37 ++++++++++ .../propertyeditor/ProductEditor.java | 34 +++++++++ .../jsonparams/JsonParamsIntegrationTest.java | 71 +++++++++++++++++++ 6 files changed, 264 insertions(+) create mode 100644 spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/config/JsonParamsConfig.java create mode 100644 spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/config/JsonParamsInit.java create mode 100644 spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/controller/ProductController.java create mode 100644 spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/model/Product.java create mode 100644 spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/propertyeditor/ProductEditor.java create mode 100644 spring-mvc-basics-4/src/test/java/com/baeldung/jsonparams/JsonParamsIntegrationTest.java diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/config/JsonParamsConfig.java b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/config/JsonParamsConfig.java new file mode 100644 index 0000000000..f2049554ab --- /dev/null +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/config/JsonParamsConfig.java @@ -0,0 +1,36 @@ +package com.baeldung.jsonparams.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.view.InternalResourceViewResolver; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Configuration +@EnableWebMvc +@ComponentScan(basePackages = { "com.baeldung.jsonparams" }) +public class JsonParamsConfig implements WebMvcConfigurer { + @Override + public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { + configurer.enable(); + } + + @Bean + public ViewResolver viewResolver() { + InternalResourceViewResolver bean = new InternalResourceViewResolver(); + bean.setPrefix("/WEB-INF/"); + bean.setSuffix(".jsp"); + return bean; + } + + @Bean + public ObjectMapper objectMapper() { + return new ObjectMapper(); + } + +} diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/config/JsonParamsInit.java b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/config/JsonParamsInit.java new file mode 100644 index 0000000000..6db2a92350 --- /dev/null +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/config/JsonParamsInit.java @@ -0,0 +1,29 @@ +package com.baeldung.jsonparams.config; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.ServletRegistration; + +import org.springframework.web.context.ContextLoaderListener; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.web.servlet.DispatcherServlet; + +public class JsonParamsInit // implements WebApplicationInitializer +{ + + //uncomment to run the product controller example + //@Override + public void onStartup(ServletContext sc) throws ServletException { + AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); + root.register(JsonParamsConfig.class); + root.setServletContext(sc); + sc.addListener(new ContextLoaderListener(root)); + + DispatcherServlet dv = new DispatcherServlet(root); + + ServletRegistration.Dynamic appServlet = sc.addServlet("jsonparams-mvc", dv); + appServlet.setLoadOnStartup(1); + appServlet.addMapping("/"); + } + +} diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/controller/ProductController.java b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/controller/ProductController.java new file mode 100644 index 0000000000..e4e2ce085d --- /dev/null +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/controller/ProductController.java @@ -0,0 +1,57 @@ +package com.baeldung.jsonparams.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.baeldung.jsonparams.model.Product; +import com.baeldung.jsonparams.propertyeditor.ProductEditor; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Controller +@RequestMapping("/products") +public class ProductController { + + private ObjectMapper objectMapper; + + @Autowired + public void setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + @InitBinder + public void initBinder(WebDataBinder binder) { + binder.registerCustomEditor(Product.class, new ProductEditor(objectMapper)); + } + + @PostMapping("/create") + @ResponseBody + public Product createProduct(@RequestBody Product product) { + // custom logic + return product; + } + + @GetMapping("/get") + @ResponseBody + public Product getProduct(@RequestParam String product) throws JsonMappingException, JsonProcessingException { + final Product prod = objectMapper.readValue(product, Product.class); + return prod; + } + + @GetMapping("/get2") + @ResponseBody + public Product get2Product(@RequestParam Product product) { + // custom logic + return product; + } + +} diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/model/Product.java b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/model/Product.java new file mode 100644 index 0000000000..b0baf0aa57 --- /dev/null +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/model/Product.java @@ -0,0 +1,37 @@ +package com.baeldung.jsonparams.model; + +public class Product { + + private int id; + private String name; + private double price; + + public Product() { + + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String nom) { + this.name = nom; + } + + public double getPrice() { + return price; + } + + public void setPrice(double price) { + this.price = price; + } + +} diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/propertyeditor/ProductEditor.java b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/propertyeditor/ProductEditor.java new file mode 100644 index 0000000000..11766118cd --- /dev/null +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/jsonparams/propertyeditor/ProductEditor.java @@ -0,0 +1,34 @@ +package com.baeldung.jsonparams.propertyeditor; + +import java.beans.PropertyEditorSupport; + +import org.springframework.util.StringUtils; + +import com.baeldung.jsonparams.model.Product; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ProductEditor extends PropertyEditorSupport { + + private ObjectMapper objectMapper; + + public ProductEditor(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + @Override + public void setAsText(String text) throws IllegalArgumentException { + if (StringUtils.isEmpty(text)) { + setValue(null); + } else { + Product prod = new Product(); + try { + prod = objectMapper.readValue(text, Product.class); + } catch (JsonProcessingException e) { + throw new IllegalArgumentException(e); + } + setValue(prod); + } + } + +} diff --git a/spring-mvc-basics-4/src/test/java/com/baeldung/jsonparams/JsonParamsIntegrationTest.java b/spring-mvc-basics-4/src/test/java/com/baeldung/jsonparams/JsonParamsIntegrationTest.java new file mode 100644 index 0000000000..bceadc4896 --- /dev/null +++ b/spring-mvc-basics-4/src/test/java/com/baeldung/jsonparams/JsonParamsIntegrationTest.java @@ -0,0 +1,71 @@ +package com.baeldung.jsonparams; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.AnnotationConfigWebContextLoader; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import com.baeldung.jsonparams.config.JsonParamsConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration(classes = { JsonParamsConfig.class }, loader = AnnotationConfigWebContextLoader.class) +public class JsonParamsIntegrationTest { + + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + @Before + public void setUp() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) + .build(); + } + + @Test + public void whenJsonIsPassedWithPost_thenResponseOK() throws Exception { + + this.mockMvc.perform(post("/products/create").accept(MediaType.APPLICATION_JSON) + .contentType(MediaType.APPLICATION_JSON) + .content("{\"id\": 1,\"name\": \"Asus Zenbook\",\"price\": 800}")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.id").value("1")) + .andExpect(jsonPath("$.name").value("Asus Zenbook")); + + } + + @Test + public void whenJsonIsPassedWithGet_thenResponseOK() throws Exception { + + this.mockMvc.perform(get("/products/get").contentType(MediaType.APPLICATION_JSON) + .queryParam("product", "{\"id\": 2,\"name\": \"HP EliteBook\",\"price\": 700}")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.id").value("2")) + .andExpect(jsonPath("$.name").value("HP EliteBook")); + + } + + @Test + public void whenJsonIsPassedWithGet2_thenResponseOK() throws Exception { + + this.mockMvc.perform(get("/products/get2").contentType(MediaType.APPLICATION_JSON) + .queryParam("product", "{\"id\": 3,\"name\": \"Dell G5 15\",\"price\": 1200}")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.id").value("3")) + .andExpect(jsonPath("$.name").value("Dell G5 15")); + + } + +} From 1cd9875381b282aff23c40473f03754e20302d1f Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Sat, 19 Sep 2020 10:40:37 -0500 Subject: [PATCH 0778/1862] BAEL-3569: Update README (#10053) * BAEL-3336 BAEL-3058 add links * BAEL-3319: add link * BAEL-3284: add link * BAEL-3198: add link to article * BAEL-3479: add link to article * BAEL-3485: add article link * SCALA-38: move to new package and add link back to article * SCALA-38: add imports back into unit test * BAEL-3908: add link back to article * BAEL-2893 BAEL-3927 add link back to article * BAEL-3569: update README --- spring-5-security-oauth/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-5-security-oauth/README.md b/spring-5-security-oauth/README.md index 43cab33598..35e64da639 100644 --- a/spring-5-security-oauth/README.md +++ b/spring-5-security-oauth/README.md @@ -7,3 +7,4 @@ This module contains articles about Spring 5 OAuth Security - [Spring Security 5 – OAuth2 Login](https://www.baeldung.com/spring-security-5-oauth2-login) - [Extracting Principal and Authorities using Spring Security OAuth](https://www.baeldung.com/spring-security-oauth-principal-authorities-extractor) - [Customizing Authorization and Token Requests with Spring Security 5.1 Client](https://www.baeldung.com/spring-security-custom-oauth-requests) +- [Social Login with Spring Security in a Jersey Application](https://www.baeldung.com/spring-security-social-login-jersey) From f1348339529b20f6d61b3cc9442db89faaafcee7 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sat, 19 Sep 2020 21:49:13 +0530 Subject: [PATCH 0779/1862] Refactored code to use generic methods and use streams. (#10052) --- .../check/staticmethods/StaticUtility.java | 19 ++++++++++++ .../staticmethods/StaticUtilityUnitTest.java | 30 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/check/staticmethods/StaticUtility.java create mode 100644 core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/check/staticmethods/StaticUtilityUnitTest.java diff --git a/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/check/staticmethods/StaticUtility.java b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/check/staticmethods/StaticUtility.java new file mode 100644 index 0000000000..5afb9b79c4 --- /dev/null +++ b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/check/staticmethods/StaticUtility.java @@ -0,0 +1,19 @@ +package com.baeldung.reflection.check.staticmethods; + +import java.time.LocalDate; +import java.time.LocalTime; + +public class StaticUtility { + + public static String getAuthorName() { + return "Umang Budhwar"; + } + + public static LocalDate getLocalDate() { + return LocalDate.now(); + } + + public static LocalTime getLocalTime() { + return LocalTime.now(); + } +} diff --git a/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/check/staticmethods/StaticUtilityUnitTest.java b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/check/staticmethods/StaticUtilityUnitTest.java new file mode 100644 index 0000000000..a4540407d5 --- /dev/null +++ b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/check/staticmethods/StaticUtilityUnitTest.java @@ -0,0 +1,30 @@ +package com.baeldung.reflection.check.staticmethods; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class StaticUtilityUnitTest { + + @Test + void whenCheckStaticMethod_ThenSuccess() throws Exception { + Method method = StaticUtility.class.getMethod("getAuthorName", null); + Assertions.assertTrue(Modifier.isStatic(method.getModifiers())); + } + + @Test + void whenCheckAllStaticMethods_thenSuccess() { + List methodList = Arrays.asList(StaticUtility.class.getMethods()) + .stream() + .filter(method -> Modifier.isStatic(method.getModifiers())) + .collect(Collectors.toList()); + Assertions.assertEquals(3, methodList.size()); + } + +} From 3626b5c85857e735b1aa2dade5fd687eaf0ec3ef Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Sun, 20 Sep 2020 01:20:58 +0530 Subject: [PATCH 0780/1862] BAEL-4404 | Added test class to verify the beahvior --- .../CharEncodingCheckControllerTest.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerTest.java diff --git a/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerTest.java b/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerTest.java new file mode 100644 index 0000000000..25f257eced --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerTest.java @@ -0,0 +1,34 @@ +package com.baeldung.charencoding.controller; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import java.io.IOException; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.junit.jupiter.api.Test; +import org.springframework.web.filter.CharacterEncodingFilter; + +class CharEncodingCheckControllerTest { + + @Test + void whenCharEncodingFilter_thenVerifyEncoding() throws ServletException, IOException { + HttpServletRequest request = mock(HttpServletRequest.class); + HttpServletResponse response = mock(HttpServletResponse.class); + FilterChain chain = mock(FilterChain.class); + + CharacterEncodingFilter filter = new CharacterEncodingFilter(); + filter.setEncoding("UTF-8"); + filter.setForceEncoding(true); + + filter.doFilter(request, response, chain); + + verify(request).setCharacterEncoding("UTF-8"); + verify(response).setCharacterEncoding("UTF-8"); + } + +} From cb8bae53a250fec6a431b75c73d49df41335d74b Mon Sep 17 00:00:00 2001 From: Ricardo Caldas Date: Sat, 19 Sep 2020 19:58:33 -0300 Subject: [PATCH 0781/1862] Add a new section in Lombok builder article - Minor Fixes --- .../lombok/builder/RequiredFieldAnnotation.java | 3 ++- ...est.java => RequiredFieldAnnotationUnitTest.java} | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) rename lombok/src/test/java/com/baeldung/lombok/builder/{RequiredFieldAnnotationTest.java => RequiredFieldAnnotationUnitTest.java} (58%) diff --git a/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java index 8781101613..e2d171b1b0 100644 --- a/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java +++ b/lombok/src/main/java/com/baeldung/lombok/builder/RequiredFieldAnnotation.java @@ -8,7 +8,8 @@ import lombok.NonNull; @Getter public class RequiredFieldAnnotation { - @NonNull String name; + @NonNull + String name; String description; public static RequiredFieldAnnotationBuilder builder(String name) { diff --git a/lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationTest.java b/lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationUnitTest.java similarity index 58% rename from lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationTest.java rename to lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationUnitTest.java index 9d347327d4..ee5c3b19aa 100644 --- a/lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationTest.java +++ b/lombok/src/test/java/com/baeldung/lombok/builder/RequiredFieldAnnotationUnitTest.java @@ -1,21 +1,21 @@ package com.baeldung.lombok.builder; +import org.junit.Before; import org.junit.Test; -import org.junit.jupiter.api.BeforeEach; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; -public class RequiredFieldAnnotationTest { +public class RequiredFieldAnnotationUnitTest { RequiredFieldAnnotation requiredFieldTest; - @BeforeEach - void setUp() { + @Before + public void setUp() { requiredFieldTest = RequiredFieldAnnotation.builder("NameField").description("Field Description").build(); } @Test public void givenBuilderWithRequiredParameter_thenParameterIsPresent() { - assertEquals(requiredFieldTest.getName(), "NameField"); + assertEquals("NameField", requiredFieldTest.getName()); } } \ No newline at end of file From c4d98a65967f8ada147e327116a177e2c86ac945 Mon Sep 17 00:00:00 2001 From: akeshri Date: Sun, 20 Sep 2020 15:25:29 +0530 Subject: [PATCH 0782/1862] changes --- .../collections/mapfirstpair/MapFirstPairUnitTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java index b25e0932d8..8272e7323a 100644 --- a/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java +++ b/core-java-modules/core-java-collections-3/src/test/java/com/baeldung/collections/mapfirstpair/MapFirstPairUnitTest.java @@ -15,21 +15,24 @@ import org.junit.Test; public class MapFirstPairUnitTest { private Map.Entry getFirstPairUsingIterator(Map map) { - if (map == null || map.size() == 0) + if (map == null || map.size() == 0) { return null; + } Iterator> iterator = map.entrySet() .iterator(); - if (iterator.hasNext()) + if (iterator.hasNext()) { return iterator.next(); + } return null; } private Map.Entry getFirstPairUsingStream(Map map) { - if (map == null || map.size() == 0) + if (map == null || map.size() == 0) { return null; + } Set> entrySet = map.entrySet(); From 599a6c45fc064011d3ea3ff1b12118a8cad1a81a Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 20 Sep 2020 15:58:04 +0530 Subject: [PATCH 0783/1862] fixing build issue --- maven-modules/maven-plugins/custom-rule/pom.xml | 13 +++++++++++++ maven-modules/maven-plugins/pom.xml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/maven-modules/maven-plugins/custom-rule/pom.xml b/maven-modules/maven-plugins/custom-rule/pom.xml index 0fb551e71b..075a5c7943 100644 --- a/maven-modules/maven-plugins/custom-rule/pom.xml +++ b/maven-modules/maven-plugins/custom-rule/pom.xml @@ -51,4 +51,17 @@ 1.0-alpha-9 + + + + maven-verifier-plugin + ${maven.verifier.version} + + ../input-resources/verifications.xml + false + + + + + diff --git a/maven-modules/maven-plugins/pom.xml b/maven-modules/maven-plugins/pom.xml index 4877f00a92..9f28871ec0 100644 --- a/maven-modules/maven-plugins/pom.xml +++ b/maven-modules/maven-plugins/pom.xml @@ -15,7 +15,7 @@ - + custom-rule maven-enforcer From 4503d5c3f7eba623a416be58c523ed5f6bd972fa Mon Sep 17 00:00:00 2001 From: Cristian Rosu Date: Sun, 20 Sep 2020 19:57:43 +0300 Subject: [PATCH 0784/1862] BAEL-4415 get a list of trusted certificates in Java --- .../certificates/CertificatesUnitTest.java | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 core-java-modules/core-java-security-2/src/test/java/certificates/CertificatesUnitTest.java diff --git a/core-java-modules/core-java-security-2/src/test/java/certificates/CertificatesUnitTest.java b/core-java-modules/core-java-security-2/src/test/java/certificates/CertificatesUnitTest.java new file mode 100644 index 0000000000..a631df086b --- /dev/null +++ b/core-java-modules/core-java-security-2/src/test/java/certificates/CertificatesUnitTest.java @@ -0,0 +1,94 @@ +package certificates; + +import org.junit.jupiter.api.Test; + +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.PKIXParameters; +import java.security.cert.TrustAnchor; +import java.security.cert.X509Certificate; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class CertificatesUnitTest { + + private static final String GODADDY_CA_ALIAS = "godaddyrootg2ca [jdk]"; + + @Test + public void whenLoadingCacertsKeyStore_thenCertificatesArePresent() throws Exception { + KeyStore keyStore = loadKeyStore(); + PKIXParameters params = new PKIXParameters(keyStore); + + Set trustAnchors = params.getTrustAnchors(); + List certificates = trustAnchors.stream() + .map(TrustAnchor::getTrustedCert) + .collect(Collectors.toList()); + + assertFalse(certificates.isEmpty()); + } + + @Test + public void whenLoadingDefaultKeyStore_thenCertificatesArePresent() throws Exception { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + trustManagerFactory.init((KeyStore)null); + + List trustManagers = Arrays.asList(trustManagerFactory.getTrustManagers()); + List certificates = trustManagers.stream() + .filter(X509TrustManager.class::isInstance) + .map(X509TrustManager.class::cast) + .map(trustManager -> Arrays.asList(trustManager.getAcceptedIssuers())) + .flatMap(Collection::stream) + .collect(Collectors.toList()); + + assertFalse(certificates.isEmpty()); + } + + @Test + public void whenLoadingKeyStore_thenGoDaddyCALabelIsPresent() throws Exception { + KeyStore keyStore = loadKeyStore(); + + Enumeration aliasEnumeration = keyStore.aliases(); + List aliases = Collections.list(aliasEnumeration); + + assertTrue(aliases.contains(GODADDY_CA_ALIAS)); + } + + @Test + public void whenLoadingKeyStore_thenGoDaddyCertificateIsPresent() throws Exception { + KeyStore keyStore = loadKeyStore(); + + Certificate goDaddyCertificate = keyStore.getCertificate(GODADDY_CA_ALIAS); + + assertNotNull(goDaddyCertificate); + } + + private KeyStore loadKeyStore() throws CertificateException, NoSuchAlgorithmException, IOException, KeyStoreException { + String relativeCacertsPath = "/lib/security/cacerts".replace("/", File.separator); + String filename = System.getProperty("java.home") + relativeCacertsPath; + FileInputStream is = new FileInputStream(filename); + + KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); + String password = "changeit"; + keystore.load(is, password.toCharArray()); + + return keystore; + } +} From 5d29ae5bbd34949076a332fae458199c995f8530 Mon Sep 17 00:00:00 2001 From: azhwani <> Date: Mon, 21 Sep 2020 11:16:03 +0100 Subject: [PATCH 0785/1862] first commit --- .../lastmodifiedfile/LastModifiedFileApp.java | 61 ++++++++++++++++ .../LastModifiedFileAppUnitTest.java | 72 +++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 core-java-modules/core-java-io-3/src/main/java/com/baeldung/lastmodifiedfile/LastModifiedFileApp.java create mode 100644 core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java diff --git a/core-java-modules/core-java-io-3/src/main/java/com/baeldung/lastmodifiedfile/LastModifiedFileApp.java b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/lastmodifiedfile/LastModifiedFileApp.java new file mode 100644 index 0000000000..d2aace184f --- /dev/null +++ b/core-java-modules/core-java-io-3/src/main/java/com/baeldung/lastmodifiedfile/LastModifiedFileApp.java @@ -0,0 +1,61 @@ +package com.baeldung.lastmodifiedfile; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.Optional; + +import org.apache.commons.io.comparator.LastModifiedFileComparator; +import org.apache.commons.io.filefilter.FileFilterUtils; + +public class LastModifiedFileApp { + + public static File findUsingIOApi(String sdir) { + File dir = new File(sdir); + if (dir.isDirectory()) { + Optional opFile = Arrays.stream(dir.listFiles(File::isFile)) + .max((f1, f2) -> Long.compare(f1.lastModified(), f2.lastModified())); + + if (opFile.isPresent()) { + return opFile.get(); + } + } + + return null; + } + + public static Path findUsingNIOApi(String sdir) throws IOException { + Path dir = Paths.get(sdir); + if (Files.isDirectory(dir)) { + Optional opPath = Files.list(dir) + .filter(p -> !Files.isDirectory(p)) + .sorted((p1, p2) -> Long.valueOf(p2.toFile().lastModified()) + .compareTo(p1.toFile().lastModified())) + .findFirst(); + + if (opPath.isPresent()) { + return opPath.get(); + } + } + + return null; + } + + public static File findUsingCommonsIO(String sdir) { + File dir = new File(sdir); + if (dir.isDirectory()) { + File[] dirFiles = dir.listFiles((FileFilter) FileFilterUtils.fileFileFilter()); + if (dirFiles != null && dirFiles.length > 0) { + Arrays.sort(dirFiles, LastModifiedFileComparator.LASTMODIFIED_REVERSE); + return dirFiles[0]; + } + } + + return null; + } + +} diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java new file mode 100644 index 0000000000..4e1f7719a9 --- /dev/null +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java @@ -0,0 +1,72 @@ +package com.baeldung.lastmodifiedfile; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +public class LastModifiedFileAppUnitTest { + + private final static String SOURCEDIRECTORY = "src/test/resources/lastmodfiles"; + + @BeforeAll + public static void setUpFiles() throws IOException, InterruptedException { + File srcDir = new File(SOURCEDIRECTORY); + if (!srcDir.exists()) { + srcDir.mkdir(); + } + + FileUtils.cleanDirectory(srcDir); + + File file01 = new File(SOURCEDIRECTORY + "/file01.txt"); + file01.createNewFile(); + + Thread.sleep(2000); + + File file02 = new File(SOURCEDIRECTORY + "/file02.txt"); + file02.createNewFile(); + + Thread.sleep(2000); + + File file03 = new File(SOURCEDIRECTORY + "/file03.txt"); + file03.createNewFile(); + + Thread.sleep(2000); + + Files.write(Paths.get(SOURCEDIRECTORY + "/file02.txt"), "Hello File02".getBytes()); + + } + + @Test + public void givenDirectory_whenUsingIoApi_thenFindLastModfile() throws IOException { + File lastModFile = LastModifiedFileApp.findUsingIOApi(SOURCEDIRECTORY); + + assertThat(lastModFile).isNotNull(); + assertThat(lastModFile.getName()).isEqualTo("file02.txt"); + } + + @Test + public void givenDirectory_whenUsingNioApi_thenFindLastModfile() throws IOException { + Path lastModPath = LastModifiedFileApp.findUsingNIOApi(SOURCEDIRECTORY); + + assertThat(lastModPath).isNotNull(); + assertThat(lastModPath.toFile() + .getName()).isEqualTo("file02.txt"); + } + + @Test + public void givenDirectory_whenUsingApacheCommons_thenFindLastModfile() throws IOException { + File lastModFile = LastModifiedFileApp.findUsingCommonsIO(SOURCEDIRECTORY); + + assertThat(lastModFile).isNotNull(); + assertThat(lastModFile.getName()).isEqualTo("file02.txt"); + } + +} \ No newline at end of file From fd9e75c6e22bfb0666d3e1bf7dfdaf380f151d74 Mon Sep 17 00:00:00 2001 From: Reza Ebrahimpour Date: Mon, 21 Sep 2020 21:48:18 +0330 Subject: [PATCH 0786/1862] BAEL-4488 Fix indents --- .../com/baeldung/cipher/AvailableCiphersUnitTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core-java-modules/core-java-security-2/src/test/java/com/baeldung/cipher/AvailableCiphersUnitTest.java b/core-java-modules/core-java-security-2/src/test/java/com/baeldung/cipher/AvailableCiphersUnitTest.java index 48aaa5fb67..fa38aca272 100644 --- a/core-java-modules/core-java-security-2/src/test/java/com/baeldung/cipher/AvailableCiphersUnitTest.java +++ b/core-java-modules/core-java-security-2/src/test/java/com/baeldung/cipher/AvailableCiphersUnitTest.java @@ -25,10 +25,10 @@ public class AvailableCiphersUnitTest { @Test public void whenGetServicesWithFilter_thenGetAllCompatibleCipherAlgorithms() { List algorithms = Arrays.stream(Security.getProviders()) - .flatMap(provider -> provider.getServices().stream()) - .filter(service -> "Cipher".equals(service.getType())) - .map(Provider.Service::getAlgorithm) - .collect(Collectors.toList()); + .flatMap(provider -> provider.getServices().stream()) + .filter(service -> "Cipher".equals(service.getType())) + .map(Provider.Service::getAlgorithm) + .collect(Collectors.toList()); algorithms.forEach(logger::info); } From dda9d0fb67378372101a026ba2d0657044337d3a Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 21 Sep 2020 20:53:16 +0200 Subject: [PATCH 0787/1862] JAVA-2901: Fix failing int tests in spring-mvc-basics-4 --- .../src/main/java/com/baeldung/controller/config/WebConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-basics-4/src/main/java/com/baeldung/controller/config/WebConfig.java b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/config/WebConfig.java index 6e79ac0aad..364f042ac7 100644 --- a/spring-mvc-basics-4/src/main/java/com/baeldung/controller/config/WebConfig.java +++ b/spring-mvc-basics-4/src/main/java/com/baeldung/controller/config/WebConfig.java @@ -11,7 +11,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @EnableWebMvc -@ComponentScan(basePackages = { "com.baeldung.controller.controller", "com.baeldung.controller", "com.baeldung.controller.config" }) +@ComponentScan(basePackages = { "com.baeldung.controller", "com.baeldung.optionalpathvars" }) public class WebConfig implements WebMvcConfigurer { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { From d51a8319c6f4946346666367ad6d5177114a7efb Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Mon, 21 Sep 2020 21:15:03 +0200 Subject: [PATCH 0788/1862] JAVA-2977: Get rid of the unused spring*boot* properties --- testing-modules/spring-testing-2/pom.xml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testing-modules/spring-testing-2/pom.xml b/testing-modules/spring-testing-2/pom.xml index c7ca2804fb..807b84c676 100644 --- a/testing-modules/spring-testing-2/pom.xml +++ b/testing-modules/spring-testing-2/pom.xml @@ -27,6 +27,12 @@ spring-boot-starter-data-jpa + + com.h2database + h2 + ${h2.version} + + org.postgresql postgresql @@ -50,8 +56,6 @@ - 2.1.9.RELEASE - 2.1.9.RELEASE 1.12.2 \ No newline at end of file From 025791611ca8b731415629d18f2b21d539472a9f Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Mon, 21 Sep 2020 20:31:14 +0100 Subject: [PATCH 0789/1862] Added feedback from pull request. --- json/README.md | 1 - .../JsonOptimizationUnitTest.java | 64 +++++++++---------- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/json/README.md b/json/README.md index cfee611f4a..0e50dcfddb 100644 --- a/json/README.md +++ b/json/README.md @@ -13,4 +13,3 @@ This module contains articles about JSON. - [Get a Value by Key in a JSONArray](https://www.baeldung.com/java-jsonarray-get-value-by-key) - [Iterating Over an Instance of org.json.JSONObject](https://www.baeldung.com/jsonobject-iteration) - [Escape JSON String in Java](https://www.baeldung.com/java-json-escaping) -- [Reducing JSON Data Size](https://www.baeldung.com/reducing-json-data-size) diff --git a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java index 5734518fad..7a56a68fe2 100644 --- a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java +++ b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java @@ -22,11 +22,11 @@ import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.databind.module.SimpleModule; class JsonOptimizationUnitTest { - private static final String TEST_LABEL_DEFAULT_JSON = "Default JSON"; + private static final String TEST_LABEL_JACKSON_DEFAULT_OPTIONS = "Default JSON"; private static final String TEST_LABEL_DEFAULT_JSON_NO_NULL = "Default JSON without null"; - private static final String TEST_LABEL_SHORT_NAMES = "Shorter field names"; - private static final String TEST_LABEL_SHORT_NAMES_NO_NULL = "Shorter field names without null"; - private static final String TEST_LABEL_CUSTOM_SERIALIZER = "Custom serializer"; + private static final String TEST_LABEL_SHORTER_FIELD_NAMES = "Shorter field names"; + private static final String TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL = "Shorter field names without null"; + private static final String TEST_LABEL_SERIALIZING_TO_ARRAY = "Custom serializer"; private static final String TEST_LABEL_SLIM_CUSTOM_SERIALIZER = "Slim custom serializer"; private static final String TEST_LABEL_SLIM_CUSTOMER = "Slim customer"; private static final String TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES = "Slim customer with shorter field names"; @@ -53,82 +53,80 @@ class JsonOptimizationUnitTest { } @Test - void testSetUp() { + void whenSetUp_ThenOneThousandCustomers() { assertEquals(1000, customers.length, "There should be a 1000 customers"); } @Test - void testDefaultJson() throws IOException { - printBanner(TEST_LABEL_DEFAULT_JSON); - byte[] plainJson = createPlainJson(TEST_LABEL_DEFAULT_JSON, customers); - compressJson(TEST_LABEL_DEFAULT_JSON, plainJson); + void whenJacksonDefaultOptions_thenValid() throws IOException { + printBanner(TEST_LABEL_JACKSON_DEFAULT_OPTIONS); + byte[] plainJson = createJsonAndVerify(TEST_LABEL_JACKSON_DEFAULT_OPTIONS, customers); + compressJson(TEST_LABEL_JACKSON_DEFAULT_OPTIONS, plainJson); } @Test - void testDefaultNoNull() throws IOException { + void whenExcludingNull_thenValid() throws IOException { printBanner(TEST_LABEL_DEFAULT_JSON_NO_NULL); mapper.setSerializationInclusion(Include.NON_NULL); - byte[] plainJson = createPlainJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, customers); + byte[] plainJson = createJsonAndVerify(TEST_LABEL_DEFAULT_JSON_NO_NULL, customers); compressJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, plainJson); } @Test - void testShortNames() throws IOException { - printBanner(TEST_LABEL_SHORT_NAMES); + void whenShorterFieldNames_thenValid() throws IOException { + printBanner(TEST_LABEL_SHORTER_FIELD_NAMES); CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); - byte[] shorterJson = createPlainJson(TEST_LABEL_SHORT_NAMES, shorterOnes); - compressJson(TEST_LABEL_SHORT_NAMES, shorterJson); + byte[] shorterJson = createJsonAndVerify(TEST_LABEL_SHORTER_FIELD_NAMES, shorterOnes); + compressJson(TEST_LABEL_SHORTER_FIELD_NAMES, shorterJson); } @Test - void testShortNamesNoNull() throws IOException { - printBanner(TEST_LABEL_SHORT_NAMES_NO_NULL); + void whenShorterFieldNamesAndExcludingNull_thenValid() throws IOException { + printBanner(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL); CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); mapper.setSerializationInclusion(Include.NON_NULL); - byte[] shorterJson = createPlainJson(TEST_LABEL_SHORT_NAMES_NO_NULL, shorterOnes); - compressJson(TEST_LABEL_SHORT_NAMES_NO_NULL, shorterJson); + byte[] shorterJson = createJsonAndVerify(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL, shorterOnes); + compressJson(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL, shorterJson); } @Test - void testSlim() throws IOException { + void whenSlimCustomer_thenValid() throws IOException { printBanner(TEST_LABEL_SLIM_CUSTOMER); CustomerSlim[] slimOnes = CustomerSlim.fromCustomers(customers); - byte[] slimJson = createPlainJson(TEST_LABEL_SLIM_CUSTOMER, slimOnes); + byte[] slimJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOMER, slimOnes); compressJson(TEST_LABEL_SLIM_CUSTOMER, slimJson); } @Test - void testSlimShortNames() throws IOException { + void whenSlimCustomerAndShorterFieldNames_thenValid() throws IOException { printBanner(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES); CustomerSlimShortNames[] slimOnes = CustomerSlimShortNames.fromCustomers(customers); - byte[] slimJson = createPlainJson(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimOnes); + byte[] slimJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimOnes); compressJson(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimJson); } @Test - void testCustomSerializer() throws IOException { - printBanner(TEST_LABEL_CUSTOM_SERIALIZER); - + void whenSerializingToArray_thenValid() throws IOException { + printBanner(TEST_LABEL_SERIALIZING_TO_ARRAY); SimpleModule serializer = new SimpleModule("CustomDeSerializer", new Version(1, 0, 0, null, null, null)); serializer.addSerializer(Customer.class, new CustomerSerializer()); serializer.addDeserializer(Customer.class, new CustomerDeserializer()); mapper.registerModule(serializer); - byte[] plainJson = createPlainJson(TEST_LABEL_CUSTOM_SERIALIZER, customers); - compressJson(TEST_LABEL_CUSTOM_SERIALIZER, plainJson); + byte[] plainJson = createJsonAndVerify(TEST_LABEL_SERIALIZING_TO_ARRAY, customers); + compressJson(TEST_LABEL_SERIALIZING_TO_ARRAY, plainJson); } @Test - void testSlimCustomSerializer() throws IOException { + void whenSerializingToArrayAndSlimCustomer_thenValid() throws IOException { printBanner(TEST_LABEL_SLIM_CUSTOM_SERIALIZER); - SimpleModule serializer = new SimpleModule("SlimCustomDeSerializer", new Version(1, 0, 0, null, null, null)); serializer.addSerializer(CustomerSlim.class, new CustomerSlimSerializer()); serializer.addDeserializer(CustomerSlim.class, new CustomerSlimDeserializer()); mapper.registerModule(serializer); CustomerSlim[] slimOnes = CustomerSlim.fromCustomers(customers); - byte[] plainJson = createPlainJson(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, slimOnes); + byte[] plainJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, slimOnes); compressJson(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, plainJson); } @@ -153,7 +151,7 @@ class JsonOptimizationUnitTest { assertTrue(plainJson.length > gzippedJson.length, label + " should be longer than GZIPped data"); } - private byte[] createPlainJson(String label, Object[] customers) throws IOException { + private byte[] createJsonAndVerify(String label, Object[] customers) throws IOException { System.out.println(label + " sample: "); ObjectWriter prettyWritter = mapper.writerWithDefaultPrettyPrinter(); System.out.println(prettyWritter.writeValueAsString(customers[0])); @@ -174,7 +172,7 @@ class JsonOptimizationUnitTest { System.out.println(label + " file: " + tempFile.toString()); Object[] restoredOnes = mapper.readValue(feedback, customers.getClass()); - assertArrayEquals(TEST_LABEL_DEFAULT_JSON + ": restoring from JSON should work", customers, restoredOnes); + assertArrayEquals(TEST_LABEL_JACKSON_DEFAULT_OPTIONS + ": restoring from JSON should work", customers, restoredOnes); return feedback; } From 65833e0a6b058151c6d6e98159a0f8e9974b03e3 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Mon, 21 Sep 2020 20:38:46 +0100 Subject: [PATCH 0790/1862] Moved code from "json" module. --- json-2/pom.xml | 37 + .../baeldung/jsonoptimization/Customer.java | 123 ++ .../CustomerDeserializer.java | 49 + .../jsonoptimization/CustomerSerializer.java | 34 + .../jsonoptimization/CustomerShortNames.java | 155 +++ .../jsonoptimization/CustomerSlim.java | 73 ++ .../CustomerSlimDeserializer.java | 37 + .../CustomerSlimSerializer.java | 28 + .../CustomerSlimShortNames.java | 81 ++ .../JsonOptimizationUnitTest.java | 180 +++ .../json_optimization_mock_data.json | 1000 +++++++++++++++++ 11 files changed, 1797 insertions(+) create mode 100644 json-2/src/main/java/com/baeldung/jsonoptimization/Customer.java create mode 100644 json-2/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java create mode 100644 json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java create mode 100644 json-2/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java create mode 100644 json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java create mode 100644 json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java create mode 100644 json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java create mode 100644 json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java create mode 100644 json-2/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java create mode 100644 json-2/src/test/resources/json_optimization_mock_data.json diff --git a/json-2/pom.xml b/json-2/pom.xml index f0215a375f..c5f11754f4 100644 --- a/json-2/pom.xml +++ b/json-2/pom.xml @@ -116,4 +116,41 @@ 1.9.2 3.9 + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-pmd-plugin + + + [3.13.0,) + + + check + + + + + + + + + + + + + diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/Customer.java b/json-2/src/main/java/com/baeldung/jsonoptimization/Customer.java new file mode 100644 index 0000000000..85451731e9 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonoptimization/Customer.java @@ -0,0 +1,123 @@ +package com.baeldung.jsonoptimization; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class Customer { + + private long id; + private String firstName; + private String lastName; + private String street; + private String postalCode; + private String city; + private String state; + private String phoneNumber; + private String email; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public int hashCode() { + return Objects.hash(city, email, firstName, id, lastName, phoneNumber, postalCode, state, street); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof Customer)) { + return false; + } + Customer other = (Customer) obj; + return Objects.equals(city, other.city) && Objects.equals(email, other.email) && Objects.equals(firstName, other.firstName) && id == other.id && Objects.equals(lastName, other.lastName) && Objects.equals(phoneNumber, other.phoneNumber) + && Objects.equals(postalCode, other.postalCode) && Objects.equals(state, other.state) && Objects.equals(street, other.street); + } + + @Override + public String toString() { + return "Customer [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", street=" + street + ", postalCode=" + postalCode + ", city=" + city + ", state=" + state + ", phoneNumber=" + phoneNumber + ", email=" + email + "]"; + } + + public static Customer[] fromMockFile() throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + InputStream jsonFile = new FileInputStream("src/test/resources/json_optimization_mock_data.json"); + Customer[] feedback = objectMapper.readValue(jsonFile, Customer[].class); + return feedback; + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java new file mode 100644 index 0000000000..16b66311ad --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java @@ -0,0 +1,49 @@ +package com.baeldung.jsonoptimization; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + +public class CustomerDeserializer extends StdDeserializer { + private static final long serialVersionUID = 1L; + + public CustomerDeserializer() { + this(null); + } + + public CustomerDeserializer(Class t) { + super(t); + } + + @Override + public Customer deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { + Customer feedback = new Customer(); + ObjectCodec codec = parser.getCodec(); + JsonNode node = codec.readTree(parser); + + feedback.setId(node.get(0) + .asLong()); + feedback.setFirstName(node.get(1) + .asText()); + feedback.setLastName(node.get(2) + .asText()); + feedback.setStreet(node.get(3) + .asText()); + feedback.setPostalCode(node.get(4) + .asText()); + feedback.setCity(node.get(5) + .asText()); + feedback.setState(node.get(6) + .asText()); + JsonNode phoneNumber = node.get(7); + feedback.setPhoneNumber(phoneNumber.isNull() ? null : phoneNumber.asText()); + JsonNode email = node.get(8); + feedback.setEmail(email.isNull() ? null : email.asText()); + + return feedback; + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java new file mode 100644 index 0000000000..0f631ee85b --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java @@ -0,0 +1,34 @@ +package com.baeldung.jsonoptimization; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class CustomerSerializer extends StdSerializer { + private static final long serialVersionUID = 1L; + + public CustomerSerializer() { + this(null); + } + + public CustomerSerializer(Class t) { + super(t); + } + + @Override + public void serialize(Customer customer, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { + jsonGenerator.writeStartArray(); + jsonGenerator.writeNumber(customer.getId()); + jsonGenerator.writeString(customer.getFirstName()); + jsonGenerator.writeString(customer.getLastName()); + jsonGenerator.writeString(customer.getStreet()); + jsonGenerator.writeString(customer.getPostalCode()); + jsonGenerator.writeString(customer.getCity()); + jsonGenerator.writeString(customer.getState()); + jsonGenerator.writeString(customer.getPhoneNumber()); + jsonGenerator.writeString(customer.getEmail()); + jsonGenerator.writeEndArray(); + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java new file mode 100644 index 0000000000..b94fbb1033 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java @@ -0,0 +1,155 @@ +package com.baeldung.jsonoptimization; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CustomerShortNames { + + @JsonProperty("i") + private long id; + + @JsonProperty("f") + private String firstName; + + @JsonProperty("l") + private String lastName; + + @JsonProperty("s") + private String street; + + @JsonProperty("p") + private String postalCode; + + @JsonProperty("c") + private String city; + + @JsonProperty("a") + private String state; + + @JsonProperty("o") + private String phoneNumber; + + @JsonProperty("e") + private String email; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getStreet() { + return street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getPostalCode() { + return postalCode; + } + + public void setPostalCode(String postalCode) { + this.postalCode = postalCode; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public int hashCode() { + return Objects.hash(city, email, firstName, id, lastName, phoneNumber, postalCode, state, street); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CustomerShortNames)) { + return false; + } + CustomerShortNames other = (CustomerShortNames) obj; + return Objects.equals(city, other.city) && Objects.equals(email, other.email) && Objects.equals(firstName, other.firstName) && id == other.id && Objects.equals(lastName, other.lastName) && Objects.equals(phoneNumber, other.phoneNumber) + && Objects.equals(postalCode, other.postalCode) && Objects.equals(state, other.state) && Objects.equals(street, other.street); + } + + @Override + public String toString() { + return "CustomerWithShorterAttributes [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", street=" + street + ", postalCode=" + postalCode + ", city=" + city + ", state=" + state + ", phoneNumber=" + phoneNumber + ", email=" + email + + "]"; + } + + public static CustomerShortNames[] fromCustomers(Customer[] customers) { + CustomerShortNames[] feedback = new CustomerShortNames[customers.length]; + + for (int i = 0; i < customers.length; i++) { + Customer aCustomer = customers[i]; + CustomerShortNames newOne = new CustomerShortNames(); + + newOne.setId(aCustomer.getId()); + newOne.setFirstName(aCustomer.getFirstName()); + newOne.setLastName(aCustomer.getLastName()); + newOne.setStreet(aCustomer.getStreet()); + newOne.setCity(aCustomer.getCity()); + newOne.setPostalCode(aCustomer.getPostalCode()); + newOne.setState(aCustomer.getState()); + newOne.setPhoneNumber(aCustomer.getPhoneNumber()); + newOne.setEmail(aCustomer.getEmail()); + + feedback[i] = newOne; + } + + return feedback; + } + +} diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java new file mode 100644 index 0000000000..e2ef4664cf --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java @@ -0,0 +1,73 @@ +package com.baeldung.jsonoptimization; + +import java.util.Objects; + +public class CustomerSlim { + private long id; + private String name; + private String address; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public int hashCode() { + return Objects.hash(address, id, name); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CustomerSlim)) { + return false; + } + CustomerSlim other = (CustomerSlim) obj; + return Objects.equals(address, other.address) && id == other.id && Objects.equals(name, other.name); + } + + @Override + public String toString() { + return "CustomerSlim [id=" + id + ", name=" + name + ", address=" + address + "]"; + } + + public static CustomerSlim[] fromCustomers(Customer[] customers) { + CustomerSlim[] feedback = new CustomerSlim[customers.length]; + + for (int i = 0; i < customers.length; i++) { + Customer aCustomer = customers[i]; + CustomerSlim newOne = new CustomerSlim(); + + newOne.setId(aCustomer.getId()); + newOne.setName(aCustomer.getFirstName() + " " + aCustomer.getLastName()); + newOne.setAddress(aCustomer.getStreet() + ", " + aCustomer.getCity() + " " + aCustomer.getState() + " " + aCustomer.getPostalCode()); + + feedback[i] = newOne; + } + + return feedback; + } + +} diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java new file mode 100644 index 0000000000..296ee6fdf6 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java @@ -0,0 +1,37 @@ +package com.baeldung.jsonoptimization; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + +public class CustomerSlimDeserializer extends StdDeserializer { + private static final long serialVersionUID = 1L; + + public CustomerSlimDeserializer() { + this(null); + } + + public CustomerSlimDeserializer(Class t) { + super(t); + } + + @Override + public CustomerSlim deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { + CustomerSlim feedback = new CustomerSlim(); + ObjectCodec codec = parser.getCodec(); + JsonNode node = codec.readTree(parser); + + feedback.setId(node.get(0) + .asLong()); + feedback.setName(node.get(1) + .asText()); + feedback.setAddress(node.get(2) + .asText()); + + return feedback; + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java new file mode 100644 index 0000000000..520c541da6 --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java @@ -0,0 +1,28 @@ +package com.baeldung.jsonoptimization; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; + +public class CustomerSlimSerializer extends StdSerializer { + private static final long serialVersionUID = 1L; + + public CustomerSlimSerializer() { + this(null); + } + + public CustomerSlimSerializer(Class t) { + super(t); + } + + @Override + public void serialize(CustomerSlim customer, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { + jsonGenerator.writeStartArray(); + jsonGenerator.writeNumber(customer.getId()); + jsonGenerator.writeString(customer.getName()); + jsonGenerator.writeString(customer.getAddress()); + jsonGenerator.writeEndArray(); + } +} diff --git a/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java new file mode 100644 index 0000000000..bf00e847ac --- /dev/null +++ b/json-2/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java @@ -0,0 +1,81 @@ +package com.baeldung.jsonoptimization; + +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CustomerSlimShortNames { + + @JsonProperty("i") + private long id; + + @JsonProperty("n") + private String name; + + @JsonProperty("a") + private String address; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public int hashCode() { + return Objects.hash(address, id, name); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof CustomerSlimShortNames)) { + return false; + } + CustomerSlimShortNames other = (CustomerSlimShortNames) obj; + return Objects.equals(address, other.address) && id == other.id && Objects.equals(name, other.name); + } + + @Override + public String toString() { + return "CustomerSlim [id=" + id + ", name=" + name + ", address=" + address + "]"; + } + + public static CustomerSlimShortNames[] fromCustomers(Customer[] customers) { + CustomerSlimShortNames[] feedback = new CustomerSlimShortNames[customers.length]; + + for (int i = 0; i < customers.length; i++) { + Customer aCustomer = customers[i]; + CustomerSlimShortNames newOne = new CustomerSlimShortNames(); + + newOne.setId(aCustomer.getId()); + newOne.setName(aCustomer.getFirstName() + " " + aCustomer.getLastName()); + newOne.setAddress(aCustomer.getStreet() + ", " + aCustomer.getCity() + " " + aCustomer.getState() + " " + aCustomer.getPostalCode()); + + feedback[i] = newOne; + } + + return feedback; + } + +} diff --git a/json-2/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json-2/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java new file mode 100644 index 0000000000..7a56a68fe2 --- /dev/null +++ b/json-2/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java @@ -0,0 +1,180 @@ +package com.baeldung.jsonoptimization; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.DecimalFormat; +import java.util.zip.GZIPOutputStream; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.module.SimpleModule; + +class JsonOptimizationUnitTest { + private static final String TEST_LABEL_JACKSON_DEFAULT_OPTIONS = "Default JSON"; + private static final String TEST_LABEL_DEFAULT_JSON_NO_NULL = "Default JSON without null"; + private static final String TEST_LABEL_SHORTER_FIELD_NAMES = "Shorter field names"; + private static final String TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL = "Shorter field names without null"; + private static final String TEST_LABEL_SERIALIZING_TO_ARRAY = "Custom serializer"; + private static final String TEST_LABEL_SLIM_CUSTOM_SERIALIZER = "Slim custom serializer"; + private static final String TEST_LABEL_SLIM_CUSTOMER = "Slim customer"; + private static final String TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES = "Slim customer with shorter field names"; + private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###.0"); + private static DecimalFormat PERCENT_FORMATTER = new DecimalFormat("###.0"); + private static Customer[] customers; + private ObjectMapper mapper; + private static int defaultJsonLength; + + @BeforeAll + static void setUpOnce() throws Exception { + customers = Customer.fromMockFile(); + ObjectMapper oneTimeMapper = new ObjectMapper(); + byte[] feedback = oneTimeMapper.writeValueAsBytes(customers); + defaultJsonLength = feedback.length; + System.out.println(); + System.out.println("Default JSON length: " + defaultJsonLength); + System.out.println(); + } + + @BeforeEach + void setUp() { + mapper = new ObjectMapper(); + } + + @Test + void whenSetUp_ThenOneThousandCustomers() { + assertEquals(1000, customers.length, "There should be a 1000 customers"); + } + + @Test + void whenJacksonDefaultOptions_thenValid() throws IOException { + printBanner(TEST_LABEL_JACKSON_DEFAULT_OPTIONS); + byte[] plainJson = createJsonAndVerify(TEST_LABEL_JACKSON_DEFAULT_OPTIONS, customers); + compressJson(TEST_LABEL_JACKSON_DEFAULT_OPTIONS, plainJson); + } + + @Test + void whenExcludingNull_thenValid() throws IOException { + printBanner(TEST_LABEL_DEFAULT_JSON_NO_NULL); + mapper.setSerializationInclusion(Include.NON_NULL); + byte[] plainJson = createJsonAndVerify(TEST_LABEL_DEFAULT_JSON_NO_NULL, customers); + compressJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, plainJson); + } + + @Test + void whenShorterFieldNames_thenValid() throws IOException { + printBanner(TEST_LABEL_SHORTER_FIELD_NAMES); + CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); + byte[] shorterJson = createJsonAndVerify(TEST_LABEL_SHORTER_FIELD_NAMES, shorterOnes); + compressJson(TEST_LABEL_SHORTER_FIELD_NAMES, shorterJson); + } + + @Test + void whenShorterFieldNamesAndExcludingNull_thenValid() throws IOException { + printBanner(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL); + CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); + mapper.setSerializationInclusion(Include.NON_NULL); + byte[] shorterJson = createJsonAndVerify(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL, shorterOnes); + compressJson(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL, shorterJson); + } + + @Test + void whenSlimCustomer_thenValid() throws IOException { + printBanner(TEST_LABEL_SLIM_CUSTOMER); + CustomerSlim[] slimOnes = CustomerSlim.fromCustomers(customers); + byte[] slimJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOMER, slimOnes); + compressJson(TEST_LABEL_SLIM_CUSTOMER, slimJson); + } + + @Test + void whenSlimCustomerAndShorterFieldNames_thenValid() throws IOException { + printBanner(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES); + CustomerSlimShortNames[] slimOnes = CustomerSlimShortNames.fromCustomers(customers); + byte[] slimJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimOnes); + compressJson(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimJson); + } + + @Test + void whenSerializingToArray_thenValid() throws IOException { + printBanner(TEST_LABEL_SERIALIZING_TO_ARRAY); + SimpleModule serializer = new SimpleModule("CustomDeSerializer", new Version(1, 0, 0, null, null, null)); + serializer.addSerializer(Customer.class, new CustomerSerializer()); + serializer.addDeserializer(Customer.class, new CustomerDeserializer()); + mapper.registerModule(serializer); + + byte[] plainJson = createJsonAndVerify(TEST_LABEL_SERIALIZING_TO_ARRAY, customers); + compressJson(TEST_LABEL_SERIALIZING_TO_ARRAY, plainJson); + } + + @Test + void whenSerializingToArrayAndSlimCustomer_thenValid() throws IOException { + printBanner(TEST_LABEL_SLIM_CUSTOM_SERIALIZER); + SimpleModule serializer = new SimpleModule("SlimCustomDeSerializer", new Version(1, 0, 0, null, null, null)); + serializer.addSerializer(CustomerSlim.class, new CustomerSlimSerializer()); + serializer.addDeserializer(CustomerSlim.class, new CustomerSlimDeserializer()); + mapper.registerModule(serializer); + + CustomerSlim[] slimOnes = CustomerSlim.fromCustomers(customers); + byte[] plainJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, slimOnes); + compressJson(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, plainJson); + } + + private void printBanner(String name) { + System.out.println(); + System.out.println("************************************************"); + System.out.println("Testing " + name); + System.out.println(); + } + + void compressJson(String label, byte[] plainJson) throws IOException { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + GZIPOutputStream gzipStream = new GZIPOutputStream(outputStream); + gzipStream.write(plainJson); + gzipStream.close(); + outputStream.close(); + byte[] gzippedJson = outputStream.toByteArray(); + double length = gzippedJson.length / 1024d; + double percent = gzippedJson.length * 100d / defaultJsonLength; + System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(length) + + "kB (" + PERCENT_FORMATTER.format(percent) + "%)"); + assertTrue(plainJson.length > gzippedJson.length, label + " should be longer than GZIPped data"); + } + + private byte[] createJsonAndVerify(String label, Object[] customers) throws IOException { + System.out.println(label + " sample: "); + ObjectWriter prettyWritter = mapper.writerWithDefaultPrettyPrinter(); + System.out.println(prettyWritter.writeValueAsString(customers[0])); + + byte[] feedback = mapper.writeValueAsBytes(customers); + double length = feedback.length / 1024d; + double percent = feedback.length * 100d / defaultJsonLength; + System.out.println(label + " length: " + LENGTH_FORMATTER.format(length) + + "kB (" + PERCENT_FORMATTER.format(percent) + "%)"); + assertTrue(feedback.length > 1, label + " should be there"); + + String prefix = label.replaceAll(" ", "-") + .toLowerCase(); + File tempFile = File.createTempFile("jon-optimization-" + prefix, ".json"); + FileOutputStream fos = new FileOutputStream(tempFile); + fos.write(feedback); + fos.close(); + System.out.println(label + " file: " + tempFile.toString()); + + Object[] restoredOnes = mapper.readValue(feedback, customers.getClass()); + assertArrayEquals(TEST_LABEL_JACKSON_DEFAULT_OPTIONS + ": restoring from JSON should work", customers, restoredOnes); + + return feedback; + } + +} diff --git a/json-2/src/test/resources/json_optimization_mock_data.json b/json-2/src/test/resources/json_optimization_mock_data.json new file mode 100644 index 0000000000..e09517cf61 --- /dev/null +++ b/json-2/src/test/resources/json_optimization_mock_data.json @@ -0,0 +1,1000 @@ +[{"id":1,"firstName":"Horatius","lastName":"Strognell","street":"4848 New Castle Point","postalCode":"33432","city":"Boca Raton","state":"FL","phoneNumber":"561-824-9105","email":"hstrognell0@dailymail.co.uk"}, +{"id":2,"firstName":"Kerri","lastName":"Arend","street":"4 Welch Pass","postalCode":"60669","city":"Chicago","state":"IL","phoneNumber":"312-303-5993"}, +{"id":3,"firstName":"Silvano","lastName":"Bartholomaus","street":"2491 Arkansas Center","postalCode":"30195","city":"Duluth","state":"GA","email":"sbartholomaus2@prlog.org"}, +{"id":4,"firstName":"Venita","lastName":"Burgoine","street":"63894 Sage Park","postalCode":"67215","city":"Wichita","state":"KS","email":"vburgoine3@telegraph.co.uk"}, +{"id":5,"firstName":"Meghan","lastName":"Westover","street":"76 Pleasure Way","postalCode":"77388","city":"Spring","state":"TX","phoneNumber":"832-926-0689","email":"mwestover4@cnn.com"}, +{"id":6,"firstName":"Mia","lastName":"Baversor","street":"50 Sommers Road","postalCode":"43204","city":"Columbus","state":"OH","email":"mbaversor5@wsj.com"}, +{"id":7,"firstName":"Winna","lastName":"Buggy","street":"05 Jenna Street","postalCode":"68144","city":"Omaha","state":"NE","phoneNumber":"402-740-7818"}, +{"id":8,"firstName":"Antonin","lastName":"Autrie","street":"9 Fieldstone Terrace","postalCode":"85754","city":"Tucson","state":"AZ"}, +{"id":9,"firstName":"Maddi","lastName":"Ollerearnshaw","street":"061 Crowley Trail","postalCode":"48335","city":"Farmington","state":"MI","phoneNumber":"248-709-8128"}, +{"id":10,"firstName":"Fawnia","lastName":"Cristofaro","street":"92571 Kinsman Alley","postalCode":"77271","city":"Houston","state":"TX","email":"fcristofaro9@ox.ac.uk"}, +{"id":11,"firstName":"Zachariah","lastName":"Rouby","street":"2439 Hudson Circle","postalCode":"25313","city":"Charleston","state":"WV","phoneNumber":"304-587-5444"}, +{"id":12,"firstName":"Brier","lastName":"Benech","street":"3144 Sutteridge Place","postalCode":"20380","city":"Washington","state":"DC","phoneNumber":"202-740-8851","email":"bbenechb@zdnet.com"}, +{"id":13,"firstName":"Merry","lastName":"Leming","street":"419 Kropf Terrace","postalCode":"45440","city":"Dayton","state":"OH","email":"mlemingc@ow.ly"}, +{"id":14,"firstName":"Audrey","lastName":"Dilleston","street":"61 Melrose Trail","postalCode":"97306","city":"Salem","state":"OR","phoneNumber":"503-480-6254"}, +{"id":15,"firstName":"De witt","lastName":"Kedge","street":"819 Kingsford Point","postalCode":"84135","city":"Salt Lake City","state":"UT"}, +{"id":16,"firstName":"Charita","lastName":"de Clerc","street":"42 Loftsgordon Hill","postalCode":"28289","city":"Charlotte","state":"NC","phoneNumber":"704-532-8850","email":"cdeclercf@comsenz.com"}, +{"id":17,"firstName":"Edgard","lastName":"Bloore","street":"1659 Donald Trail","postalCode":"20051","city":"Washington","state":"DC"}, +{"id":18,"firstName":"Kristi","lastName":"Richichi","street":"11306 Longview Hill","postalCode":"75372","city":"Dallas","state":"TX","email":"krichichih@cloudflare.com"}, +{"id":19,"firstName":"Denna","lastName":"Cornford","street":"4 Gale Junction","postalCode":"10014","city":"New York City","state":"NY","phoneNumber":"646-273-3067","email":"dcornfordi@ebay.co.uk"}, +{"id":20,"firstName":"Randall","lastName":"McQuaid","street":"55712 Stone Corner Circle","postalCode":"10203","city":"New York City","state":"NY","email":"rmcquaidj@facebook.com"}, +{"id":21,"firstName":"Kirbie","lastName":"Walczak","street":"9 Coleman Road","postalCode":"99252","city":"Spokane","state":"WA","email":"kwalczakk@spotify.com"}, +{"id":22,"firstName":"Zedekiah","lastName":"Westby","street":"9 Victoria Road","postalCode":"22093","city":"Ashburn","state":"VA","phoneNumber":"571-642-0111","email":"zwestbyl@ox.ac.uk"}, +{"id":23,"firstName":"Corri","lastName":"Snar","street":"4 Service Terrace","postalCode":"68517","city":"Lincoln","state":"NE","email":"csnarm@tinyurl.com"}, +{"id":24,"firstName":"Manny","lastName":"Marchington","street":"942 Westend Center","postalCode":"22119","city":"Merrifield","state":"VA","email":"mmarchingtonn@opensource.org"}, +{"id":25,"firstName":"Ashla","lastName":"Grigoroni","street":"755 Lerdahl Parkway","postalCode":"55423","city":"Minneapolis","state":"MN","phoneNumber":"612-797-7928","email":"agrigoronio@cam.ac.uk"}, +{"id":26,"firstName":"Rita","lastName":"Sharratt","street":"710 Buena Vista Avenue","postalCode":"40576","city":"Lexington","state":"KY","phoneNumber":"859-727-0697"}, +{"id":27,"firstName":"Karrie","lastName":"Crathorne","street":"02 Loeprich Place","postalCode":"39505","city":"Gulfport","state":"MS"}, +{"id":28,"firstName":"Lothario","lastName":"Merck","street":"46 Golden Leaf Park","postalCode":"35205","city":"Birmingham","state":"AL"}, +{"id":29,"firstName":"Renault","lastName":"Banister","street":"7 Garrison Plaza","postalCode":"85072","city":"Phoenix","state":"AZ"}, +{"id":30,"firstName":"Wanda","lastName":"Burkart","street":"10 Mendota Place","postalCode":"48258","city":"Detroit","state":"MI","phoneNumber":"248-870-5185","email":"wburkartt@wikipedia.org"}, +{"id":31,"firstName":"Maggy","lastName":"Timby","street":"37 Crest Line Center","postalCode":"50305","city":"Des Moines","state":"IA","email":"mtimbyu@cnbc.com"}, +{"id":32,"firstName":"Chet","lastName":"Origan","street":"767 Bashford Lane","postalCode":"30919","city":"Augusta","state":"GA","email":"coriganv@behance.net"}, +{"id":33,"firstName":"Jammie","lastName":"Aslie","street":"7174 Hoffman Circle","postalCode":"23464","city":"Virginia Beach","state":"VA"}, +{"id":34,"firstName":"Dill","lastName":"Kingdon","street":"75 Corben Crossing","postalCode":"33013","city":"Hialeah","state":"FL","email":"dkingdonx@ibm.com"}, +{"id":35,"firstName":"Berenice","lastName":"Blodget","street":"8 Eliot Junction","postalCode":"93907","city":"Salinas","state":"CA","email":"bblodgety@blogs.com"}, +{"id":36,"firstName":"Kimberley","lastName":"Streatley","street":"56 Welch Center","postalCode":"77070","city":"Houston","state":"TX"}, +{"id":37,"firstName":"Warde","lastName":"Woodwind","street":"773 Gerald Park","postalCode":"35295","city":"Birmingham","state":"AL","email":"wwoodwind10@wsj.com"}, +{"id":38,"firstName":"Husain","lastName":"Christofe","street":"35118 Forest Dale Avenue","postalCode":"10175","city":"New York City","state":"NY","phoneNumber":"212-611-7995","email":"hchristofe11@seesaa.net"}, +{"id":39,"firstName":"Gertrud","lastName":"Defraine","street":"568 Walton Way","postalCode":"37405","city":"Chattanooga","state":"TN","phoneNumber":"423-125-5719","email":"gdefraine12@xrea.com"}, +{"id":40,"firstName":"Yulma","lastName":"Ramshay","street":"9976 Iowa Drive","postalCode":"87121","city":"Albuquerque","state":"NM","phoneNumber":"505-914-5281"}, +{"id":41,"firstName":"Bride","lastName":"Amsberger","street":"3 Service Lane","postalCode":"28272","city":"Charlotte","state":"NC","email":"bamsberger14@forbes.com"}, +{"id":42,"firstName":"Kaiser","lastName":"Froud","street":"7 Starling Lane","postalCode":"99507","city":"Anchorage","state":"AK","email":"kfroud15@cloudflare.com"}, +{"id":43,"firstName":"Leona","lastName":"Sciusscietto","street":"06392 East Lane","postalCode":"60193","city":"Schaumburg","state":"IL","phoneNumber":"630-981-3986","email":"lsciusscietto16@mit.edu"}, +{"id":44,"firstName":"Sibel","lastName":"Ripsher","street":"8672 Bayside Road","postalCode":"32511","city":"Pensacola","state":"FL","phoneNumber":"850-975-6365","email":"sripsher17@sitemeter.com"}, +{"id":45,"firstName":"Megen","lastName":"Dymond","street":"0547 Harper Place","postalCode":"28220","city":"Charlotte","state":"NC","phoneNumber":"704-632-5850"}, +{"id":46,"firstName":"Vitoria","lastName":"Niese","street":"365 Colorado Plaza","postalCode":"15279","city":"Pittsburgh","state":"PA","phoneNumber":"412-864-8563"}, +{"id":47,"firstName":"Cherianne","lastName":"Daveran","street":"5 Esch Parkway","postalCode":"36104","city":"Montgomery","state":"AL","email":"cdaveran1a@ft.com"}, +{"id":48,"firstName":"Harriott","lastName":"Mallam","street":"9 Monterey Place","postalCode":"20215","city":"Washington","state":"DC","phoneNumber":"202-727-0645"}, +{"id":49,"firstName":"Jozef","lastName":"Stranger","street":"07 Warner Drive","postalCode":"84199","city":"Salt Lake City","state":"UT","phoneNumber":"801-741-5946"}, +{"id":50,"firstName":"Teena","lastName":"Broggio","street":"287 Luster Park","postalCode":"78285","city":"San Antonio","state":"TX","phoneNumber":"210-482-0822","email":"tbroggio1d@craigslist.org"}, +{"id":51,"firstName":"Robin","lastName":"Membry","street":"0736 Forest Dale Crossing","postalCode":"45408","city":"Dayton","state":"OH","phoneNumber":"937-335-4964","email":"rmembry1e@toplist.cz"}, +{"id":52,"firstName":"Holly","lastName":"Lowcock","street":"819 Aberg Pass","postalCode":"28815","city":"Asheville","state":"NC","email":"hlowcock1f@bbc.co.uk"}, +{"id":53,"firstName":"Shandee","lastName":"Blowick","street":"81600 Moose Lane","postalCode":"46867","city":"Fort Wayne","state":"IN","phoneNumber":"260-904-5622"}, +{"id":54,"firstName":"Chaim","lastName":"Stilliard","street":"91 Spohn Court","postalCode":"28305","city":"Fayetteville","state":"NC","phoneNumber":"910-721-3938"}, +{"id":55,"firstName":"Maximilien","lastName":"Purkis","street":"66997 Algoma Park","postalCode":"10150","city":"New York City","state":"NY","phoneNumber":"212-824-3363","email":"mpurkis1i@unblog.fr"}, +{"id":56,"firstName":"Ferguson","lastName":"Whiles","street":"0550 Bowman Street","postalCode":"33142","city":"Miami","state":"FL","phoneNumber":"786-416-2947","email":"fwhiles1j@artisteer.com"}, +{"id":57,"firstName":"Elena","lastName":"Poyle","street":"54 Warner Court","postalCode":"28055","city":"Gastonia","state":"NC","email":"epoyle1k@tripod.com"}, +{"id":58,"firstName":"Carney","lastName":"Pengilly","street":"050 Welch Junction","postalCode":"76147","city":"Fort Worth","state":"TX","phoneNumber":"817-525-7801","email":"cpengilly1l@yellowpages.com"}, +{"id":59,"firstName":"Krispin","lastName":"Pouck","street":"03554 Twin Pines Point","postalCode":"55551","city":"Young America","state":"MN","email":"kpouck1m@nymag.com"}, +{"id":60,"firstName":"Kylie","lastName":"Osmar","street":"7 Milwaukee Plaza","postalCode":"45228","city":"Cincinnati","state":"OH","phoneNumber":"513-940-5020","email":"kosmar1n@storify.com"}, +{"id":61,"firstName":"Trudi","lastName":"Standrin","street":"526 Onsgard Park","postalCode":"12237","city":"Albany","state":"NY","email":"tstandrin1o@sfgate.com"}, +{"id":62,"firstName":"Frank","lastName":"Belt","street":"52 Stang Lane","postalCode":"27455","city":"Greensboro","state":"NC"}, +{"id":63,"firstName":"Nerita","lastName":"Daulton","street":"03 Sutherland Court","postalCode":"55417","city":"Minneapolis","state":"MN","phoneNumber":"651-796-2028"}, +{"id":64,"firstName":"Urbanus","lastName":"Camm","street":"6802 Weeping Birch Circle","postalCode":"92115","city":"San Diego","state":"CA","email":"ucamm1r@ucoz.com"}, +{"id":65,"firstName":"Perry","lastName":"Struther","street":"63916 Corry Alley","postalCode":"28805","city":"Asheville","state":"NC","phoneNumber":"828-821-0824","email":"pstruther1s@nih.gov"}, +{"id":66,"firstName":"Zorina","lastName":"Uc","street":"99 Merry Circle","postalCode":"37250","city":"Nashville","state":"TN","phoneNumber":"615-364-4726","email":"zuc1t@cbc.ca"}, +{"id":67,"firstName":"Ajay","lastName":"Rediers","street":"6872 Armistice Lane","postalCode":"92812","city":"Anaheim","state":"CA","phoneNumber":"714-845-0143"}, +{"id":68,"firstName":"Brendis","lastName":"Goor","street":"94 Mccormick Place","postalCode":"77346","city":"Humble","state":"TX","phoneNumber":"713-910-5956"}, +{"id":69,"firstName":"Barbey","lastName":"Konneke","street":"75613 Miller Trail","postalCode":"30328","city":"Atlanta","state":"GA","phoneNumber":"770-208-1453"}, +{"id":70,"firstName":"Adlai","lastName":"Colly","street":"4446 Loftsgordon Place","postalCode":"40576","city":"Lexington","state":"KY","email":"acolly1x@phpbb.com"}, +{"id":71,"firstName":"Libby","lastName":"Wherton","street":"9313 Buell Road","postalCode":"70116","city":"New Orleans","state":"LA","email":"lwherton1y@flickr.com"}, +{"id":72,"firstName":"Niko","lastName":"Stockell","street":"61 Havey Park","postalCode":"10034","city":"New York City","state":"NY","phoneNumber":"646-814-6395","email":"nstockell1z@xrea.com"}, +{"id":73,"firstName":"Phillip","lastName":"Dadley","street":"14534 Victoria Street","postalCode":"33906","city":"Fort Myers","state":"FL","email":"pdadley20@studiopress.com"}, +{"id":74,"firstName":"Leann","lastName":"Hebburn","street":"9 Center Place","postalCode":"84140","city":"Salt Lake City","state":"UT","email":"lhebburn21@1688.com"}, +{"id":75,"firstName":"Raynor","lastName":"Gernier","street":"5923 Gale Plaza","postalCode":"79118","city":"Amarillo","state":"TX"}, +{"id":76,"firstName":"Elmore","lastName":"Frankton","street":"770 Wayridge Crossing","postalCode":"14619","city":"Rochester","state":"NY"}, +{"id":77,"firstName":"Teresina","lastName":"Rives","street":"51261 Sycamore Terrace","postalCode":"63180","city":"Saint Louis","state":"MO","email":"trives24@cbsnews.com"}, +{"id":78,"firstName":"Pancho","lastName":"Thebeaud","street":"72 Pierstorff Way","postalCode":"33705","city":"Saint Petersburg","state":"FL","phoneNumber":"813-335-3556"}, +{"id":79,"firstName":"Deanne","lastName":"Crighton","street":"95 Duke Plaza","postalCode":"71151","city":"Shreveport","state":"LA","phoneNumber":"318-218-7196","email":"dcrighton26@sphinn.com"}, +{"id":80,"firstName":"Brucie","lastName":"Bury","street":"8948 Knutson Lane","postalCode":"93740","city":"Fresno","state":"CA","email":"bbury27@twitter.com"}, +{"id":81,"firstName":"Joleen","lastName":"Flack","street":"8007 Morningstar Street","postalCode":"33283","city":"Miami","state":"FL","phoneNumber":"305-459-0365"}, +{"id":82,"firstName":"Antonino","lastName":"Matelyunas","street":"2585 Gale Road","postalCode":"20591","city":"Washington","state":"DC","phoneNumber":"202-780-3589"}, +{"id":83,"firstName":"Vinnie","lastName":"Syne","street":"6 Fallview Pass","postalCode":"20231","city":"Washington","state":"DC","phoneNumber":"202-648-5977","email":"vsyne2a@etsy.com"}, +{"id":84,"firstName":"Sig","lastName":"Guillotin","street":"6 Buell Lane","postalCode":"46015","city":"Anderson","state":"IN","phoneNumber":"765-948-7663","email":"sguillotin2b@cisco.com"}, +{"id":85,"firstName":"Gabriel","lastName":"Vasyukhichev","street":"25801 Grasskamp Junction","postalCode":"45408","city":"Dayton","state":"OH","email":"gvasyukhichev2c@mac.com"}, +{"id":86,"firstName":"Casie","lastName":"Burgill","street":"0 Dapin Alley","postalCode":"37410","city":"Chattanooga","state":"TN"}, +{"id":87,"firstName":"Kristan","lastName":"Chalice","street":"5118 Calypso Junction","postalCode":"78721","city":"Austin","state":"TX","phoneNumber":"512-831-2347"}, +{"id":88,"firstName":"Brear","lastName":"Pruckner","street":"2 Corscot Street","postalCode":"53790","city":"Madison","state":"WI"}, +{"id":89,"firstName":"Estella","lastName":"Orpyne","street":"293 Hansons Plaza","postalCode":"55579","city":"Maple Plain","state":"MN","phoneNumber":"952-666-6951","email":"eorpyne2g@examiner.com"}, +{"id":90,"firstName":"Conroy","lastName":"de Banke","street":"40636 Farmco Park","postalCode":"30316","city":"Atlanta","state":"GA","phoneNumber":"404-199-0073","email":"cdebanke2h@prweb.com"}, +{"id":91,"firstName":"Elmira","lastName":"Bracken","street":"10 Macpherson Place","postalCode":"85099","city":"Phoenix","state":"AZ","phoneNumber":"602-991-7768","email":"ebracken2i@sourceforge.net"}, +{"id":92,"firstName":"Carlota","lastName":"Vasilechko","street":"33 American Ash Point","postalCode":"75507","city":"Texarkana","state":"TX","phoneNumber":"903-312-0610","email":"cvasilechko2j@nba.com"}, +{"id":93,"firstName":"Jamesy","lastName":"Valentelli","street":"59634 Charing Cross Trail","postalCode":"31416","city":"Savannah","state":"GA","phoneNumber":"912-657-6729","email":"jvalentelli2k@nifty.com"}, +{"id":94,"firstName":"Hildagarde","lastName":"Sandels","street":"1 Lotheville Lane","postalCode":"32277","city":"Jacksonville","state":"FL","phoneNumber":"904-981-2753","email":"hsandels2l@a8.net"}, +{"id":95,"firstName":"Kip","lastName":"Cranidge","street":"2 South Road","postalCode":"19160","city":"Philadelphia","state":"PA"}, +{"id":96,"firstName":"Tobit","lastName":"Jarrette","street":"777 Mallard Trail","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-706-1988"}, +{"id":97,"firstName":"Tibold","lastName":"Michie","street":"87796 Nevada Junction","postalCode":"22093","city":"Ashburn","state":"VA","phoneNumber":"571-188-4893","email":"tmichie2o@mapy.cz"}, +{"id":98,"firstName":"Maximo","lastName":"Ifill","street":"8307 Tony Point","postalCode":"22225","city":"Arlington","state":"VA","phoneNumber":"571-404-1412"}, +{"id":99,"firstName":"Patti","lastName":"Autry","street":"901 Iowa Crossing","postalCode":"55551","city":"Young America","state":"MN","phoneNumber":"952-772-9107","email":"pautry2q@scientificamerican.com"}, +{"id":100,"firstName":"Cathe","lastName":"Jost","street":"4400 Menomonie Road","postalCode":"21211","city":"Baltimore","state":"MD","phoneNumber":"410-800-4683","email":"cjost2r@tuttocitta.it"}, +{"id":101,"firstName":"Byron","lastName":"Maddams","street":"10729 Oak Trail","postalCode":"78255","city":"San Antonio","state":"TX","phoneNumber":"830-263-4129"}, +{"id":102,"firstName":"Sosanna","lastName":"Paley","street":"82207 Park Meadow Court","postalCode":"77010","city":"Houston","state":"TX","phoneNumber":"832-740-8766","email":"spaley2t@salon.com"}, +{"id":103,"firstName":"Elysia","lastName":"Skerratt","street":"88708 Cambridge Drive","postalCode":"31217","city":"Macon","state":"GA","phoneNumber":"478-265-6579","email":"eskerratt2u@japanpost.jp"}, +{"id":104,"firstName":"Nealson","lastName":"Sieur","street":"1286 Elmside Plaza","postalCode":"20904","city":"Silver Spring","state":"MD"}, +{"id":105,"firstName":"Yasmeen","lastName":"Bazire","street":"91904 Elmside Point","postalCode":"73167","city":"Oklahoma City","state":"OK"}, +{"id":106,"firstName":"Mandy","lastName":"Ewart","street":"91 Norway Maple Street","postalCode":"21239","city":"Baltimore","state":"MD","email":"mewart2x@weebly.com"}, +{"id":107,"firstName":"Chlo","lastName":"Keedy","street":"560 Oak Valley Avenue","postalCode":"20420","city":"Washington","state":"DC"}, +{"id":108,"firstName":"Benedicta","lastName":"Dinneen","street":"9 Cottonwood Circle","postalCode":"60686","city":"Chicago","state":"IL","email":"bdinneen2z@nydailynews.com"}, +{"id":109,"firstName":"Nanon","lastName":"Corsar","street":"40001 Barby Drive","postalCode":"95818","city":"Sacramento","state":"CA","email":"ncorsar30@house.gov"}, +{"id":110,"firstName":"Babette","lastName":"Scarsbrick","street":"96095 Loomis Terrace","postalCode":"94622","city":"Oakland","state":"CA","email":"bscarsbrick31@smugmug.com"}, +{"id":111,"firstName":"Cornall","lastName":"Christauffour","street":"9 Springview Alley","postalCode":"84170","city":"Salt Lake City","state":"UT","phoneNumber":"801-935-1246","email":"cchristauffour32@booking.com"}, +{"id":112,"firstName":"Micki","lastName":"Labell","street":"77729 Heath Place","postalCode":"25336","city":"Charleston","state":"WV"}, +{"id":113,"firstName":"Marissa","lastName":"Bricksey","street":"1 Jackson Pass","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"917-552-4280"}, +{"id":114,"firstName":"Alex","lastName":"Lyptrade","street":"74 Bunting Circle","postalCode":"40591","city":"Lexington","state":"KY","phoneNumber":"859-177-0753"}, +{"id":115,"firstName":"Tove","lastName":"Bielfeldt","street":"95 Mallard Hill","postalCode":"70894","city":"Baton Rouge","state":"LA","email":"tbielfeldt36@goo.gl"}, +{"id":116,"firstName":"Rodrigo","lastName":"Chestle","street":"53625 1st Junction","postalCode":"43635","city":"Toledo","state":"OH","phoneNumber":"419-928-0953","email":"rchestle37@princeton.edu"}, +{"id":117,"firstName":"Ulrike","lastName":"Kendle","street":"0 Cardinal Alley","postalCode":"80925","city":"Colorado Springs","state":"CO","phoneNumber":"719-796-1992","email":"ukendle38@naver.com"}, +{"id":118,"firstName":"Sandor","lastName":"Warwick","street":"8 Spaight Crossing","postalCode":"92030","city":"Escondido","state":"CA","email":"swarwick39@about.com"}, +{"id":119,"firstName":"Selina","lastName":"Slowcock","street":"7 7th Circle","postalCode":"50335","city":"Des Moines","state":"IA","phoneNumber":"515-865-9809"}, +{"id":120,"firstName":"Maxine","lastName":"Placstone","street":"42056 Sycamore Plaza","postalCode":"20244","city":"Washington","state":"DC"}, +{"id":121,"firstName":"Ardine","lastName":"Reven","street":"10634 Nancy Way","postalCode":"10175","city":"New York City","state":"NY","email":"areven3c@diigo.com"}, +{"id":122,"firstName":"Dilan","lastName":"Widdows","street":"37 Park Meadow Way","postalCode":"68144","city":"Omaha","state":"NE","phoneNumber":"402-383-9020"}, +{"id":123,"firstName":"Kevina","lastName":"Praten","street":"8531 Elmside Point","postalCode":"27610","city":"Raleigh","state":"NC","email":"kpraten3e@craigslist.org"}, +{"id":124,"firstName":"Sherman","lastName":"Jurczak","street":"8281 Acker Alley","postalCode":"07522","city":"Paterson","state":"NJ","email":"sjurczak3f@github.com"}, +{"id":125,"firstName":"Beckie","lastName":"Disney","street":"3 Butterfield Drive","postalCode":"49518","city":"Grand Rapids","state":"MI","phoneNumber":"616-493-1284","email":"bdisney3g@china.com.cn"}, +{"id":126,"firstName":"Blaine","lastName":"Leak","street":"369 Norway Maple Lane","postalCode":"03804","city":"Portsmouth","state":"NH","email":"bleak3h@lulu.com"}, +{"id":127,"firstName":"Dare","lastName":"Marney","street":"50 Lake View Alley","postalCode":"06505","city":"New Haven","state":"CT","phoneNumber":"203-876-6938","email":"dmarney3i@delicious.com"}, +{"id":128,"firstName":"Darby","lastName":"Sackler","street":"841 Ridgeview Trail","postalCode":"80279","city":"Denver","state":"CO"}, +{"id":129,"firstName":"Aurilia","lastName":"Seabrocke","street":"670 Schmedeman Road","postalCode":"11254","city":"Brooklyn","state":"NY","email":"aseabrocke3k@engadget.com"}, +{"id":130,"firstName":"Griz","lastName":"Riccioppo","street":"2204 Moland Circle","postalCode":"45218","city":"Cincinnati","state":"OH","email":"griccioppo3l@cisco.com"}, +{"id":131,"firstName":"Zahara","lastName":"Quinion","street":"4979 Mallory Circle","postalCode":"24515","city":"Lynchburg","state":"VA","email":"zquinion3m@sfgate.com"}, +{"id":132,"firstName":"Holly-anne","lastName":"Fontel","street":"60752 Hallows Circle","postalCode":"76705","city":"Waco","state":"TX","phoneNumber":"254-822-2565","email":"hfontel3n@exblog.jp"}, +{"id":133,"firstName":"Johannes","lastName":"Lemonby","street":"3 Grover Terrace","postalCode":"25709","city":"Huntington","state":"WV","phoneNumber":"304-342-4911","email":"jlemonby3o@woothemes.com"}, +{"id":134,"firstName":"Melvin","lastName":"Kain","street":"16 Pond Junction","postalCode":"85215","city":"Mesa","state":"AZ","phoneNumber":"602-146-3701"}, +{"id":135,"firstName":"Letta","lastName":"Smelley","street":"537 Helena Circle","postalCode":"22119","city":"Merrifield","state":"VA","phoneNumber":"571-472-5640"}, +{"id":136,"firstName":"Clerc","lastName":"Mc Ilwrick","street":"7050 Northfield Street","postalCode":"90050","city":"Los Angeles","state":"CA","email":"cmcilwrick3r@abc.net.au"}, +{"id":137,"firstName":"Abba","lastName":"Sutherns","street":"8087 Monterey Lane","postalCode":"83757","city":"Boise","state":"ID","phoneNumber":"208-110-3153","email":"asutherns3s@dropbox.com"}, +{"id":138,"firstName":"Karola","lastName":"Symper","street":"4596 Clyde Gallagher Road","postalCode":"28815","city":"Asheville","state":"NC","email":"ksymper3t@parallels.com"}, +{"id":139,"firstName":"Jessamyn","lastName":"Deacock","street":"19557 Bobwhite Way","postalCode":"19725","city":"Newark","state":"DE","phoneNumber":"302-174-2938"}, +{"id":140,"firstName":"Iggy","lastName":"Impey","street":"8 Brown Place","postalCode":"27499","city":"Greensboro","state":"NC"}, +{"id":141,"firstName":"Kary","lastName":"Mably","street":"75 Porter Avenue","postalCode":"70174","city":"New Orleans","state":"LA","email":"kmably3w@miibeian.gov.cn"}, +{"id":142,"firstName":"Ciel","lastName":"Tidbold","street":"54 Mitchell Lane","postalCode":"90055","city":"Los Angeles","state":"CA"}, +{"id":143,"firstName":"Dyana","lastName":"Orcott","street":"2 Kinsman Street","postalCode":"90005","city":"Los Angeles","state":"CA","phoneNumber":"310-366-6987"}, +{"id":144,"firstName":"Damien","lastName":"Haking","street":"2 Elmside Point","postalCode":"62705","city":"Springfield","state":"IL","email":"dhaking3z@drupal.org"}, +{"id":145,"firstName":"Ricardo","lastName":"Bille","street":"3 Mesta Hill","postalCode":"98411","city":"Tacoma","state":"WA","email":"rbille40@ebay.co.uk"}, +{"id":146,"firstName":"Carlene","lastName":"Roget","street":"8 Granby Avenue","postalCode":"35225","city":"Birmingham","state":"AL","phoneNumber":"205-762-4907","email":"croget41@statcounter.com"}, +{"id":147,"firstName":"Sharlene","lastName":"Antusch","street":"02445 Stang Parkway","postalCode":"55480","city":"Minneapolis","state":"MN","email":"santusch42@mtv.com"}, +{"id":148,"firstName":"Goober","lastName":"Danielczyk","street":"474 Union Court","postalCode":"70505","city":"Lafayette","state":"LA","phoneNumber":"337-779-0312","email":"gdanielczyk43@dion.ne.jp"}, +{"id":149,"firstName":"Janette","lastName":"Mauro","street":"1231 Commercial Crossing","postalCode":"97201","city":"Portland","state":"OR","phoneNumber":"971-423-7259"}, +{"id":150,"firstName":"Melinda","lastName":"Shitliffe","street":"244 Derek Drive","postalCode":"23208","city":"Richmond","state":"VA","phoneNumber":"804-864-5845"}, +{"id":151,"firstName":"Constance","lastName":"Fardon","street":"3 Lien Point","postalCode":"89105","city":"Las Vegas","state":"NV"}, +{"id":152,"firstName":"Tedd","lastName":"Storey","street":"2551 Luster Point","postalCode":"19151","city":"Philadelphia","state":"PA","phoneNumber":"215-622-9273","email":"tstorey47@google.com.au"}, +{"id":153,"firstName":"Brigitte","lastName":"Slograve","street":"8130 Waubesa Hill","postalCode":"11499","city":"Jamaica","state":"NY","email":"bslograve48@yandex.ru"}, +{"id":154,"firstName":"Ralph","lastName":"Comberbeach","street":"88140 Anderson Avenue","postalCode":"90076","city":"Los Angeles","state":"CA"}, +{"id":155,"firstName":"Deloria","lastName":"Thomazet","street":"666 Center Crossing","postalCode":"38119","city":"Memphis","state":"TN","phoneNumber":"615-840-7916"}, +{"id":156,"firstName":"Fidel","lastName":"MacClay","street":"01 Fairfield Point","postalCode":"24034","city":"Roanoke","state":"VA","email":"fmacclay4b@sitemeter.com"}, +{"id":157,"firstName":"Amalee","lastName":"Menzies","street":"6 Judy Drive","postalCode":"84605","city":"Provo","state":"UT"}, +{"id":158,"firstName":"Ansel","lastName":"Jory","street":"3 Nobel Park","postalCode":"32505","city":"Pensacola","state":"FL","phoneNumber":"850-394-8201"}, +{"id":159,"firstName":"Teodor","lastName":"Longhorn","street":"563 Sutherland Avenue","postalCode":"98008","city":"Bellevue","state":"WA"}, +{"id":160,"firstName":"Margarita","lastName":"Rewcassell","street":"64711 Beilfuss Point","postalCode":"79764","city":"Odessa","state":"TX","phoneNumber":"432-413-2196"}, +{"id":161,"firstName":"Tarra","lastName":"Albro","street":"2 Graceland Way","postalCode":"78405","city":"Corpus Christi","state":"TX"}, +{"id":162,"firstName":"Whitaker","lastName":"Brizell","street":"6 Luster Place","postalCode":"33694","city":"Tampa","state":"FL","email":"wbrizell4h@naver.com"}, +{"id":163,"firstName":"Gauthier","lastName":"Getsham","street":"0820 Duke Plaza","postalCode":"28263","city":"Charlotte","state":"NC","phoneNumber":"704-510-2908"}, +{"id":164,"firstName":"Thane","lastName":"Discombe","street":"56809 Aberg Street","postalCode":"63167","city":"Saint Louis","state":"MO"}, +{"id":165,"firstName":"Felicia","lastName":"Barthrup","street":"904 Stuart Junction","postalCode":"32220","city":"Jacksonville","state":"FL"}, +{"id":166,"firstName":"Emeline","lastName":"Jobes","street":"2670 Prairieview Plaza","postalCode":"10120","city":"New York City","state":"NY","email":"ejobes4l@newyorker.com"}, +{"id":167,"firstName":"Felicle","lastName":"Bowie","street":"9715 Lighthouse Bay Parkway","postalCode":"11210","city":"Brooklyn","state":"NY","email":"fbowie4m@auda.org.au"}, +{"id":168,"firstName":"Clare","lastName":"Miskelly","street":"8 Towne Trail","postalCode":"44555","city":"Youngstown","state":"OH"}, +{"id":169,"firstName":"Mort","lastName":"Danat","street":"6833 Shoshone Lane","postalCode":"12255","city":"Albany","state":"NY","phoneNumber":"518-967-9791","email":"mdanat4o@privacy.gov.au"}, +{"id":170,"firstName":"Ailey","lastName":"Scatchar","street":"3 Northfield Point","postalCode":"76505","city":"Temple","state":"TX"}, +{"id":171,"firstName":"Kevina","lastName":"Darwent","street":"8165 Reinke Alley","postalCode":"94132","city":"San Francisco","state":"CA","email":"kdarwent4q@artisteer.com"}, +{"id":172,"firstName":"My","lastName":"Buston","street":"715 Saint Paul Center","postalCode":"31416","city":"Savannah","state":"GA","phoneNumber":"912-281-8654"}, +{"id":173,"firstName":"Emera","lastName":"Lingner","street":"943 Eastlawn Hill","postalCode":"90605","city":"Whittier","state":"CA"}, +{"id":174,"firstName":"Drucie","lastName":"Byer","street":"988 4th Court","postalCode":"06816","city":"Danbury","state":"CT","email":"dbyer4t@xinhuanet.com"}, +{"id":175,"firstName":"Modestine","lastName":"Madeley","street":"1 Delaware Terrace","postalCode":"80126","city":"Littleton","state":"CO"}, +{"id":176,"firstName":"Selie","lastName":"O'Mohun","street":"42 Monument Trail","postalCode":"55590","city":"Monticello","state":"MN","phoneNumber":"763-384-5166"}, +{"id":177,"firstName":"Shayla","lastName":"Pesselt","street":"7 Pawling Center","postalCode":"20099","city":"Washington","state":"DC","phoneNumber":"202-816-7300","email":"spesselt4w@posterous.com"}, +{"id":178,"firstName":"Raeann","lastName":"Layland","street":"06548 Longview Alley","postalCode":"77005","city":"Houston","state":"TX","phoneNumber":"214-899-1257","email":"rlayland4x@pcworld.com"}, +{"id":179,"firstName":"Dael","lastName":"Christaeas","street":"375 Northfield Street","postalCode":"23509","city":"Norfolk","state":"VA","phoneNumber":"757-391-2798","email":"dchristaeas4y@sciencedaily.com"}, +{"id":180,"firstName":"Nicolas","lastName":"Baxill","street":"9 Autumn Leaf Terrace","postalCode":"77005","city":"Houston","state":"TX","email":"nbaxill4z@edublogs.org"}, +{"id":181,"firstName":"Onida","lastName":"Pengilly","street":"61 Commercial Junction","postalCode":"24029","city":"Roanoke","state":"VA","email":"opengilly50@slideshare.net"}, +{"id":182,"firstName":"Muffin","lastName":"Thrasher","street":"1 Morning Hill","postalCode":"64082","city":"Lees Summit","state":"MO"}, +{"id":183,"firstName":"Ignaz","lastName":"McLugish","street":"3936 Columbus Point","postalCode":"35263","city":"Birmingham","state":"AL"}, +{"id":184,"firstName":"Guillaume","lastName":"Gillings","street":"75541 Sheridan Center","postalCode":"68510","city":"Lincoln","state":"NE","email":"ggillings53@unblog.fr"}, +{"id":185,"firstName":"Kalli","lastName":"Branche","street":"33740 Manitowish Court","postalCode":"96805","city":"Honolulu","state":"HI"}, +{"id":186,"firstName":"Winthrop","lastName":"Barszczewski","street":"9 Luster Terrace","postalCode":"60158","city":"Carol Stream","state":"IL","phoneNumber":"309-633-3125","email":"wbarszczewski55@eventbrite.com"}, +{"id":187,"firstName":"Renaud","lastName":"Nitto","street":"1 Crownhardt Place","postalCode":"10310","city":"Staten Island","state":"NY","phoneNumber":"914-568-4524","email":"rnitto56@typepad.com"}, +{"id":188,"firstName":"Pollyanna","lastName":"Wherrett","street":"31380 Upham Street","postalCode":"76134","city":"Fort Worth","state":"TX","phoneNumber":"817-198-3301","email":"pwherrett57@bluehost.com"}, +{"id":189,"firstName":"Lilly","lastName":"Gatchell","street":"7 Elka Road","postalCode":"94064","city":"Redwood City","state":"CA","email":"lgatchell58@patch.com"}, +{"id":190,"firstName":"Leopold","lastName":"Leavey","street":"9 Darwin Crossing","postalCode":"20268","city":"Washington","state":"DC","phoneNumber":"202-964-5932","email":"lleavey59@aol.com"}, +{"id":191,"firstName":"Byram","lastName":"Stuckes","street":"782 Northport Alley","postalCode":"55436","city":"Minneapolis","state":"MN"}, +{"id":192,"firstName":"Cull","lastName":"Whiterod","street":"2586 Banding Terrace","postalCode":"80249","city":"Denver","state":"CO","email":"cwhiterod5b@skype.com"}, +{"id":193,"firstName":"Gretel","lastName":"Tacey","street":"6382 Fremont Avenue","postalCode":"25305","city":"Charleston","state":"WV"}, +{"id":194,"firstName":"Tudor","lastName":"Piff","street":"0 Monterey Circle","postalCode":"00214","city":"Portsmouth","state":"NH","email":"tpiff5d@eepurl.com"}, +{"id":195,"firstName":"Julienne","lastName":"Adshed","street":"91839 Lawn Avenue","postalCode":"92519","city":"Riverside","state":"CA"}, +{"id":196,"firstName":"Arnold","lastName":"Fearns","street":"7 West Trail","postalCode":"35242","city":"Birmingham","state":"AL","email":"afearns5f@bravesites.com"}, +{"id":197,"firstName":"Dunc","lastName":"Khoter","street":"048 Clove Lane","postalCode":"89505","city":"Reno","state":"NV","phoneNumber":"775-120-9532","email":"dkhoter5g@bbb.org"}, +{"id":198,"firstName":"Stevana","lastName":"Lush","street":"6 Dovetail Plaza","postalCode":"79945","city":"El Paso","state":"TX","email":"slush5h@economist.com"}, +{"id":199,"firstName":"Iggy","lastName":"Verryan","street":"5 Sommers Road","postalCode":"34114","city":"Naples","state":"FL","phoneNumber":"239-205-8767"}, +{"id":200,"firstName":"Breena","lastName":"Rubbert","street":"5 Kensington Crossing","postalCode":"90510","city":"Torrance","state":"CA","email":"brubbert5j@phpbb.com"}, +{"id":201,"firstName":"Jervis","lastName":"Doree","street":"2947 Center Plaza","postalCode":"70160","city":"New Orleans","state":"LA","phoneNumber":"504-278-7497","email":"jdoree5k@shutterfly.com"}, +{"id":202,"firstName":"Odelia","lastName":"Lidierth","street":"36699 Aberg Park","postalCode":"62764","city":"Springfield","state":"IL"}, +{"id":203,"firstName":"Ree","lastName":"Lammerding","street":"3542 Lerdahl Court","postalCode":"88558","city":"El Paso","state":"TX","phoneNumber":"915-384-9334","email":"rlammerding5m@msu.edu"}, +{"id":204,"firstName":"Davy","lastName":"Orniz","street":"49 Graedel Parkway","postalCode":"48295","city":"Detroit","state":"MI","email":"dorniz5n@examiner.com"}, +{"id":205,"firstName":"Syd","lastName":"Buckoke","street":"70 Pepper Wood Alley","postalCode":"74156","city":"Tulsa","state":"OK","phoneNumber":"918-604-5799"}, +{"id":206,"firstName":"Ginger","lastName":"Calkin","street":"7 Thompson Trail","postalCode":"71115","city":"Shreveport","state":"LA","phoneNumber":"318-650-6046"}, +{"id":207,"firstName":"Anissa","lastName":"Ivashinnikov","street":"61905 Chive Circle","postalCode":"40745","city":"London","state":"KY","email":"aivashinnikov5q@google.cn"}, +{"id":208,"firstName":"Vikky","lastName":"Kesley","street":"1 Grayhawk Street","postalCode":"06538","city":"New Haven","state":"CT","phoneNumber":"203-944-7163"}, +{"id":209,"firstName":"Alisha","lastName":"Lampke","street":"26940 Kensington Park","postalCode":"55446","city":"Minneapolis","state":"MN","phoneNumber":"612-814-9814","email":"alampke5s@apple.com"}, +{"id":210,"firstName":"Davidde","lastName":"Phlipon","street":"2044 Ruskin Road","postalCode":"07188","city":"Newark","state":"NJ","email":"dphlipon5t@shareasale.com"}, +{"id":211,"firstName":"Joly","lastName":"Crottagh","street":"532 Dawn Plaza","postalCode":"85083","city":"Phoenix","state":"AZ","phoneNumber":"602-533-4064"}, +{"id":212,"firstName":"Aggie","lastName":"Niesing","street":"3 Tony Drive","postalCode":"57110","city":"Sioux Falls","state":"SD","email":"aniesing5v@pbs.org"}, +{"id":213,"firstName":"Daron","lastName":"Baudassi","street":"2411 Melvin Court","postalCode":"40581","city":"Lexington","state":"KY","phoneNumber":"859-754-2542","email":"dbaudassi5w@joomla.org"}, +{"id":214,"firstName":"Thadeus","lastName":"Kleiser","street":"1394 Warner Street","postalCode":"87592","city":"Santa Fe","state":"NM","email":"tkleiser5x@bloomberg.com"}, +{"id":215,"firstName":"Terri","lastName":"Perrat","street":"0080 Upham Plaza","postalCode":"52245","city":"Iowa City","state":"IA"}, +{"id":216,"firstName":"Marlena","lastName":"Gatchell","street":"60888 Annamark Street","postalCode":"90060","city":"Los Angeles","state":"CA","phoneNumber":"323-121-6985","email":"mgatchell5z@ibm.com"}, +{"id":217,"firstName":"Locke","lastName":"Orcott","street":"459 Warner Lane","postalCode":"45020","city":"Hamilton","state":"OH","phoneNumber":"937-115-3187"}, +{"id":218,"firstName":"Wilmer","lastName":"Bewick","street":"0 Ohio Center","postalCode":"98166","city":"Seattle","state":"WA","phoneNumber":"253-805-8855","email":"wbewick61@seesaa.net"}, +{"id":219,"firstName":"Marena","lastName":"MacShirrie","street":"607 Badeau Circle","postalCode":"98008","city":"Bellevue","state":"WA","email":"mmacshirrie62@wikia.com"}, +{"id":220,"firstName":"Nathanial","lastName":"Sexty","street":"43 Basil Place","postalCode":"85020","city":"Phoenix","state":"AZ"}, +{"id":221,"firstName":"Wadsworth","lastName":"Iacovuzzi","street":"9610 Donald Crossing","postalCode":"88530","city":"El Paso","state":"TX","phoneNumber":"915-889-7936","email":"wiacovuzzi64@prnewswire.com"}, +{"id":222,"firstName":"Sutton","lastName":"Stych","street":"9 Brentwood Terrace","postalCode":"20546","city":"Washington","state":"DC","phoneNumber":"202-538-6355","email":"sstych65@wikimedia.org"}, +{"id":223,"firstName":"Gaspar","lastName":"Wabey","street":"3061 Bluejay Terrace","postalCode":"10110","city":"New York City","state":"NY","phoneNumber":"917-939-0802","email":"gwabey66@technorati.com"}, +{"id":224,"firstName":"Herminia","lastName":"Guyot","street":"91 Express Drive","postalCode":"85715","city":"Tucson","state":"AZ","phoneNumber":"520-777-1670","email":"hguyot67@admin.ch"}, +{"id":225,"firstName":"Udale","lastName":"Beurich","street":"675 Karstens Crossing","postalCode":"46852","city":"Fort Wayne","state":"IN","phoneNumber":"260-580-8627","email":"ubeurich68@bigcartel.com"}, +{"id":226,"firstName":"Kerrie","lastName":"Girauld","street":"56132 Charing Cross Court","postalCode":"71137","city":"Shreveport","state":"LA","email":"kgirauld69@nationalgeographic.com"}, +{"id":227,"firstName":"Irvin","lastName":"Nix","street":"0676 Aberg Terrace","postalCode":"97075","city":"Beaverton","state":"OR","email":"inix6a@xing.com"}, +{"id":228,"firstName":"Corene","lastName":"Spencock","street":"90 Meadow Ridge Drive","postalCode":"73173","city":"Oklahoma City","state":"OK","phoneNumber":"405-577-1312","email":"cspencock6b@shinystat.com"}, +{"id":229,"firstName":"Christos","lastName":"McIlreavy","street":"673 Jana Trail","postalCode":"23471","city":"Virginia Beach","state":"VA","email":"cmcilreavy6c@mayoclinic.com"}, +{"id":230,"firstName":"Bennett","lastName":"Melding","street":"4 Cardinal Lane","postalCode":"55448","city":"Minneapolis","state":"MN","email":"bmelding6d@t-online.de"}, +{"id":231,"firstName":"Winny","lastName":"de Leon","street":"941 Scoville Place","postalCode":"94611","city":"Oakland","state":"CA","phoneNumber":"510-230-4168","email":"wdeleon6e@dell.com"}, +{"id":232,"firstName":"Nike","lastName":"Iacobassi","street":"956 Service Junction","postalCode":"71914","city":"Hot Springs National Park","state":"AR","phoneNumber":"501-266-4142"}, +{"id":233,"firstName":"Gillan","lastName":"Baumann","street":"11 8th Alley","postalCode":"31190","city":"Atlanta","state":"GA","phoneNumber":"404-703-5154","email":"gbaumann6g@edublogs.org"}, +{"id":234,"firstName":"Brandtr","lastName":"Gadman","street":"5 Marquette Hill","postalCode":"32511","city":"Pensacola","state":"FL","phoneNumber":"850-834-0058","email":"bgadman6h@marriott.com"}, +{"id":235,"firstName":"Kenn","lastName":"Cage","street":"3759 Spohn Point","postalCode":"94126","city":"San Francisco","state":"CA","email":"kcage6i@earthlink.net"}, +{"id":236,"firstName":"Butch","lastName":"Causby","street":"02 Basil Crossing","postalCode":"10110","city":"New York City","state":"NY","phoneNumber":"212-190-1702","email":"bcausby6j@scribd.com"}, +{"id":237,"firstName":"Haleigh","lastName":"Parsonson","street":"8 Ruskin Trail","postalCode":"87201","city":"Albuquerque","state":"NM","phoneNumber":"505-987-1352"}, +{"id":238,"firstName":"Bartel","lastName":"Ruppeli","street":"7538 Red Cloud Center","postalCode":"37410","city":"Chattanooga","state":"TN","phoneNumber":"423-804-1016","email":"bruppeli6l@etsy.com"}, +{"id":239,"firstName":"Gretchen","lastName":"Le feaver","street":"7 Orin Way","postalCode":"98042","city":"Kent","state":"WA","phoneNumber":"253-205-3092","email":"glefeaver6m@mayoclinic.com"}, +{"id":240,"firstName":"Trumaine","lastName":"Dearden","street":"1 Vernon Trail","postalCode":"06127","city":"West Hartford","state":"CT","phoneNumber":"860-939-3865","email":"tdearden6n@goo.gl"}, +{"id":241,"firstName":"Aggie","lastName":"Dubs","street":"3601 Walton Trail","postalCode":"62764","city":"Springfield","state":"IL","phoneNumber":"217-834-6059","email":"adubs6o@cbsnews.com"}, +{"id":242,"firstName":"Shelly","lastName":"Skechley","street":"16 Morning Lane","postalCode":"60567","city":"Naperville","state":"IL","email":"sskechley6p@technorati.com"}, +{"id":243,"firstName":"Karin","lastName":"Fausch","street":"7532 Eggendart Way","postalCode":"19810","city":"Wilmington","state":"DE","phoneNumber":"302-548-2991"}, +{"id":244,"firstName":"Sal","lastName":"Harrow","street":"2632 Lien Way","postalCode":"33982","city":"Punta Gorda","state":"FL","phoneNumber":"941-904-5187","email":"sharrow6r@joomla.org"}, +{"id":245,"firstName":"Albie","lastName":"Strelitzki","street":"8436 Eggendart Terrace","postalCode":"49505","city":"Grand Rapids","state":"MI","email":"astrelitzki6s@google.com.br"}, +{"id":246,"firstName":"Augy","lastName":"Usherwood","street":"9078 Clemons Street","postalCode":"80915","city":"Colorado Springs","state":"CO","email":"ausherwood6t@wikimedia.org"}, +{"id":247,"firstName":"Solomon","lastName":"D'eathe","street":"778 Rockefeller Parkway","postalCode":"84199","city":"Salt Lake City","state":"UT"}, +{"id":248,"firstName":"Talya","lastName":"Joseff","street":"14 Graedel Court","postalCode":"99220","city":"Spokane","state":"WA","email":"tjoseff6v@amazon.de"}, +{"id":249,"firstName":"Anatol","lastName":"Self","street":"2 Stoughton Junction","postalCode":"85255","city":"Scottsdale","state":"AZ"}, +{"id":250,"firstName":"Elinore","lastName":"Bruhnke","street":"3 Bashford Alley","postalCode":"17105","city":"Harrisburg","state":"PA","email":"ebruhnke6x@usnews.com"}, +{"id":251,"firstName":"Stanfield","lastName":"Jagiello","street":"0804 Amoth Road","postalCode":"20067","city":"Washington","state":"DC"}, +{"id":252,"firstName":"Isak","lastName":"Venour","street":"04 Orin Court","postalCode":"78210","city":"San Antonio","state":"TX","email":"ivenour6z@springer.com"}, +{"id":253,"firstName":"Abigale","lastName":"Woolgar","street":"74 Porter Terrace","postalCode":"62705","city":"Springfield","state":"IL"}, +{"id":254,"firstName":"Phylys","lastName":"Casperri","street":"07 Delaware Street","postalCode":"33069","city":"Pompano Beach","state":"FL","phoneNumber":"954-224-4577"}, +{"id":255,"firstName":"Melania","lastName":"Fee","street":"194 Luster Point","postalCode":"70154","city":"New Orleans","state":"LA","phoneNumber":"504-168-6959","email":"mfee72@comsenz.com"}, +{"id":256,"firstName":"Joli","lastName":"Colquite","street":"9 Bayside Court","postalCode":"27425","city":"Greensboro","state":"NC","email":"jcolquite73@comcast.net"}, +{"id":257,"firstName":"Rahel","lastName":"Late","street":"2 Meadow Ridge Alley","postalCode":"32204","city":"Jacksonville","state":"FL"}, +{"id":258,"firstName":"Carny","lastName":"Fewell","street":"21826 Cardinal Pass","postalCode":"98140","city":"Seattle","state":"WA"}, +{"id":259,"firstName":"Lesly","lastName":"Vanyatin","street":"7730 South Court","postalCode":"25356","city":"Charleston","state":"WV","email":"lvanyatin76@histats.com"}, +{"id":260,"firstName":"Fianna","lastName":"Thomason","street":"2576 Holmberg Trail","postalCode":"27710","city":"Durham","state":"NC"}, +{"id":261,"firstName":"Bobinette","lastName":"Gowdridge","street":"6780 Superior Place","postalCode":"37605","city":"Johnson City","state":"TN","phoneNumber":"423-490-4990","email":"bgowdridge78@icio.us"}, +{"id":262,"firstName":"Karmen","lastName":"Megson","street":"34 Messerschmidt Point","postalCode":"97229","city":"Portland","state":"OR","email":"kmegson79@apache.org"}, +{"id":263,"firstName":"Thaddeus","lastName":"Padilla","street":"42 Corben Road","postalCode":"90010","city":"Los Angeles","state":"CA","phoneNumber":"213-659-3136","email":"tpadilla7a@hud.gov"}, +{"id":264,"firstName":"Hanna","lastName":"Baswall","street":"9 Old Shore Lane","postalCode":"53710","city":"Madison","state":"WI","email":"hbaswall7b@ezinearticles.com"}, +{"id":265,"firstName":"Tania","lastName":"McMorland","street":"4333 Commercial Point","postalCode":"45408","city":"Dayton","state":"OH"}, +{"id":266,"firstName":"Gifford","lastName":"Arne","street":"0 Drewry Point","postalCode":"24048","city":"Roanoke","state":"VA","email":"garne7d@samsung.com"}, +{"id":267,"firstName":"Tomasina","lastName":"Linch","street":"64992 Maple Wood Point","postalCode":"98447","city":"Tacoma","state":"WA","email":"tlinch7e@theglobeandmail.com"}, +{"id":268,"firstName":"Merrick","lastName":"Garvan","street":"7220 Melody Trail","postalCode":"90005","city":"Los Angeles","state":"CA","email":"mgarvan7f@mozilla.org"}, +{"id":269,"firstName":"Carmita","lastName":"Sailes","street":"3 Bay Lane","postalCode":"55428","city":"Minneapolis","state":"MN","email":"csailes7g@devhub.com"}, +{"id":270,"firstName":"Lesly","lastName":"Eslemont","street":"93302 Mcbride Terrace","postalCode":"19810","city":"Wilmington","state":"DE","email":"leslemont7h@wunderground.com"}, +{"id":271,"firstName":"Adelaida","lastName":"Keggins","street":"4 Birchwood Pass","postalCode":"97405","city":"Eugene","state":"OR","phoneNumber":"541-387-1319"}, +{"id":272,"firstName":"Peadar","lastName":"Forte","street":"1 Montana Center","postalCode":"32505","city":"Pensacola","state":"FL","email":"pforte7j@xing.com"}, +{"id":273,"firstName":"Godfrey","lastName":"Swatland","street":"477 Maple Wood Road","postalCode":"93034","city":"Oxnard","state":"CA","phoneNumber":"805-267-0614","email":"gswatland7k@photobucket.com"}, +{"id":274,"firstName":"Marten","lastName":"Jelleman","street":"57 Pennsylvania Plaza","postalCode":"20057","city":"Washington","state":"DC","email":"mjelleman7l@phoca.cz"}, +{"id":275,"firstName":"Sharity","lastName":"Keady","street":"753 Sauthoff Place","postalCode":"77505","city":"Pasadena","state":"TX"}, +{"id":276,"firstName":"Gabbie","lastName":"Pally","street":"45 Fallview Park","postalCode":"97255","city":"Portland","state":"OR","phoneNumber":"971-412-2293","email":"gpally7n@dyndns.org"}, +{"id":277,"firstName":"Betsy","lastName":"Rhelton","street":"9 Jackson Road","postalCode":"85040","city":"Phoenix","state":"AZ"}, +{"id":278,"firstName":"Patty","lastName":"Schooling","street":"4 Moulton Point","postalCode":"25705","city":"Huntington","state":"WV","phoneNumber":"304-908-8211","email":"pschooling7p@parallels.com"}, +{"id":279,"firstName":"Katlin","lastName":"O'Hallagan","street":"8418 Petterle Plaza","postalCode":"60636","city":"Chicago","state":"IL","email":"kohallagan7q@hao123.com"}, +{"id":280,"firstName":"Anne","lastName":"Wealleans","street":"3 Sachtjen Court","postalCode":"48609","city":"Saginaw","state":"MI"}, +{"id":281,"firstName":"Flory","lastName":"Pley","street":"6322 Golf View Court","postalCode":"19104","city":"Philadelphia","state":"PA"}, +{"id":282,"firstName":"Maryellen","lastName":"Baszkiewicz","street":"54165 Hanson Trail","postalCode":"93726","city":"Fresno","state":"CA","phoneNumber":"209-198-4916","email":"mbaszkiewicz7t@google.com.br"}, +{"id":283,"firstName":"Moyna","lastName":"Caddens","street":"17 Melrose Lane","postalCode":"11236","city":"Brooklyn","state":"NY","phoneNumber":"917-518-3987","email":"mcaddens7u@amazon.co.uk"}, +{"id":284,"firstName":"Lawton","lastName":"Ramiro","street":"2 Muir Park","postalCode":"48092","city":"Warren","state":"MI","phoneNumber":"810-472-5208","email":"lramiro7v@senate.gov"}, +{"id":285,"firstName":"Agnella","lastName":"Phelip","street":"24566 Colorado Pass","postalCode":"84145","city":"Salt Lake City","state":"UT","phoneNumber":"801-709-8696","email":"aphelip7w@woothemes.com"}, +{"id":286,"firstName":"Tracee","lastName":"Tighe","street":"41013 Cascade Lane","postalCode":"02142","city":"Cambridge","state":"MA"}, +{"id":287,"firstName":"Shelden","lastName":"Sowrey","street":"87 Glacier Hill Court","postalCode":"55557","city":"Young America","state":"MN","email":"ssowrey7y@sfgate.com"}, +{"id":288,"firstName":"Letizia","lastName":"Sallery","street":"65052 Shasta Court","postalCode":"44905","city":"Mansfield","state":"OH","phoneNumber":"419-752-9141"}, +{"id":289,"firstName":"Hilly","lastName":"Oyley","street":"7 Waywood Trail","postalCode":"30323","city":"Atlanta","state":"GA","email":"hoyley80@upenn.edu"}, +{"id":290,"firstName":"Sabra","lastName":"Grigoryev","street":"856 Michigan Trail","postalCode":"33705","city":"Saint Petersburg","state":"FL"}, +{"id":291,"firstName":"Nathanil","lastName":"Bodham","street":"536 Ridgeview Way","postalCode":"79984","city":"El Paso","state":"TX","email":"nbodham82@wikimedia.org"}, +{"id":292,"firstName":"Niven","lastName":"Hartzenberg","street":"5 Carpenter Hill","postalCode":"73167","city":"Oklahoma City","state":"OK","email":"nhartzenberg83@bandcamp.com"}, +{"id":293,"firstName":"Rachael","lastName":"Birdsall","street":"61484 Mendota Point","postalCode":"90410","city":"Santa Monica","state":"CA","email":"rbirdsall84@gmpg.org"}, +{"id":294,"firstName":"Gypsy","lastName":"Rallin","street":"4 Spohn Drive","postalCode":"77346","city":"Humble","state":"TX","phoneNumber":"713-508-2912","email":"grallin85@privacy.gov.au"}, +{"id":295,"firstName":"Skye","lastName":"Arsey","street":"49126 Maryland Lane","postalCode":"02119","city":"Boston","state":"MA"}, +{"id":296,"firstName":"Karalee","lastName":"Biddiss","street":"0327 Coleman Lane","postalCode":"10203","city":"New York City","state":"NY","email":"kbiddiss87@studiopress.com"}, +{"id":297,"firstName":"Russ","lastName":"O' Mahony","street":"7831 Caliangt Avenue","postalCode":"37665","city":"Kingsport","state":"TN","phoneNumber":"423-292-1177","email":"romahony88@umich.edu"}, +{"id":298,"firstName":"Gerianne","lastName":"Morfey","street":"1 Jay Hill","postalCode":"97229","city":"Portland","state":"OR","email":"gmorfey89@techcrunch.com"}, +{"id":299,"firstName":"Griz","lastName":"Vellacott","street":"44 Parkside Court","postalCode":"64149","city":"Kansas City","state":"MO","phoneNumber":"816-120-1692"}, +{"id":300,"firstName":"Parker","lastName":"Mantz","street":"3 Arkansas Lane","postalCode":"90005","city":"Los Angeles","state":"CA","email":"pmantz8b@va.gov"}, +{"id":301,"firstName":"Drugi","lastName":"Acaster","street":"426 Hagan Park","postalCode":"20599","city":"Washington","state":"DC","email":"dacaster8c@ihg.com"}, +{"id":302,"firstName":"Peder","lastName":"Monget","street":"9 Wayridge Parkway","postalCode":"92862","city":"Orange","state":"CA","phoneNumber":"714-532-0867","email":"pmonget8d@biblegateway.com"}, +{"id":303,"firstName":"Zilvia","lastName":"Grocutt","street":"1 Stuart Circle","postalCode":"34642","city":"Seminole","state":"FL"}, +{"id":304,"firstName":"Clyve","lastName":"Gunby","street":"75 Dunning Junction","postalCode":"79977","city":"El Paso","state":"TX","email":"cgunby8f@microsoft.com"}, +{"id":305,"firstName":"Zacharias","lastName":"Tomasini","street":"48488 Thackeray Way","postalCode":"40210","city":"Louisville","state":"KY","email":"ztomasini8g@harvard.edu"}, +{"id":306,"firstName":"Ferdinand","lastName":"McGuinley","street":"30366 Kipling Drive","postalCode":"23208","city":"Richmond","state":"VA","email":"fmcguinley8h@archive.org"}, +{"id":307,"firstName":"Ebonee","lastName":"Brumfitt","street":"18765 Division Terrace","postalCode":"30033","city":"Decatur","state":"GA","phoneNumber":"404-684-8364","email":"ebrumfitt8i@sourceforge.net"}, +{"id":308,"firstName":"Christy","lastName":"Cuniam","street":"6 Homewood Road","postalCode":"78744","city":"Austin","state":"TX","phoneNumber":"361-677-9833","email":"ccuniam8j@51.la"}, +{"id":309,"firstName":"Emelen","lastName":"Casin","street":"91 Thompson Plaza","postalCode":"33954","city":"Port Charlotte","state":"FL","email":"ecasin8k@webnode.com"}, +{"id":310,"firstName":"Babara","lastName":"Robberecht","street":"603 Oak Terrace","postalCode":"37450","city":"Chattanooga","state":"TN","email":"brobberecht8l@cargocollective.com"}, +{"id":311,"firstName":"Cesar","lastName":"Whitecross","street":"024 Oxford Junction","postalCode":"20226","city":"Washington","state":"DC","phoneNumber":"202-772-2936"}, +{"id":312,"firstName":"Frieda","lastName":"Sliman","street":"4 Beilfuss Hill","postalCode":"23324","city":"Chesapeake","state":"VA","email":"fsliman8n@bigcartel.com"}, +{"id":313,"firstName":"Dylan","lastName":"Paige","street":"26 Gina Parkway","postalCode":"55448","city":"Minneapolis","state":"MN","email":"dpaige8o@trellian.com"}, +{"id":314,"firstName":"Waring","lastName":"Labon","street":"2843 Spenser Center","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-274-0766","email":"wlabon8p@ucla.edu"}, +{"id":315,"firstName":"Conny","lastName":"Duinkerk","street":"65 Lunder Circle","postalCode":"45426","city":"Dayton","state":"OH","email":"cduinkerk8q@economist.com"}, +{"id":316,"firstName":"Nessie","lastName":"Stucksbury","street":"91449 Browning Drive","postalCode":"25705","city":"Huntington","state":"WV","phoneNumber":"304-182-0766"}, +{"id":317,"firstName":"Corrine","lastName":"Kohlert","street":"00706 Carioca Plaza","postalCode":"45223","city":"Cincinnati","state":"OH","email":"ckohlert8s@wunderground.com"}, +{"id":318,"firstName":"Horatio","lastName":"Greengrass","street":"0 Cascade Park","postalCode":"79905","city":"El Paso","state":"TX","email":"hgreengrass8t@ameblo.jp"}, +{"id":319,"firstName":"Jana","lastName":"McLae","street":"919 Esch Place","postalCode":"55428","city":"Minneapolis","state":"MN","email":"jmclae8u@nytimes.com"}, +{"id":320,"firstName":"Maressa","lastName":"Rehor","street":"55 Talisman Junction","postalCode":"90505","city":"Torrance","state":"CA","email":"mrehor8v@vinaora.com"}, +{"id":321,"firstName":"Filide","lastName":"Riehm","street":"0 Karstens Lane","postalCode":"95054","city":"Santa Clara","state":"CA"}, +{"id":322,"firstName":"Bunnie","lastName":"Mumbey","street":"9369 Bayside Circle","postalCode":"46216","city":"Indianapolis","state":"IN","email":"bmumbey8x@scribd.com"}, +{"id":323,"firstName":"Maxi","lastName":"Jentgens","street":"2970 Rowland Circle","postalCode":"84189","city":"Salt Lake City","state":"UT","phoneNumber":"801-423-8854","email":"mjentgens8y@ihg.com"}, +{"id":324,"firstName":"Florri","lastName":"Okenden","street":"2180 Cody Point","postalCode":"70187","city":"New Orleans","state":"LA","phoneNumber":"504-913-1989","email":"fokenden8z@networksolutions.com"}, +{"id":325,"firstName":"Imogen","lastName":"Grisard","street":"8 Westerfield Avenue","postalCode":"92668","city":"Orange","state":"CA","email":"igrisard90@tamu.edu"}, +{"id":326,"firstName":"Edwina","lastName":"Montes","street":"92 Carpenter Avenue","postalCode":"97216","city":"Portland","state":"OR","phoneNumber":"503-544-7296","email":"emontes91@reference.com"}, +{"id":327,"firstName":"Renelle","lastName":"MacCambridge","street":"77 Talmadge Circle","postalCode":"08638","city":"Trenton","state":"NJ","phoneNumber":"609-150-9438","email":"rmaccambridge92@springer.com"}, +{"id":328,"firstName":"Sterne","lastName":"Taberner","street":"642 6th Terrace","postalCode":"10120","city":"New York City","state":"NY","email":"staberner93@miibeian.gov.cn"}, +{"id":329,"firstName":"Garvy","lastName":"Pankethman","street":"8618 Kennedy Terrace","postalCode":"79405","city":"Lubbock","state":"TX","phoneNumber":"806-470-8784","email":"gpankethman94@free.fr"}, +{"id":330,"firstName":"Nathanil","lastName":"Holston","street":"27247 Eliot Avenue","postalCode":"31190","city":"Atlanta","state":"GA","email":"nholston95@drupal.org"}, +{"id":331,"firstName":"Caresse","lastName":"Kilty","street":"514 Manufacturers Pass","postalCode":"76205","city":"Denton","state":"TX","email":"ckilty96@umich.edu"}, +{"id":332,"firstName":"Arlinda","lastName":"Brenstuhl","street":"2 Sunnyside Avenue","postalCode":"55470","city":"Minneapolis","state":"MN","email":"abrenstuhl97@wisc.edu"}, +{"id":333,"firstName":"Darcy","lastName":"Dunne","street":"3 Badeau Park","postalCode":"91328","city":"Northridge","state":"CA"}, +{"id":334,"firstName":"Malva","lastName":"Grew","street":"2242 Huxley Hill","postalCode":"68510","city":"Lincoln","state":"NE","email":"mgrew99@com.com"}, +{"id":335,"firstName":"Sukey","lastName":"Winspur","street":"475 Melvin Way","postalCode":"68524","city":"Lincoln","state":"NE","phoneNumber":"402-816-9401"}, +{"id":336,"firstName":"Beth","lastName":"O'Dougherty","street":"450 Eastlawn Park","postalCode":"93591","city":"Palmdale","state":"CA","phoneNumber":"661-845-8781"}, +{"id":337,"firstName":"Cortney","lastName":"Meers","street":"9 Chive Drive","postalCode":"93762","city":"Fresno","state":"CA","email":"cmeers9c@diigo.com"}, +{"id":338,"firstName":"Geralda","lastName":"Brocket","street":"0686 La Follette Avenue","postalCode":"80126","city":"Littleton","state":"CO","phoneNumber":"720-641-1371","email":"gbrocket9d@youku.com"}, +{"id":339,"firstName":"Lishe","lastName":"Maliphant","street":"5 Erie Plaza","postalCode":"63169","city":"Saint Louis","state":"MO","email":"lmaliphant9e@sfgate.com"}, +{"id":340,"firstName":"Brod","lastName":"Dobrovsky","street":"9 Gateway Park","postalCode":"79405","city":"Lubbock","state":"TX"}, +{"id":341,"firstName":"Philippe","lastName":"Argile","street":"4 Red Cloud Plaza","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-633-5495"}, +{"id":342,"firstName":"Sadye","lastName":"Sally","street":"07 Mendota Terrace","postalCode":"75507","city":"Texarkana","state":"TX","email":"ssally9h@e-recht24.de"}, +{"id":343,"firstName":"Napoleon","lastName":"Piggott","street":"3968 Roxbury Point","postalCode":"35905","city":"Gadsden","state":"AL","email":"npiggott9i@cnbc.com"}, +{"id":344,"firstName":"Jere","lastName":"Larn","street":"5086 Dahle Crossing","postalCode":"39534","city":"Biloxi","state":"MS","email":"jlarn9j@twitter.com"}, +{"id":345,"firstName":"Bevon","lastName":"Stidson","street":"7 Armistice Court","postalCode":"23436","city":"Suffolk","state":"VA","email":"bstidson9k@alexa.com"}, +{"id":346,"firstName":"Drugi","lastName":"Ewbach","street":"6032 5th Avenue","postalCode":"02208","city":"Boston","state":"MA","email":"dewbach9l@techcrunch.com"}, +{"id":347,"firstName":"Milka","lastName":"Caizley","street":"7 Anderson Junction","postalCode":"37228","city":"Nashville","state":"TN","phoneNumber":"615-305-6985","email":"mcaizley9m@cyberchimps.com"}, +{"id":348,"firstName":"Wilton","lastName":"Biagi","street":"80833 6th Crossing","postalCode":"40215","city":"Louisville","state":"KY","email":"wbiagi9n@vinaora.com"}, +{"id":349,"firstName":"Dilly","lastName":"Spradbrow","street":"5 Harbort Street","postalCode":"45419","city":"Dayton","state":"OH","email":"dspradbrow9o@marketwatch.com"}, +{"id":350,"firstName":"Gan","lastName":"Gookey","street":"8387 Bultman Terrace","postalCode":"75241","city":"Dallas","state":"TX"}, +{"id":351,"firstName":"Nanon","lastName":"Mulrenan","street":"47257 Reindahl Drive","postalCode":"22119","city":"Merrifield","state":"VA","phoneNumber":"571-637-8154","email":"nmulrenan9q@godaddy.com"}, +{"id":352,"firstName":"Frederique","lastName":"Watkiss","street":"61 Heath Pass","postalCode":"70124","city":"New Orleans","state":"LA","phoneNumber":"504-891-7051"}, +{"id":353,"firstName":"Sinclare","lastName":"MacCurlye","street":"514 Meadow Ridge Place","postalCode":"97240","city":"Portland","state":"OR","phoneNumber":"971-190-5174","email":"smaccurlye9s@google.ru"}, +{"id":354,"firstName":"Jessie","lastName":"Newlands","street":"80509 Northland Pass","postalCode":"33111","city":"Miami","state":"FL","phoneNumber":"786-557-9193"}, +{"id":355,"firstName":"Jamaal","lastName":"Molder","street":"90 Mcbride Trail","postalCode":"78764","city":"Austin","state":"TX","phoneNumber":"512-320-8728"}, +{"id":356,"firstName":"Benni","lastName":"Sherel","street":"7 Springs Road","postalCode":"15235","city":"Pittsburgh","state":"PA","email":"bsherel9v@hostgator.com"}, +{"id":357,"firstName":"Dene","lastName":"Brigge","street":"8560 Sutteridge Parkway","postalCode":"32412","city":"Panama City","state":"FL"}, +{"id":358,"firstName":"Timoteo","lastName":"Iban","street":"52858 Oak Valley Hill","postalCode":"93750","city":"Fresno","state":"CA","email":"tiban9x@europa.eu"}, +{"id":359,"firstName":"Dar","lastName":"Quillinane","street":"2 Carberry Junction","postalCode":"66276","city":"Shawnee Mission","state":"KS","phoneNumber":"913-977-7562","email":"dquillinane9y@msn.com"}, +{"id":360,"firstName":"Claudian","lastName":"Tinson","street":"445 Novick Avenue","postalCode":"79968","city":"El Paso","state":"TX","email":"ctinson9z@google.cn"}, +{"id":361,"firstName":"Clarice","lastName":"Deneve","street":"94 Meadow Ridge Road","postalCode":"37131","city":"Murfreesboro","state":"TN","phoneNumber":"615-780-7667"}, +{"id":362,"firstName":"Hilary","lastName":"Bithell","street":"20 Russell Trail","postalCode":"81010","city":"Pueblo","state":"CO","email":"hbithella1@list-manage.com"}, +{"id":363,"firstName":"Mathew","lastName":"Scrivin","street":"4 Elgar Point","postalCode":"90081","city":"Los Angeles","state":"CA","phoneNumber":"213-898-6650","email":"mscrivina2@about.me"}, +{"id":364,"firstName":"Idell","lastName":"Rambadt","street":"6 Cherokee Hill","postalCode":"90840","city":"Long Beach","state":"CA","email":"irambadta3@ustream.tv"}, +{"id":365,"firstName":"Nealon","lastName":"Schoolfield","street":"1 Northland Point","postalCode":"74133","city":"Tulsa","state":"OK"}, +{"id":366,"firstName":"Gregorius","lastName":"Bartot","street":"24636 Eagle Crest Crossing","postalCode":"32215","city":"Jacksonville","state":"FL","email":"gbartota5@blogger.com"}, +{"id":367,"firstName":"Inessa","lastName":"Hullin","street":"559 Bartillon Trail","postalCode":"33142","city":"Miami","state":"FL","phoneNumber":"305-381-6621","email":"ihullina6@pcworld.com"}, +{"id":368,"firstName":"Andie","lastName":"Bampford","street":"5204 Meadow Valley Street","postalCode":"92825","city":"Anaheim","state":"CA","email":"abampforda7@sun.com"}, +{"id":369,"firstName":"Duane","lastName":"MacShirrie","street":"5077 Kings Parkway","postalCode":"92725","city":"Santa Ana","state":"CA","email":"dmacshirriea8@rambler.ru"}, +{"id":370,"firstName":"Sydel","lastName":"Deerr","street":"1 Commercial Road","postalCode":"30356","city":"Atlanta","state":"GA","phoneNumber":"404-209-0194","email":"sdeerra9@phpbb.com"}, +{"id":371,"firstName":"Mel","lastName":"Miles","street":"28164 Melody Plaza","postalCode":"90847","city":"Long Beach","state":"CA","phoneNumber":"562-932-1172"}, +{"id":372,"firstName":"Jone","lastName":"Drinkel","street":"946 Reindahl Point","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-547-0653"}, +{"id":373,"firstName":"Marcellus","lastName":"MacGilmartin","street":"10568 Westerfield Way","postalCode":"32868","city":"Orlando","state":"FL","phoneNumber":"407-874-6188","email":"mmacgilmartinac@fotki.com"}, +{"id":374,"firstName":"Bret","lastName":"Hardan","street":"9 Hayes Crossing","postalCode":"32309","city":"Tallahassee","state":"FL","email":"bhardanad@mit.edu"}, +{"id":375,"firstName":"Heddie","lastName":"Cesaric","street":"502 Cody Crossing","postalCode":"95397","city":"Modesto","state":"CA"}, +{"id":376,"firstName":"Tansy","lastName":"Maeer","street":"526 Messerschmidt Court","postalCode":"94089","city":"Sunnyvale","state":"CA","email":"tmaeeraf@arizona.edu"}, +{"id":377,"firstName":"Waverly","lastName":"West-Frimley","street":"02 Quincy Trail","postalCode":"20575","city":"Washington","state":"DC","phoneNumber":"202-493-3304","email":"wwestfrimleyag@ft.com"}, +{"id":378,"firstName":"Dido","lastName":"de Clercq","street":"7 Norway Maple Center","postalCode":"84125","city":"Salt Lake City","state":"UT","email":"ddeclercqah@trellian.com"}, +{"id":379,"firstName":"Vic","lastName":"Samuels","street":"2 Kipling Drive","postalCode":"31190","city":"Atlanta","state":"GA","email":"vsamuelsai@goo.gl"}, +{"id":380,"firstName":"Jeno","lastName":"Freiburger","street":"431 Golden Leaf Parkway","postalCode":"32610","city":"Gainesville","state":"FL","email":"jfreiburgeraj@theguardian.com"}, +{"id":381,"firstName":"Christine","lastName":"Basketter","street":"4 Lotheville Terrace","postalCode":"39305","city":"Meridian","state":"MS","phoneNumber":"601-702-1546"}, +{"id":382,"firstName":"Karry","lastName":"Corsan","street":"09189 Lakeland Point","postalCode":"27409","city":"Greensboro","state":"NC","phoneNumber":"336-445-0006","email":"kcorsanal@usgs.gov"}, +{"id":383,"firstName":"Barri","lastName":"Brinsden","street":"53 Shelley Drive","postalCode":"35225","city":"Birmingham","state":"AL","email":"bbrinsdenam@1und1.de"}, +{"id":384,"firstName":"Hyacintha","lastName":"Boddam","street":"45 Sugar Circle","postalCode":"10160","city":"New York City","state":"NY","phoneNumber":"212-794-6062"}, +{"id":385,"firstName":"Brande","lastName":"Remnant","street":"283 Stone Corner Road","postalCode":"31904","city":"Columbus","state":"GA","phoneNumber":"706-211-4851","email":"bremnantao@people.com.cn"}, +{"id":386,"firstName":"Tally","lastName":"Bygraves","street":"54833 Northport Pass","postalCode":"85072","city":"Phoenix","state":"AZ","email":"tbygravesap@jigsy.com"}, +{"id":387,"firstName":"Garfield","lastName":"Pressnell","street":"63077 Hudson Court","postalCode":"30061","city":"Marietta","state":"GA","email":"gpressnellaq@archive.org"}, +{"id":388,"firstName":"Romonda","lastName":"Stiggles","street":"17 Russell Parkway","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-600-9676"}, +{"id":389,"firstName":"Dedie","lastName":"Ralling","street":"8 Judy Plaza","postalCode":"94137","city":"San Francisco","state":"CA","email":"drallingas@wikia.com"}, +{"id":390,"firstName":"Maddi","lastName":"Cornau","street":"5 Oriole Way","postalCode":"92105","city":"San Diego","state":"CA","phoneNumber":"619-388-6359","email":"mcornauat@adobe.com"}, +{"id":391,"firstName":"Zeke","lastName":"Jennery","street":"65332 Sommers Avenue","postalCode":"48206","city":"Detroit","state":"MI","email":"zjenneryau@elegantthemes.com"}, +{"id":392,"firstName":"Danya","lastName":"Fairlaw","street":"343 Logan Alley","postalCode":"33111","city":"Miami","state":"FL","email":"dfairlawav@irs.gov"}, +{"id":393,"firstName":"Rabi","lastName":"Petheridge","street":"7 Monica Alley","postalCode":"64054","city":"Independence","state":"MO","phoneNumber":"816-501-9452"}, +{"id":394,"firstName":"Ebba","lastName":"Skellen","street":"2655 Iowa Terrace","postalCode":"63150","city":"Saint Louis","state":"MO","phoneNumber":"314-695-7831","email":"eskellenax@nbcnews.com"}, +{"id":395,"firstName":"Marie-ann","lastName":"Glaysher","street":"4 Lakewood Hill","postalCode":"12247","city":"Albany","state":"NY","phoneNumber":"518-634-2425"}, +{"id":396,"firstName":"Arne","lastName":"Quincey","street":"162 Redwing Way","postalCode":"83711","city":"Boise","state":"ID"}, +{"id":397,"firstName":"Clarita","lastName":"Okroy","street":"05 Delaware Way","postalCode":"45218","city":"Cincinnati","state":"OH","email":"cokroyb0@stumbleupon.com"}, +{"id":398,"firstName":"Renault","lastName":"Weighell","street":"498 Dovetail Place","postalCode":"79710","city":"Midland","state":"TX","phoneNumber":"432-955-1408"}, +{"id":399,"firstName":"Roderich","lastName":"Mankor","street":"07 Dayton Way","postalCode":"92160","city":"San Diego","state":"CA"}, +{"id":400,"firstName":"Arv","lastName":"Sunnex","street":"89 Ronald Regan Terrace","postalCode":"91109","city":"Pasadena","state":"CA","email":"asunnexb3@vkontakte.ru"}, +{"id":401,"firstName":"Sonia","lastName":"Cowperthwaite","street":"77 Dennis Point","postalCode":"16550","city":"Erie","state":"PA"}, +{"id":402,"firstName":"Buddie","lastName":"Goscomb","street":"85675 Eastlawn Pass","postalCode":"20535","city":"Washington","state":"DC"}, +{"id":403,"firstName":"Brandi","lastName":"Swaine","street":"39961 Del Mar Lane","postalCode":"39705","city":"Columbus","state":"MS","phoneNumber":"662-306-2164","email":"bswaineb6@miibeian.gov.cn"}, +{"id":404,"firstName":"Jenny","lastName":"Cabbell","street":"743 Fordem Center","postalCode":"78285","city":"San Antonio","state":"TX","phoneNumber":"210-491-9874","email":"jcabbellb7@techcrunch.com"}, +{"id":405,"firstName":"Vincent","lastName":"People","street":"83 Tennessee Way","postalCode":"77293","city":"Houston","state":"TX","phoneNumber":"281-261-1928","email":"vpeopleb8@github.io"}, +{"id":406,"firstName":"Reinald","lastName":"Roles","street":"2 Division Road","postalCode":"53785","city":"Madison","state":"WI","phoneNumber":"608-568-7958","email":"rrolesb9@google.fr"}, +{"id":407,"firstName":"Kale","lastName":"Wanek","street":"7 Crescent Oaks Terrace","postalCode":"46852","city":"Fort Wayne","state":"IN","phoneNumber":"260-844-9669","email":"kwanekba@scribd.com"}, +{"id":408,"firstName":"Charisse","lastName":"Perse","street":"94449 Gateway Street","postalCode":"91117","city":"Pasadena","state":"CA","email":"cpersebb@ycombinator.com"}, +{"id":409,"firstName":"Konstantin","lastName":"Aslum","street":"08 Kings Trail","postalCode":"80328","city":"Boulder","state":"CO","email":"kaslumbc@opera.com"}, +{"id":410,"firstName":"Tyson","lastName":"O'Hartigan","street":"75122 Crowley Place","postalCode":"95173","city":"San Jose","state":"CA","phoneNumber":"408-879-0901","email":"tohartiganbd@devhub.com"}, +{"id":411,"firstName":"Fallon","lastName":"Haysman","street":"477 High Crossing Place","postalCode":"23293","city":"Richmond","state":"VA"}, +{"id":412,"firstName":"Svend","lastName":"Scarlet","street":"2856 Merrick Circle","postalCode":"90087","city":"Los Angeles","state":"CA","email":"sscarletbf@clickbank.net"}, +{"id":413,"firstName":"Gabey","lastName":"Colter","street":"7 2nd Alley","postalCode":"90610","city":"Whittier","state":"CA"}, +{"id":414,"firstName":"Hart","lastName":"Densell","street":"2687 Elka Alley","postalCode":"99599","city":"Anchorage","state":"AK","phoneNumber":"907-286-6079"}, +{"id":415,"firstName":"Claresta","lastName":"Folger","street":"5 Amoth Alley","postalCode":"27116","city":"Winston Salem","state":"NC"}, +{"id":416,"firstName":"Rica","lastName":"Lightowlers","street":"54303 Mayer Drive","postalCode":"61825","city":"Champaign","state":"IL","email":"rlightowlersbj@so-net.ne.jp"}, +{"id":417,"firstName":"Paula","lastName":"Treadaway","street":"8 Anniversary Road","postalCode":"20456","city":"Washington","state":"DC"}, +{"id":418,"firstName":"Francoise","lastName":"Gooderick","street":"13 Knutson Lane","postalCode":"33325","city":"Fort Lauderdale","state":"FL","email":"fgooderickbl@dedecms.com"}, +{"id":419,"firstName":"Ferdy","lastName":"Nannizzi","street":"578 Esker Trail","postalCode":"25321","city":"Charleston","state":"WV","email":"fnannizzibm@rambler.ru"}, +{"id":420,"firstName":"Dody","lastName":"Gettone","street":"9 Veith Court","postalCode":"62711","city":"Springfield","state":"IL"}, +{"id":421,"firstName":"Ronna","lastName":"Godleman","street":"6 Jenna Trail","postalCode":"22301","city":"Alexandria","state":"VA","email":"rgodlemanbo@hexun.com"}, +{"id":422,"firstName":"Adey","lastName":"Waith","street":"2 Mayer Avenue","postalCode":"12325","city":"Schenectady","state":"NY"}, +{"id":423,"firstName":"Stanislaw","lastName":"Garahan","street":"660 Merry Avenue","postalCode":"62723","city":"Springfield","state":"IL","phoneNumber":"217-587-6734"}, +{"id":424,"firstName":"Westley","lastName":"Knowles","street":"67430 Lakeland Circle","postalCode":"53263","city":"Milwaukee","state":"WI","email":"wknowlesbr@msu.edu"}, +{"id":425,"firstName":"Dion","lastName":"Jamson","street":"696 Birchwood Circle","postalCode":"80015","city":"Aurora","state":"CO","phoneNumber":"720-486-4494"}, +{"id":426,"firstName":"Glynis","lastName":"Bourhill","street":"091 Harper Park","postalCode":"40250","city":"Louisville","state":"KY"}, +{"id":427,"firstName":"Massimo","lastName":"Briand","street":"37 Northview Junction","postalCode":"75507","city":"Texarkana","state":"TX","email":"mbriandbu@etsy.com"}, +{"id":428,"firstName":"Tremayne","lastName":"Cadore","street":"6721 Anthes Point","postalCode":"94605","city":"Oakland","state":"CA","email":"tcadorebv@mozilla.com"}, +{"id":429,"firstName":"Lea","lastName":"Wildman","street":"52 Dixon Point","postalCode":"50310","city":"Des Moines","state":"IA","phoneNumber":"515-536-2096"}, +{"id":430,"firstName":"Ambur","lastName":"Oxlade","street":"356 Porter Center","postalCode":"44485","city":"Warren","state":"OH"}, +{"id":431,"firstName":"Jyoti","lastName":"Gillet","street":"13 Del Mar Parkway","postalCode":"81505","city":"Grand Junction","state":"CO","phoneNumber":"970-598-0357"}, +{"id":432,"firstName":"Sascha","lastName":"Stanyan","street":"77289 Blue Bill Park Alley","postalCode":"06120","city":"Hartford","state":"CT","email":"sstanyanbz@geocities.jp"}, +{"id":433,"firstName":"Spenser","lastName":"Harry","street":"2021 Oak Place","postalCode":"32835","city":"Orlando","state":"FL","email":"sharryc0@privacy.gov.au"}, +{"id":434,"firstName":"Clim","lastName":"Penrose","street":"8 Warrior Road","postalCode":"15255","city":"Pittsburgh","state":"PA","email":"cpenrosec1@blogtalkradio.com"}, +{"id":435,"firstName":"Jewell","lastName":"McKinnon","street":"4 Delladonna Street","postalCode":"36114","city":"Montgomery","state":"AL","email":"jmckinnonc2@tinypic.com"}, +{"id":436,"firstName":"Estrellita","lastName":"Amburgy","street":"5538 Tennessee Plaza","postalCode":"17121","city":"Harrisburg","state":"PA","phoneNumber":"717-274-8930","email":"eamburgyc3@forbes.com"}, +{"id":437,"firstName":"Sarah","lastName":"Fears","street":"61 Springs Park","postalCode":"93034","city":"Oxnard","state":"CA","email":"sfearsc4@wisc.edu"}, +{"id":438,"firstName":"Nixie","lastName":"Peddie","street":"7 Armistice Way","postalCode":"10155","city":"New York City","state":"NY","email":"npeddiec5@free.fr"}, +{"id":439,"firstName":"Ardisj","lastName":"Rohmer","street":"726 Crowley Point","postalCode":"93399","city":"Bakersfield","state":"CA","email":"arohmerc6@google.nl"}, +{"id":440,"firstName":"Wallie","lastName":"Johanssen","street":"9555 Jana Park","postalCode":"28410","city":"Wilmington","state":"NC","phoneNumber":"910-160-4520","email":"wjohanssenc7@boston.com"}, +{"id":441,"firstName":"Allan","lastName":"Jodlkowski","street":"31585 Kedzie Park","postalCode":"89150","city":"Las Vegas","state":"NV","phoneNumber":"702-782-3289","email":"ajodlkowskic8@sogou.com"}, +{"id":442,"firstName":"Harris","lastName":"Cadden","street":"96829 Fieldstone Park","postalCode":"16565","city":"Erie","state":"PA","phoneNumber":"814-745-1099"}, +{"id":443,"firstName":"Nigel","lastName":"Girardengo","street":"24703 Red Cloud Road","postalCode":"90310","city":"Inglewood","state":"CA","email":"ngirardengoca@ow.ly"}, +{"id":444,"firstName":"Aila","lastName":"Tinniswood","street":"62812 Stephen Parkway","postalCode":"13205","city":"Syracuse","state":"NY","phoneNumber":"315-847-2259","email":"atinniswoodcb@google.com.br"}, +{"id":445,"firstName":"Genni","lastName":"Geockle","street":"81 Bobwhite Plaza","postalCode":"93721","city":"Fresno","state":"CA","email":"ggeocklecc@furl.net"}, +{"id":446,"firstName":"Madison","lastName":"Brikner","street":"166 Coolidge Trail","postalCode":"07208","city":"Elizabeth","state":"NJ","email":"mbriknercd@myspace.com"}, +{"id":447,"firstName":"Akim","lastName":"Gotthard.sf","street":"0017 Heffernan Parkway","postalCode":"71914","city":"Hot Springs National Park","state":"AR","email":"agotthardsfce@google.com.au"}, +{"id":448,"firstName":"Andria","lastName":"Cardello","street":"1089 Stang Road","postalCode":"96835","city":"Honolulu","state":"HI","phoneNumber":"808-372-6528"}, +{"id":449,"firstName":"Laureen","lastName":"Crawshaw","street":"13 Manitowish Avenue","postalCode":"23504","city":"Norfolk","state":"VA","phoneNumber":"757-220-4043"}, +{"id":450,"firstName":"Henderson","lastName":"Parmley","street":"3408 Superior Street","postalCode":"28410","city":"Wilmington","state":"NC","email":"hparmleych@diigo.com"}, +{"id":451,"firstName":"Henri","lastName":"Arnley","street":"54 Knutson Park","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"718-365-7389"}, +{"id":452,"firstName":"Phil","lastName":"Trunkfield","street":"07 Arizona Way","postalCode":"85030","city":"Phoenix","state":"AZ","email":"ptrunkfieldcj@cisco.com"}, +{"id":453,"firstName":"Chery","lastName":"Nangle","street":"03 Merrick Way","postalCode":"88569","city":"El Paso","state":"TX","phoneNumber":"915-959-5535","email":"cnangleck@tumblr.com"}, +{"id":454,"firstName":"Leora","lastName":"Fields","street":"0260 Eastlawn Lane","postalCode":"85311","city":"Glendale","state":"AZ","email":"lfieldscl@nyu.edu"}, +{"id":455,"firstName":"Ronnica","lastName":"Pocknoll","street":"786 Hovde Plaza","postalCode":"78410","city":"Corpus Christi","state":"TX","email":"rpocknollcm@unesco.org"}, +{"id":456,"firstName":"Valida","lastName":"Romayn","street":"1108 Hudson Drive","postalCode":"34615","city":"Clearwater","state":"FL","email":"vromayncn@usatoday.com"}, +{"id":457,"firstName":"Randee","lastName":"Strowther","street":"441 Cordelia Point","postalCode":"27710","city":"Durham","state":"NC","phoneNumber":"919-463-1516","email":"rstrowtherco@trellian.com"}, +{"id":458,"firstName":"Ansell","lastName":"Blacklock","street":"9393 Kedzie Point","postalCode":"75358","city":"Dallas","state":"TX","phoneNumber":"214-949-3912"}, +{"id":459,"firstName":"Bailie","lastName":"Wing","street":"79459 Buhler Way","postalCode":"15279","city":"Pittsburgh","state":"PA","phoneNumber":"412-431-5446"}, +{"id":460,"firstName":"Leesa","lastName":"Wellbeloved","street":"4553 Dakota Circle","postalCode":"40215","city":"Louisville","state":"KY","phoneNumber":"502-145-8496","email":"lwellbelovedcr@go.com"}, +{"id":461,"firstName":"Sarge","lastName":"Tocknell","street":"9884 North Alley","postalCode":"80249","city":"Denver","state":"CO","phoneNumber":"303-603-8315","email":"stocknellcs@artisteer.com"}, +{"id":462,"firstName":"Loralyn","lastName":"Grimolbie","street":"3620 Clyde Gallagher Junction","postalCode":"91103","city":"Pasadena","state":"CA","email":"lgrimolbiect@purevolume.com"}, +{"id":463,"firstName":"Ki","lastName":"Youdell","street":"3 Gina Center","postalCode":"81005","city":"Pueblo","state":"CO"}, +{"id":464,"firstName":"Katerine","lastName":"Herreros","street":"70 Westend Place","postalCode":"57105","city":"Sioux Falls","state":"SD"}, +{"id":465,"firstName":"Frasquito","lastName":"Nockolds","street":"21 Dwight Park","postalCode":"11236","city":"Brooklyn","state":"NY","phoneNumber":"917-761-0549"}, +{"id":466,"firstName":"Krystalle","lastName":"Brierly","street":"7797 Forest Dale Lane","postalCode":"90410","city":"Santa Monica","state":"CA","email":"kbrierlycx@simplemachines.org"}, +{"id":467,"firstName":"Tobin","lastName":"Guillford","street":"501 Messerschmidt Alley","postalCode":"98195","city":"Seattle","state":"WA","phoneNumber":"206-862-7413","email":"tguillfordcy@fastcompany.com"}, +{"id":468,"firstName":"Lorita","lastName":"Sikorski","street":"83 Corscot Junction","postalCode":"44905","city":"Mansfield","state":"OH","phoneNumber":"419-278-2324","email":"lsikorskicz@intel.com"}, +{"id":469,"firstName":"Hermon","lastName":"Chomley","street":"696 Talisman Lane","postalCode":"35290","city":"Birmingham","state":"AL"}, +{"id":470,"firstName":"Karolina","lastName":"Andrault","street":"49738 Maple Wood Place","postalCode":"99709","city":"Fairbanks","state":"AK","phoneNumber":"907-337-1698","email":"kandraultd1@bloglines.com"}, +{"id":471,"firstName":"Lev","lastName":"Pankhurst.","street":"442 Pennsylvania Crossing","postalCode":"23605","city":"Newport News","state":"VA","phoneNumber":"757-832-3631"}, +{"id":472,"firstName":"Bianca","lastName":"Garfath","street":"7 Forest Run Center","postalCode":"71914","city":"Hot Springs National Park","state":"AR","email":"bgarfathd3@youku.com"}, +{"id":473,"firstName":"Walden","lastName":"Van der Linde","street":"6 Namekagon Parkway","postalCode":"70187","city":"New Orleans","state":"LA","email":"wvanderlinded4@netscape.com"}, +{"id":474,"firstName":"Alexandra","lastName":"Vasyukhin","street":"471 School Alley","postalCode":"80910","city":"Colorado Springs","state":"CO","email":"avasyukhind5@samsung.com"}, +{"id":475,"firstName":"Perry","lastName":"Spere","street":"33 Autumn Leaf Street","postalCode":"79994","city":"El Paso","state":"TX","email":"pspered6@tamu.edu"}, +{"id":476,"firstName":"Cristobal","lastName":"Afonso","street":"5 Lake View Way","postalCode":"19136","city":"Philadelphia","state":"PA","email":"cafonsod7@themeforest.net"}, +{"id":477,"firstName":"Sebastien","lastName":"Annets","street":"4229 Bowman Trail","postalCode":"43699","city":"Toledo","state":"OH","phoneNumber":"419-981-8630","email":"sannetsd8@guardian.co.uk"}, +{"id":478,"firstName":"Prentice","lastName":"Desorts","street":"54 Mendota Drive","postalCode":"31196","city":"Atlanta","state":"GA","phoneNumber":"404-235-6736","email":"pdesortsd9@who.int"}, +{"id":479,"firstName":"Rubin","lastName":"Dunkerk","street":"035 Myrtle Park","postalCode":"94297","city":"Sacramento","state":"CA","phoneNumber":"916-658-2157","email":"rdunkerkda@columbia.edu"}, +{"id":480,"firstName":"Jesselyn","lastName":"Bidnall","street":"2353 Norway Maple Court","postalCode":"07522","city":"Paterson","state":"NJ","email":"jbidnalldb@4shared.com"}, +{"id":481,"firstName":"Arleta","lastName":"Massy","street":"2 Bluejay Lane","postalCode":"10310","city":"Staten Island","state":"NY"}, +{"id":482,"firstName":"Trescha","lastName":"Joncic","street":"052 Summit Way","postalCode":"13217","city":"Syracuse","state":"NY"}, +{"id":483,"firstName":"Joshuah","lastName":"Galbreth","street":"16 Elka Place","postalCode":"08922","city":"New Brunswick","state":"NJ","email":"jgalbrethde@rambler.ru"}, +{"id":484,"firstName":"Clywd","lastName":"Henlon","street":"26 Thackeray Pass","postalCode":"90040","city":"Los Angeles","state":"CA","email":"chenlondf@unesco.org"}, +{"id":485,"firstName":"Glenda","lastName":"Grayley","street":"6326 Ohio Plaza","postalCode":"91411","city":"Van Nuys","state":"CA"}, +{"id":486,"firstName":"Glynda","lastName":"Stokell","street":"6 Schmedeman Court","postalCode":"60641","city":"Chicago","state":"IL","email":"gstokelldh@ted.com"}, +{"id":487,"firstName":"Kath","lastName":"Harrap","street":"43769 Barby Plaza","postalCode":"32304","city":"Tallahassee","state":"FL","email":"kharrapdi@cargocollective.com"}, +{"id":488,"firstName":"Dickie","lastName":"Domotor","street":"2954 Toban Lane","postalCode":"98133","city":"Seattle","state":"WA","email":"ddomotordj@hhs.gov"}, +{"id":489,"firstName":"Ceciley","lastName":"Hitzke","street":"9102 Westport Pass","postalCode":"40618","city":"Frankfort","state":"KY","phoneNumber":"502-545-5506","email":"chitzkedk@newsvine.com"}, +{"id":490,"firstName":"Adler","lastName":"Webb-Bowen","street":"5 Hanover Street","postalCode":"32123","city":"Daytona Beach","state":"FL"}, +{"id":491,"firstName":"Fergus","lastName":"Domerq","street":"06 Hansons Road","postalCode":"58106","city":"Fargo","state":"ND","phoneNumber":"701-656-3778"}, +{"id":492,"firstName":"Kimbra","lastName":"Petherick","street":"867 Mayer Drive","postalCode":"39236","city":"Jackson","state":"MS"}, +{"id":493,"firstName":"Geneva","lastName":"Hobgen","street":"74 Vernon Parkway","postalCode":"53710","city":"Madison","state":"WI","email":"ghobgendo@google.de"}, +{"id":494,"firstName":"Jillane","lastName":"Skitral","street":"9747 Ruskin Point","postalCode":"22405","city":"Fredericksburg","state":"VA","email":"jskitraldp@mysql.com"}, +{"id":495,"firstName":"Carolin","lastName":"Pimblotte","street":"8 Union Way","postalCode":"75358","city":"Dallas","state":"TX","phoneNumber":"214-109-7114","email":"cpimblottedq@cargocollective.com"}, +{"id":496,"firstName":"Wandis","lastName":"Andreasson","street":"3 Nancy Parkway","postalCode":"70033","city":"Metairie","state":"LA","email":"wandreassondr@topsy.com"}, +{"id":497,"firstName":"Baily","lastName":"Dalliston","street":"602 Melrose Way","postalCode":"25331","city":"Charleston","state":"WV","email":"bdallistonds@storify.com"}, +{"id":498,"firstName":"Kissie","lastName":"Lammiman","street":"4 Memorial Terrace","postalCode":"06510","city":"New Haven","state":"CT","phoneNumber":"203-724-3731","email":"klammimandt@barnesandnoble.com"}, +{"id":499,"firstName":"Cloris","lastName":"Dorning","street":"4 Lien Road","postalCode":"37235","city":"Nashville","state":"TN","email":"cdorningdu@unesco.org"}, +{"id":500,"firstName":"Jemimah","lastName":"Juppe","street":"979 Tennessee Pass","postalCode":"85305","city":"Glendale","state":"AZ"}, +{"id":501,"firstName":"Fanchette","lastName":"Marlor","street":"90 Waywood Circle","postalCode":"44511","city":"Youngstown","state":"OH","email":"fmarlordw@is.gd"}, +{"id":502,"firstName":"Carmelle","lastName":"Stillmann","street":"9124 Sachtjen Way","postalCode":"74184","city":"Tulsa","state":"OK","email":"cstillmanndx@telegraph.co.uk"}, +{"id":503,"firstName":"Joelle","lastName":"Mumford","street":"5 Susan Point","postalCode":"28410","city":"Wilmington","state":"NC","email":"jmumforddy@yellowbook.com"}, +{"id":504,"firstName":"Vicky","lastName":"Danzelman","street":"472 Pond Junction","postalCode":"11220","city":"Brooklyn","state":"NY","email":"vdanzelmandz@stumbleupon.com"}, +{"id":505,"firstName":"Baudoin","lastName":"Grenshiels","street":"4703 Tony Circle","postalCode":"76198","city":"Fort Worth","state":"TX","email":"bgrenshielse0@devhub.com"}, +{"id":506,"firstName":"Rosetta","lastName":"Wennington","street":"3 Kensington Crossing","postalCode":"14619","city":"Rochester","state":"NY"}, +{"id":507,"firstName":"Eudora","lastName":"Murtell","street":"97 Mockingbird Circle","postalCode":"92867","city":"Orange","state":"CA","phoneNumber":"949-899-3967"}, +{"id":508,"firstName":"Sonnie","lastName":"Hawkin","street":"76669 Green Ridge Crossing","postalCode":"79491","city":"Lubbock","state":"TX","email":"shawkine3@wikia.com"}, +{"id":509,"firstName":"Ulysses","lastName":"Uman","street":"4 Fieldstone Circle","postalCode":"32128","city":"Daytona Beach","state":"FL","phoneNumber":"386-761-6071","email":"uumane4@multiply.com"}, +{"id":510,"firstName":"Alidia","lastName":"Kowalski","street":"3915 Harper Plaza","postalCode":"75221","city":"Dallas","state":"TX","email":"akowalskie5@simplemachines.org"}, +{"id":511,"firstName":"Willis","lastName":"Jeaneau","street":"8 Northport Center","postalCode":"37939","city":"Knoxville","state":"TN","phoneNumber":"865-336-2729","email":"wjeaneaue6@furl.net"}, +{"id":512,"firstName":"Clement","lastName":"Taudevin","street":"25062 Amoth Pass","postalCode":"31914","city":"Columbus","state":"GA","email":"ctaudevine7@mapquest.com"}, +{"id":513,"firstName":"Tally","lastName":"Arnatt","street":"5745 Nancy Terrace","postalCode":"95054","city":"Santa Clara","state":"CA","email":"tarnatte8@umich.edu"}, +{"id":514,"firstName":"Eldon","lastName":"Munnings","street":"17 Dayton Parkway","postalCode":"27690","city":"Raleigh","state":"NC","email":"emunningse9@gmpg.org"}, +{"id":515,"firstName":"Duffie","lastName":"Sibary","street":"840 Springview Avenue","postalCode":"48275","city":"Detroit","state":"MI","email":"dsibaryea@livejournal.com"}, +{"id":516,"firstName":"Winny","lastName":"Dobell","street":"0426 Lindbergh Street","postalCode":"81015","city":"Pueblo","state":"CO","phoneNumber":"719-882-3553","email":"wdobelleb@bizjournals.com"}, +{"id":517,"firstName":"Pancho","lastName":"Pointon","street":"79 Clyde Gallagher Park","postalCode":"97306","city":"Salem","state":"OR","phoneNumber":"503-151-2205"}, +{"id":518,"firstName":"Elston","lastName":"Warwicker","street":"96 Schmedeman Park","postalCode":"44705","city":"Canton","state":"OH","email":"ewarwickered@arstechnica.com"}, +{"id":519,"firstName":"Nicolle","lastName":"Shellcross","street":"23982 Cambridge Parkway","postalCode":"80940","city":"Colorado Springs","state":"CO","email":"nshellcrossee@hibu.com"}, +{"id":520,"firstName":"Bethanne","lastName":"Briggdale","street":"026 Portage Circle","postalCode":"43215","city":"Columbus","state":"OH","phoneNumber":"513-925-3139","email":"bbriggdaleef@flickr.com"}, +{"id":521,"firstName":"Elsey","lastName":"McCorry","street":"781 International Parkway","postalCode":"94286","city":"Sacramento","state":"CA","phoneNumber":"916-879-2104","email":"emccorryeg@sakura.ne.jp"}, +{"id":522,"firstName":"Abran","lastName":"Vasyuchov","street":"64 Grim Place","postalCode":"44177","city":"Cleveland","state":"OH"}, +{"id":523,"firstName":"Rhoda","lastName":"Grieveson","street":"50687 Towne Pass","postalCode":"11220","city":"Brooklyn","state":"NY","email":"rgrievesonei@mit.edu"}, +{"id":524,"firstName":"Florette","lastName":"Eke","street":"85057 Anzinger Lane","postalCode":"66225","city":"Shawnee Mission","state":"KS","phoneNumber":"913-299-0032","email":"fekeej@fema.gov"}, +{"id":525,"firstName":"Sheff","lastName":"Baigrie","street":"80366 Lawn Hill","postalCode":"02203","city":"Boston","state":"MA","phoneNumber":"617-556-4978","email":"sbaigrieek@aboutads.info"}, +{"id":526,"firstName":"Clarisse","lastName":"Hubbuck","street":"435 Truax Trail","postalCode":"02458","city":"Newton","state":"MA","phoneNumber":"781-641-2937"}, +{"id":527,"firstName":"Gilberte","lastName":"Yanele","street":"413 Glacier Hill Park","postalCode":"90610","city":"Whittier","state":"CA","phoneNumber":"562-451-1686","email":"gyaneleem@dot.gov"}, +{"id":528,"firstName":"Lefty","lastName":"Dufore","street":"957 Straubel Street","postalCode":"35220","city":"Birmingham","state":"AL","email":"lduforeen@slideshare.net"}, +{"id":529,"firstName":"Saul","lastName":"Shepperd","street":"44805 Sunnyside Place","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-904-7271"}, +{"id":530,"firstName":"Hadrian","lastName":"Cockhill","street":"479 Mayer Way","postalCode":"22119","city":"Merrifield","state":"VA","email":"hcockhillep@xrea.com"}, +{"id":531,"firstName":"Amalia","lastName":"Geare","street":"63075 Glendale Trail","postalCode":"90065","city":"Los Angeles","state":"CA","email":"ageareeq@vistaprint.com"}, +{"id":532,"firstName":"Adan","lastName":"Ibbeson","street":"5 Cambridge Lane","postalCode":"73142","city":"Oklahoma City","state":"OK"}, +{"id":533,"firstName":"Nicol","lastName":"Garbutt","street":"3 8th Street","postalCode":"50393","city":"Des Moines","state":"IA","phoneNumber":"515-946-8077"}, +{"id":534,"firstName":"Lilas","lastName":"Estcot","street":"1927 Mitchell Avenue","postalCode":"75185","city":"Mesquite","state":"TX","email":"lestcotet@ezinearticles.com"}, +{"id":535,"firstName":"Valina","lastName":"Dellenbrok","street":"1 Victoria Hill","postalCode":"45249","city":"Cincinnati","state":"OH","phoneNumber":"513-958-5055","email":"vdellenbrokeu@upenn.edu"}, +{"id":536,"firstName":"Gwen","lastName":"Harwell","street":"64275 Bartelt Terrace","postalCode":"93721","city":"Fresno","state":"CA"}, +{"id":537,"firstName":"Adriena","lastName":"Lochead","street":"0088 Hintze Point","postalCode":"43231","city":"Columbus","state":"OH","phoneNumber":"614-506-5616","email":"alocheadew@paypal.com"}, +{"id":538,"firstName":"Jacobo","lastName":"Jills","street":"809 Anderson Park","postalCode":"55557","city":"Young America","state":"MN","phoneNumber":"952-580-6574","email":"jjillsex@xing.com"}, +{"id":539,"firstName":"Saree","lastName":"Jeanequin","street":"0212 Clyde Gallagher Alley","postalCode":"32891","city":"Orlando","state":"FL","email":"sjeanequiney@who.int"}, +{"id":540,"firstName":"Kin","lastName":"Dewar","street":"3 Emmet Center","postalCode":"20244","city":"Washington","state":"DC","email":"kdewarez@discovery.com"}, +{"id":541,"firstName":"Kaleena","lastName":"Godfray","street":"4350 Eliot Parkway","postalCode":"76134","city":"Fort Worth","state":"TX","phoneNumber":"817-332-6412","email":"kgodfrayf0@webmd.com"}, +{"id":542,"firstName":"Wallace","lastName":"Poytres","street":"78157 Dovetail Crossing","postalCode":"14683","city":"Rochester","state":"NY","email":"wpoytresf1@springer.com"}, +{"id":543,"firstName":"Dur","lastName":"Burgise","street":"2 Weeping Birch Court","postalCode":"89130","city":"Las Vegas","state":"NV"}, +{"id":544,"firstName":"Sheridan","lastName":"Gardiner","street":"26 Gateway Crossing","postalCode":"64193","city":"Kansas City","state":"MO","phoneNumber":"816-647-4434","email":"sgardinerf3@jugem.jp"}, +{"id":545,"firstName":"Nickolaus","lastName":"Thomassen","street":"130 Anderson Drive","postalCode":"33330","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-339-0290"}, +{"id":546,"firstName":"Boris","lastName":"Cortez","street":"55 Center Court","postalCode":"10184","city":"New York City","state":"NY","phoneNumber":"212-549-8414","email":"bcortezf5@mail.ru"}, +{"id":547,"firstName":"Candra","lastName":"Codner","street":"24078 Superior Point","postalCode":"93715","city":"Fresno","state":"CA","phoneNumber":"209-495-8135"}, +{"id":548,"firstName":"Ashton","lastName":"Hugin","street":"33 Fuller Place","postalCode":"63143","city":"Saint Louis","state":"MO"}, +{"id":549,"firstName":"Miguelita","lastName":"Lanceley","street":"34877 Arizona Street","postalCode":"80045","city":"Aurora","state":"CO","email":"mlanceleyf8@trellian.com"}, +{"id":550,"firstName":"Law","lastName":"Skim","street":"1795 Farmco Street","postalCode":"28230","city":"Charlotte","state":"NC","email":"lskimf9@bravesites.com"}, +{"id":551,"firstName":"Carlita","lastName":"Kindall","street":"7 Scofield Road","postalCode":"93709","city":"Fresno","state":"CA","email":"ckindallfa@zimbio.com"}, +{"id":552,"firstName":"Mehetabel","lastName":"Stawell","street":"648 Upham Plaza","postalCode":"75277","city":"Dallas","state":"TX","phoneNumber":"214-597-5958","email":"mstawellfb@ehow.com"}, +{"id":553,"firstName":"Charlena","lastName":"MacAlpyne","street":"2 Village Terrace","postalCode":"33758","city":"Clearwater","state":"FL","phoneNumber":"813-452-9764","email":"cmacalpynefc@xinhuanet.com"}, +{"id":554,"firstName":"Gayel","lastName":"Litel","street":"34782 Birchwood Road","postalCode":"46406","city":"Gary","state":"IN","phoneNumber":"219-156-8377","email":"glitelfd@alibaba.com"}, +{"id":555,"firstName":"Prisca","lastName":"Kanzler","street":"67 Miller Terrace","postalCode":"08619","city":"Trenton","state":"NJ","phoneNumber":"609-352-4487"}, +{"id":556,"firstName":"Marlowe","lastName":"Idenden","street":"396 Beilfuss Park","postalCode":"74103","city":"Tulsa","state":"OK","phoneNumber":"918-254-3102"}, +{"id":557,"firstName":"Ashley","lastName":"Skule","street":"2327 Valley Edge Terrace","postalCode":"93794","city":"Fresno","state":"CA","phoneNumber":"559-558-9123"}, +{"id":558,"firstName":"Trista","lastName":"Naptine","street":"646 Dahle Court","postalCode":"06538","city":"New Haven","state":"CT","phoneNumber":"203-257-3017","email":"tnaptinefh@hugedomains.com"}, +{"id":559,"firstName":"Hasheem","lastName":"Ottery","street":"004 Clemons Street","postalCode":"28815","city":"Asheville","state":"NC","phoneNumber":"828-768-3824","email":"hotteryfi@gmpg.org"}, +{"id":560,"firstName":"Alisa","lastName":"Bernhardt","street":"49 Cody Center","postalCode":"84120","city":"Salt Lake City","state":"UT","phoneNumber":"801-808-4005","email":"abernhardtfj@census.gov"}, +{"id":561,"firstName":"Isadora","lastName":"Hatchett","street":"78644 Hoepker Junction","postalCode":"77015","city":"Houston","state":"TX","email":"ihatchettfk@spiegel.de"}, +{"id":562,"firstName":"Valdemar","lastName":"Stithe","street":"75 East Street","postalCode":"48206","city":"Detroit","state":"MI","email":"vstithefl@marriott.com"}, +{"id":563,"firstName":"Elden","lastName":"Rebert","street":"2 Florence Place","postalCode":"65110","city":"Jefferson City","state":"MO","phoneNumber":"573-753-8030"}, +{"id":564,"firstName":"Stormie","lastName":"Trewartha","street":"59 Shoshone Lane","postalCode":"19136","city":"Philadelphia","state":"PA","phoneNumber":"215-466-6832"}, +{"id":565,"firstName":"Bernhard","lastName":"Boulsher","street":"50888 Dwight Drive","postalCode":"02114","city":"Boston","state":"MA","email":"bboulsherfo@zdnet.com"}, +{"id":566,"firstName":"Twyla","lastName":"Yerrill","street":"526 Clove Terrace","postalCode":"40745","city":"London","state":"KY","email":"tyerrillfp@smugmug.com"}, +{"id":567,"firstName":"Sullivan","lastName":"Dudeney","street":"953 Swallow Crossing","postalCode":"19160","city":"Philadelphia","state":"PA","email":"sdudeneyfq@kickstarter.com"}, +{"id":568,"firstName":"Estell","lastName":"Kiggel","street":"8170 Rusk Alley","postalCode":"20442","city":"Washington","state":"DC","phoneNumber":"202-645-5828","email":"ekiggelfr@imgur.com"}, +{"id":569,"firstName":"Jonis","lastName":"Pymer","street":"21296 International Pass","postalCode":"77844","city":"College Station","state":"TX","email":"jpymerfs@nymag.com"}, +{"id":570,"firstName":"Linea","lastName":"Cranmor","street":"2541 Thackeray Hill","postalCode":"31210","city":"Macon","state":"GA"}, +{"id":571,"firstName":"Starlin","lastName":"Reven","street":"7692 Mifflin Hill","postalCode":"66611","city":"Topeka","state":"KS","email":"srevenfu@nba.com"}, +{"id":572,"firstName":"Augusta","lastName":"Heustice","street":"947 Ramsey Lane","postalCode":"10292","city":"New York City","state":"NY","phoneNumber":"212-194-3346","email":"aheusticefv@cloudflare.com"}, +{"id":573,"firstName":"Glen","lastName":"O'Mailey","street":"90 6th Court","postalCode":"33982","city":"Punta Gorda","state":"FL","phoneNumber":"941-381-2231"}, +{"id":574,"firstName":"Astrix","lastName":"Bister","street":"505 Artisan Crossing","postalCode":"23324","city":"Chesapeake","state":"VA","phoneNumber":"757-469-4444","email":"abisterfx@uol.com.br"}, +{"id":575,"firstName":"Shaw","lastName":"Lidbetter","street":"70 New Castle Trail","postalCode":"10474","city":"Bronx","state":"NY","phoneNumber":"917-917-9173"}, +{"id":576,"firstName":"Yovonnda","lastName":"Wych","street":"97472 Derek Drive","postalCode":"90410","city":"Santa Monica","state":"CA","email":"ywychfz@symantec.com"}, +{"id":577,"firstName":"Harcourt","lastName":"Faier","street":"056 Northridge Street","postalCode":"16510","city":"Erie","state":"PA","email":"hfaierg0@cloudflare.com"}, +{"id":578,"firstName":"Archibold","lastName":"Kos","street":"6 Forster Park","postalCode":"63104","city":"Saint Louis","state":"MO","phoneNumber":"314-967-5566","email":"akosg1@soup.io"}, +{"id":579,"firstName":"Nataniel","lastName":"Beldom","street":"1 Sullivan Street","postalCode":"02453","city":"Waltham","state":"MA","email":"nbeldomg2@alibaba.com"}, +{"id":580,"firstName":"Felisha","lastName":"Bamfield","street":"970 Washington Avenue","postalCode":"12305","city":"Schenectady","state":"NY","email":"fbamfieldg3@jimdo.com"}, +{"id":581,"firstName":"Colly","lastName":"Rugge","street":"8 Golf Course Avenue","postalCode":"55172","city":"Saint Paul","state":"MN","phoneNumber":"651-450-9347","email":"cruggeg4@tmall.com"}, +{"id":582,"firstName":"Patti","lastName":"Maddrell","street":"0483 Coolidge Drive","postalCode":"74193","city":"Tulsa","state":"OK"}, +{"id":583,"firstName":"Antin","lastName":"Gabbetis","street":"93510 Clemons Drive","postalCode":"68583","city":"Lincoln","state":"NE","email":"agabbetisg6@java.com"}, +{"id":584,"firstName":"Bree","lastName":"Million","street":"3 Columbus Avenue","postalCode":"61614","city":"Peoria","state":"IL","phoneNumber":"309-360-1909","email":"bmilliong7@gnu.org"}, +{"id":585,"firstName":"Taber","lastName":"Lorait","street":"4 Melrose Way","postalCode":"62764","city":"Springfield","state":"IL","phoneNumber":"217-436-2021","email":"tloraitg8@cargocollective.com"}, +{"id":586,"firstName":"Roley","lastName":"Di Carlo","street":"981 Bowman Center","postalCode":"87505","city":"Santa Fe","state":"NM"}, +{"id":587,"firstName":"Seline","lastName":"Oxenham","street":"65051 Forest Run Center","postalCode":"94064","city":"Redwood City","state":"CA","email":"soxenhamga@fastcompany.com"}, +{"id":588,"firstName":"Costa","lastName":"Tomblin","street":"7 Arapahoe Alley","postalCode":"33315","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-239-1335"}, +{"id":589,"firstName":"Opalina","lastName":"Cake","street":"88 Commercial Avenue","postalCode":"40215","city":"Louisville","state":"KY","email":"ocakegc@examiner.com"}, +{"id":590,"firstName":"Suzanne","lastName":"Giuroni","street":"73 Twin Pines Terrace","postalCode":"99260","city":"Spokane","state":"WA"}, +{"id":591,"firstName":"Faustine","lastName":"Croysdale","street":"01 Delladonna Point","postalCode":"48295","city":"Detroit","state":"MI"}, +{"id":592,"firstName":"Sheffie","lastName":"Aldine","street":"4 Hansons Junction","postalCode":"74108","city":"Tulsa","state":"OK"}, +{"id":593,"firstName":"Bret","lastName":"Birrane","street":"745 Mayer Junction","postalCode":"77030","city":"Houston","state":"TX","phoneNumber":"832-374-7571","email":"bbirranegg@opera.com"}, +{"id":594,"firstName":"Lennard","lastName":"Mowbury","street":"5 Dwight Road","postalCode":"94522","city":"Concord","state":"CA","email":"lmowburygh@1und1.de"}, +{"id":595,"firstName":"Albie","lastName":"Pert","street":"23705 Fieldstone Plaza","postalCode":"08922","city":"New Brunswick","state":"NJ","phoneNumber":"732-587-7312","email":"apertgi@netlog.com"}, +{"id":596,"firstName":"Stevie","lastName":"Pressnell","street":"0077 Ronald Regan Point","postalCode":"85020","city":"Phoenix","state":"AZ","phoneNumber":"623-991-0482","email":"spressnellgj@skype.com"}, +{"id":597,"firstName":"Eddy","lastName":"McIlreavy","street":"04 Luster Lane","postalCode":"94126","city":"San Francisco","state":"CA"}, +{"id":598,"firstName":"Webb","lastName":"Titterell","street":"94323 Kedzie Alley","postalCode":"91505","city":"Burbank","state":"CA","phoneNumber":"818-220-9105","email":"wtitterellgl@bandcamp.com"}, +{"id":599,"firstName":"Jeffrey","lastName":"Benito","street":"7487 Scott Lane","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"917-379-2592","email":"jbenitogm@deviantart.com"}, +{"id":600,"firstName":"Nollie","lastName":"Arsey","street":"7282 Summerview Plaza","postalCode":"55811","city":"Duluth","state":"MN","email":"narseygn@imageshack.us"}, +{"id":601,"firstName":"Petra","lastName":"Turpey","street":"43920 Evergreen Junction","postalCode":"77255","city":"Houston","state":"TX","phoneNumber":"713-446-0144"}, +{"id":602,"firstName":"Harwilll","lastName":"Lashbrook","street":"8063 Grasskamp Parkway","postalCode":"27621","city":"Raleigh","state":"NC","phoneNumber":"919-142-9887","email":"hlashbrookgp@seattletimes.com"}, +{"id":603,"firstName":"Tedman","lastName":"Steinor","street":"80230 Hanson Hill","postalCode":"47134","city":"Jeffersonville","state":"IN","email":"tsteinorgq@dmoz.org"}, +{"id":604,"firstName":"Georgette","lastName":"Tupper","street":"37 Lillian Avenue","postalCode":"33543","city":"Zephyrhills","state":"FL","phoneNumber":"813-743-2425","email":"gtuppergr@qq.com"}, +{"id":605,"firstName":"Torrance","lastName":"Welsh","street":"95802 Doe Crossing Crossing","postalCode":"13217","city":"Syracuse","state":"NY","phoneNumber":"315-145-4503","email":"twelshgs@imgur.com"}, +{"id":606,"firstName":"Silvie","lastName":"Souster","street":"52827 Fuller Place","postalCode":"99709","city":"Fairbanks","state":"AK"}, +{"id":607,"firstName":"Pauline","lastName":"Dulwitch","street":"8 Aberg Drive","postalCode":"17105","city":"Harrisburg","state":"PA","phoneNumber":"717-228-4960","email":"pdulwitchgu@aboutads.info"}, +{"id":608,"firstName":"Roberta","lastName":"Castanie","street":"182 Mosinee Avenue","postalCode":"75185","city":"Mesquite","state":"TX"}, +{"id":609,"firstName":"Percival","lastName":"Kristoffersen","street":"4 Del Mar Park","postalCode":"48335","city":"Farmington","state":"MI","phoneNumber":"248-438-1650","email":"pkristoffersengw@chron.com"}, +{"id":610,"firstName":"Caryl","lastName":"Boame","street":"094 Springview Avenue","postalCode":"78255","city":"San Antonio","state":"TX","email":"cboamegx@example.com"}, +{"id":611,"firstName":"Steve","lastName":"Simakov","street":"323 Brickson Park Trail","postalCode":"32244","city":"Jacksonville","state":"FL","phoneNumber":"904-468-9377","email":"ssimakovgy@angelfire.com"}, +{"id":612,"firstName":"Carl","lastName":"Tumayan","street":"93854 Clyde Gallagher Circle","postalCode":"98447","city":"Tacoma","state":"WA","email":"ctumayangz@1und1.de"}, +{"id":613,"firstName":"Gayle","lastName":"Blaker","street":"5930 Grasskamp Drive","postalCode":"12262","city":"Albany","state":"NY","email":"gblakerh0@spiegel.de"}, +{"id":614,"firstName":"Darrick","lastName":"Harefoot","street":"359 Waywood Trail","postalCode":"20189","city":"Dulles","state":"VA"}, +{"id":615,"firstName":"Sayer","lastName":"Eversfield","street":"86 Park Meadow Crossing","postalCode":"53263","city":"Milwaukee","state":"WI","email":"seversfieldh2@multiply.com"}, +{"id":616,"firstName":"Loralyn","lastName":"Poyner","street":"28530 Magdeline Crossing","postalCode":"84125","city":"Salt Lake City","state":"UT","phoneNumber":"801-363-2593"}, +{"id":617,"firstName":"Petrina","lastName":"Ridewood","street":"91782 Oriole Parkway","postalCode":"80235","city":"Denver","state":"CO","phoneNumber":"720-131-3660","email":"pridewoodh4@walmart.com"}, +{"id":618,"firstName":"Leroi","lastName":"Marde","street":"7992 Prairieview Junction","postalCode":"02142","city":"Cambridge","state":"MA","phoneNumber":"781-623-9420","email":"lmardeh5@oracle.com"}, +{"id":619,"firstName":"Brannon","lastName":"Janata","street":"79706 Wayridge Alley","postalCode":"24515","city":"Lynchburg","state":"VA","phoneNumber":"434-255-0721"}, +{"id":620,"firstName":"Berry","lastName":"Joska","street":"301 6th Alley","postalCode":"10150","city":"New York City","state":"NY","email":"bjoskah7@360.cn"}, +{"id":621,"firstName":"Blinnie","lastName":"Basten","street":"047 Canary Parkway","postalCode":"30343","city":"Atlanta","state":"GA","phoneNumber":"404-794-2760"}, +{"id":622,"firstName":"Inesita","lastName":"Abbitt","street":"8 Sachtjen Plaza","postalCode":"60681","city":"Chicago","state":"IL"}, +{"id":623,"firstName":"Nickie","lastName":"Ellicombe","street":"1067 Ridge Oak Terrace","postalCode":"38131","city":"Memphis","state":"TN","phoneNumber":"901-695-3826","email":"nellicombeha@imgur.com"}, +{"id":624,"firstName":"Barney","lastName":"Sheeres","street":"1 Rutledge Avenue","postalCode":"29208","city":"Columbia","state":"SC","phoneNumber":"803-166-1398"}, +{"id":625,"firstName":"Ogdan","lastName":"Lelievre","street":"27 Weeping Birch Plaza","postalCode":"27264","city":"High Point","state":"NC","phoneNumber":"336-416-3966","email":"olelievrehc@exblog.jp"}, +{"id":626,"firstName":"Zora","lastName":"Exter","street":"7 Ronald Regan Pass","postalCode":"33673","city":"Tampa","state":"FL"}, +{"id":627,"firstName":"Travus","lastName":"Jaulme","street":"3159 Montana Circle","postalCode":"79176","city":"Amarillo","state":"TX","phoneNumber":"806-894-9411"}, +{"id":628,"firstName":"Krishna","lastName":"Beckingham","street":"58 Fair Oaks Lane","postalCode":"30311","city":"Atlanta","state":"GA","email":"kbeckinghamhf@usnews.com"}, +{"id":629,"firstName":"Bartolomeo","lastName":"Bosanko","street":"753 Victoria Place","postalCode":"79699","city":"Abilene","state":"TX","phoneNumber":"325-223-9615","email":"bbosankohg@merriam-webster.com"}, +{"id":630,"firstName":"Umberto","lastName":"McGinly","street":"30 Upham Parkway","postalCode":"80945","city":"Colorado Springs","state":"CO","email":"umcginlyhh@cdc.gov"}, +{"id":631,"firstName":"Launce","lastName":"Fatkin","street":"03246 Esch Place","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-916-7032","email":"lfatkinhi@blogs.com"}, +{"id":632,"firstName":"Simone","lastName":"Soars","street":"9969 Forest Run Crossing","postalCode":"90101","city":"Los Angeles","state":"CA","phoneNumber":"213-282-8462"}, +{"id":633,"firstName":"Clerissa","lastName":"Leason","street":"59731 Mayfield Street","postalCode":"89510","city":"Reno","state":"NV"}, +{"id":634,"firstName":"Rutter","lastName":"Sultan","street":"697 Spenser Way","postalCode":"77245","city":"Houston","state":"TX"}, +{"id":635,"firstName":"Shannon","lastName":"De Carteret","street":"2 Grover Avenue","postalCode":"92717","city":"Irvine","state":"CA","phoneNumber":"714-410-2360","email":"sdecarterethm@simplemachines.org"}, +{"id":636,"firstName":"Sawyere","lastName":"Cardno","street":"428 Golf Course Drive","postalCode":"33111","city":"Miami","state":"FL"}, +{"id":637,"firstName":"Paulie","lastName":"Bucktharp","street":"5398 Sugar Park","postalCode":"10039","city":"New York City","state":"NY","phoneNumber":"646-197-4123","email":"pbucktharpho@businessweek.com"}, +{"id":638,"firstName":"Kippy","lastName":"Guisler","street":"2161 Claremont Trail","postalCode":"20546","city":"Washington","state":"DC","phoneNumber":"202-138-6171","email":"kguislerhp@ox.ac.uk"}, +{"id":639,"firstName":"Yoshiko","lastName":"Tolson","street":"2 Glendale Court","postalCode":"27415","city":"Greensboro","state":"NC","email":"ytolsonhq@example.com"}, +{"id":640,"firstName":"Page","lastName":"Chillingsworth","street":"8 Loomis Drive","postalCode":"55470","city":"Minneapolis","state":"MN","email":"pchillingsworthhr@wunderground.com"}, +{"id":641,"firstName":"Jillana","lastName":"O'Siaghail","street":"13517 Del Mar Road","postalCode":"29215","city":"Columbia","state":"SC","phoneNumber":"803-420-8597","email":"josiaghailhs@reuters.com"}, +{"id":642,"firstName":"Phedra","lastName":"Bagnold","street":"7059 Hallows Street","postalCode":"55470","city":"Minneapolis","state":"MN","email":"pbagnoldht@howstuffworks.com"}, +{"id":643,"firstName":"Bellina","lastName":"Gouldie","street":"7567 Bultman Way","postalCode":"88514","city":"El Paso","state":"TX","email":"bgouldiehu@salon.com"}, +{"id":644,"firstName":"Devi","lastName":"Bohden","street":"68833 Northview Hill","postalCode":"84115","city":"Salt Lake City","state":"UT"}, +{"id":645,"firstName":"Peggi","lastName":"Gobert","street":"667 Sauthoff Hill","postalCode":"44710","city":"Canton","state":"OH","email":"pgoberthw@mapy.cz"}, +{"id":646,"firstName":"Madelina","lastName":"Gurys","street":"70 Del Sol Trail","postalCode":"20420","city":"Washington","state":"DC","phoneNumber":"202-747-9276","email":"mguryshx@hibu.com"}, +{"id":647,"firstName":"Ikey","lastName":"Aubri","street":"76 Sutteridge Hill","postalCode":"36205","city":"Anniston","state":"AL","phoneNumber":"256-945-5095","email":"iaubrihy@mayoclinic.com"}, +{"id":648,"firstName":"Ginevra","lastName":"Duffitt","street":"25 Eagan Circle","postalCode":"31217","city":"Macon","state":"GA"}, +{"id":649,"firstName":"Cissiee","lastName":"Gozzard","street":"40240 Lillian Park","postalCode":"60609","city":"Chicago","state":"IL","email":"cgozzardi0@columbia.edu"}, +{"id":650,"firstName":"Sonny","lastName":"Jobern","street":"8 Green Trail","postalCode":"77065","city":"Houston","state":"TX","email":"sjoberni1@ucoz.com"}, +{"id":651,"firstName":"Mitch","lastName":"Guidera","street":"0 Dorton Junction","postalCode":"35210","city":"Birmingham","state":"AL","phoneNumber":"205-224-0177"}, +{"id":652,"firstName":"Dorey","lastName":"Marks","street":"81562 Maywood Crossing","postalCode":"71208","city":"Monroe","state":"LA","phoneNumber":"318-492-5487"}, +{"id":653,"firstName":"Pavla","lastName":"Conneely","street":"4007 Mifflin Lane","postalCode":"20456","city":"Washington","state":"DC"}, +{"id":654,"firstName":"Kym","lastName":"Gecks","street":"72638 Namekagon Plaza","postalCode":"61656","city":"Peoria","state":"IL","email":"kgecksi5@nature.com"}, +{"id":655,"firstName":"Prudence","lastName":"Peert","street":"91 Tomscot Parkway","postalCode":"32209","city":"Jacksonville","state":"FL","phoneNumber":"904-277-2945","email":"ppeerti6@usa.gov"}, +{"id":656,"firstName":"Elston","lastName":"Paolo","street":"4 Jenna Crossing","postalCode":"95155","city":"San Jose","state":"CA","email":"epaoloi7@umn.edu"}, +{"id":657,"firstName":"Indira","lastName":"Splaven","street":"8853 Vermont Drive","postalCode":"38188","city":"Memphis","state":"TN","phoneNumber":"901-706-3908","email":"isplaveni8@fda.gov"}, +{"id":658,"firstName":"Paul","lastName":"Mc Meekin","street":"56 Vidon Drive","postalCode":"08695","city":"Trenton","state":"NJ","phoneNumber":"609-361-1580"}, +{"id":659,"firstName":"Hadley","lastName":"Windmill","street":"31384 Evergreen Point","postalCode":"16550","city":"Erie","state":"PA","email":"hwindmillia@yale.edu"}, +{"id":660,"firstName":"Jay","lastName":"Yesichev","street":"675 Starling Pass","postalCode":"89150","city":"Las Vegas","state":"NV"}, +{"id":661,"firstName":"Ranna","lastName":"Dowtry","street":"303 Nevada Pass","postalCode":"48550","city":"Flint","state":"MI","phoneNumber":"810-164-4521","email":"rdowtryic@amazon.co.jp"}, +{"id":662,"firstName":"Annabel","lastName":"Pellamont","street":"277 Merrick Crossing","postalCode":"36605","city":"Mobile","state":"AL","phoneNumber":"251-595-3594","email":"apellamontid@reverbnation.com"}, +{"id":663,"firstName":"Kaitlynn","lastName":"Tracey","street":"612 Magdeline Road","postalCode":"97296","city":"Portland","state":"OR","email":"ktraceyie@ycombinator.com"}, +{"id":664,"firstName":"Matthiew","lastName":"Jills","street":"65 Walton Circle","postalCode":"93750","city":"Fresno","state":"CA","email":"mjillsif@addthis.com"}, +{"id":665,"firstName":"Bartlet","lastName":"Roe","street":"51573 Mandrake Park","postalCode":"02109","city":"Boston","state":"MA","phoneNumber":"617-460-5377","email":"broeig@nasa.gov"}, +{"id":666,"firstName":"Ban","lastName":"Knotton","street":"174 Westridge Parkway","postalCode":"32405","city":"Panama City","state":"FL","phoneNumber":"850-939-6502","email":"bknottonih@businesswire.com"}, +{"id":667,"firstName":"Cordelie","lastName":"O'Dee","street":"1733 Linden Avenue","postalCode":"80940","city":"Colorado Springs","state":"CO","phoneNumber":"719-966-3402","email":"codeeii@amazonaws.com"}, +{"id":668,"firstName":"Hardy","lastName":"Lob","street":"4 Bultman Road","postalCode":"75074","city":"Plano","state":"TX","email":"hlobij@dropbox.com"}, +{"id":669,"firstName":"Rosabelle","lastName":"Tonner","street":"1 Holy Cross Trail","postalCode":"36670","city":"Mobile","state":"AL","phoneNumber":"251-606-9437","email":"rtonnerik@google.ru"}, +{"id":670,"firstName":"Bernardina","lastName":"Mardy","street":"65 Myrtle Center","postalCode":"96845","city":"Honolulu","state":"HI","email":"bmardyil@wordpress.com"}, +{"id":671,"firstName":"Hynda","lastName":"Soldner","street":"88 Hazelcrest Drive","postalCode":"55470","city":"Minneapolis","state":"MN","email":"hsoldnerim@webeden.co.uk"}, +{"id":672,"firstName":"Quinn","lastName":"Templeton","street":"5 Village Way","postalCode":"19131","city":"Philadelphia","state":"PA","email":"qtempletonin@diigo.com"}, +{"id":673,"firstName":"Torrence","lastName":"Askwith","street":"1 Namekagon Point","postalCode":"31410","city":"Savannah","state":"GA","phoneNumber":"912-552-5239","email":"taskwithio@people.com.cn"}, +{"id":674,"firstName":"Bonnie","lastName":"Robilliard","street":"731 Johnson Lane","postalCode":"24515","city":"Lynchburg","state":"VA","phoneNumber":"434-382-5496"}, +{"id":675,"firstName":"Daphna","lastName":"D'Souza","street":"1549 Loftsgordon Center","postalCode":"91406","city":"Van Nuys","state":"CA","phoneNumber":"818-773-9088"}, +{"id":676,"firstName":"Palm","lastName":"Gandrich","street":"9 4th Pass","postalCode":"87121","city":"Albuquerque","state":"NM","phoneNumber":"505-815-5555"}, +{"id":677,"firstName":"Danie","lastName":"Gaydon","street":"382 Bayside Junction","postalCode":"55441","city":"Minneapolis","state":"MN","phoneNumber":"952-744-9400","email":"dgaydonis@seesaa.net"}, +{"id":678,"firstName":"Tabatha","lastName":"Caddock","street":"3858 Mccormick Road","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-996-7653","email":"tcaddockit@gizmodo.com"}, +{"id":679,"firstName":"Sergent","lastName":"Cade","street":"7 Riverside Crossing","postalCode":"13505","city":"Utica","state":"NY","email":"scadeiu@google.co.uk"}, +{"id":680,"firstName":"Shina","lastName":"Dumphry","street":"483 Del Mar Terrace","postalCode":"73109","city":"Oklahoma City","state":"OK","phoneNumber":"405-261-3364","email":"sdumphryiv@mediafire.com"}, +{"id":681,"firstName":"Aaron","lastName":"O'Neal","street":"669 Crowley Road","postalCode":"87140","city":"Albuquerque","state":"NM","phoneNumber":"505-451-6591","email":"aonealiw@npr.org"}, +{"id":682,"firstName":"Cynthea","lastName":"Wippermann","street":"109 Kinsman Parkway","postalCode":"06606","city":"Bridgeport","state":"CT","phoneNumber":"203-799-4552"}, +{"id":683,"firstName":"Stoddard","lastName":"Hullett","street":"06200 Mesta Park","postalCode":"78769","city":"Austin","state":"TX","phoneNumber":"512-190-7003"}, +{"id":684,"firstName":"Margit","lastName":"Comusso","street":"54 Springs Center","postalCode":"33737","city":"Saint Petersburg","state":"FL","phoneNumber":"727-144-3743","email":"mcomussoiz@drupal.org"}, +{"id":685,"firstName":"Dur","lastName":"Manns","street":"464 Park Meadow Road","postalCode":"90015","city":"Los Angeles","state":"CA","email":"dmannsj0@nymag.com"}, +{"id":686,"firstName":"Hollie","lastName":"Aldersey","street":"12195 Mallory Court","postalCode":"21405","city":"Annapolis","state":"MD","email":"halderseyj1@businessinsider.com"}, +{"id":687,"firstName":"Ralina","lastName":"Crepin","street":"13313 Clyde Gallagher Way","postalCode":"78285","city":"San Antonio","state":"TX"}, +{"id":688,"firstName":"Lyell","lastName":"Graveston","street":"20 Talisman Crossing","postalCode":"27157","city":"Winston Salem","state":"NC","phoneNumber":"336-638-3366","email":"lgravestonj3@webmd.com"}, +{"id":689,"firstName":"Anny","lastName":"Potell","street":"0 Ludington Circle","postalCode":"32803","city":"Orlando","state":"FL","email":"apotellj4@microsoft.com"}, +{"id":690,"firstName":"Harriot","lastName":"Klimpke","street":"8 Southridge Alley","postalCode":"22047","city":"Falls Church","state":"VA","phoneNumber":"571-470-2688","email":"hklimpkej5@slashdot.org"}, +{"id":691,"firstName":"Stacia","lastName":"Stainsby","street":"78 Mcbride Avenue","postalCode":"46862","city":"Fort Wayne","state":"IN"}, +{"id":692,"firstName":"Zacharia","lastName":"Willmont","street":"24 Everett Center","postalCode":"73135","city":"Oklahoma City","state":"OK","phoneNumber":"405-167-0584","email":"zwillmontj7@tuttocitta.it"}, +{"id":693,"firstName":"Dorelia","lastName":"Flexman","street":"0 Hauk Crossing","postalCode":"95298","city":"Stockton","state":"CA","phoneNumber":"209-759-3308"}, +{"id":694,"firstName":"Rubi","lastName":"Karran","street":"586 Eggendart Pass","postalCode":"64082","city":"Lees Summit","state":"MO","email":"rkarranj9@yahoo.com"}, +{"id":695,"firstName":"Edlin","lastName":"Davidsen","street":"5646 Arrowood Park","postalCode":"20591","city":"Washington","state":"DC","phoneNumber":"202-800-5817","email":"edavidsenja@purevolume.com"}, +{"id":696,"firstName":"Oralle","lastName":"Coneybeare","street":"0 Lakewood Parkway","postalCode":"08695","city":"Trenton","state":"NJ","email":"oconeybearejb@booking.com"}, +{"id":697,"firstName":"Scotti","lastName":"Cereceres","street":"2 Golf Hill","postalCode":"38119","city":"Memphis","state":"TN"}, +{"id":698,"firstName":"Hermione","lastName":"Mingotti","street":"14 Shoshone Alley","postalCode":"44511","city":"Youngstown","state":"OH","phoneNumber":"330-505-0585"}, +{"id":699,"firstName":"Janka","lastName":"Merredy","street":"877 Reinke Park","postalCode":"45233","city":"Cincinnati","state":"OH","email":"jmerredyje@furl.net"}, +{"id":700,"firstName":"Phillida","lastName":"Gannicleff","street":"48778 Sheridan Center","postalCode":"99210","city":"Spokane","state":"WA","email":"pgannicleffjf@github.io"}, +{"id":701,"firstName":"Bryn","lastName":"Shury","street":"82609 Surrey Road","postalCode":"78240","city":"San Antonio","state":"TX","phoneNumber":"210-361-9404","email":"bshuryjg@arstechnica.com"}, +{"id":702,"firstName":"Bobbe","lastName":"Yurocjhin","street":"54904 Southridge Parkway","postalCode":"33633","city":"Tampa","state":"FL","email":"byurocjhinjh@tumblr.com"}, +{"id":703,"firstName":"Noell","lastName":"Trewman","street":"63703 Fair Oaks Point","postalCode":"91520","city":"Burbank","state":"CA"}, +{"id":704,"firstName":"Adelind","lastName":"Marr","street":"68 Lotheville Park","postalCode":"02912","city":"Providence","state":"RI","email":"amarrjj@hexun.com"}, +{"id":705,"firstName":"Arabelle","lastName":"Oultram","street":"7927 Waxwing Place","postalCode":"77085","city":"Houston","state":"TX","email":"aoultramjk@diigo.com"}, +{"id":706,"firstName":"Derril","lastName":"Whylie","street":"1 Summerview Terrace","postalCode":"91606","city":"North Hollywood","state":"CA","phoneNumber":"323-244-3266","email":"dwhyliejl@auda.org.au"}, +{"id":707,"firstName":"Isadore","lastName":"Airth","street":"08897 Hauk Court","postalCode":"73104","city":"Oklahoma City","state":"OK","phoneNumber":"405-488-1807"}, +{"id":708,"firstName":"Barbara","lastName":"Feast","street":"420 Bayside Circle","postalCode":"63136","city":"Saint Louis","state":"MO","phoneNumber":"314-919-9094"}, +{"id":709,"firstName":"Engracia","lastName":"Laxtonne","street":"189 Oneill Center","postalCode":"22047","city":"Falls Church","state":"VA","email":"elaxtonnejo@addthis.com"}, +{"id":710,"firstName":"Dorice","lastName":"Dearle","street":"655 Union Way","postalCode":"47705","city":"Evansville","state":"IN","phoneNumber":"812-812-8795","email":"ddearlejp@mail.ru"}, +{"id":711,"firstName":"Crissie","lastName":"Leall","street":"1 1st Drive","postalCode":"36689","city":"Mobile","state":"AL","phoneNumber":"251-112-1542","email":"clealljq@nyu.edu"}, +{"id":712,"firstName":"Rica","lastName":"Wilshin","street":"0 Miller Way","postalCode":"79705","city":"Midland","state":"TX","phoneNumber":"432-935-1867"}, +{"id":713,"firstName":"Annie","lastName":"Thorns","street":"297 Thompson Park","postalCode":"32412","city":"Panama City","state":"FL","phoneNumber":"850-594-4049"}, +{"id":714,"firstName":"Lilah","lastName":"Beining","street":"1566 American Ash Avenue","postalCode":"25326","city":"Charleston","state":"WV","email":"lbeiningjt@mayoclinic.com"}, +{"id":715,"firstName":"Leeann","lastName":"Dorant","street":"5530 Mcguire Alley","postalCode":"93407","city":"San Luis Obispo","state":"CA","email":"ldorantju@homestead.com"}, +{"id":716,"firstName":"Elinor","lastName":"James","street":"2 Waxwing Terrace","postalCode":"88579","city":"El Paso","state":"TX","email":"ejamesjv@europa.eu"}, +{"id":717,"firstName":"Novelia","lastName":"Durman","street":"7 Hermina Junction","postalCode":"77050","city":"Houston","state":"TX","email":"ndurmanjw@fc2.com"}, +{"id":718,"firstName":"Sharai","lastName":"Pickervance","street":"739 Lien Junction","postalCode":"73167","city":"Oklahoma City","state":"OK","email":"spickervancejx@independent.co.uk"}, +{"id":719,"firstName":"Gilberte","lastName":"Stilling","street":"29950 Annamark Trail","postalCode":"89178","city":"Las Vegas","state":"NV","phoneNumber":"702-604-4240","email":"gstillingjy@feedburner.com"}, +{"id":720,"firstName":"Rosabelle","lastName":"Guinan","street":"13078 Sutherland Center","postalCode":"83757","city":"Boise","state":"ID","phoneNumber":"208-792-6705"}, +{"id":721,"firstName":"Karin","lastName":"Ackermann","street":"3 Susan Hill","postalCode":"48919","city":"Lansing","state":"MI","phoneNumber":"517-579-7811","email":"kackermannk0@csmonitor.com"}, +{"id":722,"firstName":"Reeta","lastName":"Attwell","street":"96 Alpine Junction","postalCode":"66622","city":"Topeka","state":"KS"}, +{"id":723,"firstName":"Dru","lastName":"Linck","street":"37 Wayridge Place","postalCode":"49505","city":"Grand Rapids","state":"MI","phoneNumber":"616-197-1837"}, +{"id":724,"firstName":"Frances","lastName":"Collingridge","street":"273 Ludington Crossing","postalCode":"77255","city":"Houston","state":"TX"}, +{"id":725,"firstName":"Wilmette","lastName":"Haimes","street":"8408 Shopko Circle","postalCode":"98907","city":"Yakima","state":"WA","phoneNumber":"509-821-5948"}, +{"id":726,"firstName":"Isahella","lastName":"Rubrow","street":"25 Melby Crossing","postalCode":"59105","city":"Billings","state":"MT","email":"irubrowk5@edublogs.org"}, +{"id":727,"firstName":"Walden","lastName":"Sappson","street":"1 3rd Hill","postalCode":"60435","city":"Joliet","state":"IL","email":"wsappsonk6@ameblo.jp"}, +{"id":728,"firstName":"Blondie","lastName":"Godehard.sf","street":"4606 Caliangt Circle","postalCode":"20709","city":"Laurel","state":"MD"}, +{"id":729,"firstName":"Dion","lastName":"Wingeatt","street":"098 Ridgeview Alley","postalCode":"78769","city":"Austin","state":"TX","phoneNumber":"512-948-4113","email":"dwingeattk8@clickbank.net"}, +{"id":730,"firstName":"Antoni","lastName":"Tibbles","street":"9 Muir Court","postalCode":"25313","city":"Charleston","state":"WV","phoneNumber":"304-298-6149","email":"atibblesk9@usa.gov"}, +{"id":731,"firstName":"Quinn","lastName":"McKevin","street":"063 Washington Parkway","postalCode":"55470","city":"Minneapolis","state":"MN","phoneNumber":"612-140-1997"}, +{"id":732,"firstName":"Rita","lastName":"Hallam","street":"4 Chive Court","postalCode":"85025","city":"Phoenix","state":"AZ","email":"rhallamkb@list-manage.com"}, +{"id":733,"firstName":"Cliff","lastName":"McCrum","street":"30841 Scoville Street","postalCode":"38150","city":"Memphis","state":"TN","phoneNumber":"901-983-7713","email":"cmccrumkc@yellowpages.com"}, +{"id":734,"firstName":"Allyson","lastName":"Petkov","street":"057 Grover Trail","postalCode":"55487","city":"Minneapolis","state":"MN","phoneNumber":"612-706-7185"}, +{"id":735,"firstName":"Tanney","lastName":"Cicccitti","street":"84959 Calypso Way","postalCode":"66629","city":"Topeka","state":"KS","phoneNumber":"785-516-0753","email":"tcicccittike@netscape.com"}, +{"id":736,"firstName":"Brendin","lastName":"Behnke","street":"3057 Browning Parkway","postalCode":"38181","city":"Memphis","state":"TN","email":"bbehnkekf@answers.com"}, +{"id":737,"firstName":"Sydelle","lastName":"Lestor","street":"6 Old Shore Way","postalCode":"73167","city":"Oklahoma City","state":"OK"}, +{"id":738,"firstName":"Nilson","lastName":"Nelthorp","street":"5 Gerald Trail","postalCode":"60567","city":"Naperville","state":"IL","phoneNumber":"630-718-5304","email":"nnelthorpkh@scribd.com"}, +{"id":739,"firstName":"Randy","lastName":"Boller","street":"64 Roth Junction","postalCode":"95354","city":"Modesto","state":"CA","phoneNumber":"209-795-8532","email":"rbollerki@nature.com"}, +{"id":740,"firstName":"Vicki","lastName":"De Vaan","street":"08 Mariners Cove Terrace","postalCode":"62776","city":"Springfield","state":"IL","email":"vdevaankj@disqus.com"}, +{"id":741,"firstName":"Romain","lastName":"Castri","street":"7 Atwood Road","postalCode":"02905","city":"Providence","state":"RI","phoneNumber":"401-865-9950","email":"rcastrikk@google.com.br"}, +{"id":742,"firstName":"Adlai","lastName":"Keppel","street":"6 Farragut Circle","postalCode":"76705","city":"Waco","state":"TX","phoneNumber":"254-852-6322"}, +{"id":743,"firstName":"Arlyne","lastName":"Whalley","street":"6 Esker Terrace","postalCode":"83727","city":"Boise","state":"ID","email":"awhalleykm@amazon.co.uk"}, +{"id":744,"firstName":"Alistair","lastName":"Jennins","street":"6 Loeprich Center","postalCode":"21684","city":"Ridgely","state":"MD","phoneNumber":"410-494-2201","email":"ajenninskn@sciencedaily.com"}, +{"id":745,"firstName":"Farr","lastName":"Steer","street":"8569 Eliot Lane","postalCode":"93381","city":"Bakersfield","state":"CA","phoneNumber":"661-416-1609","email":"fsteerko@usgs.gov"}, +{"id":746,"firstName":"Analise","lastName":"Balasini","street":"8901 Lyons Parkway","postalCode":"23242","city":"Richmond","state":"VA","email":"abalasinikp@imgur.com"}, +{"id":747,"firstName":"Gilbert","lastName":"Lockton","street":"3 Leroy Court","postalCode":"49018","city":"Battle Creek","state":"MI","email":"glocktonkq@google.nl"}, +{"id":748,"firstName":"Hamlen","lastName":"Massie","street":"469 Mallory Drive","postalCode":"77250","city":"Houston","state":"TX","email":"hmassiekr@admin.ch"}, +{"id":749,"firstName":"Ebony","lastName":"Loker","street":"21173 Raven Point","postalCode":"21265","city":"Baltimore","state":"MD"}, +{"id":750,"firstName":"Kristina","lastName":"Deeble","street":"479 Warner Park","postalCode":"92013","city":"Carlsbad","state":"CA","phoneNumber":"760-377-7198","email":"kdeeblekt@ezinearticles.com"}, +{"id":751,"firstName":"Jabez","lastName":"Mummery","street":"1 East Point","postalCode":"52809","city":"Davenport","state":"IA","email":"jmummeryku@sfgate.com"}, +{"id":752,"firstName":"Perrine","lastName":"Aldwinckle","street":"98 Montana Avenue","postalCode":"85030","city":"Phoenix","state":"AZ","phoneNumber":"602-224-2810","email":"paldwincklekv@eepurl.com"}, +{"id":753,"firstName":"Humfried","lastName":"Pendleton","street":"843 Swallow Park","postalCode":"89115","city":"Las Vegas","state":"NV","phoneNumber":"702-524-6047"}, +{"id":754,"firstName":"Dario","lastName":"Chesshire","street":"638 Westport Place","postalCode":"96845","city":"Honolulu","state":"HI","phoneNumber":"808-718-1386"}, +{"id":755,"firstName":"Cherianne","lastName":"Hearfield","street":"15 Quincy Street","postalCode":"14233","city":"Buffalo","state":"NY","email":"chearfieldky@technorati.com"}, +{"id":756,"firstName":"Jemima","lastName":"Oxnam","street":"22276 Maple Street","postalCode":"92165","city":"San Diego","state":"CA","email":"joxnamkz@addtoany.com"}, +{"id":757,"firstName":"Tedmund","lastName":"Chandler","street":"81 Katie Point","postalCode":"44310","city":"Akron","state":"OH","phoneNumber":"330-336-2279","email":"tchandlerl0@webeden.co.uk"}, +{"id":758,"firstName":"Tobie","lastName":"Risley","street":"82996 Reindahl Junction","postalCode":"17140","city":"Harrisburg","state":"PA","phoneNumber":"717-272-9110","email":"trisleyl1@youtu.be"}, +{"id":759,"firstName":"Tomi","lastName":"Crevagh","street":"91791 Buhler Park","postalCode":"33715","city":"Saint Petersburg","state":"FL"}, +{"id":760,"firstName":"Luce","lastName":"Gwatkin","street":"424 Lunder Crossing","postalCode":"31416","city":"Savannah","state":"GA"}, +{"id":761,"firstName":"Vinita","lastName":"Hannon","street":"90 Claremont Trail","postalCode":"39236","city":"Jackson","state":"MS"}, +{"id":762,"firstName":"Ruby","lastName":"O'Cosgra","street":"304 Dayton Avenue","postalCode":"07188","city":"Newark","state":"NJ"}, +{"id":763,"firstName":"Amandi","lastName":"Vasiltsov","street":"98188 Killdeer Alley","postalCode":"93399","city":"Bakersfield","state":"CA","email":"avasiltsovl6@smh.com.au"}, +{"id":764,"firstName":"Juliana","lastName":"Goldspink","street":"93 Maryland Terrace","postalCode":"06705","city":"Waterbury","state":"CT","email":"jgoldspinkl7@guardian.co.uk"}, +{"id":765,"firstName":"Giorgi","lastName":"Yakovl","street":"24240 Shasta Drive","postalCode":"46814","city":"Fort Wayne","state":"IN","phoneNumber":"260-754-5907"}, +{"id":766,"firstName":"Aleksandr","lastName":"Justun","street":"06 Fulton Terrace","postalCode":"85025","city":"Phoenix","state":"AZ"}, +{"id":767,"firstName":"Cornela","lastName":"Grindell","street":"1 Hazelcrest Lane","postalCode":"53285","city":"Milwaukee","state":"WI"}, +{"id":768,"firstName":"Liv","lastName":"Madrell","street":"623 Cordelia Terrace","postalCode":"17105","city":"Harrisburg","state":"PA","email":"lmadrelllb@1688.com"}, +{"id":769,"firstName":"Konstance","lastName":"Rosebotham","street":"8930 Utah Terrace","postalCode":"20029","city":"Washington","state":"DC","email":"krosebothamlc@studiopress.com"}, +{"id":770,"firstName":"Theo","lastName":"Scotland","street":"454 Hintze Park","postalCode":"45238","city":"Cincinnati","state":"OH"}, +{"id":771,"firstName":"Trefor","lastName":"Rein","street":"9 Redwing Plaza","postalCode":"22184","city":"Vienna","state":"VA","email":"treinle@barnesandnoble.com"}, +{"id":772,"firstName":"Angelina","lastName":"Bromehead","street":"62477 Walton Circle","postalCode":"14683","city":"Rochester","state":"NY","email":"abromeheadlf@php.net"}, +{"id":773,"firstName":"Thornie","lastName":"Ivanishin","street":"0 Sunbrook Court","postalCode":"34665","city":"Pinellas Park","state":"FL","email":"tivanishinlg@aol.com"}, +{"id":774,"firstName":"Dyana","lastName":"McNickle","street":"2696 Lakewood Gardens Pass","postalCode":"20456","city":"Washington","state":"DC","phoneNumber":"202-653-8740"}, +{"id":775,"firstName":"Humfried","lastName":"Suero","street":"643 Pearson Junction","postalCode":"28410","city":"Wilmington","state":"NC"}, +{"id":776,"firstName":"Jessamine","lastName":"Stockings","street":"739 Moose Street","postalCode":"94137","city":"San Francisco","state":"CA","phoneNumber":"415-641-0091","email":"jstockingslj@skype.com"}, +{"id":777,"firstName":"Laryssa","lastName":"Grahl","street":"0538 Bultman Point","postalCode":"81505","city":"Grand Junction","state":"CO"}, +{"id":778,"firstName":"Susan","lastName":"Stonnell","street":"7 Dennis Parkway","postalCode":"67215","city":"Wichita","state":"KS","phoneNumber":"316-966-3243","email":"sstonnellll@nps.gov"}, +{"id":779,"firstName":"Melinde","lastName":"Segoe","street":"9 Dottie Place","postalCode":"19125","city":"Philadelphia","state":"PA","phoneNumber":"215-119-3801"}, +{"id":780,"firstName":"Skip","lastName":"Sedgebeer","street":"1 Eliot Drive","postalCode":"20005","city":"Washington","state":"DC","email":"ssedgebeerln@blogtalkradio.com"}, +{"id":781,"firstName":"Annabel","lastName":"Schusterl","street":"6094 Talisman Lane","postalCode":"68510","city":"Lincoln","state":"NE","phoneNumber":"402-355-7934","email":"aschusterllo@cargocollective.com"}, +{"id":782,"firstName":"Emiline","lastName":"Whittlesey","street":"5 Claremont Lane","postalCode":"77040","city":"Houston","state":"TX","phoneNumber":"832-835-1321","email":"ewhittleseylp@geocities.com"}, +{"id":783,"firstName":"Frasquito","lastName":"Loukes","street":"47 Merchant Pass","postalCode":"27499","city":"Greensboro","state":"NC","phoneNumber":"336-265-5719","email":"floukeslq@google.it"}, +{"id":784,"firstName":"Jerald","lastName":"Fairholm","street":"5939 Mariners Cove Road","postalCode":"76598","city":"Gatesville","state":"TX","email":"jfairholmlr@smh.com.au"}, +{"id":785,"firstName":"Melisent","lastName":"Strange","street":"50 Glendale Trail","postalCode":"10606","city":"White Plains","state":"NY"}, +{"id":786,"firstName":"Aaron","lastName":"Mixter","street":"14347 Darwin Place","postalCode":"33124","city":"Miami","state":"FL","phoneNumber":"786-244-1856","email":"amixterlt@dmoz.org"}, +{"id":787,"firstName":"Margy","lastName":"Falla","street":"5 Caliangt Trail","postalCode":"40287","city":"Louisville","state":"KY","email":"mfallalu@booking.com"}, +{"id":788,"firstName":"Malinde","lastName":"Ashdown","street":"97234 Anniversary Hill","postalCode":"06152","city":"Hartford","state":"CT","phoneNumber":"860-140-7408","email":"mashdownlv@economist.com"}, +{"id":789,"firstName":"Carolynn","lastName":"Dulany","street":"33 Melby Road","postalCode":"74116","city":"Tulsa","state":"OK","phoneNumber":"918-140-7039","email":"cdulanylw@yelp.com"}, +{"id":790,"firstName":"Kissee","lastName":"Escale","street":"1470 Hanson Parkway","postalCode":"92812","city":"Anaheim","state":"CA","phoneNumber":"714-466-6376"}, +{"id":791,"firstName":"Rebeka","lastName":"Moralee","street":"898 Oak Street","postalCode":"34108","city":"Naples","state":"FL","email":"rmoraleely@shutterfly.com"}, +{"id":792,"firstName":"Cort","lastName":"Arter","street":"35039 Menomonie Way","postalCode":"50936","city":"Des Moines","state":"IA","email":"carterlz@surveymonkey.com"}, +{"id":793,"firstName":"Kirsteni","lastName":"Heady","street":"473 Lawn Street","postalCode":"32092","city":"Saint Augustine","state":"FL","phoneNumber":"904-424-3526","email":"kheadym0@usda.gov"}, +{"id":794,"firstName":"Ettie","lastName":"Overil","street":"1085 Waubesa Lane","postalCode":"18105","city":"Allentown","state":"PA"}, +{"id":795,"firstName":"Evey","lastName":"Tesimon","street":"9 Cordelia Place","postalCode":"55127","city":"Saint Paul","state":"MN"}, +{"id":796,"firstName":"Hersh","lastName":"Lebond","street":"5265 Bartelt Park","postalCode":"34282","city":"Bradenton","state":"FL","phoneNumber":"941-114-7090"}, +{"id":797,"firstName":"Hendrika","lastName":"Govan","street":"27747 La Follette Avenue","postalCode":"21229","city":"Baltimore","state":"MD","email":"hgovanm4@cam.ac.uk"}, +{"id":798,"firstName":"Renado","lastName":"Hambly","street":"5211 Schmedeman Drive","postalCode":"68105","city":"Omaha","state":"NE","phoneNumber":"402-183-0376","email":"rhamblym5@netlog.com"}, +{"id":799,"firstName":"Brewer","lastName":"Boyn","street":"3161 Novick Lane","postalCode":"77055","city":"Houston","state":"TX","email":"bboynm6@google.it"}, +{"id":800,"firstName":"Patrick","lastName":"Speck","street":"57052 Ronald Regan Way","postalCode":"30306","city":"Atlanta","state":"GA","phoneNumber":"770-764-6971","email":"pspeckm7@live.com"}, +{"id":801,"firstName":"Skipper","lastName":"Conybear","street":"75 Autumn Leaf Alley","postalCode":"79968","city":"El Paso","state":"TX","phoneNumber":"915-705-5594","email":"sconybearm8@jimdo.com"}, +{"id":802,"firstName":"Elmore","lastName":"Quilty","street":"027 Warbler Court","postalCode":"35210","city":"Birmingham","state":"AL","email":"equiltym9@ebay.co.uk"}, +{"id":803,"firstName":"Estella","lastName":"Jorck","street":"52695 Holy Cross Trail","postalCode":"47134","city":"Jeffersonville","state":"IN","email":"ejorckma@bluehost.com"}, +{"id":804,"firstName":"Scotti","lastName":"Goodale","street":"7551 Dottie Pass","postalCode":"77713","city":"Beaumont","state":"TX","email":"sgoodalemb@nba.com"}, +{"id":805,"firstName":"Catha","lastName":"Shekle","street":"38839 Derek Terrace","postalCode":"62718","city":"Springfield","state":"IL","email":"csheklemc@tmall.com"}, +{"id":806,"firstName":"Clemens","lastName":"Chuter","street":"015 Charing Cross Pass","postalCode":"30306","city":"Atlanta","state":"GA"}, +{"id":807,"firstName":"Kiley","lastName":"Vasiltsov","street":"8 Reindahl Hill","postalCode":"33432","city":"Boca Raton","state":"FL","email":"kvasiltsovme@google.nl"}, +{"id":808,"firstName":"Korrie","lastName":"McGauhy","street":"188 Golf Lane","postalCode":"89110","city":"Las Vegas","state":"NV","phoneNumber":"702-647-1620","email":"kmcgauhymf@goodreads.com"}, +{"id":809,"firstName":"Giustina","lastName":"Hentze","street":"62244 Roth Way","postalCode":"48604","city":"Saginaw","state":"MI","email":"ghentzemg@pcworld.com"}, +{"id":810,"firstName":"Emilia","lastName":"Virgoe","street":"13910 Alpine Lane","postalCode":"33994","city":"Fort Myers","state":"FL","phoneNumber":"239-993-2041","email":"evirgoemh@mediafire.com"}, +{"id":811,"firstName":"Gordan","lastName":"Trimming","street":"38168 Transport Avenue","postalCode":"38131","city":"Memphis","state":"TN","email":"gtrimmingmi@spiegel.de"}, +{"id":812,"firstName":"Tadeo","lastName":"Vannoort","street":"41476 Pond Alley","postalCode":"20851","city":"Rockville","state":"MD","phoneNumber":"240-432-6489","email":"tvannoortmj@privacy.gov.au"}, +{"id":813,"firstName":"Joseito","lastName":"Viant","street":"1390 Kropf Court","postalCode":"04109","city":"Portland","state":"ME"}, +{"id":814,"firstName":"Blake","lastName":"Tailby","street":"5 Bultman Terrace","postalCode":"31914","city":"Columbus","state":"GA"}, +{"id":815,"firstName":"Cynthie","lastName":"Victor","street":"64 Hoard Avenue","postalCode":"46221","city":"Indianapolis","state":"IN","phoneNumber":"317-836-2511","email":"cvictormm@bizjournals.com"}, +{"id":816,"firstName":"Kristoforo","lastName":"Luckman","street":"019 Ohio Avenue","postalCode":"58505","city":"Bismarck","state":"ND","phoneNumber":"701-921-3472"}, +{"id":817,"firstName":"Celinka","lastName":"Brakewell","street":"5702 Tennessee Pass","postalCode":"92612","city":"Irvine","state":"CA","phoneNumber":"714-584-5599","email":"cbrakewellmo@house.gov"}, +{"id":818,"firstName":"Analiese","lastName":"Debenham","street":"7 Straubel Pass","postalCode":"31704","city":"Albany","state":"GA","phoneNumber":"229-600-4384","email":"adebenhammp@dell.com"}, +{"id":819,"firstName":"Sebastiano","lastName":"Eskriett","street":"0 Northridge Pass","postalCode":"34114","city":"Naples","state":"FL","phoneNumber":"239-651-1326","email":"seskriettmq@berkeley.edu"}, +{"id":820,"firstName":"Jermaine","lastName":"Donisthorpe","street":"69319 Hollow Ridge Park","postalCode":"62794","city":"Springfield","state":"IL","phoneNumber":"217-510-3030","email":"jdonisthorpemr@istockphoto.com"}, +{"id":821,"firstName":"Tera","lastName":"Smalecombe","street":"646 Oakridge Avenue","postalCode":"43699","city":"Toledo","state":"OH","email":"tsmalecombems@tripod.com"}, +{"id":822,"firstName":"Issie","lastName":"Cohane","street":"79078 Fair Oaks Circle","postalCode":"40233","city":"Louisville","state":"KY","email":"icohanemt@wired.com"}, +{"id":823,"firstName":"Nanete","lastName":"Erb","street":"02 Truax Place","postalCode":"88563","city":"El Paso","state":"TX","phoneNumber":"915-234-2792"}, +{"id":824,"firstName":"Benetta","lastName":"Roger","street":"822 Fallview Alley","postalCode":"33625","city":"Tampa","state":"FL","phoneNumber":"813-715-8911","email":"brogermv@ca.gov"}, +{"id":825,"firstName":"Sascha","lastName":"Hillyatt","street":"06 Fisk Plaza","postalCode":"11407","city":"Jamaica","state":"NY"}, +{"id":826,"firstName":"Britt","lastName":"Gilderoy","street":"64312 Delaware Place","postalCode":"89135","city":"Las Vegas","state":"NV"}, +{"id":827,"firstName":"Sterne","lastName":"Frissell","street":"69121 Sycamore Way","postalCode":"06912","city":"Stamford","state":"CT"}, +{"id":828,"firstName":"Lonny","lastName":"Petersen","street":"6 Golf Course Crossing","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-245-3289","email":"lpetersenmz@msu.edu"}, +{"id":829,"firstName":"Maridel","lastName":"Clunie","street":"0312 Dryden Street","postalCode":"80328","city":"Boulder","state":"CO","phoneNumber":"303-848-1116","email":"mclunien0@china.com.cn"}, +{"id":830,"firstName":"Annabal","lastName":"Pruckner","street":"98481 Anhalt Pass","postalCode":"30340","city":"Atlanta","state":"GA","email":"aprucknern1@bandcamp.com"}, +{"id":831,"firstName":"Carin","lastName":"Ambrois","street":"7982 Vahlen Road","postalCode":"85010","city":"Phoenix","state":"AZ"}, +{"id":832,"firstName":"Consuela","lastName":"Grubey","street":"1 Lillian Circle","postalCode":"89714","city":"Carson City","state":"NV","email":"cgrubeyn3@google.pl"}, +{"id":833,"firstName":"Friedrick","lastName":"Ventom","street":"703 Almo Crossing","postalCode":"43215","city":"Columbus","state":"OH"}, +{"id":834,"firstName":"Shalom","lastName":"Rosten","street":"4460 Parkside Road","postalCode":"37215","city":"Nashville","state":"TN","email":"srostenn5@e-recht24.de"}, +{"id":835,"firstName":"Sofia","lastName":"Pottie","street":"89885 Golf Course Junction","postalCode":"27635","city":"Raleigh","state":"NC","email":"spottien6@weather.com"}, +{"id":836,"firstName":"Ed","lastName":"Cecely","street":"38576 Gina Trail","postalCode":"85305","city":"Glendale","state":"AZ","email":"ececelyn7@friendfeed.com"}, +{"id":837,"firstName":"Ruthann","lastName":"Bignold","street":"202 Monterey Alley","postalCode":"19104","city":"Philadelphia","state":"PA","phoneNumber":"610-892-3949"}, +{"id":838,"firstName":"Vonnie","lastName":"Leeming","street":"5 Farmco Center","postalCode":"18706","city":"Wilkes Barre","state":"PA"}, +{"id":839,"firstName":"Diandra","lastName":"Gredden","street":"68178 Parkside Hill","postalCode":"89120","city":"Las Vegas","state":"NV","phoneNumber":"702-952-4026"}, +{"id":840,"firstName":"Donny","lastName":"Bruckent","street":"6 Dapin Way","postalCode":"98127","city":"Seattle","state":"WA","email":"dbruckentnb@stumbleupon.com"}, +{"id":841,"firstName":"Mill","lastName":"Finlay","street":"9 Meadow Valley Terrace","postalCode":"94405","city":"San Mateo","state":"CA","email":"mfinlaync@hibu.com"}, +{"id":842,"firstName":"Garv","lastName":"Feldberger","street":"5916 Marquette Lane","postalCode":"98127","city":"Seattle","state":"WA"}, +{"id":843,"firstName":"Micheal","lastName":"Favela","street":"41587 Dunning Road","postalCode":"47712","city":"Evansville","state":"IN"}, +{"id":844,"firstName":"Shannon","lastName":"Alvaro","street":"86377 Becker Avenue","postalCode":"33315","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-661-6648","email":"salvaronf@usa.gov"}, +{"id":845,"firstName":"Corenda","lastName":"Aldcorn","street":"19 Bowman Court","postalCode":"67220","city":"Wichita","state":"KS","phoneNumber":"316-835-1638","email":"caldcornng@ebay.com"}, +{"id":846,"firstName":"Alvy","lastName":"Mahood","street":"0814 Spohn Hill","postalCode":"50347","city":"Des Moines","state":"IA","phoneNumber":"515-865-3669","email":"amahoodnh@toplist.cz"}, +{"id":847,"firstName":"Alexandr","lastName":"Stut","street":"8672 Anderson Court","postalCode":"78410","city":"Corpus Christi","state":"TX"}, +{"id":848,"firstName":"Gale","lastName":"Chaperling","street":"78873 Bellgrove Alley","postalCode":"10009","city":"New York City","state":"NY","phoneNumber":"212-978-6798","email":"gchaperlingnj@livejournal.com"}, +{"id":849,"firstName":"Eunice","lastName":"Dadson","street":"340 Dwight Hill","postalCode":"52809","city":"Davenport","state":"IA","phoneNumber":"563-787-9869","email":"edadsonnk@businessinsider.com"}, +{"id":850,"firstName":"Florentia","lastName":"Camin","street":"68733 Orin Point","postalCode":"46867","city":"Fort Wayne","state":"IN","phoneNumber":"260-920-3928","email":"fcaminnl@technorati.com"}, +{"id":851,"firstName":"Norina","lastName":"Vannacci","street":"585 Karstens Circle","postalCode":"45233","city":"Cincinnati","state":"OH"}, +{"id":852,"firstName":"Syd","lastName":"Gianolo","street":"99755 Arrowood Hill","postalCode":"33673","city":"Tampa","state":"FL","phoneNumber":"813-878-8150","email":"sgianolonn@uol.com.br"}, +{"id":853,"firstName":"Timofei","lastName":"Serle","street":"1081 Cascade Park","postalCode":"94257","city":"Sacramento","state":"CA","email":"tserleno@behance.net"}, +{"id":854,"firstName":"Moina","lastName":"Ciobutaro","street":"502 Stone Corner Circle","postalCode":"33018","city":"Hialeah","state":"FL","email":"mciobutaronp@ycombinator.com"}, +{"id":855,"firstName":"Nikolaos","lastName":"Gavaghan","street":"47136 Golf Junction","postalCode":"97255","city":"Portland","state":"OR"}, +{"id":856,"firstName":"Gallard","lastName":"Jenks","street":"2 Carioca Terrace","postalCode":"35263","city":"Birmingham","state":"AL","email":"gjenksnr@blogtalkradio.com"}, +{"id":857,"firstName":"Dare","lastName":"Nielson","street":"3 Carberry Hill","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-211-0944"}, +{"id":858,"firstName":"Cecilius","lastName":"Fasse","street":"1 Novick Street","postalCode":"68583","city":"Lincoln","state":"NE","phoneNumber":"402-342-4624","email":"cfassent@zimbio.com"}, +{"id":859,"firstName":"Kevon","lastName":"Doxsey","street":"152 Warrior Pass","postalCode":"91616","city":"North Hollywood","state":"CA","phoneNumber":"213-339-9582"}, +{"id":860,"firstName":"Matti","lastName":"Gras","street":"4567 Bunting Way","postalCode":"94544","city":"Hayward","state":"CA"}, +{"id":861,"firstName":"Nathan","lastName":"Longfut","street":"3178 Mockingbird Alley","postalCode":"97255","city":"Portland","state":"OR","phoneNumber":"971-206-3004"}, +{"id":862,"firstName":"Willetta","lastName":"Fitzpayn","street":"87 Alpine Drive","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-698-7578","email":"wfitzpaynnx@geocities.jp"}, +{"id":863,"firstName":"Emanuel","lastName":"Jikylls","street":"42 Heffernan Court","postalCode":"33884","city":"Winter Haven","state":"FL","email":"ejikyllsny@biglobe.ne.jp"}, +{"id":864,"firstName":"Lenard","lastName":"Nore","street":"7 Nevada Avenue","postalCode":"77343","city":"Huntsville","state":"TX","phoneNumber":"936-267-6742","email":"lnorenz@netscape.com"}, +{"id":865,"firstName":"Jeanine","lastName":"MacTurlough","street":"26343 Gale Crossing","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-865-6630","email":"jmacturlougho0@scientificamerican.com"}, +{"id":866,"firstName":"Jaquenetta","lastName":"Dorn","street":"3963 Novick Way","postalCode":"19495","city":"Valley Forge","state":"PA","email":"jdorno1@about.com"}, +{"id":867,"firstName":"Amity","lastName":"Titterrell","street":"3216 Lindbergh Court","postalCode":"90071","city":"Los Angeles","state":"CA","phoneNumber":"626-416-1494","email":"atitterrello2@psu.edu"}, +{"id":868,"firstName":"Rafaelia","lastName":"Melly","street":"6 Westridge Center","postalCode":"61825","city":"Champaign","state":"IL","email":"rmellyo3@ovh.net"}, +{"id":869,"firstName":"Cordi","lastName":"Martinovsky","street":"38 Forest Dale Terrace","postalCode":"50362","city":"Des Moines","state":"IA","email":"cmartinovskyo4@tuttocitta.it"}, +{"id":870,"firstName":"Humfrid","lastName":"Varne","street":"858 Farwell Street","postalCode":"06127","city":"West Hartford","state":"CT","email":"hvarneo5@yolasite.com"}, +{"id":871,"firstName":"Ford","lastName":"Pinchback","street":"363 Lien Pass","postalCode":"20599","city":"Washington","state":"DC","email":"fpinchbacko6@nytimes.com"}, +{"id":872,"firstName":"Maible","lastName":"Haresign","street":"809 Monica Point","postalCode":"28230","city":"Charlotte","state":"NC"}, +{"id":873,"firstName":"Rozamond","lastName":"Challis","street":"312 Mcbride Plaza","postalCode":"77266","city":"Houston","state":"TX","email":"rchalliso8@google.ca"}, +{"id":874,"firstName":"Myrah","lastName":"Menendez","street":"21 Garrison Plaza","postalCode":"23208","city":"Richmond","state":"VA","email":"mmenendezo9@msn.com"}, +{"id":875,"firstName":"Roberto","lastName":"Lamb","street":"3339 Cottonwood Pass","postalCode":"43699","city":"Toledo","state":"OH","phoneNumber":"419-633-9671"}, +{"id":876,"firstName":"Foster","lastName":"Delyth","street":"91500 Carpenter Point","postalCode":"79928","city":"El Paso","state":"TX","phoneNumber":"915-782-9005"}, +{"id":877,"firstName":"Nicholle","lastName":"Pickring","street":"8083 Talmadge Lane","postalCode":"14624","city":"Rochester","state":"NY","email":"npickringoc@tuttocitta.it"}, +{"id":878,"firstName":"Theodosia","lastName":"Bayliss","street":"6 Marcy Parkway","postalCode":"33954","city":"Port Charlotte","state":"FL"}, +{"id":879,"firstName":"Araldo","lastName":"Dowzell","street":"8376 Carpenter Court","postalCode":"71151","city":"Shreveport","state":"LA","email":"adowzelloe@army.mil"}, +{"id":880,"firstName":"Hugues","lastName":"McColgan","street":"990 Southridge Point","postalCode":"93591","city":"Palmdale","state":"CA","phoneNumber":"661-978-2646","email":"hmccolganof@netvibes.com"}, +{"id":881,"firstName":"Annissa","lastName":"Mordue","street":"62114 Ludington Lane","postalCode":"30911","city":"Augusta","state":"GA","phoneNumber":"706-152-3967","email":"amordueog@tripod.com"}, +{"id":882,"firstName":"Tierney","lastName":"Claughton","street":"3 Twin Pines Trail","postalCode":"88563","city":"El Paso","state":"TX","phoneNumber":"915-784-7980"}, +{"id":883,"firstName":"Rey","lastName":"Fleckno","street":"49 Oakridge Point","postalCode":"27605","city":"Raleigh","state":"NC"}, +{"id":884,"firstName":"Stacee","lastName":"Rewcastle","street":"19 Glendale Point","postalCode":"78278","city":"San Antonio","state":"TX","phoneNumber":"210-454-3087","email":"srewcastleoj@ustream.tv"}, +{"id":885,"firstName":"Delano","lastName":"Bragger","street":"0 Hoffman Center","postalCode":"47725","city":"Evansville","state":"IN","email":"dbraggerok@ifeng.com"}, +{"id":886,"firstName":"Redford","lastName":"Bare","street":"801 Garrison Court","postalCode":"08638","city":"Trenton","state":"NJ"}, +{"id":887,"firstName":"Grantham","lastName":"Arlidge","street":"69 Shelley Parkway","postalCode":"34210","city":"Bradenton","state":"FL","email":"garlidgeom@google.nl"}, +{"id":888,"firstName":"Debbie","lastName":"Tommaseo","street":"295 Crowley Alley","postalCode":"98516","city":"Olympia","state":"WA","email":"dtommaseoon@xrea.com"}, +{"id":889,"firstName":"Ragnar","lastName":"O' Byrne","street":"88163 Manitowish Terrace","postalCode":"20260","city":"Washington","state":"DC","phoneNumber":"202-982-3050","email":"robyrneoo@ft.com"}, +{"id":890,"firstName":"Leopold","lastName":"Woodington","street":"44 Vera Pass","postalCode":"24009","city":"Roanoke","state":"VA","email":"lwoodingtonop@engadget.com"}, +{"id":891,"firstName":"Farrah","lastName":"Conniam","street":"2078 Bunting Parkway","postalCode":"68134","city":"Omaha","state":"NE","email":"fconniamoq@github.com"}, +{"id":892,"firstName":"Augustus","lastName":"Morrish","street":"430 Sauthoff Plaza","postalCode":"27710","city":"Durham","state":"NC","phoneNumber":"919-266-8155","email":"amorrishor@naver.com"}, +{"id":893,"firstName":"Cassaundra","lastName":"Deaves","street":"32 Clarendon Way","postalCode":"40266","city":"Louisville","state":"KY","phoneNumber":"502-138-7158"}, +{"id":894,"firstName":"Glynn","lastName":"Shewan","street":"989 Susan Avenue","postalCode":"95194","city":"San Jose","state":"CA","email":"gshewanot@reuters.com"}, +{"id":895,"firstName":"Neils","lastName":"Niesing","street":"488 Jana Road","postalCode":"48232","city":"Detroit","state":"MI","email":"nniesingou@cafepress.com"}, +{"id":896,"firstName":"Alix","lastName":"Cleeton","street":"8 Merrick Crossing","postalCode":"18018","city":"Bethlehem","state":"PA","email":"acleetonov@ask.com"}, +{"id":897,"firstName":"Kyrstin","lastName":"Alejandro","street":"45487 Carey Way","postalCode":"37919","city":"Knoxville","state":"TN","email":"kalejandroow@scribd.com"}, +{"id":898,"firstName":"Waylin","lastName":"De Caroli","street":"9237 Ludington Plaza","postalCode":"77554","city":"Galveston","state":"TX","email":"wdecaroliox@washingtonpost.com"}, +{"id":899,"firstName":"Lian","lastName":"Brade","street":"704 Lotheville Drive","postalCode":"24014","city":"Roanoke","state":"VA","phoneNumber":"540-712-7147"}, +{"id":900,"firstName":"Griz","lastName":"Elgie","street":"435 Northridge Point","postalCode":"93399","city":"Bakersfield","state":"CA","email":"gelgieoz@hao123.com"}, +{"id":901,"firstName":"Georgeanna","lastName":"Gilberthorpe","street":"6 Tomscot Park","postalCode":"37931","city":"Knoxville","state":"TN","phoneNumber":"865-664-6191","email":"ggilberthorpep0@typepad.com"}, +{"id":902,"firstName":"Korrie","lastName":"Goldstraw","street":"00 Lindbergh Plaza","postalCode":"14225","city":"Buffalo","state":"NY","email":"kgoldstrawp1@yellowbook.com"}, +{"id":903,"firstName":"Hervey","lastName":"Wyse","street":"27 Buell Road","postalCode":"75044","city":"Garland","state":"TX","phoneNumber":"972-243-9031","email":"hwysep2@deliciousdays.com"}, +{"id":904,"firstName":"Georgeta","lastName":"Buckam","street":"0 Continental Hill","postalCode":"65810","city":"Springfield","state":"MO","phoneNumber":"417-682-2553","email":"gbuckamp3@java.com"}, +{"id":905,"firstName":"Hussein","lastName":"Jacson","street":"478 Vermont Court","postalCode":"95354","city":"Modesto","state":"CA","phoneNumber":"209-714-7362","email":"hjacsonp4@squarespace.com"}, +{"id":906,"firstName":"Chrysler","lastName":"Heddy","street":"913 Steensland Parkway","postalCode":"20709","city":"Laurel","state":"MD","phoneNumber":"410-691-9748"}, +{"id":907,"firstName":"Jourdan","lastName":"Frise","street":"35 Erie Point","postalCode":"94245","city":"Sacramento","state":"CA","email":"jfrisep6@eepurl.com"}, +{"id":908,"firstName":"Roxie","lastName":"Gimber","street":"9237 Vermont Pass","postalCode":"88553","city":"El Paso","state":"TX","email":"rgimberp7@mayoclinic.com"}, +{"id":909,"firstName":"Jenilee","lastName":"MacNab","street":"23 Union Alley","postalCode":"29579","city":"Myrtle Beach","state":"SC","email":"jmacnabp8@mit.edu"}, +{"id":910,"firstName":"Lola","lastName":"Bier","street":"371 Bartillon Avenue","postalCode":"71105","city":"Shreveport","state":"LA","phoneNumber":"318-818-1659","email":"lbierp9@goo.gl"}, +{"id":911,"firstName":"Fayina","lastName":"Brosel","street":"3255 Macpherson Pass","postalCode":"55166","city":"Saint Paul","state":"MN","email":"fbroselpa@rakuten.co.jp"}, +{"id":912,"firstName":"Ellerey","lastName":"Darell","street":"735 Leroy Road","postalCode":"07544","city":"Paterson","state":"NJ"}, +{"id":913,"firstName":"Lorianne","lastName":"McLanachan","street":"22 Alpine Point","postalCode":"77293","city":"Houston","state":"TX","email":"lmclanachanpc@dmoz.org"}, +{"id":914,"firstName":"Merrill","lastName":"Searson","street":"8447 Namekagon Hill","postalCode":"55114","city":"Saint Paul","state":"MN","phoneNumber":"651-567-8380","email":"msearsonpd@census.gov"}, +{"id":915,"firstName":"Nisse","lastName":"Larive","street":"976 Forest Dale Way","postalCode":"10004","city":"New York City","state":"NY","phoneNumber":"347-192-6897","email":"nlarivepe@drupal.org"}, +{"id":916,"firstName":"Cazzie","lastName":"Brenard","street":"647 Gulseth Plaza","postalCode":"02283","city":"Boston","state":"MA","phoneNumber":"781-248-3572","email":"cbrenardpf@uiuc.edu"}, +{"id":917,"firstName":"Gael","lastName":"Ramirez","street":"161 Basil Terrace","postalCode":"93786","city":"Fresno","state":"CA","phoneNumber":"559-692-2653","email":"gramirezpg@ucoz.ru"}, +{"id":918,"firstName":"Culver","lastName":"Le Brun","street":"73906 Muir Terrace","postalCode":"95973","city":"Chico","state":"CA","email":"clebrunph@jigsy.com"}, +{"id":919,"firstName":"Bordie","lastName":"Muskett","street":"27 Nobel Trail","postalCode":"20599","city":"Washington","state":"DC","phoneNumber":"202-872-5253"}, +{"id":920,"firstName":"Riccardo","lastName":"Miskin","street":"778 Eagan Place","postalCode":"55407","city":"Minneapolis","state":"MN","email":"rmiskinpj@slideshare.net"}, +{"id":921,"firstName":"Cristabel","lastName":"Gowlett","street":"5 Quincy Lane","postalCode":"62525","city":"Decatur","state":"IL","email":"cgowlettpk@cafepress.com"}, +{"id":922,"firstName":"Crawford","lastName":"Huby","street":"6 Gina Lane","postalCode":"94913","city":"San Rafael","state":"CA","phoneNumber":"415-133-8552","email":"chubypl@jugem.jp"}, +{"id":923,"firstName":"Cherish","lastName":"Mutch","street":"8 Oak Valley Lane","postalCode":"20719","city":"Bowie","state":"MD","phoneNumber":"240-982-9087"}, +{"id":924,"firstName":"Jerrie","lastName":"Latek","street":"9462 Moulton Terrace","postalCode":"52809","city":"Davenport","state":"IA","phoneNumber":"563-687-6664","email":"jlatekpn@gov.uk"}, +{"id":925,"firstName":"Lacey","lastName":"Maris","street":"1 Carpenter Hill","postalCode":"61605","city":"Peoria","state":"IL","phoneNumber":"309-570-3216"}, +{"id":926,"firstName":"Daffy","lastName":"Binion","street":"8 Milwaukee Parkway","postalCode":"33129","city":"Miami","state":"FL","phoneNumber":"305-579-9009"}, +{"id":927,"firstName":"Melita","lastName":"Valde","street":"629 Packers Crossing","postalCode":"06140","city":"Hartford","state":"CT","phoneNumber":"860-747-5927","email":"mvaldepq@storify.com"}, +{"id":928,"firstName":"Cherlyn","lastName":"Rosenshine","street":"764 Pepper Wood Place","postalCode":"72204","city":"Little Rock","state":"AR","phoneNumber":"501-823-8134"}, +{"id":929,"firstName":"Morty","lastName":"Stanger","street":"3286 Charing Cross Court","postalCode":"08603","city":"Trenton","state":"NJ","email":"mstangerps@yellowpages.com"}, +{"id":930,"firstName":"Bernete","lastName":"Hirth","street":"83 Granby Center","postalCode":"95194","city":"San Jose","state":"CA","phoneNumber":"408-738-2333","email":"bhirthpt@people.com.cn"}, +{"id":931,"firstName":"Elena","lastName":"Wace","street":"98 Grover Trail","postalCode":"33742","city":"Saint Petersburg","state":"FL","phoneNumber":"727-883-2239","email":"ewacepu@merriam-webster.com"}, +{"id":932,"firstName":"Giselbert","lastName":"Sisland","street":"2214 Sheridan Pass","postalCode":"40225","city":"Louisville","state":"KY"}, +{"id":933,"firstName":"Herb","lastName":"Voyce","street":"628 Basil Pass","postalCode":"21265","city":"Baltimore","state":"MD"}, +{"id":934,"firstName":"Vina","lastName":"Antonetti","street":"6 Springview Terrace","postalCode":"20430","city":"Washington","state":"DC","phoneNumber":"202-955-4578"}, +{"id":935,"firstName":"Bard","lastName":"De Avenell","street":"2775 Clarendon Avenue","postalCode":"53215","city":"Milwaukee","state":"WI"}, +{"id":936,"firstName":"Briana","lastName":"Pinshon","street":"43 Del Sol Street","postalCode":"33615","city":"Tampa","state":"FL","email":"bpinshonpz@java.com"}, +{"id":937,"firstName":"Hilly","lastName":"Aysh","street":"37 Doe Crossing Terrace","postalCode":"23705","city":"Portsmouth","state":"VA","phoneNumber":"757-992-8124"}, +{"id":938,"firstName":"Marylin","lastName":"Ciotto","street":"3957 Browning Pass","postalCode":"94807","city":"Richmond","state":"CA"}, +{"id":939,"firstName":"Cam","lastName":"Kurth","street":"155 Walton Point","postalCode":"92867","city":"Orange","state":"CA","phoneNumber":"949-955-2248"}, +{"id":940,"firstName":"Rawley","lastName":"Bickle","street":"54 Macpherson Point","postalCode":"93762","city":"Fresno","state":"CA","phoneNumber":"559-331-2187","email":"rbickleq3@delicious.com"}, +{"id":941,"firstName":"Merlina","lastName":"Dunster","street":"70557 Toban Trail","postalCode":"20005","city":"Washington","state":"DC","phoneNumber":"202-999-8731"}, +{"id":942,"firstName":"Kennie","lastName":"MacCoughan","street":"04566 Browning Parkway","postalCode":"75507","city":"Texarkana","state":"TX","phoneNumber":"903-622-7509","email":"kmaccoughanq5@reuters.com"}, +{"id":943,"firstName":"Jase","lastName":"Cholomin","street":"21497 Blaine Road","postalCode":"33777","city":"Largo","state":"FL","email":"jcholominq6@cocolog-nifty.com"}, +{"id":944,"firstName":"Cirstoforo","lastName":"Billingsley","street":"1306 Summer Ridge Court","postalCode":"02124","city":"Boston","state":"MA","email":"cbillingsleyq7@google.es"}, +{"id":945,"firstName":"Berkly","lastName":"Lawles","street":"80400 Milwaukee Way","postalCode":"64082","city":"Lees Summit","state":"MO","email":"blawlesq8@jiathis.com"}, +{"id":946,"firstName":"Otha","lastName":"Key","street":"59639 Center Circle","postalCode":"35405","city":"Tuscaloosa","state":"AL","email":"okeyq9@deliciousdays.com"}, +{"id":947,"firstName":"Anselma","lastName":"Debow","street":"5 Spohn Parkway","postalCode":"80241","city":"Denver","state":"CO","email":"adebowqa@yelp.com"}, +{"id":948,"firstName":"Auria","lastName":"Beric","street":"5 Anderson Way","postalCode":"20022","city":"Washington","state":"DC","email":"abericqb@a8.net"}, +{"id":949,"firstName":"Eirena","lastName":"Caswall","street":"4648 Fulton Street","postalCode":"64054","city":"Independence","state":"MO","phoneNumber":"816-406-0779","email":"ecaswallqc@i2i.jp"}, +{"id":950,"firstName":"Tracy","lastName":"Sperwell","street":"4 Heath Drive","postalCode":"91499","city":"Van Nuys","state":"CA"}, +{"id":951,"firstName":"Cherilyn","lastName":"Faint","street":"814 Anniversary Lane","postalCode":"24503","city":"Lynchburg","state":"VA","phoneNumber":"434-722-2344","email":"cfaintqe@amazon.de"}, +{"id":952,"firstName":"Sela","lastName":"Darcey","street":"002 Walton Hill","postalCode":"78703","city":"Austin","state":"TX","email":"sdarceyqf@lycos.com"}, +{"id":953,"firstName":"Freddie","lastName":"Klagge","street":"842 Schlimgen Road","postalCode":"29905","city":"Beaufort","state":"SC","email":"fklaggeqg@1und1.de"}, +{"id":954,"firstName":"Eunice","lastName":"Walrond","street":"4 Mifflin Terrace","postalCode":"68117","city":"Omaha","state":"NE","email":"ewalrondqh@arstechnica.com"}, +{"id":955,"firstName":"Adelbert","lastName":"Meuse","street":"971 Doe Crossing Court","postalCode":"27157","city":"Winston Salem","state":"NC"}, +{"id":956,"firstName":"Caitlin","lastName":"Windham","street":"29 Cordelia Alley","postalCode":"76210","city":"Denton","state":"TX","phoneNumber":"214-498-2801","email":"cwindhamqj@trellian.com"}, +{"id":957,"firstName":"Jere","lastName":"Presho","street":"7 Monica Plaza","postalCode":"75710","city":"Tyler","state":"TX","email":"jpreshoqk@e-recht24.de"}, +{"id":958,"firstName":"Lonny","lastName":"Cotter","street":"5686 Rutledge Place","postalCode":"40596","city":"Lexington","state":"KY","email":"lcotterql@last.fm"}, +{"id":959,"firstName":"Sarah","lastName":"Earnshaw","street":"69 Prentice Point","postalCode":"60669","city":"Chicago","state":"IL","email":"searnshawqm@ycombinator.com"}, +{"id":960,"firstName":"Claire","lastName":"Minette","street":"3145 Butterfield Terrace","postalCode":"43204","city":"Columbus","state":"OH","phoneNumber":"614-157-5341","email":"cminetteqn@upenn.edu"}, +{"id":961,"firstName":"Traci","lastName":"Farnes","street":"2 Service Circle","postalCode":"06905","city":"Stamford","state":"CT","phoneNumber":"203-311-5859","email":"tfarnesqo@merriam-webster.com"}, +{"id":962,"firstName":"Storm","lastName":"de Werk","street":"9 Jenifer Alley","postalCode":"98121","city":"Seattle","state":"WA","phoneNumber":"425-172-3688"}, +{"id":963,"firstName":"Neile","lastName":"Mackrill","street":"5046 Schurz Point","postalCode":"28299","city":"Charlotte","state":"NC"}, +{"id":964,"firstName":"Temple","lastName":"Howlings","street":"8831 Randy Street","postalCode":"71161","city":"Shreveport","state":"LA","phoneNumber":"318-859-6319","email":"thowlingsqr@smugmug.com"}, +{"id":965,"firstName":"Roda","lastName":"Drissell","street":"16621 Mandrake Lane","postalCode":"78744","city":"Austin","state":"TX","email":"rdrissellqs@mayoclinic.com"}, +{"id":966,"firstName":"Francoise","lastName":"Lawman","street":"7 Calypso Point","postalCode":"14614","city":"Rochester","state":"NY","phoneNumber":"585-995-3882"}, +{"id":967,"firstName":"Helen","lastName":"Kigelman","street":"613 Manley Plaza","postalCode":"01905","city":"Lynn","state":"MA","email":"hkigelmanqu@shutterfly.com"}, +{"id":968,"firstName":"Dudley","lastName":"Cansdall","street":"153 Schmedeman Place","postalCode":"93715","city":"Fresno","state":"CA","email":"dcansdallqv@naver.com"}, +{"id":969,"firstName":"Shelby","lastName":"Fayers","street":"94681 Knutson Point","postalCode":"10039","city":"New York City","state":"NY"}, +{"id":970,"firstName":"Sileas","lastName":"Jalland","street":"2199 Buhler Circle","postalCode":"10029","city":"New York City","state":"NY","phoneNumber":"917-902-1667","email":"sjallandqx@rakuten.co.jp"}, +{"id":971,"firstName":"Zeke","lastName":"Duffett","street":"5 Coolidge Park","postalCode":"37995","city":"Knoxville","state":"TN","phoneNumber":"865-814-8540","email":"zduffettqy@wikispaces.com"}, +{"id":972,"firstName":"Tabby","lastName":"Mathieu","street":"78 Donald Circle","postalCode":"55114","city":"Saint Paul","state":"MN","email":"tmathieuqz@rediff.com"}, +{"id":973,"firstName":"Zsa zsa","lastName":"Knights","street":"208 Kingsford Park","postalCode":"15250","city":"Pittsburgh","state":"PA","phoneNumber":"412-652-8956","email":"zknightsr0@privacy.gov.au"}, +{"id":974,"firstName":"Tildi","lastName":"Knewstub","street":"8572 Gina Hill","postalCode":"32909","city":"Palm Bay","state":"FL","email":"tknewstubr1@archive.org"}, +{"id":975,"firstName":"Eric","lastName":"Wharrier","street":"9 Marcy Alley","postalCode":"38126","city":"Memphis","state":"TN","phoneNumber":"901-378-1545","email":"ewharrierr2@people.com.cn"}, +{"id":976,"firstName":"Jilleen","lastName":"Durgan","street":"7 Lien Plaza","postalCode":"75241","city":"Dallas","state":"TX","email":"jdurganr3@google.pl"}, +{"id":977,"firstName":"Ingeberg","lastName":"Whipp","street":"489 Bartillon Street","postalCode":"22205","city":"Arlington","state":"VA","phoneNumber":"703-356-7728","email":"iwhippr4@un.org"}, +{"id":978,"firstName":"Drake","lastName":"McCreagh","street":"735 Mcguire Lane","postalCode":"20530","city":"Washington","state":"DC","email":"dmccreaghr5@mediafire.com"}, +{"id":979,"firstName":"Byron","lastName":"Eades","street":"931 Hollow Ridge Avenue","postalCode":"23285","city":"Richmond","state":"VA","phoneNumber":"804-728-5669","email":"beadesr6@npr.org"}, +{"id":980,"firstName":"Free","lastName":"Tungate","street":"7037 Ramsey Crossing","postalCode":"64153","city":"Kansas City","state":"MO","email":"ftungater7@macromedia.com"}, +{"id":981,"firstName":"Augustus","lastName":"Benardet","street":"398 Bultman Circle","postalCode":"70165","city":"New Orleans","state":"LA"}, +{"id":982,"firstName":"Sanders","lastName":"Sullens","street":"75785 Westend Terrace","postalCode":"43656","city":"Toledo","state":"OH","phoneNumber":"419-314-1134"}, +{"id":983,"firstName":"Ynes","lastName":"Troup","street":"328 Schurz Trail","postalCode":"98907","city":"Yakima","state":"WA","phoneNumber":"509-696-5645"}, +{"id":984,"firstName":"Siana","lastName":"Bernath","street":"968 Sommers Lane","postalCode":"55487","city":"Minneapolis","state":"MN","phoneNumber":"612-351-3016"}, +{"id":985,"firstName":"Ellary","lastName":"Enders","street":"2 Charing Cross Court","postalCode":"06505","city":"New Haven","state":"CT","phoneNumber":"203-608-5058"}, +{"id":986,"firstName":"Mariann","lastName":"Damerell","street":"885 Pennsylvania Crossing","postalCode":"15220","city":"Pittsburgh","state":"PA","phoneNumber":"412-667-1349","email":"mdamerellrd@moonfruit.com"}, +{"id":987,"firstName":"Timotheus","lastName":"Muncer","street":"293 Hoepker Center","postalCode":"32405","city":"Panama City","state":"FL","phoneNumber":"850-740-2501","email":"tmuncerre@ifeng.com"}, +{"id":988,"firstName":"Hermina","lastName":"Tetsall","street":"9354 Nobel Road","postalCode":"55585","city":"Monticello","state":"MN","phoneNumber":"763-292-3970","email":"htetsallrf@wsj.com"}, +{"id":989,"firstName":"Dorelia","lastName":"Howship","street":"747 Namekagon Way","postalCode":"14269","city":"Buffalo","state":"NY","phoneNumber":"716-470-3584","email":"dhowshiprg@un.org"}, +{"id":990,"firstName":"Peggy","lastName":"Coutts","street":"34 Village Green Road","postalCode":"19131","city":"Philadelphia","state":"PA"}, +{"id":991,"firstName":"Dacey","lastName":"Inglefield","street":"05227 Buell Avenue","postalCode":"45414","city":"Dayton","state":"OH"}, +{"id":992,"firstName":"Hollyanne","lastName":"Hobbema","street":"684 La Follette Drive","postalCode":"45218","city":"Cincinnati","state":"OH","phoneNumber":"513-346-0258"}, +{"id":993,"firstName":"Freedman","lastName":"Whorlow","street":"291 Maywood Pass","postalCode":"48098","city":"Troy","state":"MI","phoneNumber":"248-890-5937"}, +{"id":994,"firstName":"Karine","lastName":"Gerring","street":"163 Graceland Street","postalCode":"95397","city":"Modesto","state":"CA"}, +{"id":995,"firstName":"Sonya","lastName":"Giercke","street":"1801 Rowland Junction","postalCode":"66215","city":"Shawnee Mission","state":"KS","email":"sgierckerm@mapquest.com"}, +{"id":996,"firstName":"Fabiano","lastName":"O'Hear","street":"87555 Sunnyside Plaza","postalCode":"33330","city":"Fort Lauderdale","state":"FL","email":"fohearrn@china.com.cn"}, +{"id":997,"firstName":"Lelia","lastName":"Gillman","street":"29838 Eagan Junction","postalCode":"78783","city":"Austin","state":"TX","phoneNumber":"512-515-1461","email":"lgillmanro@amazon.co.jp"}, +{"id":998,"firstName":"Ophelie","lastName":"Richardet","street":"9 Bay Point","postalCode":"94042","city":"Mountain View","state":"CA"}, +{"id":999,"firstName":"Batholomew","lastName":"Janzen","street":"9 Rigney Alley","postalCode":"95113","city":"San Jose","state":"CA"}, +{"id":1000,"firstName":"Kirstyn","lastName":"Bixley","street":"2 Cascade Trail","postalCode":"80015","city":"Aurora","state":"CO","phoneNumber":"303-339-2309","email":"kbixleyrr@i2i.jp"}] \ No newline at end of file From 90328358070ced845129d83ed7b125decb3dd861 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Mon, 21 Sep 2020 20:40:16 +0100 Subject: [PATCH 0791/1862] Moved code to "json-2" module. --- .../baeldung/jsonoptimization/Customer.java | 123 -- .../CustomerDeserializer.java | 49 - .../jsonoptimization/CustomerSerializer.java | 34 - .../jsonoptimization/CustomerShortNames.java | 155 --- .../jsonoptimization/CustomerSlim.java | 73 -- .../CustomerSlimDeserializer.java | 37 - .../CustomerSlimSerializer.java | 28 - .../CustomerSlimShortNames.java | 81 -- .../JsonOptimizationUnitTest.java | 180 --- .../json_optimization_mock_data.json | 1000 ----------------- 10 files changed, 1760 deletions(-) delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/Customer.java delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java delete mode 100644 json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java delete mode 100644 json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java delete mode 100644 json/src/test/resources/json_optimization_mock_data.json diff --git a/json/src/main/java/com/baeldung/jsonoptimization/Customer.java b/json/src/main/java/com/baeldung/jsonoptimization/Customer.java deleted file mode 100644 index 85451731e9..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/Customer.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.baeldung.jsonoptimization; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Objects; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class Customer { - - private long id; - private String firstName; - private String lastName; - private String street; - private String postalCode; - private String city; - private String state; - private String phoneNumber; - private String email; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getStreet() { - return street; - } - - public void setStreet(String street) { - this.street = street; - } - - public String getPostalCode() { - return postalCode; - } - - public void setPostalCode(String postalCode) { - this.postalCode = postalCode; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - @Override - public int hashCode() { - return Objects.hash(city, email, firstName, id, lastName, phoneNumber, postalCode, state, street); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof Customer)) { - return false; - } - Customer other = (Customer) obj; - return Objects.equals(city, other.city) && Objects.equals(email, other.email) && Objects.equals(firstName, other.firstName) && id == other.id && Objects.equals(lastName, other.lastName) && Objects.equals(phoneNumber, other.phoneNumber) - && Objects.equals(postalCode, other.postalCode) && Objects.equals(state, other.state) && Objects.equals(street, other.street); - } - - @Override - public String toString() { - return "Customer [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", street=" + street + ", postalCode=" + postalCode + ", city=" + city + ", state=" + state + ", phoneNumber=" + phoneNumber + ", email=" + email + "]"; - } - - public static Customer[] fromMockFile() throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - InputStream jsonFile = new FileInputStream("src/test/resources/json_optimization_mock_data.json"); - Customer[] feedback = objectMapper.readValue(jsonFile, Customer[].class); - return feedback; - } -} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java deleted file mode 100644 index 16b66311ad..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerDeserializer.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baeldung.jsonoptimization; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectCodec; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; - -public class CustomerDeserializer extends StdDeserializer { - private static final long serialVersionUID = 1L; - - public CustomerDeserializer() { - this(null); - } - - public CustomerDeserializer(Class t) { - super(t); - } - - @Override - public Customer deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { - Customer feedback = new Customer(); - ObjectCodec codec = parser.getCodec(); - JsonNode node = codec.readTree(parser); - - feedback.setId(node.get(0) - .asLong()); - feedback.setFirstName(node.get(1) - .asText()); - feedback.setLastName(node.get(2) - .asText()); - feedback.setStreet(node.get(3) - .asText()); - feedback.setPostalCode(node.get(4) - .asText()); - feedback.setCity(node.get(5) - .asText()); - feedback.setState(node.get(6) - .asText()); - JsonNode phoneNumber = node.get(7); - feedback.setPhoneNumber(phoneNumber.isNull() ? null : phoneNumber.asText()); - JsonNode email = node.get(8); - feedback.setEmail(email.isNull() ? null : email.asText()); - - return feedback; - } -} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java deleted file mode 100644 index 0f631ee85b..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSerializer.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.baeldung.jsonoptimization; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class CustomerSerializer extends StdSerializer { - private static final long serialVersionUID = 1L; - - public CustomerSerializer() { - this(null); - } - - public CustomerSerializer(Class t) { - super(t); - } - - @Override - public void serialize(Customer customer, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { - jsonGenerator.writeStartArray(); - jsonGenerator.writeNumber(customer.getId()); - jsonGenerator.writeString(customer.getFirstName()); - jsonGenerator.writeString(customer.getLastName()); - jsonGenerator.writeString(customer.getStreet()); - jsonGenerator.writeString(customer.getPostalCode()); - jsonGenerator.writeString(customer.getCity()); - jsonGenerator.writeString(customer.getState()); - jsonGenerator.writeString(customer.getPhoneNumber()); - jsonGenerator.writeString(customer.getEmail()); - jsonGenerator.writeEndArray(); - } -} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java deleted file mode 100644 index b94fbb1033..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerShortNames.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.baeldung.jsonoptimization; - -import java.util.Objects; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class CustomerShortNames { - - @JsonProperty("i") - private long id; - - @JsonProperty("f") - private String firstName; - - @JsonProperty("l") - private String lastName; - - @JsonProperty("s") - private String street; - - @JsonProperty("p") - private String postalCode; - - @JsonProperty("c") - private String city; - - @JsonProperty("a") - private String state; - - @JsonProperty("o") - private String phoneNumber; - - @JsonProperty("e") - private String email; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public String getStreet() { - return street; - } - - public void setStreet(String street) { - this.street = street; - } - - public String getPostalCode() { - return postalCode; - } - - public void setPostalCode(String postalCode) { - this.postalCode = postalCode; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getPhoneNumber() { - return phoneNumber; - } - - public void setPhoneNumber(String phoneNumber) { - this.phoneNumber = phoneNumber; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - @Override - public int hashCode() { - return Objects.hash(city, email, firstName, id, lastName, phoneNumber, postalCode, state, street); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof CustomerShortNames)) { - return false; - } - CustomerShortNames other = (CustomerShortNames) obj; - return Objects.equals(city, other.city) && Objects.equals(email, other.email) && Objects.equals(firstName, other.firstName) && id == other.id && Objects.equals(lastName, other.lastName) && Objects.equals(phoneNumber, other.phoneNumber) - && Objects.equals(postalCode, other.postalCode) && Objects.equals(state, other.state) && Objects.equals(street, other.street); - } - - @Override - public String toString() { - return "CustomerWithShorterAttributes [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", street=" + street + ", postalCode=" + postalCode + ", city=" + city + ", state=" + state + ", phoneNumber=" + phoneNumber + ", email=" + email - + "]"; - } - - public static CustomerShortNames[] fromCustomers(Customer[] customers) { - CustomerShortNames[] feedback = new CustomerShortNames[customers.length]; - - for (int i = 0; i < customers.length; i++) { - Customer aCustomer = customers[i]; - CustomerShortNames newOne = new CustomerShortNames(); - - newOne.setId(aCustomer.getId()); - newOne.setFirstName(aCustomer.getFirstName()); - newOne.setLastName(aCustomer.getLastName()); - newOne.setStreet(aCustomer.getStreet()); - newOne.setCity(aCustomer.getCity()); - newOne.setPostalCode(aCustomer.getPostalCode()); - newOne.setState(aCustomer.getState()); - newOne.setPhoneNumber(aCustomer.getPhoneNumber()); - newOne.setEmail(aCustomer.getEmail()); - - feedback[i] = newOne; - } - - return feedback; - } - -} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java deleted file mode 100644 index e2ef4664cf..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlim.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.baeldung.jsonoptimization; - -import java.util.Objects; - -public class CustomerSlim { - private long id; - private String name; - private String address; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - @Override - public int hashCode() { - return Objects.hash(address, id, name); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof CustomerSlim)) { - return false; - } - CustomerSlim other = (CustomerSlim) obj; - return Objects.equals(address, other.address) && id == other.id && Objects.equals(name, other.name); - } - - @Override - public String toString() { - return "CustomerSlim [id=" + id + ", name=" + name + ", address=" + address + "]"; - } - - public static CustomerSlim[] fromCustomers(Customer[] customers) { - CustomerSlim[] feedback = new CustomerSlim[customers.length]; - - for (int i = 0; i < customers.length; i++) { - Customer aCustomer = customers[i]; - CustomerSlim newOne = new CustomerSlim(); - - newOne.setId(aCustomer.getId()); - newOne.setName(aCustomer.getFirstName() + " " + aCustomer.getLastName()); - newOne.setAddress(aCustomer.getStreet() + ", " + aCustomer.getCity() + " " + aCustomer.getState() + " " + aCustomer.getPostalCode()); - - feedback[i] = newOne; - } - - return feedback; - } - -} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java deleted file mode 100644 index 296ee6fdf6..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimDeserializer.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.jsonoptimization; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectCodec; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; - -public class CustomerSlimDeserializer extends StdDeserializer { - private static final long serialVersionUID = 1L; - - public CustomerSlimDeserializer() { - this(null); - } - - public CustomerSlimDeserializer(Class t) { - super(t); - } - - @Override - public CustomerSlim deserialize(JsonParser parser, DeserializationContext deserializer) throws IOException { - CustomerSlim feedback = new CustomerSlim(); - ObjectCodec codec = parser.getCodec(); - JsonNode node = codec.readTree(parser); - - feedback.setId(node.get(0) - .asLong()); - feedback.setName(node.get(1) - .asText()); - feedback.setAddress(node.get(2) - .asText()); - - return feedback; - } -} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java deleted file mode 100644 index 520c541da6..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimSerializer.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.jsonoptimization; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; - -public class CustomerSlimSerializer extends StdSerializer { - private static final long serialVersionUID = 1L; - - public CustomerSlimSerializer() { - this(null); - } - - public CustomerSlimSerializer(Class t) { - super(t); - } - - @Override - public void serialize(CustomerSlim customer, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { - jsonGenerator.writeStartArray(); - jsonGenerator.writeNumber(customer.getId()); - jsonGenerator.writeString(customer.getName()); - jsonGenerator.writeString(customer.getAddress()); - jsonGenerator.writeEndArray(); - } -} diff --git a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java b/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java deleted file mode 100644 index bf00e847ac..0000000000 --- a/json/src/main/java/com/baeldung/jsonoptimization/CustomerSlimShortNames.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.baeldung.jsonoptimization; - -import java.util.Objects; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class CustomerSlimShortNames { - - @JsonProperty("i") - private long id; - - @JsonProperty("n") - private String name; - - @JsonProperty("a") - private String address; - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - @Override - public int hashCode() { - return Objects.hash(address, id, name); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof CustomerSlimShortNames)) { - return false; - } - CustomerSlimShortNames other = (CustomerSlimShortNames) obj; - return Objects.equals(address, other.address) && id == other.id && Objects.equals(name, other.name); - } - - @Override - public String toString() { - return "CustomerSlim [id=" + id + ", name=" + name + ", address=" + address + "]"; - } - - public static CustomerSlimShortNames[] fromCustomers(Customer[] customers) { - CustomerSlimShortNames[] feedback = new CustomerSlimShortNames[customers.length]; - - for (int i = 0; i < customers.length; i++) { - Customer aCustomer = customers[i]; - CustomerSlimShortNames newOne = new CustomerSlimShortNames(); - - newOne.setId(aCustomer.getId()); - newOne.setName(aCustomer.getFirstName() + " " + aCustomer.getLastName()); - newOne.setAddress(aCustomer.getStreet() + ", " + aCustomer.getCity() + " " + aCustomer.getState() + " " + aCustomer.getPostalCode()); - - feedback[i] = newOne; - } - - return feedback; - } - -} diff --git a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java b/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java deleted file mode 100644 index 7a56a68fe2..0000000000 --- a/json/src/test/java/com/baeldung/jsonoptimization/JsonOptimizationUnitTest.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.baeldung.jsonoptimization; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.text.DecimalFormat; -import java.util.zip.GZIPOutputStream; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.core.Version; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.module.SimpleModule; - -class JsonOptimizationUnitTest { - private static final String TEST_LABEL_JACKSON_DEFAULT_OPTIONS = "Default JSON"; - private static final String TEST_LABEL_DEFAULT_JSON_NO_NULL = "Default JSON without null"; - private static final String TEST_LABEL_SHORTER_FIELD_NAMES = "Shorter field names"; - private static final String TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL = "Shorter field names without null"; - private static final String TEST_LABEL_SERIALIZING_TO_ARRAY = "Custom serializer"; - private static final String TEST_LABEL_SLIM_CUSTOM_SERIALIZER = "Slim custom serializer"; - private static final String TEST_LABEL_SLIM_CUSTOMER = "Slim customer"; - private static final String TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES = "Slim customer with shorter field names"; - private static DecimalFormat LENGTH_FORMATTER = new DecimalFormat("###,###.0"); - private static DecimalFormat PERCENT_FORMATTER = new DecimalFormat("###.0"); - private static Customer[] customers; - private ObjectMapper mapper; - private static int defaultJsonLength; - - @BeforeAll - static void setUpOnce() throws Exception { - customers = Customer.fromMockFile(); - ObjectMapper oneTimeMapper = new ObjectMapper(); - byte[] feedback = oneTimeMapper.writeValueAsBytes(customers); - defaultJsonLength = feedback.length; - System.out.println(); - System.out.println("Default JSON length: " + defaultJsonLength); - System.out.println(); - } - - @BeforeEach - void setUp() { - mapper = new ObjectMapper(); - } - - @Test - void whenSetUp_ThenOneThousandCustomers() { - assertEquals(1000, customers.length, "There should be a 1000 customers"); - } - - @Test - void whenJacksonDefaultOptions_thenValid() throws IOException { - printBanner(TEST_LABEL_JACKSON_DEFAULT_OPTIONS); - byte[] plainJson = createJsonAndVerify(TEST_LABEL_JACKSON_DEFAULT_OPTIONS, customers); - compressJson(TEST_LABEL_JACKSON_DEFAULT_OPTIONS, plainJson); - } - - @Test - void whenExcludingNull_thenValid() throws IOException { - printBanner(TEST_LABEL_DEFAULT_JSON_NO_NULL); - mapper.setSerializationInclusion(Include.NON_NULL); - byte[] plainJson = createJsonAndVerify(TEST_LABEL_DEFAULT_JSON_NO_NULL, customers); - compressJson(TEST_LABEL_DEFAULT_JSON_NO_NULL, plainJson); - } - - @Test - void whenShorterFieldNames_thenValid() throws IOException { - printBanner(TEST_LABEL_SHORTER_FIELD_NAMES); - CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); - byte[] shorterJson = createJsonAndVerify(TEST_LABEL_SHORTER_FIELD_NAMES, shorterOnes); - compressJson(TEST_LABEL_SHORTER_FIELD_NAMES, shorterJson); - } - - @Test - void whenShorterFieldNamesAndExcludingNull_thenValid() throws IOException { - printBanner(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL); - CustomerShortNames[] shorterOnes = CustomerShortNames.fromCustomers(customers); - mapper.setSerializationInclusion(Include.NON_NULL); - byte[] shorterJson = createJsonAndVerify(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL, shorterOnes); - compressJson(TEST_LABEL_SHORTER_FIELD_NAMES_AND_NO_NULL, shorterJson); - } - - @Test - void whenSlimCustomer_thenValid() throws IOException { - printBanner(TEST_LABEL_SLIM_CUSTOMER); - CustomerSlim[] slimOnes = CustomerSlim.fromCustomers(customers); - byte[] slimJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOMER, slimOnes); - compressJson(TEST_LABEL_SLIM_CUSTOMER, slimJson); - } - - @Test - void whenSlimCustomerAndShorterFieldNames_thenValid() throws IOException { - printBanner(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES); - CustomerSlimShortNames[] slimOnes = CustomerSlimShortNames.fromCustomers(customers); - byte[] slimJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimOnes); - compressJson(TEST_LABEL_SLIM_CUSTOMER_SHORT_NAMES, slimJson); - } - - @Test - void whenSerializingToArray_thenValid() throws IOException { - printBanner(TEST_LABEL_SERIALIZING_TO_ARRAY); - SimpleModule serializer = new SimpleModule("CustomDeSerializer", new Version(1, 0, 0, null, null, null)); - serializer.addSerializer(Customer.class, new CustomerSerializer()); - serializer.addDeserializer(Customer.class, new CustomerDeserializer()); - mapper.registerModule(serializer); - - byte[] plainJson = createJsonAndVerify(TEST_LABEL_SERIALIZING_TO_ARRAY, customers); - compressJson(TEST_LABEL_SERIALIZING_TO_ARRAY, plainJson); - } - - @Test - void whenSerializingToArrayAndSlimCustomer_thenValid() throws IOException { - printBanner(TEST_LABEL_SLIM_CUSTOM_SERIALIZER); - SimpleModule serializer = new SimpleModule("SlimCustomDeSerializer", new Version(1, 0, 0, null, null, null)); - serializer.addSerializer(CustomerSlim.class, new CustomerSlimSerializer()); - serializer.addDeserializer(CustomerSlim.class, new CustomerSlimDeserializer()); - mapper.registerModule(serializer); - - CustomerSlim[] slimOnes = CustomerSlim.fromCustomers(customers); - byte[] plainJson = createJsonAndVerify(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, slimOnes); - compressJson(TEST_LABEL_SLIM_CUSTOM_SERIALIZER, plainJson); - } - - private void printBanner(String name) { - System.out.println(); - System.out.println("************************************************"); - System.out.println("Testing " + name); - System.out.println(); - } - - void compressJson(String label, byte[] plainJson) throws IOException { - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - GZIPOutputStream gzipStream = new GZIPOutputStream(outputStream); - gzipStream.write(plainJson); - gzipStream.close(); - outputStream.close(); - byte[] gzippedJson = outputStream.toByteArray(); - double length = gzippedJson.length / 1024d; - double percent = gzippedJson.length * 100d / defaultJsonLength; - System.out.println(label + " GZIPped length: " + LENGTH_FORMATTER.format(length) - + "kB (" + PERCENT_FORMATTER.format(percent) + "%)"); - assertTrue(plainJson.length > gzippedJson.length, label + " should be longer than GZIPped data"); - } - - private byte[] createJsonAndVerify(String label, Object[] customers) throws IOException { - System.out.println(label + " sample: "); - ObjectWriter prettyWritter = mapper.writerWithDefaultPrettyPrinter(); - System.out.println(prettyWritter.writeValueAsString(customers[0])); - - byte[] feedback = mapper.writeValueAsBytes(customers); - double length = feedback.length / 1024d; - double percent = feedback.length * 100d / defaultJsonLength; - System.out.println(label + " length: " + LENGTH_FORMATTER.format(length) - + "kB (" + PERCENT_FORMATTER.format(percent) + "%)"); - assertTrue(feedback.length > 1, label + " should be there"); - - String prefix = label.replaceAll(" ", "-") - .toLowerCase(); - File tempFile = File.createTempFile("jon-optimization-" + prefix, ".json"); - FileOutputStream fos = new FileOutputStream(tempFile); - fos.write(feedback); - fos.close(); - System.out.println(label + " file: " + tempFile.toString()); - - Object[] restoredOnes = mapper.readValue(feedback, customers.getClass()); - assertArrayEquals(TEST_LABEL_JACKSON_DEFAULT_OPTIONS + ": restoring from JSON should work", customers, restoredOnes); - - return feedback; - } - -} diff --git a/json/src/test/resources/json_optimization_mock_data.json b/json/src/test/resources/json_optimization_mock_data.json deleted file mode 100644 index e09517cf61..0000000000 --- a/json/src/test/resources/json_optimization_mock_data.json +++ /dev/null @@ -1,1000 +0,0 @@ -[{"id":1,"firstName":"Horatius","lastName":"Strognell","street":"4848 New Castle Point","postalCode":"33432","city":"Boca Raton","state":"FL","phoneNumber":"561-824-9105","email":"hstrognell0@dailymail.co.uk"}, -{"id":2,"firstName":"Kerri","lastName":"Arend","street":"4 Welch Pass","postalCode":"60669","city":"Chicago","state":"IL","phoneNumber":"312-303-5993"}, -{"id":3,"firstName":"Silvano","lastName":"Bartholomaus","street":"2491 Arkansas Center","postalCode":"30195","city":"Duluth","state":"GA","email":"sbartholomaus2@prlog.org"}, -{"id":4,"firstName":"Venita","lastName":"Burgoine","street":"63894 Sage Park","postalCode":"67215","city":"Wichita","state":"KS","email":"vburgoine3@telegraph.co.uk"}, -{"id":5,"firstName":"Meghan","lastName":"Westover","street":"76 Pleasure Way","postalCode":"77388","city":"Spring","state":"TX","phoneNumber":"832-926-0689","email":"mwestover4@cnn.com"}, -{"id":6,"firstName":"Mia","lastName":"Baversor","street":"50 Sommers Road","postalCode":"43204","city":"Columbus","state":"OH","email":"mbaversor5@wsj.com"}, -{"id":7,"firstName":"Winna","lastName":"Buggy","street":"05 Jenna Street","postalCode":"68144","city":"Omaha","state":"NE","phoneNumber":"402-740-7818"}, -{"id":8,"firstName":"Antonin","lastName":"Autrie","street":"9 Fieldstone Terrace","postalCode":"85754","city":"Tucson","state":"AZ"}, -{"id":9,"firstName":"Maddi","lastName":"Ollerearnshaw","street":"061 Crowley Trail","postalCode":"48335","city":"Farmington","state":"MI","phoneNumber":"248-709-8128"}, -{"id":10,"firstName":"Fawnia","lastName":"Cristofaro","street":"92571 Kinsman Alley","postalCode":"77271","city":"Houston","state":"TX","email":"fcristofaro9@ox.ac.uk"}, -{"id":11,"firstName":"Zachariah","lastName":"Rouby","street":"2439 Hudson Circle","postalCode":"25313","city":"Charleston","state":"WV","phoneNumber":"304-587-5444"}, -{"id":12,"firstName":"Brier","lastName":"Benech","street":"3144 Sutteridge Place","postalCode":"20380","city":"Washington","state":"DC","phoneNumber":"202-740-8851","email":"bbenechb@zdnet.com"}, -{"id":13,"firstName":"Merry","lastName":"Leming","street":"419 Kropf Terrace","postalCode":"45440","city":"Dayton","state":"OH","email":"mlemingc@ow.ly"}, -{"id":14,"firstName":"Audrey","lastName":"Dilleston","street":"61 Melrose Trail","postalCode":"97306","city":"Salem","state":"OR","phoneNumber":"503-480-6254"}, -{"id":15,"firstName":"De witt","lastName":"Kedge","street":"819 Kingsford Point","postalCode":"84135","city":"Salt Lake City","state":"UT"}, -{"id":16,"firstName":"Charita","lastName":"de Clerc","street":"42 Loftsgordon Hill","postalCode":"28289","city":"Charlotte","state":"NC","phoneNumber":"704-532-8850","email":"cdeclercf@comsenz.com"}, -{"id":17,"firstName":"Edgard","lastName":"Bloore","street":"1659 Donald Trail","postalCode":"20051","city":"Washington","state":"DC"}, -{"id":18,"firstName":"Kristi","lastName":"Richichi","street":"11306 Longview Hill","postalCode":"75372","city":"Dallas","state":"TX","email":"krichichih@cloudflare.com"}, -{"id":19,"firstName":"Denna","lastName":"Cornford","street":"4 Gale Junction","postalCode":"10014","city":"New York City","state":"NY","phoneNumber":"646-273-3067","email":"dcornfordi@ebay.co.uk"}, -{"id":20,"firstName":"Randall","lastName":"McQuaid","street":"55712 Stone Corner Circle","postalCode":"10203","city":"New York City","state":"NY","email":"rmcquaidj@facebook.com"}, -{"id":21,"firstName":"Kirbie","lastName":"Walczak","street":"9 Coleman Road","postalCode":"99252","city":"Spokane","state":"WA","email":"kwalczakk@spotify.com"}, -{"id":22,"firstName":"Zedekiah","lastName":"Westby","street":"9 Victoria Road","postalCode":"22093","city":"Ashburn","state":"VA","phoneNumber":"571-642-0111","email":"zwestbyl@ox.ac.uk"}, -{"id":23,"firstName":"Corri","lastName":"Snar","street":"4 Service Terrace","postalCode":"68517","city":"Lincoln","state":"NE","email":"csnarm@tinyurl.com"}, -{"id":24,"firstName":"Manny","lastName":"Marchington","street":"942 Westend Center","postalCode":"22119","city":"Merrifield","state":"VA","email":"mmarchingtonn@opensource.org"}, -{"id":25,"firstName":"Ashla","lastName":"Grigoroni","street":"755 Lerdahl Parkway","postalCode":"55423","city":"Minneapolis","state":"MN","phoneNumber":"612-797-7928","email":"agrigoronio@cam.ac.uk"}, -{"id":26,"firstName":"Rita","lastName":"Sharratt","street":"710 Buena Vista Avenue","postalCode":"40576","city":"Lexington","state":"KY","phoneNumber":"859-727-0697"}, -{"id":27,"firstName":"Karrie","lastName":"Crathorne","street":"02 Loeprich Place","postalCode":"39505","city":"Gulfport","state":"MS"}, -{"id":28,"firstName":"Lothario","lastName":"Merck","street":"46 Golden Leaf Park","postalCode":"35205","city":"Birmingham","state":"AL"}, -{"id":29,"firstName":"Renault","lastName":"Banister","street":"7 Garrison Plaza","postalCode":"85072","city":"Phoenix","state":"AZ"}, -{"id":30,"firstName":"Wanda","lastName":"Burkart","street":"10 Mendota Place","postalCode":"48258","city":"Detroit","state":"MI","phoneNumber":"248-870-5185","email":"wburkartt@wikipedia.org"}, -{"id":31,"firstName":"Maggy","lastName":"Timby","street":"37 Crest Line Center","postalCode":"50305","city":"Des Moines","state":"IA","email":"mtimbyu@cnbc.com"}, -{"id":32,"firstName":"Chet","lastName":"Origan","street":"767 Bashford Lane","postalCode":"30919","city":"Augusta","state":"GA","email":"coriganv@behance.net"}, -{"id":33,"firstName":"Jammie","lastName":"Aslie","street":"7174 Hoffman Circle","postalCode":"23464","city":"Virginia Beach","state":"VA"}, -{"id":34,"firstName":"Dill","lastName":"Kingdon","street":"75 Corben Crossing","postalCode":"33013","city":"Hialeah","state":"FL","email":"dkingdonx@ibm.com"}, -{"id":35,"firstName":"Berenice","lastName":"Blodget","street":"8 Eliot Junction","postalCode":"93907","city":"Salinas","state":"CA","email":"bblodgety@blogs.com"}, -{"id":36,"firstName":"Kimberley","lastName":"Streatley","street":"56 Welch Center","postalCode":"77070","city":"Houston","state":"TX"}, -{"id":37,"firstName":"Warde","lastName":"Woodwind","street":"773 Gerald Park","postalCode":"35295","city":"Birmingham","state":"AL","email":"wwoodwind10@wsj.com"}, -{"id":38,"firstName":"Husain","lastName":"Christofe","street":"35118 Forest Dale Avenue","postalCode":"10175","city":"New York City","state":"NY","phoneNumber":"212-611-7995","email":"hchristofe11@seesaa.net"}, -{"id":39,"firstName":"Gertrud","lastName":"Defraine","street":"568 Walton Way","postalCode":"37405","city":"Chattanooga","state":"TN","phoneNumber":"423-125-5719","email":"gdefraine12@xrea.com"}, -{"id":40,"firstName":"Yulma","lastName":"Ramshay","street":"9976 Iowa Drive","postalCode":"87121","city":"Albuquerque","state":"NM","phoneNumber":"505-914-5281"}, -{"id":41,"firstName":"Bride","lastName":"Amsberger","street":"3 Service Lane","postalCode":"28272","city":"Charlotte","state":"NC","email":"bamsberger14@forbes.com"}, -{"id":42,"firstName":"Kaiser","lastName":"Froud","street":"7 Starling Lane","postalCode":"99507","city":"Anchorage","state":"AK","email":"kfroud15@cloudflare.com"}, -{"id":43,"firstName":"Leona","lastName":"Sciusscietto","street":"06392 East Lane","postalCode":"60193","city":"Schaumburg","state":"IL","phoneNumber":"630-981-3986","email":"lsciusscietto16@mit.edu"}, -{"id":44,"firstName":"Sibel","lastName":"Ripsher","street":"8672 Bayside Road","postalCode":"32511","city":"Pensacola","state":"FL","phoneNumber":"850-975-6365","email":"sripsher17@sitemeter.com"}, -{"id":45,"firstName":"Megen","lastName":"Dymond","street":"0547 Harper Place","postalCode":"28220","city":"Charlotte","state":"NC","phoneNumber":"704-632-5850"}, -{"id":46,"firstName":"Vitoria","lastName":"Niese","street":"365 Colorado Plaza","postalCode":"15279","city":"Pittsburgh","state":"PA","phoneNumber":"412-864-8563"}, -{"id":47,"firstName":"Cherianne","lastName":"Daveran","street":"5 Esch Parkway","postalCode":"36104","city":"Montgomery","state":"AL","email":"cdaveran1a@ft.com"}, -{"id":48,"firstName":"Harriott","lastName":"Mallam","street":"9 Monterey Place","postalCode":"20215","city":"Washington","state":"DC","phoneNumber":"202-727-0645"}, -{"id":49,"firstName":"Jozef","lastName":"Stranger","street":"07 Warner Drive","postalCode":"84199","city":"Salt Lake City","state":"UT","phoneNumber":"801-741-5946"}, -{"id":50,"firstName":"Teena","lastName":"Broggio","street":"287 Luster Park","postalCode":"78285","city":"San Antonio","state":"TX","phoneNumber":"210-482-0822","email":"tbroggio1d@craigslist.org"}, -{"id":51,"firstName":"Robin","lastName":"Membry","street":"0736 Forest Dale Crossing","postalCode":"45408","city":"Dayton","state":"OH","phoneNumber":"937-335-4964","email":"rmembry1e@toplist.cz"}, -{"id":52,"firstName":"Holly","lastName":"Lowcock","street":"819 Aberg Pass","postalCode":"28815","city":"Asheville","state":"NC","email":"hlowcock1f@bbc.co.uk"}, -{"id":53,"firstName":"Shandee","lastName":"Blowick","street":"81600 Moose Lane","postalCode":"46867","city":"Fort Wayne","state":"IN","phoneNumber":"260-904-5622"}, -{"id":54,"firstName":"Chaim","lastName":"Stilliard","street":"91 Spohn Court","postalCode":"28305","city":"Fayetteville","state":"NC","phoneNumber":"910-721-3938"}, -{"id":55,"firstName":"Maximilien","lastName":"Purkis","street":"66997 Algoma Park","postalCode":"10150","city":"New York City","state":"NY","phoneNumber":"212-824-3363","email":"mpurkis1i@unblog.fr"}, -{"id":56,"firstName":"Ferguson","lastName":"Whiles","street":"0550 Bowman Street","postalCode":"33142","city":"Miami","state":"FL","phoneNumber":"786-416-2947","email":"fwhiles1j@artisteer.com"}, -{"id":57,"firstName":"Elena","lastName":"Poyle","street":"54 Warner Court","postalCode":"28055","city":"Gastonia","state":"NC","email":"epoyle1k@tripod.com"}, -{"id":58,"firstName":"Carney","lastName":"Pengilly","street":"050 Welch Junction","postalCode":"76147","city":"Fort Worth","state":"TX","phoneNumber":"817-525-7801","email":"cpengilly1l@yellowpages.com"}, -{"id":59,"firstName":"Krispin","lastName":"Pouck","street":"03554 Twin Pines Point","postalCode":"55551","city":"Young America","state":"MN","email":"kpouck1m@nymag.com"}, -{"id":60,"firstName":"Kylie","lastName":"Osmar","street":"7 Milwaukee Plaza","postalCode":"45228","city":"Cincinnati","state":"OH","phoneNumber":"513-940-5020","email":"kosmar1n@storify.com"}, -{"id":61,"firstName":"Trudi","lastName":"Standrin","street":"526 Onsgard Park","postalCode":"12237","city":"Albany","state":"NY","email":"tstandrin1o@sfgate.com"}, -{"id":62,"firstName":"Frank","lastName":"Belt","street":"52 Stang Lane","postalCode":"27455","city":"Greensboro","state":"NC"}, -{"id":63,"firstName":"Nerita","lastName":"Daulton","street":"03 Sutherland Court","postalCode":"55417","city":"Minneapolis","state":"MN","phoneNumber":"651-796-2028"}, -{"id":64,"firstName":"Urbanus","lastName":"Camm","street":"6802 Weeping Birch Circle","postalCode":"92115","city":"San Diego","state":"CA","email":"ucamm1r@ucoz.com"}, -{"id":65,"firstName":"Perry","lastName":"Struther","street":"63916 Corry Alley","postalCode":"28805","city":"Asheville","state":"NC","phoneNumber":"828-821-0824","email":"pstruther1s@nih.gov"}, -{"id":66,"firstName":"Zorina","lastName":"Uc","street":"99 Merry Circle","postalCode":"37250","city":"Nashville","state":"TN","phoneNumber":"615-364-4726","email":"zuc1t@cbc.ca"}, -{"id":67,"firstName":"Ajay","lastName":"Rediers","street":"6872 Armistice Lane","postalCode":"92812","city":"Anaheim","state":"CA","phoneNumber":"714-845-0143"}, -{"id":68,"firstName":"Brendis","lastName":"Goor","street":"94 Mccormick Place","postalCode":"77346","city":"Humble","state":"TX","phoneNumber":"713-910-5956"}, -{"id":69,"firstName":"Barbey","lastName":"Konneke","street":"75613 Miller Trail","postalCode":"30328","city":"Atlanta","state":"GA","phoneNumber":"770-208-1453"}, -{"id":70,"firstName":"Adlai","lastName":"Colly","street":"4446 Loftsgordon Place","postalCode":"40576","city":"Lexington","state":"KY","email":"acolly1x@phpbb.com"}, -{"id":71,"firstName":"Libby","lastName":"Wherton","street":"9313 Buell Road","postalCode":"70116","city":"New Orleans","state":"LA","email":"lwherton1y@flickr.com"}, -{"id":72,"firstName":"Niko","lastName":"Stockell","street":"61 Havey Park","postalCode":"10034","city":"New York City","state":"NY","phoneNumber":"646-814-6395","email":"nstockell1z@xrea.com"}, -{"id":73,"firstName":"Phillip","lastName":"Dadley","street":"14534 Victoria Street","postalCode":"33906","city":"Fort Myers","state":"FL","email":"pdadley20@studiopress.com"}, -{"id":74,"firstName":"Leann","lastName":"Hebburn","street":"9 Center Place","postalCode":"84140","city":"Salt Lake City","state":"UT","email":"lhebburn21@1688.com"}, -{"id":75,"firstName":"Raynor","lastName":"Gernier","street":"5923 Gale Plaza","postalCode":"79118","city":"Amarillo","state":"TX"}, -{"id":76,"firstName":"Elmore","lastName":"Frankton","street":"770 Wayridge Crossing","postalCode":"14619","city":"Rochester","state":"NY"}, -{"id":77,"firstName":"Teresina","lastName":"Rives","street":"51261 Sycamore Terrace","postalCode":"63180","city":"Saint Louis","state":"MO","email":"trives24@cbsnews.com"}, -{"id":78,"firstName":"Pancho","lastName":"Thebeaud","street":"72 Pierstorff Way","postalCode":"33705","city":"Saint Petersburg","state":"FL","phoneNumber":"813-335-3556"}, -{"id":79,"firstName":"Deanne","lastName":"Crighton","street":"95 Duke Plaza","postalCode":"71151","city":"Shreveport","state":"LA","phoneNumber":"318-218-7196","email":"dcrighton26@sphinn.com"}, -{"id":80,"firstName":"Brucie","lastName":"Bury","street":"8948 Knutson Lane","postalCode":"93740","city":"Fresno","state":"CA","email":"bbury27@twitter.com"}, -{"id":81,"firstName":"Joleen","lastName":"Flack","street":"8007 Morningstar Street","postalCode":"33283","city":"Miami","state":"FL","phoneNumber":"305-459-0365"}, -{"id":82,"firstName":"Antonino","lastName":"Matelyunas","street":"2585 Gale Road","postalCode":"20591","city":"Washington","state":"DC","phoneNumber":"202-780-3589"}, -{"id":83,"firstName":"Vinnie","lastName":"Syne","street":"6 Fallview Pass","postalCode":"20231","city":"Washington","state":"DC","phoneNumber":"202-648-5977","email":"vsyne2a@etsy.com"}, -{"id":84,"firstName":"Sig","lastName":"Guillotin","street":"6 Buell Lane","postalCode":"46015","city":"Anderson","state":"IN","phoneNumber":"765-948-7663","email":"sguillotin2b@cisco.com"}, -{"id":85,"firstName":"Gabriel","lastName":"Vasyukhichev","street":"25801 Grasskamp Junction","postalCode":"45408","city":"Dayton","state":"OH","email":"gvasyukhichev2c@mac.com"}, -{"id":86,"firstName":"Casie","lastName":"Burgill","street":"0 Dapin Alley","postalCode":"37410","city":"Chattanooga","state":"TN"}, -{"id":87,"firstName":"Kristan","lastName":"Chalice","street":"5118 Calypso Junction","postalCode":"78721","city":"Austin","state":"TX","phoneNumber":"512-831-2347"}, -{"id":88,"firstName":"Brear","lastName":"Pruckner","street":"2 Corscot Street","postalCode":"53790","city":"Madison","state":"WI"}, -{"id":89,"firstName":"Estella","lastName":"Orpyne","street":"293 Hansons Plaza","postalCode":"55579","city":"Maple Plain","state":"MN","phoneNumber":"952-666-6951","email":"eorpyne2g@examiner.com"}, -{"id":90,"firstName":"Conroy","lastName":"de Banke","street":"40636 Farmco Park","postalCode":"30316","city":"Atlanta","state":"GA","phoneNumber":"404-199-0073","email":"cdebanke2h@prweb.com"}, -{"id":91,"firstName":"Elmira","lastName":"Bracken","street":"10 Macpherson Place","postalCode":"85099","city":"Phoenix","state":"AZ","phoneNumber":"602-991-7768","email":"ebracken2i@sourceforge.net"}, -{"id":92,"firstName":"Carlota","lastName":"Vasilechko","street":"33 American Ash Point","postalCode":"75507","city":"Texarkana","state":"TX","phoneNumber":"903-312-0610","email":"cvasilechko2j@nba.com"}, -{"id":93,"firstName":"Jamesy","lastName":"Valentelli","street":"59634 Charing Cross Trail","postalCode":"31416","city":"Savannah","state":"GA","phoneNumber":"912-657-6729","email":"jvalentelli2k@nifty.com"}, -{"id":94,"firstName":"Hildagarde","lastName":"Sandels","street":"1 Lotheville Lane","postalCode":"32277","city":"Jacksonville","state":"FL","phoneNumber":"904-981-2753","email":"hsandels2l@a8.net"}, -{"id":95,"firstName":"Kip","lastName":"Cranidge","street":"2 South Road","postalCode":"19160","city":"Philadelphia","state":"PA"}, -{"id":96,"firstName":"Tobit","lastName":"Jarrette","street":"777 Mallard Trail","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-706-1988"}, -{"id":97,"firstName":"Tibold","lastName":"Michie","street":"87796 Nevada Junction","postalCode":"22093","city":"Ashburn","state":"VA","phoneNumber":"571-188-4893","email":"tmichie2o@mapy.cz"}, -{"id":98,"firstName":"Maximo","lastName":"Ifill","street":"8307 Tony Point","postalCode":"22225","city":"Arlington","state":"VA","phoneNumber":"571-404-1412"}, -{"id":99,"firstName":"Patti","lastName":"Autry","street":"901 Iowa Crossing","postalCode":"55551","city":"Young America","state":"MN","phoneNumber":"952-772-9107","email":"pautry2q@scientificamerican.com"}, -{"id":100,"firstName":"Cathe","lastName":"Jost","street":"4400 Menomonie Road","postalCode":"21211","city":"Baltimore","state":"MD","phoneNumber":"410-800-4683","email":"cjost2r@tuttocitta.it"}, -{"id":101,"firstName":"Byron","lastName":"Maddams","street":"10729 Oak Trail","postalCode":"78255","city":"San Antonio","state":"TX","phoneNumber":"830-263-4129"}, -{"id":102,"firstName":"Sosanna","lastName":"Paley","street":"82207 Park Meadow Court","postalCode":"77010","city":"Houston","state":"TX","phoneNumber":"832-740-8766","email":"spaley2t@salon.com"}, -{"id":103,"firstName":"Elysia","lastName":"Skerratt","street":"88708 Cambridge Drive","postalCode":"31217","city":"Macon","state":"GA","phoneNumber":"478-265-6579","email":"eskerratt2u@japanpost.jp"}, -{"id":104,"firstName":"Nealson","lastName":"Sieur","street":"1286 Elmside Plaza","postalCode":"20904","city":"Silver Spring","state":"MD"}, -{"id":105,"firstName":"Yasmeen","lastName":"Bazire","street":"91904 Elmside Point","postalCode":"73167","city":"Oklahoma City","state":"OK"}, -{"id":106,"firstName":"Mandy","lastName":"Ewart","street":"91 Norway Maple Street","postalCode":"21239","city":"Baltimore","state":"MD","email":"mewart2x@weebly.com"}, -{"id":107,"firstName":"Chlo","lastName":"Keedy","street":"560 Oak Valley Avenue","postalCode":"20420","city":"Washington","state":"DC"}, -{"id":108,"firstName":"Benedicta","lastName":"Dinneen","street":"9 Cottonwood Circle","postalCode":"60686","city":"Chicago","state":"IL","email":"bdinneen2z@nydailynews.com"}, -{"id":109,"firstName":"Nanon","lastName":"Corsar","street":"40001 Barby Drive","postalCode":"95818","city":"Sacramento","state":"CA","email":"ncorsar30@house.gov"}, -{"id":110,"firstName":"Babette","lastName":"Scarsbrick","street":"96095 Loomis Terrace","postalCode":"94622","city":"Oakland","state":"CA","email":"bscarsbrick31@smugmug.com"}, -{"id":111,"firstName":"Cornall","lastName":"Christauffour","street":"9 Springview Alley","postalCode":"84170","city":"Salt Lake City","state":"UT","phoneNumber":"801-935-1246","email":"cchristauffour32@booking.com"}, -{"id":112,"firstName":"Micki","lastName":"Labell","street":"77729 Heath Place","postalCode":"25336","city":"Charleston","state":"WV"}, -{"id":113,"firstName":"Marissa","lastName":"Bricksey","street":"1 Jackson Pass","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"917-552-4280"}, -{"id":114,"firstName":"Alex","lastName":"Lyptrade","street":"74 Bunting Circle","postalCode":"40591","city":"Lexington","state":"KY","phoneNumber":"859-177-0753"}, -{"id":115,"firstName":"Tove","lastName":"Bielfeldt","street":"95 Mallard Hill","postalCode":"70894","city":"Baton Rouge","state":"LA","email":"tbielfeldt36@goo.gl"}, -{"id":116,"firstName":"Rodrigo","lastName":"Chestle","street":"53625 1st Junction","postalCode":"43635","city":"Toledo","state":"OH","phoneNumber":"419-928-0953","email":"rchestle37@princeton.edu"}, -{"id":117,"firstName":"Ulrike","lastName":"Kendle","street":"0 Cardinal Alley","postalCode":"80925","city":"Colorado Springs","state":"CO","phoneNumber":"719-796-1992","email":"ukendle38@naver.com"}, -{"id":118,"firstName":"Sandor","lastName":"Warwick","street":"8 Spaight Crossing","postalCode":"92030","city":"Escondido","state":"CA","email":"swarwick39@about.com"}, -{"id":119,"firstName":"Selina","lastName":"Slowcock","street":"7 7th Circle","postalCode":"50335","city":"Des Moines","state":"IA","phoneNumber":"515-865-9809"}, -{"id":120,"firstName":"Maxine","lastName":"Placstone","street":"42056 Sycamore Plaza","postalCode":"20244","city":"Washington","state":"DC"}, -{"id":121,"firstName":"Ardine","lastName":"Reven","street":"10634 Nancy Way","postalCode":"10175","city":"New York City","state":"NY","email":"areven3c@diigo.com"}, -{"id":122,"firstName":"Dilan","lastName":"Widdows","street":"37 Park Meadow Way","postalCode":"68144","city":"Omaha","state":"NE","phoneNumber":"402-383-9020"}, -{"id":123,"firstName":"Kevina","lastName":"Praten","street":"8531 Elmside Point","postalCode":"27610","city":"Raleigh","state":"NC","email":"kpraten3e@craigslist.org"}, -{"id":124,"firstName":"Sherman","lastName":"Jurczak","street":"8281 Acker Alley","postalCode":"07522","city":"Paterson","state":"NJ","email":"sjurczak3f@github.com"}, -{"id":125,"firstName":"Beckie","lastName":"Disney","street":"3 Butterfield Drive","postalCode":"49518","city":"Grand Rapids","state":"MI","phoneNumber":"616-493-1284","email":"bdisney3g@china.com.cn"}, -{"id":126,"firstName":"Blaine","lastName":"Leak","street":"369 Norway Maple Lane","postalCode":"03804","city":"Portsmouth","state":"NH","email":"bleak3h@lulu.com"}, -{"id":127,"firstName":"Dare","lastName":"Marney","street":"50 Lake View Alley","postalCode":"06505","city":"New Haven","state":"CT","phoneNumber":"203-876-6938","email":"dmarney3i@delicious.com"}, -{"id":128,"firstName":"Darby","lastName":"Sackler","street":"841 Ridgeview Trail","postalCode":"80279","city":"Denver","state":"CO"}, -{"id":129,"firstName":"Aurilia","lastName":"Seabrocke","street":"670 Schmedeman Road","postalCode":"11254","city":"Brooklyn","state":"NY","email":"aseabrocke3k@engadget.com"}, -{"id":130,"firstName":"Griz","lastName":"Riccioppo","street":"2204 Moland Circle","postalCode":"45218","city":"Cincinnati","state":"OH","email":"griccioppo3l@cisco.com"}, -{"id":131,"firstName":"Zahara","lastName":"Quinion","street":"4979 Mallory Circle","postalCode":"24515","city":"Lynchburg","state":"VA","email":"zquinion3m@sfgate.com"}, -{"id":132,"firstName":"Holly-anne","lastName":"Fontel","street":"60752 Hallows Circle","postalCode":"76705","city":"Waco","state":"TX","phoneNumber":"254-822-2565","email":"hfontel3n@exblog.jp"}, -{"id":133,"firstName":"Johannes","lastName":"Lemonby","street":"3 Grover Terrace","postalCode":"25709","city":"Huntington","state":"WV","phoneNumber":"304-342-4911","email":"jlemonby3o@woothemes.com"}, -{"id":134,"firstName":"Melvin","lastName":"Kain","street":"16 Pond Junction","postalCode":"85215","city":"Mesa","state":"AZ","phoneNumber":"602-146-3701"}, -{"id":135,"firstName":"Letta","lastName":"Smelley","street":"537 Helena Circle","postalCode":"22119","city":"Merrifield","state":"VA","phoneNumber":"571-472-5640"}, -{"id":136,"firstName":"Clerc","lastName":"Mc Ilwrick","street":"7050 Northfield Street","postalCode":"90050","city":"Los Angeles","state":"CA","email":"cmcilwrick3r@abc.net.au"}, -{"id":137,"firstName":"Abba","lastName":"Sutherns","street":"8087 Monterey Lane","postalCode":"83757","city":"Boise","state":"ID","phoneNumber":"208-110-3153","email":"asutherns3s@dropbox.com"}, -{"id":138,"firstName":"Karola","lastName":"Symper","street":"4596 Clyde Gallagher Road","postalCode":"28815","city":"Asheville","state":"NC","email":"ksymper3t@parallels.com"}, -{"id":139,"firstName":"Jessamyn","lastName":"Deacock","street":"19557 Bobwhite Way","postalCode":"19725","city":"Newark","state":"DE","phoneNumber":"302-174-2938"}, -{"id":140,"firstName":"Iggy","lastName":"Impey","street":"8 Brown Place","postalCode":"27499","city":"Greensboro","state":"NC"}, -{"id":141,"firstName":"Kary","lastName":"Mably","street":"75 Porter Avenue","postalCode":"70174","city":"New Orleans","state":"LA","email":"kmably3w@miibeian.gov.cn"}, -{"id":142,"firstName":"Ciel","lastName":"Tidbold","street":"54 Mitchell Lane","postalCode":"90055","city":"Los Angeles","state":"CA"}, -{"id":143,"firstName":"Dyana","lastName":"Orcott","street":"2 Kinsman Street","postalCode":"90005","city":"Los Angeles","state":"CA","phoneNumber":"310-366-6987"}, -{"id":144,"firstName":"Damien","lastName":"Haking","street":"2 Elmside Point","postalCode":"62705","city":"Springfield","state":"IL","email":"dhaking3z@drupal.org"}, -{"id":145,"firstName":"Ricardo","lastName":"Bille","street":"3 Mesta Hill","postalCode":"98411","city":"Tacoma","state":"WA","email":"rbille40@ebay.co.uk"}, -{"id":146,"firstName":"Carlene","lastName":"Roget","street":"8 Granby Avenue","postalCode":"35225","city":"Birmingham","state":"AL","phoneNumber":"205-762-4907","email":"croget41@statcounter.com"}, -{"id":147,"firstName":"Sharlene","lastName":"Antusch","street":"02445 Stang Parkway","postalCode":"55480","city":"Minneapolis","state":"MN","email":"santusch42@mtv.com"}, -{"id":148,"firstName":"Goober","lastName":"Danielczyk","street":"474 Union Court","postalCode":"70505","city":"Lafayette","state":"LA","phoneNumber":"337-779-0312","email":"gdanielczyk43@dion.ne.jp"}, -{"id":149,"firstName":"Janette","lastName":"Mauro","street":"1231 Commercial Crossing","postalCode":"97201","city":"Portland","state":"OR","phoneNumber":"971-423-7259"}, -{"id":150,"firstName":"Melinda","lastName":"Shitliffe","street":"244 Derek Drive","postalCode":"23208","city":"Richmond","state":"VA","phoneNumber":"804-864-5845"}, -{"id":151,"firstName":"Constance","lastName":"Fardon","street":"3 Lien Point","postalCode":"89105","city":"Las Vegas","state":"NV"}, -{"id":152,"firstName":"Tedd","lastName":"Storey","street":"2551 Luster Point","postalCode":"19151","city":"Philadelphia","state":"PA","phoneNumber":"215-622-9273","email":"tstorey47@google.com.au"}, -{"id":153,"firstName":"Brigitte","lastName":"Slograve","street":"8130 Waubesa Hill","postalCode":"11499","city":"Jamaica","state":"NY","email":"bslograve48@yandex.ru"}, -{"id":154,"firstName":"Ralph","lastName":"Comberbeach","street":"88140 Anderson Avenue","postalCode":"90076","city":"Los Angeles","state":"CA"}, -{"id":155,"firstName":"Deloria","lastName":"Thomazet","street":"666 Center Crossing","postalCode":"38119","city":"Memphis","state":"TN","phoneNumber":"615-840-7916"}, -{"id":156,"firstName":"Fidel","lastName":"MacClay","street":"01 Fairfield Point","postalCode":"24034","city":"Roanoke","state":"VA","email":"fmacclay4b@sitemeter.com"}, -{"id":157,"firstName":"Amalee","lastName":"Menzies","street":"6 Judy Drive","postalCode":"84605","city":"Provo","state":"UT"}, -{"id":158,"firstName":"Ansel","lastName":"Jory","street":"3 Nobel Park","postalCode":"32505","city":"Pensacola","state":"FL","phoneNumber":"850-394-8201"}, -{"id":159,"firstName":"Teodor","lastName":"Longhorn","street":"563 Sutherland Avenue","postalCode":"98008","city":"Bellevue","state":"WA"}, -{"id":160,"firstName":"Margarita","lastName":"Rewcassell","street":"64711 Beilfuss Point","postalCode":"79764","city":"Odessa","state":"TX","phoneNumber":"432-413-2196"}, -{"id":161,"firstName":"Tarra","lastName":"Albro","street":"2 Graceland Way","postalCode":"78405","city":"Corpus Christi","state":"TX"}, -{"id":162,"firstName":"Whitaker","lastName":"Brizell","street":"6 Luster Place","postalCode":"33694","city":"Tampa","state":"FL","email":"wbrizell4h@naver.com"}, -{"id":163,"firstName":"Gauthier","lastName":"Getsham","street":"0820 Duke Plaza","postalCode":"28263","city":"Charlotte","state":"NC","phoneNumber":"704-510-2908"}, -{"id":164,"firstName":"Thane","lastName":"Discombe","street":"56809 Aberg Street","postalCode":"63167","city":"Saint Louis","state":"MO"}, -{"id":165,"firstName":"Felicia","lastName":"Barthrup","street":"904 Stuart Junction","postalCode":"32220","city":"Jacksonville","state":"FL"}, -{"id":166,"firstName":"Emeline","lastName":"Jobes","street":"2670 Prairieview Plaza","postalCode":"10120","city":"New York City","state":"NY","email":"ejobes4l@newyorker.com"}, -{"id":167,"firstName":"Felicle","lastName":"Bowie","street":"9715 Lighthouse Bay Parkway","postalCode":"11210","city":"Brooklyn","state":"NY","email":"fbowie4m@auda.org.au"}, -{"id":168,"firstName":"Clare","lastName":"Miskelly","street":"8 Towne Trail","postalCode":"44555","city":"Youngstown","state":"OH"}, -{"id":169,"firstName":"Mort","lastName":"Danat","street":"6833 Shoshone Lane","postalCode":"12255","city":"Albany","state":"NY","phoneNumber":"518-967-9791","email":"mdanat4o@privacy.gov.au"}, -{"id":170,"firstName":"Ailey","lastName":"Scatchar","street":"3 Northfield Point","postalCode":"76505","city":"Temple","state":"TX"}, -{"id":171,"firstName":"Kevina","lastName":"Darwent","street":"8165 Reinke Alley","postalCode":"94132","city":"San Francisco","state":"CA","email":"kdarwent4q@artisteer.com"}, -{"id":172,"firstName":"My","lastName":"Buston","street":"715 Saint Paul Center","postalCode":"31416","city":"Savannah","state":"GA","phoneNumber":"912-281-8654"}, -{"id":173,"firstName":"Emera","lastName":"Lingner","street":"943 Eastlawn Hill","postalCode":"90605","city":"Whittier","state":"CA"}, -{"id":174,"firstName":"Drucie","lastName":"Byer","street":"988 4th Court","postalCode":"06816","city":"Danbury","state":"CT","email":"dbyer4t@xinhuanet.com"}, -{"id":175,"firstName":"Modestine","lastName":"Madeley","street":"1 Delaware Terrace","postalCode":"80126","city":"Littleton","state":"CO"}, -{"id":176,"firstName":"Selie","lastName":"O'Mohun","street":"42 Monument Trail","postalCode":"55590","city":"Monticello","state":"MN","phoneNumber":"763-384-5166"}, -{"id":177,"firstName":"Shayla","lastName":"Pesselt","street":"7 Pawling Center","postalCode":"20099","city":"Washington","state":"DC","phoneNumber":"202-816-7300","email":"spesselt4w@posterous.com"}, -{"id":178,"firstName":"Raeann","lastName":"Layland","street":"06548 Longview Alley","postalCode":"77005","city":"Houston","state":"TX","phoneNumber":"214-899-1257","email":"rlayland4x@pcworld.com"}, -{"id":179,"firstName":"Dael","lastName":"Christaeas","street":"375 Northfield Street","postalCode":"23509","city":"Norfolk","state":"VA","phoneNumber":"757-391-2798","email":"dchristaeas4y@sciencedaily.com"}, -{"id":180,"firstName":"Nicolas","lastName":"Baxill","street":"9 Autumn Leaf Terrace","postalCode":"77005","city":"Houston","state":"TX","email":"nbaxill4z@edublogs.org"}, -{"id":181,"firstName":"Onida","lastName":"Pengilly","street":"61 Commercial Junction","postalCode":"24029","city":"Roanoke","state":"VA","email":"opengilly50@slideshare.net"}, -{"id":182,"firstName":"Muffin","lastName":"Thrasher","street":"1 Morning Hill","postalCode":"64082","city":"Lees Summit","state":"MO"}, -{"id":183,"firstName":"Ignaz","lastName":"McLugish","street":"3936 Columbus Point","postalCode":"35263","city":"Birmingham","state":"AL"}, -{"id":184,"firstName":"Guillaume","lastName":"Gillings","street":"75541 Sheridan Center","postalCode":"68510","city":"Lincoln","state":"NE","email":"ggillings53@unblog.fr"}, -{"id":185,"firstName":"Kalli","lastName":"Branche","street":"33740 Manitowish Court","postalCode":"96805","city":"Honolulu","state":"HI"}, -{"id":186,"firstName":"Winthrop","lastName":"Barszczewski","street":"9 Luster Terrace","postalCode":"60158","city":"Carol Stream","state":"IL","phoneNumber":"309-633-3125","email":"wbarszczewski55@eventbrite.com"}, -{"id":187,"firstName":"Renaud","lastName":"Nitto","street":"1 Crownhardt Place","postalCode":"10310","city":"Staten Island","state":"NY","phoneNumber":"914-568-4524","email":"rnitto56@typepad.com"}, -{"id":188,"firstName":"Pollyanna","lastName":"Wherrett","street":"31380 Upham Street","postalCode":"76134","city":"Fort Worth","state":"TX","phoneNumber":"817-198-3301","email":"pwherrett57@bluehost.com"}, -{"id":189,"firstName":"Lilly","lastName":"Gatchell","street":"7 Elka Road","postalCode":"94064","city":"Redwood City","state":"CA","email":"lgatchell58@patch.com"}, -{"id":190,"firstName":"Leopold","lastName":"Leavey","street":"9 Darwin Crossing","postalCode":"20268","city":"Washington","state":"DC","phoneNumber":"202-964-5932","email":"lleavey59@aol.com"}, -{"id":191,"firstName":"Byram","lastName":"Stuckes","street":"782 Northport Alley","postalCode":"55436","city":"Minneapolis","state":"MN"}, -{"id":192,"firstName":"Cull","lastName":"Whiterod","street":"2586 Banding Terrace","postalCode":"80249","city":"Denver","state":"CO","email":"cwhiterod5b@skype.com"}, -{"id":193,"firstName":"Gretel","lastName":"Tacey","street":"6382 Fremont Avenue","postalCode":"25305","city":"Charleston","state":"WV"}, -{"id":194,"firstName":"Tudor","lastName":"Piff","street":"0 Monterey Circle","postalCode":"00214","city":"Portsmouth","state":"NH","email":"tpiff5d@eepurl.com"}, -{"id":195,"firstName":"Julienne","lastName":"Adshed","street":"91839 Lawn Avenue","postalCode":"92519","city":"Riverside","state":"CA"}, -{"id":196,"firstName":"Arnold","lastName":"Fearns","street":"7 West Trail","postalCode":"35242","city":"Birmingham","state":"AL","email":"afearns5f@bravesites.com"}, -{"id":197,"firstName":"Dunc","lastName":"Khoter","street":"048 Clove Lane","postalCode":"89505","city":"Reno","state":"NV","phoneNumber":"775-120-9532","email":"dkhoter5g@bbb.org"}, -{"id":198,"firstName":"Stevana","lastName":"Lush","street":"6 Dovetail Plaza","postalCode":"79945","city":"El Paso","state":"TX","email":"slush5h@economist.com"}, -{"id":199,"firstName":"Iggy","lastName":"Verryan","street":"5 Sommers Road","postalCode":"34114","city":"Naples","state":"FL","phoneNumber":"239-205-8767"}, -{"id":200,"firstName":"Breena","lastName":"Rubbert","street":"5 Kensington Crossing","postalCode":"90510","city":"Torrance","state":"CA","email":"brubbert5j@phpbb.com"}, -{"id":201,"firstName":"Jervis","lastName":"Doree","street":"2947 Center Plaza","postalCode":"70160","city":"New Orleans","state":"LA","phoneNumber":"504-278-7497","email":"jdoree5k@shutterfly.com"}, -{"id":202,"firstName":"Odelia","lastName":"Lidierth","street":"36699 Aberg Park","postalCode":"62764","city":"Springfield","state":"IL"}, -{"id":203,"firstName":"Ree","lastName":"Lammerding","street":"3542 Lerdahl Court","postalCode":"88558","city":"El Paso","state":"TX","phoneNumber":"915-384-9334","email":"rlammerding5m@msu.edu"}, -{"id":204,"firstName":"Davy","lastName":"Orniz","street":"49 Graedel Parkway","postalCode":"48295","city":"Detroit","state":"MI","email":"dorniz5n@examiner.com"}, -{"id":205,"firstName":"Syd","lastName":"Buckoke","street":"70 Pepper Wood Alley","postalCode":"74156","city":"Tulsa","state":"OK","phoneNumber":"918-604-5799"}, -{"id":206,"firstName":"Ginger","lastName":"Calkin","street":"7 Thompson Trail","postalCode":"71115","city":"Shreveport","state":"LA","phoneNumber":"318-650-6046"}, -{"id":207,"firstName":"Anissa","lastName":"Ivashinnikov","street":"61905 Chive Circle","postalCode":"40745","city":"London","state":"KY","email":"aivashinnikov5q@google.cn"}, -{"id":208,"firstName":"Vikky","lastName":"Kesley","street":"1 Grayhawk Street","postalCode":"06538","city":"New Haven","state":"CT","phoneNumber":"203-944-7163"}, -{"id":209,"firstName":"Alisha","lastName":"Lampke","street":"26940 Kensington Park","postalCode":"55446","city":"Minneapolis","state":"MN","phoneNumber":"612-814-9814","email":"alampke5s@apple.com"}, -{"id":210,"firstName":"Davidde","lastName":"Phlipon","street":"2044 Ruskin Road","postalCode":"07188","city":"Newark","state":"NJ","email":"dphlipon5t@shareasale.com"}, -{"id":211,"firstName":"Joly","lastName":"Crottagh","street":"532 Dawn Plaza","postalCode":"85083","city":"Phoenix","state":"AZ","phoneNumber":"602-533-4064"}, -{"id":212,"firstName":"Aggie","lastName":"Niesing","street":"3 Tony Drive","postalCode":"57110","city":"Sioux Falls","state":"SD","email":"aniesing5v@pbs.org"}, -{"id":213,"firstName":"Daron","lastName":"Baudassi","street":"2411 Melvin Court","postalCode":"40581","city":"Lexington","state":"KY","phoneNumber":"859-754-2542","email":"dbaudassi5w@joomla.org"}, -{"id":214,"firstName":"Thadeus","lastName":"Kleiser","street":"1394 Warner Street","postalCode":"87592","city":"Santa Fe","state":"NM","email":"tkleiser5x@bloomberg.com"}, -{"id":215,"firstName":"Terri","lastName":"Perrat","street":"0080 Upham Plaza","postalCode":"52245","city":"Iowa City","state":"IA"}, -{"id":216,"firstName":"Marlena","lastName":"Gatchell","street":"60888 Annamark Street","postalCode":"90060","city":"Los Angeles","state":"CA","phoneNumber":"323-121-6985","email":"mgatchell5z@ibm.com"}, -{"id":217,"firstName":"Locke","lastName":"Orcott","street":"459 Warner Lane","postalCode":"45020","city":"Hamilton","state":"OH","phoneNumber":"937-115-3187"}, -{"id":218,"firstName":"Wilmer","lastName":"Bewick","street":"0 Ohio Center","postalCode":"98166","city":"Seattle","state":"WA","phoneNumber":"253-805-8855","email":"wbewick61@seesaa.net"}, -{"id":219,"firstName":"Marena","lastName":"MacShirrie","street":"607 Badeau Circle","postalCode":"98008","city":"Bellevue","state":"WA","email":"mmacshirrie62@wikia.com"}, -{"id":220,"firstName":"Nathanial","lastName":"Sexty","street":"43 Basil Place","postalCode":"85020","city":"Phoenix","state":"AZ"}, -{"id":221,"firstName":"Wadsworth","lastName":"Iacovuzzi","street":"9610 Donald Crossing","postalCode":"88530","city":"El Paso","state":"TX","phoneNumber":"915-889-7936","email":"wiacovuzzi64@prnewswire.com"}, -{"id":222,"firstName":"Sutton","lastName":"Stych","street":"9 Brentwood Terrace","postalCode":"20546","city":"Washington","state":"DC","phoneNumber":"202-538-6355","email":"sstych65@wikimedia.org"}, -{"id":223,"firstName":"Gaspar","lastName":"Wabey","street":"3061 Bluejay Terrace","postalCode":"10110","city":"New York City","state":"NY","phoneNumber":"917-939-0802","email":"gwabey66@technorati.com"}, -{"id":224,"firstName":"Herminia","lastName":"Guyot","street":"91 Express Drive","postalCode":"85715","city":"Tucson","state":"AZ","phoneNumber":"520-777-1670","email":"hguyot67@admin.ch"}, -{"id":225,"firstName":"Udale","lastName":"Beurich","street":"675 Karstens Crossing","postalCode":"46852","city":"Fort Wayne","state":"IN","phoneNumber":"260-580-8627","email":"ubeurich68@bigcartel.com"}, -{"id":226,"firstName":"Kerrie","lastName":"Girauld","street":"56132 Charing Cross Court","postalCode":"71137","city":"Shreveport","state":"LA","email":"kgirauld69@nationalgeographic.com"}, -{"id":227,"firstName":"Irvin","lastName":"Nix","street":"0676 Aberg Terrace","postalCode":"97075","city":"Beaverton","state":"OR","email":"inix6a@xing.com"}, -{"id":228,"firstName":"Corene","lastName":"Spencock","street":"90 Meadow Ridge Drive","postalCode":"73173","city":"Oklahoma City","state":"OK","phoneNumber":"405-577-1312","email":"cspencock6b@shinystat.com"}, -{"id":229,"firstName":"Christos","lastName":"McIlreavy","street":"673 Jana Trail","postalCode":"23471","city":"Virginia Beach","state":"VA","email":"cmcilreavy6c@mayoclinic.com"}, -{"id":230,"firstName":"Bennett","lastName":"Melding","street":"4 Cardinal Lane","postalCode":"55448","city":"Minneapolis","state":"MN","email":"bmelding6d@t-online.de"}, -{"id":231,"firstName":"Winny","lastName":"de Leon","street":"941 Scoville Place","postalCode":"94611","city":"Oakland","state":"CA","phoneNumber":"510-230-4168","email":"wdeleon6e@dell.com"}, -{"id":232,"firstName":"Nike","lastName":"Iacobassi","street":"956 Service Junction","postalCode":"71914","city":"Hot Springs National Park","state":"AR","phoneNumber":"501-266-4142"}, -{"id":233,"firstName":"Gillan","lastName":"Baumann","street":"11 8th Alley","postalCode":"31190","city":"Atlanta","state":"GA","phoneNumber":"404-703-5154","email":"gbaumann6g@edublogs.org"}, -{"id":234,"firstName":"Brandtr","lastName":"Gadman","street":"5 Marquette Hill","postalCode":"32511","city":"Pensacola","state":"FL","phoneNumber":"850-834-0058","email":"bgadman6h@marriott.com"}, -{"id":235,"firstName":"Kenn","lastName":"Cage","street":"3759 Spohn Point","postalCode":"94126","city":"San Francisco","state":"CA","email":"kcage6i@earthlink.net"}, -{"id":236,"firstName":"Butch","lastName":"Causby","street":"02 Basil Crossing","postalCode":"10110","city":"New York City","state":"NY","phoneNumber":"212-190-1702","email":"bcausby6j@scribd.com"}, -{"id":237,"firstName":"Haleigh","lastName":"Parsonson","street":"8 Ruskin Trail","postalCode":"87201","city":"Albuquerque","state":"NM","phoneNumber":"505-987-1352"}, -{"id":238,"firstName":"Bartel","lastName":"Ruppeli","street":"7538 Red Cloud Center","postalCode":"37410","city":"Chattanooga","state":"TN","phoneNumber":"423-804-1016","email":"bruppeli6l@etsy.com"}, -{"id":239,"firstName":"Gretchen","lastName":"Le feaver","street":"7 Orin Way","postalCode":"98042","city":"Kent","state":"WA","phoneNumber":"253-205-3092","email":"glefeaver6m@mayoclinic.com"}, -{"id":240,"firstName":"Trumaine","lastName":"Dearden","street":"1 Vernon Trail","postalCode":"06127","city":"West Hartford","state":"CT","phoneNumber":"860-939-3865","email":"tdearden6n@goo.gl"}, -{"id":241,"firstName":"Aggie","lastName":"Dubs","street":"3601 Walton Trail","postalCode":"62764","city":"Springfield","state":"IL","phoneNumber":"217-834-6059","email":"adubs6o@cbsnews.com"}, -{"id":242,"firstName":"Shelly","lastName":"Skechley","street":"16 Morning Lane","postalCode":"60567","city":"Naperville","state":"IL","email":"sskechley6p@technorati.com"}, -{"id":243,"firstName":"Karin","lastName":"Fausch","street":"7532 Eggendart Way","postalCode":"19810","city":"Wilmington","state":"DE","phoneNumber":"302-548-2991"}, -{"id":244,"firstName":"Sal","lastName":"Harrow","street":"2632 Lien Way","postalCode":"33982","city":"Punta Gorda","state":"FL","phoneNumber":"941-904-5187","email":"sharrow6r@joomla.org"}, -{"id":245,"firstName":"Albie","lastName":"Strelitzki","street":"8436 Eggendart Terrace","postalCode":"49505","city":"Grand Rapids","state":"MI","email":"astrelitzki6s@google.com.br"}, -{"id":246,"firstName":"Augy","lastName":"Usherwood","street":"9078 Clemons Street","postalCode":"80915","city":"Colorado Springs","state":"CO","email":"ausherwood6t@wikimedia.org"}, -{"id":247,"firstName":"Solomon","lastName":"D'eathe","street":"778 Rockefeller Parkway","postalCode":"84199","city":"Salt Lake City","state":"UT"}, -{"id":248,"firstName":"Talya","lastName":"Joseff","street":"14 Graedel Court","postalCode":"99220","city":"Spokane","state":"WA","email":"tjoseff6v@amazon.de"}, -{"id":249,"firstName":"Anatol","lastName":"Self","street":"2 Stoughton Junction","postalCode":"85255","city":"Scottsdale","state":"AZ"}, -{"id":250,"firstName":"Elinore","lastName":"Bruhnke","street":"3 Bashford Alley","postalCode":"17105","city":"Harrisburg","state":"PA","email":"ebruhnke6x@usnews.com"}, -{"id":251,"firstName":"Stanfield","lastName":"Jagiello","street":"0804 Amoth Road","postalCode":"20067","city":"Washington","state":"DC"}, -{"id":252,"firstName":"Isak","lastName":"Venour","street":"04 Orin Court","postalCode":"78210","city":"San Antonio","state":"TX","email":"ivenour6z@springer.com"}, -{"id":253,"firstName":"Abigale","lastName":"Woolgar","street":"74 Porter Terrace","postalCode":"62705","city":"Springfield","state":"IL"}, -{"id":254,"firstName":"Phylys","lastName":"Casperri","street":"07 Delaware Street","postalCode":"33069","city":"Pompano Beach","state":"FL","phoneNumber":"954-224-4577"}, -{"id":255,"firstName":"Melania","lastName":"Fee","street":"194 Luster Point","postalCode":"70154","city":"New Orleans","state":"LA","phoneNumber":"504-168-6959","email":"mfee72@comsenz.com"}, -{"id":256,"firstName":"Joli","lastName":"Colquite","street":"9 Bayside Court","postalCode":"27425","city":"Greensboro","state":"NC","email":"jcolquite73@comcast.net"}, -{"id":257,"firstName":"Rahel","lastName":"Late","street":"2 Meadow Ridge Alley","postalCode":"32204","city":"Jacksonville","state":"FL"}, -{"id":258,"firstName":"Carny","lastName":"Fewell","street":"21826 Cardinal Pass","postalCode":"98140","city":"Seattle","state":"WA"}, -{"id":259,"firstName":"Lesly","lastName":"Vanyatin","street":"7730 South Court","postalCode":"25356","city":"Charleston","state":"WV","email":"lvanyatin76@histats.com"}, -{"id":260,"firstName":"Fianna","lastName":"Thomason","street":"2576 Holmberg Trail","postalCode":"27710","city":"Durham","state":"NC"}, -{"id":261,"firstName":"Bobinette","lastName":"Gowdridge","street":"6780 Superior Place","postalCode":"37605","city":"Johnson City","state":"TN","phoneNumber":"423-490-4990","email":"bgowdridge78@icio.us"}, -{"id":262,"firstName":"Karmen","lastName":"Megson","street":"34 Messerschmidt Point","postalCode":"97229","city":"Portland","state":"OR","email":"kmegson79@apache.org"}, -{"id":263,"firstName":"Thaddeus","lastName":"Padilla","street":"42 Corben Road","postalCode":"90010","city":"Los Angeles","state":"CA","phoneNumber":"213-659-3136","email":"tpadilla7a@hud.gov"}, -{"id":264,"firstName":"Hanna","lastName":"Baswall","street":"9 Old Shore Lane","postalCode":"53710","city":"Madison","state":"WI","email":"hbaswall7b@ezinearticles.com"}, -{"id":265,"firstName":"Tania","lastName":"McMorland","street":"4333 Commercial Point","postalCode":"45408","city":"Dayton","state":"OH"}, -{"id":266,"firstName":"Gifford","lastName":"Arne","street":"0 Drewry Point","postalCode":"24048","city":"Roanoke","state":"VA","email":"garne7d@samsung.com"}, -{"id":267,"firstName":"Tomasina","lastName":"Linch","street":"64992 Maple Wood Point","postalCode":"98447","city":"Tacoma","state":"WA","email":"tlinch7e@theglobeandmail.com"}, -{"id":268,"firstName":"Merrick","lastName":"Garvan","street":"7220 Melody Trail","postalCode":"90005","city":"Los Angeles","state":"CA","email":"mgarvan7f@mozilla.org"}, -{"id":269,"firstName":"Carmita","lastName":"Sailes","street":"3 Bay Lane","postalCode":"55428","city":"Minneapolis","state":"MN","email":"csailes7g@devhub.com"}, -{"id":270,"firstName":"Lesly","lastName":"Eslemont","street":"93302 Mcbride Terrace","postalCode":"19810","city":"Wilmington","state":"DE","email":"leslemont7h@wunderground.com"}, -{"id":271,"firstName":"Adelaida","lastName":"Keggins","street":"4 Birchwood Pass","postalCode":"97405","city":"Eugene","state":"OR","phoneNumber":"541-387-1319"}, -{"id":272,"firstName":"Peadar","lastName":"Forte","street":"1 Montana Center","postalCode":"32505","city":"Pensacola","state":"FL","email":"pforte7j@xing.com"}, -{"id":273,"firstName":"Godfrey","lastName":"Swatland","street":"477 Maple Wood Road","postalCode":"93034","city":"Oxnard","state":"CA","phoneNumber":"805-267-0614","email":"gswatland7k@photobucket.com"}, -{"id":274,"firstName":"Marten","lastName":"Jelleman","street":"57 Pennsylvania Plaza","postalCode":"20057","city":"Washington","state":"DC","email":"mjelleman7l@phoca.cz"}, -{"id":275,"firstName":"Sharity","lastName":"Keady","street":"753 Sauthoff Place","postalCode":"77505","city":"Pasadena","state":"TX"}, -{"id":276,"firstName":"Gabbie","lastName":"Pally","street":"45 Fallview Park","postalCode":"97255","city":"Portland","state":"OR","phoneNumber":"971-412-2293","email":"gpally7n@dyndns.org"}, -{"id":277,"firstName":"Betsy","lastName":"Rhelton","street":"9 Jackson Road","postalCode":"85040","city":"Phoenix","state":"AZ"}, -{"id":278,"firstName":"Patty","lastName":"Schooling","street":"4 Moulton Point","postalCode":"25705","city":"Huntington","state":"WV","phoneNumber":"304-908-8211","email":"pschooling7p@parallels.com"}, -{"id":279,"firstName":"Katlin","lastName":"O'Hallagan","street":"8418 Petterle Plaza","postalCode":"60636","city":"Chicago","state":"IL","email":"kohallagan7q@hao123.com"}, -{"id":280,"firstName":"Anne","lastName":"Wealleans","street":"3 Sachtjen Court","postalCode":"48609","city":"Saginaw","state":"MI"}, -{"id":281,"firstName":"Flory","lastName":"Pley","street":"6322 Golf View Court","postalCode":"19104","city":"Philadelphia","state":"PA"}, -{"id":282,"firstName":"Maryellen","lastName":"Baszkiewicz","street":"54165 Hanson Trail","postalCode":"93726","city":"Fresno","state":"CA","phoneNumber":"209-198-4916","email":"mbaszkiewicz7t@google.com.br"}, -{"id":283,"firstName":"Moyna","lastName":"Caddens","street":"17 Melrose Lane","postalCode":"11236","city":"Brooklyn","state":"NY","phoneNumber":"917-518-3987","email":"mcaddens7u@amazon.co.uk"}, -{"id":284,"firstName":"Lawton","lastName":"Ramiro","street":"2 Muir Park","postalCode":"48092","city":"Warren","state":"MI","phoneNumber":"810-472-5208","email":"lramiro7v@senate.gov"}, -{"id":285,"firstName":"Agnella","lastName":"Phelip","street":"24566 Colorado Pass","postalCode":"84145","city":"Salt Lake City","state":"UT","phoneNumber":"801-709-8696","email":"aphelip7w@woothemes.com"}, -{"id":286,"firstName":"Tracee","lastName":"Tighe","street":"41013 Cascade Lane","postalCode":"02142","city":"Cambridge","state":"MA"}, -{"id":287,"firstName":"Shelden","lastName":"Sowrey","street":"87 Glacier Hill Court","postalCode":"55557","city":"Young America","state":"MN","email":"ssowrey7y@sfgate.com"}, -{"id":288,"firstName":"Letizia","lastName":"Sallery","street":"65052 Shasta Court","postalCode":"44905","city":"Mansfield","state":"OH","phoneNumber":"419-752-9141"}, -{"id":289,"firstName":"Hilly","lastName":"Oyley","street":"7 Waywood Trail","postalCode":"30323","city":"Atlanta","state":"GA","email":"hoyley80@upenn.edu"}, -{"id":290,"firstName":"Sabra","lastName":"Grigoryev","street":"856 Michigan Trail","postalCode":"33705","city":"Saint Petersburg","state":"FL"}, -{"id":291,"firstName":"Nathanil","lastName":"Bodham","street":"536 Ridgeview Way","postalCode":"79984","city":"El Paso","state":"TX","email":"nbodham82@wikimedia.org"}, -{"id":292,"firstName":"Niven","lastName":"Hartzenberg","street":"5 Carpenter Hill","postalCode":"73167","city":"Oklahoma City","state":"OK","email":"nhartzenberg83@bandcamp.com"}, -{"id":293,"firstName":"Rachael","lastName":"Birdsall","street":"61484 Mendota Point","postalCode":"90410","city":"Santa Monica","state":"CA","email":"rbirdsall84@gmpg.org"}, -{"id":294,"firstName":"Gypsy","lastName":"Rallin","street":"4 Spohn Drive","postalCode":"77346","city":"Humble","state":"TX","phoneNumber":"713-508-2912","email":"grallin85@privacy.gov.au"}, -{"id":295,"firstName":"Skye","lastName":"Arsey","street":"49126 Maryland Lane","postalCode":"02119","city":"Boston","state":"MA"}, -{"id":296,"firstName":"Karalee","lastName":"Biddiss","street":"0327 Coleman Lane","postalCode":"10203","city":"New York City","state":"NY","email":"kbiddiss87@studiopress.com"}, -{"id":297,"firstName":"Russ","lastName":"O' Mahony","street":"7831 Caliangt Avenue","postalCode":"37665","city":"Kingsport","state":"TN","phoneNumber":"423-292-1177","email":"romahony88@umich.edu"}, -{"id":298,"firstName":"Gerianne","lastName":"Morfey","street":"1 Jay Hill","postalCode":"97229","city":"Portland","state":"OR","email":"gmorfey89@techcrunch.com"}, -{"id":299,"firstName":"Griz","lastName":"Vellacott","street":"44 Parkside Court","postalCode":"64149","city":"Kansas City","state":"MO","phoneNumber":"816-120-1692"}, -{"id":300,"firstName":"Parker","lastName":"Mantz","street":"3 Arkansas Lane","postalCode":"90005","city":"Los Angeles","state":"CA","email":"pmantz8b@va.gov"}, -{"id":301,"firstName":"Drugi","lastName":"Acaster","street":"426 Hagan Park","postalCode":"20599","city":"Washington","state":"DC","email":"dacaster8c@ihg.com"}, -{"id":302,"firstName":"Peder","lastName":"Monget","street":"9 Wayridge Parkway","postalCode":"92862","city":"Orange","state":"CA","phoneNumber":"714-532-0867","email":"pmonget8d@biblegateway.com"}, -{"id":303,"firstName":"Zilvia","lastName":"Grocutt","street":"1 Stuart Circle","postalCode":"34642","city":"Seminole","state":"FL"}, -{"id":304,"firstName":"Clyve","lastName":"Gunby","street":"75 Dunning Junction","postalCode":"79977","city":"El Paso","state":"TX","email":"cgunby8f@microsoft.com"}, -{"id":305,"firstName":"Zacharias","lastName":"Tomasini","street":"48488 Thackeray Way","postalCode":"40210","city":"Louisville","state":"KY","email":"ztomasini8g@harvard.edu"}, -{"id":306,"firstName":"Ferdinand","lastName":"McGuinley","street":"30366 Kipling Drive","postalCode":"23208","city":"Richmond","state":"VA","email":"fmcguinley8h@archive.org"}, -{"id":307,"firstName":"Ebonee","lastName":"Brumfitt","street":"18765 Division Terrace","postalCode":"30033","city":"Decatur","state":"GA","phoneNumber":"404-684-8364","email":"ebrumfitt8i@sourceforge.net"}, -{"id":308,"firstName":"Christy","lastName":"Cuniam","street":"6 Homewood Road","postalCode":"78744","city":"Austin","state":"TX","phoneNumber":"361-677-9833","email":"ccuniam8j@51.la"}, -{"id":309,"firstName":"Emelen","lastName":"Casin","street":"91 Thompson Plaza","postalCode":"33954","city":"Port Charlotte","state":"FL","email":"ecasin8k@webnode.com"}, -{"id":310,"firstName":"Babara","lastName":"Robberecht","street":"603 Oak Terrace","postalCode":"37450","city":"Chattanooga","state":"TN","email":"brobberecht8l@cargocollective.com"}, -{"id":311,"firstName":"Cesar","lastName":"Whitecross","street":"024 Oxford Junction","postalCode":"20226","city":"Washington","state":"DC","phoneNumber":"202-772-2936"}, -{"id":312,"firstName":"Frieda","lastName":"Sliman","street":"4 Beilfuss Hill","postalCode":"23324","city":"Chesapeake","state":"VA","email":"fsliman8n@bigcartel.com"}, -{"id":313,"firstName":"Dylan","lastName":"Paige","street":"26 Gina Parkway","postalCode":"55448","city":"Minneapolis","state":"MN","email":"dpaige8o@trellian.com"}, -{"id":314,"firstName":"Waring","lastName":"Labon","street":"2843 Spenser Center","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-274-0766","email":"wlabon8p@ucla.edu"}, -{"id":315,"firstName":"Conny","lastName":"Duinkerk","street":"65 Lunder Circle","postalCode":"45426","city":"Dayton","state":"OH","email":"cduinkerk8q@economist.com"}, -{"id":316,"firstName":"Nessie","lastName":"Stucksbury","street":"91449 Browning Drive","postalCode":"25705","city":"Huntington","state":"WV","phoneNumber":"304-182-0766"}, -{"id":317,"firstName":"Corrine","lastName":"Kohlert","street":"00706 Carioca Plaza","postalCode":"45223","city":"Cincinnati","state":"OH","email":"ckohlert8s@wunderground.com"}, -{"id":318,"firstName":"Horatio","lastName":"Greengrass","street":"0 Cascade Park","postalCode":"79905","city":"El Paso","state":"TX","email":"hgreengrass8t@ameblo.jp"}, -{"id":319,"firstName":"Jana","lastName":"McLae","street":"919 Esch Place","postalCode":"55428","city":"Minneapolis","state":"MN","email":"jmclae8u@nytimes.com"}, -{"id":320,"firstName":"Maressa","lastName":"Rehor","street":"55 Talisman Junction","postalCode":"90505","city":"Torrance","state":"CA","email":"mrehor8v@vinaora.com"}, -{"id":321,"firstName":"Filide","lastName":"Riehm","street":"0 Karstens Lane","postalCode":"95054","city":"Santa Clara","state":"CA"}, -{"id":322,"firstName":"Bunnie","lastName":"Mumbey","street":"9369 Bayside Circle","postalCode":"46216","city":"Indianapolis","state":"IN","email":"bmumbey8x@scribd.com"}, -{"id":323,"firstName":"Maxi","lastName":"Jentgens","street":"2970 Rowland Circle","postalCode":"84189","city":"Salt Lake City","state":"UT","phoneNumber":"801-423-8854","email":"mjentgens8y@ihg.com"}, -{"id":324,"firstName":"Florri","lastName":"Okenden","street":"2180 Cody Point","postalCode":"70187","city":"New Orleans","state":"LA","phoneNumber":"504-913-1989","email":"fokenden8z@networksolutions.com"}, -{"id":325,"firstName":"Imogen","lastName":"Grisard","street":"8 Westerfield Avenue","postalCode":"92668","city":"Orange","state":"CA","email":"igrisard90@tamu.edu"}, -{"id":326,"firstName":"Edwina","lastName":"Montes","street":"92 Carpenter Avenue","postalCode":"97216","city":"Portland","state":"OR","phoneNumber":"503-544-7296","email":"emontes91@reference.com"}, -{"id":327,"firstName":"Renelle","lastName":"MacCambridge","street":"77 Talmadge Circle","postalCode":"08638","city":"Trenton","state":"NJ","phoneNumber":"609-150-9438","email":"rmaccambridge92@springer.com"}, -{"id":328,"firstName":"Sterne","lastName":"Taberner","street":"642 6th Terrace","postalCode":"10120","city":"New York City","state":"NY","email":"staberner93@miibeian.gov.cn"}, -{"id":329,"firstName":"Garvy","lastName":"Pankethman","street":"8618 Kennedy Terrace","postalCode":"79405","city":"Lubbock","state":"TX","phoneNumber":"806-470-8784","email":"gpankethman94@free.fr"}, -{"id":330,"firstName":"Nathanil","lastName":"Holston","street":"27247 Eliot Avenue","postalCode":"31190","city":"Atlanta","state":"GA","email":"nholston95@drupal.org"}, -{"id":331,"firstName":"Caresse","lastName":"Kilty","street":"514 Manufacturers Pass","postalCode":"76205","city":"Denton","state":"TX","email":"ckilty96@umich.edu"}, -{"id":332,"firstName":"Arlinda","lastName":"Brenstuhl","street":"2 Sunnyside Avenue","postalCode":"55470","city":"Minneapolis","state":"MN","email":"abrenstuhl97@wisc.edu"}, -{"id":333,"firstName":"Darcy","lastName":"Dunne","street":"3 Badeau Park","postalCode":"91328","city":"Northridge","state":"CA"}, -{"id":334,"firstName":"Malva","lastName":"Grew","street":"2242 Huxley Hill","postalCode":"68510","city":"Lincoln","state":"NE","email":"mgrew99@com.com"}, -{"id":335,"firstName":"Sukey","lastName":"Winspur","street":"475 Melvin Way","postalCode":"68524","city":"Lincoln","state":"NE","phoneNumber":"402-816-9401"}, -{"id":336,"firstName":"Beth","lastName":"O'Dougherty","street":"450 Eastlawn Park","postalCode":"93591","city":"Palmdale","state":"CA","phoneNumber":"661-845-8781"}, -{"id":337,"firstName":"Cortney","lastName":"Meers","street":"9 Chive Drive","postalCode":"93762","city":"Fresno","state":"CA","email":"cmeers9c@diigo.com"}, -{"id":338,"firstName":"Geralda","lastName":"Brocket","street":"0686 La Follette Avenue","postalCode":"80126","city":"Littleton","state":"CO","phoneNumber":"720-641-1371","email":"gbrocket9d@youku.com"}, -{"id":339,"firstName":"Lishe","lastName":"Maliphant","street":"5 Erie Plaza","postalCode":"63169","city":"Saint Louis","state":"MO","email":"lmaliphant9e@sfgate.com"}, -{"id":340,"firstName":"Brod","lastName":"Dobrovsky","street":"9 Gateway Park","postalCode":"79405","city":"Lubbock","state":"TX"}, -{"id":341,"firstName":"Philippe","lastName":"Argile","street":"4 Red Cloud Plaza","postalCode":"49444","city":"Muskegon","state":"MI","phoneNumber":"231-633-5495"}, -{"id":342,"firstName":"Sadye","lastName":"Sally","street":"07 Mendota Terrace","postalCode":"75507","city":"Texarkana","state":"TX","email":"ssally9h@e-recht24.de"}, -{"id":343,"firstName":"Napoleon","lastName":"Piggott","street":"3968 Roxbury Point","postalCode":"35905","city":"Gadsden","state":"AL","email":"npiggott9i@cnbc.com"}, -{"id":344,"firstName":"Jere","lastName":"Larn","street":"5086 Dahle Crossing","postalCode":"39534","city":"Biloxi","state":"MS","email":"jlarn9j@twitter.com"}, -{"id":345,"firstName":"Bevon","lastName":"Stidson","street":"7 Armistice Court","postalCode":"23436","city":"Suffolk","state":"VA","email":"bstidson9k@alexa.com"}, -{"id":346,"firstName":"Drugi","lastName":"Ewbach","street":"6032 5th Avenue","postalCode":"02208","city":"Boston","state":"MA","email":"dewbach9l@techcrunch.com"}, -{"id":347,"firstName":"Milka","lastName":"Caizley","street":"7 Anderson Junction","postalCode":"37228","city":"Nashville","state":"TN","phoneNumber":"615-305-6985","email":"mcaizley9m@cyberchimps.com"}, -{"id":348,"firstName":"Wilton","lastName":"Biagi","street":"80833 6th Crossing","postalCode":"40215","city":"Louisville","state":"KY","email":"wbiagi9n@vinaora.com"}, -{"id":349,"firstName":"Dilly","lastName":"Spradbrow","street":"5 Harbort Street","postalCode":"45419","city":"Dayton","state":"OH","email":"dspradbrow9o@marketwatch.com"}, -{"id":350,"firstName":"Gan","lastName":"Gookey","street":"8387 Bultman Terrace","postalCode":"75241","city":"Dallas","state":"TX"}, -{"id":351,"firstName":"Nanon","lastName":"Mulrenan","street":"47257 Reindahl Drive","postalCode":"22119","city":"Merrifield","state":"VA","phoneNumber":"571-637-8154","email":"nmulrenan9q@godaddy.com"}, -{"id":352,"firstName":"Frederique","lastName":"Watkiss","street":"61 Heath Pass","postalCode":"70124","city":"New Orleans","state":"LA","phoneNumber":"504-891-7051"}, -{"id":353,"firstName":"Sinclare","lastName":"MacCurlye","street":"514 Meadow Ridge Place","postalCode":"97240","city":"Portland","state":"OR","phoneNumber":"971-190-5174","email":"smaccurlye9s@google.ru"}, -{"id":354,"firstName":"Jessie","lastName":"Newlands","street":"80509 Northland Pass","postalCode":"33111","city":"Miami","state":"FL","phoneNumber":"786-557-9193"}, -{"id":355,"firstName":"Jamaal","lastName":"Molder","street":"90 Mcbride Trail","postalCode":"78764","city":"Austin","state":"TX","phoneNumber":"512-320-8728"}, -{"id":356,"firstName":"Benni","lastName":"Sherel","street":"7 Springs Road","postalCode":"15235","city":"Pittsburgh","state":"PA","email":"bsherel9v@hostgator.com"}, -{"id":357,"firstName":"Dene","lastName":"Brigge","street":"8560 Sutteridge Parkway","postalCode":"32412","city":"Panama City","state":"FL"}, -{"id":358,"firstName":"Timoteo","lastName":"Iban","street":"52858 Oak Valley Hill","postalCode":"93750","city":"Fresno","state":"CA","email":"tiban9x@europa.eu"}, -{"id":359,"firstName":"Dar","lastName":"Quillinane","street":"2 Carberry Junction","postalCode":"66276","city":"Shawnee Mission","state":"KS","phoneNumber":"913-977-7562","email":"dquillinane9y@msn.com"}, -{"id":360,"firstName":"Claudian","lastName":"Tinson","street":"445 Novick Avenue","postalCode":"79968","city":"El Paso","state":"TX","email":"ctinson9z@google.cn"}, -{"id":361,"firstName":"Clarice","lastName":"Deneve","street":"94 Meadow Ridge Road","postalCode":"37131","city":"Murfreesboro","state":"TN","phoneNumber":"615-780-7667"}, -{"id":362,"firstName":"Hilary","lastName":"Bithell","street":"20 Russell Trail","postalCode":"81010","city":"Pueblo","state":"CO","email":"hbithella1@list-manage.com"}, -{"id":363,"firstName":"Mathew","lastName":"Scrivin","street":"4 Elgar Point","postalCode":"90081","city":"Los Angeles","state":"CA","phoneNumber":"213-898-6650","email":"mscrivina2@about.me"}, -{"id":364,"firstName":"Idell","lastName":"Rambadt","street":"6 Cherokee Hill","postalCode":"90840","city":"Long Beach","state":"CA","email":"irambadta3@ustream.tv"}, -{"id":365,"firstName":"Nealon","lastName":"Schoolfield","street":"1 Northland Point","postalCode":"74133","city":"Tulsa","state":"OK"}, -{"id":366,"firstName":"Gregorius","lastName":"Bartot","street":"24636 Eagle Crest Crossing","postalCode":"32215","city":"Jacksonville","state":"FL","email":"gbartota5@blogger.com"}, -{"id":367,"firstName":"Inessa","lastName":"Hullin","street":"559 Bartillon Trail","postalCode":"33142","city":"Miami","state":"FL","phoneNumber":"305-381-6621","email":"ihullina6@pcworld.com"}, -{"id":368,"firstName":"Andie","lastName":"Bampford","street":"5204 Meadow Valley Street","postalCode":"92825","city":"Anaheim","state":"CA","email":"abampforda7@sun.com"}, -{"id":369,"firstName":"Duane","lastName":"MacShirrie","street":"5077 Kings Parkway","postalCode":"92725","city":"Santa Ana","state":"CA","email":"dmacshirriea8@rambler.ru"}, -{"id":370,"firstName":"Sydel","lastName":"Deerr","street":"1 Commercial Road","postalCode":"30356","city":"Atlanta","state":"GA","phoneNumber":"404-209-0194","email":"sdeerra9@phpbb.com"}, -{"id":371,"firstName":"Mel","lastName":"Miles","street":"28164 Melody Plaza","postalCode":"90847","city":"Long Beach","state":"CA","phoneNumber":"562-932-1172"}, -{"id":372,"firstName":"Jone","lastName":"Drinkel","street":"946 Reindahl Point","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-547-0653"}, -{"id":373,"firstName":"Marcellus","lastName":"MacGilmartin","street":"10568 Westerfield Way","postalCode":"32868","city":"Orlando","state":"FL","phoneNumber":"407-874-6188","email":"mmacgilmartinac@fotki.com"}, -{"id":374,"firstName":"Bret","lastName":"Hardan","street":"9 Hayes Crossing","postalCode":"32309","city":"Tallahassee","state":"FL","email":"bhardanad@mit.edu"}, -{"id":375,"firstName":"Heddie","lastName":"Cesaric","street":"502 Cody Crossing","postalCode":"95397","city":"Modesto","state":"CA"}, -{"id":376,"firstName":"Tansy","lastName":"Maeer","street":"526 Messerschmidt Court","postalCode":"94089","city":"Sunnyvale","state":"CA","email":"tmaeeraf@arizona.edu"}, -{"id":377,"firstName":"Waverly","lastName":"West-Frimley","street":"02 Quincy Trail","postalCode":"20575","city":"Washington","state":"DC","phoneNumber":"202-493-3304","email":"wwestfrimleyag@ft.com"}, -{"id":378,"firstName":"Dido","lastName":"de Clercq","street":"7 Norway Maple Center","postalCode":"84125","city":"Salt Lake City","state":"UT","email":"ddeclercqah@trellian.com"}, -{"id":379,"firstName":"Vic","lastName":"Samuels","street":"2 Kipling Drive","postalCode":"31190","city":"Atlanta","state":"GA","email":"vsamuelsai@goo.gl"}, -{"id":380,"firstName":"Jeno","lastName":"Freiburger","street":"431 Golden Leaf Parkway","postalCode":"32610","city":"Gainesville","state":"FL","email":"jfreiburgeraj@theguardian.com"}, -{"id":381,"firstName":"Christine","lastName":"Basketter","street":"4 Lotheville Terrace","postalCode":"39305","city":"Meridian","state":"MS","phoneNumber":"601-702-1546"}, -{"id":382,"firstName":"Karry","lastName":"Corsan","street":"09189 Lakeland Point","postalCode":"27409","city":"Greensboro","state":"NC","phoneNumber":"336-445-0006","email":"kcorsanal@usgs.gov"}, -{"id":383,"firstName":"Barri","lastName":"Brinsden","street":"53 Shelley Drive","postalCode":"35225","city":"Birmingham","state":"AL","email":"bbrinsdenam@1und1.de"}, -{"id":384,"firstName":"Hyacintha","lastName":"Boddam","street":"45 Sugar Circle","postalCode":"10160","city":"New York City","state":"NY","phoneNumber":"212-794-6062"}, -{"id":385,"firstName":"Brande","lastName":"Remnant","street":"283 Stone Corner Road","postalCode":"31904","city":"Columbus","state":"GA","phoneNumber":"706-211-4851","email":"bremnantao@people.com.cn"}, -{"id":386,"firstName":"Tally","lastName":"Bygraves","street":"54833 Northport Pass","postalCode":"85072","city":"Phoenix","state":"AZ","email":"tbygravesap@jigsy.com"}, -{"id":387,"firstName":"Garfield","lastName":"Pressnell","street":"63077 Hudson Court","postalCode":"30061","city":"Marietta","state":"GA","email":"gpressnellaq@archive.org"}, -{"id":388,"firstName":"Romonda","lastName":"Stiggles","street":"17 Russell Parkway","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-600-9676"}, -{"id":389,"firstName":"Dedie","lastName":"Ralling","street":"8 Judy Plaza","postalCode":"94137","city":"San Francisco","state":"CA","email":"drallingas@wikia.com"}, -{"id":390,"firstName":"Maddi","lastName":"Cornau","street":"5 Oriole Way","postalCode":"92105","city":"San Diego","state":"CA","phoneNumber":"619-388-6359","email":"mcornauat@adobe.com"}, -{"id":391,"firstName":"Zeke","lastName":"Jennery","street":"65332 Sommers Avenue","postalCode":"48206","city":"Detroit","state":"MI","email":"zjenneryau@elegantthemes.com"}, -{"id":392,"firstName":"Danya","lastName":"Fairlaw","street":"343 Logan Alley","postalCode":"33111","city":"Miami","state":"FL","email":"dfairlawav@irs.gov"}, -{"id":393,"firstName":"Rabi","lastName":"Petheridge","street":"7 Monica Alley","postalCode":"64054","city":"Independence","state":"MO","phoneNumber":"816-501-9452"}, -{"id":394,"firstName":"Ebba","lastName":"Skellen","street":"2655 Iowa Terrace","postalCode":"63150","city":"Saint Louis","state":"MO","phoneNumber":"314-695-7831","email":"eskellenax@nbcnews.com"}, -{"id":395,"firstName":"Marie-ann","lastName":"Glaysher","street":"4 Lakewood Hill","postalCode":"12247","city":"Albany","state":"NY","phoneNumber":"518-634-2425"}, -{"id":396,"firstName":"Arne","lastName":"Quincey","street":"162 Redwing Way","postalCode":"83711","city":"Boise","state":"ID"}, -{"id":397,"firstName":"Clarita","lastName":"Okroy","street":"05 Delaware Way","postalCode":"45218","city":"Cincinnati","state":"OH","email":"cokroyb0@stumbleupon.com"}, -{"id":398,"firstName":"Renault","lastName":"Weighell","street":"498 Dovetail Place","postalCode":"79710","city":"Midland","state":"TX","phoneNumber":"432-955-1408"}, -{"id":399,"firstName":"Roderich","lastName":"Mankor","street":"07 Dayton Way","postalCode":"92160","city":"San Diego","state":"CA"}, -{"id":400,"firstName":"Arv","lastName":"Sunnex","street":"89 Ronald Regan Terrace","postalCode":"91109","city":"Pasadena","state":"CA","email":"asunnexb3@vkontakte.ru"}, -{"id":401,"firstName":"Sonia","lastName":"Cowperthwaite","street":"77 Dennis Point","postalCode":"16550","city":"Erie","state":"PA"}, -{"id":402,"firstName":"Buddie","lastName":"Goscomb","street":"85675 Eastlawn Pass","postalCode":"20535","city":"Washington","state":"DC"}, -{"id":403,"firstName":"Brandi","lastName":"Swaine","street":"39961 Del Mar Lane","postalCode":"39705","city":"Columbus","state":"MS","phoneNumber":"662-306-2164","email":"bswaineb6@miibeian.gov.cn"}, -{"id":404,"firstName":"Jenny","lastName":"Cabbell","street":"743 Fordem Center","postalCode":"78285","city":"San Antonio","state":"TX","phoneNumber":"210-491-9874","email":"jcabbellb7@techcrunch.com"}, -{"id":405,"firstName":"Vincent","lastName":"People","street":"83 Tennessee Way","postalCode":"77293","city":"Houston","state":"TX","phoneNumber":"281-261-1928","email":"vpeopleb8@github.io"}, -{"id":406,"firstName":"Reinald","lastName":"Roles","street":"2 Division Road","postalCode":"53785","city":"Madison","state":"WI","phoneNumber":"608-568-7958","email":"rrolesb9@google.fr"}, -{"id":407,"firstName":"Kale","lastName":"Wanek","street":"7 Crescent Oaks Terrace","postalCode":"46852","city":"Fort Wayne","state":"IN","phoneNumber":"260-844-9669","email":"kwanekba@scribd.com"}, -{"id":408,"firstName":"Charisse","lastName":"Perse","street":"94449 Gateway Street","postalCode":"91117","city":"Pasadena","state":"CA","email":"cpersebb@ycombinator.com"}, -{"id":409,"firstName":"Konstantin","lastName":"Aslum","street":"08 Kings Trail","postalCode":"80328","city":"Boulder","state":"CO","email":"kaslumbc@opera.com"}, -{"id":410,"firstName":"Tyson","lastName":"O'Hartigan","street":"75122 Crowley Place","postalCode":"95173","city":"San Jose","state":"CA","phoneNumber":"408-879-0901","email":"tohartiganbd@devhub.com"}, -{"id":411,"firstName":"Fallon","lastName":"Haysman","street":"477 High Crossing Place","postalCode":"23293","city":"Richmond","state":"VA"}, -{"id":412,"firstName":"Svend","lastName":"Scarlet","street":"2856 Merrick Circle","postalCode":"90087","city":"Los Angeles","state":"CA","email":"sscarletbf@clickbank.net"}, -{"id":413,"firstName":"Gabey","lastName":"Colter","street":"7 2nd Alley","postalCode":"90610","city":"Whittier","state":"CA"}, -{"id":414,"firstName":"Hart","lastName":"Densell","street":"2687 Elka Alley","postalCode":"99599","city":"Anchorage","state":"AK","phoneNumber":"907-286-6079"}, -{"id":415,"firstName":"Claresta","lastName":"Folger","street":"5 Amoth Alley","postalCode":"27116","city":"Winston Salem","state":"NC"}, -{"id":416,"firstName":"Rica","lastName":"Lightowlers","street":"54303 Mayer Drive","postalCode":"61825","city":"Champaign","state":"IL","email":"rlightowlersbj@so-net.ne.jp"}, -{"id":417,"firstName":"Paula","lastName":"Treadaway","street":"8 Anniversary Road","postalCode":"20456","city":"Washington","state":"DC"}, -{"id":418,"firstName":"Francoise","lastName":"Gooderick","street":"13 Knutson Lane","postalCode":"33325","city":"Fort Lauderdale","state":"FL","email":"fgooderickbl@dedecms.com"}, -{"id":419,"firstName":"Ferdy","lastName":"Nannizzi","street":"578 Esker Trail","postalCode":"25321","city":"Charleston","state":"WV","email":"fnannizzibm@rambler.ru"}, -{"id":420,"firstName":"Dody","lastName":"Gettone","street":"9 Veith Court","postalCode":"62711","city":"Springfield","state":"IL"}, -{"id":421,"firstName":"Ronna","lastName":"Godleman","street":"6 Jenna Trail","postalCode":"22301","city":"Alexandria","state":"VA","email":"rgodlemanbo@hexun.com"}, -{"id":422,"firstName":"Adey","lastName":"Waith","street":"2 Mayer Avenue","postalCode":"12325","city":"Schenectady","state":"NY"}, -{"id":423,"firstName":"Stanislaw","lastName":"Garahan","street":"660 Merry Avenue","postalCode":"62723","city":"Springfield","state":"IL","phoneNumber":"217-587-6734"}, -{"id":424,"firstName":"Westley","lastName":"Knowles","street":"67430 Lakeland Circle","postalCode":"53263","city":"Milwaukee","state":"WI","email":"wknowlesbr@msu.edu"}, -{"id":425,"firstName":"Dion","lastName":"Jamson","street":"696 Birchwood Circle","postalCode":"80015","city":"Aurora","state":"CO","phoneNumber":"720-486-4494"}, -{"id":426,"firstName":"Glynis","lastName":"Bourhill","street":"091 Harper Park","postalCode":"40250","city":"Louisville","state":"KY"}, -{"id":427,"firstName":"Massimo","lastName":"Briand","street":"37 Northview Junction","postalCode":"75507","city":"Texarkana","state":"TX","email":"mbriandbu@etsy.com"}, -{"id":428,"firstName":"Tremayne","lastName":"Cadore","street":"6721 Anthes Point","postalCode":"94605","city":"Oakland","state":"CA","email":"tcadorebv@mozilla.com"}, -{"id":429,"firstName":"Lea","lastName":"Wildman","street":"52 Dixon Point","postalCode":"50310","city":"Des Moines","state":"IA","phoneNumber":"515-536-2096"}, -{"id":430,"firstName":"Ambur","lastName":"Oxlade","street":"356 Porter Center","postalCode":"44485","city":"Warren","state":"OH"}, -{"id":431,"firstName":"Jyoti","lastName":"Gillet","street":"13 Del Mar Parkway","postalCode":"81505","city":"Grand Junction","state":"CO","phoneNumber":"970-598-0357"}, -{"id":432,"firstName":"Sascha","lastName":"Stanyan","street":"77289 Blue Bill Park Alley","postalCode":"06120","city":"Hartford","state":"CT","email":"sstanyanbz@geocities.jp"}, -{"id":433,"firstName":"Spenser","lastName":"Harry","street":"2021 Oak Place","postalCode":"32835","city":"Orlando","state":"FL","email":"sharryc0@privacy.gov.au"}, -{"id":434,"firstName":"Clim","lastName":"Penrose","street":"8 Warrior Road","postalCode":"15255","city":"Pittsburgh","state":"PA","email":"cpenrosec1@blogtalkradio.com"}, -{"id":435,"firstName":"Jewell","lastName":"McKinnon","street":"4 Delladonna Street","postalCode":"36114","city":"Montgomery","state":"AL","email":"jmckinnonc2@tinypic.com"}, -{"id":436,"firstName":"Estrellita","lastName":"Amburgy","street":"5538 Tennessee Plaza","postalCode":"17121","city":"Harrisburg","state":"PA","phoneNumber":"717-274-8930","email":"eamburgyc3@forbes.com"}, -{"id":437,"firstName":"Sarah","lastName":"Fears","street":"61 Springs Park","postalCode":"93034","city":"Oxnard","state":"CA","email":"sfearsc4@wisc.edu"}, -{"id":438,"firstName":"Nixie","lastName":"Peddie","street":"7 Armistice Way","postalCode":"10155","city":"New York City","state":"NY","email":"npeddiec5@free.fr"}, -{"id":439,"firstName":"Ardisj","lastName":"Rohmer","street":"726 Crowley Point","postalCode":"93399","city":"Bakersfield","state":"CA","email":"arohmerc6@google.nl"}, -{"id":440,"firstName":"Wallie","lastName":"Johanssen","street":"9555 Jana Park","postalCode":"28410","city":"Wilmington","state":"NC","phoneNumber":"910-160-4520","email":"wjohanssenc7@boston.com"}, -{"id":441,"firstName":"Allan","lastName":"Jodlkowski","street":"31585 Kedzie Park","postalCode":"89150","city":"Las Vegas","state":"NV","phoneNumber":"702-782-3289","email":"ajodlkowskic8@sogou.com"}, -{"id":442,"firstName":"Harris","lastName":"Cadden","street":"96829 Fieldstone Park","postalCode":"16565","city":"Erie","state":"PA","phoneNumber":"814-745-1099"}, -{"id":443,"firstName":"Nigel","lastName":"Girardengo","street":"24703 Red Cloud Road","postalCode":"90310","city":"Inglewood","state":"CA","email":"ngirardengoca@ow.ly"}, -{"id":444,"firstName":"Aila","lastName":"Tinniswood","street":"62812 Stephen Parkway","postalCode":"13205","city":"Syracuse","state":"NY","phoneNumber":"315-847-2259","email":"atinniswoodcb@google.com.br"}, -{"id":445,"firstName":"Genni","lastName":"Geockle","street":"81 Bobwhite Plaza","postalCode":"93721","city":"Fresno","state":"CA","email":"ggeocklecc@furl.net"}, -{"id":446,"firstName":"Madison","lastName":"Brikner","street":"166 Coolidge Trail","postalCode":"07208","city":"Elizabeth","state":"NJ","email":"mbriknercd@myspace.com"}, -{"id":447,"firstName":"Akim","lastName":"Gotthard.sf","street":"0017 Heffernan Parkway","postalCode":"71914","city":"Hot Springs National Park","state":"AR","email":"agotthardsfce@google.com.au"}, -{"id":448,"firstName":"Andria","lastName":"Cardello","street":"1089 Stang Road","postalCode":"96835","city":"Honolulu","state":"HI","phoneNumber":"808-372-6528"}, -{"id":449,"firstName":"Laureen","lastName":"Crawshaw","street":"13 Manitowish Avenue","postalCode":"23504","city":"Norfolk","state":"VA","phoneNumber":"757-220-4043"}, -{"id":450,"firstName":"Henderson","lastName":"Parmley","street":"3408 Superior Street","postalCode":"28410","city":"Wilmington","state":"NC","email":"hparmleych@diigo.com"}, -{"id":451,"firstName":"Henri","lastName":"Arnley","street":"54 Knutson Park","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"718-365-7389"}, -{"id":452,"firstName":"Phil","lastName":"Trunkfield","street":"07 Arizona Way","postalCode":"85030","city":"Phoenix","state":"AZ","email":"ptrunkfieldcj@cisco.com"}, -{"id":453,"firstName":"Chery","lastName":"Nangle","street":"03 Merrick Way","postalCode":"88569","city":"El Paso","state":"TX","phoneNumber":"915-959-5535","email":"cnangleck@tumblr.com"}, -{"id":454,"firstName":"Leora","lastName":"Fields","street":"0260 Eastlawn Lane","postalCode":"85311","city":"Glendale","state":"AZ","email":"lfieldscl@nyu.edu"}, -{"id":455,"firstName":"Ronnica","lastName":"Pocknoll","street":"786 Hovde Plaza","postalCode":"78410","city":"Corpus Christi","state":"TX","email":"rpocknollcm@unesco.org"}, -{"id":456,"firstName":"Valida","lastName":"Romayn","street":"1108 Hudson Drive","postalCode":"34615","city":"Clearwater","state":"FL","email":"vromayncn@usatoday.com"}, -{"id":457,"firstName":"Randee","lastName":"Strowther","street":"441 Cordelia Point","postalCode":"27710","city":"Durham","state":"NC","phoneNumber":"919-463-1516","email":"rstrowtherco@trellian.com"}, -{"id":458,"firstName":"Ansell","lastName":"Blacklock","street":"9393 Kedzie Point","postalCode":"75358","city":"Dallas","state":"TX","phoneNumber":"214-949-3912"}, -{"id":459,"firstName":"Bailie","lastName":"Wing","street":"79459 Buhler Way","postalCode":"15279","city":"Pittsburgh","state":"PA","phoneNumber":"412-431-5446"}, -{"id":460,"firstName":"Leesa","lastName":"Wellbeloved","street":"4553 Dakota Circle","postalCode":"40215","city":"Louisville","state":"KY","phoneNumber":"502-145-8496","email":"lwellbelovedcr@go.com"}, -{"id":461,"firstName":"Sarge","lastName":"Tocknell","street":"9884 North Alley","postalCode":"80249","city":"Denver","state":"CO","phoneNumber":"303-603-8315","email":"stocknellcs@artisteer.com"}, -{"id":462,"firstName":"Loralyn","lastName":"Grimolbie","street":"3620 Clyde Gallagher Junction","postalCode":"91103","city":"Pasadena","state":"CA","email":"lgrimolbiect@purevolume.com"}, -{"id":463,"firstName":"Ki","lastName":"Youdell","street":"3 Gina Center","postalCode":"81005","city":"Pueblo","state":"CO"}, -{"id":464,"firstName":"Katerine","lastName":"Herreros","street":"70 Westend Place","postalCode":"57105","city":"Sioux Falls","state":"SD"}, -{"id":465,"firstName":"Frasquito","lastName":"Nockolds","street":"21 Dwight Park","postalCode":"11236","city":"Brooklyn","state":"NY","phoneNumber":"917-761-0549"}, -{"id":466,"firstName":"Krystalle","lastName":"Brierly","street":"7797 Forest Dale Lane","postalCode":"90410","city":"Santa Monica","state":"CA","email":"kbrierlycx@simplemachines.org"}, -{"id":467,"firstName":"Tobin","lastName":"Guillford","street":"501 Messerschmidt Alley","postalCode":"98195","city":"Seattle","state":"WA","phoneNumber":"206-862-7413","email":"tguillfordcy@fastcompany.com"}, -{"id":468,"firstName":"Lorita","lastName":"Sikorski","street":"83 Corscot Junction","postalCode":"44905","city":"Mansfield","state":"OH","phoneNumber":"419-278-2324","email":"lsikorskicz@intel.com"}, -{"id":469,"firstName":"Hermon","lastName":"Chomley","street":"696 Talisman Lane","postalCode":"35290","city":"Birmingham","state":"AL"}, -{"id":470,"firstName":"Karolina","lastName":"Andrault","street":"49738 Maple Wood Place","postalCode":"99709","city":"Fairbanks","state":"AK","phoneNumber":"907-337-1698","email":"kandraultd1@bloglines.com"}, -{"id":471,"firstName":"Lev","lastName":"Pankhurst.","street":"442 Pennsylvania Crossing","postalCode":"23605","city":"Newport News","state":"VA","phoneNumber":"757-832-3631"}, -{"id":472,"firstName":"Bianca","lastName":"Garfath","street":"7 Forest Run Center","postalCode":"71914","city":"Hot Springs National Park","state":"AR","email":"bgarfathd3@youku.com"}, -{"id":473,"firstName":"Walden","lastName":"Van der Linde","street":"6 Namekagon Parkway","postalCode":"70187","city":"New Orleans","state":"LA","email":"wvanderlinded4@netscape.com"}, -{"id":474,"firstName":"Alexandra","lastName":"Vasyukhin","street":"471 School Alley","postalCode":"80910","city":"Colorado Springs","state":"CO","email":"avasyukhind5@samsung.com"}, -{"id":475,"firstName":"Perry","lastName":"Spere","street":"33 Autumn Leaf Street","postalCode":"79994","city":"El Paso","state":"TX","email":"pspered6@tamu.edu"}, -{"id":476,"firstName":"Cristobal","lastName":"Afonso","street":"5 Lake View Way","postalCode":"19136","city":"Philadelphia","state":"PA","email":"cafonsod7@themeforest.net"}, -{"id":477,"firstName":"Sebastien","lastName":"Annets","street":"4229 Bowman Trail","postalCode":"43699","city":"Toledo","state":"OH","phoneNumber":"419-981-8630","email":"sannetsd8@guardian.co.uk"}, -{"id":478,"firstName":"Prentice","lastName":"Desorts","street":"54 Mendota Drive","postalCode":"31196","city":"Atlanta","state":"GA","phoneNumber":"404-235-6736","email":"pdesortsd9@who.int"}, -{"id":479,"firstName":"Rubin","lastName":"Dunkerk","street":"035 Myrtle Park","postalCode":"94297","city":"Sacramento","state":"CA","phoneNumber":"916-658-2157","email":"rdunkerkda@columbia.edu"}, -{"id":480,"firstName":"Jesselyn","lastName":"Bidnall","street":"2353 Norway Maple Court","postalCode":"07522","city":"Paterson","state":"NJ","email":"jbidnalldb@4shared.com"}, -{"id":481,"firstName":"Arleta","lastName":"Massy","street":"2 Bluejay Lane","postalCode":"10310","city":"Staten Island","state":"NY"}, -{"id":482,"firstName":"Trescha","lastName":"Joncic","street":"052 Summit Way","postalCode":"13217","city":"Syracuse","state":"NY"}, -{"id":483,"firstName":"Joshuah","lastName":"Galbreth","street":"16 Elka Place","postalCode":"08922","city":"New Brunswick","state":"NJ","email":"jgalbrethde@rambler.ru"}, -{"id":484,"firstName":"Clywd","lastName":"Henlon","street":"26 Thackeray Pass","postalCode":"90040","city":"Los Angeles","state":"CA","email":"chenlondf@unesco.org"}, -{"id":485,"firstName":"Glenda","lastName":"Grayley","street":"6326 Ohio Plaza","postalCode":"91411","city":"Van Nuys","state":"CA"}, -{"id":486,"firstName":"Glynda","lastName":"Stokell","street":"6 Schmedeman Court","postalCode":"60641","city":"Chicago","state":"IL","email":"gstokelldh@ted.com"}, -{"id":487,"firstName":"Kath","lastName":"Harrap","street":"43769 Barby Plaza","postalCode":"32304","city":"Tallahassee","state":"FL","email":"kharrapdi@cargocollective.com"}, -{"id":488,"firstName":"Dickie","lastName":"Domotor","street":"2954 Toban Lane","postalCode":"98133","city":"Seattle","state":"WA","email":"ddomotordj@hhs.gov"}, -{"id":489,"firstName":"Ceciley","lastName":"Hitzke","street":"9102 Westport Pass","postalCode":"40618","city":"Frankfort","state":"KY","phoneNumber":"502-545-5506","email":"chitzkedk@newsvine.com"}, -{"id":490,"firstName":"Adler","lastName":"Webb-Bowen","street":"5 Hanover Street","postalCode":"32123","city":"Daytona Beach","state":"FL"}, -{"id":491,"firstName":"Fergus","lastName":"Domerq","street":"06 Hansons Road","postalCode":"58106","city":"Fargo","state":"ND","phoneNumber":"701-656-3778"}, -{"id":492,"firstName":"Kimbra","lastName":"Petherick","street":"867 Mayer Drive","postalCode":"39236","city":"Jackson","state":"MS"}, -{"id":493,"firstName":"Geneva","lastName":"Hobgen","street":"74 Vernon Parkway","postalCode":"53710","city":"Madison","state":"WI","email":"ghobgendo@google.de"}, -{"id":494,"firstName":"Jillane","lastName":"Skitral","street":"9747 Ruskin Point","postalCode":"22405","city":"Fredericksburg","state":"VA","email":"jskitraldp@mysql.com"}, -{"id":495,"firstName":"Carolin","lastName":"Pimblotte","street":"8 Union Way","postalCode":"75358","city":"Dallas","state":"TX","phoneNumber":"214-109-7114","email":"cpimblottedq@cargocollective.com"}, -{"id":496,"firstName":"Wandis","lastName":"Andreasson","street":"3 Nancy Parkway","postalCode":"70033","city":"Metairie","state":"LA","email":"wandreassondr@topsy.com"}, -{"id":497,"firstName":"Baily","lastName":"Dalliston","street":"602 Melrose Way","postalCode":"25331","city":"Charleston","state":"WV","email":"bdallistonds@storify.com"}, -{"id":498,"firstName":"Kissie","lastName":"Lammiman","street":"4 Memorial Terrace","postalCode":"06510","city":"New Haven","state":"CT","phoneNumber":"203-724-3731","email":"klammimandt@barnesandnoble.com"}, -{"id":499,"firstName":"Cloris","lastName":"Dorning","street":"4 Lien Road","postalCode":"37235","city":"Nashville","state":"TN","email":"cdorningdu@unesco.org"}, -{"id":500,"firstName":"Jemimah","lastName":"Juppe","street":"979 Tennessee Pass","postalCode":"85305","city":"Glendale","state":"AZ"}, -{"id":501,"firstName":"Fanchette","lastName":"Marlor","street":"90 Waywood Circle","postalCode":"44511","city":"Youngstown","state":"OH","email":"fmarlordw@is.gd"}, -{"id":502,"firstName":"Carmelle","lastName":"Stillmann","street":"9124 Sachtjen Way","postalCode":"74184","city":"Tulsa","state":"OK","email":"cstillmanndx@telegraph.co.uk"}, -{"id":503,"firstName":"Joelle","lastName":"Mumford","street":"5 Susan Point","postalCode":"28410","city":"Wilmington","state":"NC","email":"jmumforddy@yellowbook.com"}, -{"id":504,"firstName":"Vicky","lastName":"Danzelman","street":"472 Pond Junction","postalCode":"11220","city":"Brooklyn","state":"NY","email":"vdanzelmandz@stumbleupon.com"}, -{"id":505,"firstName":"Baudoin","lastName":"Grenshiels","street":"4703 Tony Circle","postalCode":"76198","city":"Fort Worth","state":"TX","email":"bgrenshielse0@devhub.com"}, -{"id":506,"firstName":"Rosetta","lastName":"Wennington","street":"3 Kensington Crossing","postalCode":"14619","city":"Rochester","state":"NY"}, -{"id":507,"firstName":"Eudora","lastName":"Murtell","street":"97 Mockingbird Circle","postalCode":"92867","city":"Orange","state":"CA","phoneNumber":"949-899-3967"}, -{"id":508,"firstName":"Sonnie","lastName":"Hawkin","street":"76669 Green Ridge Crossing","postalCode":"79491","city":"Lubbock","state":"TX","email":"shawkine3@wikia.com"}, -{"id":509,"firstName":"Ulysses","lastName":"Uman","street":"4 Fieldstone Circle","postalCode":"32128","city":"Daytona Beach","state":"FL","phoneNumber":"386-761-6071","email":"uumane4@multiply.com"}, -{"id":510,"firstName":"Alidia","lastName":"Kowalski","street":"3915 Harper Plaza","postalCode":"75221","city":"Dallas","state":"TX","email":"akowalskie5@simplemachines.org"}, -{"id":511,"firstName":"Willis","lastName":"Jeaneau","street":"8 Northport Center","postalCode":"37939","city":"Knoxville","state":"TN","phoneNumber":"865-336-2729","email":"wjeaneaue6@furl.net"}, -{"id":512,"firstName":"Clement","lastName":"Taudevin","street":"25062 Amoth Pass","postalCode":"31914","city":"Columbus","state":"GA","email":"ctaudevine7@mapquest.com"}, -{"id":513,"firstName":"Tally","lastName":"Arnatt","street":"5745 Nancy Terrace","postalCode":"95054","city":"Santa Clara","state":"CA","email":"tarnatte8@umich.edu"}, -{"id":514,"firstName":"Eldon","lastName":"Munnings","street":"17 Dayton Parkway","postalCode":"27690","city":"Raleigh","state":"NC","email":"emunningse9@gmpg.org"}, -{"id":515,"firstName":"Duffie","lastName":"Sibary","street":"840 Springview Avenue","postalCode":"48275","city":"Detroit","state":"MI","email":"dsibaryea@livejournal.com"}, -{"id":516,"firstName":"Winny","lastName":"Dobell","street":"0426 Lindbergh Street","postalCode":"81015","city":"Pueblo","state":"CO","phoneNumber":"719-882-3553","email":"wdobelleb@bizjournals.com"}, -{"id":517,"firstName":"Pancho","lastName":"Pointon","street":"79 Clyde Gallagher Park","postalCode":"97306","city":"Salem","state":"OR","phoneNumber":"503-151-2205"}, -{"id":518,"firstName":"Elston","lastName":"Warwicker","street":"96 Schmedeman Park","postalCode":"44705","city":"Canton","state":"OH","email":"ewarwickered@arstechnica.com"}, -{"id":519,"firstName":"Nicolle","lastName":"Shellcross","street":"23982 Cambridge Parkway","postalCode":"80940","city":"Colorado Springs","state":"CO","email":"nshellcrossee@hibu.com"}, -{"id":520,"firstName":"Bethanne","lastName":"Briggdale","street":"026 Portage Circle","postalCode":"43215","city":"Columbus","state":"OH","phoneNumber":"513-925-3139","email":"bbriggdaleef@flickr.com"}, -{"id":521,"firstName":"Elsey","lastName":"McCorry","street":"781 International Parkway","postalCode":"94286","city":"Sacramento","state":"CA","phoneNumber":"916-879-2104","email":"emccorryeg@sakura.ne.jp"}, -{"id":522,"firstName":"Abran","lastName":"Vasyuchov","street":"64 Grim Place","postalCode":"44177","city":"Cleveland","state":"OH"}, -{"id":523,"firstName":"Rhoda","lastName":"Grieveson","street":"50687 Towne Pass","postalCode":"11220","city":"Brooklyn","state":"NY","email":"rgrievesonei@mit.edu"}, -{"id":524,"firstName":"Florette","lastName":"Eke","street":"85057 Anzinger Lane","postalCode":"66225","city":"Shawnee Mission","state":"KS","phoneNumber":"913-299-0032","email":"fekeej@fema.gov"}, -{"id":525,"firstName":"Sheff","lastName":"Baigrie","street":"80366 Lawn Hill","postalCode":"02203","city":"Boston","state":"MA","phoneNumber":"617-556-4978","email":"sbaigrieek@aboutads.info"}, -{"id":526,"firstName":"Clarisse","lastName":"Hubbuck","street":"435 Truax Trail","postalCode":"02458","city":"Newton","state":"MA","phoneNumber":"781-641-2937"}, -{"id":527,"firstName":"Gilberte","lastName":"Yanele","street":"413 Glacier Hill Park","postalCode":"90610","city":"Whittier","state":"CA","phoneNumber":"562-451-1686","email":"gyaneleem@dot.gov"}, -{"id":528,"firstName":"Lefty","lastName":"Dufore","street":"957 Straubel Street","postalCode":"35220","city":"Birmingham","state":"AL","email":"lduforeen@slideshare.net"}, -{"id":529,"firstName":"Saul","lastName":"Shepperd","street":"44805 Sunnyside Place","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-904-7271"}, -{"id":530,"firstName":"Hadrian","lastName":"Cockhill","street":"479 Mayer Way","postalCode":"22119","city":"Merrifield","state":"VA","email":"hcockhillep@xrea.com"}, -{"id":531,"firstName":"Amalia","lastName":"Geare","street":"63075 Glendale Trail","postalCode":"90065","city":"Los Angeles","state":"CA","email":"ageareeq@vistaprint.com"}, -{"id":532,"firstName":"Adan","lastName":"Ibbeson","street":"5 Cambridge Lane","postalCode":"73142","city":"Oklahoma City","state":"OK"}, -{"id":533,"firstName":"Nicol","lastName":"Garbutt","street":"3 8th Street","postalCode":"50393","city":"Des Moines","state":"IA","phoneNumber":"515-946-8077"}, -{"id":534,"firstName":"Lilas","lastName":"Estcot","street":"1927 Mitchell Avenue","postalCode":"75185","city":"Mesquite","state":"TX","email":"lestcotet@ezinearticles.com"}, -{"id":535,"firstName":"Valina","lastName":"Dellenbrok","street":"1 Victoria Hill","postalCode":"45249","city":"Cincinnati","state":"OH","phoneNumber":"513-958-5055","email":"vdellenbrokeu@upenn.edu"}, -{"id":536,"firstName":"Gwen","lastName":"Harwell","street":"64275 Bartelt Terrace","postalCode":"93721","city":"Fresno","state":"CA"}, -{"id":537,"firstName":"Adriena","lastName":"Lochead","street":"0088 Hintze Point","postalCode":"43231","city":"Columbus","state":"OH","phoneNumber":"614-506-5616","email":"alocheadew@paypal.com"}, -{"id":538,"firstName":"Jacobo","lastName":"Jills","street":"809 Anderson Park","postalCode":"55557","city":"Young America","state":"MN","phoneNumber":"952-580-6574","email":"jjillsex@xing.com"}, -{"id":539,"firstName":"Saree","lastName":"Jeanequin","street":"0212 Clyde Gallagher Alley","postalCode":"32891","city":"Orlando","state":"FL","email":"sjeanequiney@who.int"}, -{"id":540,"firstName":"Kin","lastName":"Dewar","street":"3 Emmet Center","postalCode":"20244","city":"Washington","state":"DC","email":"kdewarez@discovery.com"}, -{"id":541,"firstName":"Kaleena","lastName":"Godfray","street":"4350 Eliot Parkway","postalCode":"76134","city":"Fort Worth","state":"TX","phoneNumber":"817-332-6412","email":"kgodfrayf0@webmd.com"}, -{"id":542,"firstName":"Wallace","lastName":"Poytres","street":"78157 Dovetail Crossing","postalCode":"14683","city":"Rochester","state":"NY","email":"wpoytresf1@springer.com"}, -{"id":543,"firstName":"Dur","lastName":"Burgise","street":"2 Weeping Birch Court","postalCode":"89130","city":"Las Vegas","state":"NV"}, -{"id":544,"firstName":"Sheridan","lastName":"Gardiner","street":"26 Gateway Crossing","postalCode":"64193","city":"Kansas City","state":"MO","phoneNumber":"816-647-4434","email":"sgardinerf3@jugem.jp"}, -{"id":545,"firstName":"Nickolaus","lastName":"Thomassen","street":"130 Anderson Drive","postalCode":"33330","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-339-0290"}, -{"id":546,"firstName":"Boris","lastName":"Cortez","street":"55 Center Court","postalCode":"10184","city":"New York City","state":"NY","phoneNumber":"212-549-8414","email":"bcortezf5@mail.ru"}, -{"id":547,"firstName":"Candra","lastName":"Codner","street":"24078 Superior Point","postalCode":"93715","city":"Fresno","state":"CA","phoneNumber":"209-495-8135"}, -{"id":548,"firstName":"Ashton","lastName":"Hugin","street":"33 Fuller Place","postalCode":"63143","city":"Saint Louis","state":"MO"}, -{"id":549,"firstName":"Miguelita","lastName":"Lanceley","street":"34877 Arizona Street","postalCode":"80045","city":"Aurora","state":"CO","email":"mlanceleyf8@trellian.com"}, -{"id":550,"firstName":"Law","lastName":"Skim","street":"1795 Farmco Street","postalCode":"28230","city":"Charlotte","state":"NC","email":"lskimf9@bravesites.com"}, -{"id":551,"firstName":"Carlita","lastName":"Kindall","street":"7 Scofield Road","postalCode":"93709","city":"Fresno","state":"CA","email":"ckindallfa@zimbio.com"}, -{"id":552,"firstName":"Mehetabel","lastName":"Stawell","street":"648 Upham Plaza","postalCode":"75277","city":"Dallas","state":"TX","phoneNumber":"214-597-5958","email":"mstawellfb@ehow.com"}, -{"id":553,"firstName":"Charlena","lastName":"MacAlpyne","street":"2 Village Terrace","postalCode":"33758","city":"Clearwater","state":"FL","phoneNumber":"813-452-9764","email":"cmacalpynefc@xinhuanet.com"}, -{"id":554,"firstName":"Gayel","lastName":"Litel","street":"34782 Birchwood Road","postalCode":"46406","city":"Gary","state":"IN","phoneNumber":"219-156-8377","email":"glitelfd@alibaba.com"}, -{"id":555,"firstName":"Prisca","lastName":"Kanzler","street":"67 Miller Terrace","postalCode":"08619","city":"Trenton","state":"NJ","phoneNumber":"609-352-4487"}, -{"id":556,"firstName":"Marlowe","lastName":"Idenden","street":"396 Beilfuss Park","postalCode":"74103","city":"Tulsa","state":"OK","phoneNumber":"918-254-3102"}, -{"id":557,"firstName":"Ashley","lastName":"Skule","street":"2327 Valley Edge Terrace","postalCode":"93794","city":"Fresno","state":"CA","phoneNumber":"559-558-9123"}, -{"id":558,"firstName":"Trista","lastName":"Naptine","street":"646 Dahle Court","postalCode":"06538","city":"New Haven","state":"CT","phoneNumber":"203-257-3017","email":"tnaptinefh@hugedomains.com"}, -{"id":559,"firstName":"Hasheem","lastName":"Ottery","street":"004 Clemons Street","postalCode":"28815","city":"Asheville","state":"NC","phoneNumber":"828-768-3824","email":"hotteryfi@gmpg.org"}, -{"id":560,"firstName":"Alisa","lastName":"Bernhardt","street":"49 Cody Center","postalCode":"84120","city":"Salt Lake City","state":"UT","phoneNumber":"801-808-4005","email":"abernhardtfj@census.gov"}, -{"id":561,"firstName":"Isadora","lastName":"Hatchett","street":"78644 Hoepker Junction","postalCode":"77015","city":"Houston","state":"TX","email":"ihatchettfk@spiegel.de"}, -{"id":562,"firstName":"Valdemar","lastName":"Stithe","street":"75 East Street","postalCode":"48206","city":"Detroit","state":"MI","email":"vstithefl@marriott.com"}, -{"id":563,"firstName":"Elden","lastName":"Rebert","street":"2 Florence Place","postalCode":"65110","city":"Jefferson City","state":"MO","phoneNumber":"573-753-8030"}, -{"id":564,"firstName":"Stormie","lastName":"Trewartha","street":"59 Shoshone Lane","postalCode":"19136","city":"Philadelphia","state":"PA","phoneNumber":"215-466-6832"}, -{"id":565,"firstName":"Bernhard","lastName":"Boulsher","street":"50888 Dwight Drive","postalCode":"02114","city":"Boston","state":"MA","email":"bboulsherfo@zdnet.com"}, -{"id":566,"firstName":"Twyla","lastName":"Yerrill","street":"526 Clove Terrace","postalCode":"40745","city":"London","state":"KY","email":"tyerrillfp@smugmug.com"}, -{"id":567,"firstName":"Sullivan","lastName":"Dudeney","street":"953 Swallow Crossing","postalCode":"19160","city":"Philadelphia","state":"PA","email":"sdudeneyfq@kickstarter.com"}, -{"id":568,"firstName":"Estell","lastName":"Kiggel","street":"8170 Rusk Alley","postalCode":"20442","city":"Washington","state":"DC","phoneNumber":"202-645-5828","email":"ekiggelfr@imgur.com"}, -{"id":569,"firstName":"Jonis","lastName":"Pymer","street":"21296 International Pass","postalCode":"77844","city":"College Station","state":"TX","email":"jpymerfs@nymag.com"}, -{"id":570,"firstName":"Linea","lastName":"Cranmor","street":"2541 Thackeray Hill","postalCode":"31210","city":"Macon","state":"GA"}, -{"id":571,"firstName":"Starlin","lastName":"Reven","street":"7692 Mifflin Hill","postalCode":"66611","city":"Topeka","state":"KS","email":"srevenfu@nba.com"}, -{"id":572,"firstName":"Augusta","lastName":"Heustice","street":"947 Ramsey Lane","postalCode":"10292","city":"New York City","state":"NY","phoneNumber":"212-194-3346","email":"aheusticefv@cloudflare.com"}, -{"id":573,"firstName":"Glen","lastName":"O'Mailey","street":"90 6th Court","postalCode":"33982","city":"Punta Gorda","state":"FL","phoneNumber":"941-381-2231"}, -{"id":574,"firstName":"Astrix","lastName":"Bister","street":"505 Artisan Crossing","postalCode":"23324","city":"Chesapeake","state":"VA","phoneNumber":"757-469-4444","email":"abisterfx@uol.com.br"}, -{"id":575,"firstName":"Shaw","lastName":"Lidbetter","street":"70 New Castle Trail","postalCode":"10474","city":"Bronx","state":"NY","phoneNumber":"917-917-9173"}, -{"id":576,"firstName":"Yovonnda","lastName":"Wych","street":"97472 Derek Drive","postalCode":"90410","city":"Santa Monica","state":"CA","email":"ywychfz@symantec.com"}, -{"id":577,"firstName":"Harcourt","lastName":"Faier","street":"056 Northridge Street","postalCode":"16510","city":"Erie","state":"PA","email":"hfaierg0@cloudflare.com"}, -{"id":578,"firstName":"Archibold","lastName":"Kos","street":"6 Forster Park","postalCode":"63104","city":"Saint Louis","state":"MO","phoneNumber":"314-967-5566","email":"akosg1@soup.io"}, -{"id":579,"firstName":"Nataniel","lastName":"Beldom","street":"1 Sullivan Street","postalCode":"02453","city":"Waltham","state":"MA","email":"nbeldomg2@alibaba.com"}, -{"id":580,"firstName":"Felisha","lastName":"Bamfield","street":"970 Washington Avenue","postalCode":"12305","city":"Schenectady","state":"NY","email":"fbamfieldg3@jimdo.com"}, -{"id":581,"firstName":"Colly","lastName":"Rugge","street":"8 Golf Course Avenue","postalCode":"55172","city":"Saint Paul","state":"MN","phoneNumber":"651-450-9347","email":"cruggeg4@tmall.com"}, -{"id":582,"firstName":"Patti","lastName":"Maddrell","street":"0483 Coolidge Drive","postalCode":"74193","city":"Tulsa","state":"OK"}, -{"id":583,"firstName":"Antin","lastName":"Gabbetis","street":"93510 Clemons Drive","postalCode":"68583","city":"Lincoln","state":"NE","email":"agabbetisg6@java.com"}, -{"id":584,"firstName":"Bree","lastName":"Million","street":"3 Columbus Avenue","postalCode":"61614","city":"Peoria","state":"IL","phoneNumber":"309-360-1909","email":"bmilliong7@gnu.org"}, -{"id":585,"firstName":"Taber","lastName":"Lorait","street":"4 Melrose Way","postalCode":"62764","city":"Springfield","state":"IL","phoneNumber":"217-436-2021","email":"tloraitg8@cargocollective.com"}, -{"id":586,"firstName":"Roley","lastName":"Di Carlo","street":"981 Bowman Center","postalCode":"87505","city":"Santa Fe","state":"NM"}, -{"id":587,"firstName":"Seline","lastName":"Oxenham","street":"65051 Forest Run Center","postalCode":"94064","city":"Redwood City","state":"CA","email":"soxenhamga@fastcompany.com"}, -{"id":588,"firstName":"Costa","lastName":"Tomblin","street":"7 Arapahoe Alley","postalCode":"33315","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-239-1335"}, -{"id":589,"firstName":"Opalina","lastName":"Cake","street":"88 Commercial Avenue","postalCode":"40215","city":"Louisville","state":"KY","email":"ocakegc@examiner.com"}, -{"id":590,"firstName":"Suzanne","lastName":"Giuroni","street":"73 Twin Pines Terrace","postalCode":"99260","city":"Spokane","state":"WA"}, -{"id":591,"firstName":"Faustine","lastName":"Croysdale","street":"01 Delladonna Point","postalCode":"48295","city":"Detroit","state":"MI"}, -{"id":592,"firstName":"Sheffie","lastName":"Aldine","street":"4 Hansons Junction","postalCode":"74108","city":"Tulsa","state":"OK"}, -{"id":593,"firstName":"Bret","lastName":"Birrane","street":"745 Mayer Junction","postalCode":"77030","city":"Houston","state":"TX","phoneNumber":"832-374-7571","email":"bbirranegg@opera.com"}, -{"id":594,"firstName":"Lennard","lastName":"Mowbury","street":"5 Dwight Road","postalCode":"94522","city":"Concord","state":"CA","email":"lmowburygh@1und1.de"}, -{"id":595,"firstName":"Albie","lastName":"Pert","street":"23705 Fieldstone Plaza","postalCode":"08922","city":"New Brunswick","state":"NJ","phoneNumber":"732-587-7312","email":"apertgi@netlog.com"}, -{"id":596,"firstName":"Stevie","lastName":"Pressnell","street":"0077 Ronald Regan Point","postalCode":"85020","city":"Phoenix","state":"AZ","phoneNumber":"623-991-0482","email":"spressnellgj@skype.com"}, -{"id":597,"firstName":"Eddy","lastName":"McIlreavy","street":"04 Luster Lane","postalCode":"94126","city":"San Francisco","state":"CA"}, -{"id":598,"firstName":"Webb","lastName":"Titterell","street":"94323 Kedzie Alley","postalCode":"91505","city":"Burbank","state":"CA","phoneNumber":"818-220-9105","email":"wtitterellgl@bandcamp.com"}, -{"id":599,"firstName":"Jeffrey","lastName":"Benito","street":"7487 Scott Lane","postalCode":"11470","city":"Jamaica","state":"NY","phoneNumber":"917-379-2592","email":"jbenitogm@deviantart.com"}, -{"id":600,"firstName":"Nollie","lastName":"Arsey","street":"7282 Summerview Plaza","postalCode":"55811","city":"Duluth","state":"MN","email":"narseygn@imageshack.us"}, -{"id":601,"firstName":"Petra","lastName":"Turpey","street":"43920 Evergreen Junction","postalCode":"77255","city":"Houston","state":"TX","phoneNumber":"713-446-0144"}, -{"id":602,"firstName":"Harwilll","lastName":"Lashbrook","street":"8063 Grasskamp Parkway","postalCode":"27621","city":"Raleigh","state":"NC","phoneNumber":"919-142-9887","email":"hlashbrookgp@seattletimes.com"}, -{"id":603,"firstName":"Tedman","lastName":"Steinor","street":"80230 Hanson Hill","postalCode":"47134","city":"Jeffersonville","state":"IN","email":"tsteinorgq@dmoz.org"}, -{"id":604,"firstName":"Georgette","lastName":"Tupper","street":"37 Lillian Avenue","postalCode":"33543","city":"Zephyrhills","state":"FL","phoneNumber":"813-743-2425","email":"gtuppergr@qq.com"}, -{"id":605,"firstName":"Torrance","lastName":"Welsh","street":"95802 Doe Crossing Crossing","postalCode":"13217","city":"Syracuse","state":"NY","phoneNumber":"315-145-4503","email":"twelshgs@imgur.com"}, -{"id":606,"firstName":"Silvie","lastName":"Souster","street":"52827 Fuller Place","postalCode":"99709","city":"Fairbanks","state":"AK"}, -{"id":607,"firstName":"Pauline","lastName":"Dulwitch","street":"8 Aberg Drive","postalCode":"17105","city":"Harrisburg","state":"PA","phoneNumber":"717-228-4960","email":"pdulwitchgu@aboutads.info"}, -{"id":608,"firstName":"Roberta","lastName":"Castanie","street":"182 Mosinee Avenue","postalCode":"75185","city":"Mesquite","state":"TX"}, -{"id":609,"firstName":"Percival","lastName":"Kristoffersen","street":"4 Del Mar Park","postalCode":"48335","city":"Farmington","state":"MI","phoneNumber":"248-438-1650","email":"pkristoffersengw@chron.com"}, -{"id":610,"firstName":"Caryl","lastName":"Boame","street":"094 Springview Avenue","postalCode":"78255","city":"San Antonio","state":"TX","email":"cboamegx@example.com"}, -{"id":611,"firstName":"Steve","lastName":"Simakov","street":"323 Brickson Park Trail","postalCode":"32244","city":"Jacksonville","state":"FL","phoneNumber":"904-468-9377","email":"ssimakovgy@angelfire.com"}, -{"id":612,"firstName":"Carl","lastName":"Tumayan","street":"93854 Clyde Gallagher Circle","postalCode":"98447","city":"Tacoma","state":"WA","email":"ctumayangz@1und1.de"}, -{"id":613,"firstName":"Gayle","lastName":"Blaker","street":"5930 Grasskamp Drive","postalCode":"12262","city":"Albany","state":"NY","email":"gblakerh0@spiegel.de"}, -{"id":614,"firstName":"Darrick","lastName":"Harefoot","street":"359 Waywood Trail","postalCode":"20189","city":"Dulles","state":"VA"}, -{"id":615,"firstName":"Sayer","lastName":"Eversfield","street":"86 Park Meadow Crossing","postalCode":"53263","city":"Milwaukee","state":"WI","email":"seversfieldh2@multiply.com"}, -{"id":616,"firstName":"Loralyn","lastName":"Poyner","street":"28530 Magdeline Crossing","postalCode":"84125","city":"Salt Lake City","state":"UT","phoneNumber":"801-363-2593"}, -{"id":617,"firstName":"Petrina","lastName":"Ridewood","street":"91782 Oriole Parkway","postalCode":"80235","city":"Denver","state":"CO","phoneNumber":"720-131-3660","email":"pridewoodh4@walmart.com"}, -{"id":618,"firstName":"Leroi","lastName":"Marde","street":"7992 Prairieview Junction","postalCode":"02142","city":"Cambridge","state":"MA","phoneNumber":"781-623-9420","email":"lmardeh5@oracle.com"}, -{"id":619,"firstName":"Brannon","lastName":"Janata","street":"79706 Wayridge Alley","postalCode":"24515","city":"Lynchburg","state":"VA","phoneNumber":"434-255-0721"}, -{"id":620,"firstName":"Berry","lastName":"Joska","street":"301 6th Alley","postalCode":"10150","city":"New York City","state":"NY","email":"bjoskah7@360.cn"}, -{"id":621,"firstName":"Blinnie","lastName":"Basten","street":"047 Canary Parkway","postalCode":"30343","city":"Atlanta","state":"GA","phoneNumber":"404-794-2760"}, -{"id":622,"firstName":"Inesita","lastName":"Abbitt","street":"8 Sachtjen Plaza","postalCode":"60681","city":"Chicago","state":"IL"}, -{"id":623,"firstName":"Nickie","lastName":"Ellicombe","street":"1067 Ridge Oak Terrace","postalCode":"38131","city":"Memphis","state":"TN","phoneNumber":"901-695-3826","email":"nellicombeha@imgur.com"}, -{"id":624,"firstName":"Barney","lastName":"Sheeres","street":"1 Rutledge Avenue","postalCode":"29208","city":"Columbia","state":"SC","phoneNumber":"803-166-1398"}, -{"id":625,"firstName":"Ogdan","lastName":"Lelievre","street":"27 Weeping Birch Plaza","postalCode":"27264","city":"High Point","state":"NC","phoneNumber":"336-416-3966","email":"olelievrehc@exblog.jp"}, -{"id":626,"firstName":"Zora","lastName":"Exter","street":"7 Ronald Regan Pass","postalCode":"33673","city":"Tampa","state":"FL"}, -{"id":627,"firstName":"Travus","lastName":"Jaulme","street":"3159 Montana Circle","postalCode":"79176","city":"Amarillo","state":"TX","phoneNumber":"806-894-9411"}, -{"id":628,"firstName":"Krishna","lastName":"Beckingham","street":"58 Fair Oaks Lane","postalCode":"30311","city":"Atlanta","state":"GA","email":"kbeckinghamhf@usnews.com"}, -{"id":629,"firstName":"Bartolomeo","lastName":"Bosanko","street":"753 Victoria Place","postalCode":"79699","city":"Abilene","state":"TX","phoneNumber":"325-223-9615","email":"bbosankohg@merriam-webster.com"}, -{"id":630,"firstName":"Umberto","lastName":"McGinly","street":"30 Upham Parkway","postalCode":"80945","city":"Colorado Springs","state":"CO","email":"umcginlyhh@cdc.gov"}, -{"id":631,"firstName":"Launce","lastName":"Fatkin","street":"03246 Esch Place","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-916-7032","email":"lfatkinhi@blogs.com"}, -{"id":632,"firstName":"Simone","lastName":"Soars","street":"9969 Forest Run Crossing","postalCode":"90101","city":"Los Angeles","state":"CA","phoneNumber":"213-282-8462"}, -{"id":633,"firstName":"Clerissa","lastName":"Leason","street":"59731 Mayfield Street","postalCode":"89510","city":"Reno","state":"NV"}, -{"id":634,"firstName":"Rutter","lastName":"Sultan","street":"697 Spenser Way","postalCode":"77245","city":"Houston","state":"TX"}, -{"id":635,"firstName":"Shannon","lastName":"De Carteret","street":"2 Grover Avenue","postalCode":"92717","city":"Irvine","state":"CA","phoneNumber":"714-410-2360","email":"sdecarterethm@simplemachines.org"}, -{"id":636,"firstName":"Sawyere","lastName":"Cardno","street":"428 Golf Course Drive","postalCode":"33111","city":"Miami","state":"FL"}, -{"id":637,"firstName":"Paulie","lastName":"Bucktharp","street":"5398 Sugar Park","postalCode":"10039","city":"New York City","state":"NY","phoneNumber":"646-197-4123","email":"pbucktharpho@businessweek.com"}, -{"id":638,"firstName":"Kippy","lastName":"Guisler","street":"2161 Claremont Trail","postalCode":"20546","city":"Washington","state":"DC","phoneNumber":"202-138-6171","email":"kguislerhp@ox.ac.uk"}, -{"id":639,"firstName":"Yoshiko","lastName":"Tolson","street":"2 Glendale Court","postalCode":"27415","city":"Greensboro","state":"NC","email":"ytolsonhq@example.com"}, -{"id":640,"firstName":"Page","lastName":"Chillingsworth","street":"8 Loomis Drive","postalCode":"55470","city":"Minneapolis","state":"MN","email":"pchillingsworthhr@wunderground.com"}, -{"id":641,"firstName":"Jillana","lastName":"O'Siaghail","street":"13517 Del Mar Road","postalCode":"29215","city":"Columbia","state":"SC","phoneNumber":"803-420-8597","email":"josiaghailhs@reuters.com"}, -{"id":642,"firstName":"Phedra","lastName":"Bagnold","street":"7059 Hallows Street","postalCode":"55470","city":"Minneapolis","state":"MN","email":"pbagnoldht@howstuffworks.com"}, -{"id":643,"firstName":"Bellina","lastName":"Gouldie","street":"7567 Bultman Way","postalCode":"88514","city":"El Paso","state":"TX","email":"bgouldiehu@salon.com"}, -{"id":644,"firstName":"Devi","lastName":"Bohden","street":"68833 Northview Hill","postalCode":"84115","city":"Salt Lake City","state":"UT"}, -{"id":645,"firstName":"Peggi","lastName":"Gobert","street":"667 Sauthoff Hill","postalCode":"44710","city":"Canton","state":"OH","email":"pgoberthw@mapy.cz"}, -{"id":646,"firstName":"Madelina","lastName":"Gurys","street":"70 Del Sol Trail","postalCode":"20420","city":"Washington","state":"DC","phoneNumber":"202-747-9276","email":"mguryshx@hibu.com"}, -{"id":647,"firstName":"Ikey","lastName":"Aubri","street":"76 Sutteridge Hill","postalCode":"36205","city":"Anniston","state":"AL","phoneNumber":"256-945-5095","email":"iaubrihy@mayoclinic.com"}, -{"id":648,"firstName":"Ginevra","lastName":"Duffitt","street":"25 Eagan Circle","postalCode":"31217","city":"Macon","state":"GA"}, -{"id":649,"firstName":"Cissiee","lastName":"Gozzard","street":"40240 Lillian Park","postalCode":"60609","city":"Chicago","state":"IL","email":"cgozzardi0@columbia.edu"}, -{"id":650,"firstName":"Sonny","lastName":"Jobern","street":"8 Green Trail","postalCode":"77065","city":"Houston","state":"TX","email":"sjoberni1@ucoz.com"}, -{"id":651,"firstName":"Mitch","lastName":"Guidera","street":"0 Dorton Junction","postalCode":"35210","city":"Birmingham","state":"AL","phoneNumber":"205-224-0177"}, -{"id":652,"firstName":"Dorey","lastName":"Marks","street":"81562 Maywood Crossing","postalCode":"71208","city":"Monroe","state":"LA","phoneNumber":"318-492-5487"}, -{"id":653,"firstName":"Pavla","lastName":"Conneely","street":"4007 Mifflin Lane","postalCode":"20456","city":"Washington","state":"DC"}, -{"id":654,"firstName":"Kym","lastName":"Gecks","street":"72638 Namekagon Plaza","postalCode":"61656","city":"Peoria","state":"IL","email":"kgecksi5@nature.com"}, -{"id":655,"firstName":"Prudence","lastName":"Peert","street":"91 Tomscot Parkway","postalCode":"32209","city":"Jacksonville","state":"FL","phoneNumber":"904-277-2945","email":"ppeerti6@usa.gov"}, -{"id":656,"firstName":"Elston","lastName":"Paolo","street":"4 Jenna Crossing","postalCode":"95155","city":"San Jose","state":"CA","email":"epaoloi7@umn.edu"}, -{"id":657,"firstName":"Indira","lastName":"Splaven","street":"8853 Vermont Drive","postalCode":"38188","city":"Memphis","state":"TN","phoneNumber":"901-706-3908","email":"isplaveni8@fda.gov"}, -{"id":658,"firstName":"Paul","lastName":"Mc Meekin","street":"56 Vidon Drive","postalCode":"08695","city":"Trenton","state":"NJ","phoneNumber":"609-361-1580"}, -{"id":659,"firstName":"Hadley","lastName":"Windmill","street":"31384 Evergreen Point","postalCode":"16550","city":"Erie","state":"PA","email":"hwindmillia@yale.edu"}, -{"id":660,"firstName":"Jay","lastName":"Yesichev","street":"675 Starling Pass","postalCode":"89150","city":"Las Vegas","state":"NV"}, -{"id":661,"firstName":"Ranna","lastName":"Dowtry","street":"303 Nevada Pass","postalCode":"48550","city":"Flint","state":"MI","phoneNumber":"810-164-4521","email":"rdowtryic@amazon.co.jp"}, -{"id":662,"firstName":"Annabel","lastName":"Pellamont","street":"277 Merrick Crossing","postalCode":"36605","city":"Mobile","state":"AL","phoneNumber":"251-595-3594","email":"apellamontid@reverbnation.com"}, -{"id":663,"firstName":"Kaitlynn","lastName":"Tracey","street":"612 Magdeline Road","postalCode":"97296","city":"Portland","state":"OR","email":"ktraceyie@ycombinator.com"}, -{"id":664,"firstName":"Matthiew","lastName":"Jills","street":"65 Walton Circle","postalCode":"93750","city":"Fresno","state":"CA","email":"mjillsif@addthis.com"}, -{"id":665,"firstName":"Bartlet","lastName":"Roe","street":"51573 Mandrake Park","postalCode":"02109","city":"Boston","state":"MA","phoneNumber":"617-460-5377","email":"broeig@nasa.gov"}, -{"id":666,"firstName":"Ban","lastName":"Knotton","street":"174 Westridge Parkway","postalCode":"32405","city":"Panama City","state":"FL","phoneNumber":"850-939-6502","email":"bknottonih@businesswire.com"}, -{"id":667,"firstName":"Cordelie","lastName":"O'Dee","street":"1733 Linden Avenue","postalCode":"80940","city":"Colorado Springs","state":"CO","phoneNumber":"719-966-3402","email":"codeeii@amazonaws.com"}, -{"id":668,"firstName":"Hardy","lastName":"Lob","street":"4 Bultman Road","postalCode":"75074","city":"Plano","state":"TX","email":"hlobij@dropbox.com"}, -{"id":669,"firstName":"Rosabelle","lastName":"Tonner","street":"1 Holy Cross Trail","postalCode":"36670","city":"Mobile","state":"AL","phoneNumber":"251-606-9437","email":"rtonnerik@google.ru"}, -{"id":670,"firstName":"Bernardina","lastName":"Mardy","street":"65 Myrtle Center","postalCode":"96845","city":"Honolulu","state":"HI","email":"bmardyil@wordpress.com"}, -{"id":671,"firstName":"Hynda","lastName":"Soldner","street":"88 Hazelcrest Drive","postalCode":"55470","city":"Minneapolis","state":"MN","email":"hsoldnerim@webeden.co.uk"}, -{"id":672,"firstName":"Quinn","lastName":"Templeton","street":"5 Village Way","postalCode":"19131","city":"Philadelphia","state":"PA","email":"qtempletonin@diigo.com"}, -{"id":673,"firstName":"Torrence","lastName":"Askwith","street":"1 Namekagon Point","postalCode":"31410","city":"Savannah","state":"GA","phoneNumber":"912-552-5239","email":"taskwithio@people.com.cn"}, -{"id":674,"firstName":"Bonnie","lastName":"Robilliard","street":"731 Johnson Lane","postalCode":"24515","city":"Lynchburg","state":"VA","phoneNumber":"434-382-5496"}, -{"id":675,"firstName":"Daphna","lastName":"D'Souza","street":"1549 Loftsgordon Center","postalCode":"91406","city":"Van Nuys","state":"CA","phoneNumber":"818-773-9088"}, -{"id":676,"firstName":"Palm","lastName":"Gandrich","street":"9 4th Pass","postalCode":"87121","city":"Albuquerque","state":"NM","phoneNumber":"505-815-5555"}, -{"id":677,"firstName":"Danie","lastName":"Gaydon","street":"382 Bayside Junction","postalCode":"55441","city":"Minneapolis","state":"MN","phoneNumber":"952-744-9400","email":"dgaydonis@seesaa.net"}, -{"id":678,"firstName":"Tabatha","lastName":"Caddock","street":"3858 Mccormick Road","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-996-7653","email":"tcaddockit@gizmodo.com"}, -{"id":679,"firstName":"Sergent","lastName":"Cade","street":"7 Riverside Crossing","postalCode":"13505","city":"Utica","state":"NY","email":"scadeiu@google.co.uk"}, -{"id":680,"firstName":"Shina","lastName":"Dumphry","street":"483 Del Mar Terrace","postalCode":"73109","city":"Oklahoma City","state":"OK","phoneNumber":"405-261-3364","email":"sdumphryiv@mediafire.com"}, -{"id":681,"firstName":"Aaron","lastName":"O'Neal","street":"669 Crowley Road","postalCode":"87140","city":"Albuquerque","state":"NM","phoneNumber":"505-451-6591","email":"aonealiw@npr.org"}, -{"id":682,"firstName":"Cynthea","lastName":"Wippermann","street":"109 Kinsman Parkway","postalCode":"06606","city":"Bridgeport","state":"CT","phoneNumber":"203-799-4552"}, -{"id":683,"firstName":"Stoddard","lastName":"Hullett","street":"06200 Mesta Park","postalCode":"78769","city":"Austin","state":"TX","phoneNumber":"512-190-7003"}, -{"id":684,"firstName":"Margit","lastName":"Comusso","street":"54 Springs Center","postalCode":"33737","city":"Saint Petersburg","state":"FL","phoneNumber":"727-144-3743","email":"mcomussoiz@drupal.org"}, -{"id":685,"firstName":"Dur","lastName":"Manns","street":"464 Park Meadow Road","postalCode":"90015","city":"Los Angeles","state":"CA","email":"dmannsj0@nymag.com"}, -{"id":686,"firstName":"Hollie","lastName":"Aldersey","street":"12195 Mallory Court","postalCode":"21405","city":"Annapolis","state":"MD","email":"halderseyj1@businessinsider.com"}, -{"id":687,"firstName":"Ralina","lastName":"Crepin","street":"13313 Clyde Gallagher Way","postalCode":"78285","city":"San Antonio","state":"TX"}, -{"id":688,"firstName":"Lyell","lastName":"Graveston","street":"20 Talisman Crossing","postalCode":"27157","city":"Winston Salem","state":"NC","phoneNumber":"336-638-3366","email":"lgravestonj3@webmd.com"}, -{"id":689,"firstName":"Anny","lastName":"Potell","street":"0 Ludington Circle","postalCode":"32803","city":"Orlando","state":"FL","email":"apotellj4@microsoft.com"}, -{"id":690,"firstName":"Harriot","lastName":"Klimpke","street":"8 Southridge Alley","postalCode":"22047","city":"Falls Church","state":"VA","phoneNumber":"571-470-2688","email":"hklimpkej5@slashdot.org"}, -{"id":691,"firstName":"Stacia","lastName":"Stainsby","street":"78 Mcbride Avenue","postalCode":"46862","city":"Fort Wayne","state":"IN"}, -{"id":692,"firstName":"Zacharia","lastName":"Willmont","street":"24 Everett Center","postalCode":"73135","city":"Oklahoma City","state":"OK","phoneNumber":"405-167-0584","email":"zwillmontj7@tuttocitta.it"}, -{"id":693,"firstName":"Dorelia","lastName":"Flexman","street":"0 Hauk Crossing","postalCode":"95298","city":"Stockton","state":"CA","phoneNumber":"209-759-3308"}, -{"id":694,"firstName":"Rubi","lastName":"Karran","street":"586 Eggendart Pass","postalCode":"64082","city":"Lees Summit","state":"MO","email":"rkarranj9@yahoo.com"}, -{"id":695,"firstName":"Edlin","lastName":"Davidsen","street":"5646 Arrowood Park","postalCode":"20591","city":"Washington","state":"DC","phoneNumber":"202-800-5817","email":"edavidsenja@purevolume.com"}, -{"id":696,"firstName":"Oralle","lastName":"Coneybeare","street":"0 Lakewood Parkway","postalCode":"08695","city":"Trenton","state":"NJ","email":"oconeybearejb@booking.com"}, -{"id":697,"firstName":"Scotti","lastName":"Cereceres","street":"2 Golf Hill","postalCode":"38119","city":"Memphis","state":"TN"}, -{"id":698,"firstName":"Hermione","lastName":"Mingotti","street":"14 Shoshone Alley","postalCode":"44511","city":"Youngstown","state":"OH","phoneNumber":"330-505-0585"}, -{"id":699,"firstName":"Janka","lastName":"Merredy","street":"877 Reinke Park","postalCode":"45233","city":"Cincinnati","state":"OH","email":"jmerredyje@furl.net"}, -{"id":700,"firstName":"Phillida","lastName":"Gannicleff","street":"48778 Sheridan Center","postalCode":"99210","city":"Spokane","state":"WA","email":"pgannicleffjf@github.io"}, -{"id":701,"firstName":"Bryn","lastName":"Shury","street":"82609 Surrey Road","postalCode":"78240","city":"San Antonio","state":"TX","phoneNumber":"210-361-9404","email":"bshuryjg@arstechnica.com"}, -{"id":702,"firstName":"Bobbe","lastName":"Yurocjhin","street":"54904 Southridge Parkway","postalCode":"33633","city":"Tampa","state":"FL","email":"byurocjhinjh@tumblr.com"}, -{"id":703,"firstName":"Noell","lastName":"Trewman","street":"63703 Fair Oaks Point","postalCode":"91520","city":"Burbank","state":"CA"}, -{"id":704,"firstName":"Adelind","lastName":"Marr","street":"68 Lotheville Park","postalCode":"02912","city":"Providence","state":"RI","email":"amarrjj@hexun.com"}, -{"id":705,"firstName":"Arabelle","lastName":"Oultram","street":"7927 Waxwing Place","postalCode":"77085","city":"Houston","state":"TX","email":"aoultramjk@diigo.com"}, -{"id":706,"firstName":"Derril","lastName":"Whylie","street":"1 Summerview Terrace","postalCode":"91606","city":"North Hollywood","state":"CA","phoneNumber":"323-244-3266","email":"dwhyliejl@auda.org.au"}, -{"id":707,"firstName":"Isadore","lastName":"Airth","street":"08897 Hauk Court","postalCode":"73104","city":"Oklahoma City","state":"OK","phoneNumber":"405-488-1807"}, -{"id":708,"firstName":"Barbara","lastName":"Feast","street":"420 Bayside Circle","postalCode":"63136","city":"Saint Louis","state":"MO","phoneNumber":"314-919-9094"}, -{"id":709,"firstName":"Engracia","lastName":"Laxtonne","street":"189 Oneill Center","postalCode":"22047","city":"Falls Church","state":"VA","email":"elaxtonnejo@addthis.com"}, -{"id":710,"firstName":"Dorice","lastName":"Dearle","street":"655 Union Way","postalCode":"47705","city":"Evansville","state":"IN","phoneNumber":"812-812-8795","email":"ddearlejp@mail.ru"}, -{"id":711,"firstName":"Crissie","lastName":"Leall","street":"1 1st Drive","postalCode":"36689","city":"Mobile","state":"AL","phoneNumber":"251-112-1542","email":"clealljq@nyu.edu"}, -{"id":712,"firstName":"Rica","lastName":"Wilshin","street":"0 Miller Way","postalCode":"79705","city":"Midland","state":"TX","phoneNumber":"432-935-1867"}, -{"id":713,"firstName":"Annie","lastName":"Thorns","street":"297 Thompson Park","postalCode":"32412","city":"Panama City","state":"FL","phoneNumber":"850-594-4049"}, -{"id":714,"firstName":"Lilah","lastName":"Beining","street":"1566 American Ash Avenue","postalCode":"25326","city":"Charleston","state":"WV","email":"lbeiningjt@mayoclinic.com"}, -{"id":715,"firstName":"Leeann","lastName":"Dorant","street":"5530 Mcguire Alley","postalCode":"93407","city":"San Luis Obispo","state":"CA","email":"ldorantju@homestead.com"}, -{"id":716,"firstName":"Elinor","lastName":"James","street":"2 Waxwing Terrace","postalCode":"88579","city":"El Paso","state":"TX","email":"ejamesjv@europa.eu"}, -{"id":717,"firstName":"Novelia","lastName":"Durman","street":"7 Hermina Junction","postalCode":"77050","city":"Houston","state":"TX","email":"ndurmanjw@fc2.com"}, -{"id":718,"firstName":"Sharai","lastName":"Pickervance","street":"739 Lien Junction","postalCode":"73167","city":"Oklahoma City","state":"OK","email":"spickervancejx@independent.co.uk"}, -{"id":719,"firstName":"Gilberte","lastName":"Stilling","street":"29950 Annamark Trail","postalCode":"89178","city":"Las Vegas","state":"NV","phoneNumber":"702-604-4240","email":"gstillingjy@feedburner.com"}, -{"id":720,"firstName":"Rosabelle","lastName":"Guinan","street":"13078 Sutherland Center","postalCode":"83757","city":"Boise","state":"ID","phoneNumber":"208-792-6705"}, -{"id":721,"firstName":"Karin","lastName":"Ackermann","street":"3 Susan Hill","postalCode":"48919","city":"Lansing","state":"MI","phoneNumber":"517-579-7811","email":"kackermannk0@csmonitor.com"}, -{"id":722,"firstName":"Reeta","lastName":"Attwell","street":"96 Alpine Junction","postalCode":"66622","city":"Topeka","state":"KS"}, -{"id":723,"firstName":"Dru","lastName":"Linck","street":"37 Wayridge Place","postalCode":"49505","city":"Grand Rapids","state":"MI","phoneNumber":"616-197-1837"}, -{"id":724,"firstName":"Frances","lastName":"Collingridge","street":"273 Ludington Crossing","postalCode":"77255","city":"Houston","state":"TX"}, -{"id":725,"firstName":"Wilmette","lastName":"Haimes","street":"8408 Shopko Circle","postalCode":"98907","city":"Yakima","state":"WA","phoneNumber":"509-821-5948"}, -{"id":726,"firstName":"Isahella","lastName":"Rubrow","street":"25 Melby Crossing","postalCode":"59105","city":"Billings","state":"MT","email":"irubrowk5@edublogs.org"}, -{"id":727,"firstName":"Walden","lastName":"Sappson","street":"1 3rd Hill","postalCode":"60435","city":"Joliet","state":"IL","email":"wsappsonk6@ameblo.jp"}, -{"id":728,"firstName":"Blondie","lastName":"Godehard.sf","street":"4606 Caliangt Circle","postalCode":"20709","city":"Laurel","state":"MD"}, -{"id":729,"firstName":"Dion","lastName":"Wingeatt","street":"098 Ridgeview Alley","postalCode":"78769","city":"Austin","state":"TX","phoneNumber":"512-948-4113","email":"dwingeattk8@clickbank.net"}, -{"id":730,"firstName":"Antoni","lastName":"Tibbles","street":"9 Muir Court","postalCode":"25313","city":"Charleston","state":"WV","phoneNumber":"304-298-6149","email":"atibblesk9@usa.gov"}, -{"id":731,"firstName":"Quinn","lastName":"McKevin","street":"063 Washington Parkway","postalCode":"55470","city":"Minneapolis","state":"MN","phoneNumber":"612-140-1997"}, -{"id":732,"firstName":"Rita","lastName":"Hallam","street":"4 Chive Court","postalCode":"85025","city":"Phoenix","state":"AZ","email":"rhallamkb@list-manage.com"}, -{"id":733,"firstName":"Cliff","lastName":"McCrum","street":"30841 Scoville Street","postalCode":"38150","city":"Memphis","state":"TN","phoneNumber":"901-983-7713","email":"cmccrumkc@yellowpages.com"}, -{"id":734,"firstName":"Allyson","lastName":"Petkov","street":"057 Grover Trail","postalCode":"55487","city":"Minneapolis","state":"MN","phoneNumber":"612-706-7185"}, -{"id":735,"firstName":"Tanney","lastName":"Cicccitti","street":"84959 Calypso Way","postalCode":"66629","city":"Topeka","state":"KS","phoneNumber":"785-516-0753","email":"tcicccittike@netscape.com"}, -{"id":736,"firstName":"Brendin","lastName":"Behnke","street":"3057 Browning Parkway","postalCode":"38181","city":"Memphis","state":"TN","email":"bbehnkekf@answers.com"}, -{"id":737,"firstName":"Sydelle","lastName":"Lestor","street":"6 Old Shore Way","postalCode":"73167","city":"Oklahoma City","state":"OK"}, -{"id":738,"firstName":"Nilson","lastName":"Nelthorp","street":"5 Gerald Trail","postalCode":"60567","city":"Naperville","state":"IL","phoneNumber":"630-718-5304","email":"nnelthorpkh@scribd.com"}, -{"id":739,"firstName":"Randy","lastName":"Boller","street":"64 Roth Junction","postalCode":"95354","city":"Modesto","state":"CA","phoneNumber":"209-795-8532","email":"rbollerki@nature.com"}, -{"id":740,"firstName":"Vicki","lastName":"De Vaan","street":"08 Mariners Cove Terrace","postalCode":"62776","city":"Springfield","state":"IL","email":"vdevaankj@disqus.com"}, -{"id":741,"firstName":"Romain","lastName":"Castri","street":"7 Atwood Road","postalCode":"02905","city":"Providence","state":"RI","phoneNumber":"401-865-9950","email":"rcastrikk@google.com.br"}, -{"id":742,"firstName":"Adlai","lastName":"Keppel","street":"6 Farragut Circle","postalCode":"76705","city":"Waco","state":"TX","phoneNumber":"254-852-6322"}, -{"id":743,"firstName":"Arlyne","lastName":"Whalley","street":"6 Esker Terrace","postalCode":"83727","city":"Boise","state":"ID","email":"awhalleykm@amazon.co.uk"}, -{"id":744,"firstName":"Alistair","lastName":"Jennins","street":"6 Loeprich Center","postalCode":"21684","city":"Ridgely","state":"MD","phoneNumber":"410-494-2201","email":"ajenninskn@sciencedaily.com"}, -{"id":745,"firstName":"Farr","lastName":"Steer","street":"8569 Eliot Lane","postalCode":"93381","city":"Bakersfield","state":"CA","phoneNumber":"661-416-1609","email":"fsteerko@usgs.gov"}, -{"id":746,"firstName":"Analise","lastName":"Balasini","street":"8901 Lyons Parkway","postalCode":"23242","city":"Richmond","state":"VA","email":"abalasinikp@imgur.com"}, -{"id":747,"firstName":"Gilbert","lastName":"Lockton","street":"3 Leroy Court","postalCode":"49018","city":"Battle Creek","state":"MI","email":"glocktonkq@google.nl"}, -{"id":748,"firstName":"Hamlen","lastName":"Massie","street":"469 Mallory Drive","postalCode":"77250","city":"Houston","state":"TX","email":"hmassiekr@admin.ch"}, -{"id":749,"firstName":"Ebony","lastName":"Loker","street":"21173 Raven Point","postalCode":"21265","city":"Baltimore","state":"MD"}, -{"id":750,"firstName":"Kristina","lastName":"Deeble","street":"479 Warner Park","postalCode":"92013","city":"Carlsbad","state":"CA","phoneNumber":"760-377-7198","email":"kdeeblekt@ezinearticles.com"}, -{"id":751,"firstName":"Jabez","lastName":"Mummery","street":"1 East Point","postalCode":"52809","city":"Davenport","state":"IA","email":"jmummeryku@sfgate.com"}, -{"id":752,"firstName":"Perrine","lastName":"Aldwinckle","street":"98 Montana Avenue","postalCode":"85030","city":"Phoenix","state":"AZ","phoneNumber":"602-224-2810","email":"paldwincklekv@eepurl.com"}, -{"id":753,"firstName":"Humfried","lastName":"Pendleton","street":"843 Swallow Park","postalCode":"89115","city":"Las Vegas","state":"NV","phoneNumber":"702-524-6047"}, -{"id":754,"firstName":"Dario","lastName":"Chesshire","street":"638 Westport Place","postalCode":"96845","city":"Honolulu","state":"HI","phoneNumber":"808-718-1386"}, -{"id":755,"firstName":"Cherianne","lastName":"Hearfield","street":"15 Quincy Street","postalCode":"14233","city":"Buffalo","state":"NY","email":"chearfieldky@technorati.com"}, -{"id":756,"firstName":"Jemima","lastName":"Oxnam","street":"22276 Maple Street","postalCode":"92165","city":"San Diego","state":"CA","email":"joxnamkz@addtoany.com"}, -{"id":757,"firstName":"Tedmund","lastName":"Chandler","street":"81 Katie Point","postalCode":"44310","city":"Akron","state":"OH","phoneNumber":"330-336-2279","email":"tchandlerl0@webeden.co.uk"}, -{"id":758,"firstName":"Tobie","lastName":"Risley","street":"82996 Reindahl Junction","postalCode":"17140","city":"Harrisburg","state":"PA","phoneNumber":"717-272-9110","email":"trisleyl1@youtu.be"}, -{"id":759,"firstName":"Tomi","lastName":"Crevagh","street":"91791 Buhler Park","postalCode":"33715","city":"Saint Petersburg","state":"FL"}, -{"id":760,"firstName":"Luce","lastName":"Gwatkin","street":"424 Lunder Crossing","postalCode":"31416","city":"Savannah","state":"GA"}, -{"id":761,"firstName":"Vinita","lastName":"Hannon","street":"90 Claremont Trail","postalCode":"39236","city":"Jackson","state":"MS"}, -{"id":762,"firstName":"Ruby","lastName":"O'Cosgra","street":"304 Dayton Avenue","postalCode":"07188","city":"Newark","state":"NJ"}, -{"id":763,"firstName":"Amandi","lastName":"Vasiltsov","street":"98188 Killdeer Alley","postalCode":"93399","city":"Bakersfield","state":"CA","email":"avasiltsovl6@smh.com.au"}, -{"id":764,"firstName":"Juliana","lastName":"Goldspink","street":"93 Maryland Terrace","postalCode":"06705","city":"Waterbury","state":"CT","email":"jgoldspinkl7@guardian.co.uk"}, -{"id":765,"firstName":"Giorgi","lastName":"Yakovl","street":"24240 Shasta Drive","postalCode":"46814","city":"Fort Wayne","state":"IN","phoneNumber":"260-754-5907"}, -{"id":766,"firstName":"Aleksandr","lastName":"Justun","street":"06 Fulton Terrace","postalCode":"85025","city":"Phoenix","state":"AZ"}, -{"id":767,"firstName":"Cornela","lastName":"Grindell","street":"1 Hazelcrest Lane","postalCode":"53285","city":"Milwaukee","state":"WI"}, -{"id":768,"firstName":"Liv","lastName":"Madrell","street":"623 Cordelia Terrace","postalCode":"17105","city":"Harrisburg","state":"PA","email":"lmadrelllb@1688.com"}, -{"id":769,"firstName":"Konstance","lastName":"Rosebotham","street":"8930 Utah Terrace","postalCode":"20029","city":"Washington","state":"DC","email":"krosebothamlc@studiopress.com"}, -{"id":770,"firstName":"Theo","lastName":"Scotland","street":"454 Hintze Park","postalCode":"45238","city":"Cincinnati","state":"OH"}, -{"id":771,"firstName":"Trefor","lastName":"Rein","street":"9 Redwing Plaza","postalCode":"22184","city":"Vienna","state":"VA","email":"treinle@barnesandnoble.com"}, -{"id":772,"firstName":"Angelina","lastName":"Bromehead","street":"62477 Walton Circle","postalCode":"14683","city":"Rochester","state":"NY","email":"abromeheadlf@php.net"}, -{"id":773,"firstName":"Thornie","lastName":"Ivanishin","street":"0 Sunbrook Court","postalCode":"34665","city":"Pinellas Park","state":"FL","email":"tivanishinlg@aol.com"}, -{"id":774,"firstName":"Dyana","lastName":"McNickle","street":"2696 Lakewood Gardens Pass","postalCode":"20456","city":"Washington","state":"DC","phoneNumber":"202-653-8740"}, -{"id":775,"firstName":"Humfried","lastName":"Suero","street":"643 Pearson Junction","postalCode":"28410","city":"Wilmington","state":"NC"}, -{"id":776,"firstName":"Jessamine","lastName":"Stockings","street":"739 Moose Street","postalCode":"94137","city":"San Francisco","state":"CA","phoneNumber":"415-641-0091","email":"jstockingslj@skype.com"}, -{"id":777,"firstName":"Laryssa","lastName":"Grahl","street":"0538 Bultman Point","postalCode":"81505","city":"Grand Junction","state":"CO"}, -{"id":778,"firstName":"Susan","lastName":"Stonnell","street":"7 Dennis Parkway","postalCode":"67215","city":"Wichita","state":"KS","phoneNumber":"316-966-3243","email":"sstonnellll@nps.gov"}, -{"id":779,"firstName":"Melinde","lastName":"Segoe","street":"9 Dottie Place","postalCode":"19125","city":"Philadelphia","state":"PA","phoneNumber":"215-119-3801"}, -{"id":780,"firstName":"Skip","lastName":"Sedgebeer","street":"1 Eliot Drive","postalCode":"20005","city":"Washington","state":"DC","email":"ssedgebeerln@blogtalkradio.com"}, -{"id":781,"firstName":"Annabel","lastName":"Schusterl","street":"6094 Talisman Lane","postalCode":"68510","city":"Lincoln","state":"NE","phoneNumber":"402-355-7934","email":"aschusterllo@cargocollective.com"}, -{"id":782,"firstName":"Emiline","lastName":"Whittlesey","street":"5 Claremont Lane","postalCode":"77040","city":"Houston","state":"TX","phoneNumber":"832-835-1321","email":"ewhittleseylp@geocities.com"}, -{"id":783,"firstName":"Frasquito","lastName":"Loukes","street":"47 Merchant Pass","postalCode":"27499","city":"Greensboro","state":"NC","phoneNumber":"336-265-5719","email":"floukeslq@google.it"}, -{"id":784,"firstName":"Jerald","lastName":"Fairholm","street":"5939 Mariners Cove Road","postalCode":"76598","city":"Gatesville","state":"TX","email":"jfairholmlr@smh.com.au"}, -{"id":785,"firstName":"Melisent","lastName":"Strange","street":"50 Glendale Trail","postalCode":"10606","city":"White Plains","state":"NY"}, -{"id":786,"firstName":"Aaron","lastName":"Mixter","street":"14347 Darwin Place","postalCode":"33124","city":"Miami","state":"FL","phoneNumber":"786-244-1856","email":"amixterlt@dmoz.org"}, -{"id":787,"firstName":"Margy","lastName":"Falla","street":"5 Caliangt Trail","postalCode":"40287","city":"Louisville","state":"KY","email":"mfallalu@booking.com"}, -{"id":788,"firstName":"Malinde","lastName":"Ashdown","street":"97234 Anniversary Hill","postalCode":"06152","city":"Hartford","state":"CT","phoneNumber":"860-140-7408","email":"mashdownlv@economist.com"}, -{"id":789,"firstName":"Carolynn","lastName":"Dulany","street":"33 Melby Road","postalCode":"74116","city":"Tulsa","state":"OK","phoneNumber":"918-140-7039","email":"cdulanylw@yelp.com"}, -{"id":790,"firstName":"Kissee","lastName":"Escale","street":"1470 Hanson Parkway","postalCode":"92812","city":"Anaheim","state":"CA","phoneNumber":"714-466-6376"}, -{"id":791,"firstName":"Rebeka","lastName":"Moralee","street":"898 Oak Street","postalCode":"34108","city":"Naples","state":"FL","email":"rmoraleely@shutterfly.com"}, -{"id":792,"firstName":"Cort","lastName":"Arter","street":"35039 Menomonie Way","postalCode":"50936","city":"Des Moines","state":"IA","email":"carterlz@surveymonkey.com"}, -{"id":793,"firstName":"Kirsteni","lastName":"Heady","street":"473 Lawn Street","postalCode":"32092","city":"Saint Augustine","state":"FL","phoneNumber":"904-424-3526","email":"kheadym0@usda.gov"}, -{"id":794,"firstName":"Ettie","lastName":"Overil","street":"1085 Waubesa Lane","postalCode":"18105","city":"Allentown","state":"PA"}, -{"id":795,"firstName":"Evey","lastName":"Tesimon","street":"9 Cordelia Place","postalCode":"55127","city":"Saint Paul","state":"MN"}, -{"id":796,"firstName":"Hersh","lastName":"Lebond","street":"5265 Bartelt Park","postalCode":"34282","city":"Bradenton","state":"FL","phoneNumber":"941-114-7090"}, -{"id":797,"firstName":"Hendrika","lastName":"Govan","street":"27747 La Follette Avenue","postalCode":"21229","city":"Baltimore","state":"MD","email":"hgovanm4@cam.ac.uk"}, -{"id":798,"firstName":"Renado","lastName":"Hambly","street":"5211 Schmedeman Drive","postalCode":"68105","city":"Omaha","state":"NE","phoneNumber":"402-183-0376","email":"rhamblym5@netlog.com"}, -{"id":799,"firstName":"Brewer","lastName":"Boyn","street":"3161 Novick Lane","postalCode":"77055","city":"Houston","state":"TX","email":"bboynm6@google.it"}, -{"id":800,"firstName":"Patrick","lastName":"Speck","street":"57052 Ronald Regan Way","postalCode":"30306","city":"Atlanta","state":"GA","phoneNumber":"770-764-6971","email":"pspeckm7@live.com"}, -{"id":801,"firstName":"Skipper","lastName":"Conybear","street":"75 Autumn Leaf Alley","postalCode":"79968","city":"El Paso","state":"TX","phoneNumber":"915-705-5594","email":"sconybearm8@jimdo.com"}, -{"id":802,"firstName":"Elmore","lastName":"Quilty","street":"027 Warbler Court","postalCode":"35210","city":"Birmingham","state":"AL","email":"equiltym9@ebay.co.uk"}, -{"id":803,"firstName":"Estella","lastName":"Jorck","street":"52695 Holy Cross Trail","postalCode":"47134","city":"Jeffersonville","state":"IN","email":"ejorckma@bluehost.com"}, -{"id":804,"firstName":"Scotti","lastName":"Goodale","street":"7551 Dottie Pass","postalCode":"77713","city":"Beaumont","state":"TX","email":"sgoodalemb@nba.com"}, -{"id":805,"firstName":"Catha","lastName":"Shekle","street":"38839 Derek Terrace","postalCode":"62718","city":"Springfield","state":"IL","email":"csheklemc@tmall.com"}, -{"id":806,"firstName":"Clemens","lastName":"Chuter","street":"015 Charing Cross Pass","postalCode":"30306","city":"Atlanta","state":"GA"}, -{"id":807,"firstName":"Kiley","lastName":"Vasiltsov","street":"8 Reindahl Hill","postalCode":"33432","city":"Boca Raton","state":"FL","email":"kvasiltsovme@google.nl"}, -{"id":808,"firstName":"Korrie","lastName":"McGauhy","street":"188 Golf Lane","postalCode":"89110","city":"Las Vegas","state":"NV","phoneNumber":"702-647-1620","email":"kmcgauhymf@goodreads.com"}, -{"id":809,"firstName":"Giustina","lastName":"Hentze","street":"62244 Roth Way","postalCode":"48604","city":"Saginaw","state":"MI","email":"ghentzemg@pcworld.com"}, -{"id":810,"firstName":"Emilia","lastName":"Virgoe","street":"13910 Alpine Lane","postalCode":"33994","city":"Fort Myers","state":"FL","phoneNumber":"239-993-2041","email":"evirgoemh@mediafire.com"}, -{"id":811,"firstName":"Gordan","lastName":"Trimming","street":"38168 Transport Avenue","postalCode":"38131","city":"Memphis","state":"TN","email":"gtrimmingmi@spiegel.de"}, -{"id":812,"firstName":"Tadeo","lastName":"Vannoort","street":"41476 Pond Alley","postalCode":"20851","city":"Rockville","state":"MD","phoneNumber":"240-432-6489","email":"tvannoortmj@privacy.gov.au"}, -{"id":813,"firstName":"Joseito","lastName":"Viant","street":"1390 Kropf Court","postalCode":"04109","city":"Portland","state":"ME"}, -{"id":814,"firstName":"Blake","lastName":"Tailby","street":"5 Bultman Terrace","postalCode":"31914","city":"Columbus","state":"GA"}, -{"id":815,"firstName":"Cynthie","lastName":"Victor","street":"64 Hoard Avenue","postalCode":"46221","city":"Indianapolis","state":"IN","phoneNumber":"317-836-2511","email":"cvictormm@bizjournals.com"}, -{"id":816,"firstName":"Kristoforo","lastName":"Luckman","street":"019 Ohio Avenue","postalCode":"58505","city":"Bismarck","state":"ND","phoneNumber":"701-921-3472"}, -{"id":817,"firstName":"Celinka","lastName":"Brakewell","street":"5702 Tennessee Pass","postalCode":"92612","city":"Irvine","state":"CA","phoneNumber":"714-584-5599","email":"cbrakewellmo@house.gov"}, -{"id":818,"firstName":"Analiese","lastName":"Debenham","street":"7 Straubel Pass","postalCode":"31704","city":"Albany","state":"GA","phoneNumber":"229-600-4384","email":"adebenhammp@dell.com"}, -{"id":819,"firstName":"Sebastiano","lastName":"Eskriett","street":"0 Northridge Pass","postalCode":"34114","city":"Naples","state":"FL","phoneNumber":"239-651-1326","email":"seskriettmq@berkeley.edu"}, -{"id":820,"firstName":"Jermaine","lastName":"Donisthorpe","street":"69319 Hollow Ridge Park","postalCode":"62794","city":"Springfield","state":"IL","phoneNumber":"217-510-3030","email":"jdonisthorpemr@istockphoto.com"}, -{"id":821,"firstName":"Tera","lastName":"Smalecombe","street":"646 Oakridge Avenue","postalCode":"43699","city":"Toledo","state":"OH","email":"tsmalecombems@tripod.com"}, -{"id":822,"firstName":"Issie","lastName":"Cohane","street":"79078 Fair Oaks Circle","postalCode":"40233","city":"Louisville","state":"KY","email":"icohanemt@wired.com"}, -{"id":823,"firstName":"Nanete","lastName":"Erb","street":"02 Truax Place","postalCode":"88563","city":"El Paso","state":"TX","phoneNumber":"915-234-2792"}, -{"id":824,"firstName":"Benetta","lastName":"Roger","street":"822 Fallview Alley","postalCode":"33625","city":"Tampa","state":"FL","phoneNumber":"813-715-8911","email":"brogermv@ca.gov"}, -{"id":825,"firstName":"Sascha","lastName":"Hillyatt","street":"06 Fisk Plaza","postalCode":"11407","city":"Jamaica","state":"NY"}, -{"id":826,"firstName":"Britt","lastName":"Gilderoy","street":"64312 Delaware Place","postalCode":"89135","city":"Las Vegas","state":"NV"}, -{"id":827,"firstName":"Sterne","lastName":"Frissell","street":"69121 Sycamore Way","postalCode":"06912","city":"Stamford","state":"CT"}, -{"id":828,"firstName":"Lonny","lastName":"Petersen","street":"6 Golf Course Crossing","postalCode":"32627","city":"Gainesville","state":"FL","phoneNumber":"352-245-3289","email":"lpetersenmz@msu.edu"}, -{"id":829,"firstName":"Maridel","lastName":"Clunie","street":"0312 Dryden Street","postalCode":"80328","city":"Boulder","state":"CO","phoneNumber":"303-848-1116","email":"mclunien0@china.com.cn"}, -{"id":830,"firstName":"Annabal","lastName":"Pruckner","street":"98481 Anhalt Pass","postalCode":"30340","city":"Atlanta","state":"GA","email":"aprucknern1@bandcamp.com"}, -{"id":831,"firstName":"Carin","lastName":"Ambrois","street":"7982 Vahlen Road","postalCode":"85010","city":"Phoenix","state":"AZ"}, -{"id":832,"firstName":"Consuela","lastName":"Grubey","street":"1 Lillian Circle","postalCode":"89714","city":"Carson City","state":"NV","email":"cgrubeyn3@google.pl"}, -{"id":833,"firstName":"Friedrick","lastName":"Ventom","street":"703 Almo Crossing","postalCode":"43215","city":"Columbus","state":"OH"}, -{"id":834,"firstName":"Shalom","lastName":"Rosten","street":"4460 Parkside Road","postalCode":"37215","city":"Nashville","state":"TN","email":"srostenn5@e-recht24.de"}, -{"id":835,"firstName":"Sofia","lastName":"Pottie","street":"89885 Golf Course Junction","postalCode":"27635","city":"Raleigh","state":"NC","email":"spottien6@weather.com"}, -{"id":836,"firstName":"Ed","lastName":"Cecely","street":"38576 Gina Trail","postalCode":"85305","city":"Glendale","state":"AZ","email":"ececelyn7@friendfeed.com"}, -{"id":837,"firstName":"Ruthann","lastName":"Bignold","street":"202 Monterey Alley","postalCode":"19104","city":"Philadelphia","state":"PA","phoneNumber":"610-892-3949"}, -{"id":838,"firstName":"Vonnie","lastName":"Leeming","street":"5 Farmco Center","postalCode":"18706","city":"Wilkes Barre","state":"PA"}, -{"id":839,"firstName":"Diandra","lastName":"Gredden","street":"68178 Parkside Hill","postalCode":"89120","city":"Las Vegas","state":"NV","phoneNumber":"702-952-4026"}, -{"id":840,"firstName":"Donny","lastName":"Bruckent","street":"6 Dapin Way","postalCode":"98127","city":"Seattle","state":"WA","email":"dbruckentnb@stumbleupon.com"}, -{"id":841,"firstName":"Mill","lastName":"Finlay","street":"9 Meadow Valley Terrace","postalCode":"94405","city":"San Mateo","state":"CA","email":"mfinlaync@hibu.com"}, -{"id":842,"firstName":"Garv","lastName":"Feldberger","street":"5916 Marquette Lane","postalCode":"98127","city":"Seattle","state":"WA"}, -{"id":843,"firstName":"Micheal","lastName":"Favela","street":"41587 Dunning Road","postalCode":"47712","city":"Evansville","state":"IN"}, -{"id":844,"firstName":"Shannon","lastName":"Alvaro","street":"86377 Becker Avenue","postalCode":"33315","city":"Fort Lauderdale","state":"FL","phoneNumber":"954-661-6648","email":"salvaronf@usa.gov"}, -{"id":845,"firstName":"Corenda","lastName":"Aldcorn","street":"19 Bowman Court","postalCode":"67220","city":"Wichita","state":"KS","phoneNumber":"316-835-1638","email":"caldcornng@ebay.com"}, -{"id":846,"firstName":"Alvy","lastName":"Mahood","street":"0814 Spohn Hill","postalCode":"50347","city":"Des Moines","state":"IA","phoneNumber":"515-865-3669","email":"amahoodnh@toplist.cz"}, -{"id":847,"firstName":"Alexandr","lastName":"Stut","street":"8672 Anderson Court","postalCode":"78410","city":"Corpus Christi","state":"TX"}, -{"id":848,"firstName":"Gale","lastName":"Chaperling","street":"78873 Bellgrove Alley","postalCode":"10009","city":"New York City","state":"NY","phoneNumber":"212-978-6798","email":"gchaperlingnj@livejournal.com"}, -{"id":849,"firstName":"Eunice","lastName":"Dadson","street":"340 Dwight Hill","postalCode":"52809","city":"Davenport","state":"IA","phoneNumber":"563-787-9869","email":"edadsonnk@businessinsider.com"}, -{"id":850,"firstName":"Florentia","lastName":"Camin","street":"68733 Orin Point","postalCode":"46867","city":"Fort Wayne","state":"IN","phoneNumber":"260-920-3928","email":"fcaminnl@technorati.com"}, -{"id":851,"firstName":"Norina","lastName":"Vannacci","street":"585 Karstens Circle","postalCode":"45233","city":"Cincinnati","state":"OH"}, -{"id":852,"firstName":"Syd","lastName":"Gianolo","street":"99755 Arrowood Hill","postalCode":"33673","city":"Tampa","state":"FL","phoneNumber":"813-878-8150","email":"sgianolonn@uol.com.br"}, -{"id":853,"firstName":"Timofei","lastName":"Serle","street":"1081 Cascade Park","postalCode":"94257","city":"Sacramento","state":"CA","email":"tserleno@behance.net"}, -{"id":854,"firstName":"Moina","lastName":"Ciobutaro","street":"502 Stone Corner Circle","postalCode":"33018","city":"Hialeah","state":"FL","email":"mciobutaronp@ycombinator.com"}, -{"id":855,"firstName":"Nikolaos","lastName":"Gavaghan","street":"47136 Golf Junction","postalCode":"97255","city":"Portland","state":"OR"}, -{"id":856,"firstName":"Gallard","lastName":"Jenks","street":"2 Carioca Terrace","postalCode":"35263","city":"Birmingham","state":"AL","email":"gjenksnr@blogtalkradio.com"}, -{"id":857,"firstName":"Dare","lastName":"Nielson","street":"3 Carberry Hill","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-211-0944"}, -{"id":858,"firstName":"Cecilius","lastName":"Fasse","street":"1 Novick Street","postalCode":"68583","city":"Lincoln","state":"NE","phoneNumber":"402-342-4624","email":"cfassent@zimbio.com"}, -{"id":859,"firstName":"Kevon","lastName":"Doxsey","street":"152 Warrior Pass","postalCode":"91616","city":"North Hollywood","state":"CA","phoneNumber":"213-339-9582"}, -{"id":860,"firstName":"Matti","lastName":"Gras","street":"4567 Bunting Way","postalCode":"94544","city":"Hayward","state":"CA"}, -{"id":861,"firstName":"Nathan","lastName":"Longfut","street":"3178 Mockingbird Alley","postalCode":"97255","city":"Portland","state":"OR","phoneNumber":"971-206-3004"}, -{"id":862,"firstName":"Willetta","lastName":"Fitzpayn","street":"87 Alpine Drive","postalCode":"48604","city":"Saginaw","state":"MI","phoneNumber":"989-698-7578","email":"wfitzpaynnx@geocities.jp"}, -{"id":863,"firstName":"Emanuel","lastName":"Jikylls","street":"42 Heffernan Court","postalCode":"33884","city":"Winter Haven","state":"FL","email":"ejikyllsny@biglobe.ne.jp"}, -{"id":864,"firstName":"Lenard","lastName":"Nore","street":"7 Nevada Avenue","postalCode":"77343","city":"Huntsville","state":"TX","phoneNumber":"936-267-6742","email":"lnorenz@netscape.com"}, -{"id":865,"firstName":"Jeanine","lastName":"MacTurlough","street":"26343 Gale Crossing","postalCode":"53779","city":"Madison","state":"WI","phoneNumber":"608-865-6630","email":"jmacturlougho0@scientificamerican.com"}, -{"id":866,"firstName":"Jaquenetta","lastName":"Dorn","street":"3963 Novick Way","postalCode":"19495","city":"Valley Forge","state":"PA","email":"jdorno1@about.com"}, -{"id":867,"firstName":"Amity","lastName":"Titterrell","street":"3216 Lindbergh Court","postalCode":"90071","city":"Los Angeles","state":"CA","phoneNumber":"626-416-1494","email":"atitterrello2@psu.edu"}, -{"id":868,"firstName":"Rafaelia","lastName":"Melly","street":"6 Westridge Center","postalCode":"61825","city":"Champaign","state":"IL","email":"rmellyo3@ovh.net"}, -{"id":869,"firstName":"Cordi","lastName":"Martinovsky","street":"38 Forest Dale Terrace","postalCode":"50362","city":"Des Moines","state":"IA","email":"cmartinovskyo4@tuttocitta.it"}, -{"id":870,"firstName":"Humfrid","lastName":"Varne","street":"858 Farwell Street","postalCode":"06127","city":"West Hartford","state":"CT","email":"hvarneo5@yolasite.com"}, -{"id":871,"firstName":"Ford","lastName":"Pinchback","street":"363 Lien Pass","postalCode":"20599","city":"Washington","state":"DC","email":"fpinchbacko6@nytimes.com"}, -{"id":872,"firstName":"Maible","lastName":"Haresign","street":"809 Monica Point","postalCode":"28230","city":"Charlotte","state":"NC"}, -{"id":873,"firstName":"Rozamond","lastName":"Challis","street":"312 Mcbride Plaza","postalCode":"77266","city":"Houston","state":"TX","email":"rchalliso8@google.ca"}, -{"id":874,"firstName":"Myrah","lastName":"Menendez","street":"21 Garrison Plaza","postalCode":"23208","city":"Richmond","state":"VA","email":"mmenendezo9@msn.com"}, -{"id":875,"firstName":"Roberto","lastName":"Lamb","street":"3339 Cottonwood Pass","postalCode":"43699","city":"Toledo","state":"OH","phoneNumber":"419-633-9671"}, -{"id":876,"firstName":"Foster","lastName":"Delyth","street":"91500 Carpenter Point","postalCode":"79928","city":"El Paso","state":"TX","phoneNumber":"915-782-9005"}, -{"id":877,"firstName":"Nicholle","lastName":"Pickring","street":"8083 Talmadge Lane","postalCode":"14624","city":"Rochester","state":"NY","email":"npickringoc@tuttocitta.it"}, -{"id":878,"firstName":"Theodosia","lastName":"Bayliss","street":"6 Marcy Parkway","postalCode":"33954","city":"Port Charlotte","state":"FL"}, -{"id":879,"firstName":"Araldo","lastName":"Dowzell","street":"8376 Carpenter Court","postalCode":"71151","city":"Shreveport","state":"LA","email":"adowzelloe@army.mil"}, -{"id":880,"firstName":"Hugues","lastName":"McColgan","street":"990 Southridge Point","postalCode":"93591","city":"Palmdale","state":"CA","phoneNumber":"661-978-2646","email":"hmccolganof@netvibes.com"}, -{"id":881,"firstName":"Annissa","lastName":"Mordue","street":"62114 Ludington Lane","postalCode":"30911","city":"Augusta","state":"GA","phoneNumber":"706-152-3967","email":"amordueog@tripod.com"}, -{"id":882,"firstName":"Tierney","lastName":"Claughton","street":"3 Twin Pines Trail","postalCode":"88563","city":"El Paso","state":"TX","phoneNumber":"915-784-7980"}, -{"id":883,"firstName":"Rey","lastName":"Fleckno","street":"49 Oakridge Point","postalCode":"27605","city":"Raleigh","state":"NC"}, -{"id":884,"firstName":"Stacee","lastName":"Rewcastle","street":"19 Glendale Point","postalCode":"78278","city":"San Antonio","state":"TX","phoneNumber":"210-454-3087","email":"srewcastleoj@ustream.tv"}, -{"id":885,"firstName":"Delano","lastName":"Bragger","street":"0 Hoffman Center","postalCode":"47725","city":"Evansville","state":"IN","email":"dbraggerok@ifeng.com"}, -{"id":886,"firstName":"Redford","lastName":"Bare","street":"801 Garrison Court","postalCode":"08638","city":"Trenton","state":"NJ"}, -{"id":887,"firstName":"Grantham","lastName":"Arlidge","street":"69 Shelley Parkway","postalCode":"34210","city":"Bradenton","state":"FL","email":"garlidgeom@google.nl"}, -{"id":888,"firstName":"Debbie","lastName":"Tommaseo","street":"295 Crowley Alley","postalCode":"98516","city":"Olympia","state":"WA","email":"dtommaseoon@xrea.com"}, -{"id":889,"firstName":"Ragnar","lastName":"O' Byrne","street":"88163 Manitowish Terrace","postalCode":"20260","city":"Washington","state":"DC","phoneNumber":"202-982-3050","email":"robyrneoo@ft.com"}, -{"id":890,"firstName":"Leopold","lastName":"Woodington","street":"44 Vera Pass","postalCode":"24009","city":"Roanoke","state":"VA","email":"lwoodingtonop@engadget.com"}, -{"id":891,"firstName":"Farrah","lastName":"Conniam","street":"2078 Bunting Parkway","postalCode":"68134","city":"Omaha","state":"NE","email":"fconniamoq@github.com"}, -{"id":892,"firstName":"Augustus","lastName":"Morrish","street":"430 Sauthoff Plaza","postalCode":"27710","city":"Durham","state":"NC","phoneNumber":"919-266-8155","email":"amorrishor@naver.com"}, -{"id":893,"firstName":"Cassaundra","lastName":"Deaves","street":"32 Clarendon Way","postalCode":"40266","city":"Louisville","state":"KY","phoneNumber":"502-138-7158"}, -{"id":894,"firstName":"Glynn","lastName":"Shewan","street":"989 Susan Avenue","postalCode":"95194","city":"San Jose","state":"CA","email":"gshewanot@reuters.com"}, -{"id":895,"firstName":"Neils","lastName":"Niesing","street":"488 Jana Road","postalCode":"48232","city":"Detroit","state":"MI","email":"nniesingou@cafepress.com"}, -{"id":896,"firstName":"Alix","lastName":"Cleeton","street":"8 Merrick Crossing","postalCode":"18018","city":"Bethlehem","state":"PA","email":"acleetonov@ask.com"}, -{"id":897,"firstName":"Kyrstin","lastName":"Alejandro","street":"45487 Carey Way","postalCode":"37919","city":"Knoxville","state":"TN","email":"kalejandroow@scribd.com"}, -{"id":898,"firstName":"Waylin","lastName":"De Caroli","street":"9237 Ludington Plaza","postalCode":"77554","city":"Galveston","state":"TX","email":"wdecaroliox@washingtonpost.com"}, -{"id":899,"firstName":"Lian","lastName":"Brade","street":"704 Lotheville Drive","postalCode":"24014","city":"Roanoke","state":"VA","phoneNumber":"540-712-7147"}, -{"id":900,"firstName":"Griz","lastName":"Elgie","street":"435 Northridge Point","postalCode":"93399","city":"Bakersfield","state":"CA","email":"gelgieoz@hao123.com"}, -{"id":901,"firstName":"Georgeanna","lastName":"Gilberthorpe","street":"6 Tomscot Park","postalCode":"37931","city":"Knoxville","state":"TN","phoneNumber":"865-664-6191","email":"ggilberthorpep0@typepad.com"}, -{"id":902,"firstName":"Korrie","lastName":"Goldstraw","street":"00 Lindbergh Plaza","postalCode":"14225","city":"Buffalo","state":"NY","email":"kgoldstrawp1@yellowbook.com"}, -{"id":903,"firstName":"Hervey","lastName":"Wyse","street":"27 Buell Road","postalCode":"75044","city":"Garland","state":"TX","phoneNumber":"972-243-9031","email":"hwysep2@deliciousdays.com"}, -{"id":904,"firstName":"Georgeta","lastName":"Buckam","street":"0 Continental Hill","postalCode":"65810","city":"Springfield","state":"MO","phoneNumber":"417-682-2553","email":"gbuckamp3@java.com"}, -{"id":905,"firstName":"Hussein","lastName":"Jacson","street":"478 Vermont Court","postalCode":"95354","city":"Modesto","state":"CA","phoneNumber":"209-714-7362","email":"hjacsonp4@squarespace.com"}, -{"id":906,"firstName":"Chrysler","lastName":"Heddy","street":"913 Steensland Parkway","postalCode":"20709","city":"Laurel","state":"MD","phoneNumber":"410-691-9748"}, -{"id":907,"firstName":"Jourdan","lastName":"Frise","street":"35 Erie Point","postalCode":"94245","city":"Sacramento","state":"CA","email":"jfrisep6@eepurl.com"}, -{"id":908,"firstName":"Roxie","lastName":"Gimber","street":"9237 Vermont Pass","postalCode":"88553","city":"El Paso","state":"TX","email":"rgimberp7@mayoclinic.com"}, -{"id":909,"firstName":"Jenilee","lastName":"MacNab","street":"23 Union Alley","postalCode":"29579","city":"Myrtle Beach","state":"SC","email":"jmacnabp8@mit.edu"}, -{"id":910,"firstName":"Lola","lastName":"Bier","street":"371 Bartillon Avenue","postalCode":"71105","city":"Shreveport","state":"LA","phoneNumber":"318-818-1659","email":"lbierp9@goo.gl"}, -{"id":911,"firstName":"Fayina","lastName":"Brosel","street":"3255 Macpherson Pass","postalCode":"55166","city":"Saint Paul","state":"MN","email":"fbroselpa@rakuten.co.jp"}, -{"id":912,"firstName":"Ellerey","lastName":"Darell","street":"735 Leroy Road","postalCode":"07544","city":"Paterson","state":"NJ"}, -{"id":913,"firstName":"Lorianne","lastName":"McLanachan","street":"22 Alpine Point","postalCode":"77293","city":"Houston","state":"TX","email":"lmclanachanpc@dmoz.org"}, -{"id":914,"firstName":"Merrill","lastName":"Searson","street":"8447 Namekagon Hill","postalCode":"55114","city":"Saint Paul","state":"MN","phoneNumber":"651-567-8380","email":"msearsonpd@census.gov"}, -{"id":915,"firstName":"Nisse","lastName":"Larive","street":"976 Forest Dale Way","postalCode":"10004","city":"New York City","state":"NY","phoneNumber":"347-192-6897","email":"nlarivepe@drupal.org"}, -{"id":916,"firstName":"Cazzie","lastName":"Brenard","street":"647 Gulseth Plaza","postalCode":"02283","city":"Boston","state":"MA","phoneNumber":"781-248-3572","email":"cbrenardpf@uiuc.edu"}, -{"id":917,"firstName":"Gael","lastName":"Ramirez","street":"161 Basil Terrace","postalCode":"93786","city":"Fresno","state":"CA","phoneNumber":"559-692-2653","email":"gramirezpg@ucoz.ru"}, -{"id":918,"firstName":"Culver","lastName":"Le Brun","street":"73906 Muir Terrace","postalCode":"95973","city":"Chico","state":"CA","email":"clebrunph@jigsy.com"}, -{"id":919,"firstName":"Bordie","lastName":"Muskett","street":"27 Nobel Trail","postalCode":"20599","city":"Washington","state":"DC","phoneNumber":"202-872-5253"}, -{"id":920,"firstName":"Riccardo","lastName":"Miskin","street":"778 Eagan Place","postalCode":"55407","city":"Minneapolis","state":"MN","email":"rmiskinpj@slideshare.net"}, -{"id":921,"firstName":"Cristabel","lastName":"Gowlett","street":"5 Quincy Lane","postalCode":"62525","city":"Decatur","state":"IL","email":"cgowlettpk@cafepress.com"}, -{"id":922,"firstName":"Crawford","lastName":"Huby","street":"6 Gina Lane","postalCode":"94913","city":"San Rafael","state":"CA","phoneNumber":"415-133-8552","email":"chubypl@jugem.jp"}, -{"id":923,"firstName":"Cherish","lastName":"Mutch","street":"8 Oak Valley Lane","postalCode":"20719","city":"Bowie","state":"MD","phoneNumber":"240-982-9087"}, -{"id":924,"firstName":"Jerrie","lastName":"Latek","street":"9462 Moulton Terrace","postalCode":"52809","city":"Davenport","state":"IA","phoneNumber":"563-687-6664","email":"jlatekpn@gov.uk"}, -{"id":925,"firstName":"Lacey","lastName":"Maris","street":"1 Carpenter Hill","postalCode":"61605","city":"Peoria","state":"IL","phoneNumber":"309-570-3216"}, -{"id":926,"firstName":"Daffy","lastName":"Binion","street":"8 Milwaukee Parkway","postalCode":"33129","city":"Miami","state":"FL","phoneNumber":"305-579-9009"}, -{"id":927,"firstName":"Melita","lastName":"Valde","street":"629 Packers Crossing","postalCode":"06140","city":"Hartford","state":"CT","phoneNumber":"860-747-5927","email":"mvaldepq@storify.com"}, -{"id":928,"firstName":"Cherlyn","lastName":"Rosenshine","street":"764 Pepper Wood Place","postalCode":"72204","city":"Little Rock","state":"AR","phoneNumber":"501-823-8134"}, -{"id":929,"firstName":"Morty","lastName":"Stanger","street":"3286 Charing Cross Court","postalCode":"08603","city":"Trenton","state":"NJ","email":"mstangerps@yellowpages.com"}, -{"id":930,"firstName":"Bernete","lastName":"Hirth","street":"83 Granby Center","postalCode":"95194","city":"San Jose","state":"CA","phoneNumber":"408-738-2333","email":"bhirthpt@people.com.cn"}, -{"id":931,"firstName":"Elena","lastName":"Wace","street":"98 Grover Trail","postalCode":"33742","city":"Saint Petersburg","state":"FL","phoneNumber":"727-883-2239","email":"ewacepu@merriam-webster.com"}, -{"id":932,"firstName":"Giselbert","lastName":"Sisland","street":"2214 Sheridan Pass","postalCode":"40225","city":"Louisville","state":"KY"}, -{"id":933,"firstName":"Herb","lastName":"Voyce","street":"628 Basil Pass","postalCode":"21265","city":"Baltimore","state":"MD"}, -{"id":934,"firstName":"Vina","lastName":"Antonetti","street":"6 Springview Terrace","postalCode":"20430","city":"Washington","state":"DC","phoneNumber":"202-955-4578"}, -{"id":935,"firstName":"Bard","lastName":"De Avenell","street":"2775 Clarendon Avenue","postalCode":"53215","city":"Milwaukee","state":"WI"}, -{"id":936,"firstName":"Briana","lastName":"Pinshon","street":"43 Del Sol Street","postalCode":"33615","city":"Tampa","state":"FL","email":"bpinshonpz@java.com"}, -{"id":937,"firstName":"Hilly","lastName":"Aysh","street":"37 Doe Crossing Terrace","postalCode":"23705","city":"Portsmouth","state":"VA","phoneNumber":"757-992-8124"}, -{"id":938,"firstName":"Marylin","lastName":"Ciotto","street":"3957 Browning Pass","postalCode":"94807","city":"Richmond","state":"CA"}, -{"id":939,"firstName":"Cam","lastName":"Kurth","street":"155 Walton Point","postalCode":"92867","city":"Orange","state":"CA","phoneNumber":"949-955-2248"}, -{"id":940,"firstName":"Rawley","lastName":"Bickle","street":"54 Macpherson Point","postalCode":"93762","city":"Fresno","state":"CA","phoneNumber":"559-331-2187","email":"rbickleq3@delicious.com"}, -{"id":941,"firstName":"Merlina","lastName":"Dunster","street":"70557 Toban Trail","postalCode":"20005","city":"Washington","state":"DC","phoneNumber":"202-999-8731"}, -{"id":942,"firstName":"Kennie","lastName":"MacCoughan","street":"04566 Browning Parkway","postalCode":"75507","city":"Texarkana","state":"TX","phoneNumber":"903-622-7509","email":"kmaccoughanq5@reuters.com"}, -{"id":943,"firstName":"Jase","lastName":"Cholomin","street":"21497 Blaine Road","postalCode":"33777","city":"Largo","state":"FL","email":"jcholominq6@cocolog-nifty.com"}, -{"id":944,"firstName":"Cirstoforo","lastName":"Billingsley","street":"1306 Summer Ridge Court","postalCode":"02124","city":"Boston","state":"MA","email":"cbillingsleyq7@google.es"}, -{"id":945,"firstName":"Berkly","lastName":"Lawles","street":"80400 Milwaukee Way","postalCode":"64082","city":"Lees Summit","state":"MO","email":"blawlesq8@jiathis.com"}, -{"id":946,"firstName":"Otha","lastName":"Key","street":"59639 Center Circle","postalCode":"35405","city":"Tuscaloosa","state":"AL","email":"okeyq9@deliciousdays.com"}, -{"id":947,"firstName":"Anselma","lastName":"Debow","street":"5 Spohn Parkway","postalCode":"80241","city":"Denver","state":"CO","email":"adebowqa@yelp.com"}, -{"id":948,"firstName":"Auria","lastName":"Beric","street":"5 Anderson Way","postalCode":"20022","city":"Washington","state":"DC","email":"abericqb@a8.net"}, -{"id":949,"firstName":"Eirena","lastName":"Caswall","street":"4648 Fulton Street","postalCode":"64054","city":"Independence","state":"MO","phoneNumber":"816-406-0779","email":"ecaswallqc@i2i.jp"}, -{"id":950,"firstName":"Tracy","lastName":"Sperwell","street":"4 Heath Drive","postalCode":"91499","city":"Van Nuys","state":"CA"}, -{"id":951,"firstName":"Cherilyn","lastName":"Faint","street":"814 Anniversary Lane","postalCode":"24503","city":"Lynchburg","state":"VA","phoneNumber":"434-722-2344","email":"cfaintqe@amazon.de"}, -{"id":952,"firstName":"Sela","lastName":"Darcey","street":"002 Walton Hill","postalCode":"78703","city":"Austin","state":"TX","email":"sdarceyqf@lycos.com"}, -{"id":953,"firstName":"Freddie","lastName":"Klagge","street":"842 Schlimgen Road","postalCode":"29905","city":"Beaufort","state":"SC","email":"fklaggeqg@1und1.de"}, -{"id":954,"firstName":"Eunice","lastName":"Walrond","street":"4 Mifflin Terrace","postalCode":"68117","city":"Omaha","state":"NE","email":"ewalrondqh@arstechnica.com"}, -{"id":955,"firstName":"Adelbert","lastName":"Meuse","street":"971 Doe Crossing Court","postalCode":"27157","city":"Winston Salem","state":"NC"}, -{"id":956,"firstName":"Caitlin","lastName":"Windham","street":"29 Cordelia Alley","postalCode":"76210","city":"Denton","state":"TX","phoneNumber":"214-498-2801","email":"cwindhamqj@trellian.com"}, -{"id":957,"firstName":"Jere","lastName":"Presho","street":"7 Monica Plaza","postalCode":"75710","city":"Tyler","state":"TX","email":"jpreshoqk@e-recht24.de"}, -{"id":958,"firstName":"Lonny","lastName":"Cotter","street":"5686 Rutledge Place","postalCode":"40596","city":"Lexington","state":"KY","email":"lcotterql@last.fm"}, -{"id":959,"firstName":"Sarah","lastName":"Earnshaw","street":"69 Prentice Point","postalCode":"60669","city":"Chicago","state":"IL","email":"searnshawqm@ycombinator.com"}, -{"id":960,"firstName":"Claire","lastName":"Minette","street":"3145 Butterfield Terrace","postalCode":"43204","city":"Columbus","state":"OH","phoneNumber":"614-157-5341","email":"cminetteqn@upenn.edu"}, -{"id":961,"firstName":"Traci","lastName":"Farnes","street":"2 Service Circle","postalCode":"06905","city":"Stamford","state":"CT","phoneNumber":"203-311-5859","email":"tfarnesqo@merriam-webster.com"}, -{"id":962,"firstName":"Storm","lastName":"de Werk","street":"9 Jenifer Alley","postalCode":"98121","city":"Seattle","state":"WA","phoneNumber":"425-172-3688"}, -{"id":963,"firstName":"Neile","lastName":"Mackrill","street":"5046 Schurz Point","postalCode":"28299","city":"Charlotte","state":"NC"}, -{"id":964,"firstName":"Temple","lastName":"Howlings","street":"8831 Randy Street","postalCode":"71161","city":"Shreveport","state":"LA","phoneNumber":"318-859-6319","email":"thowlingsqr@smugmug.com"}, -{"id":965,"firstName":"Roda","lastName":"Drissell","street":"16621 Mandrake Lane","postalCode":"78744","city":"Austin","state":"TX","email":"rdrissellqs@mayoclinic.com"}, -{"id":966,"firstName":"Francoise","lastName":"Lawman","street":"7 Calypso Point","postalCode":"14614","city":"Rochester","state":"NY","phoneNumber":"585-995-3882"}, -{"id":967,"firstName":"Helen","lastName":"Kigelman","street":"613 Manley Plaza","postalCode":"01905","city":"Lynn","state":"MA","email":"hkigelmanqu@shutterfly.com"}, -{"id":968,"firstName":"Dudley","lastName":"Cansdall","street":"153 Schmedeman Place","postalCode":"93715","city":"Fresno","state":"CA","email":"dcansdallqv@naver.com"}, -{"id":969,"firstName":"Shelby","lastName":"Fayers","street":"94681 Knutson Point","postalCode":"10039","city":"New York City","state":"NY"}, -{"id":970,"firstName":"Sileas","lastName":"Jalland","street":"2199 Buhler Circle","postalCode":"10029","city":"New York City","state":"NY","phoneNumber":"917-902-1667","email":"sjallandqx@rakuten.co.jp"}, -{"id":971,"firstName":"Zeke","lastName":"Duffett","street":"5 Coolidge Park","postalCode":"37995","city":"Knoxville","state":"TN","phoneNumber":"865-814-8540","email":"zduffettqy@wikispaces.com"}, -{"id":972,"firstName":"Tabby","lastName":"Mathieu","street":"78 Donald Circle","postalCode":"55114","city":"Saint Paul","state":"MN","email":"tmathieuqz@rediff.com"}, -{"id":973,"firstName":"Zsa zsa","lastName":"Knights","street":"208 Kingsford Park","postalCode":"15250","city":"Pittsburgh","state":"PA","phoneNumber":"412-652-8956","email":"zknightsr0@privacy.gov.au"}, -{"id":974,"firstName":"Tildi","lastName":"Knewstub","street":"8572 Gina Hill","postalCode":"32909","city":"Palm Bay","state":"FL","email":"tknewstubr1@archive.org"}, -{"id":975,"firstName":"Eric","lastName":"Wharrier","street":"9 Marcy Alley","postalCode":"38126","city":"Memphis","state":"TN","phoneNumber":"901-378-1545","email":"ewharrierr2@people.com.cn"}, -{"id":976,"firstName":"Jilleen","lastName":"Durgan","street":"7 Lien Plaza","postalCode":"75241","city":"Dallas","state":"TX","email":"jdurganr3@google.pl"}, -{"id":977,"firstName":"Ingeberg","lastName":"Whipp","street":"489 Bartillon Street","postalCode":"22205","city":"Arlington","state":"VA","phoneNumber":"703-356-7728","email":"iwhippr4@un.org"}, -{"id":978,"firstName":"Drake","lastName":"McCreagh","street":"735 Mcguire Lane","postalCode":"20530","city":"Washington","state":"DC","email":"dmccreaghr5@mediafire.com"}, -{"id":979,"firstName":"Byron","lastName":"Eades","street":"931 Hollow Ridge Avenue","postalCode":"23285","city":"Richmond","state":"VA","phoneNumber":"804-728-5669","email":"beadesr6@npr.org"}, -{"id":980,"firstName":"Free","lastName":"Tungate","street":"7037 Ramsey Crossing","postalCode":"64153","city":"Kansas City","state":"MO","email":"ftungater7@macromedia.com"}, -{"id":981,"firstName":"Augustus","lastName":"Benardet","street":"398 Bultman Circle","postalCode":"70165","city":"New Orleans","state":"LA"}, -{"id":982,"firstName":"Sanders","lastName":"Sullens","street":"75785 Westend Terrace","postalCode":"43656","city":"Toledo","state":"OH","phoneNumber":"419-314-1134"}, -{"id":983,"firstName":"Ynes","lastName":"Troup","street":"328 Schurz Trail","postalCode":"98907","city":"Yakima","state":"WA","phoneNumber":"509-696-5645"}, -{"id":984,"firstName":"Siana","lastName":"Bernath","street":"968 Sommers Lane","postalCode":"55487","city":"Minneapolis","state":"MN","phoneNumber":"612-351-3016"}, -{"id":985,"firstName":"Ellary","lastName":"Enders","street":"2 Charing Cross Court","postalCode":"06505","city":"New Haven","state":"CT","phoneNumber":"203-608-5058"}, -{"id":986,"firstName":"Mariann","lastName":"Damerell","street":"885 Pennsylvania Crossing","postalCode":"15220","city":"Pittsburgh","state":"PA","phoneNumber":"412-667-1349","email":"mdamerellrd@moonfruit.com"}, -{"id":987,"firstName":"Timotheus","lastName":"Muncer","street":"293 Hoepker Center","postalCode":"32405","city":"Panama City","state":"FL","phoneNumber":"850-740-2501","email":"tmuncerre@ifeng.com"}, -{"id":988,"firstName":"Hermina","lastName":"Tetsall","street":"9354 Nobel Road","postalCode":"55585","city":"Monticello","state":"MN","phoneNumber":"763-292-3970","email":"htetsallrf@wsj.com"}, -{"id":989,"firstName":"Dorelia","lastName":"Howship","street":"747 Namekagon Way","postalCode":"14269","city":"Buffalo","state":"NY","phoneNumber":"716-470-3584","email":"dhowshiprg@un.org"}, -{"id":990,"firstName":"Peggy","lastName":"Coutts","street":"34 Village Green Road","postalCode":"19131","city":"Philadelphia","state":"PA"}, -{"id":991,"firstName":"Dacey","lastName":"Inglefield","street":"05227 Buell Avenue","postalCode":"45414","city":"Dayton","state":"OH"}, -{"id":992,"firstName":"Hollyanne","lastName":"Hobbema","street":"684 La Follette Drive","postalCode":"45218","city":"Cincinnati","state":"OH","phoneNumber":"513-346-0258"}, -{"id":993,"firstName":"Freedman","lastName":"Whorlow","street":"291 Maywood Pass","postalCode":"48098","city":"Troy","state":"MI","phoneNumber":"248-890-5937"}, -{"id":994,"firstName":"Karine","lastName":"Gerring","street":"163 Graceland Street","postalCode":"95397","city":"Modesto","state":"CA"}, -{"id":995,"firstName":"Sonya","lastName":"Giercke","street":"1801 Rowland Junction","postalCode":"66215","city":"Shawnee Mission","state":"KS","email":"sgierckerm@mapquest.com"}, -{"id":996,"firstName":"Fabiano","lastName":"O'Hear","street":"87555 Sunnyside Plaza","postalCode":"33330","city":"Fort Lauderdale","state":"FL","email":"fohearrn@china.com.cn"}, -{"id":997,"firstName":"Lelia","lastName":"Gillman","street":"29838 Eagan Junction","postalCode":"78783","city":"Austin","state":"TX","phoneNumber":"512-515-1461","email":"lgillmanro@amazon.co.jp"}, -{"id":998,"firstName":"Ophelie","lastName":"Richardet","street":"9 Bay Point","postalCode":"94042","city":"Mountain View","state":"CA"}, -{"id":999,"firstName":"Batholomew","lastName":"Janzen","street":"9 Rigney Alley","postalCode":"95113","city":"San Jose","state":"CA"}, -{"id":1000,"firstName":"Kirstyn","lastName":"Bixley","street":"2 Cascade Trail","postalCode":"80015","city":"Aurora","state":"CO","phoneNumber":"303-339-2309","email":"kbixleyrr@i2i.jp"}] \ No newline at end of file From 6947342212b484dcf530ae39ce9a358d7adc8ed6 Mon Sep 17 00:00:00 2001 From: Karsten Silz Date: Mon, 21 Sep 2020 20:44:47 +0100 Subject: [PATCH 0792/1862] Undoing another change. --- json/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/json/pom.xml b/json/pom.xml index 99fcfed362..bd901b526e 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -45,11 +45,6 @@ jackson-databind ${jackson.version} - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - javax.json.bind javax.json.bind-api From f84e6099381ef89d4c2276a5fe878e939be04ece Mon Sep 17 00:00:00 2001 From: Cavero Barca Date: Tue, 22 Sep 2020 01:08:21 +0200 Subject: [PATCH 0793/1862] Add a new project with dependencies to separate the layers --- docker/docker-internal-dto/pom.xml | 14 +++++++++ .../java/com/baeldung/docker/VariableDto.java | 14 +++++++++ docker/docker-spring-boot/pom.xml | 28 ++++++++++------- .../src/main/docker/Dockerfile | 4 +-- docker/pom.xml | 30 +++++++++++++++++++ 5 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 docker/docker-internal-dto/pom.xml create mode 100644 docker/docker-internal-dto/src/main/java/com/baeldung/docker/VariableDto.java create mode 100644 docker/pom.xml diff --git a/docker/docker-internal-dto/pom.xml b/docker/docker-internal-dto/pom.xml new file mode 100644 index 0000000000..d7ba6d7373 --- /dev/null +++ b/docker/docker-internal-dto/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + com.baeldung.docker + docker-spring-boot-parent + 0.0.1 + + + docker-internal-dto + + \ No newline at end of file diff --git a/docker/docker-internal-dto/src/main/java/com/baeldung/docker/VariableDto.java b/docker/docker-internal-dto/src/main/java/com/baeldung/docker/VariableDto.java new file mode 100644 index 0000000000..86e173e351 --- /dev/null +++ b/docker/docker-internal-dto/src/main/java/com/baeldung/docker/VariableDto.java @@ -0,0 +1,14 @@ +package com.baeldung.docker; + +public class VariableDto { + + private final String value; + + public VariableDto(String value) { + this.value = value; + } + + public String getValue() { + return value; + } +} diff --git a/docker/docker-spring-boot/pom.xml b/docker/docker-spring-boot/pom.xml index e8f6c134b1..9524f68a5a 100644 --- a/docker/docker-spring-boot/pom.xml +++ b/docker/docker-spring-boot/pom.xml @@ -1,21 +1,21 @@ - + 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.3.1.RELEASE - + com.baeldung.docker + docker-spring-boot-parent + 0.0.1 - com.baeldung.docker - spring-boot-docker - 0.0.1-SNAPSHOT - spring-boot-docker + + docker-spring-boot + + docker-spring-boot Demo project showing Spring Boot and Docker - 8 + 11 @@ -24,6 +24,12 @@ spring-boot-starter-web + + com.baeldung.docker + docker-internal-dto + 0.0.1 + + org.springframework.boot spring-boot-starter-test diff --git a/docker/docker-spring-boot/src/main/docker/Dockerfile b/docker/docker-spring-boot/src/main/docker/Dockerfile index 663cc94490..c0fd9c9cdb 100644 --- a/docker/docker-spring-boot/src/main/docker/Dockerfile +++ b/docker/docker-spring-boot/src/main/docker/Dockerfile @@ -9,8 +9,8 @@ RUN java -Djarmode=layertools -jar application.jar extract FROM adoptopenjdk:11-jre-hotspot COPY --from=builder dependencies/ ./ -COPY --from=builder snapshot-dependencies/ ./ -COPY --from=builder internal-dependencies/ ./ COPY --from=builder spring-boot-loader/ ./ +COPY --from=builder internal-dependencies/ ./ +COPY --from=builder snapshot-dependencies/ ./ COPY --from=builder application/ ./ ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] \ No newline at end of file diff --git a/docker/pom.xml b/docker/pom.xml new file mode 100644 index 0000000000..3668ceb0fc --- /dev/null +++ b/docker/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + + com.baeldung.docker + docker-spring-boot-parent + 0.0.1 + docker-spring-boot-parent + Demo project showing Spring Boot and Docker + pom + + + 11 + + + + docker-internal-dto + docker-spring-boot + + + From 9be17d36d21eb55f67e84521245f90a3896a1f16 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Tue, 22 Sep 2020 14:57:32 +0200 Subject: [PATCH 0794/1862] JAVA-2976: Get rid of the overriden spring-boot.version property --- .../spring-boot-property-exp/property-exp-custom-config/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-property-exp/property-exp-custom-config/pom.xml b/spring-boot-modules/spring-boot-property-exp/property-exp-custom-config/pom.xml index e38a2742d5..f0df50cf76 100644 --- a/spring-boot-modules/spring-boot-property-exp/property-exp-custom-config/pom.xml +++ b/spring-boot-modules/spring-boot-property-exp/property-exp-custom-config/pom.xml @@ -78,7 +78,6 @@ - 2.2.6.RELEASE Custom Property Value 2.7 1.6.0 From 27953f3bb15115001c634a81c098746b5cbc9af0 Mon Sep 17 00:00:00 2001 From: "sahil.singla" Date: Tue, 22 Sep 2020 22:18:17 +0530 Subject: [PATCH 0795/1862] Applied formatter --- .../stopexecution/StopExecution.java | 79 +++++++++---------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java index 2eb807020c..20f66da5da 100644 --- a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java +++ b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java @@ -29,16 +29,14 @@ public class StopExecution { LOG.info("done"); } - - public void testUsingLoop(){ + public void testUsingLoop() { long start = System.currentTimeMillis(); long end = start + 5000; List items = new ArrayList<>(); int counter = 0; // Let this loop run only upto 5 seconds - while (System.currentTimeMillis() < end && counter < items.size()) - { + while (System.currentTimeMillis() < end && counter < items.size()) { // Fetch the item from the list. // Some expensive operation on the item. try { @@ -50,7 +48,7 @@ public class StopExecution { } } - public static void testThreads(){ + public static void testThreads() { Thread thread = new Thread(new Runnable() { @Override public void run() { @@ -65,7 +63,7 @@ public class StopExecution { } }); thread.start(); - while (thread.getState() != Thread.State.TERMINATED){ + while (thread.getState() != Thread.State.TERMINATED) { LOG.info(thread.getState().name()); try { Thread.sleep(500); @@ -74,16 +72,16 @@ public class StopExecution { } } } - public static void testExecutor(){ + + public static void testExecutor() { final ExecutorService service = Executors.newSingleThreadExecutor(); Future f = null; try { - f = service.submit(() -> { + f = service.submit(() -> { // Do you long running calculation here try { Thread.sleep(2737); // Simulate some delay - } - catch (InterruptedException e){ + } catch (InterruptedException e) { LOG.info("Interrupted"); return "interrupted"; } @@ -92,18 +90,17 @@ public class StopExecution { }); LOG.info(f.get(2, TimeUnit.SECONDS)); - } catch (final TimeoutException e) { + } catch (TimeoutException e) { f.cancel(true); LOG.error("Calculation took to long"); - } catch (final Exception e) { + } catch (Exception e) { throw new RuntimeException(e); } finally { service.shutdown(); } } - - public void testExecutor2(){ + public void testExecutor2() { final ExecutorService service = Executors.newSingleThreadExecutor(); Future f = null; try { @@ -120,27 +117,28 @@ public class StopExecution { } } - public void testScheduledExecutor(){ + public void testScheduledExecutor() { LOG.info("testScheduledExecutor"); ScheduledExecutorService executor = Executors.newScheduledThreadPool(2); Future future = executor.submit(new LongRunningTask()); - executor.schedule(new Runnable(){ - public void run(){ + executor.schedule(new Runnable() { + public void run() { future.cancel(true); } }, 1000, TimeUnit.MILLISECONDS); executor.shutdown(); } - public void testThreadAndInterrupt(){ + + public void testThreadAndInterrupt() { Thread t; try { - t = new Thread(new LongRunningTask()); + t = new Thread(new LongRunningTask()); LOG.info("testExecutor3"); long end = System.currentTimeMillis() + 2000; t.start(); - while (t.isAlive() && System.currentTimeMillis() < end){ + while (t.isAlive() && System.currentTimeMillis() < end) { Thread.sleep(50); } t.interrupt(); @@ -148,7 +146,8 @@ public class StopExecution { throw new RuntimeException(e); } } - public void testTimer(){ + + public void testTimer() { LOG.info("Timer test"); Thread t = new Thread(new LongRunningTask()); Timer timeoutTimer = new Timer(); @@ -156,30 +155,26 @@ public class StopExecution { t.start(); } - class MyRunnableTask implements Runnable{ - public void run() - { - try - { + class MyRunnableTask implements Runnable { + public void run() { + try { LOG.info("MyRunnable..."); Thread.sleep(10000); - } - catch (InterruptedException ie) - { + } catch (InterruptedException ie) { LOG.info("MyRunnable interrupted..."); } } } - class TimeOutTask extends TimerTask { private Thread t; private Timer timer; - TimeOutTask(Thread t, Timer timer){ + TimeOutTask(Thread t, Timer timer) { this.t = t; this.timer = timer; } + public void run() { if (t != null && t.isAlive()) { t.interrupt(); @@ -188,26 +183,25 @@ public class StopExecution { } } - class LongRunningTask implements Runnable{ + class LongRunningTask implements Runnable { @Override public void run() { longRunningSort(); } - private void longRunningOperation(){ + private void longRunningOperation() { LOG.info("long Running operation started"); try { //Thread.sleep(500); longFileRead(); LOG.info("long running operation finished"); - } - catch (InterruptedException e){ + } catch (InterruptedException e) { LOG.info("long Running operation interrupted"); } } - private void longRunningSort(){ + private void longRunningSort() { LOG.info("long Running task started"); // Do you long running calculation here int len = 100000; @@ -234,16 +228,16 @@ public class StopExecution { } LOG.info("Index position: " + i); LOG.info("Long running task finished"); - }catch (InterruptedException e){ + } catch (InterruptedException e) { LOG.info("long Running operation interrupted"); } } - private void longFileRead() throws InterruptedException{ + private void longFileRead() throws InterruptedException { String file = "input.txt"; ClassLoader classloader = getClass().getClassLoader(); - try (InputStream inputStream = classloader.getResourceAsStream(file)){ + try (InputStream inputStream = classloader.getResourceAsStream(file)) { Reader inputStreamReader = new InputStreamReader(inputStream); int data = inputStreamReader.read(); @@ -252,12 +246,13 @@ public class StopExecution { data = inputStreamReader.read(); throwExceptionOnThreadInterrupt(); } - } catch (IOException e){ + } catch (IOException e) { LOG.error("Exception: ", e); } } - private void throwExceptionOnThreadInterrupt() throws InterruptedException{ - if (Thread.currentThread().interrupted()){ + + private void throwExceptionOnThreadInterrupt() throws InterruptedException { + if (Thread.currentThread().interrupted()) { throw new InterruptedException(); } } From 5590f2389673c7be59ceaf197ce2bc2966483291 Mon Sep 17 00:00:00 2001 From: fdpro Date: Tue, 22 Sep 2020 21:49:49 +0200 Subject: [PATCH 0796/1862] [JAVA-2587] Added spring-boot dependency for freemarker --- spring-mvc-basics-2/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spring-mvc-basics-2/pom.xml b/spring-mvc-basics-2/pom.xml index 6bcb1e90e5..c4688ffad6 100644 --- a/spring-mvc-basics-2/pom.xml +++ b/spring-mvc-basics-2/pom.xml @@ -84,6 +84,11 @@ spring-context-support ${spring.version} + + org.springframework.boot + spring-boot-starter-freemarker + ${spring-boot.version} + @@ -173,6 +178,7 @@ 5.1.0 20180130 1.6.1 + 2.3.4.RELEASE From 9f51e1c6e55bc55dbe69acf20179cc63fd7d0ddc Mon Sep 17 00:00:00 2001 From: Bruno Fontana Date: Tue, 22 Sep 2020 18:21:24 -0300 Subject: [PATCH 0797/1862] Assume Class examples redone. --- .../ConditionallyIgnoreTestsUnitTest.java | 64 ++++++++++++------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java index 0aa184f2e1..b3fd5e3b2c 100644 --- a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java @@ -5,37 +5,55 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeThat; import static org.junit.Assume.assumeTrue; +import static org.junit.Assume.assumeNotNull; +import static org.junit.Assume.assumeNoException; + import org.junit.Test; public class ConditionallyIgnoreTestsUnitTest { + @Test public void whenAssumeThatAndOSIsLinux_thenRunTest() { + assumeThat(getOsName(), is("Linux")); + assertEquals("run", "RUN".toLowerCase()); + } - @Test - public void whenAssumeThatCodeVersionIsNot2_thenIgnore() { - final int codeVersion = 1; - assumeThat(codeVersion, is(2)); + @Test public void whenAssumeTrueAndOSIsLinux_thenRunTest() { + final int codeVersion = 1; + assumeTrue(isExpectedOS(getOsName())); + assertEquals("run", "RUN".toLowerCase()); + } - assertEquals("hello", "HELLO".toLowerCase()); + @Test public void whenAssumeFalseAndOSIsLinux_thenIgnore() { + assumeFalse(isExpectedOS(getOsName())); + assertEquals("run", "RUN".toLowerCase()); + } + + @Test public void whenAssumeNotNullAndNotNullOSVersion_thenIgnore() { + assumeNotNull(getOsName()); + assertEquals("run", "RUN".toLowerCase()); + } + + /** + * Let's use a different example here. + */ + @Test public void whenAssumeNoExceptionAndExceptionThrown_thenIgnore() { + assertEquals("everything ok", "EVERYTHING OK".toLowerCase()); + String t = null; + try { + t.charAt(0); + } catch (NullPointerException npe) { + assumeNoException(npe); } + assertEquals("run", "RUN".toLowerCase()); + } - @Test - public void whenAssumeTrueOnCondition_thenIgnore() { - final int codeVersion = 1; - assumeTrue(isCodeVersion2(codeVersion)); + private boolean isExpectedOS(final String osName) { + return "Linux".equals(osName); + } - assertEquals("hello", "HELLO".toLowerCase()); - } - - @Test - public void whenAssumeFalseOnCondition_thenIgnore() { - final int codeVersion = 2; - assumeFalse(isCodeVersion2(codeVersion)); - - assertEquals("hello", "HELLO".toLowerCase()); - } - - private boolean isCodeVersion2(final int codeVersion) { - return codeVersion == 2; - } + // This should use System.getProperty("os.name") in a real test. + private String getOsName() { + return "Linux"; + } } From 8b0b645e6fd48b5e6288f924625178ff0c9e5986 Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Tue, 22 Sep 2020 00:41:23 +0200 Subject: [PATCH 0798/1862] [BAEL-4612] get spring boot port at runtime --- .../serverport/GetServerPortApplication.java | 12 ++++ .../serverport/ServerPortService.java | 20 +++++++ .../GetServerFixedPortUnitTest.java | 37 +++++++++++++ .../GetServerRandomPortUnitTest.java | 55 +++++++++++++++++++ .../application-fixedport.properties | 1 + .../application-randomport.properties | 1 + 6 files changed, 126 insertions(+) create mode 100644 spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/serverport/GetServerPortApplication.java create mode 100644 spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/serverport/ServerPortService.java create mode 100644 spring-boot-modules/spring-boot-environment/src/test/java/com/baeldung/serverport/GetServerFixedPortUnitTest.java create mode 100644 spring-boot-modules/spring-boot-environment/src/test/java/com/baeldung/serverport/GetServerRandomPortUnitTest.java create mode 100644 spring-boot-modules/spring-boot-environment/src/test/resources/application-fixedport.properties create mode 100644 spring-boot-modules/spring-boot-environment/src/test/resources/application-randomport.properties diff --git a/spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/serverport/GetServerPortApplication.java b/spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/serverport/GetServerPortApplication.java new file mode 100644 index 0000000000..d7658ad8d5 --- /dev/null +++ b/spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/serverport/GetServerPortApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.serverport; + + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class GetServerPortApplication { + public static void main(String[] args) { + SpringApplication.run(GetServerPortApplication.class, args); + } +} diff --git a/spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/serverport/ServerPortService.java b/spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/serverport/ServerPortService.java new file mode 100644 index 0000000000..59c0a0f333 --- /dev/null +++ b/spring-boot-modules/spring-boot-environment/src/main/java/com/baeldung/serverport/ServerPortService.java @@ -0,0 +1,20 @@ +package com.baeldung.serverport; + +import org.springframework.boot.web.servlet.context.ServletWebServerInitializedEvent; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Service; + +@Service +public class ServerPortService { + private int port; + + public int getPort() { + return port; + } + + @EventListener + public void onApplicationEvent(final ServletWebServerInitializedEvent event) { + port = event.getWebServer().getPort(); + } + +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-environment/src/test/java/com/baeldung/serverport/GetServerFixedPortUnitTest.java b/spring-boot-modules/spring-boot-environment/src/test/java/com/baeldung/serverport/GetServerFixedPortUnitTest.java new file mode 100644 index 0000000000..81e663b7a1 --- /dev/null +++ b/spring-boot-modules/spring-boot-environment/src/test/java/com/baeldung/serverport/GetServerFixedPortUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.serverport; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.web.ServerProperties; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.junit.Assert.assertEquals; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = GetServerPortApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) +@ActiveProfiles("fixedport") +public class GetServerFixedPortUnitTest { + private final static int EXPECTED_PORT = 7777; + + @Value("${server.port}") + private int serverPort; + + @Autowired + private ServerProperties serverProperties; + + @Test + public void givenFixedPortAsServerPort_whenReadServerPort_thenGetThePort() { + assertEquals("Reading fixed port by @Value(\"${server.port}\") will get the port.", EXPECTED_PORT, serverPort); + } + + @Test + public void givenFixedPortAsServerPort_whenReadServerProps_thenGetThePort() { + int port = serverProperties.getPort(); + assertEquals("Reading fixed port from serverProperties will get the port.", EXPECTED_PORT, port); + } + +} diff --git a/spring-boot-modules/spring-boot-environment/src/test/java/com/baeldung/serverport/GetServerRandomPortUnitTest.java b/spring-boot-modules/spring-boot-environment/src/test/java/com/baeldung/serverport/GetServerRandomPortUnitTest.java new file mode 100644 index 0000000000..3ad7e0fdf1 --- /dev/null +++ b/spring-boot-modules/spring-boot-environment/src/test/java/com/baeldung/serverport/GetServerRandomPortUnitTest.java @@ -0,0 +1,55 @@ +package com.baeldung.serverport; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.web.ServerProperties; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = GetServerPortApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) +@ActiveProfiles("randomport") +public class GetServerRandomPortUnitTest { + + @Value("${server.port}") + private int randomServerPort; + + @Autowired + private ServerPortService serverPortService; + + @Autowired + private ServerProperties serverProperties; + + @Autowired + private ServletWebServerApplicationContext webServerAppCtxt; + + @Test + public void given0AsServerPort_whenReadServerPort_thenGet0() { + assertEquals("Reading random port by @Value(\"${server.port}\") will get 0.", 0, randomServerPort); + } + + @Test + public void given0AsServerPort_whenReadServerProps_thenGet0() { + int port = serverProperties.getPort(); + assertEquals("Reading random port by serverProperties will get 0.", 0, port); + } + + @Test + public void given0AsServerPort_whenReadWebAppCtxt_thenGetThePort() { + int port = webServerAppCtxt.getWebServer().getPort(); + assertTrue("The random port should be greater than 1023", port > 1023); + } + + @Test + public void given0AsServerPort_whenReadFromListener_thenGetThePort() { + int port = serverPortService.getPort(); + assertTrue("The random port should be greater than 1023", port > 1023); + } +} diff --git a/spring-boot-modules/spring-boot-environment/src/test/resources/application-fixedport.properties b/spring-boot-modules/spring-boot-environment/src/test/resources/application-fixedport.properties new file mode 100644 index 0000000000..0c5e84f3a2 --- /dev/null +++ b/spring-boot-modules/spring-boot-environment/src/test/resources/application-fixedport.properties @@ -0,0 +1 @@ +server.port=7777 diff --git a/spring-boot-modules/spring-boot-environment/src/test/resources/application-randomport.properties b/spring-boot-modules/spring-boot-environment/src/test/resources/application-randomport.properties new file mode 100644 index 0000000000..cbe617ef03 --- /dev/null +++ b/spring-boot-modules/spring-boot-environment/src/test/resources/application-randomport.properties @@ -0,0 +1 @@ +server.port=0 From 9a8f92de763b47f08928c69d11b7aab5e4e85b05 Mon Sep 17 00:00:00 2001 From: Bruno Fontana Date: Tue, 22 Sep 2020 20:54:25 -0300 Subject: [PATCH 0799/1862] Fixing formatting issues. --- .../ConditionallyIgnoreTestsUnitTest.java | 86 ++++++++++--------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java index b3fd5e3b2c..9f927310b3 100644 --- a/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/assume/ConditionallyIgnoreTestsUnitTest.java @@ -13,47 +13,51 @@ import org.junit.Test; public class ConditionallyIgnoreTestsUnitTest { - @Test public void whenAssumeThatAndOSIsLinux_thenRunTest() { - assumeThat(getOsName(), is("Linux")); - assertEquals("run", "RUN".toLowerCase()); - } - - @Test public void whenAssumeTrueAndOSIsLinux_thenRunTest() { - final int codeVersion = 1; - assumeTrue(isExpectedOS(getOsName())); - assertEquals("run", "RUN".toLowerCase()); - } - - @Test public void whenAssumeFalseAndOSIsLinux_thenIgnore() { - assumeFalse(isExpectedOS(getOsName())); - assertEquals("run", "RUN".toLowerCase()); - } - - @Test public void whenAssumeNotNullAndNotNullOSVersion_thenIgnore() { - assumeNotNull(getOsName()); - assertEquals("run", "RUN".toLowerCase()); - } - - /** - * Let's use a different example here. - */ - @Test public void whenAssumeNoExceptionAndExceptionThrown_thenIgnore() { - assertEquals("everything ok", "EVERYTHING OK".toLowerCase()); - String t = null; - try { - t.charAt(0); - } catch (NullPointerException npe) { - assumeNoException(npe); + @Test + public void whenAssumeThatAndOSIsLinux_thenRunTest() { + assumeThat(getOsName(), is("Linux")); + assertEquals("run", "RUN".toLowerCase()); } - assertEquals("run", "RUN".toLowerCase()); - } - private boolean isExpectedOS(final String osName) { - return "Linux".equals(osName); - } + @Test + public void whenAssumeTrueAndOSIsLinux_thenRunTest() { + assumeTrue(isExpectedOS(getOsName())); + assertEquals("run", "RUN".toLowerCase()); + } - // This should use System.getProperty("os.name") in a real test. - private String getOsName() { - return "Linux"; - } -} + @Test + public void whenAssumeFalseAndOSIsLinux_thenIgnore() { + assumeFalse(isExpectedOS(getOsName())); + assertEquals("run", "RUN".toLowerCase()); + } + + @Test + public void whenAssumeNotNullAndNotNullOSVersion_thenRun() { + assumeNotNull(getOsName()); + assertEquals("run", "RUN".toLowerCase()); + } + + /** + * Let's use a different example here. + */ + @Test + public void whenAssumeNoExceptionAndExceptionThrown_thenIgnore() { + assertEquals("everything ok", "EVERYTHING OK".toLowerCase()); + String t = null; + try { + t.charAt(0); + } catch (NullPointerException npe) { + assumeNoException(npe); + } + assertEquals("run", "RUN".toLowerCase()); + } + + private boolean isExpectedOS(final String osName) { + return "Linux".equals(osName); + } + + // This should use System.getProperty("os.name") in a real test. + private String getOsName() { + return "Linux"; + } +} \ No newline at end of file From 465a878d02e5f2b4140ffd6bce02beb76aa01e73 Mon Sep 17 00:00:00 2001 From: Cristian Rosu Date: Wed, 23 Sep 2020 17:34:42 +0300 Subject: [PATCH 0800/1862] BAEL-4415 correct package name --- .../baeldung/trustedcert}/CertificatesUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename core-java-modules/core-java-security-2/src/test/java/{certificates => com/baeldung/trustedcert}/CertificatesUnitTest.java (99%) diff --git a/core-java-modules/core-java-security-2/src/test/java/certificates/CertificatesUnitTest.java b/core-java-modules/core-java-security-2/src/test/java/com/baeldung/trustedcert/CertificatesUnitTest.java similarity index 99% rename from core-java-modules/core-java-security-2/src/test/java/certificates/CertificatesUnitTest.java rename to core-java-modules/core-java-security-2/src/test/java/com/baeldung/trustedcert/CertificatesUnitTest.java index a631df086b..d99589a2ec 100644 --- a/core-java-modules/core-java-security-2/src/test/java/certificates/CertificatesUnitTest.java +++ b/core-java-modules/core-java-security-2/src/test/java/com/baeldung/trustedcert/CertificatesUnitTest.java @@ -1,4 +1,4 @@ -package certificates; +package com.baeldung.trustedcert; import org.junit.jupiter.api.Test; From 478e6ccff6b60de96d4cabbaaa042d1ca45496ea Mon Sep 17 00:00:00 2001 From: Cristian Rosu Date: Wed, 23 Sep 2020 17:36:48 +0300 Subject: [PATCH 0801/1862] BAEL-4415 correct line continuations indent to 2 spaces --- .../baeldung/trustedcert/CertificatesUnitTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/core-java-modules/core-java-security-2/src/test/java/com/baeldung/trustedcert/CertificatesUnitTest.java b/core-java-modules/core-java-security-2/src/test/java/com/baeldung/trustedcert/CertificatesUnitTest.java index d99589a2ec..4f40c3c195 100644 --- a/core-java-modules/core-java-security-2/src/test/java/com/baeldung/trustedcert/CertificatesUnitTest.java +++ b/core-java-modules/core-java-security-2/src/test/java/com/baeldung/trustedcert/CertificatesUnitTest.java @@ -39,8 +39,8 @@ public class CertificatesUnitTest { Set trustAnchors = params.getTrustAnchors(); List certificates = trustAnchors.stream() - .map(TrustAnchor::getTrustedCert) - .collect(Collectors.toList()); + .map(TrustAnchor::getTrustedCert) + .collect(Collectors.toList()); assertFalse(certificates.isEmpty()); } @@ -52,11 +52,11 @@ public class CertificatesUnitTest { List trustManagers = Arrays.asList(trustManagerFactory.getTrustManagers()); List certificates = trustManagers.stream() - .filter(X509TrustManager.class::isInstance) - .map(X509TrustManager.class::cast) - .map(trustManager -> Arrays.asList(trustManager.getAcceptedIssuers())) - .flatMap(Collection::stream) - .collect(Collectors.toList()); + .filter(X509TrustManager.class::isInstance) + .map(X509TrustManager.class::cast) + .map(trustManager -> Arrays.asList(trustManager.getAcceptedIssuers())) + .flatMap(Collection::stream) + .collect(Collectors.toList()); assertFalse(certificates.isEmpty()); } From 20a3070093b70bdc6b80c6cf1a8716537b366df8 Mon Sep 17 00:00:00 2001 From: Cristian Stancalau Date: Wed, 23 Sep 2020 19:23:50 +0300 Subject: [PATCH 0802/1862] BAEL-4156 Does a method's signature in Java include its return type? (#10049) * BAEL-4156 Does a method's signature in Java include its return type? * BAEL-4156 Add varargs * Update OverloadingErrors.java Co-authored-by: Cristian Stancalau --- .../baeldung/signature/OverloadingErrors.java | 72 +++++++++++++++++++ .../com/baeldung/signature/StaticBinding.java | 46 ++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/signature/OverloadingErrors.java create mode 100644 core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/signature/StaticBinding.java diff --git a/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/signature/OverloadingErrors.java b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/signature/OverloadingErrors.java new file mode 100644 index 0000000000..4c9d11d925 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/signature/OverloadingErrors.java @@ -0,0 +1,72 @@ +package com.baeldung.signature; + +import java.io.Serializable; + +public class OverloadingErrors { + + public void print() { + System.out.println("Signature is: print()"); + } + + /* + // Uncommenting this method will lead to a compilation error: java: method print() is already defined in class + // The method signature is independent from return type + public int print() { + System.out.println("Signature is: print()"); + return 0; + } + */ + + /* + // Uncommenting this method will lead to a compilation error: java: method print() is already defined in class + // The method signature is independent from modifiers + private final void print() { + System.out.println("Signature is: print()"); + } + */ + + /* + // Uncommenting this method will lead to a compilation error: java: method print() is already defined in class + // The method signature is independent from thrown exception declaration + public void print() throws IllegalStateException { + System.out.println("Signature is: print()"); + throw new IllegalStateException(); + } + */ + + public void print(int parameter) { + System.out.println("Signature is: print(int)"); + } + + /* + // Uncommenting this method will lead to a compilation error: java: method print(int) is already defined in class + // The method signature is independent from parameter names + public void print(int anotherParameter) { + System.out.println("Signature is: print(int)"); + } + */ + + public void printElement(T t) { + System.out.println("Signature is: printElement(T)"); + } + + /* + // Uncommenting this method will lead to a compilation error: java: name clash: printElement(java.io.Serializable) and printElement(T) have the same erasure + // Even though the signatures appear different, the compiler cannot statically bind the correct method after type erasure + public void printElement(Serializable o) { + System.out.println("Signature is: printElement(Serializable)"); + } + */ + + public void print(Object... parameter) { + System.out.println("Signature is: print(Object...)"); + } + + /* + // Uncommenting this method will lead to a compilation error: java cannot declare both sum(Object...) and sum(Object[]) + // Even though the signatures appear different, after compilation they both resolve to sum(Object[]) + public void print(Object[] parameter) { + System.out.println("Signature is: print(Object[])"); + } + */ +} diff --git a/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/signature/StaticBinding.java b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/signature/StaticBinding.java new file mode 100644 index 0000000000..01016812f0 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/signature/StaticBinding.java @@ -0,0 +1,46 @@ +package com.baeldung.signature; + +public class StaticBinding { + + public Number sum(Integer term1, Integer term2) { + System.out.println("Adding integers"); + return term1 + term2; + } + + public Number sum(Number term1, Number term2) { + System.out.println("Adding numbers"); + return term1.doubleValue() + term2.doubleValue(); + } + + public Number sum(Object term1, Object term2) { + System.out.println("Adding objects"); + return term1.hashCode() + term2.hashCode(); + } + + public Number sum(Object term1, Object... term2) { + System.out.println("Adding variable arguments: " + term2.length); + int result = term1.hashCode(); + for (Object o : term2) { + result += o.hashCode(); + } + return result; + } + + public static void main(String[] args) { + StaticBinding obj = new StaticBinding(); + + obj.sum(2, 3); // "Adding integers" due to auto-boxing from int to Integer + obj.sum(Integer.valueOf(2), Integer.valueOf(3)); // "Adding integers" due to exact parameter types + obj.sum(2, 0x1); // "Adding integers" due to type promotion from byte to int + + obj.sum((Number) 2, (Number) 3); // "Adding numbers" due to explicit cast to Number + obj.sum(2.0d, 3.0d); // "Adding numbers" due to auto-boxing from double to Double + obj.sum(Float.valueOf(2), Float.valueOf(3)); // "Adding numbers" due to polimorphism + + obj.sum((Object) 2, (Object) 3); // "Adding objects" due to explicit cast to Object + obj.sum(2, "John"); // "Adding objects" due to polimorphism + + obj.sum(new Object(), new Object(), new Object()); // "Adding variable arguments 2" + obj.sum(new Object(), new Object[]{new Object()}); // "Adding variable arguments 1" + } +} From a2751ea0d5ab98c72f0df508286948b5f6253e9c Mon Sep 17 00:00:00 2001 From: fdpro Date: Wed, 23 Sep 2020 19:31:59 +0200 Subject: [PATCH 0803/1862] [JAVA-2590] Added example of @JdbcTest usage --- .../template/testing/EmployeeApplication.java | 7 ++++++ .../jdbc/template/testing/EmployeeDAO.java | 4 ++++ .../testing/EmployeeDAOIntegrationTest.java | 24 +++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeApplication.java create mode 100644 persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAOIntegrationTest.java diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeApplication.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeApplication.java new file mode 100644 index 0000000000..a2917be105 --- /dev/null +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeApplication.java @@ -0,0 +1,7 @@ +package com.baeldung.spring.jdbc.template.testing; + +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class EmployeeApplication { +} diff --git a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAO.java b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAO.java index 64b146fd47..15da78ce35 100644 --- a/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAO.java +++ b/persistence-modules/spring-jdbc/src/main/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAO.java @@ -13,6 +13,10 @@ public class EmployeeDAO { jdbcTemplate = new JdbcTemplate(dataSource); } + public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { + this.jdbcTemplate = jdbcTemplate; + } + public int getCountOfEmployees() { return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class); } diff --git a/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAOIntegrationTest.java b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAOIntegrationTest.java new file mode 100644 index 0000000000..9634c3e0d7 --- /dev/null +++ b/persistence-modules/spring-jdbc/src/test/java/com/baeldung/spring/jdbc/template/testing/EmployeeDAOIntegrationTest.java @@ -0,0 +1,24 @@ +package com.baeldung.spring.jdbc.template.testing; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.JdbcTest; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.test.context.jdbc.Sql; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@JdbcTest +@Sql({"schema.sql", "test-data.sql"}) +class EmployeeDAOIntegrationTest { + @Autowired + private JdbcTemplate jdbcTemplate; + + @Test + void whenInjectInMemoryDataSource_thenReturnCorrectEmployeeCount() { + EmployeeDAO employeeDAO = new EmployeeDAO(); + employeeDAO.setJdbcTemplate(jdbcTemplate); + + assertEquals(4, employeeDAO.getCountOfEmployees()); + } +} From 49590633a82ff00541438c0d86f633426973ebae Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Wed, 23 Sep 2020 23:34:51 +0530 Subject: [PATCH 0804/1862] JAVA-2421: Merge spring-ehcache module into spring-caching module (#10072) * JAVA-2421: Moved 1 article from spring-ehcache to spring-caching * JAVA-2421: Removed module spring-ehcache * JAVA-2421: Removed module spring-ehcache from main pom --- pom.xml | 2 - spring-caching/README.md | 1 + spring-caching/pom.xml | 4 + .../com/baeldung/cachetest/Application.java | 0 .../cachetest/config/CacheConfig.java | 0 .../cachetest/config/CacheEventLogger.java | 0 .../cachetest/rest/NumberController.java | 0 .../cachetest/service/NumberService.java | 0 .../springdatacaching/model/Book.java | 4 +- .../src/main/resources/application.properties | 5 +- .../src/main/resources/ehcache.xml | 23 +++++ spring-ehcache/.gitignore | 13 --- spring-ehcache/README.md | 8 -- spring-ehcache/checkstyle.xml | 11 --- spring-ehcache/pom.xml | 87 ------------------- .../src/main/resources/application.properties | 1 - 16 files changed, 35 insertions(+), 124 deletions(-) rename {spring-ehcache => spring-caching}/src/main/java/com/baeldung/cachetest/Application.java (100%) rename {spring-ehcache => spring-caching}/src/main/java/com/baeldung/cachetest/config/CacheConfig.java (100%) rename {spring-ehcache => spring-caching}/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java (100%) rename {spring-ehcache => spring-caching}/src/main/java/com/baeldung/cachetest/rest/NumberController.java (100%) rename {spring-ehcache => spring-caching}/src/main/java/com/baeldung/cachetest/service/NumberService.java (100%) rename {spring-ehcache => spring-caching}/src/main/resources/ehcache.xml (58%) delete mode 100644 spring-ehcache/.gitignore delete mode 100644 spring-ehcache/README.md delete mode 100644 spring-ehcache/checkstyle.xml delete mode 100644 spring-ehcache/pom.xml delete mode 100644 spring-ehcache/src/main/resources/application.properties diff --git a/pom.xml b/pom.xml index 9fd8f65a61..6553716d63 100644 --- a/pom.xml +++ b/pom.xml @@ -651,7 +651,6 @@ spring-dispatcher-servlet spring-drools - spring-ehcache spring-ejb spring-exceptions @@ -1152,7 +1151,6 @@ spring-dispatcher-servlet spring-drools - spring-ehcache spring-ejb spring-exceptions diff --git a/spring-caching/README.md b/spring-caching/README.md index 705d998b1e..e10d6080e8 100644 --- a/spring-caching/README.md +++ b/spring-caching/README.md @@ -5,3 +5,4 @@ - [Cache Eviction in Spring Boot](https://www.baeldung.com/spring-boot-evict-cache) - [Using Multiple Cache Managers in Spring](https://www.baeldung.com/spring-multiple-cache-managers) - [Testing @Cacheable on Spring Data Repositories](https://www.baeldung.com/spring-data-testing-cacheable) +- [Spring Boot Ehcache Example](https://www.baeldung.com/spring-boot-ehcache) diff --git a/spring-caching/pom.xml b/spring-caching/pom.xml index b13755dafd..f58be35a76 100644 --- a/spring-caching/pom.xml +++ b/spring-caching/pom.xml @@ -36,6 +36,10 @@ org.springframework spring-webmvc + + javax.cache + cache-api + org.ehcache ehcache diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/Application.java b/spring-caching/src/main/java/com/baeldung/cachetest/Application.java similarity index 100% rename from spring-ehcache/src/main/java/com/baeldung/cachetest/Application.java rename to spring-caching/src/main/java/com/baeldung/cachetest/Application.java diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java b/spring-caching/src/main/java/com/baeldung/cachetest/config/CacheConfig.java similarity index 100% rename from spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheConfig.java rename to spring-caching/src/main/java/com/baeldung/cachetest/config/CacheConfig.java diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java b/spring-caching/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java similarity index 100% rename from spring-ehcache/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java rename to spring-caching/src/main/java/com/baeldung/cachetest/config/CacheEventLogger.java diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java b/spring-caching/src/main/java/com/baeldung/cachetest/rest/NumberController.java similarity index 100% rename from spring-ehcache/src/main/java/com/baeldung/cachetest/rest/NumberController.java rename to spring-caching/src/main/java/com/baeldung/cachetest/rest/NumberController.java diff --git a/spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java b/spring-caching/src/main/java/com/baeldung/cachetest/service/NumberService.java similarity index 100% rename from spring-ehcache/src/main/java/com/baeldung/cachetest/service/NumberService.java rename to spring-caching/src/main/java/com/baeldung/cachetest/service/NumberService.java diff --git a/spring-caching/src/main/java/com/baeldung/springdatacaching/model/Book.java b/spring-caching/src/main/java/com/baeldung/springdatacaching/model/Book.java index 7de567f0db..02285e3894 100644 --- a/spring-caching/src/main/java/com/baeldung/springdatacaching/model/Book.java +++ b/spring-caching/src/main/java/com/baeldung/springdatacaching/model/Book.java @@ -6,13 +6,15 @@ import lombok.NoArgsConstructor; import javax.persistence.Entity; import javax.persistence.Id; + +import java.io.Serializable; import java.util.UUID; @Data @Entity @NoArgsConstructor @AllArgsConstructor -public class Book { +public class Book implements Serializable { @Id private UUID id; diff --git a/spring-caching/src/main/resources/application.properties b/spring-caching/src/main/resources/application.properties index ee7b5e62c0..1039f85a42 100644 --- a/spring-caching/src/main/resources/application.properties +++ b/spring-caching/src/main/resources/application.properties @@ -1,4 +1,4 @@ -spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password= @@ -6,3 +6,6 @@ spring.datasource.password= # Enabling H2 Console spring.h2.console.enabled=true spring.h2.console.path=/h2 + +#ehcache +spring.cache.jcache.config=classpath:ehcache.xml diff --git a/spring-ehcache/src/main/resources/ehcache.xml b/spring-caching/src/main/resources/ehcache.xml similarity index 58% rename from spring-ehcache/src/main/resources/ehcache.xml rename to spring-caching/src/main/resources/ehcache.xml index caba0f2cc4..4b24394170 100644 --- a/spring-ehcache/src/main/resources/ehcache.xml +++ b/spring-caching/src/main/resources/ehcache.xml @@ -27,5 +27,28 @@ 10 + + + java.lang.String + com.baeldung.springdatacaching.model.Book + + 30 + + + + + com.baeldung.cachetest.config.CacheEventLogger + ASYNCHRONOUS + UNORDERED + CREATED + EXPIRED + + + + + 2 + 10 + + \ No newline at end of file diff --git a/spring-ehcache/.gitignore b/spring-ehcache/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-ehcache/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.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/spring-ehcache/README.md b/spring-ehcache/README.md deleted file mode 100644 index da7376e476..0000000000 --- a/spring-ehcache/README.md +++ /dev/null @@ -1,8 +0,0 @@ -## Spring Ehcache - -This module contains articles about Spring with Ehcache - -### Relevant Articles: - -- [Spring Boot Ehcache Example](https://www.baeldung.com/spring-boot-ehcache) - diff --git a/spring-ehcache/checkstyle.xml b/spring-ehcache/checkstyle.xml deleted file mode 100644 index 85063a7570..0000000000 --- a/spring-ehcache/checkstyle.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/spring-ehcache/pom.xml b/spring-ehcache/pom.xml deleted file mode 100644 index bf78e1392c..0000000000 --- a/spring-ehcache/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - 4.0.0 - spring-ehcache - 0.1-SNAPSHOT - spring-ehcache - jar - - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../parent-boot-2 - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-cache - - - javax.cache - cache-api - - - org.ehcache - ehcache - - - - - spring-ehcache - - - src/main/resources - true - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${checkstyle-maven-plugin.version} - - checkstyle.xml - - - - - check - - - - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${checkstyle-maven-plugin.version} - - checkstyle.xml - - - - - - - - 3.0.0 - false - - - diff --git a/spring-ehcache/src/main/resources/application.properties b/spring-ehcache/src/main/resources/application.properties deleted file mode 100644 index a5c2964d32..0000000000 --- a/spring-ehcache/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.cache.jcache.config=classpath:ehcache.xml \ No newline at end of file From 68287516fef69d735e1204792a446c1227454aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dupire?= Date: Wed, 23 Sep 2020 20:10:21 +0200 Subject: [PATCH 0805/1862] [JAVA-1669] Upgrading JUnit and Maven Surefire Plugin versions (#10018) * [JAVA-1669] Upgrading JUnit and Maven Surefire Plugin versions * Upgraded JUnit version for persistence-module and the modules that directly depends on it * Upgraded Maven Surefire Plugin version for these as well * Either made modules inheriting from persistence-modules instead of parent-modules or added relative paths when already inheriting persistence-modules * Upgraded versions in other modules * [JAVA-1669] Removed explicit relativePath in pom.xml when default value used * [JAVA-1669] Minor fix --- persistence-modules/apache-bookkeeper/pom.xml | 3 +-- persistence-modules/deltaspike/pom.xml | 7 ------- persistence-modules/flyway-repair/pom.xml | 5 +++++ persistence-modules/flyway/pom.xml | 5 +++++ persistence-modules/jpa-hibernate-cascade-type/pom.xml | 1 + persistence-modules/pom.xml | 5 +++++ persistence-modules/r2dbc/pom.xml | 5 +++++ persistence-modules/redis/pom.xml | 5 +++++ persistence-modules/spring-boot-mysql/pom.xml | 5 +++++ persistence-modules/spring-boot-persistence-2/pom.xml | 8 +++++++- persistence-modules/spring-boot-persistence-h2/pom.xml | 5 +++++ .../spring-boot-persistence-mongodb/pom.xml | 6 ++++++ persistence-modules/spring-boot-persistence/pom.xml | 5 +++++ .../spring-data-cassandra-reactive/pom.xml | 5 +++++ persistence-modules/spring-data-cassandra/pom.xml | 5 +++++ persistence-modules/spring-data-cosmosdb/pom.xml | 5 +++++ persistence-modules/spring-data-dynamodb/pom.xml | 5 +++++ persistence-modules/spring-data-elasticsearch/pom.xml | 5 +++++ persistence-modules/spring-data-jdbc/pom.xml | 7 +++++++ persistence-modules/spring-data-jpa-annotations/pom.xml | 5 +++++ persistence-modules/spring-data-jpa-crud/pom.xml | 5 +++++ persistence-modules/spring-data-jpa-enterprise/pom.xml | 5 +++++ persistence-modules/spring-data-jpa-filtering/pom.xml | 5 +++++ persistence-modules/spring-data-jpa-query-2/pom.xml | 6 ++++++ persistence-modules/spring-data-jpa-query/pom.xml | 5 +++++ persistence-modules/spring-data-jpa-repo-2/pom.xml | 5 +++++ persistence-modules/spring-data-jpa-repo/pom.xml | 6 ++++++ persistence-modules/spring-data-keyvalue/pom.xml | 6 ++++++ persistence-modules/spring-data-mongodb/pom.xml | 5 +++++ persistence-modules/spring-data-redis/pom.xml | 5 +++++ persistence-modules/spring-data-solr/pom.xml | 5 +++++ persistence-modules/spring-hibernate4/pom.xml | 5 +++++ persistence-modules/spring-jdbc/pom.xml | 5 +++++ 33 files changed, 160 insertions(+), 10 deletions(-) diff --git a/persistence-modules/apache-bookkeeper/pom.xml b/persistence-modules/apache-bookkeeper/pom.xml index 0beea7f1fc..32467b9997 100644 --- a/persistence-modules/apache-bookkeeper/pom.xml +++ b/persistence-modules/apache-bookkeeper/pom.xml @@ -11,9 +11,8 @@ com.baeldung - parent-modules + persistence-modules 1.0.0-SNAPSHOT - ../../ diff --git a/persistence-modules/deltaspike/pom.xml b/persistence-modules/deltaspike/pom.xml index 871bacd18b..955ad4abe8 100644 --- a/persistence-modules/deltaspike/pom.xml +++ b/persistence-modules/deltaspike/pom.xml @@ -188,13 +188,6 @@ provided - - - junit - junit - test - - org.apache.commons diff --git a/persistence-modules/flyway-repair/pom.xml b/persistence-modules/flyway-repair/pom.xml index 5a5c4103f6..82e5d705f9 100644 --- a/persistence-modules/flyway-repair/pom.xml +++ b/persistence-modules/flyway-repair/pom.xml @@ -75,6 +75,11 @@ src/main/resources/application-${spring-boot.run.profiles}.properties + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/flyway/pom.xml b/persistence-modules/flyway/pom.xml index f2e393abbf..2379f996d7 100644 --- a/persistence-modules/flyway/pom.xml +++ b/persistence-modules/flyway/pom.xml @@ -65,6 +65,11 @@ 5.2.3 5.0.2 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/jpa-hibernate-cascade-type/pom.xml b/persistence-modules/jpa-hibernate-cascade-type/pom.xml index 1fc119592c..e8117290b0 100644 --- a/persistence-modules/jpa-hibernate-cascade-type/pom.xml +++ b/persistence-modules/jpa-hibernate-cascade-type/pom.xml @@ -4,6 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 jpa-hibernate-cascade-type + com.baeldung persistence-modules diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 4e46c9204b..def2deb941 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -92,5 +92,10 @@ 5.2.17.Final + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/r2dbc/pom.xml b/persistence-modules/r2dbc/pom.xml index 119d0547e3..7083eea64d 100644 --- a/persistence-modules/r2dbc/pom.xml +++ b/persistence-modules/r2dbc/pom.xml @@ -68,6 +68,11 @@ 0.8.1.RELEASE 1.4.200 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/redis/pom.xml b/persistence-modules/redis/pom.xml index e4c5eb4002..9e00566767 100644 --- a/persistence-modules/redis/pom.xml +++ b/persistence-modules/redis/pom.xml @@ -61,6 +61,11 @@ 3.13.1 3.3.0 4.1.50.Final + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-boot-mysql/pom.xml b/persistence-modules/spring-boot-mysql/pom.xml index 9f6ec73522..9b8c6d0028 100644 --- a/persistence-modules/spring-boot-mysql/pom.xml +++ b/persistence-modules/spring-boot-mysql/pom.xml @@ -39,6 +39,11 @@ 8.0.12 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-boot-persistence-2/pom.xml b/persistence-modules/spring-boot-persistence-2/pom.xml index e90d61fda3..ca6ec93340 100644 --- a/persistence-modules/spring-boot-persistence-2/pom.xml +++ b/persistence-modules/spring-boot-persistence-2/pom.xml @@ -17,6 +17,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.boot spring-boot-dependencies @@ -36,7 +43,6 @@ jdbi3-sqlobject ${jdbi.version} - diff --git a/persistence-modules/spring-boot-persistence-h2/pom.xml b/persistence-modules/spring-boot-persistence-h2/pom.xml index 9e6c780931..23520a3fda 100644 --- a/persistence-modules/spring-boot-persistence-h2/pom.xml +++ b/persistence-modules/spring-boot-persistence-h2/pom.xml @@ -46,6 +46,11 @@ com.baeldung.h2db.demo.server.SpringBootApp 1.0.4 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-boot-persistence-mongodb/pom.xml b/persistence-modules/spring-boot-persistence-mongodb/pom.xml index de52a4b2d6..69ef09356d 100644 --- a/persistence-modules/spring-boot-persistence-mongodb/pom.xml +++ b/persistence-modules/spring-boot-persistence-mongodb/pom.xml @@ -36,4 +36,10 @@ + + + 2.22.2 + 5.6.2 + 4.13 + \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml index 9e44a7b9c1..b034f6dad9 100644 --- a/persistence-modules/spring-boot-persistence/pom.xml +++ b/persistence-modules/spring-boot-persistence/pom.xml @@ -76,6 +76,11 @@ 2.23.0 2.0.1.Final + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-cassandra-reactive/pom.xml b/persistence-modules/spring-data-cassandra-reactive/pom.xml index 16486bf380..42329e03f0 100644 --- a/persistence-modules/spring-data-cassandra-reactive/pom.xml +++ b/persistence-modules/spring-data-cassandra-reactive/pom.xml @@ -53,6 +53,11 @@ 2.2.6.RELEASE 3.11.2.0 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-cassandra/pom.xml b/persistence-modules/spring-data-cassandra/pom.xml index b44324dc46..a56d067a05 100644 --- a/persistence-modules/spring-data-cassandra/pom.xml +++ b/persistence-modules/spring-data-cassandra/pom.xml @@ -104,6 +104,11 @@ 2.1.9.2 2.1.9.2 2.0-0 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml index 75cc830578..0f9e8ac72f 100644 --- a/persistence-modules/spring-data-cosmosdb/pom.xml +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -16,6 +16,11 @@ 1.8 2.3.0 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-dynamodb/pom.xml b/persistence-modules/spring-data-dynamodb/pom.xml index 377e35b635..0f4b578088 100644 --- a/persistence-modules/spring-data-dynamodb/pom.xml +++ b/persistence-modules/spring-data-dynamodb/pom.xml @@ -182,6 +182,11 @@ 1.11.86 https://s3-us-west-2.amazonaws.com/dynamodb-local/release 3.1.1 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml index 6a983145ee..c94962d39d 100644 --- a/persistence-modules/spring-data-elasticsearch/pom.xml +++ b/persistence-modules/spring-data-elasticsearch/pom.xml @@ -69,5 +69,10 @@ 1.2.47 0.7 1.15.0 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jdbc/pom.xml b/persistence-modules/spring-data-jdbc/pom.xml index ff034104d7..eca8037e20 100644 --- a/persistence-modules/spring-data-jdbc/pom.xml +++ b/persistence-modules/spring-data-jdbc/pom.xml @@ -26,4 +26,11 @@ runtime + + + + 2.22.2 + 5.6.2 + 4.13 + diff --git a/persistence-modules/spring-data-jpa-annotations/pom.xml b/persistence-modules/spring-data-jpa-annotations/pom.xml index 67b788c404..ea2fe34f3c 100644 --- a/persistence-modules/spring-data-jpa-annotations/pom.xml +++ b/persistence-modules/spring-data-jpa-annotations/pom.xml @@ -72,6 +72,11 @@ 1.10.6 42.2.5 21.0 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/pom.xml b/persistence-modules/spring-data-jpa-crud/pom.xml index 1708d14fc2..44944298e0 100644 --- a/persistence-modules/spring-data-jpa-crud/pom.xml +++ b/persistence-modules/spring-data-jpa-crud/pom.xml @@ -66,6 +66,11 @@ 1.4.1 21.0 1.12.2 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-jpa-enterprise/pom.xml b/persistence-modules/spring-data-jpa-enterprise/pom.xml index 093059ad78..6d9fc41df6 100644 --- a/persistence-modules/spring-data-jpa-enterprise/pom.xml +++ b/persistence-modules/spring-data-jpa-enterprise/pom.xml @@ -102,6 +102,11 @@ 1.3.1.Final 21.0 1.12.2 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-jpa-filtering/pom.xml b/persistence-modules/spring-data-jpa-filtering/pom.xml index 2039ef1a37..7448a5a818 100644 --- a/persistence-modules/spring-data-jpa-filtering/pom.xml +++ b/persistence-modules/spring-data-jpa-filtering/pom.xml @@ -72,6 +72,11 @@ 1.10.6 42.2.5 21.0 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/pom.xml b/persistence-modules/spring-data-jpa-query-2/pom.xml index 22cd373c95..231640284e 100644 --- a/persistence-modules/spring-data-jpa-query-2/pom.xml +++ b/persistence-modules/spring-data-jpa-query-2/pom.xml @@ -30,4 +30,10 @@ + + + 2.22.2 + 5.6.2 + 4.13 + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query/pom.xml b/persistence-modules/spring-data-jpa-query/pom.xml index 71498143c3..fe42d4b595 100644 --- a/persistence-modules/spring-data-jpa-query/pom.xml +++ b/persistence-modules/spring-data-jpa-query/pom.xml @@ -43,6 +43,11 @@ 1.4.1 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-2/pom.xml b/persistence-modules/spring-data-jpa-repo-2/pom.xml index 855b441074..98ecdc6645 100644 --- a/persistence-modules/spring-data-jpa-repo-2/pom.xml +++ b/persistence-modules/spring-data-jpa-repo-2/pom.xml @@ -43,5 +43,10 @@ 29.0-jre + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/pom.xml b/persistence-modules/spring-data-jpa-repo/pom.xml index 984bc1bdff..07514e9771 100644 --- a/persistence-modules/spring-data-jpa-repo/pom.xml +++ b/persistence-modules/spring-data-jpa-repo/pom.xml @@ -49,4 +49,10 @@ + + + 2.22.2 + 5.6.2 + 4.13 + \ No newline at end of file diff --git a/persistence-modules/spring-data-keyvalue/pom.xml b/persistence-modules/spring-data-keyvalue/pom.xml index b28773c414..190d6c7445 100644 --- a/persistence-modules/spring-data-keyvalue/pom.xml +++ b/persistence-modules/spring-data-keyvalue/pom.xml @@ -28,4 +28,10 @@ + + + 2.22.2 + 5.6.2 + 4.13 + \ No newline at end of file diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index 60e59f5186..a3a81fe450 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -107,6 +107,11 @@ 4.1.0 3.2.0.RELEASE 4.0.5 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-redis/pom.xml b/persistence-modules/spring-data-redis/pom.xml index d271df31c7..34674dc223 100644 --- a/persistence-modules/spring-data-redis/pom.xml +++ b/persistence-modules/spring-data-redis/pom.xml @@ -98,6 +98,11 @@ 3.2.4 0.10.0 0.6 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-data-solr/pom.xml b/persistence-modules/spring-data-solr/pom.xml index 5386c4f9e1..94a796c466 100644 --- a/persistence-modules/spring-data-solr/pom.xml +++ b/persistence-modules/spring-data-solr/pom.xml @@ -45,6 +45,11 @@ 2.0.5.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/pom.xml b/persistence-modules/spring-hibernate4/pom.xml index 5e931d5cff..3e5a6f913f 100644 --- a/persistence-modules/spring-hibernate4/pom.xml +++ b/persistence-modules/spring-hibernate4/pom.xml @@ -156,6 +156,11 @@ 19.0 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/persistence-modules/spring-jdbc/pom.xml b/persistence-modules/spring-jdbc/pom.xml index 4ac5239318..77200cd66e 100644 --- a/persistence-modules/spring-jdbc/pom.xml +++ b/persistence-modules/spring-jdbc/pom.xml @@ -37,5 +37,10 @@ 2.0.3.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file From b800a844fd4e7400ec69ea0be05aabec4456874d Mon Sep 17 00:00:00 2001 From: Krzysiek Date: Wed, 23 Sep 2020 20:14:15 +0200 Subject: [PATCH 0806/1862] JAVA-2974: Clean up the pom.xml in spring-data-jpa-enterprise --- persistence-modules/spring-data-jpa-enterprise/pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/persistence-modules/spring-data-jpa-enterprise/pom.xml b/persistence-modules/spring-data-jpa-enterprise/pom.xml index 093059ad78..756ea59702 100644 --- a/persistence-modules/spring-data-jpa-enterprise/pom.xml +++ b/persistence-modules/spring-data-jpa-enterprise/pom.xml @@ -95,10 +95,6 @@ - 2.1.9.RELEASE - com.baeldung.springdatageode.app.ClientCacheApp - 1.1.1.RELEASE - 2.1.9.RELEASE 1.3.1.Final 21.0 1.12.2 From 027cba8b8bdf26b9cf21254d08eb7f6e80c84ab1 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 02:39:41 +0800 Subject: [PATCH 0807/1862] Update README.md --- java-collections-conversions-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-collections-conversions-2/README.md b/java-collections-conversions-2/README.md index 9d0ba88cbf..628421b0e2 100644 --- a/java-collections-conversions-2/README.md +++ b/java-collections-conversions-2/README.md @@ -7,4 +7,5 @@ This module contains articles about conversions among Collection types and array - [Array to String Conversions](https://www.baeldung.com/java-array-to-string) - [Mapping Lists with ModelMapper](https://www.baeldung.com/java-modelmapper-lists) - [Converting List to Map With a Custom Supplier](https://www.baeldung.com/list-to-map-supplier) +- [Arrays.asList vs new ArrayList(Arrays.asList())](https://www.baeldung.com/java-arrays-aslist-vs-new-arraylist) - More articles: [[<-- prev]](../java-collections-conversions) From 14965826eb20c8b08a9054451297af45375e82a6 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 02:49:18 +0800 Subject: [PATCH 0808/1862] Update README.md --- spring-boot-modules/spring-boot-mvc-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-mvc-3/README.md b/spring-boot-modules/spring-boot-mvc-3/README.md index 6627bd8eea..796ab72425 100644 --- a/spring-boot-modules/spring-boot-mvc-3/README.md +++ b/spring-boot-modules/spring-boot-mvc-3/README.md @@ -7,4 +7,5 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Circular View Path Error](https://www.baeldung.com/spring-circular-view-path-error) - [Download an Image or a File with Spring MVC](https://www.baeldung.com/spring-controller-return-image-file) - [Spring MVC Async vs Spring WebFlux](https://www.baeldung.com/spring-mvc-async-vs-webflux) +- [Differences in @Valid and @Validated Annotations in Spring](https://www.baeldung.com/spring-valid-vs-validated) - More articles: [[prev -->]](/spring-boot-modules/spring-boot-mvc-2) From 7e0a8329a255376e859a2ca288d6ff2403192fbf Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 02:53:02 +0800 Subject: [PATCH 0809/1862] Create README.md --- core-groovy-strings/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core-groovy-strings/README.md diff --git a/core-groovy-strings/README.md b/core-groovy-strings/README.md new file mode 100644 index 0000000000..2f49f47cf9 --- /dev/null +++ b/core-groovy-strings/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [How to Remove a Prefix From Strings in Groovy](https://www.baeldung.com/groovy-remove-string-prefix) From 46c071b40bf68f394855dd4486e325a7cf0e15e3 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 02:55:21 +0800 Subject: [PATCH 0810/1862] Update README.md --- core-java-modules/core-java-networking-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-networking-2/README.md b/core-java-modules/core-java-networking-2/README.md index dbda8bdc7c..fa49c35bf8 100644 --- a/core-java-modules/core-java-networking-2/README.md +++ b/core-java-modules/core-java-networking-2/README.md @@ -13,4 +13,5 @@ This module contains articles about networking in Java - [Download a File from an URL in Java](https://www.baeldung.com/java-download-file) - [Handling java.net.ConnectException](https://www.baeldung.com/java-net-connectexception) - [Getting MAC addresses in Java](https://www.baeldung.com/java-mac-address) +- [Sending Emails with Attachments in Java](https://www.baeldung.com/java-send-emails-attachments) - [[<-- Prev]](/core-java-modules/core-java-networking) From 95549836ec4476b1aaa837fbb33cf9b913e4f373 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 03:32:03 +0800 Subject: [PATCH 0811/1862] Update README.md --- spring-mvc-basics-4/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-mvc-basics-4/README.md b/spring-mvc-basics-4/README.md index 19cb9059ed..0da83540ad 100644 --- a/spring-mvc-basics-4/README.md +++ b/spring-mvc-basics-4/README.md @@ -8,4 +8,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Model, ModelMap, and ModelView in Spring MVC](https://www.baeldung.com/spring-mvc-model-model-map-model-view) - [Spring Web Contexts](https://www.baeldung.com/spring-web-contexts) - [Spring Optional Path variables](https://www.baeldung.com/spring-optional-path-variables) -- More articles: [[<-- prev]](/spring-mvc-basics-3) \ No newline at end of file +- [JSON Parameters with Spring MVC](https://www.baeldung.com/spring-mvc-send-json-parameters) +- More articles: [[<-- prev]](/spring-mvc-basics-3) From 2ba94bd15408e394ffeefc2d97315734f164d2a0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 03:34:17 +0800 Subject: [PATCH 0812/1862] Create README.md --- testing-modules/testing-libraries-2/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 testing-modules/testing-libraries-2/README.md diff --git a/testing-modules/testing-libraries-2/README.md b/testing-modules/testing-libraries-2/README.md new file mode 100644 index 0000000000..3325600b5e --- /dev/null +++ b/testing-modules/testing-libraries-2/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Guide to the System Rules Library](https://www.baeldung.com/java-system-rules-junit) From 4575ad984632801664636dacf90e9b71308c62df Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 03:36:26 +0800 Subject: [PATCH 0813/1862] Update README.md --- json/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/json/README.md b/json/README.md index 0e50dcfddb..6ad4c8a29d 100644 --- a/json/README.md +++ b/json/README.md @@ -13,3 +13,4 @@ This module contains articles about JSON. - [Get a Value by Key in a JSONArray](https://www.baeldung.com/java-jsonarray-get-value-by-key) - [Iterating Over an Instance of org.json.JSONObject](https://www.baeldung.com/jsonobject-iteration) - [Escape JSON String in Java](https://www.baeldung.com/java-json-escaping) +- [Reducing JSON Data Size](https://www.baeldung.com/json-reduce-data-size) From bea5c242afe1405842ca5d391c8b8b5a0b773086 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 03:39:09 +0800 Subject: [PATCH 0814/1862] Update README.md --- core-java-modules/core-java-reflection-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-reflection-2/README.md b/core-java-modules/core-java-reflection-2/README.md index e5ddb7a8b8..1668eeade3 100644 --- a/core-java-modules/core-java-reflection-2/README.md +++ b/core-java-modules/core-java-reflection-2/README.md @@ -2,3 +2,4 @@ - [Reading the Value of ‘private’ Fields from a Different Class in Java](https://www.baeldung.com/java-reflection-read-private-field-value) - [Set Field Value With Reflection](https://www.baeldung.com/java-set-private-field-value) +- [Checking If a Method is Static Using Reflection in Java](https://www.baeldung.com/java-check-method-is-static) From 86876c57d1a94788991e19951fd77c056e21ceae Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 24 Sep 2020 03:40:31 +0800 Subject: [PATCH 0815/1862] Update README.md --- core-java-modules/core-java-lang-oop-methods/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-oop-methods/README.md b/core-java-modules/core-java-lang-oop-methods/README.md index afceaded9a..43eab24003 100644 --- a/core-java-modules/core-java-lang-oop-methods/README.md +++ b/core-java-modules/core-java-lang-oop-methods/README.md @@ -9,3 +9,4 @@ This module contains articles about methods in Java - [Java equals() and hashCode() Contracts](https://www.baeldung.com/java-equals-hashcode-contracts) - [Guide to hashCode() in Java](https://www.baeldung.com/java-hashcode) - [The Covariant Return Type in Java](https://www.baeldung.com/java-covariant-return-type) +- [Does a Method’s Signature Include the Return Type in Java?](https://www.baeldung.com/java-method-signature-return-type) From 17369c4b7733cfb09fd5be036faae1d350fddf07 Mon Sep 17 00:00:00 2001 From: Tarun Jain Date: Thu, 24 Sep 2020 03:02:04 +0530 Subject: [PATCH 0816/1862] BAEL-4404|Updated test class name --- ...rollerTest.java => CharEncodingCheckControllerUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/{CharEncodingCheckControllerTest.java => CharEncodingCheckControllerUnitTest.java} (96%) diff --git a/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerTest.java b/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerUnitTest.java similarity index 96% rename from spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerTest.java rename to spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerUnitTest.java index 25f257eced..6dcbfe390f 100644 --- a/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerTest.java +++ b/spring-boot-modules/spring-boot-mvc-3/src/test/java/com/baeldung/charencoding/controller/CharEncodingCheckControllerUnitTest.java @@ -13,7 +13,7 @@ import javax.servlet.http.HttpServletResponse; import org.junit.jupiter.api.Test; import org.springframework.web.filter.CharacterEncodingFilter; -class CharEncodingCheckControllerTest { +class CharEncodingCheckControllerUnitTest { @Test void whenCharEncodingFilter_thenVerifyEncoding() throws ServletException, IOException { From bea3fccca7a72a9e1857aae9a4dbcdc25b6de3b0 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Wed, 23 Sep 2020 21:50:39 -0500 Subject: [PATCH 0817/1862] BAEL-4327 update README (#10084) * BAEL-3336 BAEL-3058 add links * BAEL-3319: add link * BAEL-3284: add link * BAEL-3198: add link to article * BAEL-3479: add link to article * BAEL-3485: add article link * SCALA-38: move to new package and add link back to article * SCALA-38: add imports back into unit test * BAEL-3908: add link back to article * BAEL-2893 BAEL-3927 add link back to article * BAEL-3569: update README * BAEL-4327: update README --- spring-mvc-basics-4/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-mvc-basics-4/README.md b/spring-mvc-basics-4/README.md index 19cb9059ed..0da83540ad 100644 --- a/spring-mvc-basics-4/README.md +++ b/spring-mvc-basics-4/README.md @@ -8,4 +8,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Model, ModelMap, and ModelView in Spring MVC](https://www.baeldung.com/spring-mvc-model-model-map-model-view) - [Spring Web Contexts](https://www.baeldung.com/spring-web-contexts) - [Spring Optional Path variables](https://www.baeldung.com/spring-optional-path-variables) -- More articles: [[<-- prev]](/spring-mvc-basics-3) \ No newline at end of file +- [JSON Parameters with Spring MVC](https://www.baeldung.com/spring-mvc-send-json-parameters) +- More articles: [[<-- prev]](/spring-mvc-basics-3) From d100adc9c59ef660da247d4786ccfd45197ea09b Mon Sep 17 00:00:00 2001 From: Joe Boudreau Date: Thu, 24 Sep 2020 12:28:05 -0400 Subject: [PATCH 0818/1862] BAEL-4448: Added examples for setting TLS version in HttpClient (#9936) * [BAEL-4448] Added examples for setting TLS version in HttpClient (cherry picked from commit f4d40fc3f3140fd046ed957030e9a54582bd4a67) * [BAEL-4448] Simplified the code for one example * [BAEL-4448] Formatting fixes and moved to new package * [BAEL-4448] Forgot an import and fixed class name typo * [BAEL-4448] Created second module for httpclient and moved article code Co-authored-by: joe --- httpclient-2/.gitignore | 13 ++++ httpclient-2/README.md | 12 ++++ httpclient-2/pom.xml | 43 +++++++++++++ .../tlsversion/ClientTlsVersionExamples.java | 64 +++++++++++++++++++ httpclient/README.md | 1 + pom.xml | 2 + 6 files changed, 135 insertions(+) create mode 100644 httpclient-2/.gitignore create mode 100644 httpclient-2/README.md create mode 100644 httpclient-2/pom.xml create mode 100644 httpclient-2/src/main/java/com/baeldung/tlsversion/ClientTlsVersionExamples.java diff --git a/httpclient-2/.gitignore b/httpclient-2/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/httpclient-2/.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/httpclient-2/README.md b/httpclient-2/README.md new file mode 100644 index 0000000000..52d8b8fcff --- /dev/null +++ b/httpclient-2/README.md @@ -0,0 +1,12 @@ +## HttpClient 4.x + +This module contains articles about HttpClient 4.x + +### The Course + +The "REST With Spring" Classes: http://bit.ly/restwithspring + +### Relevant Articles: + +- [How to Set TLS Version in Apache HttpClient](https://www.baeldung.com/TODO) +- More articles: [[<-- prev]](../httpclient) diff --git a/httpclient-2/pom.xml b/httpclient-2/pom.xml new file mode 100644 index 0000000000..1a27d9b5fe --- /dev/null +++ b/httpclient-2/pom.xml @@ -0,0 +1,43 @@ + + + 4.0.0 + httpclient-2 + 0.1-SNAPSHOT + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../parent-java + + + + + org.apache.httpcomponents + httpclient + ${httpclient.version} + + + commons-logging + commons-logging + + + + + + + httpclient-2 + + + src/main/resources + true + + + + + + 4.5.8 + + + \ No newline at end of file diff --git a/httpclient-2/src/main/java/com/baeldung/tlsversion/ClientTlsVersionExamples.java b/httpclient-2/src/main/java/com/baeldung/tlsversion/ClientTlsVersionExamples.java new file mode 100644 index 0000000000..c58763b1c0 --- /dev/null +++ b/httpclient-2/src/main/java/com/baeldung/tlsversion/ClientTlsVersionExamples.java @@ -0,0 +1,64 @@ +package com.baeldung.tlsversion; + +import javax.net.ssl.SSLSocket; + +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContexts; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; + +public class ClientTlsVersionExamples { + + public static CloseableHttpClient setViaSocketFactory() { + SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( + SSLContexts.createDefault(), + new String[] { "TLSv1.2", "TLSv1.3" }, + null, + SSLConnectionSocketFactory.getDefaultHostnameVerifier()); + + return HttpClients.custom().setSSLSocketFactory(sslsf).build(); + } + + public static CloseableHttpClient setTlsVersionPerConnection() { + SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(SSLContexts.createDefault()) { + + @Override + protected void prepareSocket(SSLSocket socket) { + String hostname = socket.getInetAddress().getHostName(); + if (hostname.endsWith("internal.system.com")) { + socket.setEnabledProtocols(new String[] { "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3" }); + } else { + socket.setEnabledProtocols(new String[] { "TLSv1.3" }); + } + } + }; + + return HttpClients.custom().setSSLSocketFactory(sslsf).build(); + } + + // To configure the TLS versions for the client, set the https.protocols system property during runtime. + // For example: java -Dhttps.protocols=TLSv1.1,TLSv1.2,TLSv1.3 -jar webClient.jar + public static CloseableHttpClient setViaSystemProperties() { + return HttpClients.createSystem(); + // Alternatively: + // return HttpClients.custom().useSystemProperties().build(); + } + + public static void main(String[] args) throws IOException { + // Alternatively: + // CloseableHttpClient httpClient = setTlsVersionPerConnection(); + // CloseableHttpClient httpClient = setViaSystemProperties(); + try (CloseableHttpClient httpClient = setViaSocketFactory(); + CloseableHttpResponse response = httpClient.execute(new HttpGet("https://httpbin.org/"))) { + + HttpEntity entity = response.getEntity(); + EntityUtils.consume(entity); + } + } +} \ No newline at end of file diff --git a/httpclient/README.md b/httpclient/README.md index d88739e901..23fe7c7271 100644 --- a/httpclient/README.md +++ b/httpclient/README.md @@ -18,3 +18,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Advanced HttpClient Configuration](https://www.baeldung.com/httpclient-advanced-config) - [HttpClient 4 – Do Not Follow Redirects](https://www.baeldung.com/httpclient-stop-follow-redirect) - [Custom User-Agent in HttpClient 4](https://www.baeldung.com/httpclient-user-agent-header) +- More articles: [[next -->]](../httpclient-2) diff --git a/pom.xml b/pom.xml index 6553716d63..065d6abbdd 100644 --- a/pom.xml +++ b/pom.xml @@ -424,6 +424,7 @@ hazelcast helidon httpclient + httpclient-2 httpclient-simple hystrix @@ -935,6 +936,7 @@ hazelcast helidon httpclient + httpclient-2 httpclient-simple hystrix From 0fd213eb5d5874ccf1c93d38911e9e9c2ceab154 Mon Sep 17 00:00:00 2001 From: mikr Date: Thu, 24 Sep 2020 19:13:13 +0200 Subject: [PATCH 0819/1862] Java-82 Fix test (change port) --- .../baeldung/reactive/security/SpringSecurity5Application.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java index d315bf8238..bb0f007ada 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SpringSecurity5Application.java @@ -28,7 +28,7 @@ public class SpringSecurity5Application { HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context) .build(); ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler); - HttpServer httpServer = HttpServer.create().host("localhost").port(8080); + HttpServer httpServer = HttpServer.create().host("localhost").port(8083); return httpServer.handle(adapter).bindNow(); } From b5d49958eb8a20250e774e872d037abee64972da Mon Sep 17 00:00:00 2001 From: Liu Chuang Date: Fri, 25 Sep 2020 15:12:35 +0800 Subject: [PATCH 0820/1862] Update MaxSizeConstraintValidator.java --- .../constraint/MaxSizeConstraintValidator.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java index 0154fb636a..7e725a3981 100644 --- a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java +++ b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java @@ -11,11 +11,7 @@ public class MaxSizeConstraintValidator implements ConstraintValidator values, ConstraintValidatorContext context) { - boolean isValid = true; - if (values.size() > 4) { - isValid = false; - } - return isValid; + return value.size()<=4 } } From c245528f3d78c400c0ccd9f91551af0d45455863 Mon Sep 17 00:00:00 2001 From: Liu Chuang Date: Fri, 25 Sep 2020 15:14:41 +0800 Subject: [PATCH 0821/1862] Update MaxSizeConstraintValidator.java --- .../listvalidation/constraint/MaxSizeConstraintValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java index 7e725a3981..524e98a39e 100644 --- a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java +++ b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java @@ -11,7 +11,7 @@ public class MaxSizeConstraintValidator implements ConstraintValidator values, ConstraintValidatorContext context) { - return value.size()<=4 + return values.size()<=4 } } From 68272ef58fde5cedff32e2d9f1dc8e27aacf1864 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 25 Sep 2020 13:17:43 +0200 Subject: [PATCH 0822/1862] BAEL-4641: Use MapStruct 1.3.1.Final (#10088) --- mapstruct/pom.xml | 2 +- .../mappingCollections/mapper/CompanyMapperAdderPreferred.java | 3 ++- .../mapstruct/mappingCollections/mapper/EmployeeMapper.java | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mapstruct/pom.xml b/mapstruct/pom.xml index 9fe6ab6485..9b416177e7 100644 --- a/mapstruct/pom.xml +++ b/mapstruct/pom.xml @@ -71,7 +71,7 @@ - 1.4.0.Beta1 + 1.3.1.Final 4.3.4.RELEASE 1.8 1.8 diff --git a/mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/mapper/CompanyMapperAdderPreferred.java b/mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/mapper/CompanyMapperAdderPreferred.java index e5cc43074e..094d87351a 100644 --- a/mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/mapper/CompanyMapperAdderPreferred.java +++ b/mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/mapper/CompanyMapperAdderPreferred.java @@ -5,7 +5,8 @@ import com.baeldung.mapstruct.mappingCollections.model.Company; import org.mapstruct.CollectionMappingStrategy; import org.mapstruct.Mapper; -@Mapper(collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED) +@Mapper(collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED, + uses = EmployeeMapper.class) public interface CompanyMapperAdderPreferred { CompanyDTO map(Company company); diff --git a/mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/mapper/EmployeeMapper.java b/mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/mapper/EmployeeMapper.java index 45bf76c5a4..4a723f049a 100644 --- a/mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/mapper/EmployeeMapper.java +++ b/mapstruct/src/main/java/com/baeldung/mapstruct/mappingCollections/mapper/EmployeeMapper.java @@ -11,6 +11,8 @@ import java.util.Set; @Mapper public interface EmployeeMapper { + EmployeeDTO map(Employee employee); + List map(List employees); Set map(Set employees); From 725a7b2a7aba4ed53b614d4c306aabb3c5063a22 Mon Sep 17 00:00:00 2001 From: azhwani <> Date: Fri, 25 Sep 2020 18:40:26 +0100 Subject: [PATCH 0823/1862] Add cleanUp --- .../lastmodifiedfile/LastModifiedFileAppUnitTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java index 4e1f7719a9..fe704c3c40 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/lastmodifiedfile/LastModifiedFileAppUnitTest.java @@ -9,6 +9,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -57,8 +58,7 @@ public class LastModifiedFileAppUnitTest { Path lastModPath = LastModifiedFileApp.findUsingNIOApi(SOURCEDIRECTORY); assertThat(lastModPath).isNotNull(); - assertThat(lastModPath.toFile() - .getName()).isEqualTo("file02.txt"); + assertThat(lastModPath.toFile().getName()).isEqualTo("file02.txt"); } @Test @@ -69,4 +69,10 @@ public class LastModifiedFileAppUnitTest { assertThat(lastModFile.getName()).isEqualTo("file02.txt"); } + @AfterAll + public static void cleanUp() throws IOException { + File srcDir = new File(SOURCEDIRECTORY); + FileUtils.deleteDirectory(srcDir); + } + } \ No newline at end of file From 32f4eeef0207f19f217c6c92b78e906fb6b65ed6 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Fri, 25 Sep 2020 23:39:32 +0200 Subject: [PATCH 0824/1862] BAEL-4520 Getting Started with jOOQ (#10086) * BAEL-4520 Getting Started with jOOQ * add generated sources * remove maven files * create tests Co-authored-by: Krzysztof Majewski --- persistence-modules/jooq/pom.xml | 46 ++++ .../src/main/java/com/baeldung/jooq/Crud.java | 57 ++++ .../java/com/baeldung/jooq/CrudExamples.java | 117 ++++++++ .../baeldung/jooq/model/DefaultCatalog.java | 44 +++ .../java/com/baeldung/jooq/model/Keys.java | 48 ++++ .../java/com/baeldung/jooq/model/Public.java | 59 ++++ .../java/com/baeldung/jooq/model/Tables.java | 25 ++ .../baeldung/jooq/model/tables/Article.java | 159 +++++++++++ .../baeldung/jooq/model/tables/Author.java | 149 ++++++++++ .../model/tables/records/ArticleRecord.java | 218 +++++++++++++++ .../model/tables/records/AuthorRecord.java | 217 +++++++++++++++ .../java/com/baeldung/jooq/CrudLiveTest.java | 257 ++++++++++++++++++ persistence-modules/pom.xml | 1 + 13 files changed, 1397 insertions(+) create mode 100644 persistence-modules/jooq/pom.xml create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/DefaultCatalog.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Keys.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Public.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Tables.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/Article.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/Author.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/records/ArticleRecord.java create mode 100644 persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/records/AuthorRecord.java create mode 100644 persistence-modules/jooq/src/test/java/com/baeldung/jooq/CrudLiveTest.java diff --git a/persistence-modules/jooq/pom.xml b/persistence-modules/jooq/pom.xml new file mode 100644 index 0000000000..f0c5a27a96 --- /dev/null +++ b/persistence-modules/jooq/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + jooq + 0.0.1-SNAPSHOT + jooq-examples + jar + jOOQ Examples + + + com.baeldung + persistence-modules + 1.0.0-SNAPSHOT + + + + + org.jooq + jooq + 3.13.4 + + + org.jooq + jooq-meta + 3.13.4 + + + org.jooq + jooq-codegen + 3.13.4 + + + org.postgresql + postgresql + 42.2.16 + + + com.h2database + h2 + 1.4.200 + + + + diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java new file mode 100644 index 0000000000..0427b71c25 --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java @@ -0,0 +1,57 @@ +package com.baeldung.jooq; + +import org.jooq.Condition; +import org.jooq.DSLContext; +import org.jooq.Field; +import org.jooq.Record; +import org.jooq.Result; +import org.jooq.SelectFieldOrAsterisk; +import org.jooq.Table; +import org.jooq.UpdatableRecord; + +import java.util.Map; + +public class Crud { + + public static > void save(UpdatableRecord record) { + record.store(); + } + + public static Result getAll(DSLContext context, Table table) { + return context.select() + .from(table) + .fetch(); + } + + public static Result getFields(DSLContext context, Table table, SelectFieldOrAsterisk... fields) { + return context.select(fields) + .from(table) + .fetch(); + } + + public static R getOne(DSLContext context, Table table, Condition condition) { + return context.fetchOne(table, condition); + } + + public static void update(DSLContext context, Table table, Map, T> values, Condition condition) { + context.update(table) + .set(values) + .where(condition) + .execute(); + } + + public static > void update(UpdatableRecord record) { + record.update(); + } + + public static void delete(DSLContext context, Table table, Condition condition) { + context.delete(table) + .where(condition) + .execute(); + } + + public static > void delete(UpdatableRecord record) { + record.delete(); + } + +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java new file mode 100644 index 0000000000..87a7b6439e --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java @@ -0,0 +1,117 @@ +package com.baeldung.jooq; + +import com.baeldung.jooq.model.tables.Article; +import com.baeldung.jooq.model.tables.Author; +import com.baeldung.jooq.model.tables.records.ArticleRecord; +import com.baeldung.jooq.model.tables.records.AuthorRecord; +import org.jooq.DSLContext; +import org.jooq.Field; +import org.jooq.Record; +import org.jooq.Result; +import org.jooq.SQLDialect; +import org.jooq.impl.DSL; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.HashMap; + +import static com.baeldung.jooq.Crud.delete; +import static com.baeldung.jooq.Crud.getAll; +import static com.baeldung.jooq.Crud.getFields; +import static com.baeldung.jooq.Crud.getOne; +import static com.baeldung.jooq.Crud.save; +import static com.baeldung.jooq.Crud.update; + +public class CrudExamples { + + public void crudExamples() throws SQLException { + String userName = "username"; + String password = "password"; + String url = "jdbc:postgresql://db_url:5432/baeldung_database"; + + Connection conn = DriverManager.getConnection(url, userName, password); + DSLContext context = DSL.using(conn, SQLDialect.POSTGRES); + + createValues(context); + readValues(context); + updateValues(context); + deleteValues(context); + } + + private void createValues(DSLContext context) { + ArticleRecord article = context.newRecord(Article.ARTICLE); + + article.setId(2); + article.setTitle("jOOQ examples"); + article.setDescription("A few examples of jOOQ CRUD operations"); + article.setAuthorId(1); + + save(article); + + AuthorRecord author = context.newRecord(Author.AUTHOR); + author.setId(1); + author.setFirstName("John"); + author.setLastName("Smith"); + author.setAge(40); + + save(author); + } + + private void readValues(DSLContext context) { + Result authors = getAll( + context, + Author.AUTHOR + ); + + authors.forEach(author -> { + Integer id = author.getValue(Author.AUTHOR.ID); + String firstName = author.getValue(Author.AUTHOR.FIRST_NAME); + String lastName = author.getValue(Author.AUTHOR.LAST_NAME); + Integer age = author.getValue(Author.AUTHOR.AGE); + System.out.printf("Author %s %s has id: %d and age: %d%n", firstName, lastName, id, age); + }); + + Result articles = getFields( + context, + Author.AUTHOR, + Article.ARTICLE.ID, Article.ARTICLE.TITLE + ); + + AuthorRecord author = getOne( + context, + Author.AUTHOR, + Author.AUTHOR.ID.eq(1) + ); + } + + private void updateValues(DSLContext context) { + HashMap, String> fieldsToUpdate = new HashMap<>(); + fieldsToUpdate.put(Author.AUTHOR.FIRST_NAME, "David"); + fieldsToUpdate.put(Author.AUTHOR.LAST_NAME, "Brown"); + update( + context, + Author.AUTHOR, + fieldsToUpdate, + Author.AUTHOR.ID.eq(1) + ); + + ArticleRecord article = context.fetchOne(Article.ARTICLE, Article.ARTICLE.ID.eq(1)); + article.setTitle("A New Article Title"); + update( + article + ); + } + + private void deleteValues(DSLContext context) { + delete( + context, + Article.ARTICLE, + Article.ARTICLE.ID.eq(1) + ); + + AuthorRecord author = context.fetchOne(Author.AUTHOR, Author.AUTHOR.ID.eq(1)); + delete(author); + } + +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/DefaultCatalog.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/DefaultCatalog.java new file mode 100644 index 0000000000..b18484877a --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/DefaultCatalog.java @@ -0,0 +1,44 @@ +/* + * This file is generated by jOOQ. + */ +package com.baeldung.jooq.model; + + +import org.jooq.Schema; +import org.jooq.impl.CatalogImpl; + +import java.util.Arrays; +import java.util.List; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class DefaultCatalog extends CatalogImpl { + + private static final long serialVersionUID = 1035293962; + + /** + * The reference instance of DEFAULT_CATALOG + */ + public static final DefaultCatalog DEFAULT_CATALOG = new DefaultCatalog(); + + /** + * The schema public. + */ + public final Public PUBLIC = Public.PUBLIC; + + /** + * No further instances allowed + */ + private DefaultCatalog() { + super(""); + } + + @Override + public final List getSchemas() { + return Arrays.asList( + Public.PUBLIC); + } +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Keys.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Keys.java new file mode 100644 index 0000000000..461ffb58c7 --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Keys.java @@ -0,0 +1,48 @@ +/* + * This file is generated by jOOQ. + */ +package com.baeldung.jooq.model; + + +import com.baeldung.jooq.model.tables.Article; +import com.baeldung.jooq.model.tables.Author; +import com.baeldung.jooq.model.tables.records.ArticleRecord; +import com.baeldung.jooq.model.tables.records.AuthorRecord; +import org.jooq.ForeignKey; +import org.jooq.TableField; +import org.jooq.UniqueKey; +import org.jooq.impl.Internal; + + +/** + * A class modelling foreign key relationships and constraints of tables of + * the public schema. + */ +@SuppressWarnings({"all", "unchecked", "rawtypes"}) +public class Keys { + + // ------------------------------------------------------------------------- + // UNIQUE and PRIMARY KEY definitions + // ------------------------------------------------------------------------- + + public static final UniqueKey ARTICLE_PKEY = UniqueKeys0.ARTICLE_PKEY; + public static final UniqueKey AUTHOR_PKEY = UniqueKeys0.AUTHOR_PKEY; + + // ------------------------------------------------------------------------- + // FOREIGN KEY definitions + // ------------------------------------------------------------------------- + public static final ForeignKey ARTICLE__XXX = ForeignKeys0.ARTICLE__XXX; + + // ------------------------------------------------------------------------- + // [#1459] distribute members to avoid static initialisers > 64kb + // ------------------------------------------------------------------------- + + private static class UniqueKeys0 { + public static final UniqueKey ARTICLE_PKEY = Internal.createUniqueKey(Article.ARTICLE, "article_pkey", new TableField[]{Article.ARTICLE.ID}, true); + public static final UniqueKey AUTHOR_PKEY = Internal.createUniqueKey(Author.AUTHOR, "author_pkey", new TableField[]{Author.AUTHOR.ID}, true); + } + + private static class ForeignKeys0 { + public static final ForeignKey ARTICLE__XXX = Internal.createForeignKey(Keys.AUTHOR_PKEY, Article.ARTICLE, "xxx", new TableField[]{Article.ARTICLE.AUTHOR_ID}, true); + } +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Public.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Public.java new file mode 100644 index 0000000000..02c664522b --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Public.java @@ -0,0 +1,59 @@ +/* + * This file is generated by jOOQ. + */ +package com.baeldung.jooq.model; + +import com.baeldung.jooq.model.tables.Article; +import com.baeldung.jooq.model.tables.Author; +import org.jooq.Catalog; +import org.jooq.Table; +import org.jooq.impl.SchemaImpl; + +import java.util.Arrays; +import java.util.List; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({"all", "unchecked", "rawtypes"}) +public class Public extends SchemaImpl { + + private static final long serialVersionUID = -2049410122; + + /** + * The reference instance of public + */ + public static final Public PUBLIC = new Public(); + + /** + * The table public.article. + */ + public final Article ARTICLE = Article.ARTICLE; + + /** + * The table public.author. + */ + public final Author AUTHOR = Author.AUTHOR; + + /** + * No further instances allowed + */ + private Public() { + super("public", null); + } + + + @Override + public Catalog getCatalog() { + return DefaultCatalog.DEFAULT_CATALOG; + } + + @Override + public final List> getTables() { + return Arrays.>asList( + Article.ARTICLE, + Author.AUTHOR + ); + } +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Tables.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Tables.java new file mode 100644 index 0000000000..eb1f14e05a --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/Tables.java @@ -0,0 +1,25 @@ +/* + * This file is generated by jOOQ. + */ +package com.baeldung.jooq.model; + +import com.baeldung.jooq.model.tables.Article; +import com.baeldung.jooq.model.tables.Author; + +/** + * Convenience access to all tables in public + */ +@SuppressWarnings({"all", "unchecked", "rawtypes"}) +public class Tables { + + /** + * The table public.article. + */ + public static final Article ARTICLE = Article.ARTICLE; + + /** + * The table public.author. + */ + public static final Author AUTHOR = Author.AUTHOR; + +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/Article.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/Article.java new file mode 100644 index 0000000000..3159c91aa8 --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/Article.java @@ -0,0 +1,159 @@ +/* + * This file is generated by jOOQ. + */ +package com.baeldung.jooq.model.tables; + + +import com.baeldung.jooq.model.Keys; +import com.baeldung.jooq.model.Public; +import com.baeldung.jooq.model.tables.records.ArticleRecord; +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row4; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + +import java.util.Arrays; +import java.util.List; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Article extends TableImpl { + + private static final long serialVersionUID = -1401275800; + + /** + * The reference instance of public.article + */ + public static final Article ARTICLE = new Article(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return ArticleRecord.class; + } + + /** + * The column public.article.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, ""); + + /** + * The column public.article.title. + */ + public final TableField TITLE = createField(DSL.name("title"), org.jooq.impl.SQLDataType.VARCHAR(255).nullable(false), this, ""); + + /** + * The column public.article.description. + */ + public final TableField DESCRIPTION = createField(DSL.name("description"), org.jooq.impl.SQLDataType.VARCHAR(255), this, ""); + + /** + * The column public.article.author_id. + */ + public final TableField AUTHOR_ID = createField(DSL.name("author_id"), org.jooq.impl.SQLDataType.INTEGER, this, ""); + + /** + * Create a public.article table reference + */ + public Article() { + this(DSL.name("article"), null); + } + + /** + * Create an aliased public.article table reference + */ + public Article(String alias) { + this(DSL.name(alias), ARTICLE); + } + + /** + * Create an aliased public.article table reference + */ + public Article(Name alias) { + this(alias, ARTICLE); + } + + private Article(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private Article(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table()); + } + + public Article(Table child, ForeignKey key) { + super(child, key, ARTICLE); + } + + @Override + public Schema getSchema() { + return Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.ARTICLE_PKEY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.ARTICLE_PKEY); + } + + @Override + public List> getReferences() { + return Arrays.>asList(Keys.ARTICLE__XXX); + } + + public Author author() { + return new Author(this, Keys.ARTICLE__XXX); + } + + @Override + public Article as(String alias) { + return new Article(DSL.name(alias), this); + } + + @Override + public Article as(Name alias) { + return new Article(alias, this); + } + + /** + * Rename this table + */ + @Override + public Article rename(String name) { + return new Article(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Article rename(Name name) { + return new Article(name, null); + } + + // ------------------------------------------------------------------------- + // Row4 type methods + // ------------------------------------------------------------------------- + + @Override + public Row4 fieldsRow() { + return (Row4) super.fieldsRow(); + } +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/Author.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/Author.java new file mode 100644 index 0000000000..9da9415109 --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/Author.java @@ -0,0 +1,149 @@ +/* + * This file is generated by jOOQ. + */ +package com.baeldung.jooq.model.tables; + +import com.baeldung.jooq.model.Keys; +import com.baeldung.jooq.model.Public; +import com.baeldung.jooq.model.tables.records.AuthorRecord; +import org.jooq.Field; +import org.jooq.ForeignKey; +import org.jooq.Name; +import org.jooq.Record; +import org.jooq.Row4; +import org.jooq.Schema; +import org.jooq.Table; +import org.jooq.TableField; +import org.jooq.TableOptions; +import org.jooq.UniqueKey; +import org.jooq.impl.DSL; +import org.jooq.impl.TableImpl; + +import java.util.Arrays; +import java.util.List; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class Author extends TableImpl { + + private static final long serialVersionUID = -798376522; + + /** + * The reference instance of public.author + */ + public static final Author AUTHOR = new Author(); + + /** + * The class holding records for this type + */ + @Override + public Class getRecordType() { + return AuthorRecord.class; + } + + /** + * The column public.author.id. + */ + public final TableField ID = createField(DSL.name("id"), org.jooq.impl.SQLDataType.INTEGER.nullable(false), AUTHOR, ""); + + /** + * The column public.author.first_name. + */ + public final TableField FIRST_NAME = createField(DSL.name("first_name"), org.jooq.impl.SQLDataType.VARCHAR(255), this, ""); + + /** + * The column public.author.last_name. + */ + public final TableField LAST_NAME = createField(DSL.name("last_name"), org.jooq.impl.SQLDataType.VARCHAR(255), this, ""); + + /** + * The column public.author.age. + */ + public final TableField AGE = createField(DSL.name("age"), org.jooq.impl.SQLDataType.INTEGER, this, ""); + + /** + * Create a public.author table reference + */ + public Author() { + this(DSL.name("author"), null); + } + + /** + * Create an aliased public.author table reference + */ + public Author(String alias) { + this(DSL.name(alias), AUTHOR); + } + + /** + * Create an aliased public.author table reference + */ + public Author(Name alias) { + this(alias, AUTHOR); + } + + private Author(Name alias, Table aliased) { + this(alias, aliased, null); + } + + private Author(Name alias, Table aliased, Field[] parameters) { + super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table()); + } + + public Author(Table child, ForeignKey key) { + super(child, key, AUTHOR); + } + + @Override + public Schema getSchema() { + return Public.PUBLIC; + } + + @Override + public UniqueKey getPrimaryKey() { + return Keys.AUTHOR_PKEY; + } + + @Override + public List> getKeys() { + return Arrays.>asList(Keys.AUTHOR_PKEY); + } + + @Override + public Author as(String alias) { + return new Author(DSL.name(alias), this); + } + + @Override + public Author as(Name alias) { + return new Author(alias, this); + } + + /** + * Rename this table + */ + @Override + public Author rename(String name) { + return new Author(DSL.name(name), null); + } + + /** + * Rename this table + */ + @Override + public Author rename(Name name) { + return new Author(name, null); + } + + // ------------------------------------------------------------------------- + // Row4 type methods + // ------------------------------------------------------------------------- + + @Override + public Row4 fieldsRow() { + return (Row4) super.fieldsRow(); + } +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/records/ArticleRecord.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/records/ArticleRecord.java new file mode 100644 index 0000000000..cee17fe716 --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/records/ArticleRecord.java @@ -0,0 +1,218 @@ +/* + * This file is generated by jOOQ. + */ +package com.baeldung.jooq.model.tables.records; + + +import com.baeldung.jooq.model.tables.Article; + +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record4; +import org.jooq.Row4; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class ArticleRecord extends UpdatableRecordImpl implements Record4 { + + private static final long serialVersionUID = 1297442421; + + /** + * Setter for public.article.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for public.article.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for public.article.title. + */ + public void setTitle(String value) { + set(1, value); + } + + /** + * Getter for public.article.title. + */ + public String getTitle() { + return (String) get(1); + } + + /** + * Setter for public.article.description. + */ + public void setDescription(String value) { + set(2, value); + } + + /** + * Getter for public.article.description. + */ + public String getDescription() { + return (String) get(2); + } + + /** + * Setter for public.article.author_id. + */ + public void setAuthorId(Integer value) { + set(3, value); + } + + /** + * Getter for public.article.author_id. + */ + public Integer getAuthorId() { + return (Integer) get(3); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record4 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row4 fieldsRow() { + return (Row4) super.fieldsRow(); + } + + @Override + public Row4 valuesRow() { + return (Row4) super.valuesRow(); + } + + @Override + public Field field1() { + return Article.ARTICLE.ID; + } + + @Override + public Field field2() { + return Article.ARTICLE.TITLE; + } + + @Override + public Field field3() { + return Article.ARTICLE.DESCRIPTION; + } + + @Override + public Field field4() { + return Article.ARTICLE.AUTHOR_ID; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public String component2() { + return getTitle(); + } + + @Override + public String component3() { + return getDescription(); + } + + @Override + public Integer component4() { + return getAuthorId(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public String value2() { + return getTitle(); + } + + @Override + public String value3() { + return getDescription(); + } + + @Override + public Integer value4() { + return getAuthorId(); + } + + @Override + public ArticleRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public ArticleRecord value2(String value) { + setTitle(value); + return this; + } + + @Override + public ArticleRecord value3(String value) { + setDescription(value); + return this; + } + + @Override + public ArticleRecord value4(Integer value) { + setAuthorId(value); + return this; + } + + @Override + public ArticleRecord values(Integer value1, String value2, String value3, Integer value4) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached ArticleRecord + */ + public ArticleRecord() { + super(Article.ARTICLE); + } + + /** + * Create a detached, initialised ArticleRecord + */ + public ArticleRecord(Integer id, String title, String description, Integer authorId) { + super(Article.ARTICLE); + + set(0, id); + set(1, title); + set(2, description); + set(3, authorId); + } +} diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/records/AuthorRecord.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/records/AuthorRecord.java new file mode 100644 index 0000000000..365de20747 --- /dev/null +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/model/tables/records/AuthorRecord.java @@ -0,0 +1,217 @@ +/* + * This file is generated by jOOQ. + */ +package com.baeldung.jooq.model.tables.records; + + +import com.baeldung.jooq.model.tables.Author; +import org.jooq.Field; +import org.jooq.Record1; +import org.jooq.Record4; +import org.jooq.Row4; +import org.jooq.impl.UpdatableRecordImpl; + + +/** + * This class is generated by jOOQ. + */ +@SuppressWarnings({ "all", "unchecked", "rawtypes" }) +public class AuthorRecord extends UpdatableRecordImpl implements Record4 { + + private static final long serialVersionUID = -2120822720; + + /** + * Setter for public.author.id. + */ + public void setId(Integer value) { + set(0, value); + } + + /** + * Getter for public.author.id. + */ + public Integer getId() { + return (Integer) get(0); + } + + /** + * Setter for public.author.first_name. + */ + public void setFirstName(String value) { + set(1, value); + } + + /** + * Getter for public.author.first_name. + */ + public String getFirstName() { + return (String) get(1); + } + + /** + * Setter for public.author.last_name. + */ + public void setLastName(String value) { + set(2, value); + } + + /** + * Getter for public.author.last_name. + */ + public String getLastName() { + return (String) get(2); + } + + /** + * Setter for public.author.age. + */ + public void setAge(Integer value) { + set(3, value); + } + + /** + * Getter for public.author.age. + */ + public Integer getAge() { + return (Integer) get(3); + } + + // ------------------------------------------------------------------------- + // Primary key information + // ------------------------------------------------------------------------- + + @Override + public Record1 key() { + return (Record1) super.key(); + } + + // ------------------------------------------------------------------------- + // Record4 type implementation + // ------------------------------------------------------------------------- + + @Override + public Row4 fieldsRow() { + return (Row4) super.fieldsRow(); + } + + @Override + public Row4 valuesRow() { + return (Row4) super.valuesRow(); + } + + @Override + public Field field1() { + return Author.AUTHOR.ID; + } + + @Override + public Field field2() { + return Author.AUTHOR.FIRST_NAME; + } + + @Override + public Field field3() { + return Author.AUTHOR.LAST_NAME; + } + + @Override + public Field field4() { + return Author.AUTHOR.AGE; + } + + @Override + public Integer component1() { + return getId(); + } + + @Override + public String component2() { + return getFirstName(); + } + + @Override + public String component3() { + return getLastName(); + } + + @Override + public Integer component4() { + return getAge(); + } + + @Override + public Integer value1() { + return getId(); + } + + @Override + public String value2() { + return getFirstName(); + } + + @Override + public String value3() { + return getLastName(); + } + + @Override + public Integer value4() { + return getAge(); + } + + @Override + public AuthorRecord value1(Integer value) { + setId(value); + return this; + } + + @Override + public AuthorRecord value2(String value) { + setFirstName(value); + return this; + } + + @Override + public AuthorRecord value3(String value) { + setLastName(value); + return this; + } + + @Override + public AuthorRecord value4(Integer value) { + setAge(value); + return this; + } + + @Override + public AuthorRecord values(Integer value1, String value2, String value3, Integer value4) { + value1(value1); + value2(value2); + value3(value3); + value4(value4); + return this; + } + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + /** + * Create a detached AuthorRecord + */ + public AuthorRecord() { + super(Author.AUTHOR); + } + + /** + * Create a detached, initialised AuthorRecord + */ + public AuthorRecord(Integer id, String firstName, String lastName, Integer age) { + super(Author.AUTHOR); + + set(0, id); + set(1, firstName); + set(2, lastName); + set(3, age); + } +} diff --git a/persistence-modules/jooq/src/test/java/com/baeldung/jooq/CrudLiveTest.java b/persistence-modules/jooq/src/test/java/com/baeldung/jooq/CrudLiveTest.java new file mode 100644 index 0000000000..d41344c08e --- /dev/null +++ b/persistence-modules/jooq/src/test/java/com/baeldung/jooq/CrudLiveTest.java @@ -0,0 +1,257 @@ +package com.baeldung.jooq; + +import com.baeldung.jooq.model.tables.Article; +import com.baeldung.jooq.model.tables.Author; +import com.baeldung.jooq.model.tables.records.ArticleRecord; +import org.jooq.DSLContext; +import org.jooq.Field; +import org.jooq.Record; +import org.jooq.Result; +import org.jooq.SQLDialect; +import org.jooq.impl.DSL; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.HashMap; + +import static com.baeldung.jooq.Crud.delete; +import static com.baeldung.jooq.Crud.getAll; +import static com.baeldung.jooq.Crud.getFields; +import static com.baeldung.jooq.Crud.getOne; +import static com.baeldung.jooq.Crud.save; +import static com.baeldung.jooq.Crud.update; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +public class CrudLiveTest { + + static DSLContext context; + + @BeforeClass + public static void setup() throws SQLException { + Connection conn = DriverManager.getConnection("jdbc:h2:mem:tes;INIT=CREATE SCHEMA IF NOT EXISTS \"public\""); + context = DSL.using(conn, SQLDialect.H2); + + context.createTable(Author.AUTHOR) + .columns( + Author.AUTHOR.ID, + Author.AUTHOR.FIRST_NAME, + Author.AUTHOR.LAST_NAME, + Author.AUTHOR.AGE + ) + .execute(); + context.createTable(Article.ARTICLE) + .columns( + Article.ARTICLE.ID, + Article.ARTICLE.TITLE, + Article.ARTICLE.DESCRIPTION, + Article.ARTICLE.AUTHOR_ID + ) + .execute(); + } + + @Before + public void cleanup() { + context.truncateTable(Article.ARTICLE) + .execute(); + context.truncateTable(Author.AUTHOR) + .execute(); + } + + @Test + public void givenArticleRecord_whenSave_thenNewRecordInDb() { + // given + ArticleRecord article = article(); + + // when + save(article); + + // then + ArticleRecord savedArticle = getOne( + context, + Article.ARTICLE, + Article.ARTICLE.ID.eq(1) + ); + assertEquals(savedArticle.getId().intValue(), 1); + assertEquals(savedArticle.getTitle(), "jOOQ examples"); + assertEquals(savedArticle.getDescription(), "A few examples of jOOQ CRUD operations"); + assertEquals(savedArticle.getAuthorId().intValue(), 1); + } + + @Test + public void givenArticleRecord_whenGetAll_thenValidOneRecord() { + // given + ArticleRecord article = article(); + save(article); + + // when + Result articles = getAll( + context, + Article.ARTICLE + ); + + // then + assertEquals(articles.size(), 1); + + Record record = articles.get(0); + ArticleRecord savedArticle = record.into(Article.ARTICLE); + + assertEquals(savedArticle.getId().intValue(), 1); + assertEquals(savedArticle.getTitle(), "jOOQ examples"); + assertEquals(savedArticle.getDescription(), "A few examples of jOOQ CRUD operations"); + assertEquals(savedArticle.getAuthorId().intValue(), 1); + } + + @Test + public void givenArticleRecord_whenGetOnlyTitles_thenValidOneValue() { + // given + ArticleRecord article = article(); + save(article); + + // when + Result articles = getFields( + context, + Article.ARTICLE, + Article.ARTICLE.TITLE + ); + + // then + assertEquals(articles.size(), 1); + + Record record = articles.get(0); + ArticleRecord savedArticle = record.into(Article.ARTICLE); + + assertNull(savedArticle.getId()); + assertEquals(savedArticle.getTitle(), "jOOQ examples"); + assertNull(savedArticle.getDescription()); + assertNull(savedArticle.getAuthorId()); + } + + @Test + public void givenArticleRecord_whenGetOne_thenValidRecord() { + // given + ArticleRecord article = article(); + save(article); + + // when + ArticleRecord savedArticle = getOne( + context, + Article.ARTICLE, + Article.ARTICLE.ID.eq(1) + ); + + // then + assertEquals(savedArticle.getId().intValue(), 1); + assertEquals(savedArticle.getTitle(), "jOOQ examples"); + assertEquals(savedArticle.getDescription(), "A few examples of jOOQ CRUD operations"); + assertEquals(savedArticle.getAuthorId().intValue(), 1); + } + + @Test + public void givenArticleRecord_whenUpdateById_thenChangedValuesDbTable() { + // given + ArticleRecord article = article(); + save(article); + + HashMap, String> updateFields = new HashMap<>(); + updateFields.put(Article.ARTICLE.TITLE, "new title"); + updateFields.put(Article.ARTICLE.DESCRIPTION, "new description"); + + // when + update( + context, + Article.ARTICLE, + updateFields, + Article.ARTICLE.ID.eq(1) + ); + + // then + ArticleRecord updatedArticle = getOne( + context, + Article.ARTICLE, + Article.ARTICLE.ID.eq(1) + ); + assertEquals(updatedArticle.getId().intValue(), 1); + assertEquals(updatedArticle.getTitle(), "new title"); + assertEquals(updatedArticle.getDescription(), "new description"); + assertEquals(updatedArticle.getAuthorId().intValue(), 1); + } + + @Test + public void givenArticleRecord_whenUpdate_thenChangedValuesDbTable() { + // given + ArticleRecord article = article(); + save(article); + + article.setTitle("new title"); + article.setDescription("new description"); + + // when + update(article); + + // then + ArticleRecord updatedArticle = getOne( + context, + Article.ARTICLE, + Article.ARTICLE.ID.eq(1) + ); + assertEquals(updatedArticle.getId().intValue(), 1); + assertEquals(updatedArticle.getTitle(), "new title"); + assertEquals(updatedArticle.getDescription(), "new description"); + assertEquals(updatedArticle.getAuthorId().intValue(), 1); + } + + @Test + public void givenArticleRecord_whenDelete_thenEmptyDbTable() { + // given + ArticleRecord article = article(); + save(article); + + // when + delete(article); + + // then + Result articles = getAll( + context, + Article.ARTICLE + ); + assertTrue(articles.isEmpty()); + } + + @Test + public void givenArticleRecord_whenDeleteById_thenEmptyDbTable() { + // given + ArticleRecord article = article(); + save(article); + + // when + delete( + context, + Article.ARTICLE, + Article.ARTICLE.ID.eq(1) + ); + + // then + Result articles = getAll( + context, + Article.ARTICLE + ); + assertTrue(articles.isEmpty()); + } + + private ArticleRecord article() { + ArticleRecord article = context.newRecord(Article.ARTICLE); + article.setId(1); + article.setTitle("jOOQ examples"); + article.setDescription("A few examples of jOOQ CRUD operations"); + article.setAuthorId(1); + + return article; + } + +} diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index def2deb941..590e5da76e 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -39,6 +39,7 @@ java-jpa-2 java-mongodb jnosql + jooq jpa-hibernate-cascade-type liquibase orientdb From c6b1da41802030e665206c9c8bc3f22eabf1cc22 Mon Sep 17 00:00:00 2001 From: fdpro Date: Sat, 26 Sep 2020 08:23:21 +0200 Subject: [PATCH 0825/1862] [JAVA-1669] Added missing byte-buddy dependency --- persistence-modules/spring-jpa-2/pom.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/persistence-modules/spring-jpa-2/pom.xml b/persistence-modules/spring-jpa-2/pom.xml index 1c21f6b98d..8d8dfe3a7b 100644 --- a/persistence-modules/spring-jpa-2/pom.xml +++ b/persistence-modules/spring-jpa-2/pom.xml @@ -66,6 +66,11 @@ guava ${guava.version} + + net.bytebuddy + byte-buddy + ${byte-buddy.version} + @@ -85,13 +90,14 @@ 5.1.5.RELEASE + 2.2.6.RELEASE 9.0.0.M26 21.0 - 2.2.6.RELEASE + 1.10.16 \ No newline at end of file From ce9356179e75db29685d44577914bcfc0c3183d6 Mon Sep 17 00:00:00 2001 From: fdpro Date: Mon, 14 Sep 2020 20:49:03 +0200 Subject: [PATCH 0826/1862] [JAVA-1671] Upgraded JUnit and Maven Surefire Plugin versions * For modules inheriting from spring-cloud directly * Other modules as well --- spring-cloud/pom.xml | 24 +++++++++++++++++++ spring-cloud/spring-cloud-aws/pom.xml | 5 ++++ .../spring-cloud-bootstrap/config/pom.xml | 12 ++++++++++ .../customer-service/pom.xml | 5 ++++ .../spring-cloud-bootstrap/discovery/pom.xml | 5 ++++ .../spring-cloud-bootstrap/gateway/pom.xml | 5 ++++ .../order-service/order-client/pom.xml | 1 - .../order-service/pom.xml | 12 ++++++++++ .../spring-cloud-bootstrap/svc-book/pom.xml | 5 ++++ .../spring-cloud-bootstrap/svc-rating/pom.xml | 5 ++++ .../spring-cloud-bootstrap/zipkin/pom.xml | 12 ++++++++++ .../spring-cloud-config/client/pom.xml | 1 - spring-cloud/spring-cloud-config/pom.xml | 12 ++++++++++ .../spring-cloud-config/server/pom.xml | 1 - .../spring-cloud-connectors-heroku/pom.xml | 5 ++++ .../spring-cloud-eureka-client/pom.xml | 7 ++++++ .../spring-cloud-eureka-feign-client/pom.xml | 7 ++++++ .../spring-cloud-eureka-server/pom.xml | 7 ++++++ spring-cloud/spring-cloud-functions/pom.xml | 5 ++++ spring-cloud/spring-cloud-gateway/pom.xml | 15 +++++------- .../feign-rest-consumer/pom.xml | 7 ++++++ .../rest-consumer/pom.xml | 7 ++++++ .../kubernetes-minikube/demo-frontend/pom.xml | 1 - spring-cloud/spring-cloud-kubernetes/pom.xml | 6 +++++ .../spring-cloud-rest-books-api/pom.xml | 14 ++++++++++- .../spring-cloud-rest-config-server/pom.xml | 12 ++++++++++ .../pom.xml | 12 ++++++++++ .../spring-cloud-rest-reviews-api/pom.xml | 12 ++++++++++ .../spring-cloud-ribbon-client/pom.xml | 12 ++++++++++ .../spring-cloud-ribbon-retry/pom.xml | 12 ++++++++++ spring-cloud/spring-cloud-security/pom.xml | 6 +++++ .../spring-cloud-stream-kafka/pom.xml | 5 ++++ .../spring-cloud-stream-kinesis/pom.xml | 5 ++++ spring-cloud/spring-cloud-task/pom.xml | 12 ++++++++++ spring-cloud/spring-cloud-vault/pom.xml | 5 ++++ .../api-gateway/pom.xml | 8 +++++++ .../weather-service/pom.xml | 7 ++++++ spring-cloud/spring-cloud-zuul/pom.xml | 12 ++++++++++ .../spring-zuul-rate-limiting/pom.xml | 12 ---------- 39 files changed, 292 insertions(+), 26 deletions(-) diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index ee7b80ffc1..928db8adb7 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -58,6 +58,25 @@ + + + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + Hoxton.SR4 2.2.3.RELEASE @@ -68,6 +87,11 @@ 3.0.6.RELEASE 2.3.1.RELEASE 2.3.1.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml index 2b05020888..3952ffdec1 100644 --- a/spring-cloud/spring-cloud-aws/pom.xml +++ b/spring-cloud/spring-cloud-aws/pom.xml @@ -67,6 +67,11 @@ com.baeldung.spring.cloud.aws.SpringCloudAwsApplication Dalston.SR4 2.2.1.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-bootstrap/config/pom.xml b/spring-cloud/spring-cloud-bootstrap/config/pom.xml index 67831d0c7f..65a9830495 100644 --- a/spring-cloud/spring-cloud-bootstrap/config/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/config/pom.xml @@ -30,6 +30,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -42,6 +49,11 @@ Brixton.SR7 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml b/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml index 8fcf4adadb..026a7a1841 100644 --- a/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml @@ -78,5 +78,10 @@ 1.8 1.8 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml index 46550031e1..eaebaacc4d 100644 --- a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml @@ -51,6 +51,11 @@ Edgware.SR5 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml index 10a04db197..aacd2cdbf7 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml @@ -100,6 +100,11 @@ Dalston.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/order-service/order-client/pom.xml b/spring-cloud/spring-cloud-bootstrap/order-service/order-client/pom.xml index 4c8cf742b1..01e8afeec3 100644 --- a/spring-cloud/spring-cloud-bootstrap/order-service/order-client/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/order-service/order-client/pom.xml @@ -14,5 +14,4 @@ order-service 1.0.0-SNAPSHOT - diff --git a/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml b/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml index a1c6c1c39f..04901f9936 100644 --- a/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml @@ -23,6 +23,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.boot spring-boot-dependencies @@ -118,5 +125,10 @@ 1.8 1.8 com.baeldung.orderservice.OrderApplication + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml index 36227f93c6..cf34e44f24 100644 --- a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml @@ -73,6 +73,11 @@ Dalston.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml index 0a01488628..a232861cad 100644 --- a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml @@ -82,6 +82,11 @@ Dalston.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml index bf7525a8e4..134038b94a 100644 --- a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml @@ -38,6 +38,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -50,6 +57,11 @@ Brixton.SR7 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml index 4f4a420238..805a50bfdb 100644 --- a/spring-cloud/spring-cloud-config/client/pom.xml +++ b/spring-cloud/spring-cloud-config/client/pom.xml @@ -36,5 +36,4 @@ - diff --git a/spring-cloud/spring-cloud-config/pom.xml b/spring-cloud/spring-cloud-config/pom.xml index 8411a65500..e693bc7a29 100644 --- a/spring-cloud/spring-cloud-config/pom.xml +++ b/spring-cloud/spring-cloud-config/pom.xml @@ -22,6 +22,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -34,6 +41,11 @@ Hoxton.SR4 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml index 9574834457..e32a473cd6 100644 --- a/spring-cloud/spring-cloud-config/server/pom.xml +++ b/spring-cloud/spring-cloud-config/server/pom.xml @@ -40,5 +40,4 @@ - diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index 7d85e07bb8..2e84061be9 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -64,6 +64,11 @@ Hoxton.SR4 42.2.10 1.10.10 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml index d82ee6566d..dc6a1ae236 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml @@ -17,6 +17,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-starter-parent diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml index 1ecc50a81f..e0d63dc15d 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-feign-client/pom.xml @@ -17,6 +17,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-starter-parent diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml index 627be513ba..9c0a933753 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-server/pom.xml @@ -17,6 +17,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-starter-parent diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml index 7e6f5dfbdc..19b5e3cd8d 100644 --- a/spring-cloud/spring-cloud-functions/pom.xml +++ b/spring-cloud/spring-cloud-functions/pom.xml @@ -86,6 +86,11 @@ 2.0.2 1.1.0 1.0.10.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml index bbacf7a8ce..c9c087d738 100644 --- a/spring-cloud/spring-cloud-gateway/pom.xml +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -17,19 +17,16 @@ - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud-dependencies.version} + org.junit + junit-bom + ${junit-jupiter.version} pom import - - - org.junit - junit-bom - ${junit-bom.version} + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud-dependencies.version} pom import diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml index acb9993881..9b43542f02 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml @@ -17,6 +17,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-starter-parent diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml index ba03ad3348..7989b09ed4 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml @@ -16,6 +16,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-starter-parent diff --git a/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml index 9a4924b903..004fabeb09 100644 --- a/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/kubernetes-minikube/demo-frontend/pom.xml @@ -33,5 +33,4 @@ - diff --git a/spring-cloud/spring-cloud-kubernetes/pom.xml b/spring-cloud/spring-cloud-kubernetes/pom.xml index ed4bccbf78..c936024753 100644 --- a/spring-cloud/spring-cloud-kubernetes/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/pom.xml @@ -24,4 +24,10 @@ kubernetes-guide/travel-agency-service + + + 2.22.2 + 5.6.2 + 4.13 + \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml index 042f7657ab..1dcf14f104 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml @@ -18,6 +18,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -65,7 +72,12 @@ org.springframework.boot spring-boot-starter-data-redis - + + + 2.22.2 + 5.6.2 + 4.13 + diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml index 5fb9364752..736b8bdf78 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml @@ -18,6 +18,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -45,6 +52,11 @@ Camden.SR4 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml index 5e35a7c0f5..12f8b6ae6a 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml @@ -18,6 +18,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -53,6 +60,11 @@ Edgware.SR4 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml index 7503418ad2..0e7aed7f6a 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml @@ -18,6 +18,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -75,6 +82,11 @@ 3.0.1 0.6 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-ribbon-client/pom.xml b/spring-cloud/spring-cloud-ribbon-client/pom.xml index e19d3beaad..ce57cfd7d3 100644 --- a/spring-cloud/spring-cloud-ribbon-client/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-client/pom.xml @@ -16,6 +16,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -39,6 +46,11 @@ Hoxton.SR4 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-ribbon-retry/pom.xml b/spring-cloud/spring-cloud-ribbon-retry/pom.xml index 27037d6710..198473d5e5 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-retry/pom.xml @@ -23,6 +23,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-starter-parent @@ -48,5 +55,10 @@ Hoxton.SR3 + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-security/pom.xml b/spring-cloud/spring-cloud-security/pom.xml index 498c88ac48..0997b1f3aa 100644 --- a/spring-cloud/spring-cloud-security/pom.xml +++ b/spring-cloud/spring-cloud-security/pom.xml @@ -20,4 +20,10 @@ auth-server + + + 2.22.2 + 5.6.2 + 4.13 + diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml index 669499efb7..3283d4d07c 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml @@ -105,6 +105,11 @@ Greenwich.SR1 4.0.0 1.8.2 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml index 9e706cc239..d3182433e9 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml @@ -43,6 +43,11 @@ 1.11.632 2.0.2.RELEASE 2.2.1.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-task/pom.xml b/spring-cloud/spring-cloud-task/pom.xml index e2006ee9d3..bb18c1390b 100644 --- a/spring-cloud/spring-cloud-task/pom.xml +++ b/spring-cloud/spring-cloud-task/pom.xml @@ -22,6 +22,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-task-dependencies @@ -42,6 +49,11 @@ Hoxton.SR4 2.2.3.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-vault/pom.xml b/spring-cloud/spring-cloud-vault/pom.xml index d9ae6b515f..a713e47fe2 100644 --- a/spring-cloud/spring-cloud-vault/pom.xml +++ b/spring-cloud/spring-cloud-vault/pom.xml @@ -83,6 +83,11 @@ Greenwich.RELEASE + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml b/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml index 136461ccb9..4e092736a5 100644 --- a/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml +++ b/spring-cloud/spring-cloud-zuul-fallback/api-gateway/pom.xml @@ -12,10 +12,18 @@ com.baeldung.spring.cloud spring-cloud-zuul-fallback 1.0.0-SNAPSHOT + ../pom.xml + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-starter-parent diff --git a/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml b/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml index bafd4ffcd1..d2914b48bf 100644 --- a/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml +++ b/spring-cloud/spring-cloud-zuul-fallback/weather-service/pom.xml @@ -15,6 +15,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-starter-parent diff --git a/spring-cloud/spring-cloud-zuul/pom.xml b/spring-cloud/spring-cloud-zuul/pom.xml index b3c66dd1c6..3884e67388 100644 --- a/spring-cloud/spring-cloud-zuul/pom.xml +++ b/spring-cloud/spring-cloud-zuul/pom.xml @@ -24,6 +24,13 @@ + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + org.springframework.cloud spring-cloud-dependencies @@ -73,6 +80,11 @@ Hoxton.SR4 + + + 2.22.2 + 5.6.2 + 4.13 diff --git a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml index 8873282d1e..b42d32b6b3 100644 --- a/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml +++ b/spring-cloud/spring-cloud-zuul/spring-zuul-rate-limiting/pom.xml @@ -13,18 +13,6 @@ 0.0.1-SNAPSHOT - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - com.marcosbarbero.cloud From 428e8dac62b901208872dde784e7eb9379cb369d Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Thu, 17 Sep 2020 00:20:42 +0200 Subject: [PATCH 0827/1862] [BAEL-4532]a.getClass() vs A.class --- .../com/baeldung/getclassobject/Animal.java | 5 ++ .../com/baeldung/getclassobject/Monkey.java | 4 ++ .../getclassobject/SomeAbstractClass.java | 4 ++ .../getclassobject/SomeInterface.java | 4 ++ .../baeldung/getclassobject/SomeUtils.java | 9 +++ .../GetClassObjectUnitTest.java | 55 +++++++++++++++++++ 6 files changed, 81 insertions(+) create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/Animal.java create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/Monkey.java create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeAbstractClass.java create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeInterface.java create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeUtils.java create mode 100644 core-java-modules/core-java-lang-3/src/test/java/com/baeldung/getclassobject/GetClassObjectUnitTest.java diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/Animal.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/Animal.java new file mode 100644 index 0000000000..426f1403af --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/Animal.java @@ -0,0 +1,5 @@ +package com.baeldung.getclassobject; + +public class Animal { + protected int numberOfEyes; +} diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/Monkey.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/Monkey.java new file mode 100644 index 0000000000..76ad8a96e3 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/Monkey.java @@ -0,0 +1,4 @@ +package com.baeldung.getclassobject; + +public class Monkey extends Animal { +} diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeAbstractClass.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeAbstractClass.java new file mode 100644 index 0000000000..7ee34cf62a --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeAbstractClass.java @@ -0,0 +1,4 @@ +package com.baeldung.getclassobject; + +public abstract class SomeAbstractClass { +} diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeInterface.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeInterface.java new file mode 100644 index 0000000000..eec8048481 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeInterface.java @@ -0,0 +1,4 @@ +package com.baeldung.getclassobject; + +interface SomeInterface { +} diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeUtils.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeUtils.java new file mode 100644 index 0000000000..294ef5bc9e --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/getclassobject/SomeUtils.java @@ -0,0 +1,9 @@ +package com.baeldung.getclassobject; + +public class SomeUtils { + private SomeUtils() { + throw new RuntimeException("This Util class is not allowed to be instantiated!"); + } + // public static utilMethods + // ... +} diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/getclassobject/GetClassObjectUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/getclassobject/GetClassObjectUnitTest.java new file mode 100644 index 0000000000..20b5b8e0c8 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/getclassobject/GetClassObjectUnitTest.java @@ -0,0 +1,55 @@ +package com.baeldung.getclassobject; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class GetClassObjectUnitTest { + @Test + public void givenObjectAndType_whenGettingClassObject_thenTwoMethodsHaveTheSameResult() { + String str = "I am an object of the String class"; + Class fromStrObject = str.getClass(); + Class clazz = String.class; + assertSame(fromStrObject, clazz); + } + + @Test + public void givenClassInheritance_whenGettingRuntimeTypeAndStaticType_thenGetDifferentResult() { + Animal animal = new Monkey(); + Class runtimeType = animal.getClass(); + Class staticType = Animal.class; + //Not equals + assertNotEquals(staticType, runtimeType); + + Class monkeyClass = Monkey.class; + assertSame(runtimeType, monkeyClass); + } + + @Test + public void givenPrimitiveType_whenGettingClassObject_thenOnlyStaticTypeWorks() { + int number = 7; + // Class numberClass = number.getClass(); <-- compilation error + Class intType = int.class; + + assertNotNull(intType); + assertEquals("int", intType.getName()); + assertTrue(intType.isPrimitive()); + } + + @Test + public void givenTypeCannotInstantiate_whenGetTypeStatically_thenGetTypesSuccefully() { + Class interfaceType = SomeInterface.class; + Class abstractClassType = SomeAbstractClass.class; + Class utilClassType = SomeUtils.class; + + assertNotNull(interfaceType); + assertTrue(interfaceType.isInterface()); + assertEquals("SomeInterface", interfaceType.getSimpleName()); + + assertNotNull(abstractClassType); + assertEquals("SomeAbstractClass", abstractClassType.getSimpleName()); + + assertNotNull(utilClassType); + assertEquals("SomeUtils", utilClassType.getSimpleName()); + } +} From 70203a988b81a564cf281ed1b94efd6b0b6e9809 Mon Sep 17 00:00:00 2001 From: Ronald Dehuysser Date: Sat, 26 Sep 2020 23:14:11 +0200 Subject: [PATCH 0828/1862] [BAEL-4639] Running background jobs in Spring with JobRunr (#10089) * [BAEL-4639] Running background jobs in Spring with JobRunr * [BAEL-4639] Background jobs in Spring with JobRunr - update dependencies and readme * [BAEL-4639] Background jobs in Spring with JobRunr - add required newline to application.properties * [BAEL-4639] Background jobs in Spring with JobRunr - Make sure link is correct * [BAEL-4639] Background jobs in Spring with JobRunr - Cleanup and LiveTest added * [BAEL-4639] - Feedback * [BAEL-4639] Update test with feedback --- spring-boot-modules/pom.xml | 1 + .../spring-boot-libraries-2/README.md | 7 +++ .../spring-boot-libraries-2/pom.xml | 46 +++++++++++++++++++ .../jobrunr/JobRunrSpringBootApp.java | 37 +++++++++++++++ .../jobrunr/controller/JobRunrController.java | 43 +++++++++++++++++ .../jobrunr/service/SampleJobService.java | 36 +++++++++++++++ .../src/main/resources/application.properties | 2 + .../com/baeldung/jobrunr/JobRunrLiveTest.java | 46 +++++++++++++++++++ 8 files changed, 218 insertions(+) create mode 100644 spring-boot-modules/spring-boot-libraries-2/README.md create mode 100644 spring-boot-modules/spring-boot-libraries-2/pom.xml create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/JobRunrSpringBootApp.java create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/controller/JobRunrController.java create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/service/SampleJobService.java create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/jobrunr/JobRunrLiveTest.java diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index 527f7dcad8..fa70a9f058 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -46,6 +46,7 @@ spring-boot-jasypt spring-boot-keycloak spring-boot-libraries + spring-boot-libraries-2 spring-boot-logging-log4j2 spring-boot-kotlin spring-boot-mvc diff --git a/spring-boot-modules/spring-boot-libraries-2/README.md b/spring-boot-modules/spring-boot-libraries-2/README.md new file mode 100644 index 0000000000..b0840798e3 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/README.md @@ -0,0 +1,7 @@ +## Spring Boot Libraries + +This module contains articles about various Spring Boot libraries + +### Relevant Articles: + +- Running background jobs in Spring with JobRunr diff --git a/spring-boot-modules/spring-boot-libraries-2/pom.xml b/spring-boot-modules/spring-boot-libraries-2/pom.xml new file mode 100644 index 0000000000..2633c8fad3 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/pom.xml @@ -0,0 +1,46 @@ + + + + spring-boot-modules + com.baeldung.spring-boot-modules + 1.0.0-SNAPSHOT + + 4.0.0 + + spring-boot-libraries-2 + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.jobrunr + jobrunr-spring-boot-starter + ${jobrunr.version} + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.awaitility + awaitility + ${awaitility.version} + test + + + + + 1.0.0 + 4.0.3 + + + \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/JobRunrSpringBootApp.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/JobRunrSpringBootApp.java new file mode 100644 index 0000000000..d72e9464d9 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/JobRunrSpringBootApp.java @@ -0,0 +1,37 @@ +package com.baeldung.jobrunr; + +import com.baeldung.jobrunr.service.SampleJobService; +import org.jobrunr.jobs.mappers.JobMapper; +import org.jobrunr.scheduling.JobScheduler; +import org.jobrunr.scheduling.cron.Cron; +import org.jobrunr.storage.InMemoryStorageProvider; +import org.jobrunr.storage.StorageProvider; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +import javax.annotation.PostConstruct; + +@SpringBootApplication +public class JobRunrSpringBootApp { + + @Autowired + private JobScheduler jobScheduler; + + public static void main(String[] args) { + SpringApplication.run(JobRunrSpringBootApp.class, args); + } + + @Bean + public StorageProvider storageProvider(JobMapper jobMapper) { + InMemoryStorageProvider storageProvider = new InMemoryStorageProvider(); + storageProvider.setJobMapper(jobMapper); + return storageProvider; + } + + @PostConstruct + public void scheduleRecurrently() { + jobScheduler.scheduleRecurrently(x -> x.executeSampleJob("a recurring job"), Cron.every5minutes()); + } +} diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/controller/JobRunrController.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/controller/JobRunrController.java new file mode 100644 index 0000000000..af5f0b1196 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/controller/JobRunrController.java @@ -0,0 +1,43 @@ +package com.baeldung.jobrunr.controller; + +import com.baeldung.jobrunr.service.SampleJobService; +import org.jobrunr.scheduling.JobScheduler; +import org.springframework.boot.context.properties.bind.DefaultValue; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.time.LocalDateTime; + +@RestController +@RequestMapping("/jobrunr") +public class JobRunrController { + + private JobScheduler jobScheduler; + private SampleJobService sampleJobService; + + private JobRunrController(JobScheduler jobScheduler, SampleJobService sampleJobService) { + this.jobScheduler = jobScheduler; + this.sampleJobService = sampleJobService; + } + + @GetMapping(value = "/enqueue/{input}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity enqueue(@PathVariable("input") @DefaultValue("default-input") String input) { + jobScheduler.enqueue(() -> sampleJobService.executeSampleJob(input)); + return okResponse("job enqueued successfully"); + } + + @GetMapping(value = "/schedule/{input}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity schedule( + @PathVariable("input") @DefaultValue("default-input") String input, + @RequestParam("scheduleAt") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime scheduleAt) { + jobScheduler.schedule(() -> sampleJobService.executeSampleJob(input), scheduleAt); + return okResponse("job scheduled successfully"); + } + + private ResponseEntity okResponse(String feedback) { + return new ResponseEntity<>(feedback, HttpStatus.OK); + } +} diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/service/SampleJobService.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/service/SampleJobService.java new file mode 100644 index 0000000000..dff4309374 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/jobrunr/service/SampleJobService.java @@ -0,0 +1,36 @@ +package com.baeldung.jobrunr.service; + +import org.jobrunr.jobs.annotations.Job; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.util.concurrent.atomic.AtomicInteger; + +@Service +public class SampleJobService { + + public static final long EXECUTION_TIME = 5000L; + + private Logger logger = LoggerFactory.getLogger(getClass()); + + private AtomicInteger count = new AtomicInteger(); + + @Job(name = "The sample job with variable %0", retries = 2) + public void executeSampleJob(String variable) { + + logger.info("The sample job has begun. The variable you passed is {}", variable); + try { + Thread.sleep(EXECUTION_TIME); + } catch (InterruptedException e) { + logger.error("Error while executing sample job", e); + } finally { + count.incrementAndGet(); + logger.info("Sample job has finished..."); + } + } + + public int getNumberOfInvocations() { + return count.get(); + } +} diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties b/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties new file mode 100644 index 0000000000..69f5a7356e --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties @@ -0,0 +1,2 @@ +org.jobrunr.background_job_server=true +org.jobrunr.dashboard=true diff --git a/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/jobrunr/JobRunrLiveTest.java b/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/jobrunr/JobRunrLiveTest.java new file mode 100644 index 0000000000..83222e7726 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/test/java/com/baeldung/jobrunr/JobRunrLiveTest.java @@ -0,0 +1,46 @@ +package com.baeldung.jobrunr; + +import org.awaitility.Awaitility; +import org.jobrunr.jobs.states.StateName; +import org.jobrunr.storage.StorageProvider; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.test.context.junit4.SpringRunner; + +import java.net.URI; +import java.util.concurrent.TimeUnit; + +import static org.awaitility.Awaitility.await; +import static org.junit.Assert.assertEquals; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.DEFINED_PORT; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = DEFINED_PORT, classes = JobRunrSpringBootApp.class) +public class JobRunrLiveTest { + + @Autowired + TestRestTemplate restTemplate; + + @Autowired + StorageProvider storageProvider; + + @Test + public void givenEndpoint_whenJobEnqueued_thenJobIsProcessedWithin30Seconds() { + String response = enqueueJobViaRest("some-input"); + assertEquals("job enqueued successfully", response); + + await().atMost(30, TimeUnit.SECONDS).until(() -> storageProvider.countJobs(StateName.SUCCEEDED) == 1); + } + + private String enqueueJobViaRest(String input) { + try { + return restTemplate.getForObject(new URI("http://localhost:8080/jobrunr/enqueue/" + input), String.class); + } catch (Exception ignored) { + ignored.printStackTrace(); + } + return null; + } +} From 76c4f84e641570c4f8e4044c52831fb4f541866a Mon Sep 17 00:00:00 2001 From: Lachezar Atanasov <53919277+lachezarat@users.noreply.github.com> Date: Sun, 27 Sep 2020 11:44:45 +0300 Subject: [PATCH 0829/1862] Update README.md --- algorithms-miscellaneous-1/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms-miscellaneous-1/README.md b/algorithms-miscellaneous-1/README.md index 25e2733538..77c621339a 100644 --- a/algorithms-miscellaneous-1/README.md +++ b/algorithms-miscellaneous-1/README.md @@ -10,4 +10,4 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [Introduction to Minimax Algorithm](https://www.baeldung.com/java-minimax-algorithm) - [How to Calculate Levenshtein Distance in Java?](https://www.baeldung.com/java-levenshtein-distance) - [How to Find the Kth Largest Element in Java](https://www.baeldung.com/java-kth-largest-element) -- More articles: [[next -->]](/../algorithms-miscellaneous-2) +- More articles: [[next -->]](/algorithms-miscellaneous-2) From 60201640d966b0ead5d6f35c28c8f79948ba4bed Mon Sep 17 00:00:00 2001 From: Lachezar Atanasov <53919277+lachezarat@users.noreply.github.com> Date: Sun, 27 Sep 2020 11:45:13 +0300 Subject: [PATCH 0830/1862] Update README.md --- algorithms-miscellaneous-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms-miscellaneous-2/README.md b/algorithms-miscellaneous-2/README.md index 26737b61f0..265416534e 100644 --- a/algorithms-miscellaneous-2/README.md +++ b/algorithms-miscellaneous-2/README.md @@ -14,4 +14,4 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [Displaying Money Amounts in Words](https://www.baeldung.com/java-money-into-words) - [A Collaborative Filtering Recommendation System in Java](https://www.baeldung.com/java-collaborative-filtering-recommendations) - [Implementing A* Pathfinding in Java](https://www.baeldung.com/java-a-star-pathfinding) -- More articles: [[<-- prev]](/../algorithms-miscellaneous-1) [[next -->]](/../algorithms-miscellaneous-3) +- More articles: [[<-- prev]](/algorithms-miscellaneous-1) [[next -->]](/algorithms-miscellaneous-3) From 0055fb2e1b9b27b102c69ba7502c7445d3b2ea0e Mon Sep 17 00:00:00 2001 From: Lachezar Atanasov <53919277+lachezarat@users.noreply.github.com> Date: Sun, 27 Sep 2020 11:45:57 +0300 Subject: [PATCH 0831/1862] Update README.md --- algorithms-miscellaneous-5/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms-miscellaneous-5/README.md b/algorithms-miscellaneous-5/README.md index 3e6eeb4c93..e5d46ace1c 100644 --- a/algorithms-miscellaneous-5/README.md +++ b/algorithms-miscellaneous-5/README.md @@ -15,5 +15,5 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [Maximum Subarray Problem](https://www.baeldung.com/java-maximum-subarray) - [How to Merge Two Sorted Arrays](https://www.baeldung.com/java-merge-sorted-arrays) - [Median of Stream of Integers using Heap](https://www.baeldung.com/java-stream-integers-median-using-heap) -- More articles: [[<-- prev]](/../algorithms-miscellaneous-4) [[next -->]](/../algorithms-miscellaneous-6) +- More articles: [[<-- prev]](/algorithms-miscellaneous-4) [[next -->]](/algorithms-miscellaneous-6) From 0a9ccbfeddbc2cd33f85276f270bf64cd676911c Mon Sep 17 00:00:00 2001 From: Lachezar Atanasov <53919277+lachezarat@users.noreply.github.com> Date: Sun, 27 Sep 2020 11:46:14 +0300 Subject: [PATCH 0832/1862] Update README.md --- algorithms-miscellaneous-6/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/algorithms-miscellaneous-6/README.md b/algorithms-miscellaneous-6/README.md index 6ddae75f43..70acb69b6f 100644 --- a/algorithms-miscellaneous-6/README.md +++ b/algorithms-miscellaneous-6/README.md @@ -9,4 +9,4 @@ - [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher) - [Implementing a 2048 Solver in Java](https://www.baeldung.com/2048-java-solver) - [Finding Top K Elements in an Array](https://www.baeldung.com/java-array-top-elements) -- More articles: [[<-- prev]](/../algorithms-miscellaneous-5) +- More articles: [[<-- prev]](/algorithms-miscellaneous-5) From ea8e33f434d95d57b6c3b570d4a391401645d6a5 Mon Sep 17 00:00:00 2001 From: Simone Cusimano Date: Sun, 27 Sep 2020 18:37:50 +0200 Subject: [PATCH 0833/1862] Add dependency management module --- .../gradle-dependency-management/.gitignore | 34 ++++ .../gradle-dependency-management/build.gradle | 46 +++++ .../gradle/wrapper/gradle-wrapper.properties | 5 + gradle/gradle-dependency-management/gradlew | 184 ++++++++++++++++++ .../gradle-dependency-management/gradlew.bat | 89 +++++++++ .../settings.gradle | 1 + .../DependencyManagementApplication.java | 13 ++ .../src/main/resources/application.properties | 1 + .../DependencyManagementApplicationTests.java | 13 ++ 9 files changed, 386 insertions(+) create mode 100644 gradle/gradle-dependency-management/.gitignore create mode 100644 gradle/gradle-dependency-management/build.gradle create mode 100644 gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.properties create mode 100644 gradle/gradle-dependency-management/gradlew create mode 100644 gradle/gradle-dependency-management/gradlew.bat create mode 100644 gradle/gradle-dependency-management/settings.gradle create mode 100644 gradle/gradle-dependency-management/src/main/java/com/gradle/dependencymanagement/DependencyManagementApplication.java create mode 100644 gradle/gradle-dependency-management/src/main/resources/application.properties create mode 100644 gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationTests.java diff --git a/gradle/gradle-dependency-management/.gitignore b/gradle/gradle-dependency-management/.gitignore new file mode 100644 index 0000000000..84695dca6f --- /dev/null +++ b/gradle/gradle-dependency-management/.gitignore @@ -0,0 +1,34 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ diff --git a/gradle/gradle-dependency-management/build.gradle b/gradle/gradle-dependency-management/build.gradle new file mode 100644 index 0000000000..db908b6457 --- /dev/null +++ b/gradle/gradle-dependency-management/build.gradle @@ -0,0 +1,46 @@ +plugins { + id 'org.springframework.boot' version '2.3.4.RELEASE' + id 'io.spring.dependency-management' version '1.0.10.RELEASE' + id 'java' +} + +group = 'com.gradle' +version = '1.0.0' +sourceCompatibility = '14' + +configurations { + compileOnly { + extendsFrom annotationProcessor + } +} + +repositories { + mavenCentral() +} + +ext { + set('testcontainersVersion', "1.14.3") +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.springframework.boot:spring-boot-starter-webflux' + developmentOnly 'org.springframework.boot:spring-boot-devtools' + annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' + testImplementation('org.springframework.boot:spring-boot-starter-test') { + exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' + } + testImplementation 'io.projectreactor:reactor-test' + testImplementation 'org.springframework.security:spring-security-test' + testImplementation 'org.testcontainers:junit-jupiter' +} + +dependencyManagement { + imports { + mavenBom "org.testcontainers:testcontainers-bom:${testcontainersVersion}" + } +} + +test { + useJUnitPlatform() +} diff --git a/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.properties b/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..12d38de6a4 --- /dev/null +++ b/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradle/gradle-dependency-management/gradlew b/gradle/gradle-dependency-management/gradlew new file mode 100644 index 0000000000..8f8904743c --- /dev/null +++ b/gradle/gradle-dependency-management/gradlew @@ -0,0 +1,184 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ]; do + ls=$(ls -ld "$PRG") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' >/dev/null; then + PRG="$link" + else + PRG=$(dirname "$PRG")"/$link" + fi +done +SAVED="$(pwd)" +cd "$(dirname \"$PRG\")/" >/dev/null +APP_HOME="$(pwd -P)" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=$(basename "$0") + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn() { + echo "$*" +} + +die() { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$(uname)" in +CYGWIN*) + cygwin=true + ;; +Darwin*) + darwin=true + ;; +MINGW*) + msys=true + ;; +NONSTOP*) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ]; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then + MAX_FD_LIMIT=$(ulimit -H -n) + if [ $? -eq 0 ]; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ]; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ]; then + APP_HOME=$(cygpath --path --mixed "$APP_HOME") + CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") + + JAVACMD=$(cygpath --unix "$JAVACMD") + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) + SEP="" + for dir in $ROOTDIRSRAW; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ]; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@"; do + CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) + CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition + eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") + else + eval $(echo args$i)="\"$arg\"" + fi + i=$(expr $i + 1) + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save() { + for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradle/gradle-dependency-management/gradlew.bat b/gradle/gradle-dependency-management/gradlew.bat new file mode 100644 index 0000000000..107acd32c4 --- /dev/null +++ b/gradle/gradle-dependency-management/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/gradle/gradle-dependency-management/settings.gradle b/gradle/gradle-dependency-management/settings.gradle new file mode 100644 index 0000000000..09bfe08af7 --- /dev/null +++ b/gradle/gradle-dependency-management/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'dependencymanagement' diff --git a/gradle/gradle-dependency-management/src/main/java/com/gradle/dependencymanagement/DependencyManagementApplication.java b/gradle/gradle-dependency-management/src/main/java/com/gradle/dependencymanagement/DependencyManagementApplication.java new file mode 100644 index 0000000000..7e589c0477 --- /dev/null +++ b/gradle/gradle-dependency-management/src/main/java/com/gradle/dependencymanagement/DependencyManagementApplication.java @@ -0,0 +1,13 @@ +package com.gradle.dependencymanagement; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DependencyManagementApplication { + + public static void main(String[] args) { + SpringApplication.run(DependencyManagementApplication.class, args); + } + +} diff --git a/gradle/gradle-dependency-management/src/main/resources/application.properties b/gradle/gradle-dependency-management/src/main/resources/application.properties new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/gradle/gradle-dependency-management/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationTests.java b/gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationTests.java new file mode 100644 index 0000000000..85634a052e --- /dev/null +++ b/gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationTests.java @@ -0,0 +1,13 @@ +package com.gradle.dependencymanagement; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class DependencyManagementApplicationTests { + + @Test + void contextLoads() { + } + +} From 69d7f51947a4e28f61d3d58eb87adc2fdddd25fc Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Sep 2020 04:04:49 +0530 Subject: [PATCH 0834/1862] IsLetter / isAlphabetic method unit tests --- .../character/IsLetterOrAlphabetUnitTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 core-java-modules/core-java-14/src/test/java/com/baeldung/java14/character/IsLetterOrAlphabetUnitTest.java diff --git a/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/character/IsLetterOrAlphabetUnitTest.java b/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/character/IsLetterOrAlphabetUnitTest.java new file mode 100644 index 0000000000..44c712a17f --- /dev/null +++ b/core-java-modules/core-java-14/src/test/java/com/baeldung/java14/character/IsLetterOrAlphabetUnitTest.java @@ -0,0 +1,30 @@ +package com.baeldung.java14.character; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; + +public class IsLetterOrAlphabetUnitTest { + + @Test + public void givenACharacter_whenLetter_thenAssertIsLetterTrue() { + assertTrue(Character.isLetter(65)); + } + + @Test + public void givenACharacter_whenLetter_thenAssertIsAlphabeticTrue() { + assertTrue(Character.isAlphabetic(65)); + } + + @Test + public void givenACharacter_whenAlphabeticAndNotLetter_thenAssertIsLetterFalse() { + assertFalse(Character.isLetter(837)); + } + + @Test + public void givenACharacter_whenAlphabeticAndNotLetter_thenAssertIsAlphabeticTrue() { + assertTrue(Character.isAlphabetic(837)); + } + +} \ No newline at end of file From 29c91cde2e39b7dbb8c29ffde57444da97e6914c Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Mon, 28 Sep 2020 01:24:17 +0200 Subject: [PATCH 0835/1862] Added component scan and auto configuration annotations --- .../EmployeeApplication.java | 26 +++++++++++++++++++ .../doctor/Doctor.java | 7 +++++ .../employee/Employee.java | 7 +++++ .../employee/SeniorEmployee.java | 7 +++++ .../student/Student.java | 7 +++++ .../teacher/Teacher.java | 7 +++++ 6 files changed, 61 insertions(+) create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/doctor/Doctor.java create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java new file mode 100644 index 0000000000..108dd1a695 --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java @@ -0,0 +1,26 @@ +package com.baeldung.annotations.componentscanautoconfigure; + +import com.baeldung.annotations.componentscanautoconfigure.teacher.Teacher; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.aop.AopAutoConfiguration; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan(basePackages = {"com.baeldung.annotations.componentscanautoconfigure.doctor", "com.baeldung.annotations.componentscanautoconfigure.employee"}, + basePackageClasses = Teacher.class) +@EnableAutoConfiguration(exclude={AopAutoConfiguration.class}) +//@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.aop"}) +public class EmployeeApplication { + + public static void main(String[] args) { + ApplicationContext context = SpringApplication.run(EmployeeApplication.class, args); + System.out.println("Configures Doctor: " + context.containsBeanDefinition("doctor")); + System.out.println("Configures Employee: " + context.containsBeanDefinition("employee")); + System.out.println("Configures Senior Employee: " + context.containsBeanDefinition("seniorEmployee")); + System.out.println("Configures Student: " + context.containsBeanDefinition("student")); + System.out.println("Configures Teacher: " + context.containsBeanDefinition("teacher")); + } +} diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/doctor/Doctor.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/doctor/Doctor.java new file mode 100644 index 0000000000..40bb68259a --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/doctor/Doctor.java @@ -0,0 +1,7 @@ +package com.baeldung.annotations.componentscanautoconfigure.doctor; + +import org.springframework.stereotype.Component; + +@Component("doctor") +public class Doctor { +} diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java new file mode 100644 index 0000000000..bdc0b3f2d9 --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java @@ -0,0 +1,7 @@ +package com.baeldung.annotations.componentscanautoconfigure.employee; + +import org.springframework.stereotype.Component; + +@Component("employee") +public class Employee { +} diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java new file mode 100644 index 0000000000..fc02a17df6 --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java @@ -0,0 +1,7 @@ +package com.baeldung.annotations.componentscanautoconfigure.employee; + +import org.springframework.stereotype.Component; + +@Component("seniorEmployee") +public class SeniorEmployee { +} diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java new file mode 100644 index 0000000000..820d0bea10 --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java @@ -0,0 +1,7 @@ +package com.baeldung.annotations.componentscanautoconfigure.student; + +import org.springframework.stereotype.Component; + +@Component("student") +public class Student { +} diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java new file mode 100644 index 0000000000..699b8ccfb4 --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java @@ -0,0 +1,7 @@ +package com.baeldung.annotations.componentscanautoconfigure.teacher; + +import org.springframework.stereotype.Component; + +@Component("teacher") +public class Teacher { +} From e134c020ceb050ecacfb23509f1a8418fe481e41 Mon Sep 17 00:00:00 2001 From: Oussama BEN MAHMOUD Date: Mon, 28 Sep 2020 10:43:07 +0200 Subject: [PATCH 0836/1862] BAEL-4443 Reading HTTP ResponseBody as a String --- httpclient-2/pom.xml | 29 ++++++++++++++++ .../ApacheHttpClientUnitTest.java | 26 ++++++++++++++ .../HttpClientUnitTest.java | 29 ++++++++++++++++ .../HttpUrlConnectionUnitTest.java | 34 +++++++++++++++++++ .../SpringRestTemplateUnitTest.java | 17 ++++++++++ pom.xml | 4 +-- 6 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/ApacheHttpClientUnitTest.java create mode 100644 httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpClientUnitTest.java create mode 100644 httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpUrlConnectionUnitTest.java create mode 100644 httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/SpringRestTemplateUnitTest.java diff --git a/httpclient-2/pom.xml b/httpclient-2/pom.xml index 1a27d9b5fe..7638c692dc 100644 --- a/httpclient-2/pom.xml +++ b/httpclient-2/pom.xml @@ -4,6 +4,7 @@ 4.0.0 httpclient-2 0.1-SNAPSHOT + httpclient-2 com.baeldung @@ -13,6 +14,7 @@ + org.apache.httpcomponents httpclient @@ -24,6 +26,19 @@ + + + + org.springframework.boot + spring-boot-starter-web + ${spring-boot.version} + + + org.springframework.boot + spring-boot-starter-test + ${spring-boot.version} + test + @@ -34,10 +49,24 @@ true + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source.version} + ${maven.compiler.target.version} + + + 4.5.8 + 11 + 11 + 2.1.7.RELEASE \ No newline at end of file diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/ApacheHttpClientUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/ApacheHttpClientUnitTest.java new file mode 100644 index 0000000000..5a638b2bd5 --- /dev/null +++ b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/ApacheHttpClientUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.httpclient.readresponsebodystring; + +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.junit.Test; + +import java.io.IOException; + +public class ApacheHttpClientUnitTest { + public static final String DUMMY_URL = "https://postman-echo.com/get"; + + @Test + public void whenUseApacheHttpClient_thenCorrect() throws IOException { + HttpGet request = new HttpGet(DUMMY_URL); + + try (CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpResponse response = client.execute(request)) { + HttpEntity entity = response.getEntity(); + String result = EntityUtils.toString(entity); + System.out.println("Response -> " + result); + } + } +} diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpClientUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpClientUnitTest.java new file mode 100644 index 0000000000..1dca1bf7c6 --- /dev/null +++ b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpClientUnitTest.java @@ -0,0 +1,29 @@ +package com.baeldung.httpclient.readresponsebodystring; + +import org.junit.Test; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + +public class HttpClientUnitTest { + public static final String DUMMY_URL = "https://postman-echo.com/get"; + + @Test + public void whenUseHttpClient_thenCorrect() throws IOException, InterruptedException { + HttpClient client = HttpClient.newHttpClient(); + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(DUMMY_URL)).build(); + + // synchronous response + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); + System.out.println(response.body()); + + // asynchronous response + client.sendAsync(request, HttpResponse.BodyHandlers.ofString()) + .thenApply(HttpResponse::body) + .thenAccept(System.out::println) + .join(); + } +} diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpUrlConnectionUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpUrlConnectionUnitTest.java new file mode 100644 index 0000000000..54ae887eb4 --- /dev/null +++ b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/HttpUrlConnectionUnitTest.java @@ -0,0 +1,34 @@ +package com.baeldung.httpclient.readresponsebodystring; + +import org.junit.Assert; +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +public class HttpUrlConnectionUnitTest { + + public static final String DUMMY_URL = "https://postman-echo.com/get"; + + @Test + public void whenUseHttpUrlConnection_thenCorrect() throws IOException { + HttpURLConnection connection = (HttpURLConnection) new URL(DUMMY_URL).openConnection(); + + InputStream inputStream = connection.getInputStream(); + + BufferedReader in = new BufferedReader(new InputStreamReader(inputStream)); + StringBuilder response = new StringBuilder(); + String currentLine; + + while ((currentLine = in.readLine()) != null) + response.append(currentLine); + + in.close(); + Assert.assertNotNull(response.toString()); + System.out.println("Response -> " + response.toString()); + } +} diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/SpringRestTemplateUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/SpringRestTemplateUnitTest.java new file mode 100644 index 0000000000..c59d7662f1 --- /dev/null +++ b/httpclient-2/src/test/java/com/baeldung/httpclient/readresponsebodystring/SpringRestTemplateUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.httpclient.readresponsebodystring; + +import org.junit.Test; +import org.springframework.web.client.RestTemplate; + +public class SpringRestTemplateUnitTest { + + public static final String DUMMY_URL = "https://postman-echo.com/get"; + + @Test + public void whenUseRestTemplate_thenCorrect() { + RestTemplate restTemplate = new RestTemplate(); + String response = restTemplate.getForObject(DUMMY_URL, String.class); + System.out.println(response); + } + +} diff --git a/pom.xml b/pom.xml index 065d6abbdd..c93aeffcbd 100644 --- a/pom.xml +++ b/pom.xml @@ -424,7 +424,7 @@ hazelcast helidon httpclient - httpclient-2 + httpclient-simple hystrix @@ -936,7 +936,7 @@ hazelcast helidon httpclient - httpclient-2 + httpclient-simple hystrix From 664d170cf45b392c23652aa443a945ba0beae5d0 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Mon, 28 Sep 2020 16:29:44 +0200 Subject: [PATCH 0837/1862] BAEL-4656: Get available port number for the test (#10096) --- .../PactConsumerDrivenContractUnitTest.java | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java index e4ac8a3a95..8d4918a3e7 100644 --- a/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java +++ b/libraries-5/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java @@ -7,22 +7,38 @@ import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.model.RequestResponsePact; import org.junit.Rule; import org.junit.Test; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; +import org.springframework.http.*; import org.springframework.web.client.RestTemplate; +import java.io.IOException; +import java.net.ServerSocket; import java.util.HashMap; import java.util.Map; +import java.util.Random; import static org.assertj.core.api.Assertions.assertThat; public class PactConsumerDrivenContractUnitTest { + private static int getAvailablePort() { + return new Random() + .ints(6000, 9000) + .filter(PactConsumerDrivenContractUnitTest::isFree) + .findFirst() + .orElse(8080); + } + + private static boolean isFree(int port) { + try { + new ServerSocket(port).close(); + return true; + } catch (IOException e) { + return false; + } + } + @Rule - public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("test_provider", "localhost", 8080, this); + public PactProviderRuleMk2 mockProvider = new PactProviderRuleMk2("test_provider", "localhost", getAvailablePort(), this); @Pact(consumer = "test_consumer") public RequestResponsePact createPact(PactDslWithProvider builder) { From 7ee94d7455955233b462267d99366e0992e6306a Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Mon, 28 Sep 2020 23:10:40 +0530 Subject: [PATCH 0838/1862] JAVA-2432: Moved articles from here to other modules --- .../spring-hibernate4/.gitignore | 15 - .../spring-hibernate4/README.md | 24 -- persistence-modules/spring-hibernate4/pom.xml | 166 ----------- .../hibernate/audit/AuditorAwareImpl.java | 19 -- .../hibernate/criteria/model/Item.java | 81 ------ .../hibernate/fetching/model/OrderDetail.java | 58 ---- .../hibernate/fetching/model/UserEager.java | 71 ----- .../hibernate/fetching/model/UserLazy.java | 71 ----- .../fetching/util/HibernateUtil.java | 29 -- .../fetching/view/FetchingAppView.java | 68 ----- .../persistence/dao/IBarAuditableDao.java | 8 - .../persistence/dao/IBarCrudRepository.java | 10 - .../com/baeldung/persistence/dao/IBarDao.java | 8 - .../baeldung/persistence/dao/IChildDao.java | 8 - .../persistence/dao/IFooAuditableDao.java | 8 - .../com/baeldung/persistence/dao/IFooDao.java | 8 - .../baeldung/persistence/dao/IParentDao.java | 8 - .../persistence/dao/common/AbstractDao.java | 14 - .../common/AbstractHibernateAuditableDao.java | 37 --- .../dao/common/AbstractHibernateDao.java | 59 ---- .../dao/common/AbstractJpaDao.java | 56 ---- .../dao/common/GenericHibernateDao.java | 13 - .../dao/common/IAuditOperations.java | 14 - .../persistence/dao/common/IGenericDao.java | 7 - .../persistence/dao/common/IOperations.java | 20 -- .../persistence/dao/impl/BarAuditableDao.java | 28 -- .../baeldung/persistence/dao/impl/BarDao.java | 19 -- .../persistence/dao/impl/BarJpaDao.java | 19 -- .../persistence/dao/impl/ChildDao.java | 19 -- .../persistence/dao/impl/FooAuditableDao.java | 17 -- .../baeldung/persistence/dao/impl/FooDao.java | 19 -- .../persistence/dao/impl/ParentDao.java | 19 -- .../com/baeldung/persistence/model/Bar.java | 242 ---------------- .../com/baeldung/persistence/model/Child.java | 51 ---- .../com/baeldung/persistence/model/Foo.java | 105 ------- .../baeldung/persistence/model/Parent.java | 60 ---- .../baeldung/persistence/model/Person.java | 31 --- .../service/IBarAuditableService.java | 8 - .../persistence/service/IBarService.java | 8 - .../persistence/service/IChildService.java | 8 - .../service/IFooAuditableService.java | 8 - .../persistence/service/IFooService.java | 8 - .../persistence/service/IParentService.java | 8 - .../AbstractHibernateAuditableService.java | 30 -- .../common/AbstractHibernateService.java | 42 --- .../service/common/AbstractJpaService.java | 42 --- .../service/common/AbstractService.java | 42 --- .../common/AbstractSpringDataJpaService.java | 46 --- .../service/impl/BarAuditableService.java | 41 --- .../service/impl/BarJpaService.java | 30 -- .../persistence/service/impl/BarService.java | 30 -- .../service/impl/BarSpringDataJpaService.java | 26 -- .../service/impl/ChildService.java | 28 -- .../service/impl/FooAuditableService.java | 41 --- .../persistence/service/impl/FooService.java | 30 -- .../service/impl/ParentService.java | 28 -- .../baeldung/spring/PersistenceConfig.java | 186 ------------- .../baeldung/spring/PersistenceXmlConfig.java | 18 -- .../src/main/resources/fetching.cfg.xml | 20 -- .../src/main/resources/fetchingLazy.cfg.xml | 17 -- .../resources/fetching_create_queries.sql | 14 - .../src/main/resources/hibernate4Config.xml | 34 --- .../src/main/resources/immutable.cfg.xml | 38 --- .../src/main/resources/insert_statements.sql | 31 --- .../src/main/resources/logback.xml | 19 -- .../resources/persistence-mysql.properties | 13 - .../src/main/resources/stored_procedure.sql | 20 -- .../src/main/resources/webSecurityConfig.xml | 37 --- .../java/com/baeldung/SpringContextTest.java | 18 -- .../HibernateFetchingIntegrationTest.java | 42 --- .../persistence/IntegrationTestSuite.java | 25 -- .../persistence/audit/AuditTestSuite.java | 14 - .../EnversFooBarAuditIntegrationTest.java | 146 ---------- .../audit/JPABarAuditIntegrationTest.java | 103 ------- .../SpringDataJPABarAuditIntegrationTest.java | 77 ----- .../persistence/hibernate/FooFixtures.java | 101 ------- ...oPaginationPersistenceIntegrationTest.java | 185 ------------- .../FooSortingPersistenceIntegrationTest.java | 174 ------------ .../save/SaveMethodsIntegrationTest.java | 262 ------------------ ...erviceBasicPersistenceIntegrationTest.java | 55 ---- .../FooServicePersistenceIntegrationTest.java | 64 ----- .../service/FooStoredProceduresLiveTest.java | 121 -------- ...rentServicePersistenceIntegrationTest.java | 70 ----- .../spring/config/PersistenceTestConfig.java | 179 ------------ .../src/test/resources/.gitignore | 13 - .../src/test/resources/fetching.cfg.xml | 19 -- .../src/test/resources/fetchingLazy.cfg.xml | 19 -- .../test/resources/persistence-h2.properties | 13 - 88 files changed, 4160 deletions(-) delete mode 100644 persistence-modules/spring-hibernate4/.gitignore delete mode 100644 persistence-modules/spring-hibernate4/README.md delete mode 100644 persistence-modules/spring-hibernate4/pom.xml delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/logback.xml delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql delete mode 100644 persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java delete mode 100644 persistence-modules/spring-hibernate4/src/test/resources/.gitignore delete mode 100644 persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml delete mode 100644 persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml delete mode 100644 persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties diff --git a/persistence-modules/spring-hibernate4/.gitignore b/persistence-modules/spring-hibernate4/.gitignore deleted file mode 100644 index d31cc4c619..0000000000 --- a/persistence-modules/spring-hibernate4/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear -/target/ -/target/ diff --git a/persistence-modules/spring-hibernate4/README.md b/persistence-modules/spring-hibernate4/README.md deleted file mode 100644 index a5a72a9b7e..0000000000 --- a/persistence-modules/spring-hibernate4/README.md +++ /dev/null @@ -1,24 +0,0 @@ -## Spring with Hibernate 4 - -This module contains articles about Spring with Hibernate 4 - -### Relevant Articles: -- [Guide to Hibernate 4 with Spring](https://www.baeldung.com/hibernate-4-spring) -- [Hibernate Pagination](https://www.baeldung.com/hibernate-pagination) -- [Sorting with Hibernate](https://www.baeldung.com/hibernate-sort) -- [Stored Procedures with Hibernate](https://www.baeldung.com/stored-procedures-with-hibernate-tutorial) -- [Hibernate: save, persist, update, merge, saveOrUpdate](https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate) -- [Eager/Lazy Loading In Hibernate](https://www.baeldung.com/hibernate-lazy-eager-loading) -- [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa) - -### Quick Start - -``` -git clone git://github.com/eugenp/REST.git -cd REST -mvn install -mvn cargo:run -``` - -- **note**: starts on port `8082` - diff --git a/persistence-modules/spring-hibernate4/pom.xml b/persistence-modules/spring-hibernate4/pom.xml deleted file mode 100644 index 3e5a6f913f..0000000000 --- a/persistence-modules/spring-hibernate4/pom.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - 4.0.0 - spring-hibernate4 - 0.1-SNAPSHOT - spring-hibernate4 - - - com.baeldung - parent-spring-4 - 0.0.1-SNAPSHOT - ../../parent-spring-4 - - - - - - - org.springframework - spring-context - ${org.springframework.version} - - - commons-logging - commons-logging - - - - - org.springframework - spring-aspects - ${org.springframework.version} - - - org.springframework.security - spring-security-core - ${org.springframework.security.version} - - - - - - org.springframework - spring-orm - ${org.springframework.version} - - - org.springframework.data - spring-data-jpa - ${org.springframework.data.version} - - - org.hibernate - hibernate-core - ${hibernate.version} - - - org.hibernate - hibernate-envers - ${hibernate-envers.version} - - - javax.transaction - jta - ${jta.version} - - - mysql - mysql-connector-java - ${mysql-connector-java.version} - - - - org.apache.tomcat - tomcat-dbcp - ${tomcat-dbcp.version} - - - - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - - javax.el - javax.el-api - ${javax.el-api.version} - - - - - - com.google.guava - guava - ${guava.version} - - - - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - test - - - - org.springframework - spring-test - ${org.springframework.version} - test - - - - org.springframework.security - spring-security-test - ${org.springframework.security.version} - test - - - - org.hsqldb - hsqldb - ${hsqldb.version} - test - - - com.h2database - h2 - ${h2.version} - test - - - - - - - 4.3.4.RELEASE - 4.2.0.RELEASE - 1.10.5.RELEASE - - - 4.3.11.Final - ${hibernate.version} - 5.1.40 - 8.5.8 - 1.1 - 2.3.4 - - - 5.3.3.Final - 2.2.5 - - - 19.0 - - - 2.22.2 - 5.6.2 - 4.13 - - - diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java deleted file mode 100644 index 7aef08b2ce..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.hibernate.audit; - -import java.util.Optional; - -import org.springframework.data.domain.AuditorAware; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; - -public class AuditorAwareImpl implements AuditorAware { - - @Override - public String getCurrentAuditor() { - return Optional.ofNullable(SecurityContextHolder.getContext()) - .map(e -> e.getAuthentication()) - .map(Authentication::getName) - .orElse(null); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java deleted file mode 100644 index 957207b7e6..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/criteria/model/Item.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.baeldung.hibernate.criteria.model; - -import java.io.Serializable; - -public class Item implements Serializable { - - private static final long serialVersionUID = 1L; - private Integer itemId; - private String itemName; - private String itemDescription; - private Integer itemPrice; - - // constructors - public Item() { - - } - - public Item(final Integer itemId, final String itemName, final String itemDescription) { - super(); - this.itemId = itemId; - this.itemName = itemName; - this.itemDescription = itemDescription; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((itemId == null) ? 0 : itemId.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final Item other = (Item) obj; - if (itemId == null) { - if (other.itemId != null) - return false; - } else if (!itemId.equals(other.itemId)) - return false; - return true; - } - - public Integer getItemId() { - return itemId; - } - - public void setItemId(final Integer itemId) { - this.itemId = itemId; - } - - public String getItemName() { - return itemName; - } - - public void setItemName(final String itemName) { - this.itemName = itemName; - } - - public String getItemDescription() { - return itemDescription; - } - - public Integer getItemPrice() { - return itemPrice; - } - - public void setItemPrice(final Integer itemPrice) { - this.itemPrice = itemPrice; - } - - public void setItemDescription(final String itemDescription) { - this.itemDescription = itemDescription; - } -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java deleted file mode 100644 index f4a9b8a678..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baeldung.hibernate.fetching.model; - -import javax.persistence.*; -import java.io.Serializable; -import java.sql.Date; - -@Entity -@Table(name = "USER_ORDER") -public class OrderDetail implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue - @Column(name = "ORDER_ID") - private Long orderId; - - public OrderDetail() { - } - - public OrderDetail(Date orderDate, String orderDesc) { - super(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((orderId == null) ? 0 : orderId.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - OrderDetail other = (OrderDetail) obj; - if (orderId == null) { - if (other.orderId != null) - return false; - } else if (!orderId.equals(other.orderId)) - return false; - - return true; - } - - public Long getOrderId() { - return orderId; - } - - public void setOrderId(Long orderId) { - this.orderId = orderId; - } -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java deleted file mode 100644 index 9fda4c43bb..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.baeldung.hibernate.fetching.model; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; - -@Entity -@Table(name = "USER") -public class UserEager implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue - @Column(name = "USER_ID") - private Long userId; - - @OneToMany(fetch = FetchType.EAGER) - private Set orderDetail = new HashSet(); - - public UserEager() { - } - - public UserEager(final Long userId) { - super(); - this.userId = userId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((userId == null) ? 0 : userId.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final UserEager other = (UserEager) obj; - if (userId == null) { - if (other.userId != null) - return false; - } else if (!userId.equals(other.userId)) - return false; - return true; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(final Long userId) { - this.userId = userId; - } - - public Set getOrderDetail() { - return orderDetail; - } - - public void setOrderDetail(Set orderDetail) { - this.orderDetail = orderDetail; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java deleted file mode 100644 index a78eaa4ac0..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.baeldung.hibernate.fetching.model; - -import javax.persistence.*; -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; - -@Entity -@Table(name = "USER") -public class UserLazy implements Serializable { - - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue - @Column(name = "USER_ID") - private Long userId; - - @OneToMany(fetch = FetchType.LAZY) - private Set orderDetail = new HashSet(); - - public UserLazy() { - } - - public UserLazy(final Long userId) { - super(); - this.userId = userId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((userId == null) ? 0 : userId.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final UserLazy other = (UserLazy) obj; - if (userId == null) { - if (other.userId != null) - return false; - } else if (!userId.equals(other.userId)) - return false; - return true; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(final Long userId) { - this.userId = userId; - } - - public Set getOrderDetail() { - return orderDetail; - } - - public void setOrderDetail(Set orderDetail) { - this.orderDetail = orderDetail; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java deleted file mode 100644 index c7be96abb7..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.hibernate.fetching.util; - -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.cfg.Configuration; - -public class HibernateUtil { - - @SuppressWarnings("deprecation") - public static Session getHibernateSession(String fetchMethod) { - // two config files are there - // one with lazy loading enabled - // another lazy = false - SessionFactory sf; - if ("lazy".equals(fetchMethod)) { - sf = new Configuration().configure("fetchingLazy.cfg.xml").buildSessionFactory(); - } else { - sf = new Configuration().configure("fetching.cfg.xml").buildSessionFactory(); - } - - // fetching.cfg.xml is used for this example - return sf.openSession(); - } - - public static Session getHibernateSession() { - return new Configuration().configure("fetching.cfg.xml").buildSessionFactory().openSession(); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java deleted file mode 100644 index 35cdd254e3..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.baeldung.hibernate.fetching.view; - -import com.baeldung.hibernate.fetching.model.OrderDetail; -import com.baeldung.hibernate.fetching.model.UserEager; -import com.baeldung.hibernate.fetching.model.UserLazy; -import com.baeldung.hibernate.fetching.util.HibernateUtil; -import org.hibernate.Session; -import org.hibernate.Transaction; - -import java.util.List; -import java.util.Set; - -public class FetchingAppView { - - public FetchingAppView() { - - } - - // lazily loaded - public Set lazyLoaded() { - final Session sessionLazy = HibernateUtil.getHibernateSession("lazy"); - List users = sessionLazy.createQuery("From UserLazy").list(); - UserLazy userLazyLoaded = users.get(0); - // since data is lazyloaded so data won't be initialized - return (userLazyLoaded.getOrderDetail()); - } - - // eagerly loaded - public Set eagerLoaded() { - final Session sessionEager = HibernateUtil.getHibernateSession(); - // data should be loaded in the following line - // also note the queries generated - List user = sessionEager.createQuery("From UserEager").list(); - UserEager userEagerLoaded = user.get(0); - return userEagerLoaded.getOrderDetail(); - } - - // creates test data - // call this method to create the data in the database - public void createTestData() { - - final Session session = HibernateUtil.getHibernateSession("lazy"); - Transaction tx = session.beginTransaction(); - final UserLazy user1 = new UserLazy(); - final UserLazy user2 = new UserLazy(); - final UserLazy user3 = new UserLazy(); - - session.save(user1); - session.save(user2); - session.save(user3); - - final OrderDetail order1 = new OrderDetail(); - final OrderDetail order2 = new OrderDetail(); - final OrderDetail order3 = new OrderDetail(); - final OrderDetail order4 = new OrderDetail(); - final OrderDetail order5 = new OrderDetail(); - - session.saveOrUpdate(order1); - session.saveOrUpdate(order2); - session.saveOrUpdate(order3); - session.saveOrUpdate(order4); - session.saveOrUpdate(order5); - - tx.commit(); - session.close(); - - } -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java deleted file mode 100644 index 182b493592..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.dao.common.IAuditOperations; -import com.baeldung.persistence.model.Bar; - -public interface IBarAuditableDao extends IBarDao, IAuditOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java deleted file mode 100644 index 4d7db64240..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.persistence.dao; - -import java.io.Serializable; - -import com.baeldung.persistence.model.Bar; -import org.springframework.data.repository.CrudRepository; - -public interface IBarCrudRepository extends CrudRepository { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java deleted file mode 100644 index 7896a2a84a..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IBarDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.model.Bar; - -public interface IBarDao extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java deleted file mode 100644 index a55a0b0598..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IChildDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.model.Child; -import com.baeldung.persistence.dao.common.IOperations; - -public interface IChildDao extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java deleted file mode 100644 index ddbb685988..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.dao.common.IAuditOperations; -import com.baeldung.persistence.model.Foo; - -public interface IFooAuditableDao extends IFooDao, IAuditOperations { - // -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java deleted file mode 100644 index 0935772dbd..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IFooDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.persistence.dao.common.IOperations; - -public interface IFooDao extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java deleted file mode 100644 index 03680158bb..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/IParentDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.model.Parent; -import com.baeldung.persistence.dao.common.IOperations; - -public interface IParentDao extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java deleted file mode 100644 index 5a6c76a93a..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; - -import com.google.common.base.Preconditions; - -public abstract class AbstractDao implements IOperations { - - protected Class clazz; - - protected final void setClazz(final Class clazzToSet) { - clazz = Preconditions.checkNotNull(clazzToSet); - } -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java deleted file mode 100644 index 41184669ad..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; -import java.util.List; - -import org.hibernate.envers.AuditReader; -import org.hibernate.envers.AuditReaderFactory; -import org.hibernate.envers.query.AuditQuery; - -@SuppressWarnings("unchecked") -public class AbstractHibernateAuditableDao extends AbstractHibernateDao implements IAuditOperations { - - @Override - public List getEntitiesAtRevision(final Number revision) { - final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); - final AuditQuery query = auditReader.createQuery().forEntitiesAtRevision(clazz, revision); - final List resultList = query.getResultList(); - return resultList; - } - - @Override - public List getEntitiesModifiedAtRevision(final Number revision) { - final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); - final AuditQuery query = auditReader.createQuery().forEntitiesModifiedAtRevision(clazz, revision); - final List resultList = query.getResultList(); - return resultList; - } - - @Override - public List getRevisions() { - final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); - final AuditQuery query = auditReader.createQuery().forRevisionsOfEntity(clazz, true, true); - final List resultList = query.getResultList(); - return resultList; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java deleted file mode 100644 index f3ade67f80..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; -import java.util.List; - -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; - -import com.google.common.base.Preconditions; - -@SuppressWarnings("unchecked") -public abstract class AbstractHibernateDao extends AbstractDao implements IOperations { - - @Autowired - protected SessionFactory sessionFactory; - - // API - - @Override - public T findOne(final long id) { - return (T) getCurrentSession().get(clazz, id); - } - - @Override - public List findAll() { - return getCurrentSession().createQuery("from " + clazz.getName()).list(); - } - - @Override - public void create(final T entity) { - Preconditions.checkNotNull(entity); - getCurrentSession().saveOrUpdate(entity); - } - - @Override - public T update(final T entity) { - Preconditions.checkNotNull(entity); - return (T) getCurrentSession().merge(entity); - } - - @Override - public void delete(final T entity) { - Preconditions.checkNotNull(entity); - getCurrentSession().delete(entity); - } - - @Override - public void deleteById(final long entityId) { - final T entity = findOne(entityId); - Preconditions.checkState(entity != null); - delete(entity); - } - - protected Session getCurrentSession() { - return sessionFactory.getCurrentSession(); - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java deleted file mode 100644 index 69f8e58c25..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Root; - -public class AbstractJpaDao extends AbstractDao implements IOperations { - - @PersistenceContext - private EntityManager em; - - // API - - @Override - public T findOne(final long id) { - return em.find(clazz, Long.valueOf(id).intValue()); - } - - @Override - public List findAll() { - final CriteriaBuilder cb = em.getCriteriaBuilder(); - final CriteriaQuery cq = cb.createQuery(clazz); - final Root rootEntry = cq.from(clazz); - final CriteriaQuery all = cq.select(rootEntry); - final TypedQuery allQuery = em.createQuery(all); - return allQuery.getResultList(); - } - - @Override - public void create(final T entity) { - em.persist(entity); - } - - @Override - public T update(final T entity) { - em.merge(entity); - return entity; - } - - @Override - public void delete(final T entity) { - em.remove(entity); - } - - @Override - public void deleteById(final long entityId) { - delete(findOne(entityId)); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java deleted file mode 100644 index 18b16fa033..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Repository; - -@Repository -@Scope(BeanDefinition.SCOPE_PROTOTYPE) -public class GenericHibernateDao extends AbstractHibernateDao implements IGenericDao { - // -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java deleted file mode 100644 index 169d3fed72..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; -import java.util.List; - -public interface IAuditOperations { - - List getEntitiesAtRevision(Number revision); - - List getEntitiesModifiedAtRevision(Number revision); - - List getRevisions(); - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java deleted file mode 100644 index 8d8af18394..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; - -public interface IGenericDao extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java deleted file mode 100644 index 4ef99221ab..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/common/IOperations.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.persistence.dao.common; - -import java.io.Serializable; -import java.util.List; - -public interface IOperations { - - T findOne(final long id); - - List findAll(); - - void create(final T entity); - - T update(final T entity); - - void delete(final T entity); - - void deleteById(final long entityId); - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java deleted file mode 100644 index e12b6ae2da..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.persistence.dao.impl; - -import java.util.List; - -import com.baeldung.persistence.dao.IBarAuditableDao; -import com.baeldung.persistence.dao.common.AbstractHibernateAuditableDao; -import com.baeldung.persistence.model.Bar; - -public class BarAuditableDao extends AbstractHibernateAuditableDao implements IBarAuditableDao { - - public BarAuditableDao() { - super(); - - setClazz(Bar.class); - } - - // API - - @Override - public List getRevisions() { - final List resultList = super.getRevisions(); - for (final Bar bar : resultList) { - bar.getFooSet().size(); // force FooSet initialization - } - return resultList; - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java deleted file mode 100644 index 0ead802dc5..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.persistence.dao.impl; - -import com.baeldung.persistence.dao.common.AbstractHibernateDao; -import com.baeldung.persistence.dao.IBarDao; -import com.baeldung.persistence.model.Bar; -import org.springframework.stereotype.Repository; - -@Repository -public class BarDao extends AbstractHibernateDao implements IBarDao { - - public BarDao() { - super(); - - setClazz(Bar.class); - } - - // API - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java deleted file mode 100644 index e0fa382d41..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.persistence.dao.impl; - -import com.baeldung.persistence.dao.IBarDao; -import com.baeldung.persistence.dao.common.AbstractJpaDao; -import com.baeldung.persistence.model.Bar; -import org.springframework.stereotype.Repository; - -@Repository -public class BarJpaDao extends AbstractJpaDao implements IBarDao { - - public BarJpaDao() { - super(); - - setClazz(Bar.class); - } - - // API - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java deleted file mode 100644 index b55da6e43a..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.persistence.dao.impl; - -import com.baeldung.persistence.dao.common.AbstractHibernateDao; -import com.baeldung.persistence.model.Child; -import com.baeldung.persistence.dao.IChildDao; -import org.springframework.stereotype.Repository; - -@Repository -public class ChildDao extends AbstractHibernateDao implements IChildDao { - - public ChildDao() { - super(); - - setClazz(Child.class); - } - - // API - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java deleted file mode 100644 index 05064c1478..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.persistence.dao.impl; - -import com.baeldung.persistence.dao.common.AbstractHibernateAuditableDao; -import com.baeldung.persistence.model.Foo; -import com.baeldung.persistence.dao.IFooAuditableDao; - -public class FooAuditableDao extends AbstractHibernateAuditableDao implements IFooAuditableDao { - - public FooAuditableDao() { - super(); - - setClazz(Foo.class); - } - - // API - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java deleted file mode 100644 index 787c449b1d..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.persistence.dao.impl; - -import com.baeldung.persistence.dao.common.AbstractHibernateDao; -import com.baeldung.persistence.dao.IFooDao; -import com.baeldung.persistence.model.Foo; -import org.springframework.stereotype.Repository; - -@Repository -public class FooDao extends AbstractHibernateDao implements IFooDao { - - public FooDao() { - super(); - - setClazz(Foo.class); - } - - // API - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java deleted file mode 100644 index 4602b5f30e..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.persistence.dao.impl; - -import com.baeldung.persistence.dao.IParentDao; -import com.baeldung.persistence.dao.common.AbstractHibernateDao; -import com.baeldung.persistence.model.Parent; -import org.springframework.stereotype.Repository; - -@Repository -public class ParentDao extends AbstractHibernateDao implements IParentDao { - - public ParentDao() { - super(); - - setClazz(Parent.class); - } - - // API - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java deleted file mode 100644 index c7f05254cc..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Bar.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.baeldung.persistence.model; - -import java.io.Serializable; -import java.util.Date; -import java.util.Set; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EntityListeners; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.NamedQuery; -import javax.persistence.OneToMany; -import javax.persistence.PrePersist; -import javax.persistence.PreRemove; -import javax.persistence.PreUpdate; - -import org.hibernate.annotations.OrderBy; -import org.hibernate.envers.Audited; -import org.jboss.logging.Logger; -import org.springframework.data.annotation.CreatedBy; -import org.springframework.data.annotation.CreatedDate; -import org.springframework.data.annotation.LastModifiedBy; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import com.google.common.collect.Sets; - -@Entity -@NamedQuery(name = "Bar.findAll", query = "SELECT b FROM Bar b") -@Audited -@EntityListeners(AuditingEntityListener.class) -public class Bar implements Serializable { - - private static Logger logger = Logger.getLogger(Bar.class); - - public enum OPERATION { - INSERT, UPDATE, DELETE; - private String value; - - OPERATION() { - value = toString(); - } - - public String getValue() { - return value; - } - - public static OPERATION parse(final String value) { - OPERATION operation = null; - for (final OPERATION op : OPERATION.values()) { - if (op.getValue().equals(value)) { - operation = op; - break; - } - } - return operation; - } - }; - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private int id; - - @Column(name = "name") - private String name; - - @OneToMany(mappedBy = "bar", cascade = CascadeType.ALL, fetch = FetchType.LAZY) - @OrderBy(clause = "NAME DESC") - // @NotAudited - private Set fooSet = Sets.newHashSet(); - - @Column(name = "operation") - private String operation; - - @Column(name = "timestamp") - private long timestamp; - - @Column(name = "created_date", updatable = false, nullable = false) - @CreatedDate - private long createdDate; - - @Column(name = "modified_date") - @LastModifiedDate - private long modifiedDate; - - @Column(name = "created_by") - @CreatedBy - private String createdBy; - - @Column(name = "modified_by") - @LastModifiedBy - private String modifiedBy; - - public Bar() { - super(); - } - - public Bar(final String name) { - super(); - - this.name = name; - } - - // API - - public Set getFooSet() { - return fooSet; - } - - public void setFooSet(final Set fooSet) { - this.fooSet = fooSet; - } - - public int getId() { - return id; - } - - public void setId(final int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - public OPERATION getOperation() { - return OPERATION.parse(operation); - } - - public void setOperation(final OPERATION operation) { - this.operation = operation.getValue(); - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(final long timestamp) { - this.timestamp = timestamp; - } - - public long getCreatedDate() { - return createdDate; - } - - public void setCreatedDate(final long createdDate) { - this.createdDate = createdDate; - } - - public long getModifiedDate() { - return modifiedDate; - } - - public void setModifiedDate(final long modifiedDate) { - this.modifiedDate = modifiedDate; - } - - public String getCreatedBy() { - return createdBy; - } - - public void setCreatedBy(final String createdBy) { - this.createdBy = createdBy; - } - - public String getModifiedBy() { - return modifiedBy; - } - - public void setModifiedBy(final String modifiedBy) { - this.modifiedBy = modifiedBy; - } - - public void setOperation(final String operation) { - this.operation = operation; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final Bar other = (Bar) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Bar [name=").append(name).append("]"); - return builder.toString(); - } - - @PrePersist - public void onPrePersist() { - logger.info("@PrePersist"); - audit(OPERATION.INSERT); - } - - @PreUpdate - public void onPreUpdate() { - logger.info("@PreUpdate"); - audit(OPERATION.UPDATE); - } - - @PreRemove - public void onPreRemove() { - logger.info("@PreRemove"); - audit(OPERATION.DELETE); - } - - private void audit(final OPERATION operation) { - setOperation(operation); - setTimestamp((new Date()).getTime()); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java deleted file mode 100644 index 19cfb2e237..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Child.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baeldung.persistence.model; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.OneToOne; - -@Entity -public class Child implements Serializable { - - @Id - @GeneratedValue - private long id; - - @OneToOne(mappedBy = "child") - private Parent parent; - - public Child() { - super(); - } - - // API - - public long getId() { - return id; - } - - public void setId(final long id) { - this.id = id; - } - - public Parent getParent() { - return parent; - } - - public void setParent(final Parent parent) { - this.parent = parent; - } - - // - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Child [id=").append(id).append("]"); - return builder.toString(); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java deleted file mode 100644 index d36a1e58cf..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Foo.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.baeldung.persistence.model; - -import java.io.Serializable; - -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.NamedNativeQueries; -import javax.persistence.NamedNativeQuery; - -import org.hibernate.envers.Audited; - -@NamedNativeQueries({ @NamedNativeQuery(name = "callGetAllFoos", query = "CALL GetAllFoos()", resultClass = Foo.class), @NamedNativeQuery(name = "callGetFoosByName", query = "CALL GetFoosByName(:fooName)", resultClass = Foo.class) }) -@Entity -@Audited -// @Proxy(lazy = false) -public class Foo implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id") - private long id; - - @Column(name = "name") - private String name; - - @ManyToOne(targetEntity = Bar.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER) - @JoinColumn(name = "BAR_ID") - private Bar bar = new Bar(); - - public Foo() { - super(); - } - - public Foo(final String name) { - super(); - this.name = name; - } - - // - - public Bar getBar() { - return bar; - } - - public void setBar(final Bar bar) { - this.bar = bar; - } - - public long getId() { - return id; - } - - public void setId(final long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - - // - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final Foo other = (Foo) obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Foo [name=").append(name).append("]"); - return builder.toString(); - } -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java deleted file mode 100644 index fa6948990b..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Parent.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.baeldung.persistence.model; - -import java.io.Serializable; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; - -@Entity -public class Parent implements Serializable { - - @Id - @GeneratedValue - private long id; - - @OneToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH }) - @JoinColumn(name = "child_fk") - private Child child; - - public Parent() { - super(); - } - - public Parent(final Child child) { - super(); - - this.child = child; - } - - // API - - public long getId() { - return id; - } - - public void setId(final long id) { - this.id = id; - } - - public Child getChild() { - return child; - } - - public void setChild(final Child child) { - this.child = child; - } - - // - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("Parent [id=").append(id).append("]"); - return builder.toString(); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java deleted file mode 100644 index 6a95a7acf5..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/model/Person.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.persistence.model; - -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; - -@Entity -public class Person { - - @Id - @GeneratedValue - private Long id; - - private String name; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java deleted file mode 100644 index 33e5634d12..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.service; - -import com.baeldung.persistence.dao.common.IAuditOperations; -import com.baeldung.persistence.model.Bar; - -public interface IBarAuditableService extends IBarService, IAuditOperations { - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java deleted file mode 100644 index 21185b5990..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IBarService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.service; - -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.model.Bar; - -public interface IBarService extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java deleted file mode 100644 index afe67a70c2..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IChildService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.service; - -import com.baeldung.persistence.model.Child; -import com.baeldung.persistence.dao.common.IOperations; - -public interface IChildService extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java deleted file mode 100644 index b787e7fe91..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.service; - -import com.baeldung.persistence.dao.common.IAuditOperations; -import com.baeldung.persistence.model.Foo; - -public interface IFooAuditableService extends IFooService, IAuditOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java deleted file mode 100644 index ffdb53964a..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IFooService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.service; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.persistence.dao.common.IOperations; - -public interface IFooService extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java deleted file mode 100644 index f941416aac..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/IParentService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.persistence.service; - -import com.baeldung.persistence.model.Parent; -import com.baeldung.persistence.dao.common.IOperations; - -public interface IParentService extends IOperations { - // -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java deleted file mode 100644 index 2695d7760a..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.persistence.service.common; - -import java.io.Serializable; -import java.util.List; - -import com.baeldung.persistence.dao.common.IAuditOperations; -import com.baeldung.persistence.dao.common.IOperations; -import org.springframework.transaction.annotation.Transactional; - -@Transactional(value = "hibernateTransactionManager") -public abstract class AbstractHibernateAuditableService extends AbstractHibernateService implements IOperations, IAuditOperations { - - @Override - public List getEntitiesAtRevision(final Number revision) { - return getAuditableDao().getEntitiesAtRevision(revision); - } - - @Override - public List getEntitiesModifiedAtRevision(final Number revision) { - return getAuditableDao().getEntitiesModifiedAtRevision(revision); - } - - @Override - public List getRevisions() { - return getAuditableDao().getRevisions(); - } - - abstract protected IAuditOperations getAuditableDao(); - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java deleted file mode 100644 index 02b8ccf48b..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.persistence.service.common; - -import java.io.Serializable; -import java.util.List; - -import com.baeldung.persistence.dao.common.IOperations; -import org.springframework.transaction.annotation.Transactional; - -@Transactional(value = "hibernateTransactionManager") -public abstract class AbstractHibernateService extends AbstractService implements IOperations { - - @Override - public T findOne(final long id) { - return super.findOne(id); - } - - @Override - public List findAll() { - return super.findAll(); - } - - @Override - public void create(final T entity) { - super.create(entity); - } - - @Override - public T update(final T entity) { - return super.update(entity); - } - - @Override - public void delete(final T entity) { - super.delete(entity); - } - - @Override - public void deleteById(final long entityId) { - super.deleteById(entityId); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java deleted file mode 100644 index a1c6fe9edf..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.persistence.service.common; - -import java.io.Serializable; -import java.util.List; - -import com.baeldung.persistence.dao.common.IOperations; -import org.springframework.transaction.annotation.Transactional; - -@Transactional(value = "jpaTransactionManager") -public abstract class AbstractJpaService extends AbstractService implements IOperations { - - @Override - public T findOne(final long id) { - return super.findOne(id); - } - - @Override - public List findAll() { - return super.findAll(); - } - - @Override - public void create(final T entity) { - super.create(entity); - } - - @Override - public T update(final T entity) { - return super.update(entity); - } - - @Override - public void delete(final T entity) { - super.delete(entity); - } - - @Override - public void deleteById(final long entityId) { - super.deleteById(entityId); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java deleted file mode 100644 index 9b001b1fac..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.persistence.service.common; - -import java.io.Serializable; -import java.util.List; - -import com.baeldung.persistence.dao.common.IOperations; - -public abstract class AbstractService implements IOperations { - - @Override - public T findOne(final long id) { - return getDao().findOne(id); - } - - @Override - public List findAll() { - return getDao().findAll(); - } - - @Override - public void create(final T entity) { - getDao().create(entity); - } - - @Override - public T update(final T entity) { - return getDao().update(entity); - } - - @Override - public void delete(final T entity) { - getDao().delete(entity); - } - - @Override - public void deleteById(final long entityId) { - getDao().deleteById(entityId); - } - - protected abstract IOperations getDao(); - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java deleted file mode 100644 index cef483e6bf..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.persistence.service.common; - -import java.io.Serializable; -import java.util.List; - -import com.baeldung.persistence.dao.common.IOperations; -import org.springframework.data.repository.CrudRepository; -import org.springframework.transaction.annotation.Transactional; - -import com.google.common.collect.Lists; - -@Transactional(value = "jpaTransactionManager") -public abstract class AbstractSpringDataJpaService implements IOperations { - - @Override - public T findOne(final long id) { - return getDao().findOne(Long.valueOf(id)); - } - - @Override - public List findAll() { - return Lists.newArrayList(getDao().findAll()); - } - - @Override - public void create(final T entity) { - getDao().save(entity); - } - - @Override - public T update(final T entity) { - return getDao().save(entity); - } - - @Override - public void delete(final T entity) { - getDao().delete(entity); - } - - @Override - public void deleteById(final long entityId) { - getDao().delete(Long.valueOf(entityId)); - } - - protected abstract CrudRepository getDao(); -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java deleted file mode 100644 index d84c28caa5..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.persistence.service.impl; - -import com.baeldung.persistence.dao.common.IAuditOperations; -import com.baeldung.persistence.service.common.AbstractHibernateAuditableService; -import com.baeldung.persistence.dao.IBarAuditableDao; -import com.baeldung.persistence.dao.IBarDao; -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.service.IBarAuditableService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -@Service -public class BarAuditableService extends AbstractHibernateAuditableService implements IBarAuditableService { - - @Autowired - @Qualifier("barHibernateDao") - private IBarDao dao; - - @Autowired - @Qualifier("barHibernateAuditableDao") - private IBarAuditableDao auditDao; - - public BarAuditableService() { - super(); - } - - // API - - @Override - protected IOperations getDao() { - return dao; - } - - @Override - protected IAuditOperations getAuditableDao() { - return auditDao; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java deleted file mode 100644 index 1c1b7a2274..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.persistence.service.impl; - -import com.baeldung.persistence.dao.IBarDao; -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.service.IBarService; -import com.baeldung.persistence.service.common.AbstractJpaService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -@Service -public class BarJpaService extends AbstractJpaService implements IBarService { - - @Autowired - @Qualifier("barJpaDao") - private IBarDao dao; - - public BarJpaService() { - super(); - } - - // API - - @Override - protected IOperations getDao() { - return dao; - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java deleted file mode 100644 index 32d1f919c5..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.persistence.service.impl; - -import com.baeldung.persistence.dao.IBarDao; -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.service.IBarService; -import com.baeldung.persistence.service.common.AbstractHibernateService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -@Service -public class BarService extends AbstractHibernateService implements IBarService { - - @Autowired - @Qualifier("barHibernateDao") - private IBarDao dao; - - public BarService() { - super(); - } - - // API - - @Override - protected IOperations getDao() { - return dao; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java deleted file mode 100644 index 4a55d08a35..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.persistence.service.impl; - -import java.io.Serializable; - -import com.baeldung.persistence.service.common.AbstractSpringDataJpaService; -import com.baeldung.persistence.dao.IBarCrudRepository; -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.service.IBarService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.repository.CrudRepository; - -public class BarSpringDataJpaService extends AbstractSpringDataJpaService implements IBarService { - - @Autowired - private IBarCrudRepository dao; - - public BarSpringDataJpaService() { - super(); - } - - @Override - protected CrudRepository getDao() { - return dao; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java deleted file mode 100644 index 417fe2c49a..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ChildService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.persistence.service.impl; - -import com.baeldung.persistence.model.Child; -import com.baeldung.persistence.service.IChildService; -import com.baeldung.persistence.dao.IChildDao; -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.service.common.AbstractHibernateService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ChildService extends AbstractHibernateService implements IChildService { - - @Autowired - private IChildDao dao; - - public ChildService() { - super(); - } - - // API - - @Override - protected IOperations getDao() { - return dao; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java deleted file mode 100644 index 45ad315c42..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.persistence.service.impl; - -import com.baeldung.persistence.dao.common.IAuditOperations; -import com.baeldung.persistence.service.IFooAuditableService; -import com.baeldung.persistence.service.common.AbstractHibernateAuditableService; -import com.baeldung.persistence.dao.IFooAuditableDao; -import com.baeldung.persistence.dao.IFooDao; -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.model.Foo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -@Service -public class FooAuditableService extends AbstractHibernateAuditableService implements IFooAuditableService { - - @Autowired - @Qualifier("fooHibernateDao") - private IFooDao dao; - - @Autowired - @Qualifier("fooHibernateAuditableDao") - private IFooAuditableDao auditDao; - - public FooAuditableService() { - super(); - } - - // API - - @Override - protected IOperations getDao() { - return dao; - } - - @Override - protected IAuditOperations getAuditableDao() { - return auditDao; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java deleted file mode 100644 index 84cf018fee..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/FooService.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.persistence.service.impl; - -import com.baeldung.persistence.dao.IFooDao; -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.model.Foo; -import com.baeldung.persistence.service.IFooService; -import com.baeldung.persistence.service.common.AbstractHibernateService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; - -@Service -public class FooService extends AbstractHibernateService implements IFooService { - - @Autowired - @Qualifier("fooHibernateDao") - private IFooDao dao; - - public FooService() { - super(); - } - - // API - - @Override - protected IOperations getDao() { - return dao; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java deleted file mode 100644 index 078acfc369..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/persistence/service/impl/ParentService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.persistence.service.impl; - -import com.baeldung.persistence.model.Parent; -import com.baeldung.persistence.service.IParentService; -import com.baeldung.persistence.dao.IParentDao; -import com.baeldung.persistence.dao.common.IOperations; -import com.baeldung.persistence.service.common.AbstractHibernateService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class ParentService extends AbstractHibernateService implements IParentService { - - @Autowired - private IParentDao dao; - - public ParentService() { - super(); - } - - // API - - @Override - protected IOperations getDao() { - return dao; - } - -} diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java deleted file mode 100644 index 4927c9957c..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceConfig.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.baeldung.spring; - -import java.util.Properties; - -import javax.sql.DataSource; - -import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; -import org.springframework.data.domain.AuditorAware; -import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.hibernate4.HibernateTransactionManager; -import org.springframework.orm.hibernate4.LocalSessionFactoryBean; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.JpaVendorAdapter; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.baeldung.hibernate.audit.AuditorAwareImpl; -import com.baeldung.persistence.dao.IBarAuditableDao; -import com.baeldung.persistence.dao.IBarDao; -import com.baeldung.persistence.dao.IFooAuditableDao; -import com.baeldung.persistence.dao.IFooDao; -import com.baeldung.persistence.dao.impl.BarAuditableDao; -import com.baeldung.persistence.dao.impl.BarDao; -import com.baeldung.persistence.dao.impl.BarJpaDao; -import com.baeldung.persistence.dao.impl.FooAuditableDao; -import com.baeldung.persistence.dao.impl.FooDao; -import com.baeldung.persistence.service.IBarAuditableService; -import com.baeldung.persistence.service.IBarService; -import com.baeldung.persistence.service.IFooAuditableService; -import com.baeldung.persistence.service.IFooService; -import com.baeldung.persistence.service.impl.BarAuditableService; -import com.baeldung.persistence.service.impl.BarJpaService; -import com.baeldung.persistence.service.impl.BarSpringDataJpaService; -import com.baeldung.persistence.service.impl.FooAuditableService; -import com.baeldung.persistence.service.impl.FooService; -import com.google.common.base.Preconditions; - -@Configuration -@EnableTransactionManagement -@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager") -@EnableJpaAuditing(auditorAwareRef = "auditorProvider") -@PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "com.baeldung.persistence" }) -public class PersistenceConfig { - - @Autowired - private Environment env; - - public PersistenceConfig() { - super(); - } - - @Bean("auditorProvider") - public AuditorAware auditorProvider() { - return new AuditorAwareImpl(); - } - - @Bean - public LocalSessionFactoryBean sessionFactory() { - final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); - sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); - sessionFactory.setHibernateProperties(hibernateProperties()); - - return sessionFactory; - } - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); - emf.setDataSource(restDataSource()); - emf.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); - - final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - emf.setJpaVendorAdapter(vendorAdapter); - emf.setJpaProperties(hibernateProperties()); - - return emf; - } - - @Bean - public DataSource restDataSource() { - final BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Bean - public PlatformTransactionManager hibernateTransactionManager() { - final HibernateTransactionManager transactionManager = new HibernateTransactionManager(); - transactionManager.setSessionFactory(sessionFactory().getObject()); - return transactionManager; - } - - @Bean - public PlatformTransactionManager jpaTransactionManager() { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); - return transactionManager; - } - - @Bean - public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { - return new PersistenceExceptionTranslationPostProcessor(); - } - - @Bean - public IBarService barJpaService() { - return new BarJpaService(); - } - - @Bean - public IBarService barSpringDataJpaService() { - return new BarSpringDataJpaService(); - } - - @Bean - public IFooService fooHibernateService() { - return new FooService(); - } - - @Bean - public IBarAuditableService barHibernateAuditableService() { - return new BarAuditableService(); - } - - @Bean - public IFooAuditableService fooHibernateAuditableService() { - return new FooAuditableService(); - } - - @Bean - public IBarDao barJpaDao() { - return new BarJpaDao(); - } - - @Bean - public IBarDao barHibernateDao() { - return new BarDao(); - } - - @Bean - public IBarAuditableDao barHibernateAuditableDao() { - return new BarAuditableDao(); - } - - @Bean - public IFooDao fooHibernateDao() { - return new FooDao(); - } - - @Bean - public IFooAuditableDao fooHibernateAuditableDao() { - return new FooAuditableDao(); - } - - private final Properties hibernateProperties() { - final Properties hibernateProperties = new Properties(); - hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); - - hibernateProperties.setProperty("hibernate.show_sql", "true"); - // hibernateProperties.setProperty("hibernate.format_sql", "true"); - // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); - - // Envers properties - hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix")); - - return hibernateProperties; - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java b/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java deleted file mode 100644 index 9cbeb8e1f8..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/java/com/baeldung/spring/PersistenceXmlConfig.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.spring; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@EnableTransactionManagement -@ComponentScan({ "com.baeldung.persistence.dao", "com.baeldung.persistence.service" }) -@ImportResource({ "classpath:hibernate4Config.xml" }) -public class PersistenceXmlConfig { - - public PersistenceXmlConfig() { - super(); - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml deleted file mode 100644 index 1b9a4a191c..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/fetching.cfg.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - com.mysql.jdbc.Driver - jdbc:mysql://localhost:3306/test - root - iamtheking - org.hibernate.dialect.MySQLDialect - true - validate - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml deleted file mode 100644 index c5f608e1a7..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/fetchingLazy.cfg.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - com.mysql.jdbc.Driver - jdbc:mysql://localhost:3306/test - root - iamtheking - org.hibernate.dialect.MySQLDialect - true - - - - \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql b/persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql deleted file mode 100644 index b36d9828f1..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/fetching_create_queries.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE `user` ( - `user_id` int(10) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`user_id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 ; - - -CREATE TABLE `user_order` ( - `ORDER_ID` int(10) NOT NULL AUTO_INCREMENT, - `USER_ID` int(10) NOT NULL DEFAULT '0', - PRIMARY KEY (`ORDER_ID`,`USER_ID`), - KEY `USER_ID` (`USER_ID`), - CONSTRAINT `user_order_ibfk_1` FOREIGN KEY (`USER_ID`) REFERENCES `USER` (`user_id`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; - diff --git a/persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml b/persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml deleted file mode 100644 index ca507802cd..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/hibernate4Config.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - ${hibernate.hbm2ddl.auto} - ${hibernate.dialect} - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml b/persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml deleted file mode 100644 index fe1e3cb723..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/immutable.cfg.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - org.hsqldb.jdbcDriver - jdbc:hsqldb:hsql:mem://localhost/xdb - sa - - - - 1 - - - org.hibernate.dialect.HSQLDialect - - - thread - - - org.hibernate.cache.NoCacheProvider - - - true - - - update - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql b/persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql deleted file mode 100644 index ae008f29bc..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/insert_statements.sql +++ /dev/null @@ -1,31 +0,0 @@ -insert into item (item_id, item_name, item_desc, item_price) -values(1,'item One', 'test 1', 35.12); - -insert into item (item_id, item_name, item_desc, item_price) -values(2,'Pogo stick', 'Pogo stick', 466.12); -insert into item (item_id, item_name, item_desc, item_price) -values(3,'Raft', 'Raft', 345.12); - -insert into item (item_id, item_name, item_desc, item_price) -values(4,'Skate Board', 'Skating', 135.71); - -insert into item (item_id, item_name, item_desc, item_price) -values(5,'Umbrella', 'Umbrella for Rain', 619.25); - -insert into item (item_id, item_name, item_desc, item_price) -values(6,'Glue', 'Glue for home', 432.73); - -insert into item (item_id, item_name, item_desc, item_price) -values(7,'Paint', 'Paint for Room', 1311.40); - -insert into item (item_id, item_name, item_desc, item_price) -values(8,'Red paint', 'Red paint for room', 1135.71); - -insert into item (item_id, item_name, item_desc, item_price) -values(9,'Household Chairs', 'Chairs for house', 25.71); - -insert into item (item_id, item_name, item_desc, item_price) -values(10,'Office Chairs', 'Chairs for office', 395.98); - -insert into item (item_id, item_name, item_desc, item_price) -values(11,'Outdoor Chairs', 'Chairs for outdoor activities', 1234.36); diff --git a/persistence-modules/spring-hibernate4/src/main/resources/logback.xml b/persistence-modules/spring-hibernate4/src/main/resources/logback.xml deleted file mode 100644 index 56af2d397e..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties b/persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties deleted file mode 100644 index f6b6ab6fca..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/persistence-mysql.properties +++ /dev/null @@ -1,13 +0,0 @@ -# jdbc.X -jdbc.driverClassName=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/spring_hibernate4_01?createDatabaseIfNotExist=true -jdbc.user=tutorialuser -jdbc.pass=tutorialmy5ql - -# hibernate.X -hibernate.dialect=org.hibernate.dialect.MySQL5Dialect -hibernate.show_sql=false -hibernate.hbm2ddl.auto=create-drop - -# envers.X -envers.audit_table_suffix=_audit_log diff --git a/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql b/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql deleted file mode 100644 index 9cedb75c37..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/stored_procedure.sql +++ /dev/null @@ -1,20 +0,0 @@ -DELIMITER // - CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255)) - LANGUAGE SQL - DETERMINISTIC - SQL SECURITY DEFINER - BEGIN - SELECT * FROM foo WHERE name = fooName; - END // -DELIMITER ; - - -DELIMITER // - CREATE PROCEDURE GetAllFoos() - LANGUAGE SQL - DETERMINISTIC - SQL SECURITY DEFINER - BEGIN - SELECT * FROM foo; - END // -DELIMITER ; \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml b/persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml deleted file mode 100644 index e5c19a4ad7..0000000000 --- a/persistence-modules/spring-hibernate4/src/main/resources/webSecurityConfig.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java deleted file mode 100644 index e19965773e..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/SpringContextTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.spring.PersistenceConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class SpringContextTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java deleted file mode 100644 index 65bf36f8bf..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.hibernate.fetching; - -import com.baeldung.hibernate.fetching.model.OrderDetail; -import com.baeldung.hibernate.fetching.view.FetchingAppView; -import org.hibernate.Hibernate; -import org.junit.Before; -import org.junit.Test; - -import java.util.Set; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class HibernateFetchingIntegrationTest { - - // this loads sample data in the database - @Before - public void addFecthingTestData() { - FetchingAppView fav = new FetchingAppView(); - fav.createTestData(); - } - - // testLazyFetching() tests the lazy loading - // Since it lazily loaded so orderDetalSetLazy won't - // be initialized - @Test - public void testLazyFetching() { - FetchingAppView fav = new FetchingAppView(); - Set orderDetalSetLazy = fav.lazyLoaded(); - assertFalse(Hibernate.isInitialized(orderDetalSetLazy)); - } - - // testEagerFetching() tests the eager loading - // Since it eagerly loaded so orderDetalSetLazy would - // be initialized - @Test - public void testEagerFetching() { - FetchingAppView fav = new FetchingAppView(); - Set orderDetalSetEager = fav.eagerLoaded(); - assertTrue(Hibernate.isInitialized(orderDetalSetEager)); - } -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java deleted file mode 100644 index f5c45a5d6f..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.persistence; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -import com.baeldung.persistence.audit.AuditTestSuite; -import com.baeldung.persistence.hibernate.FooPaginationPersistenceIntegrationTest; -import com.baeldung.persistence.hibernate.FooSortingPersistenceIntegrationTest; -import com.baeldung.persistence.service.FooServiceBasicPersistenceIntegrationTest; -import com.baeldung.persistence.service.FooServicePersistenceIntegrationTest; -import com.baeldung.persistence.service.ParentServicePersistenceIntegrationTest; - -@RunWith(Suite.class) -@Suite.SuiteClasses({ // @formatter:off - AuditTestSuite.class - ,FooServiceBasicPersistenceIntegrationTest.class - ,FooPaginationPersistenceIntegrationTest.class - ,FooServicePersistenceIntegrationTest.class - ,ParentServicePersistenceIntegrationTest.class - ,FooSortingPersistenceIntegrationTest.class - -}) // @formatter:on -public class IntegrationTestSuite { - // -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java deleted file mode 100644 index 34c725d62b..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.persistence.audit; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@Suite.SuiteClasses({ // @formatter:off - EnversFooBarAuditIntegrationTest.class, - JPABarAuditIntegrationTest.class, - SpringDataJPABarAuditIntegrationTest.class -}) // @formatter:on -public class AuditTestSuite { - // -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java deleted file mode 100644 index 444324dafc..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.baeldung.persistence.audit; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.model.Foo; -import com.baeldung.persistence.service.IBarAuditableService; -import com.baeldung.persistence.service.IFooAuditableService; -import com.baeldung.spring.config.PersistenceTestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) -@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS) -public class EnversFooBarAuditIntegrationTest { - - private static Logger logger = LoggerFactory.getLogger(EnversFooBarAuditIntegrationTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - logger.info("setUpBeforeClass()"); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - logger.info("tearDownAfterClass()"); - } - - @Autowired - @Qualifier("fooHibernateAuditableService") - private IFooAuditableService fooService; - - @Autowired - @Qualifier("barHibernateAuditableService") - private IBarAuditableService barService; - - @Autowired - private SessionFactory sessionFactory; - - private Session session; - - @Before - public void setUp() throws Exception { - logger.info("setUp()"); - makeRevisions(); - session = sessionFactory.openSession(); - } - - @After - public void tearDown() throws Exception { - logger.info("tearDown()"); - session.close(); - } - - private void makeRevisions() { - final Bar bar = rev1(); - rev2(bar); - rev3(bar); - rev4(bar); - } - - // REV #1: insert BAR & FOO1 - private Bar rev1() { - final Bar bar = new Bar("BAR"); - final Foo foo1 = new Foo("FOO1"); - foo1.setBar(bar); - fooService.create(foo1); - return bar; - } - - // REV #2: insert FOO2 & update BAR - private void rev2(final Bar bar) { - final Foo foo2 = new Foo("FOO2"); - foo2.setBar(bar); - fooService.create(foo2); - } - - // REV #3: update BAR - private void rev3(final Bar bar) { - - bar.setName("BAR1"); - barService.update(bar); - } - - // REV #4: insert FOO3 & update BAR - private void rev4(final Bar bar) { - - final Foo foo3 = new Foo("FOO3"); - foo3.setBar(bar); - fooService.create(foo3); - } - - @Test - public final void whenFooBarsModified_thenFooBarsAudited() { - - List barRevisionList; - List fooRevisionList; - - // test Bar revisions - - barRevisionList = barService.getRevisions(); - - assertNotNull(barRevisionList); - assertEquals(4, barRevisionList.size()); - - assertEquals("BAR", barRevisionList.get(0).getName()); - assertEquals("BAR", barRevisionList.get(1).getName()); - assertEquals("BAR1", barRevisionList.get(2).getName()); - assertEquals("BAR1", barRevisionList.get(3).getName()); - - assertEquals(1, barRevisionList.get(0).getFooSet().size()); - assertEquals(2, barRevisionList.get(1).getFooSet().size()); - assertEquals(2, barRevisionList.get(2).getFooSet().size()); - assertEquals(3, barRevisionList.get(3).getFooSet().size()); - - // test Foo revisions - - fooRevisionList = fooService.getRevisions(); - assertNotNull(fooRevisionList); - assertEquals(3, fooRevisionList.size()); - assertEquals("FOO1", fooRevisionList.get(0).getName()); - assertEquals("FOO2", fooRevisionList.get(1).getName()); - assertEquals("FOO3", fooRevisionList.get(2).getName()); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java deleted file mode 100644 index 733074a6a3..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.baeldung.persistence.audit; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.model.Bar.OPERATION; -import com.baeldung.persistence.service.IBarService; -import com.baeldung.spring.config.PersistenceTestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) -public class JPABarAuditIntegrationTest { - - private static Logger logger = LoggerFactory.getLogger(JPABarAuditIntegrationTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - logger.info("setUpBeforeClass()"); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - logger.info("tearDownAfterClass()"); - } - - @Autowired - @Qualifier("barJpaService") - private IBarService barService; - - @Autowired - private EntityManagerFactory entityManagerFactory; - - private EntityManager em; - - @Before - public void setUp() throws Exception { - logger.info("setUp()"); - em = entityManagerFactory.createEntityManager(); - } - - @After - public void tearDown() throws Exception { - logger.info("tearDown()"); - em.close(); - } - - @Test - public final void whenBarsModified_thenBarsAudited() { - - // insert BAR1 - Bar bar1 = new Bar("BAR1"); - barService.create(bar1); - - // update BAR1 - bar1.setName("BAR1a"); - barService.update(bar1); - - // insert BAR2 - Bar bar2 = new Bar("BAR2"); - barService.create(bar2); - - // update BAR1 - bar1.setName("BAR1b"); - barService.update(bar1); - - // get BAR1 and BAR2 from the DB and check the audit values - // detach instances from persistence context to make sure we fire db - em.detach(bar1); - em.detach(bar2); - bar1 = barService.findOne(bar1.getId()); - bar2 = barService.findOne(bar2.getId()); - - assertNotNull(bar1); - assertNotNull(bar2); - assertEquals(OPERATION.UPDATE, bar1.getOperation()); - assertEquals(OPERATION.INSERT, bar2.getOperation()); - assertTrue(bar1.getTimestamp() > bar2.getTimestamp()); - - barService.deleteById(bar1.getId()); - barService.deleteById(bar2.getId()); - - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java deleted file mode 100644 index 18227abd28..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.baeldung.persistence.audit; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.service.IBarService; -import com.baeldung.spring.config.PersistenceTestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) -public class SpringDataJPABarAuditIntegrationTest { - - private static Logger logger = LoggerFactory.getLogger(SpringDataJPABarAuditIntegrationTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - logger.info("setUpBeforeClass()"); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - logger.info("tearDownAfterClass()"); - } - - @Autowired - @Qualifier("barSpringDataJpaService") - private IBarService barService; - - @Autowired - private EntityManagerFactory entityManagerFactory; - - private EntityManager em; - - @Before - public void setUp() throws Exception { - logger.info("setUp()"); - em = entityManagerFactory.createEntityManager(); - } - - @After - public void tearDown() throws Exception { - logger.info("tearDown()"); - em.close(); - } - - @Test - @WithMockUser(username = "tutorialuser") - public final void whenBarsModified_thenBarsAudited() { - Bar bar = new Bar("BAR1"); - barService.create(bar); - assertEquals(bar.getCreatedDate(), bar.getModifiedDate()); - assertEquals("tutorialuser", bar.getCreatedBy(), bar.getModifiedBy()); - bar.setName("BAR2"); - bar = barService.update(bar); - assertTrue(bar.getCreatedDate() < bar.getModifiedDate()); - assertEquals("tutorialuser", bar.getCreatedBy(), bar.getModifiedBy()); - } -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java deleted file mode 100644 index da840dc027..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.baeldung.persistence.hibernate; - -import java.util.List; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.persistence.model.Bar; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; - -import com.google.common.collect.Lists; - -public class FooFixtures { - private SessionFactory sessionFactory; - - public FooFixtures(final SessionFactory sessionFactory) { - super(); - - this.sessionFactory = sessionFactory; - } - - // API - - public void createBars() { - Session session = null; - Transaction tx = null; - session = sessionFactory.openSession(); - tx = session.getTransaction(); - try { - tx.begin(); - for (int i = 156; i < 160; i++) { - final Bar bar = new Bar(); - bar.setName("Bar_" + i); - final Foo foo = new Foo("Foo_" + (i + 120)); - foo.setBar(bar); - session.save(foo); - final Foo foo2 = new Foo(null); - if (i % 2 == 0) - foo2.setName("LuckyFoo" + (i + 120)); - foo2.setBar(bar); - session.save(foo2); - bar.getFooSet().add(foo); - bar.getFooSet().add(foo2); - session.merge(bar); - } - tx.commit(); - session.flush(); - } catch (final HibernateException he) { - if (tx != null) - tx.rollback(); - System.out.println("Not able to open session"); - he.printStackTrace(); - } catch (final Exception e) { - e.printStackTrace(); - } finally { - if (session != null) - session.close(); - } - - } - - public void createFoos() { - Session session = null; - Transaction tx = null; - session = sessionFactory.openSession(); - tx = session.getTransaction(); - final List fooList = Lists.newArrayList(); - for (int i = 35; i < 46; i++) { - - final Foo foo = new Foo(); - foo.setName("Foo_" + (i + 120)); - final Bar bar = new Bar("bar_" + i); - bar.getFooSet().add(foo); - foo.setBar(bar); - fooList.add(foo); - - } - try { - tx.begin(); - for (final Foo foo : fooList) { - - session.save(foo.getBar()); - session.save(foo); - } - tx.commit(); - session.flush(); - } catch (final HibernateException he) { - if (tx != null) - tx.rollback(); - System.out.println("Not able to open session"); - he.printStackTrace(); - } catch (final Exception e) { - e.printStackTrace(); - } finally { - if (session != null) - session.close(); - } - } - -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java deleted file mode 100644 index fd7bc4aabf..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.baeldung.persistence.hibernate; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.lessThan; -import static org.junit.Assert.assertThat; - -import java.util.List; - -import org.hibernate.Criteria; -import org.hibernate.Query; -import org.hibernate.ScrollMode; -import org.hibernate.ScrollableResults; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.criterion.Projections; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.persistence.service.IFooService; -import com.baeldung.spring.config.PersistenceTestConfig; -import com.google.common.collect.Lists; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) -public class FooPaginationPersistenceIntegrationTest { - - @Autowired - private IFooService fooService; - - @Autowired - private SessionFactory sessionFactory; - - private Session session; - - // tests - - @Before - public final void before() { - final int minimalNumberOfEntities = 25; - if (fooService.findAll().size() <= minimalNumberOfEntities) { - for (int i = 0; i < minimalNumberOfEntities; i++) { - fooService.create(new Foo(randomAlphabetic(6))); - } - } - - session = sessionFactory.openSession(); - } - - @After - public final void after() { - session.close(); - } - - // tests - - @Test - public final void whenContextIsBootstrapped_thenNoExceptions() { - // - } - - @SuppressWarnings("unchecked") - @Test - public final void whenRetrievingPaginatedEntities_thenCorrectSize() { - final int pageNumber = 1; - final int pageSize = 10; - - final Query query = session.createQuery("From Foo"); - query.setFirstResult((pageNumber - 1) * pageSize); - query.setMaxResults(pageSize); - final List fooList = query.list(); - - assertThat(fooList, hasSize(pageSize)); - } - - @SuppressWarnings("unchecked") - @Test - public final void whenRetrievingAllPages_thenCorrect() { - int pageNumber = 1; - final int pageSize = 10; - - final String countQ = "Select count (f.id) from Foo f"; - final Query countQuery = session.createQuery(countQ); - final Long countResult = (Long) countQuery.uniqueResult(); - - final List fooList = Lists.newArrayList(); - int totalEntities = 0; - final Query query = session.createQuery("From Foo"); - while (totalEntities < countResult) { - query.setFirstResult((pageNumber - 1) * pageSize); - query.setMaxResults(pageSize); - fooList.addAll(query.list()); - totalEntities = fooList.size(); - pageNumber++; - } - } - - @SuppressWarnings("unchecked") - @Test - public final void whenRetrievingLastPage_thenCorrectSize() { - final int pageSize = 10; - - final String countQ = "Select count (f.id) from Foo f"; - final Query countQuery = session.createQuery(countQ); - final Long countResults = (Long) countQuery.uniqueResult(); - final int lastPageNumber = (int) (Math.ceil(countResults / pageSize)); - - final Query selectQuery = session.createQuery("From Foo"); - selectQuery.setFirstResult((lastPageNumber - 1) * pageSize); - selectQuery.setMaxResults(pageSize); - final List lastPage = selectQuery.list(); - - assertThat(lastPage, hasSize(lessThan(pageSize + 1))); - } - - // testing - scrollable - - @Test - public final void givenUsingTheScrollableApi_whenRetrievingPaginatedData_thenCorrect() { - final int pageSize = 10; - final String hql = "FROM Foo f order by f.name"; - final Query query = session.createQuery(hql); - - final ScrollableResults resultScroll = query.scroll(ScrollMode.FORWARD_ONLY); - - // resultScroll.last(); - // final int totalResults = resultScroll.getRowNumber() + 1; - - resultScroll.first(); - resultScroll.scroll(0); - final List fooPage = Lists.newArrayList(); - int i = 0; - while (pageSize > i++) { - fooPage.add((Foo) resultScroll.get(0)); - if (!resultScroll.next()) { - break; - } - } - - assertThat(fooPage, hasSize(lessThan(10 + 1))); - } - - @SuppressWarnings("unchecked") - @Test - public final void givenUsingTheCriteriaApi_whenRetrievingFirstPage_thenCorrect() { - final int pageSize = 10; - - final Criteria criteria = session.createCriteria(Foo.class); - criteria.setFirstResult(0); - criteria.setMaxResults(pageSize); - final List firstPage = criteria.list(); - - assertThat(firstPage, hasSize(pageSize)); - } - - @SuppressWarnings("unchecked") - @Test - public final void givenUsingTheCriteriaApi_whenRetrievingPaginatedData_thenCorrect() { - final Criteria criteriaCount = session.createCriteria(Foo.class); - criteriaCount.setProjection(Projections.rowCount()); - final Long count = (Long) criteriaCount.uniqueResult(); - - int pageNumber = 1; - final int pageSize = 10; - final List fooList = Lists.newArrayList(); - - final Criteria criteria = session.createCriteria(Foo.class); - int totalEntities = 0; - while (totalEntities < count.intValue()) { - criteria.setFirstResult((pageNumber - 1) * pageSize); - criteria.setMaxResults(pageSize); - fooList.addAll(criteria.list()); - totalEntities = fooList.size(); - pageNumber++; - } - } - -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java deleted file mode 100644 index 8173088af0..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.baeldung.persistence.hibernate; - -import static org.junit.Assert.assertNull; - -import java.util.List; -import java.util.Set; - -import org.hibernate.Criteria; -import org.hibernate.NullPrecedence; -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.criterion.Order; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Bar; -import com.baeldung.persistence.model.Foo; -import com.baeldung.spring.config.PersistenceTestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) -@SuppressWarnings("unchecked") -public class FooSortingPersistenceIntegrationTest { - - @Autowired - private SessionFactory sessionFactory; - - private Session session; - - @Before - public void before() { - session = sessionFactory.openSession(); - - session.beginTransaction(); - - final FooFixtures fooData = new FooFixtures(sessionFactory); - fooData.createBars(); - } - - @After - public void after() { - session.getTransaction().commit(); - session.close(); - } - - @Test - public final void whenHQlSortingByOneAttribute_thenPrintSortedResults() { - final String hql = "FROM Foo f ORDER BY f.name"; - final Query query = session.createQuery(hql); - final List fooList = query.list(); - for (final Foo foo : fooList) { - System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); - } - } - - @Test - public final void whenHQlSortingByStringNullLast_thenLastNull() { - final String hql = "FROM Foo f ORDER BY f.name NULLS LAST"; - final Query query = session.createQuery(hql); - final List fooList = query.list(); - - assertNull(fooList.get(fooList.toArray().length - 1).getName()); - for (final Foo foo : fooList) { - System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); - } - } - - @Test - public final void whenSortingByStringNullsFirst_thenReturnNullsFirst() { - final String hql = "FROM Foo f ORDER BY f.name NULLS FIRST"; - final Query query = session.createQuery(hql); - final List fooList = query.list(); - assertNull(fooList.get(0).getName()); - for (final Foo foo : fooList) { - System.out.println("Name:" + foo.getName()); - - } - } - - @Test - public final void whenHQlSortingByOneAttribute_andOrderDirection_thenPrintSortedResults() { - final String hql = "FROM Foo f ORDER BY f.name ASC"; - final Query query = session.createQuery(hql); - final List fooList = query.list(); - for (final Foo foo : fooList) { - System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); - } - } - - @Test - public final void whenHQlSortingByMultipleAttributes_thenSortedResults() { - final String hql = "FROM Foo f ORDER BY f.name, f.id"; - final Query query = session.createQuery(hql); - final List fooList = query.list(); - for (final Foo foo : fooList) { - System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); - } - } - - @Test - public final void whenHQlSortingByMultipleAttributes_andOrderDirection_thenPrintSortedResults() { - final String hql = "FROM Foo f ORDER BY f.name DESC, f.id ASC"; - final Query query = session.createQuery(hql); - final List fooList = query.list(); - for (final Foo foo : fooList) { - System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); - } - } - - @Test - public final void whenHQLCriteriaSortingByOneAttr_thenPrintSortedResults() { - final Criteria criteria = session.createCriteria(Foo.class, "FOO"); - criteria.addOrder(Order.asc("id")); - final List fooList = criteria.list(); - for (final Foo foo : fooList) { - System.out.println("Id: " + foo.getId() + ", FirstName: " + foo.getName()); - } - } - - @Test - public final void whenHQLCriteriaSortingByMultipAttr_thenSortedResults() { - final Criteria criteria = session.createCriteria(Foo.class, "FOO"); - criteria.addOrder(Order.asc("name")); - criteria.addOrder(Order.asc("id")); - final List fooList = criteria.list(); - for (final Foo foo : fooList) { - System.out.println("Id: " + foo.getId() + ", FirstName: " + foo.getName()); - } - } - - @Test - public final void whenCriteriaSortingStringNullsLastAsc_thenNullsLast() { - final Criteria criteria = session.createCriteria(Foo.class, "FOO"); - criteria.addOrder(Order.asc("name").nulls(NullPrecedence.LAST)); - final List fooList = criteria.list(); - assertNull(fooList.get(fooList.toArray().length - 1).getName()); - for (final Foo foo : fooList) { - System.out.println("Id: " + foo.getId() + ", FirstName: " + foo.getName()); - } - } - - @Test - public final void whenCriteriaSortingStringNullsFirstDesc_thenNullsFirst() { - final Criteria criteria = session.createCriteria(Foo.class, "FOO"); - criteria.addOrder(Order.desc("name").nulls(NullPrecedence.FIRST)); - final List fooList = criteria.list(); - assertNull(fooList.get(0).getName()); - for (final Foo foo : fooList) { - System.out.println("Id: " + foo.getId() + ", FirstName: " + foo.getName()); - } - } - - @Test - public final void whenSortingBars_thenBarsWithSortedFoos() { - final String hql = "FROM Bar b ORDER BY b.id"; - final Query query = session.createQuery(hql); - final List barList = query.list(); - for (final Bar bar : barList) { - final Set fooSet = bar.getFooSet(); - System.out.println("Bar Id:" + bar.getId()); - for (final Foo foo : fooSet) { - System.out.println("FooName:" + foo.getName()); - } - } - } - -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java deleted file mode 100644 index ef83af3a0d..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.baeldung.persistence.save; - -import com.baeldung.persistence.model.Person; -import org.hibernate.HibernateException; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.boot.registry.StandardServiceRegistryBuilder; -import org.hibernate.cfg.Configuration; -import org.hibernate.dialect.HSQLDialect; -import org.hibernate.service.ServiceRegistry; -import org.junit.*; - -import static org.junit.Assert.*; - -/** - * Testing specific implementation details for different methods: - * persist, save, merge, update, saveOrUpdate. - */ -public class SaveMethodsIntegrationTest { - - private static SessionFactory sessionFactory; - - private Session session; - - @BeforeClass - public static void beforeTests() { - Configuration configuration = new Configuration().addAnnotatedClass(Person.class).setProperty("hibernate.dialect", HSQLDialect.class.getName()).setProperty("hibernate.connection.driver_class", org.hsqldb.jdbcDriver.class.getName()) - .setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:test").setProperty("hibernate.connection.username", "sa").setProperty("hibernate.connection.password", "").setProperty("hibernate.hbm2ddl.auto", "update"); - ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); - sessionFactory = configuration.buildSessionFactory(serviceRegistry); - } - - @Before - public void setUp() { - session = sessionFactory.openSession(); - session.beginTransaction(); - } - - @Test - public void whenPersistTransient_thenSavedToDatabaseOnCommit() { - - Person person = new Person(); - person.setName("John"); - session.persist(person); - - session.getTransaction().commit(); - session.close(); - - session = sessionFactory.openSession(); - session.beginTransaction(); - - assertNotNull(session.get(Person.class, person.getId())); - - } - - @Test - public void whenPersistPersistent_thenNothingHappens() { - - Person person = new Person(); - person.setName("John"); - - session.persist(person); - Long id1 = person.getId(); - - session.persist(person); - Long id2 = person.getId(); - - assertEquals(id1, id2); - } - - @Test(expected = HibernateException.class) - public void whenPersistDetached_thenThrowsException() { - - Person person = new Person(); - person.setName("John"); - session.persist(person); - session.evict(person); - - session.persist(person); - - } - - @Test - public void whenSaveTransient_thenIdGeneratedImmediately() { - - Person person = new Person(); - person.setName("John"); - - assertNull(person.getId()); - - Long id = (Long) session.save(person); - - assertNotNull(id); - - session.getTransaction().commit(); - session.close(); - - assertEquals(id, person.getId()); - - session = sessionFactory.openSession(); - session.beginTransaction(); - - assertNotNull(session.get(Person.class, person.getId())); - - } - - @Test - public void whenSavePersistent_thenNothingHappens() { - - Person person = new Person(); - person.setName("John"); - Long id1 = (Long) session.save(person); - Long id2 = (Long) session.save(person); - assertEquals(id1, id2); - - } - - @Test - public void whenSaveDetached_thenNewInstancePersisted() { - - Person person = new Person(); - person.setName("John"); - Long id1 = (Long) session.save(person); - session.evict(person); - - Long id2 = (Long) session.save(person); - assertNotEquals(id1, id2); - - } - - @Test - public void whenMergeDetached_thenEntityUpdatedFromDatabase() { - - Person person = new Person(); - person.setName("John"); - session.save(person); - session.evict(person); - - person.setName("Mary"); - Person mergedPerson = (Person) session.merge(person); - - assertNotSame(person, mergedPerson); - assertEquals("Mary", mergedPerson.getName()); - - } - - @Test - public void whenMergeTransient_thenNewEntitySavedToDatabase() { - - Person person = new Person(); - person.setName("John"); - Person mergedPerson = (Person) session.merge(person); - - session.getTransaction().commit(); - session.beginTransaction(); - - assertNull(person.getId()); - assertNotNull(mergedPerson.getId()); - - } - - @Test - public void whenMergePersistent_thenReturnsSameObject() { - - Person person = new Person(); - person.setName("John"); - session.save(person); - - Person mergedPerson = (Person) session.merge(person); - - assertSame(person, mergedPerson); - - } - - @Test - public void whenUpdateDetached_thenEntityUpdatedFromDatabase() { - - Person person = new Person(); - person.setName("John"); - session.save(person); - session.evict(person); - - person.setName("Mary"); - session.update(person); - assertEquals("Mary", person.getName()); - - } - - @Test(expected = HibernateException.class) - public void whenUpdateTransient_thenThrowsException() { - - Person person = new Person(); - person.setName("John"); - session.update(person); - - } - - @Test - public void whenUpdatePersistent_thenNothingHappens() { - - Person person = new Person(); - person.setName("John"); - session.save(person); - - session.update(person); - - } - - @Test - public void whenSaveOrUpdateDetached_thenEntityUpdatedFromDatabase() { - - Person person = new Person(); - person.setName("John"); - session.save(person); - session.evict(person); - - person.setName("Mary"); - session.saveOrUpdate(person); - assertEquals("Mary", person.getName()); - - } - - @Test - public void whenSaveOrUpdateTransient_thenSavedToDatabaseOnCommit() { - - Person person = new Person(); - person.setName("John"); - session.saveOrUpdate(person); - - session.getTransaction().commit(); - session.close(); - - session = sessionFactory.openSession(); - session.beginTransaction(); - - assertNotNull(session.get(Person.class, person.getId())); - - } - - @Test - public void whenSaveOrUpdatePersistent_thenNothingHappens() { - - Person person = new Person(); - person.setName("John"); - session.save(person); - - session.saveOrUpdate(person); - - } - - @After - public void tearDown() { - session.getTransaction().commit(); - session.close(); - } - - @AfterClass - public static void afterTests() { - sessionFactory.close(); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java deleted file mode 100644 index 146f8e9622..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baeldung.persistence.service; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; - -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.spring.config.PersistenceTestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) -public class FooServiceBasicPersistenceIntegrationTest { - - @Autowired - private SessionFactory sessionFactory; - - @Autowired - private IFooService fooService; - - private Session session; - - // tests - - @Before - public final void before() { - session = sessionFactory.openSession(); - } - - @After - public final void after() { - session.close(); - } - - // tests - - @Test - public final void whenContextIsBootstrapped_thenNoExceptions() { - // - } - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - fooService.create(new Foo(randomAlphabetic(6))); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java deleted file mode 100644 index 6d426849a6..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.baeldung.persistence.service; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.dao.InvalidDataAccessApiUsageException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.spring.config.PersistenceTestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) -public class FooServicePersistenceIntegrationTest { - - @Autowired - @Qualifier("fooHibernateService") - private IFooService service; - - // tests - - @Test - public final void whenContextIsBootstrapped_thenNoExceptions() { - // - } - - @Test - public final void whenEntityIsCreated_thenNoExceptions() { - service.create(new Foo(randomAlphabetic(6))); - } - - @Test(expected = DataIntegrityViolationException.class) - @Ignore("work in progress") - public final void whenInvalidEntityIsCreated_thenDataException() { - service.create(new Foo()); - } - - @Test(expected = DataIntegrityViolationException.class) - public final void whenEntityWithLongNameIsCreated_thenDataException() { - service.create(new Foo(randomAlphabetic(2048))); - } - - @Test(expected = InvalidDataAccessApiUsageException.class) - @Ignore("Right now, persist has saveOrUpdate semantics, so this will no longer fail") - public final void whenSameEntityIsCreatedTwice_thenDataException() { - final Foo entity = new Foo(randomAlphabetic(8)); - service.create(entity); - service.create(entity); - } - - @Test(expected = DataAccessException.class) - public final void temp_whenInvalidEntityIsCreated_thenDataException() { - service.create(new Foo(randomAlphabetic(2048))); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java deleted file mode 100644 index d9353f1ad1..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.baeldung.persistence.service; - -import java.util.List; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.junit.Assert.assertEquals; - -import org.hibernate.Query; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.exception.SQLGrammarException; -import org.junit.After; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Foo; -import com.baeldung.spring.PersistenceConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) -public class FooStoredProceduresLiveTest { - - private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class); - - @Autowired - private SessionFactory sessionFactory; - - @Autowired - private IFooService fooService; - - private Session session; - - @Before - public final void before() { - session = sessionFactory.openSession(); - Assume.assumeTrue(getAllFoosExists()); - Assume.assumeTrue(getFoosByNameExists()); - } - - private boolean getFoosByNameExists() { - try { - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - sqlQuery.list(); - return true; - } catch (SQLGrammarException e) { - LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e); - return false; - } - } - - private boolean getAllFoosExists() { - try { - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - sqlQuery.list(); - return true; - } catch (SQLGrammarException e) { - LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e); - return false; - } - } - - @After - public final void after() { - session.close(); - } - - @Test - public final void getAllFoosUsingStoredProcedures() { - - fooService.create(new Foo(randomAlphabetic(6))); - - // Stored procedure getAllFoos using createSQLQuery - Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); - @SuppressWarnings("unchecked") - List allFoos = sqlQuery.list(); - for (Foo foo : allFoos) { - LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName()); - } - assertEquals(allFoos.size(), fooService.findAll().size()); - - // Stored procedure getAllFoos using a Named Query - Query namedQuery = session.getNamedQuery("callGetAllFoos"); - @SuppressWarnings("unchecked") - List allFoos2 = namedQuery.list(); - for (Foo foo : allFoos2) { - LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName()); - } - assertEquals(allFoos2.size(), fooService.findAll().size()); - } - - @Test - public final void getFoosByNameUsingStoredProcedures() { - - fooService.create(new Foo("NewFooName")); - - // Stored procedure getFoosByName using createSQLQuery() - Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName"); - @SuppressWarnings("unchecked") - List allFoosByName = sqlQuery.list(); - for (Foo foo : allFoosByName) { - LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString()); - } - - // Stored procedure getFoosByName using getNamedQuery() - Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName"); - @SuppressWarnings("unchecked") - List allFoosByName2 = namedQuery.list(); - for (Foo foo : allFoosByName2) { - LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString()); - } - - } -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java deleted file mode 100644 index 5a73e39ca2..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.baeldung.persistence.service; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.DataIntegrityViolationException; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; - -import com.baeldung.persistence.model.Child; -import com.baeldung.persistence.model.Parent; -import com.baeldung.spring.config.PersistenceTestConfig; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) -public class ParentServicePersistenceIntegrationTest { - - @Autowired - private IParentService service; - - @Autowired - private IChildService childService; - - // tests - - @Test - public final void whenContextIsBootstrapped_thenNoExceptions() { - // - } - - @Test - public final void whenOneToOneEntitiesAreCreated_thenNoExceptions() { - final Child childEntity = new Child(); - childService.create(childEntity); - - final Parent parentEntity = new Parent(childEntity); - service.create(parentEntity); - - System.out.println("Child = " + childService.findOne(childEntity.getId())); - System.out.println("Child - parent = " + childService.findOne(childEntity.getId()).getParent()); - - System.out.println("Parent = " + service.findOne(parentEntity.getId())); - System.out.println("Parent - child = " + service.findOne(parentEntity.getId()).getChild()); - } - - @Test(expected = DataIntegrityViolationException.class) - public final void whenChildIsDeletedWhileParentStillHasForeignKeyToIt_thenDataException() { - final Child childEntity = new Child(); - childService.create(childEntity); - - final Parent parentEntity = new Parent(childEntity); - service.create(parentEntity); - - childService.delete(childEntity); - } - - @Test - public final void whenChildIsDeletedAfterTheParent_thenNoExceptions() { - final Child childEntity = new Child(); - childService.create(childEntity); - - final Parent parentEntity = new Parent(childEntity); - service.create(parentEntity); - - service.delete(parentEntity); - childService.delete(childEntity); - } - -} diff --git a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java b/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java deleted file mode 100644 index 9bf55c902a..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.baeldung.spring.config; - -import java.util.Properties; - -import javax.sql.DataSource; - -import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; -import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; -import org.springframework.data.jpa.repository.config.EnableJpaAuditing; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.hibernate4.HibernateTransactionManager; -import org.springframework.orm.hibernate4.LocalSessionFactoryBean; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.JpaVendorAdapter; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import com.baeldung.persistence.dao.IBarAuditableDao; -import com.baeldung.persistence.dao.IBarDao; -import com.baeldung.persistence.dao.IFooAuditableDao; -import com.baeldung.persistence.dao.IFooDao; -import com.baeldung.persistence.dao.impl.BarAuditableDao; -import com.baeldung.persistence.dao.impl.BarDao; -import com.baeldung.persistence.dao.impl.BarJpaDao; -import com.baeldung.persistence.dao.impl.FooAuditableDao; -import com.baeldung.persistence.dao.impl.FooDao; -import com.baeldung.persistence.service.IBarAuditableService; -import com.baeldung.persistence.service.IBarService; -import com.baeldung.persistence.service.IFooAuditableService; -import com.baeldung.persistence.service.IFooService; -import com.baeldung.persistence.service.impl.BarAuditableService; -import com.baeldung.persistence.service.impl.BarJpaService; -import com.baeldung.persistence.service.impl.BarSpringDataJpaService; -import com.baeldung.persistence.service.impl.FooAuditableService; -import com.baeldung.persistence.service.impl.FooService; -import com.google.common.base.Preconditions; - -@Configuration -@EnableTransactionManagement -@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager") -@EnableJpaAuditing -@PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "com.baeldung.persistence" }) -public class PersistenceTestConfig { - - @Autowired - private Environment env; - - public PersistenceTestConfig() { - super(); - } - - @Bean - public LocalSessionFactoryBean sessionFactory() { - final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); - sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); - sessionFactory.setHibernateProperties(hibernateProperties()); - - return sessionFactory; - } - - @Bean - public LocalContainerEntityManagerFactoryBean entityManagerFactory() { - final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); - emf.setDataSource(restDataSource()); - emf.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); - - final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - emf.setJpaVendorAdapter(vendorAdapter); - emf.setJpaProperties(hibernateProperties()); - - return emf; - } - - @Bean - public DataSource restDataSource() { - final BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); - dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); - dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); - dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); - - return dataSource; - } - - @Bean - public PlatformTransactionManager hibernateTransactionManager() { - final HibernateTransactionManager transactionManager = new HibernateTransactionManager(); - transactionManager.setSessionFactory(sessionFactory().getObject()); - return transactionManager; - } - - @Bean - public PlatformTransactionManager jpaTransactionManager() { - final JpaTransactionManager transactionManager = new JpaTransactionManager(); - transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); - return transactionManager; - } - - @Bean - public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { - return new PersistenceExceptionTranslationPostProcessor(); - } - - @Bean - public IBarService barJpaService() { - return new BarJpaService(); - } - - @Bean - public IBarService barSpringDataJpaService() { - return new BarSpringDataJpaService(); - } - - @Bean - public IFooService fooHibernateService() { - return new FooService(); - } - - @Bean - public IBarAuditableService barHibernateAuditableService() { - return new BarAuditableService(); - } - - @Bean - public IFooAuditableService fooHibernateAuditableService() { - return new FooAuditableService(); - } - - @Bean - public IBarDao barJpaDao() { - return new BarJpaDao(); - } - - @Bean - public IBarDao barHibernateDao() { - return new BarDao(); - } - - @Bean - public IBarAuditableDao barHibernateAuditableDao() { - return new BarAuditableDao(); - } - - @Bean - public IFooDao fooHibernateDao() { - return new FooDao(); - } - - @Bean - public IFooAuditableDao fooHibernateAuditableDao() { - return new FooAuditableDao(); - } - - private final Properties hibernateProperties() { - final Properties hibernateProperties = new Properties(); - hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); - hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); - - hibernateProperties.setProperty("hibernate.show_sql", "true"); - // hibernateProperties.setProperty("hibernate.format_sql", "true"); - // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); - - // Envers properties - hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix")); - - return hibernateProperties; - } - -} \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/test/resources/.gitignore b/persistence-modules/spring-hibernate4/src/test/resources/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/resources/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.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/persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml b/persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml deleted file mode 100644 index 55a3aeb51c..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/resources/fetching.cfg.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - org.h2.Driver - jdbc:h2:mem:testdb - sa - - org.hibernate.dialect.H2Dialect - update - true - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml deleted file mode 100644 index 8fcf578660..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/resources/fetchingLazy.cfg.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - org.h2.Driver - jdbc:h2:mem:testdb - sa - - org.hibernate.dialect.H2Dialect - update - true - - - - - \ No newline at end of file diff --git a/persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties b/persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties deleted file mode 100644 index 911619193b..0000000000 --- a/persistence-modules/spring-hibernate4/src/test/resources/persistence-h2.properties +++ /dev/null @@ -1,13 +0,0 @@ -# jdbc.X -jdbc.driverClassName=org.h2.Driver -jdbc.url=jdbc:h2:mem:test -jdbc.user=sa -jdbc.pass= - -# hibernate.X -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.show_sql=false -hibernate.hbm2ddl.auto=create-drop - -# envers.X -envers.audit_table_suffix=_audit_log From 0ba96c9c43465a133934b244313e7e36433233d9 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Mon, 28 Sep 2020 23:12:26 +0530 Subject: [PATCH 0839/1862] JAVA-2432: Moved 1 article to hibernate-enterprise --- .../hibernate-enterprise/README.md | 3 ++- .../hibernate-enterprise/pom.xml | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/persistence-modules/hibernate-enterprise/README.md b/persistence-modules/hibernate-enterprise/README.md index c5606d0970..1a86c32afa 100644 --- a/persistence-modules/hibernate-enterprise/README.md +++ b/persistence-modules/hibernate-enterprise/README.md @@ -9,4 +9,5 @@ This module contains articles about enterprise concerns such as Multitenancy, Er - [Hibernate Aggregate Functions](https://www.baeldung.com/hibernate-aggregate-functions) - [Common Hibernate Exceptions](https://www.baeldung.com/hibernate-exceptions) - [Hibernate Error “Not all named parameters have been set”](https://www.baeldung.com/hibernate-error-named-parameters-not-set) -- [Various Logging Levels in Hibernate](https://www.baeldung.com/hibernate-logging-levels) \ No newline at end of file +- [Various Logging Levels in Hibernate](https://www.baeldung.com/hibernate-logging-levels) +- [Hibernate: save, persist, update, merge, saveOrUpdate](https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate) \ No newline at end of file diff --git a/persistence-modules/hibernate-enterprise/pom.xml b/persistence-modules/hibernate-enterprise/pom.xml index ae58e409c4..c088cc1eca 100644 --- a/persistence-modules/hibernate-enterprise/pom.xml +++ b/persistence-modules/hibernate-enterprise/pom.xml @@ -61,13 +61,25 @@ ${byte-buddy.version} test + + org.hsqldb + hsqldb + ${hsqldb.version} + test + - geodb-repo - GeoDB repository - http://repo.boundlessgeo.com/main/ + osgeo + OSGeo Release Repository + https://repo.osgeo.org/repository/release/ + + false + + + true + @@ -77,6 +89,7 @@ 2.2.3 3.8.0 0.9 + 2.3.4 From d77c22b05f944119f7bde91af4b35deb9081f979 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Mon, 28 Sep 2020 23:13:14 +0530 Subject: [PATCH 0840/1862] JAVA-2432: Moved 1 article to hibernate-enterprise --- .../baeldung/persistence/model/Person.java | 31 ++ .../save/SaveMethodsIntegrationTest.java | 291 ++++++++++++++++++ 2 files changed, 322 insertions(+) create mode 100644 persistence-modules/hibernate-enterprise/src/main/java/com/baeldung/persistence/model/Person.java create mode 100644 persistence-modules/hibernate-enterprise/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java diff --git a/persistence-modules/hibernate-enterprise/src/main/java/com/baeldung/persistence/model/Person.java b/persistence-modules/hibernate-enterprise/src/main/java/com/baeldung/persistence/model/Person.java new file mode 100644 index 0000000000..6a95a7acf5 --- /dev/null +++ b/persistence-modules/hibernate-enterprise/src/main/java/com/baeldung/persistence/model/Person.java @@ -0,0 +1,31 @@ +package com.baeldung.persistence.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class Person { + + @Id + @GeneratedValue + private Long id; + + private String name; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/persistence-modules/hibernate-enterprise/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java b/persistence-modules/hibernate-enterprise/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java new file mode 100644 index 0000000000..8c571428b4 --- /dev/null +++ b/persistence-modules/hibernate-enterprise/src/test/java/com/baeldung/persistence/save/SaveMethodsIntegrationTest.java @@ -0,0 +1,291 @@ +package com.baeldung.persistence.save; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; + +import javax.persistence.PersistenceException; + +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import org.hibernate.cfg.Configuration; +import org.hibernate.dialect.HSQLDialect; +import org.hibernate.service.ServiceRegistry; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.baeldung.persistence.model.Person; + +/** + * Testing specific implementation details for different methods: + * persist, save, merge, update, saveOrUpdate. + */ +public class SaveMethodsIntegrationTest { + + private static SessionFactory sessionFactory; + + private Session session; + private boolean doNotCommit = false; + + @BeforeClass + public static void beforeTests() { + Configuration configuration = new Configuration().addAnnotatedClass(Person.class) + .setProperty("hibernate.dialect", HSQLDialect.class.getName()) + .setProperty("hibernate.connection.driver_class", org.hsqldb.jdbcDriver.class.getName()) + .setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:test") + .setProperty("hibernate.connection.username", "sa") + .setProperty("hibernate.connection.password", "") + .setProperty("hibernate.hbm2ddl.auto", "update"); + ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()) + .build(); + sessionFactory = configuration.buildSessionFactory(serviceRegistry); + } + + @Before + public void setUp() { + session = sessionFactory.openSession(); + session.beginTransaction(); + doNotCommit = false; + } + + @Test + public void whenPersistTransient_thenSavedToDatabaseOnCommit() { + + Person person = new Person(); + person.setName("John"); + session.persist(person); + + session.getTransaction() + .commit(); + session.close(); + + session = sessionFactory.openSession(); + session.beginTransaction(); + + assertNotNull(session.get(Person.class, person.getId())); + + } + + @Test + public void whenPersistPersistent_thenNothingHappens() { + + Person person = new Person(); + person.setName("John"); + + session.persist(person); + Long id1 = person.getId(); + + session.persist(person); + Long id2 = person.getId(); + + assertEquals(id1, id2); + } + + @Test(expected = PersistenceException.class) + public void whenPersistDetached_thenThrowsException() { + + doNotCommit = true; + + Person person = new Person(); + person.setName("John"); + session.persist(person); + session.evict(person); + + session.persist(person); + } + + @Test + public void whenMergeDetached_thenEntityUpdatedFromDatabase() { + + Person person = new Person(); + person.setName("John"); + session.save(person); + session.flush(); + session.evict(person); + + person.setName("Mary"); + Person mergedPerson = (Person) session.merge(person); + + assertNotSame(person, mergedPerson); + assertEquals("Mary", mergedPerson.getName()); + + } + + @Test + public void whenSaveTransient_thenIdGeneratedImmediately() { + + Person person = new Person(); + person.setName("John"); + + assertNull(person.getId()); + + Long id = (Long) session.save(person); + + assertNotNull(id); + + session.getTransaction() + .commit(); + session.close(); + + assertEquals(id, person.getId()); + + session = sessionFactory.openSession(); + session.beginTransaction(); + + assertNotNull(session.get(Person.class, person.getId())); + + } + + @Test + public void whenSavePersistent_thenNothingHappens() { + + Person person = new Person(); + person.setName("John"); + Long id1 = (Long) session.save(person); + Long id2 = (Long) session.save(person); + assertEquals(id1, id2); + + } + + @Test + public void whenSaveDetached_thenNewInstancePersisted() { + + Person person = new Person(); + person.setName("John"); + Long id1 = (Long) session.save(person); + session.evict(person); + + Long id2 = (Long) session.save(person); + assertNotEquals(id1, id2); + + } + + @Test + public void whenMergeTransient_thenNewEntitySavedToDatabase() { + + Person person = new Person(); + person.setName("John"); + Person mergedPerson = (Person) session.merge(person); + + session.getTransaction() + .commit(); + session.beginTransaction(); + + assertNull(person.getId()); + assertNotNull(mergedPerson.getId()); + + } + + @Test + public void whenMergePersistent_thenReturnsSameObject() { + + Person person = new Person(); + person.setName("John"); + session.save(person); + + Person mergedPerson = (Person) session.merge(person); + + assertSame(person, mergedPerson); + + } + + @Test + public void whenUpdateDetached_thenEntityUpdatedFromDatabase() { + + Person person = new Person(); + person.setName("John"); + session.save(person); + session.evict(person); + + person.setName("Mary"); + session.update(person); + assertEquals("Mary", person.getName()); + + } + + @Test(expected = HibernateException.class) + public void whenUpdateTransient_thenThrowsException() { + + Person person = new Person(); + person.setName("John"); + session.update(person); + + } + + @Test + public void whenUpdatePersistent_thenNothingHappens() { + + Person person = new Person(); + person.setName("John"); + session.save(person); + + session.update(person); + + } + + @Test + public void whenSaveOrUpdateDetached_thenEntityUpdatedFromDatabase() { + + Person person = new Person(); + person.setName("John"); + session.save(person); + session.evict(person); + + person.setName("Mary"); + session.saveOrUpdate(person); + assertEquals("Mary", person.getName()); + + } + + @Test + public void whenSaveOrUpdateTransient_thenSavedToDatabaseOnCommit() { + + Person person = new Person(); + person.setName("John"); + session.saveOrUpdate(person); + + session.getTransaction() + .commit(); + session.close(); + + session = sessionFactory.openSession(); + session.beginTransaction(); + + assertNotNull(session.get(Person.class, person.getId())); + + } + + @Test + public void whenSaveOrUpdatePersistent_thenNothingHappens() { + + Person person = new Person(); + person.setName("John"); + session.save(person); + + session.saveOrUpdate(person); + + } + + @After + public void tearDown() { + if (!doNotCommit) { + session.getTransaction() + .commit(); + } + session.close(); + } + + @AfterClass + public static void afterTests() { + sessionFactory.close(); + } + +} From 7de65d1211d54e5b15fdd6ee4c432e04b1c74e2a Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Mon, 28 Sep 2020 23:13:49 +0530 Subject: [PATCH 0841/1862] JAVA-2432: removed unused module from parent pom --- persistence-modules/pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index def2deb941..0e9c04f55d 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -80,8 +80,7 @@ spring-data-redis spring-data-solr spring-hibernate-3 - spring-hibernate-5 - spring-hibernate4 + spring-hibernate-5 spring-jpa spring-jpa-2 spring-jdbc From 2dd77a259db8eaa15f1a61b2752fee17d85611d4 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Mon, 28 Sep 2020 23:17:31 +0530 Subject: [PATCH 0842/1862] JAVA-2432: Moved 5 articles to spring-data-jpa-query-2 --- .../spring-data-jpa-query-2/README.md | 6 + .../spring-data-jpa-query-2/pom.xml | 58 +++++ .../baeldung/config/PersistenceConfig.java | 186 ++++++++++++++ .../baeldung/config/PersistenceXmlConfig.java | 18 ++ .../hibernate/audit/AuditorAwareImpl.java | 18 ++ .../hibernate/fetching/model/OrderDetail.java | 58 +++++ .../hibernate/fetching/model/UserEager.java | 71 +++++ .../hibernate/fetching/model/UserLazy.java | 71 +++++ .../fetching/util/HibernateUtil.java | 29 +++ .../fetching/view/FetchingAppView.java | 68 +++++ .../persistence/dao/BookRepository.java | 9 - .../persistence/dao/BookRepositoryCustom.java | 11 - .../persistence/dao/BookRepositoryImpl.java | 44 ---- .../baeldung/persistence/dao/BookService.java | 25 -- .../persistence/dao/BookSpecifications.java | 16 -- .../persistence/dao/IBarAuditableDao.java | 8 + .../persistence/dao/IBarCrudRepository.java | 10 + .../com/baeldung/persistence/dao/IBarDao.java | 8 + .../baeldung/persistence/dao/IChildDao.java | 8 + .../persistence/dao/IFooAuditableDao.java | 8 + .../com/baeldung/persistence/dao/IFooDao.java | 8 + .../baeldung/persistence/dao/IParentDao.java | 8 + .../persistence/dao/common/AbstractDao.java | 14 + .../common/AbstractHibernateAuditableDao.java | 37 +++ .../dao/common/AbstractHibernateDao.java | 59 +++++ .../dao/common/AbstractJpaDao.java | 56 ++++ .../dao/common/GenericHibernateDao.java | 13 + .../dao/common/IAuditOperations.java | 14 + .../persistence/dao/common/IGenericDao.java | 7 + .../persistence/dao/common/IOperations.java | 20 ++ .../persistence/dao/impl/BarAuditableDao.java | 28 ++ .../baeldung/persistence/dao/impl/BarDao.java | 19 ++ .../persistence/dao/impl/BarJpaDao.java | 19 ++ .../persistence/dao/impl/ChildDao.java | 19 ++ .../persistence/dao/impl/FooAuditableDao.java | 17 ++ .../baeldung/persistence/dao/impl/FooDao.java | 19 ++ .../persistence/dao/impl/ParentDao.java | 19 ++ .../com/baeldung/persistence/model/Bar.java | 242 ++++++++++++++++++ .../com/baeldung/persistence/model/Book.java | 36 --- .../com/baeldung/persistence/model/Child.java | 51 ++++ .../com/baeldung/persistence/model/Foo.java | 105 ++++++++ .../baeldung/persistence/model/Parent.java | 60 +++++ .../baeldung/persistence/model/Person.java | 31 +++ .../service/IBarAuditableService.java | 8 + .../persistence/service/IBarService.java | 8 + .../persistence/service/IChildService.java | 8 + .../service/IFooAuditableService.java | 8 + .../persistence/service/IFooService.java | 8 + .../persistence/service/IParentService.java | 8 + .../AbstractHibernateAuditableService.java | 30 +++ .../common/AbstractHibernateService.java | 42 +++ .../service/common/AbstractJpaService.java | 42 +++ .../service/common/AbstractService.java | 42 +++ .../common/AbstractSpringDataJpaService.java | 48 ++++ .../service/impl/BarAuditableService.java | 41 +++ .../service/impl/BarJpaService.java | 30 +++ .../persistence/service/impl/BarService.java | 30 +++ .../service/impl/BarSpringDataJpaService.java | 26 ++ .../service/impl/ChildService.java | 28 ++ .../service/impl/FooAuditableService.java | 41 +++ .../persistence/service/impl/FooService.java | 30 +++ .../service/impl/ParentService.java | 28 ++ .../src/main/resources/fetching.cfg.xml | 20 ++ .../src/main/resources/fetchingLazy.cfg.xml | 17 ++ .../resources/fetching_create_queries.sql | 14 + .../src/main/resources/hibernate5Config.xml | 34 +++ .../resources/hibernate5Configuration.xml | 30 +++ .../src/main/resources/immutable.cfg.xml | 38 +++ .../src/main/resources/insert_statements.sql | 31 +++ .../src/main/resources/logback.xml | 19 ++ .../resources/persistence-mysql.properties | 13 + .../src/main/resources/stored_procedure.sql | 20 ++ .../src/main/resources/webSecurityConfig.xml | 37 +++ .../HibernateFetchingIntegrationTest.java | 42 +++ .../persistence/IntegrationTestSuite.java | 25 ++ .../persistence/audit/AuditTestSuite.java | 14 + .../EnversFooBarAuditIntegrationTest.java | 146 +++++++++++ .../audit/JPABarAuditIntegrationTest.java | 104 ++++++++ .../SpringDataJPABarAuditIntegrationTest.java | 78 ++++++ .../persistence/hibernate/FooFixtures.java | 101 ++++++++ ...oPaginationPersistenceIntegrationTest.java | 185 +++++++++++++ .../FooSortingPersistenceIntegrationTest.java | 174 +++++++++++++ ...erviceBasicPersistenceIntegrationTest.java | 55 ++++ .../FooServicePersistenceIntegrationTest.java | 64 +++++ .../service/FooStoredProceduresLiveTest.java | 121 +++++++++ ...rentServicePersistenceIntegrationTest.java | 70 +++++ .../spring/config/PersistenceTestConfig.java | 179 +++++++++++++ .../ArticleRepositoryIntegrationTest.java | 3 + .../src/test/resources/fetching.cfg.xml | 19 ++ .../src/test/resources/fetchingLazy.cfg.xml | 19 ++ .../test/resources/persistence-h2.properties | 13 + 91 files changed, 3681 insertions(+), 141 deletions(-) create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceXmlConfig.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java delete mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java delete mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java delete mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java delete mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java delete mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IChildDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IParentDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IOperations.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Bar.java delete mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Child.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Foo.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Parent.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Person.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IChildService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IParentService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ChildService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ParentService.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching_create_queries.sql create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Config.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Configuration.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/immutable.cfg.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_statements.sql create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/logback.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/persistence-mysql.properties create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/stored_procedure.sql create mode 100644 persistence-modules/spring-data-jpa-query-2/src/main/resources/webSecurityConfig.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml create mode 100644 persistence-modules/spring-data-jpa-query-2/src/test/resources/persistence-h2.properties diff --git a/persistence-modules/spring-data-jpa-query-2/README.md b/persistence-modules/spring-data-jpa-query-2/README.md index fdb4ce3db7..bdc8d7cb32 100644 --- a/persistence-modules/spring-data-jpa-query-2/README.md +++ b/persistence-modules/spring-data-jpa-query-2/README.md @@ -6,6 +6,12 @@ This module contains articles about querying data using Spring Data JPA - [Spring Data JPA @Query Annotation](https://www.baeldung.com/spring-data-jpa-query) - [Use Criteria Queries in a Spring Data Application](https://www.baeldung.com/spring-data-criteria-queries) - [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) +- [Hibernate Pagination](https://www.baeldung.com/hibernate-pagination) +- [Sorting with Hibernate](https://www.baeldung.com/hibernate-sort) +- [Stored Procedures with Hibernate](https://www.baeldung.com/stored-procedures-with-hibernate-tutorial) +- [Eager/Lazy Loading In Hibernate](https://www.baeldung.com/hibernate-lazy-eager-loading) +- [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa) + - More articles: [[<-- prev]](../spring-data-jpa-query) ### Eclipse Config diff --git a/persistence-modules/spring-data-jpa-query-2/pom.xml b/persistence-modules/spring-data-jpa-query-2/pom.xml index 231640284e..abac7b28da 100644 --- a/persistence-modules/spring-data-jpa-query-2/pom.xml +++ b/persistence-modules/spring-data-jpa-query-2/pom.xml @@ -18,6 +18,10 @@ org.springframework.boot spring-boot-starter-data-jpa + + org.springframework.security + spring-security-core + com.h2database @@ -28,6 +32,55 @@ com.fasterxml.jackson.core jackson-databind + + + org.hibernate + hibernate-envers + + + javax.transaction + jta + ${jta.version} + + + mysql + mysql-connector-java + + + com.google.guava + guava + ${guava.version} + + + org.apache.tomcat + tomcat-dbcp + ${tomcat-dbcp.version} + + + org.hibernate + hibernate-core + ${hibernate.version} + + + org.hibernate + hibernate-envers + ${hibernate.version} + + + org.springframework + spring-test + test + + + org.springframework.security + spring-security-test + test + + + org.hsqldb + hsqldb + test + @@ -35,5 +88,10 @@ 2.22.2 5.6.2 4.13 + 9.0.0.M26 + 1.1 + 21.0 + + 5.2.10.Final \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java new file mode 100644 index 0000000000..a0d70ed006 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceConfig.java @@ -0,0 +1,186 @@ +package com.baeldung.config; + +import java.util.Properties; + +import javax.sql.DataSource; + +import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; +import org.springframework.data.domain.AuditorAware; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.hibernate5.HibernateTransactionManager; +import org.springframework.orm.hibernate5.LocalSessionFactoryBean; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.JpaVendorAdapter; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.baeldung.hibernate.audit.AuditorAwareImpl; +import com.baeldung.persistence.dao.IBarAuditableDao; +import com.baeldung.persistence.dao.IBarDao; +import com.baeldung.persistence.dao.IFooAuditableDao; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.dao.impl.BarAuditableDao; +import com.baeldung.persistence.dao.impl.BarDao; +import com.baeldung.persistence.dao.impl.BarJpaDao; +import com.baeldung.persistence.dao.impl.FooAuditableDao; +import com.baeldung.persistence.dao.impl.FooDao; +import com.baeldung.persistence.service.IBarAuditableService; +import com.baeldung.persistence.service.IBarService; +import com.baeldung.persistence.service.IFooAuditableService; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.persistence.service.impl.BarAuditableService; +import com.baeldung.persistence.service.impl.BarJpaService; +import com.baeldung.persistence.service.impl.BarSpringDataJpaService; +import com.baeldung.persistence.service.impl.FooAuditableService; +import com.baeldung.persistence.service.impl.FooService; +import com.google.common.base.Preconditions; + +@Configuration +@EnableTransactionManagement +@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager", entityManagerFactoryRef = "jpaEntityManager") +@EnableJpaAuditing(auditorAwareRef = "auditorProvider") +@PropertySource({ "classpath:persistence-h2.properties" }) +@ComponentScan({ "com.baeldung.persistence" }) +public class PersistenceConfig { + + @Autowired + private Environment env; + + public PersistenceConfig() { + super(); + } + + @Bean("auditorProvider") + public AuditorAware auditorProvider() { + return new AuditorAwareImpl(); + } + + @Bean + public LocalSessionFactoryBean sessionFactory() { + final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); + sessionFactory.setDataSource(restDataSource()); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); + sessionFactory.setHibernateProperties(hibernateProperties()); + + return sessionFactory; + } + + @Bean("jpaEntityManager") + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); + emf.setDataSource(restDataSource()); + emf.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); + + final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + emf.setJpaVendorAdapter(vendorAdapter); + emf.setJpaProperties(hibernateProperties()); + + return emf; + } + + @Bean + public DataSource restDataSource() { + final BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); + + return dataSource; + } + + @Bean + public PlatformTransactionManager hibernateTransactionManager() { + final HibernateTransactionManager transactionManager = new HibernateTransactionManager(); + transactionManager.setSessionFactory(sessionFactory().getObject()); + return transactionManager; + } + + @Bean + public PlatformTransactionManager jpaTransactionManager() { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); + return transactionManager; + } + + @Bean + public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { + return new PersistenceExceptionTranslationPostProcessor(); + } + + @Bean + public IBarService barJpaService() { + return new BarJpaService(); + } + + @Bean + public IBarService barSpringDataJpaService() { + return new BarSpringDataJpaService(); + } + + @Bean + public IFooService fooHibernateService() { + return new FooService(); + } + + @Bean + public IBarAuditableService barHibernateAuditableService() { + return new BarAuditableService(); + } + + @Bean + public IFooAuditableService fooHibernateAuditableService() { + return new FooAuditableService(); + } + + @Bean + public IBarDao barJpaDao() { + return new BarJpaDao(); + } + + @Bean + public IBarDao barHibernateDao() { + return new BarDao(); + } + + @Bean + public IBarAuditableDao barHibernateAuditableDao() { + return new BarAuditableDao(); + } + + @Bean + public IFooDao fooHibernateDao() { + return new FooDao(); + } + + @Bean + public IFooAuditableDao fooHibernateAuditableDao() { + return new FooAuditableDao(); + } + + private final Properties hibernateProperties() { + final Properties hibernateProperties = new Properties(); + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + + hibernateProperties.setProperty("hibernate.show_sql", "true"); + // hibernateProperties.setProperty("hibernate.format_sql", "true"); + // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); + + // Envers properties + hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix")); + + return hibernateProperties; + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceXmlConfig.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceXmlConfig.java new file mode 100644 index 0000000000..388494b21a --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/config/PersistenceXmlConfig.java @@ -0,0 +1,18 @@ +package com.baeldung.config; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportResource; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@EnableTransactionManagement +@ComponentScan({ "com.baeldung.persistence.dao", "com.baeldung.persistence.service" }) +@ImportResource({ "classpath:hibernate4Config.xml" }) +public class PersistenceXmlConfig { + + public PersistenceXmlConfig() { + super(); + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java new file mode 100644 index 0000000000..5dd12e6841 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/audit/AuditorAwareImpl.java @@ -0,0 +1,18 @@ +package com.baeldung.hibernate.audit; + +import java.util.Optional; + +import org.springframework.data.domain.AuditorAware; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; + +public class AuditorAwareImpl implements AuditorAware { + + @Override + public Optional getCurrentAuditor() { + return Optional.ofNullable(SecurityContextHolder.getContext()) + .map(e -> e.getAuthentication()) + .map(Authentication::getName); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java new file mode 100644 index 0000000000..f4a9b8a678 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/OrderDetail.java @@ -0,0 +1,58 @@ +package com.baeldung.hibernate.fetching.model; + +import javax.persistence.*; +import java.io.Serializable; +import java.sql.Date; + +@Entity +@Table(name = "USER_ORDER") +public class OrderDetail implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue + @Column(name = "ORDER_ID") + private Long orderId; + + public OrderDetail() { + } + + public OrderDetail(Date orderDate, String orderDesc) { + super(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((orderId == null) ? 0 : orderId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + OrderDetail other = (OrderDetail) obj; + if (orderId == null) { + if (other.orderId != null) + return false; + } else if (!orderId.equals(other.orderId)) + return false; + + return true; + } + + public Long getOrderId() { + return orderId; + } + + public void setOrderId(Long orderId) { + this.orderId = orderId; + } +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java new file mode 100644 index 0000000000..9fda4c43bb --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserEager.java @@ -0,0 +1,71 @@ +package com.baeldung.hibernate.fetching.model; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; + +@Entity +@Table(name = "USER") +public class UserEager implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue + @Column(name = "USER_ID") + private Long userId; + + @OneToMany(fetch = FetchType.EAGER) + private Set orderDetail = new HashSet(); + + public UserEager() { + } + + public UserEager(final Long userId) { + super(); + this.userId = userId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((userId == null) ? 0 : userId.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final UserEager other = (UserEager) obj; + if (userId == null) { + if (other.userId != null) + return false; + } else if (!userId.equals(other.userId)) + return false; + return true; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(final Long userId) { + this.userId = userId; + } + + public Set getOrderDetail() { + return orderDetail; + } + + public void setOrderDetail(Set orderDetail) { + this.orderDetail = orderDetail; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java new file mode 100644 index 0000000000..a78eaa4ac0 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/model/UserLazy.java @@ -0,0 +1,71 @@ +package com.baeldung.hibernate.fetching.model; + +import javax.persistence.*; +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; + +@Entity +@Table(name = "USER") +public class UserLazy implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue + @Column(name = "USER_ID") + private Long userId; + + @OneToMany(fetch = FetchType.LAZY) + private Set orderDetail = new HashSet(); + + public UserLazy() { + } + + public UserLazy(final Long userId) { + super(); + this.userId = userId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((userId == null) ? 0 : userId.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final UserLazy other = (UserLazy) obj; + if (userId == null) { + if (other.userId != null) + return false; + } else if (!userId.equals(other.userId)) + return false; + return true; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(final Long userId) { + this.userId = userId; + } + + public Set getOrderDetail() { + return orderDetail; + } + + public void setOrderDetail(Set orderDetail) { + this.orderDetail = orderDetail; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java new file mode 100644 index 0000000000..c7be96abb7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/util/HibernateUtil.java @@ -0,0 +1,29 @@ +package com.baeldung.hibernate.fetching.util; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.cfg.Configuration; + +public class HibernateUtil { + + @SuppressWarnings("deprecation") + public static Session getHibernateSession(String fetchMethod) { + // two config files are there + // one with lazy loading enabled + // another lazy = false + SessionFactory sf; + if ("lazy".equals(fetchMethod)) { + sf = new Configuration().configure("fetchingLazy.cfg.xml").buildSessionFactory(); + } else { + sf = new Configuration().configure("fetching.cfg.xml").buildSessionFactory(); + } + + // fetching.cfg.xml is used for this example + return sf.openSession(); + } + + public static Session getHibernateSession() { + return new Configuration().configure("fetching.cfg.xml").buildSessionFactory().openSession(); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java new file mode 100644 index 0000000000..35cdd254e3 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/hibernate/fetching/view/FetchingAppView.java @@ -0,0 +1,68 @@ +package com.baeldung.hibernate.fetching.view; + +import com.baeldung.hibernate.fetching.model.OrderDetail; +import com.baeldung.hibernate.fetching.model.UserEager; +import com.baeldung.hibernate.fetching.model.UserLazy; +import com.baeldung.hibernate.fetching.util.HibernateUtil; +import org.hibernate.Session; +import org.hibernate.Transaction; + +import java.util.List; +import java.util.Set; + +public class FetchingAppView { + + public FetchingAppView() { + + } + + // lazily loaded + public Set lazyLoaded() { + final Session sessionLazy = HibernateUtil.getHibernateSession("lazy"); + List users = sessionLazy.createQuery("From UserLazy").list(); + UserLazy userLazyLoaded = users.get(0); + // since data is lazyloaded so data won't be initialized + return (userLazyLoaded.getOrderDetail()); + } + + // eagerly loaded + public Set eagerLoaded() { + final Session sessionEager = HibernateUtil.getHibernateSession(); + // data should be loaded in the following line + // also note the queries generated + List user = sessionEager.createQuery("From UserEager").list(); + UserEager userEagerLoaded = user.get(0); + return userEagerLoaded.getOrderDetail(); + } + + // creates test data + // call this method to create the data in the database + public void createTestData() { + + final Session session = HibernateUtil.getHibernateSession("lazy"); + Transaction tx = session.beginTransaction(); + final UserLazy user1 = new UserLazy(); + final UserLazy user2 = new UserLazy(); + final UserLazy user3 = new UserLazy(); + + session.save(user1); + session.save(user2); + session.save(user3); + + final OrderDetail order1 = new OrderDetail(); + final OrderDetail order2 = new OrderDetail(); + final OrderDetail order3 = new OrderDetail(); + final OrderDetail order4 = new OrderDetail(); + final OrderDetail order5 = new OrderDetail(); + + session.saveOrUpdate(order1); + session.saveOrUpdate(order2); + session.saveOrUpdate(order3); + session.saveOrUpdate(order4); + session.saveOrUpdate(order5); + + tx.commit(); + session.close(); + + } +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java deleted file mode 100644 index 48620f4ff1..0000000000 --- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.model.Book; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -public interface BookRepository extends JpaRepository, BookRepositoryCustom, JpaSpecificationExecutor { - -} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java deleted file mode 100644 index eda34542df..0000000000 --- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryCustom.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.model.Book; - -import java.util.List; - -public interface BookRepositoryCustom { - - List findBooksByAuthorNameAndTitle(String authorName, String title); - -} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java deleted file mode 100644 index 7f5bedd018..0000000000 --- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookRepositoryImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.model.Book; -import org.springframework.stereotype.Repository; - -import javax.persistence.EntityManager; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; -import java.util.ArrayList; -import java.util.List; - -@Repository -public class BookRepositoryImpl implements BookRepositoryCustom { - - private EntityManager em; - - public BookRepositoryImpl(EntityManager em) { - this.em = em; - } - - @Override - public List findBooksByAuthorNameAndTitle(String authorName, String title) { - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(Book.class); - - Root book = cq.from(Book.class); - List predicates = new ArrayList<>(); - - if (authorName != null) { - predicates.add(cb.equal(book.get("author"), authorName)); - } - if (title != null) { - predicates.add(cb.like(book.get("title"), "%" + title + "%")); - } - cq.where(predicates.toArray(new Predicate[0])); - - TypedQuery query = em.createQuery(cq); - return query.getResultList(); - } - -} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java deleted file mode 100644 index 4165cd8eb9..0000000000 --- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.model.Book; -import org.springframework.stereotype.Service; - -import java.util.List; - -import static com.baeldung.persistence.dao.BookSpecifications.hasAuthor; -import static com.baeldung.persistence.dao.BookSpecifications.titleContains; -import static org.springframework.data.jpa.domain.Specification.where; - -@Service -public class BookService { - - private BookRepository bookRepository; - - public BookService(BookRepository bookRepository) { - this.bookRepository = bookRepository; - } - - public List query(String author, String title) { - return bookRepository.findAll(where(hasAuthor(author)).and(titleContains(title))); - } - -} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java deleted file mode 100644 index 16646a5b4b..0000000000 --- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/BookSpecifications.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baeldung.persistence.dao; - -import com.baeldung.persistence.model.Book; -import org.springframework.data.jpa.domain.Specification; - -public class BookSpecifications { - - public static Specification hasAuthor(String author) { - return (book, cq, cb) -> cb.equal(book.get("author"), author); - } - - public static Specification titleContains(String title) { - return (book, cq, cb) -> cb.like(book.get("title"), "%" + title + "%"); - } - -} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java new file mode 100644 index 0000000000..182b493592 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarAuditableDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.dao.common.IAuditOperations; +import com.baeldung.persistence.model.Bar; + +public interface IBarAuditableDao extends IBarDao, IAuditOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java new file mode 100644 index 0000000000..4d7db64240 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarCrudRepository.java @@ -0,0 +1,10 @@ +package com.baeldung.persistence.dao; + +import java.io.Serializable; + +import com.baeldung.persistence.model.Bar; +import org.springframework.data.repository.CrudRepository; + +public interface IBarCrudRepository extends CrudRepository { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarDao.java new file mode 100644 index 0000000000..7896a2a84a --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IBarDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.model.Bar; + +public interface IBarDao extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IChildDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IChildDao.java new file mode 100644 index 0000000000..a55a0b0598 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IChildDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.model.Child; +import com.baeldung.persistence.dao.common.IOperations; + +public interface IChildDao extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java new file mode 100644 index 0000000000..ddbb685988 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooAuditableDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.dao.common.IAuditOperations; +import com.baeldung.persistence.model.Foo; + +public interface IFooAuditableDao extends IFooDao, IAuditOperations { + // +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooDao.java new file mode 100644 index 0000000000..0935772dbd --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IFooDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.dao.common.IOperations; + +public interface IFooDao extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IParentDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IParentDao.java new file mode 100644 index 0000000000..03680158bb --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/IParentDao.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.dao; + +import com.baeldung.persistence.model.Parent; +import com.baeldung.persistence.dao.common.IOperations; + +public interface IParentDao extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java new file mode 100644 index 0000000000..5a6c76a93a --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractDao.java @@ -0,0 +1,14 @@ +package com.baeldung.persistence.dao.common; + +import java.io.Serializable; + +import com.google.common.base.Preconditions; + +public abstract class AbstractDao implements IOperations { + + protected Class clazz; + + protected final void setClazz(final Class clazzToSet) { + clazz = Preconditions.checkNotNull(clazzToSet); + } +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java new file mode 100644 index 0000000000..41184669ad --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateAuditableDao.java @@ -0,0 +1,37 @@ +package com.baeldung.persistence.dao.common; + +import java.io.Serializable; +import java.util.List; + +import org.hibernate.envers.AuditReader; +import org.hibernate.envers.AuditReaderFactory; +import org.hibernate.envers.query.AuditQuery; + +@SuppressWarnings("unchecked") +public class AbstractHibernateAuditableDao extends AbstractHibernateDao implements IAuditOperations { + + @Override + public List getEntitiesAtRevision(final Number revision) { + final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); + final AuditQuery query = auditReader.createQuery().forEntitiesAtRevision(clazz, revision); + final List resultList = query.getResultList(); + return resultList; + } + + @Override + public List getEntitiesModifiedAtRevision(final Number revision) { + final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); + final AuditQuery query = auditReader.createQuery().forEntitiesModifiedAtRevision(clazz, revision); + final List resultList = query.getResultList(); + return resultList; + } + + @Override + public List getRevisions() { + final AuditReader auditReader = AuditReaderFactory.get(getCurrentSession()); + final AuditQuery query = auditReader.createQuery().forRevisionsOfEntity(clazz, true, true); + final List resultList = query.getResultList(); + return resultList; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java new file mode 100644 index 0000000000..f3ade67f80 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractHibernateDao.java @@ -0,0 +1,59 @@ +package com.baeldung.persistence.dao.common; + +import java.io.Serializable; +import java.util.List; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import com.google.common.base.Preconditions; + +@SuppressWarnings("unchecked") +public abstract class AbstractHibernateDao extends AbstractDao implements IOperations { + + @Autowired + protected SessionFactory sessionFactory; + + // API + + @Override + public T findOne(final long id) { + return (T) getCurrentSession().get(clazz, id); + } + + @Override + public List findAll() { + return getCurrentSession().createQuery("from " + clazz.getName()).list(); + } + + @Override + public void create(final T entity) { + Preconditions.checkNotNull(entity); + getCurrentSession().saveOrUpdate(entity); + } + + @Override + public T update(final T entity) { + Preconditions.checkNotNull(entity); + return (T) getCurrentSession().merge(entity); + } + + @Override + public void delete(final T entity) { + Preconditions.checkNotNull(entity); + getCurrentSession().delete(entity); + } + + @Override + public void deleteById(final long entityId) { + final T entity = findOne(entityId); + Preconditions.checkState(entity != null); + delete(entity); + } + + protected Session getCurrentSession() { + return sessionFactory.getCurrentSession(); + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java new file mode 100644 index 0000000000..79bdd86658 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/AbstractJpaDao.java @@ -0,0 +1,56 @@ +package com.baeldung.persistence.dao.common; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; + +public class AbstractJpaDao extends AbstractDao implements IOperations { + + @PersistenceContext(unitName = "jpaEntityManager") + private EntityManager em; + + // API + + @Override + public T findOne(final long id) { + return em.find(clazz, Long.valueOf(id).intValue()); + } + + @Override + public List findAll() { + final CriteriaBuilder cb = em.getCriteriaBuilder(); + final CriteriaQuery cq = cb.createQuery(clazz); + final Root rootEntry = cq.from(clazz); + final CriteriaQuery all = cq.select(rootEntry); + final TypedQuery allQuery = em.createQuery(all); + return allQuery.getResultList(); + } + + @Override + public void create(final T entity) { + em.persist(entity); + } + + @Override + public T update(final T entity) { + em.merge(entity); + return entity; + } + + @Override + public void delete(final T entity) { + em.remove(entity); + } + + @Override + public void deleteById(final long entityId) { + delete(findOne(entityId)); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java new file mode 100644 index 0000000000..18b16fa033 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/GenericHibernateDao.java @@ -0,0 +1,13 @@ +package com.baeldung.persistence.dao.common; + +import java.io.Serializable; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Repository; + +@Repository +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class GenericHibernateDao extends AbstractHibernateDao implements IGenericDao { + // +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java new file mode 100644 index 0000000000..169d3fed72 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IAuditOperations.java @@ -0,0 +1,14 @@ +package com.baeldung.persistence.dao.common; + +import java.io.Serializable; +import java.util.List; + +public interface IAuditOperations { + + List getEntitiesAtRevision(Number revision); + + List getEntitiesModifiedAtRevision(Number revision); + + List getRevisions(); + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java new file mode 100644 index 0000000000..8d8af18394 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IGenericDao.java @@ -0,0 +1,7 @@ +package com.baeldung.persistence.dao.common; + +import java.io.Serializable; + +public interface IGenericDao extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IOperations.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IOperations.java new file mode 100644 index 0000000000..4ef99221ab --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/common/IOperations.java @@ -0,0 +1,20 @@ +package com.baeldung.persistence.dao.common; + +import java.io.Serializable; +import java.util.List; + +public interface IOperations { + + T findOne(final long id); + + List findAll(); + + void create(final T entity); + + T update(final T entity); + + void delete(final T entity); + + void deleteById(final long entityId); + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java new file mode 100644 index 0000000000..e12b6ae2da --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarAuditableDao.java @@ -0,0 +1,28 @@ +package com.baeldung.persistence.dao.impl; + +import java.util.List; + +import com.baeldung.persistence.dao.IBarAuditableDao; +import com.baeldung.persistence.dao.common.AbstractHibernateAuditableDao; +import com.baeldung.persistence.model.Bar; + +public class BarAuditableDao extends AbstractHibernateAuditableDao implements IBarAuditableDao { + + public BarAuditableDao() { + super(); + + setClazz(Bar.class); + } + + // API + + @Override + public List getRevisions() { + final List resultList = super.getRevisions(); + for (final Bar bar : resultList) { + bar.getFooSet().size(); // force FooSet initialization + } + return resultList; + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java new file mode 100644 index 0000000000..0ead802dc5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarDao.java @@ -0,0 +1,19 @@ +package com.baeldung.persistence.dao.impl; + +import com.baeldung.persistence.dao.common.AbstractHibernateDao; +import com.baeldung.persistence.dao.IBarDao; +import com.baeldung.persistence.model.Bar; +import org.springframework.stereotype.Repository; + +@Repository +public class BarDao extends AbstractHibernateDao implements IBarDao { + + public BarDao() { + super(); + + setClazz(Bar.class); + } + + // API + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java new file mode 100644 index 0000000000..e0fa382d41 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/BarJpaDao.java @@ -0,0 +1,19 @@ +package com.baeldung.persistence.dao.impl; + +import com.baeldung.persistence.dao.IBarDao; +import com.baeldung.persistence.dao.common.AbstractJpaDao; +import com.baeldung.persistence.model.Bar; +import org.springframework.stereotype.Repository; + +@Repository +public class BarJpaDao extends AbstractJpaDao implements IBarDao { + + public BarJpaDao() { + super(); + + setClazz(Bar.class); + } + + // API + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java new file mode 100644 index 0000000000..b55da6e43a --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ChildDao.java @@ -0,0 +1,19 @@ +package com.baeldung.persistence.dao.impl; + +import com.baeldung.persistence.dao.common.AbstractHibernateDao; +import com.baeldung.persistence.model.Child; +import com.baeldung.persistence.dao.IChildDao; +import org.springframework.stereotype.Repository; + +@Repository +public class ChildDao extends AbstractHibernateDao implements IChildDao { + + public ChildDao() { + super(); + + setClazz(Child.class); + } + + // API + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java new file mode 100644 index 0000000000..05064c1478 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooAuditableDao.java @@ -0,0 +1,17 @@ +package com.baeldung.persistence.dao.impl; + +import com.baeldung.persistence.dao.common.AbstractHibernateAuditableDao; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.dao.IFooAuditableDao; + +public class FooAuditableDao extends AbstractHibernateAuditableDao implements IFooAuditableDao { + + public FooAuditableDao() { + super(); + + setClazz(Foo.class); + } + + // API + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java new file mode 100644 index 0000000000..787c449b1d --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java @@ -0,0 +1,19 @@ +package com.baeldung.persistence.dao.impl; + +import com.baeldung.persistence.dao.common.AbstractHibernateDao; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.model.Foo; +import org.springframework.stereotype.Repository; + +@Repository +public class FooDao extends AbstractHibernateDao implements IFooDao { + + public FooDao() { + super(); + + setClazz(Foo.class); + } + + // API + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java new file mode 100644 index 0000000000..4602b5f30e --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/dao/impl/ParentDao.java @@ -0,0 +1,19 @@ +package com.baeldung.persistence.dao.impl; + +import com.baeldung.persistence.dao.IParentDao; +import com.baeldung.persistence.dao.common.AbstractHibernateDao; +import com.baeldung.persistence.model.Parent; +import org.springframework.stereotype.Repository; + +@Repository +public class ParentDao extends AbstractHibernateDao implements IParentDao { + + public ParentDao() { + super(); + + setClazz(Parent.class); + } + + // API + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Bar.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Bar.java new file mode 100644 index 0000000000..c7f05254cc --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Bar.java @@ -0,0 +1,242 @@ +package com.baeldung.persistence.model; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EntityListeners; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.PreRemove; +import javax.persistence.PreUpdate; + +import org.hibernate.annotations.OrderBy; +import org.hibernate.envers.Audited; +import org.jboss.logging.Logger; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import com.google.common.collect.Sets; + +@Entity +@NamedQuery(name = "Bar.findAll", query = "SELECT b FROM Bar b") +@Audited +@EntityListeners(AuditingEntityListener.class) +public class Bar implements Serializable { + + private static Logger logger = Logger.getLogger(Bar.class); + + public enum OPERATION { + INSERT, UPDATE, DELETE; + private String value; + + OPERATION() { + value = toString(); + } + + public String getValue() { + return value; + } + + public static OPERATION parse(final String value) { + OPERATION operation = null; + for (final OPERATION op : OPERATION.values()) { + if (op.getValue().equals(value)) { + operation = op; + break; + } + } + return operation; + } + }; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private int id; + + @Column(name = "name") + private String name; + + @OneToMany(mappedBy = "bar", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @OrderBy(clause = "NAME DESC") + // @NotAudited + private Set fooSet = Sets.newHashSet(); + + @Column(name = "operation") + private String operation; + + @Column(name = "timestamp") + private long timestamp; + + @Column(name = "created_date", updatable = false, nullable = false) + @CreatedDate + private long createdDate; + + @Column(name = "modified_date") + @LastModifiedDate + private long modifiedDate; + + @Column(name = "created_by") + @CreatedBy + private String createdBy; + + @Column(name = "modified_by") + @LastModifiedBy + private String modifiedBy; + + public Bar() { + super(); + } + + public Bar(final String name) { + super(); + + this.name = name; + } + + // API + + public Set getFooSet() { + return fooSet; + } + + public void setFooSet(final Set fooSet) { + this.fooSet = fooSet; + } + + public int getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public OPERATION getOperation() { + return OPERATION.parse(operation); + } + + public void setOperation(final OPERATION operation) { + this.operation = operation.getValue(); + } + + public long getTimestamp() { + return timestamp; + } + + public void setTimestamp(final long timestamp) { + this.timestamp = timestamp; + } + + public long getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(final long createdDate) { + this.createdDate = createdDate; + } + + public long getModifiedDate() { + return modifiedDate; + } + + public void setModifiedDate(final long modifiedDate) { + this.modifiedDate = modifiedDate; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(final String createdBy) { + this.createdBy = createdBy; + } + + public String getModifiedBy() { + return modifiedBy; + } + + public void setModifiedBy(final String modifiedBy) { + this.modifiedBy = modifiedBy; + } + + public void setOperation(final String operation) { + this.operation = operation; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Bar other = (Bar) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Bar [name=").append(name).append("]"); + return builder.toString(); + } + + @PrePersist + public void onPrePersist() { + logger.info("@PrePersist"); + audit(OPERATION.INSERT); + } + + @PreUpdate + public void onPreUpdate() { + logger.info("@PreUpdate"); + audit(OPERATION.UPDATE); + } + + @PreRemove + public void onPreRemove() { + logger.info("@PreRemove"); + audit(OPERATION.DELETE); + } + + private void audit(final OPERATION operation) { + setOperation(operation); + setTimestamp((new Date()).getTime()); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java deleted file mode 100644 index 507043dd56..0000000000 --- a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Book.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.persistence.model; - -import javax.persistence.Entity; -import javax.persistence.Id; - -@Entity -public class Book { - - @Id - private Long id; - - private String title; - - private String author; - - public Long getId() { - return id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - -} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Child.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Child.java new file mode 100644 index 0000000000..19cfb2e237 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Child.java @@ -0,0 +1,51 @@ +package com.baeldung.persistence.model; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.OneToOne; + +@Entity +public class Child implements Serializable { + + @Id + @GeneratedValue + private long id; + + @OneToOne(mappedBy = "child") + private Parent parent; + + public Child() { + super(); + } + + // API + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public Parent getParent() { + return parent; + } + + public void setParent(final Parent parent) { + this.parent = parent; + } + + // + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Child [id=").append(id).append("]"); + return builder.toString(); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Foo.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Foo.java new file mode 100644 index 0000000000..d36a1e58cf --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Foo.java @@ -0,0 +1,105 @@ +package com.baeldung.persistence.model; + +import java.io.Serializable; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedNativeQueries; +import javax.persistence.NamedNativeQuery; + +import org.hibernate.envers.Audited; + +@NamedNativeQueries({ @NamedNativeQuery(name = "callGetAllFoos", query = "CALL GetAllFoos()", resultClass = Foo.class), @NamedNativeQuery(name = "callGetFoosByName", query = "CALL GetFoosByName(:fooName)", resultClass = Foo.class) }) +@Entity +@Audited +// @Proxy(lazy = false) +public class Foo implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "id") + private long id; + + @Column(name = "name") + private String name; + + @ManyToOne(targetEntity = Bar.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @JoinColumn(name = "BAR_ID") + private Bar bar = new Bar(); + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + this.name = name; + } + + // + + public Bar getBar() { + return bar; + } + + public void setBar(final Bar bar) { + this.bar = bar; + } + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + // + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Foo other = (Foo) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Foo [name=").append(name).append("]"); + return builder.toString(); + } +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Parent.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Parent.java new file mode 100644 index 0000000000..fa6948990b --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Parent.java @@ -0,0 +1,60 @@ +package com.baeldung.persistence.model; + +import java.io.Serializable; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; + +@Entity +public class Parent implements Serializable { + + @Id + @GeneratedValue + private long id; + + @OneToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH }) + @JoinColumn(name = "child_fk") + private Child child; + + public Parent() { + super(); + } + + public Parent(final Child child) { + super(); + + this.child = child; + } + + // API + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public Child getChild() { + return child; + } + + public void setChild(final Child child) { + this.child = child; + } + + // + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Parent [id=").append(id).append("]"); + return builder.toString(); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Person.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Person.java new file mode 100644 index 0000000000..6a95a7acf5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/model/Person.java @@ -0,0 +1,31 @@ +package com.baeldung.persistence.model; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + +@Entity +public class Person { + + @Id + @GeneratedValue + private Long id; + + private String name; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java new file mode 100644 index 0000000000..33e5634d12 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarAuditableService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.dao.common.IAuditOperations; +import com.baeldung.persistence.model.Bar; + +public interface IBarAuditableService extends IBarService, IAuditOperations { + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarService.java new file mode 100644 index 0000000000..21185b5990 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IBarService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.model.Bar; + +public interface IBarService extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IChildService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IChildService.java new file mode 100644 index 0000000000..afe67a70c2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IChildService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.model.Child; +import com.baeldung.persistence.dao.common.IOperations; + +public interface IChildService extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java new file mode 100644 index 0000000000..b787e7fe91 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooAuditableService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.dao.common.IAuditOperations; +import com.baeldung.persistence.model.Foo; + +public interface IFooAuditableService extends IFooService, IAuditOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooService.java new file mode 100644 index 0000000000..ffdb53964a --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IFooService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.dao.common.IOperations; + +public interface IFooService extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IParentService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IParentService.java new file mode 100644 index 0000000000..f941416aac --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/IParentService.java @@ -0,0 +1,8 @@ +package com.baeldung.persistence.service; + +import com.baeldung.persistence.model.Parent; +import com.baeldung.persistence.dao.common.IOperations; + +public interface IParentService extends IOperations { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java new file mode 100644 index 0000000000..2695d7760a --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateAuditableService.java @@ -0,0 +1,30 @@ +package com.baeldung.persistence.service.common; + +import java.io.Serializable; +import java.util.List; + +import com.baeldung.persistence.dao.common.IAuditOperations; +import com.baeldung.persistence.dao.common.IOperations; +import org.springframework.transaction.annotation.Transactional; + +@Transactional(value = "hibernateTransactionManager") +public abstract class AbstractHibernateAuditableService extends AbstractHibernateService implements IOperations, IAuditOperations { + + @Override + public List getEntitiesAtRevision(final Number revision) { + return getAuditableDao().getEntitiesAtRevision(revision); + } + + @Override + public List getEntitiesModifiedAtRevision(final Number revision) { + return getAuditableDao().getEntitiesModifiedAtRevision(revision); + } + + @Override + public List getRevisions() { + return getAuditableDao().getRevisions(); + } + + abstract protected IAuditOperations getAuditableDao(); + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java new file mode 100644 index 0000000000..02b8ccf48b --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractHibernateService.java @@ -0,0 +1,42 @@ +package com.baeldung.persistence.service.common; + +import java.io.Serializable; +import java.util.List; + +import com.baeldung.persistence.dao.common.IOperations; +import org.springframework.transaction.annotation.Transactional; + +@Transactional(value = "hibernateTransactionManager") +public abstract class AbstractHibernateService extends AbstractService implements IOperations { + + @Override + public T findOne(final long id) { + return super.findOne(id); + } + + @Override + public List findAll() { + return super.findAll(); + } + + @Override + public void create(final T entity) { + super.create(entity); + } + + @Override + public T update(final T entity) { + return super.update(entity); + } + + @Override + public void delete(final T entity) { + super.delete(entity); + } + + @Override + public void deleteById(final long entityId) { + super.deleteById(entityId); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java new file mode 100644 index 0000000000..a1c6fe9edf --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractJpaService.java @@ -0,0 +1,42 @@ +package com.baeldung.persistence.service.common; + +import java.io.Serializable; +import java.util.List; + +import com.baeldung.persistence.dao.common.IOperations; +import org.springframework.transaction.annotation.Transactional; + +@Transactional(value = "jpaTransactionManager") +public abstract class AbstractJpaService extends AbstractService implements IOperations { + + @Override + public T findOne(final long id) { + return super.findOne(id); + } + + @Override + public List findAll() { + return super.findAll(); + } + + @Override + public void create(final T entity) { + super.create(entity); + } + + @Override + public T update(final T entity) { + return super.update(entity); + } + + @Override + public void delete(final T entity) { + super.delete(entity); + } + + @Override + public void deleteById(final long entityId) { + super.deleteById(entityId); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractService.java new file mode 100644 index 0000000000..9b001b1fac --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractService.java @@ -0,0 +1,42 @@ +package com.baeldung.persistence.service.common; + +import java.io.Serializable; +import java.util.List; + +import com.baeldung.persistence.dao.common.IOperations; + +public abstract class AbstractService implements IOperations { + + @Override + public T findOne(final long id) { + return getDao().findOne(id); + } + + @Override + public List findAll() { + return getDao().findAll(); + } + + @Override + public void create(final T entity) { + getDao().create(entity); + } + + @Override + public T update(final T entity) { + return getDao().update(entity); + } + + @Override + public void delete(final T entity) { + getDao().delete(entity); + } + + @Override + public void deleteById(final long entityId) { + getDao().deleteById(entityId); + } + + protected abstract IOperations getDao(); + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java new file mode 100644 index 0000000000..73fe27e9ec --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/common/AbstractSpringDataJpaService.java @@ -0,0 +1,48 @@ +package com.baeldung.persistence.service.common; + +import java.io.Serializable; +import java.util.List; +import java.util.Optional; + +import com.baeldung.persistence.dao.common.IOperations; +import org.springframework.data.repository.CrudRepository; +import org.springframework.transaction.annotation.Transactional; + +import com.google.common.collect.Lists; + +@Transactional(value = "jpaTransactionManager") +public abstract class AbstractSpringDataJpaService implements IOperations { + + @Override + public T findOne(final long id) { + Optional opt = getDao().findById(Long.valueOf(id)); + return opt.get(); + } + + @Override + public List findAll() { + return Lists.newArrayList(getDao().findAll()); + } + + @Override + public void create(final T entity) { + getDao().save(entity); + } + + @Override + public T update(final T entity) { + return getDao().save(entity); + } + + @Override + public void delete(final T entity) { + getDao().delete(entity); + } + + @Override + public void deleteById(final long entityId) { + getDao().deleteById(Long.valueOf(entityId)); + } + + protected abstract CrudRepository getDao(); +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java new file mode 100644 index 0000000000..d84c28caa5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarAuditableService.java @@ -0,0 +1,41 @@ +package com.baeldung.persistence.service.impl; + +import com.baeldung.persistence.dao.common.IAuditOperations; +import com.baeldung.persistence.service.common.AbstractHibernateAuditableService; +import com.baeldung.persistence.dao.IBarAuditableDao; +import com.baeldung.persistence.dao.IBarDao; +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.model.Bar; +import com.baeldung.persistence.service.IBarAuditableService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +@Service +public class BarAuditableService extends AbstractHibernateAuditableService implements IBarAuditableService { + + @Autowired + @Qualifier("barHibernateDao") + private IBarDao dao; + + @Autowired + @Qualifier("barHibernateAuditableDao") + private IBarAuditableDao auditDao; + + public BarAuditableService() { + super(); + } + + // API + + @Override + protected IOperations getDao() { + return dao; + } + + @Override + protected IAuditOperations getAuditableDao() { + return auditDao; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java new file mode 100644 index 0000000000..1c1b7a2274 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarJpaService.java @@ -0,0 +1,30 @@ +package com.baeldung.persistence.service.impl; + +import com.baeldung.persistence.dao.IBarDao; +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.model.Bar; +import com.baeldung.persistence.service.IBarService; +import com.baeldung.persistence.service.common.AbstractJpaService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +@Service +public class BarJpaService extends AbstractJpaService implements IBarService { + + @Autowired + @Qualifier("barJpaDao") + private IBarDao dao; + + public BarJpaService() { + super(); + } + + // API + + @Override + protected IOperations getDao() { + return dao; + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarService.java new file mode 100644 index 0000000000..32d1f919c5 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarService.java @@ -0,0 +1,30 @@ +package com.baeldung.persistence.service.impl; + +import com.baeldung.persistence.dao.IBarDao; +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.model.Bar; +import com.baeldung.persistence.service.IBarService; +import com.baeldung.persistence.service.common.AbstractHibernateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +@Service +public class BarService extends AbstractHibernateService implements IBarService { + + @Autowired + @Qualifier("barHibernateDao") + private IBarDao dao; + + public BarService() { + super(); + } + + // API + + @Override + protected IOperations getDao() { + return dao; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java new file mode 100644 index 0000000000..4a55d08a35 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/BarSpringDataJpaService.java @@ -0,0 +1,26 @@ +package com.baeldung.persistence.service.impl; + +import java.io.Serializable; + +import com.baeldung.persistence.service.common.AbstractSpringDataJpaService; +import com.baeldung.persistence.dao.IBarCrudRepository; +import com.baeldung.persistence.model.Bar; +import com.baeldung.persistence.service.IBarService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.repository.CrudRepository; + +public class BarSpringDataJpaService extends AbstractSpringDataJpaService implements IBarService { + + @Autowired + private IBarCrudRepository dao; + + public BarSpringDataJpaService() { + super(); + } + + @Override + protected CrudRepository getDao() { + return dao; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ChildService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ChildService.java new file mode 100644 index 0000000000..417fe2c49a --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ChildService.java @@ -0,0 +1,28 @@ +package com.baeldung.persistence.service.impl; + +import com.baeldung.persistence.model.Child; +import com.baeldung.persistence.service.IChildService; +import com.baeldung.persistence.dao.IChildDao; +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.service.common.AbstractHibernateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ChildService extends AbstractHibernateService implements IChildService { + + @Autowired + private IChildDao dao; + + public ChildService() { + super(); + } + + // API + + @Override + protected IOperations getDao() { + return dao; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java new file mode 100644 index 0000000000..45ad315c42 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooAuditableService.java @@ -0,0 +1,41 @@ +package com.baeldung.persistence.service.impl; + +import com.baeldung.persistence.dao.common.IAuditOperations; +import com.baeldung.persistence.service.IFooAuditableService; +import com.baeldung.persistence.service.common.AbstractHibernateAuditableService; +import com.baeldung.persistence.dao.IFooAuditableDao; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.model.Foo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +@Service +public class FooAuditableService extends AbstractHibernateAuditableService implements IFooAuditableService { + + @Autowired + @Qualifier("fooHibernateDao") + private IFooDao dao; + + @Autowired + @Qualifier("fooHibernateAuditableDao") + private IFooAuditableDao auditDao; + + public FooAuditableService() { + super(); + } + + // API + + @Override + protected IOperations getDao() { + return dao; + } + + @Override + protected IAuditOperations getAuditableDao() { + return auditDao; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooService.java new file mode 100644 index 0000000000..84cf018fee --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/FooService.java @@ -0,0 +1,30 @@ +package com.baeldung.persistence.service.impl; + +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.persistence.service.common.AbstractHibernateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +@Service +public class FooService extends AbstractHibernateService implements IFooService { + + @Autowired + @Qualifier("fooHibernateDao") + private IFooDao dao; + + public FooService() { + super(); + } + + // API + + @Override + protected IOperations getDao() { + return dao; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ParentService.java b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ParentService.java new file mode 100644 index 0000000000..078acfc369 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/java/com/baeldung/persistence/service/impl/ParentService.java @@ -0,0 +1,28 @@ +package com.baeldung.persistence.service.impl; + +import com.baeldung.persistence.model.Parent; +import com.baeldung.persistence.service.IParentService; +import com.baeldung.persistence.dao.IParentDao; +import com.baeldung.persistence.dao.common.IOperations; +import com.baeldung.persistence.service.common.AbstractHibernateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ParentService extends AbstractHibernateService implements IParentService { + + @Autowired + private IParentDao dao; + + public ParentService() { + super(); + } + + // API + + @Override + protected IOperations getDao() { + return dao; + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml new file mode 100644 index 0000000000..1b9a4a191c --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching.cfg.xml @@ -0,0 +1,20 @@ + + + + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/test + root + iamtheking + org.hibernate.dialect.MySQLDialect + true + validate + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml new file mode 100644 index 0000000000..c5f608e1a7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetchingLazy.cfg.xml @@ -0,0 +1,17 @@ + + + + + + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/test + root + iamtheking + org.hibernate.dialect.MySQLDialect + true + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching_create_queries.sql b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching_create_queries.sql new file mode 100644 index 0000000000..b36d9828f1 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/fetching_create_queries.sql @@ -0,0 +1,14 @@ +CREATE TABLE `user` ( + `user_id` int(10) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`user_id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 ; + + +CREATE TABLE `user_order` ( + `ORDER_ID` int(10) NOT NULL AUTO_INCREMENT, + `USER_ID` int(10) NOT NULL DEFAULT '0', + PRIMARY KEY (`ORDER_ID`,`USER_ID`), + KEY `USER_ID` (`USER_ID`), + CONSTRAINT `user_order_ibfk_1` FOREIGN KEY (`USER_ID`) REFERENCES `USER` (`user_id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; + diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Config.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Config.xml new file mode 100644 index 0000000000..bbb61cb3e0 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Config.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + ${hibernate.hbm2ddl.auto} + ${hibernate.dialect} + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Configuration.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Configuration.xml new file mode 100644 index 0000000000..1870cfb917 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/hibernate5Configuration.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + ${hibernate.hbm2ddl.auto} + ${hibernate.dialect} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/immutable.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/immutable.cfg.xml new file mode 100644 index 0000000000..fe1e3cb723 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/immutable.cfg.xml @@ -0,0 +1,38 @@ + + + + + + + + + org.hsqldb.jdbcDriver + jdbc:hsqldb:hsql:mem://localhost/xdb + sa + + + + 1 + + + org.hibernate.dialect.HSQLDialect + + + thread + + + org.hibernate.cache.NoCacheProvider + + + true + + + update + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_statements.sql b/persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_statements.sql new file mode 100644 index 0000000000..ae008f29bc --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/insert_statements.sql @@ -0,0 +1,31 @@ +insert into item (item_id, item_name, item_desc, item_price) +values(1,'item One', 'test 1', 35.12); + +insert into item (item_id, item_name, item_desc, item_price) +values(2,'Pogo stick', 'Pogo stick', 466.12); +insert into item (item_id, item_name, item_desc, item_price) +values(3,'Raft', 'Raft', 345.12); + +insert into item (item_id, item_name, item_desc, item_price) +values(4,'Skate Board', 'Skating', 135.71); + +insert into item (item_id, item_name, item_desc, item_price) +values(5,'Umbrella', 'Umbrella for Rain', 619.25); + +insert into item (item_id, item_name, item_desc, item_price) +values(6,'Glue', 'Glue for home', 432.73); + +insert into item (item_id, item_name, item_desc, item_price) +values(7,'Paint', 'Paint for Room', 1311.40); + +insert into item (item_id, item_name, item_desc, item_price) +values(8,'Red paint', 'Red paint for room', 1135.71); + +insert into item (item_id, item_name, item_desc, item_price) +values(9,'Household Chairs', 'Chairs for house', 25.71); + +insert into item (item_id, item_name, item_desc, item_price) +values(10,'Office Chairs', 'Chairs for office', 395.98); + +insert into item (item_id, item_name, item_desc, item_price) +values(11,'Outdoor Chairs', 'Chairs for outdoor activities', 1234.36); diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/logback.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..56af2d397e --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/persistence-mysql.properties b/persistence-modules/spring-data-jpa-query-2/src/main/resources/persistence-mysql.properties new file mode 100644 index 0000000000..f6b6ab6fca --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/persistence-mysql.properties @@ -0,0 +1,13 @@ +# jdbc.X +jdbc.driverClassName=com.mysql.jdbc.Driver +jdbc.url=jdbc:mysql://localhost:3306/spring_hibernate4_01?createDatabaseIfNotExist=true +jdbc.user=tutorialuser +jdbc.pass=tutorialmy5ql + +# hibernate.X +hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +hibernate.show_sql=false +hibernate.hbm2ddl.auto=create-drop + +# envers.X +envers.audit_table_suffix=_audit_log diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/stored_procedure.sql b/persistence-modules/spring-data-jpa-query-2/src/main/resources/stored_procedure.sql new file mode 100644 index 0000000000..9cedb75c37 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/stored_procedure.sql @@ -0,0 +1,20 @@ +DELIMITER // + CREATE PROCEDURE GetFoosByName(IN fooName VARCHAR(255)) + LANGUAGE SQL + DETERMINISTIC + SQL SECURITY DEFINER + BEGIN + SELECT * FROM foo WHERE name = fooName; + END // +DELIMITER ; + + +DELIMITER // + CREATE PROCEDURE GetAllFoos() + LANGUAGE SQL + DETERMINISTIC + SQL SECURITY DEFINER + BEGIN + SELECT * FROM foo; + END // +DELIMITER ; \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/main/resources/webSecurityConfig.xml b/persistence-modules/spring-data-jpa-query-2/src/main/resources/webSecurityConfig.xml new file mode 100644 index 0000000000..e5c19a4ad7 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/main/resources/webSecurityConfig.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java new file mode 100644 index 0000000000..65bf36f8bf --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/hibernate/fetching/HibernateFetchingIntegrationTest.java @@ -0,0 +1,42 @@ +package com.baeldung.hibernate.fetching; + +import com.baeldung.hibernate.fetching.model.OrderDetail; +import com.baeldung.hibernate.fetching.view.FetchingAppView; +import org.hibernate.Hibernate; +import org.junit.Before; +import org.junit.Test; + +import java.util.Set; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class HibernateFetchingIntegrationTest { + + // this loads sample data in the database + @Before + public void addFecthingTestData() { + FetchingAppView fav = new FetchingAppView(); + fav.createTestData(); + } + + // testLazyFetching() tests the lazy loading + // Since it lazily loaded so orderDetalSetLazy won't + // be initialized + @Test + public void testLazyFetching() { + FetchingAppView fav = new FetchingAppView(); + Set orderDetalSetLazy = fav.lazyLoaded(); + assertFalse(Hibernate.isInitialized(orderDetalSetLazy)); + } + + // testEagerFetching() tests the eager loading + // Since it eagerly loaded so orderDetalSetLazy would + // be initialized + @Test + public void testEagerFetching() { + FetchingAppView fav = new FetchingAppView(); + Set orderDetalSetEager = fav.eagerLoaded(); + assertTrue(Hibernate.isInitialized(orderDetalSetEager)); + } +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java new file mode 100644 index 0000000000..f5c45a5d6f --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/IntegrationTestSuite.java @@ -0,0 +1,25 @@ +package com.baeldung.persistence; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import com.baeldung.persistence.audit.AuditTestSuite; +import com.baeldung.persistence.hibernate.FooPaginationPersistenceIntegrationTest; +import com.baeldung.persistence.hibernate.FooSortingPersistenceIntegrationTest; +import com.baeldung.persistence.service.FooServiceBasicPersistenceIntegrationTest; +import com.baeldung.persistence.service.FooServicePersistenceIntegrationTest; +import com.baeldung.persistence.service.ParentServicePersistenceIntegrationTest; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ // @formatter:off + AuditTestSuite.class + ,FooServiceBasicPersistenceIntegrationTest.class + ,FooPaginationPersistenceIntegrationTest.class + ,FooServicePersistenceIntegrationTest.class + ,ParentServicePersistenceIntegrationTest.class + ,FooSortingPersistenceIntegrationTest.class + +}) // @formatter:on +public class IntegrationTestSuite { + // +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java new file mode 100644 index 0000000000..34c725d62b --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/AuditTestSuite.java @@ -0,0 +1,14 @@ +package com.baeldung.persistence.audit; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ // @formatter:off + EnversFooBarAuditIntegrationTest.class, + JPABarAuditIntegrationTest.class, + SpringDataJPABarAuditIntegrationTest.class +}) // @formatter:on +public class AuditTestSuite { + // +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java new file mode 100644 index 0000000000..444324dafc --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/EnversFooBarAuditIntegrationTest.java @@ -0,0 +1,146 @@ +package com.baeldung.persistence.audit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Bar; +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IBarAuditableService; +import com.baeldung.persistence.service.IFooAuditableService; +import com.baeldung.spring.config.PersistenceTestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) +@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS) +public class EnversFooBarAuditIntegrationTest { + + private static Logger logger = LoggerFactory.getLogger(EnversFooBarAuditIntegrationTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + logger.info("setUpBeforeClass()"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.info("tearDownAfterClass()"); + } + + @Autowired + @Qualifier("fooHibernateAuditableService") + private IFooAuditableService fooService; + + @Autowired + @Qualifier("barHibernateAuditableService") + private IBarAuditableService barService; + + @Autowired + private SessionFactory sessionFactory; + + private Session session; + + @Before + public void setUp() throws Exception { + logger.info("setUp()"); + makeRevisions(); + session = sessionFactory.openSession(); + } + + @After + public void tearDown() throws Exception { + logger.info("tearDown()"); + session.close(); + } + + private void makeRevisions() { + final Bar bar = rev1(); + rev2(bar); + rev3(bar); + rev4(bar); + } + + // REV #1: insert BAR & FOO1 + private Bar rev1() { + final Bar bar = new Bar("BAR"); + final Foo foo1 = new Foo("FOO1"); + foo1.setBar(bar); + fooService.create(foo1); + return bar; + } + + // REV #2: insert FOO2 & update BAR + private void rev2(final Bar bar) { + final Foo foo2 = new Foo("FOO2"); + foo2.setBar(bar); + fooService.create(foo2); + } + + // REV #3: update BAR + private void rev3(final Bar bar) { + + bar.setName("BAR1"); + barService.update(bar); + } + + // REV #4: insert FOO3 & update BAR + private void rev4(final Bar bar) { + + final Foo foo3 = new Foo("FOO3"); + foo3.setBar(bar); + fooService.create(foo3); + } + + @Test + public final void whenFooBarsModified_thenFooBarsAudited() { + + List barRevisionList; + List fooRevisionList; + + // test Bar revisions + + barRevisionList = barService.getRevisions(); + + assertNotNull(barRevisionList); + assertEquals(4, barRevisionList.size()); + + assertEquals("BAR", barRevisionList.get(0).getName()); + assertEquals("BAR", barRevisionList.get(1).getName()); + assertEquals("BAR1", barRevisionList.get(2).getName()); + assertEquals("BAR1", barRevisionList.get(3).getName()); + + assertEquals(1, barRevisionList.get(0).getFooSet().size()); + assertEquals(2, barRevisionList.get(1).getFooSet().size()); + assertEquals(2, barRevisionList.get(2).getFooSet().size()); + assertEquals(3, barRevisionList.get(3).getFooSet().size()); + + // test Foo revisions + + fooRevisionList = fooService.getRevisions(); + assertNotNull(fooRevisionList); + assertEquals(3, fooRevisionList.size()); + assertEquals("FOO1", fooRevisionList.get(0).getName()); + assertEquals("FOO2", fooRevisionList.get(1).getName()); + assertEquals("FOO3", fooRevisionList.get(2).getName()); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java new file mode 100644 index 0000000000..f591773cde --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/JPABarAuditIntegrationTest.java @@ -0,0 +1,104 @@ +package com.baeldung.persistence.audit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Bar; +import com.baeldung.persistence.model.Bar.OPERATION; +import com.baeldung.persistence.service.IBarService; +import com.baeldung.spring.config.PersistenceTestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) +public class JPABarAuditIntegrationTest { + + private static Logger logger = LoggerFactory.getLogger(JPABarAuditIntegrationTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + logger.info("setUpBeforeClass()"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.info("tearDownAfterClass()"); + } + + @Autowired + @Qualifier("barJpaService") + private IBarService barService; + + @Autowired + @Qualifier("jpaEntityManager") + private EntityManagerFactory entityManagerFactory; + + private EntityManager em; + + @Before + public void setUp() throws Exception { + logger.info("setUp()"); + em = entityManagerFactory.createEntityManager(); + } + + @After + public void tearDown() throws Exception { + logger.info("tearDown()"); + em.close(); + } + + @Test + public final void whenBarsModified_thenBarsAudited() { + + // insert BAR1 + Bar bar1 = new Bar("BAR1"); + barService.create(bar1); + + // update BAR1 + bar1.setName("BAR1a"); + barService.update(bar1); + + // insert BAR2 + Bar bar2 = new Bar("BAR2"); + barService.create(bar2); + + // update BAR1 + bar1.setName("BAR1b"); + barService.update(bar1); + + // get BAR1 and BAR2 from the DB and check the audit values + // detach instances from persistence context to make sure we fire db + em.detach(bar1); + em.detach(bar2); + bar1 = barService.findOne(bar1.getId()); + bar2 = barService.findOne(bar2.getId()); + + assertNotNull(bar1); + assertNotNull(bar2); + assertEquals(OPERATION.UPDATE, bar1.getOperation()); + assertEquals(OPERATION.INSERT, bar2.getOperation()); + assertTrue(bar1.getTimestamp() > bar2.getTimestamp()); + + barService.deleteById(bar1.getId()); + barService.deleteById(bar2.getId()); + + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java new file mode 100644 index 0000000000..0603067810 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/audit/SpringDataJPABarAuditIntegrationTest.java @@ -0,0 +1,78 @@ +package com.baeldung.persistence.audit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Bar; +import com.baeldung.persistence.service.IBarService; +import com.baeldung.spring.config.PersistenceTestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) +public class SpringDataJPABarAuditIntegrationTest { + + private static Logger logger = LoggerFactory.getLogger(SpringDataJPABarAuditIntegrationTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + logger.info("setUpBeforeClass()"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + logger.info("tearDownAfterClass()"); + } + + @Autowired + @Qualifier("barSpringDataJpaService") + private IBarService barService; + + @Autowired + @Qualifier("jpaEntityManager") + private EntityManagerFactory entityManagerFactory; + + private EntityManager em; + + @Before + public void setUp() throws Exception { + logger.info("setUp()"); + em = entityManagerFactory.createEntityManager(); + } + + @After + public void tearDown() throws Exception { + logger.info("tearDown()"); + em.close(); + } + + @Test + @WithMockUser(username = "tutorialuser") + public final void whenBarsModified_thenBarsAudited() { + Bar bar = new Bar("BAR1"); + barService.create(bar); + assertEquals(bar.getCreatedDate(), bar.getModifiedDate()); + assertEquals("tutorialuser", bar.getCreatedBy(), bar.getModifiedBy()); + bar.setName("BAR2"); + bar = barService.update(bar); + assertTrue(bar.getCreatedDate() < bar.getModifiedDate()); + assertEquals("tutorialuser", bar.getCreatedBy(), bar.getModifiedBy()); + } +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java new file mode 100644 index 0000000000..da840dc027 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooFixtures.java @@ -0,0 +1,101 @@ +package com.baeldung.persistence.hibernate; + +import java.util.List; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Bar; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; + +import com.google.common.collect.Lists; + +public class FooFixtures { + private SessionFactory sessionFactory; + + public FooFixtures(final SessionFactory sessionFactory) { + super(); + + this.sessionFactory = sessionFactory; + } + + // API + + public void createBars() { + Session session = null; + Transaction tx = null; + session = sessionFactory.openSession(); + tx = session.getTransaction(); + try { + tx.begin(); + for (int i = 156; i < 160; i++) { + final Bar bar = new Bar(); + bar.setName("Bar_" + i); + final Foo foo = new Foo("Foo_" + (i + 120)); + foo.setBar(bar); + session.save(foo); + final Foo foo2 = new Foo(null); + if (i % 2 == 0) + foo2.setName("LuckyFoo" + (i + 120)); + foo2.setBar(bar); + session.save(foo2); + bar.getFooSet().add(foo); + bar.getFooSet().add(foo2); + session.merge(bar); + } + tx.commit(); + session.flush(); + } catch (final HibernateException he) { + if (tx != null) + tx.rollback(); + System.out.println("Not able to open session"); + he.printStackTrace(); + } catch (final Exception e) { + e.printStackTrace(); + } finally { + if (session != null) + session.close(); + } + + } + + public void createFoos() { + Session session = null; + Transaction tx = null; + session = sessionFactory.openSession(); + tx = session.getTransaction(); + final List fooList = Lists.newArrayList(); + for (int i = 35; i < 46; i++) { + + final Foo foo = new Foo(); + foo.setName("Foo_" + (i + 120)); + final Bar bar = new Bar("bar_" + i); + bar.getFooSet().add(foo); + foo.setBar(bar); + fooList.add(foo); + + } + try { + tx.begin(); + for (final Foo foo : fooList) { + + session.save(foo.getBar()); + session.save(foo); + } + tx.commit(); + session.flush(); + } catch (final HibernateException he) { + if (tx != null) + tx.rollback(); + System.out.println("Not able to open session"); + he.printStackTrace(); + } catch (final Exception e) { + e.printStackTrace(); + } finally { + if (session != null) + session.close(); + } + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java new file mode 100644 index 0000000000..fd7bc4aabf --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooPaginationPersistenceIntegrationTest.java @@ -0,0 +1,185 @@ +package com.baeldung.persistence.hibernate; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.lessThan; +import static org.junit.Assert.assertThat; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.ScrollMode; +import org.hibernate.ScrollableResults; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.spring.config.PersistenceTestConfig; +import com.google.common.collect.Lists; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) +public class FooPaginationPersistenceIntegrationTest { + + @Autowired + private IFooService fooService; + + @Autowired + private SessionFactory sessionFactory; + + private Session session; + + // tests + + @Before + public final void before() { + final int minimalNumberOfEntities = 25; + if (fooService.findAll().size() <= minimalNumberOfEntities) { + for (int i = 0; i < minimalNumberOfEntities; i++) { + fooService.create(new Foo(randomAlphabetic(6))); + } + } + + session = sessionFactory.openSession(); + } + + @After + public final void after() { + session.close(); + } + + // tests + + @Test + public final void whenContextIsBootstrapped_thenNoExceptions() { + // + } + + @SuppressWarnings("unchecked") + @Test + public final void whenRetrievingPaginatedEntities_thenCorrectSize() { + final int pageNumber = 1; + final int pageSize = 10; + + final Query query = session.createQuery("From Foo"); + query.setFirstResult((pageNumber - 1) * pageSize); + query.setMaxResults(pageSize); + final List fooList = query.list(); + + assertThat(fooList, hasSize(pageSize)); + } + + @SuppressWarnings("unchecked") + @Test + public final void whenRetrievingAllPages_thenCorrect() { + int pageNumber = 1; + final int pageSize = 10; + + final String countQ = "Select count (f.id) from Foo f"; + final Query countQuery = session.createQuery(countQ); + final Long countResult = (Long) countQuery.uniqueResult(); + + final List fooList = Lists.newArrayList(); + int totalEntities = 0; + final Query query = session.createQuery("From Foo"); + while (totalEntities < countResult) { + query.setFirstResult((pageNumber - 1) * pageSize); + query.setMaxResults(pageSize); + fooList.addAll(query.list()); + totalEntities = fooList.size(); + pageNumber++; + } + } + + @SuppressWarnings("unchecked") + @Test + public final void whenRetrievingLastPage_thenCorrectSize() { + final int pageSize = 10; + + final String countQ = "Select count (f.id) from Foo f"; + final Query countQuery = session.createQuery(countQ); + final Long countResults = (Long) countQuery.uniqueResult(); + final int lastPageNumber = (int) (Math.ceil(countResults / pageSize)); + + final Query selectQuery = session.createQuery("From Foo"); + selectQuery.setFirstResult((lastPageNumber - 1) * pageSize); + selectQuery.setMaxResults(pageSize); + final List lastPage = selectQuery.list(); + + assertThat(lastPage, hasSize(lessThan(pageSize + 1))); + } + + // testing - scrollable + + @Test + public final void givenUsingTheScrollableApi_whenRetrievingPaginatedData_thenCorrect() { + final int pageSize = 10; + final String hql = "FROM Foo f order by f.name"; + final Query query = session.createQuery(hql); + + final ScrollableResults resultScroll = query.scroll(ScrollMode.FORWARD_ONLY); + + // resultScroll.last(); + // final int totalResults = resultScroll.getRowNumber() + 1; + + resultScroll.first(); + resultScroll.scroll(0); + final List fooPage = Lists.newArrayList(); + int i = 0; + while (pageSize > i++) { + fooPage.add((Foo) resultScroll.get(0)); + if (!resultScroll.next()) { + break; + } + } + + assertThat(fooPage, hasSize(lessThan(10 + 1))); + } + + @SuppressWarnings("unchecked") + @Test + public final void givenUsingTheCriteriaApi_whenRetrievingFirstPage_thenCorrect() { + final int pageSize = 10; + + final Criteria criteria = session.createCriteria(Foo.class); + criteria.setFirstResult(0); + criteria.setMaxResults(pageSize); + final List firstPage = criteria.list(); + + assertThat(firstPage, hasSize(pageSize)); + } + + @SuppressWarnings("unchecked") + @Test + public final void givenUsingTheCriteriaApi_whenRetrievingPaginatedData_thenCorrect() { + final Criteria criteriaCount = session.createCriteria(Foo.class); + criteriaCount.setProjection(Projections.rowCount()); + final Long count = (Long) criteriaCount.uniqueResult(); + + int pageNumber = 1; + final int pageSize = 10; + final List fooList = Lists.newArrayList(); + + final Criteria criteria = session.createCriteria(Foo.class); + int totalEntities = 0; + while (totalEntities < count.intValue()) { + criteria.setFirstResult((pageNumber - 1) * pageSize); + criteria.setMaxResults(pageSize); + fooList.addAll(criteria.list()); + totalEntities = fooList.size(); + pageNumber++; + } + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java new file mode 100644 index 0000000000..8173088af0 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/hibernate/FooSortingPersistenceIntegrationTest.java @@ -0,0 +1,174 @@ +package com.baeldung.persistence.hibernate; + +import static org.junit.Assert.assertNull; + +import java.util.List; +import java.util.Set; + +import org.hibernate.Criteria; +import org.hibernate.NullPrecedence; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Bar; +import com.baeldung.persistence.model.Foo; +import com.baeldung.spring.config.PersistenceTestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) +@SuppressWarnings("unchecked") +public class FooSortingPersistenceIntegrationTest { + + @Autowired + private SessionFactory sessionFactory; + + private Session session; + + @Before + public void before() { + session = sessionFactory.openSession(); + + session.beginTransaction(); + + final FooFixtures fooData = new FooFixtures(sessionFactory); + fooData.createBars(); + } + + @After + public void after() { + session.getTransaction().commit(); + session.close(); + } + + @Test + public final void whenHQlSortingByOneAttribute_thenPrintSortedResults() { + final String hql = "FROM Foo f ORDER BY f.name"; + final Query query = session.createQuery(hql); + final List fooList = query.list(); + for (final Foo foo : fooList) { + System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); + } + } + + @Test + public final void whenHQlSortingByStringNullLast_thenLastNull() { + final String hql = "FROM Foo f ORDER BY f.name NULLS LAST"; + final Query query = session.createQuery(hql); + final List fooList = query.list(); + + assertNull(fooList.get(fooList.toArray().length - 1).getName()); + for (final Foo foo : fooList) { + System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); + } + } + + @Test + public final void whenSortingByStringNullsFirst_thenReturnNullsFirst() { + final String hql = "FROM Foo f ORDER BY f.name NULLS FIRST"; + final Query query = session.createQuery(hql); + final List fooList = query.list(); + assertNull(fooList.get(0).getName()); + for (final Foo foo : fooList) { + System.out.println("Name:" + foo.getName()); + + } + } + + @Test + public final void whenHQlSortingByOneAttribute_andOrderDirection_thenPrintSortedResults() { + final String hql = "FROM Foo f ORDER BY f.name ASC"; + final Query query = session.createQuery(hql); + final List fooList = query.list(); + for (final Foo foo : fooList) { + System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); + } + } + + @Test + public final void whenHQlSortingByMultipleAttributes_thenSortedResults() { + final String hql = "FROM Foo f ORDER BY f.name, f.id"; + final Query query = session.createQuery(hql); + final List fooList = query.list(); + for (final Foo foo : fooList) { + System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); + } + } + + @Test + public final void whenHQlSortingByMultipleAttributes_andOrderDirection_thenPrintSortedResults() { + final String hql = "FROM Foo f ORDER BY f.name DESC, f.id ASC"; + final Query query = session.createQuery(hql); + final List fooList = query.list(); + for (final Foo foo : fooList) { + System.out.println("Name: " + foo.getName() + ", Id: " + foo.getId()); + } + } + + @Test + public final void whenHQLCriteriaSortingByOneAttr_thenPrintSortedResults() { + final Criteria criteria = session.createCriteria(Foo.class, "FOO"); + criteria.addOrder(Order.asc("id")); + final List fooList = criteria.list(); + for (final Foo foo : fooList) { + System.out.println("Id: " + foo.getId() + ", FirstName: " + foo.getName()); + } + } + + @Test + public final void whenHQLCriteriaSortingByMultipAttr_thenSortedResults() { + final Criteria criteria = session.createCriteria(Foo.class, "FOO"); + criteria.addOrder(Order.asc("name")); + criteria.addOrder(Order.asc("id")); + final List fooList = criteria.list(); + for (final Foo foo : fooList) { + System.out.println("Id: " + foo.getId() + ", FirstName: " + foo.getName()); + } + } + + @Test + public final void whenCriteriaSortingStringNullsLastAsc_thenNullsLast() { + final Criteria criteria = session.createCriteria(Foo.class, "FOO"); + criteria.addOrder(Order.asc("name").nulls(NullPrecedence.LAST)); + final List fooList = criteria.list(); + assertNull(fooList.get(fooList.toArray().length - 1).getName()); + for (final Foo foo : fooList) { + System.out.println("Id: " + foo.getId() + ", FirstName: " + foo.getName()); + } + } + + @Test + public final void whenCriteriaSortingStringNullsFirstDesc_thenNullsFirst() { + final Criteria criteria = session.createCriteria(Foo.class, "FOO"); + criteria.addOrder(Order.desc("name").nulls(NullPrecedence.FIRST)); + final List fooList = criteria.list(); + assertNull(fooList.get(0).getName()); + for (final Foo foo : fooList) { + System.out.println("Id: " + foo.getId() + ", FirstName: " + foo.getName()); + } + } + + @Test + public final void whenSortingBars_thenBarsWithSortedFoos() { + final String hql = "FROM Bar b ORDER BY b.id"; + final Query query = session.createQuery(hql); + final List barList = query.list(); + for (final Bar bar : barList) { + final Set fooSet = bar.getFooSet(); + System.out.println("Bar Id:" + bar.getId()); + for (final Foo foo : fooSet) { + System.out.println("FooName:" + foo.getName()); + } + } + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java new file mode 100644 index 0000000000..146f8e9622 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServiceBasicPersistenceIntegrationTest.java @@ -0,0 +1,55 @@ +package com.baeldung.persistence.service; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.spring.config.PersistenceTestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) +public class FooServiceBasicPersistenceIntegrationTest { + + @Autowired + private SessionFactory sessionFactory; + + @Autowired + private IFooService fooService; + + private Session session; + + // tests + + @Before + public final void before() { + session = sessionFactory.openSession(); + } + + @After + public final void after() { + session.close(); + } + + // tests + + @Test + public final void whenContextIsBootstrapped_thenNoExceptions() { + // + } + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + fooService.create(new Foo(randomAlphabetic(6))); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java new file mode 100644 index 0000000000..6d426849a6 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java @@ -0,0 +1,64 @@ +package com.baeldung.persistence.service; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.dao.DataAccessException; +import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.dao.InvalidDataAccessApiUsageException; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Foo; +import com.baeldung.spring.config.PersistenceTestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) +public class FooServicePersistenceIntegrationTest { + + @Autowired + @Qualifier("fooHibernateService") + private IFooService service; + + // tests + + @Test + public final void whenContextIsBootstrapped_thenNoExceptions() { + // + } + + @Test + public final void whenEntityIsCreated_thenNoExceptions() { + service.create(new Foo(randomAlphabetic(6))); + } + + @Test(expected = DataIntegrityViolationException.class) + @Ignore("work in progress") + public final void whenInvalidEntityIsCreated_thenDataException() { + service.create(new Foo()); + } + + @Test(expected = DataIntegrityViolationException.class) + public final void whenEntityWithLongNameIsCreated_thenDataException() { + service.create(new Foo(randomAlphabetic(2048))); + } + + @Test(expected = InvalidDataAccessApiUsageException.class) + @Ignore("Right now, persist has saveOrUpdate semantics, so this will no longer fail") + public final void whenSameEntityIsCreatedTwice_thenDataException() { + final Foo entity = new Foo(randomAlphabetic(8)); + service.create(entity); + service.create(entity); + } + + @Test(expected = DataAccessException.class) + public final void temp_whenInvalidEntityIsCreated_thenDataException() { + service.create(new Foo(randomAlphabetic(2048))); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java new file mode 100644 index 0000000000..8bf33c4110 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/FooStoredProceduresLiveTest.java @@ -0,0 +1,121 @@ +package com.baeldung.persistence.service; + +import java.util.List; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.junit.Assert.assertEquals; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.exception.SQLGrammarException; +import org.junit.After; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.config.PersistenceConfig; +import com.baeldung.persistence.model.Foo; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class FooStoredProceduresLiveTest { + + private static final Logger LOGGER = LoggerFactory.getLogger(FooStoredProceduresLiveTest.class); + + @Autowired + private SessionFactory sessionFactory; + + @Autowired + private IFooService fooService; + + private Session session; + + @Before + public final void before() { + session = sessionFactory.openSession(); + Assume.assumeTrue(getAllFoosExists()); + Assume.assumeTrue(getFoosByNameExists()); + } + + private boolean getFoosByNameExists() { + try { + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + sqlQuery.list(); + return true; + } catch (SQLGrammarException e) { + LOGGER.error("WARNING : GetFoosByName() Procedure is may be missing ", e); + return false; + } + } + + private boolean getAllFoosExists() { + try { + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + sqlQuery.list(); + return true; + } catch (SQLGrammarException e) { + LOGGER.error("WARNING : GetAllFoos() Procedure is may be missing ", e); + return false; + } + } + + @After + public final void after() { + session.close(); + } + + @Test + public final void getAllFoosUsingStoredProcedures() { + + fooService.create(new Foo(randomAlphabetic(6))); + + // Stored procedure getAllFoos using createSQLQuery + Query sqlQuery = session.createSQLQuery("CALL GetAllFoos()").addEntity(Foo.class); + @SuppressWarnings("unchecked") + List allFoos = sqlQuery.list(); + for (Foo foo : allFoos) { + LOGGER.info("getAllFoos() SQL Query result : {}", foo.getName()); + } + assertEquals(allFoos.size(), fooService.findAll().size()); + + // Stored procedure getAllFoos using a Named Query + Query namedQuery = session.getNamedQuery("callGetAllFoos"); + @SuppressWarnings("unchecked") + List allFoos2 = namedQuery.list(); + for (Foo foo : allFoos2) { + LOGGER.info("getAllFoos() NamedQuery result : {}", foo.getName()); + } + assertEquals(allFoos2.size(), fooService.findAll().size()); + } + + @Test + public final void getFoosByNameUsingStoredProcedures() { + + fooService.create(new Foo("NewFooName")); + + // Stored procedure getFoosByName using createSQLQuery() + Query sqlQuery = session.createSQLQuery("CALL GetFoosByName(:fooName)").addEntity(Foo.class).setParameter("fooName", "NewFooName"); + @SuppressWarnings("unchecked") + List allFoosByName = sqlQuery.list(); + for (Foo foo : allFoosByName) { + LOGGER.info("getFoosByName() using SQL Query : found => {}", foo.toString()); + } + + // Stored procedure getFoosByName using getNamedQuery() + Query namedQuery = session.getNamedQuery("callGetFoosByName").setParameter("fooName", "NewFooName"); + @SuppressWarnings("unchecked") + List allFoosByName2 = namedQuery.list(); + for (Foo foo : allFoosByName2) { + LOGGER.info("getFoosByName() using Native Query : found => {}", foo.toString()); + } + + } +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java new file mode 100644 index 0000000000..5a73e39ca2 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/persistence/service/ParentServicePersistenceIntegrationTest.java @@ -0,0 +1,70 @@ +package com.baeldung.persistence.service; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.persistence.model.Child; +import com.baeldung.persistence.model.Parent; +import com.baeldung.spring.config.PersistenceTestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceTestConfig.class }, loader = AnnotationConfigContextLoader.class) +public class ParentServicePersistenceIntegrationTest { + + @Autowired + private IParentService service; + + @Autowired + private IChildService childService; + + // tests + + @Test + public final void whenContextIsBootstrapped_thenNoExceptions() { + // + } + + @Test + public final void whenOneToOneEntitiesAreCreated_thenNoExceptions() { + final Child childEntity = new Child(); + childService.create(childEntity); + + final Parent parentEntity = new Parent(childEntity); + service.create(parentEntity); + + System.out.println("Child = " + childService.findOne(childEntity.getId())); + System.out.println("Child - parent = " + childService.findOne(childEntity.getId()).getParent()); + + System.out.println("Parent = " + service.findOne(parentEntity.getId())); + System.out.println("Parent - child = " + service.findOne(parentEntity.getId()).getChild()); + } + + @Test(expected = DataIntegrityViolationException.class) + public final void whenChildIsDeletedWhileParentStillHasForeignKeyToIt_thenDataException() { + final Child childEntity = new Child(); + childService.create(childEntity); + + final Parent parentEntity = new Parent(childEntity); + service.create(parentEntity); + + childService.delete(childEntity); + } + + @Test + public final void whenChildIsDeletedAfterTheParent_thenNoExceptions() { + final Child childEntity = new Child(); + childService.create(childEntity); + + final Parent parentEntity = new Parent(childEntity); + service.create(parentEntity); + + service.delete(parentEntity); + childService.delete(childEntity); + } + +} diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java new file mode 100644 index 0000000000..34301741fe --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/config/PersistenceTestConfig.java @@ -0,0 +1,179 @@ +package com.baeldung.spring.config; + +import java.util.Properties; + +import javax.sql.DataSource; + +import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.orm.hibernate5.HibernateTransactionManager; +import org.springframework.orm.hibernate5.LocalSessionFactoryBean; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.JpaVendorAdapter; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import com.baeldung.persistence.dao.IBarAuditableDao; +import com.baeldung.persistence.dao.IBarDao; +import com.baeldung.persistence.dao.IFooAuditableDao; +import com.baeldung.persistence.dao.IFooDao; +import com.baeldung.persistence.dao.impl.BarAuditableDao; +import com.baeldung.persistence.dao.impl.BarDao; +import com.baeldung.persistence.dao.impl.BarJpaDao; +import com.baeldung.persistence.dao.impl.FooAuditableDao; +import com.baeldung.persistence.dao.impl.FooDao; +import com.baeldung.persistence.service.IBarAuditableService; +import com.baeldung.persistence.service.IBarService; +import com.baeldung.persistence.service.IFooAuditableService; +import com.baeldung.persistence.service.IFooService; +import com.baeldung.persistence.service.impl.BarAuditableService; +import com.baeldung.persistence.service.impl.BarJpaService; +import com.baeldung.persistence.service.impl.BarSpringDataJpaService; +import com.baeldung.persistence.service.impl.FooAuditableService; +import com.baeldung.persistence.service.impl.FooService; +import com.google.common.base.Preconditions; + +@Configuration +@EnableTransactionManagement +@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager", entityManagerFactoryRef = "jpaEntityManager") +@EnableJpaAuditing +@PropertySource({ "classpath:persistence-h2.properties" }) +@ComponentScan({ "com.baeldung.persistence" }) +public class PersistenceTestConfig { + + @Autowired + private Environment env; + + public PersistenceTestConfig() { + super(); + } + + @Bean + public LocalSessionFactoryBean sessionFactory() { + final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); + sessionFactory.setDataSource(restDataSource()); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); + sessionFactory.setHibernateProperties(hibernateProperties()); + + return sessionFactory; + } + + @Bean("jpaEntityManager") + public LocalContainerEntityManagerFactoryBean entityManagerFactory() { + final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); + emf.setDataSource(restDataSource()); + emf.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); + + final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); + emf.setJpaVendorAdapter(vendorAdapter); + emf.setJpaProperties(hibernateProperties()); + + return emf; + } + + @Bean + public DataSource restDataSource() { + final BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); + dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); + dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); + dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); + + return dataSource; + } + + @Bean + public PlatformTransactionManager hibernateTransactionManager() { + final HibernateTransactionManager transactionManager = new HibernateTransactionManager(); + transactionManager.setSessionFactory(sessionFactory().getObject()); + return transactionManager; + } + + @Bean + public PlatformTransactionManager jpaTransactionManager() { + final JpaTransactionManager transactionManager = new JpaTransactionManager(); + transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); + return transactionManager; + } + + @Bean + public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { + return new PersistenceExceptionTranslationPostProcessor(); + } + + @Bean + public IBarService barJpaService() { + return new BarJpaService(); + } + + @Bean + public IBarService barSpringDataJpaService() { + return new BarSpringDataJpaService(); + } + + @Bean + public IFooService fooHibernateService() { + return new FooService(); + } + + @Bean + public IBarAuditableService barHibernateAuditableService() { + return new BarAuditableService(); + } + + @Bean + public IFooAuditableService fooHibernateAuditableService() { + return new FooAuditableService(); + } + + @Bean + public IBarDao barJpaDao() { + return new BarJpaDao(); + } + + @Bean + public IBarDao barHibernateDao() { + return new BarDao(); + } + + @Bean + public IBarAuditableDao barHibernateAuditableDao() { + return new BarAuditableDao(); + } + + @Bean + public IFooDao fooHibernateDao() { + return new FooDao(); + } + + @Bean + public IFooAuditableDao fooHibernateAuditableDao() { + return new FooAuditableDao(); + } + + private final Properties hibernateProperties() { + final Properties hibernateProperties = new Properties(); + hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); + hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect")); + + hibernateProperties.setProperty("hibernate.show_sql", "true"); + // hibernateProperties.setProperty("hibernate.format_sql", "true"); + // hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true"); + + // Envers properties + hibernateProperties.setProperty("org.hibernate.envers.audit_table_suffix", env.getProperty("envers.audit_table_suffix")); + + return hibernateProperties; + } + +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java index 38fd804195..b1158b3dae 100644 --- a/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java +++ b/persistence-modules/spring-data-jpa-query-2/src/test/java/com/baeldung/spring/data/jpa/query/datetime/ArticleRepositoryIntegrationTest.java @@ -6,6 +6,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.spring.data.jpa.query.datetime.Article; +import com.baeldung.spring.data.jpa.query.datetime.ArticleRepository; + import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.List; diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml new file mode 100644 index 0000000000..55a3aeb51c --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetching.cfg.xml @@ -0,0 +1,19 @@ + + + + + + org.h2.Driver + jdbc:h2:mem:testdb + sa + + org.hibernate.dialect.H2Dialect + update + true + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml new file mode 100644 index 0000000000..8fcf578660 --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/resources/fetchingLazy.cfg.xml @@ -0,0 +1,19 @@ + + + + + + org.h2.Driver + jdbc:h2:mem:testdb + sa + + org.hibernate.dialect.H2Dialect + update + true + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/src/test/resources/persistence-h2.properties b/persistence-modules/spring-data-jpa-query-2/src/test/resources/persistence-h2.properties new file mode 100644 index 0000000000..911619193b --- /dev/null +++ b/persistence-modules/spring-data-jpa-query-2/src/test/resources/persistence-h2.properties @@ -0,0 +1,13 @@ +# jdbc.X +jdbc.driverClassName=org.h2.Driver +jdbc.url=jdbc:h2:mem:test +jdbc.user=sa +jdbc.pass= + +# hibernate.X +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.show_sql=false +hibernate.hbm2ddl.auto=create-drop + +# envers.X +envers.audit_table_suffix=_audit_log From 6d9024049e1cdc01f22c77f3d9160cf3d8e0d410 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Mon, 28 Sep 2020 23:18:18 +0530 Subject: [PATCH 0843/1862] JAVA-2432: Added link to existing article --- persistence-modules/spring-hibernate-5/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/persistence-modules/spring-hibernate-5/README.md b/persistence-modules/spring-hibernate-5/README.md index 6d7526a13b..c7506026dd 100644 --- a/persistence-modules/spring-hibernate-5/README.md +++ b/persistence-modules/spring-hibernate-5/README.md @@ -12,4 +12,5 @@ This module contains articles about Hibernate 5 with Spring. - [Hibernate Second-Level Cache](http://www.baeldung.com/hibernate-second-level-cache) - [Deleting Objects with Hibernate](http://www.baeldung.com/delete-with-hibernate) - [Spring, Hibernate and a JNDI Datasource](http://www.baeldung.com/spring-persistence-jpa-jndi-datasource) -- [@Immutable in Hibernate](http://www.baeldung.com/hibernate-immutable) \ No newline at end of file +- [@Immutable in Hibernate](http://www.baeldung.com/hibernate-immutable) +- [Guide to Hibernate 5 with Spring](https://www.baeldung.com/hibernate-4-spring) \ No newline at end of file From 427581b3a64807d552f0cd58d9c858177121840d Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Mon, 28 Sep 2020 23:21:40 +0200 Subject: [PATCH 0844/1862] Code cleanup --- .../componentscanautoconfigure/EmployeeApplication.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java index 108dd1a695..d429b0cdc9 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java @@ -3,7 +3,7 @@ package com.baeldung.annotations.componentscanautoconfigure; import com.baeldung.annotations.componentscanautoconfigure.teacher.Teacher; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.aop.AopAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -11,8 +11,8 @@ import org.springframework.context.annotation.Configuration; @Configuration @ComponentScan(basePackages = {"com.baeldung.annotations.componentscanautoconfigure.doctor", "com.baeldung.annotations.componentscanautoconfigure.employee"}, basePackageClasses = Teacher.class) -@EnableAutoConfiguration(exclude={AopAutoConfiguration.class}) -//@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.aop"}) +@EnableAutoConfiguration(exclude={JdbcTemplateAutoConfiguration.class}) +//@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration"}) public class EmployeeApplication { public static void main(String[] args) { From 42141b88891f3b331435a90957e59892ef49861b Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Tue, 29 Sep 2020 05:30:32 +0200 Subject: [PATCH 0845/1862] BAEL-4520 Getting Started with jOOQ (#10101) Co-authored-by: Krzysztof Majewski --- .../src/main/java/com/baeldung/jooq/Crud.java | 18 +++++----- .../java/com/baeldung/jooq/CrudExamples.java | 34 +++++++++---------- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java index 0427b71c25..fb3d21c467 100644 --- a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/Crud.java @@ -19,14 +19,14 @@ public class Crud { public static Result getAll(DSLContext context, Table table) { return context.select() - .from(table) - .fetch(); + .from(table) + .fetch(); } public static Result getFields(DSLContext context, Table table, SelectFieldOrAsterisk... fields) { return context.select(fields) - .from(table) - .fetch(); + .from(table) + .fetch(); } public static R getOne(DSLContext context, Table table, Condition condition) { @@ -35,9 +35,9 @@ public class Crud { public static void update(DSLContext context, Table table, Map, T> values, Condition condition) { context.update(table) - .set(values) - .where(condition) - .execute(); + .set(values) + .where(condition) + .execute(); } public static > void update(UpdatableRecord record) { @@ -46,8 +46,8 @@ public class Crud { public static void delete(DSLContext context, Table table, Condition condition) { context.delete(table) - .where(condition) - .execute(); + .where(condition) + .execute(); } public static > void delete(UpdatableRecord record) { diff --git a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java index 87a7b6439e..57f6df4915 100644 --- a/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java +++ b/persistence-modules/jooq/src/main/java/com/baeldung/jooq/CrudExamples.java @@ -60,8 +60,8 @@ public class CrudExamples { private void readValues(DSLContext context) { Result authors = getAll( - context, - Author.AUTHOR + context, + Author.AUTHOR ); authors.forEach(author -> { @@ -73,15 +73,15 @@ public class CrudExamples { }); Result articles = getFields( - context, - Author.AUTHOR, - Article.ARTICLE.ID, Article.ARTICLE.TITLE + context, + Author.AUTHOR, + Article.ARTICLE.ID, Article.ARTICLE.TITLE ); AuthorRecord author = getOne( - context, - Author.AUTHOR, - Author.AUTHOR.ID.eq(1) + context, + Author.AUTHOR, + Author.AUTHOR.ID.eq(1) ); } @@ -90,24 +90,22 @@ public class CrudExamples { fieldsToUpdate.put(Author.AUTHOR.FIRST_NAME, "David"); fieldsToUpdate.put(Author.AUTHOR.LAST_NAME, "Brown"); update( - context, - Author.AUTHOR, - fieldsToUpdate, - Author.AUTHOR.ID.eq(1) + context, + Author.AUTHOR, + fieldsToUpdate, + Author.AUTHOR.ID.eq(1) ); ArticleRecord article = context.fetchOne(Article.ARTICLE, Article.ARTICLE.ID.eq(1)); article.setTitle("A New Article Title"); - update( - article - ); + update(article); } private void deleteValues(DSLContext context) { delete( - context, - Article.ARTICLE, - Article.ARTICLE.ID.eq(1) + context, + Article.ARTICLE, + Article.ARTICLE.ID.eq(1) ); AuthorRecord author = context.fetchOne(Author.AUTHOR, Author.AUTHOR.ID.eq(1)); From 154a23d9d968933ba697525457f9ffb3ffbfbec8 Mon Sep 17 00:00:00 2001 From: Krzysztof Majewski Date: Tue, 29 Sep 2020 05:32:37 +0200 Subject: [PATCH 0846/1862] BAEL-3997 (#10102) * BAEL-3997 Verify Working with Date Parameters in Spring app level config * rename properties Co-authored-by: Krzysztof Majewski --- .../com/baeldung/datetime/DateTimeConfig.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java b/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java index 8a5d1c71af..c89b043486 100644 --- a/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java +++ b/spring-mvc-java-2/src/main/java/com/baeldung/datetime/DateTimeConfig.java @@ -2,28 +2,35 @@ package com.baeldung.datetime; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.format.datetime.DateFormatter; +import org.springframework.format.datetime.DateFormatterRegistrar; import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; import org.springframework.format.number.NumberFormatAnnotationFormatterFactory; import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.format.support.FormattingConversionService; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import java.time.format.DateTimeFormatter; @Configuration -class DateTimeConfig { +public class DateTimeConfig extends WebMvcConfigurationSupport { @Bean - public FormattingConversionService conversionService() { + @Override + public FormattingConversionService mvcConversionService() { DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(false); conversionService.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory()); - DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); - registrar.setDateFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy")); - registrar.setDateTimeFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss")); - registrar.registerFormatters(conversionService); + DateTimeFormatterRegistrar dateTimeRegistrar = new DateTimeFormatterRegistrar(); + dateTimeRegistrar.setDateFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy")); + dateTimeRegistrar.setDateTimeFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss")); + dateTimeRegistrar.registerFormatters(conversionService); + + DateFormatterRegistrar dateRegistrar = new DateFormatterRegistrar(); + dateRegistrar.setFormatter(new DateFormatter("dd.MM.yyyy")); + dateRegistrar.registerFormatters(conversionService); return conversionService; } - } \ No newline at end of file From 92bd1bbae6c75938ff8286671b6195a274ccd24a Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 29 Sep 2020 14:54:05 +0200 Subject: [PATCH 0847/1862] BAEL-2626: Update Feign to 10.11 (#10105) --- feign/pom.xml | 20 +------------------ .../feign/clients/BookClientLiveTest.java | 3 --- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/feign/pom.xml b/feign/pom.xml index 4b994be1f2..da3cbcb0fd 100644 --- a/feign/pom.xml +++ b/feign/pom.xml @@ -16,11 +16,6 @@ - - io.github.openfeign - feign-core - ${feign.version} - io.github.openfeign feign-okhttp @@ -44,21 +39,8 @@ - - - - - org.springframework.boot - spring-boot-maven-plugin - ${spring-boot-maven-plugin.version} - - - - - - 9.4.0 - 1.4.2.RELEASE + 10.11 diff --git a/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java b/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java index bee440bd9e..6f6666de32 100644 --- a/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java +++ b/feign/src/test/java/com/baeldung/feign/clients/BookClientLiveTest.java @@ -6,8 +6,6 @@ import com.baeldung.feign.models.BookResource; import lombok.extern.slf4j.Slf4j; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; import java.util.List; import java.util.UUID; @@ -22,7 +20,6 @@ import static org.junit.Assert.assertTrue; * Consumes https://github.com/Baeldung/spring-hypermedia-api */ @Slf4j -@RunWith(JUnit4.class) public class BookClientLiveTest { private BookClient bookClient; From 2f8478db349260fc51b143972b72367af579a3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20G=C5=82=C3=B3wka?= Date: Tue, 29 Sep 2020 19:12:16 +0200 Subject: [PATCH 0848/1862] BAEL-4446: Getting cookies from httpclient response example (#10104) --- .../HttpClientGettingCookieValueUnitTest.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 httpclient-2/src/test/java/com/baeldung/httpclient/cookies/HttpClientGettingCookieValueUnitTest.java diff --git a/httpclient-2/src/test/java/com/baeldung/httpclient/cookies/HttpClientGettingCookieValueUnitTest.java b/httpclient-2/src/test/java/com/baeldung/httpclient/cookies/HttpClientGettingCookieValueUnitTest.java new file mode 100644 index 0000000000..c3b0ef3c25 --- /dev/null +++ b/httpclient-2/src/test/java/com/baeldung/httpclient/cookies/HttpClientGettingCookieValueUnitTest.java @@ -0,0 +1,54 @@ +package com.baeldung.httpclient.cookies; + +import org.apache.http.client.CookieStore; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.cookie.Cookie; +import org.apache.http.impl.client.BasicCookieStore; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.cookie.BasicClientCookie; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; + +import static org.junit.Assert.assertEquals; + + +public class HttpClientGettingCookieValueUnitTest { + private static Logger log = LoggerFactory.getLogger(HttpClientGettingCookieValueUnitTest.class); + + private static final String SAMPLE_URL = "http://www.baeldung.com/"; + + @Test + public final void whenSettingCustomCookieOnTheRequest_thenGettingTheSameCookieFromTheResponse() throws IOException { + HttpClientContext context = HttpClientContext.create(); + context.setAttribute(HttpClientContext.COOKIE_STORE, createCustomCookieStore()); + + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { + try (CloseableHttpResponse response = httpClient.execute(new HttpGet(SAMPLE_URL), context)) { + CookieStore cookieStore = context.getCookieStore(); + Cookie customCookie = cookieStore.getCookies() + .stream() + .peek(cookie -> log.info("cookie name:{}", cookie.getName())) + .filter(cookie -> "custom_cookie".equals(cookie.getName())) + .findFirst() + .orElseThrow(IllegalStateException::new); + + assertEquals("test_value", customCookie.getValue()); + } + } + } + + private BasicCookieStore createCustomCookieStore() { + BasicCookieStore cookieStore = new BasicCookieStore(); + BasicClientCookie cookie = new BasicClientCookie("custom_cookie", "test_value"); + cookie.setDomain("baeldung.com"); + cookie.setPath("/"); + cookieStore.addCookie(cookie); + return cookieStore; + } +} From d7fc3796d79c97104e8e8586a54c9491b69a1655 Mon Sep 17 00:00:00 2001 From: Daniel Taylor Date: Tue, 29 Sep 2020 16:37:05 -0600 Subject: [PATCH 0849/1862] change "Aborted" to "Failed" under testFailed() --- .../extensions/testwatcher/TestResultLoggerExtension.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/extensions/testwatcher/TestResultLoggerExtension.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/extensions/testwatcher/TestResultLoggerExtension.java index a92c44a85b..1cbebd8d48 100644 --- a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/extensions/testwatcher/TestResultLoggerExtension.java +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/extensions/testwatcher/TestResultLoggerExtension.java @@ -46,7 +46,7 @@ public class TestResultLoggerExtension implements TestWatcher, AfterAllCallback @Override public void testFailed(ExtensionContext context, Throwable cause) { - LOG.info("Test Aborted for test {}: ", context.getDisplayName()); + LOG.info("Test Failed for test {}: ", context.getDisplayName()); testResultsStatus.add(TestResultStatus.FAILED); } From fc1964251c6115574ed0f45bf3deb79687b3632c Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Wed, 30 Sep 2020 19:19:44 +0530 Subject: [PATCH 0850/1862] JAVA-2432 Move articles out of spring-hibernate4 Removed legacy hibernate-4-spring article --- persistence-modules/spring-hibernate-5/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/persistence-modules/spring-hibernate-5/README.md b/persistence-modules/spring-hibernate-5/README.md index c7506026dd..cb227592f6 100644 --- a/persistence-modules/spring-hibernate-5/README.md +++ b/persistence-modules/spring-hibernate-5/README.md @@ -13,4 +13,3 @@ This module contains articles about Hibernate 5 with Spring. - [Deleting Objects with Hibernate](http://www.baeldung.com/delete-with-hibernate) - [Spring, Hibernate and a JNDI Datasource](http://www.baeldung.com/spring-persistence-jpa-jndi-datasource) - [@Immutable in Hibernate](http://www.baeldung.com/hibernate-immutable) -- [Guide to Hibernate 5 with Spring](https://www.baeldung.com/hibernate-4-spring) \ No newline at end of file From 5a8f42080742d63dac7d74dae390be440cc89585 Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Wed, 30 Sep 2020 21:08:21 +0530 Subject: [PATCH 0851/1862] BAEL-4075: Validating phone number with libphonenumber (#10111) * BAEL-4075: Validating phone number with libphonenumber * BAEL-4075: Validating phone number with libphonenumber --- libraries-6/pom.xml | 7 ++ .../LibPhoneNumberUnitTest.java | 79 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 libraries-6/src/test/java/com/baeldung/libphonenumber/LibPhoneNumberUnitTest.java diff --git a/libraries-6/pom.xml b/libraries-6/pom.xml index 2f8cc385cb..7bb6028f17 100644 --- a/libraries-6/pom.xml +++ b/libraries-6/pom.xml @@ -107,6 +107,12 @@ renjin-script-engine ${renjin.version} + + + com.googlecode.libphonenumber + libphonenumber + ${libphonenumber.version} + @@ -150,6 +156,7 @@ RELEASE 3.0 1.8.1 + 8.12.9 diff --git a/libraries-6/src/test/java/com/baeldung/libphonenumber/LibPhoneNumberUnitTest.java b/libraries-6/src/test/java/com/baeldung/libphonenumber/LibPhoneNumberUnitTest.java new file mode 100644 index 0000000000..39b96b3e38 --- /dev/null +++ b/libraries-6/src/test/java/com/baeldung/libphonenumber/LibPhoneNumberUnitTest.java @@ -0,0 +1,79 @@ +package com.baeldung.libphonenumber; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.google.i18n.phonenumbers.NumberParseException; +import com.google.i18n.phonenumbers.PhoneNumberUtil; +import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberType; +import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber; +import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber.CountryCodeSource; + +public class LibPhoneNumberUnitTest { + + private static final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance(); + + @Test + public void givenPhoneNumber_whenValid_thenOK() throws Exception { + + PhoneNumber phone = phoneNumberUtil.parse("+911234567890", CountryCodeSource.UNSPECIFIED.name()); + + assertTrue(phoneNumberUtil.isValidNumber(phone)); + assertTrue(phoneNumberUtil.isValidNumberForRegion(phone, "IN")); + assertFalse(phoneNumberUtil.isValidNumberForRegion(phone, "US")); + assertTrue(phoneNumberUtil.isValidNumber(phoneNumberUtil.getExampleNumber("IN"))); + } + + @Test + public void givenPhoneNumber_whenAlphaNumber_thenValid() { + assertTrue(phoneNumberUtil.isAlphaNumber("325-CARS")); + assertTrue(phoneNumberUtil.isAlphaNumber("0800 REPAIR")); + assertTrue(phoneNumberUtil.isAlphaNumber("1-800-MY-APPLE")); + assertTrue(phoneNumberUtil.isAlphaNumber("1-800-MY-APPLE..")); + assertFalse(phoneNumberUtil.isAlphaNumber("+876 1234-1234")); + } + + @Test + public void givenPhoneNumber_whenPossibleForType_thenValid() { + PhoneNumber number = new PhoneNumber(); + number.setCountryCode(54); + + number.setNationalNumber(123456); + assertTrue(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.FIXED_LINE)); + assertFalse(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.TOLL_FREE)); + + number.setNationalNumber(12345678901L); + assertFalse(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.FIXED_LINE)); + assertTrue(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.MOBILE)); + assertFalse(phoneNumberUtil.isPossibleNumberForType(number, PhoneNumberType.TOLL_FREE)); + } + + @Test + public void givenPhoneNumber_whenPossible_thenValid() { + PhoneNumber number = new PhoneNumber(); + number.setCountryCode(1) + .setNationalNumber(123000L); + assertFalse(phoneNumberUtil.isPossibleNumber(number)); + assertFalse(phoneNumberUtil.isPossibleNumber("+1 343 253 00000", "US")); + assertFalse(phoneNumberUtil.isPossibleNumber("(343) 253-00000", "US")); + assertFalse(phoneNumberUtil.isPossibleNumber("dial p for pizza", "US")); + assertFalse(phoneNumberUtil.isPossibleNumber("123-000", "US")); + } + + @Test + public void givenPhoneNumber_whenNumberGeographical_thenValid() throws NumberParseException { + + PhoneNumber phone = phoneNumberUtil.parse("+911234567890", "IN"); + assertTrue(phoneNumberUtil.isNumberGeographical(phone)); + + phone = new PhoneNumber().setCountryCode(1) + .setNationalNumber(2530000L); + assertFalse(phoneNumberUtil.isNumberGeographical(phone)); + + phone = new PhoneNumber().setCountryCode(800) + .setNationalNumber(12345678L); + assertFalse(phoneNumberUtil.isNumberGeographical(phone)); + } +} From cf1b728d3ed87ff964ff0852fb7eed74bfa765cc Mon Sep 17 00:00:00 2001 From: Philippe Date: Wed, 30 Sep 2020 21:47:55 -0300 Subject: [PATCH 0852/1862] [BAEL-4203] JNA --- apache-bookkeeper/data/zk/myid | 1 + {jni => java-native}/README.md | 0 java-native/core | 0 java-native/hs_err_pid100.log | 793 ++++++++++++++++++ java-native/hs_err_pid98.log | 789 +++++++++++++++++ java-native/pom.xml | 39 + .../com_baeldung_jni_ExampleObjectsJNI.cpp | 0 .../cpp/com_baeldung_jni_ExampleObjectsJNI.h | 0 .../com_baeldung_jni_ExampleParametersJNI.cpp | 0 .../com_baeldung_jni_ExampleParametersJNI.h | 0 .../cpp/com_baeldung_jni_HelloWorldJNI.cpp | 0 .../main/cpp/com_baeldung_jni_HelloWorldJNI.h | 0 .../src/main/cpp/generateNativeLib.bat | 0 .../src/main/cpp/generateNativeLib.sh | 0 .../src/main/cpp/generateNativeLibMac.sh | 0 .../src/main/java/com/baeldung/jna/CMath.java | 10 + .../src/main/java/com/baeldung/jna/Main.java | 8 + .../main/java/com/baeldung/jna/NativeFS.java | 46 + .../src/main/java/com/baeldung/jna/StdC.java | 17 + .../com/baeldung/jni/ExampleObjectsJNI.java | 0 .../baeldung/jni/ExampleParametersJNI.java | 0 .../java/com/baeldung/jni/HelloWorldJNI.java | 0 .../main/java/com/baeldung/jni/UserData.java | 0 .../src/main/resources/logback.xml | 0 .../java/com/baeldung/jna/CMathUnitTest.java | 18 + .../com/baeldung/jna/NativeFSUnitTest.java | 38 + .../java/com/baeldung/jna/StdCUnitTest.java | 47 ++ .../com/baeldung/jni/JNINativeManualTest.java | 0 jni/native/linux_x86_64/libnative.so | Bin 19856 -> 0 bytes jni/native/macos/libnative.dylib | Bin 23056 -> 0 bytes jni/pom.xml | 14 - pom.xml | 4 +- 32 files changed, 1808 insertions(+), 16 deletions(-) create mode 100644 apache-bookkeeper/data/zk/myid rename {jni => java-native}/README.md (100%) create mode 100644 java-native/core create mode 100644 java-native/hs_err_pid100.log create mode 100644 java-native/hs_err_pid98.log create mode 100644 java-native/pom.xml rename {jni => java-native}/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h (100%) rename {jni => java-native}/src/main/cpp/generateNativeLib.bat (100%) rename {jni => java-native}/src/main/cpp/generateNativeLib.sh (100%) mode change 100755 => 100644 rename {jni => java-native}/src/main/cpp/generateNativeLibMac.sh (100%) mode change 100755 => 100644 create mode 100644 java-native/src/main/java/com/baeldung/jna/CMath.java create mode 100644 java-native/src/main/java/com/baeldung/jna/Main.java create mode 100644 java-native/src/main/java/com/baeldung/jna/NativeFS.java create mode 100644 java-native/src/main/java/com/baeldung/jna/StdC.java rename {jni => java-native}/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java (100%) rename {jni => java-native}/src/main/java/com/baeldung/jni/ExampleParametersJNI.java (100%) rename {jni => java-native}/src/main/java/com/baeldung/jni/HelloWorldJNI.java (100%) rename {jni => java-native}/src/main/java/com/baeldung/jni/UserData.java (100%) rename {jni => java-native}/src/main/resources/logback.xml (100%) create mode 100644 java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java create mode 100644 java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java create mode 100644 java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java rename {jni => java-native}/src/test/java/com/baeldung/jni/JNINativeManualTest.java (100%) delete mode 100755 jni/native/linux_x86_64/libnative.so delete mode 100755 jni/native/macos/libnative.dylib delete mode 100644 jni/pom.xml diff --git a/apache-bookkeeper/data/zk/myid b/apache-bookkeeper/data/zk/myid new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/apache-bookkeeper/data/zk/myid @@ -0,0 +1 @@ +1 diff --git a/jni/README.md b/java-native/README.md similarity index 100% rename from jni/README.md rename to java-native/README.md diff --git a/java-native/core b/java-native/core new file mode 100644 index 0000000000..e69de29bb2 diff --git a/java-native/hs_err_pid100.log b/java-native/hs_err_pid100.log new file mode 100644 index 0000000000..c05a3fad99 --- /dev/null +++ b/java-native/hs_err_pid100.log @@ -0,0 +1,793 @@ +# +# A fatal error has been detected by the Java Runtime Environment: +# +# SIGSEGV (0xb) at pc=0x00007f7ecd45c090, pid=100, tid=115 +# +# JRE version: OpenJDK Runtime Environment (14.0.2+12) (build 14.0.2+12-46) +# Java VM: OpenJDK 64-Bit Server VM (14.0.2+12-46, mixed mode, sharing, tiered, compressed oops, serial gc, linux-amd64) +# Problematic frame: +# C [libc.so.6+0x15e090] __memset_avx2_unaligned_erms+0x60 +# +# Core dump will be written. Default location: /project/java-native/core +# +# If you would like to submit a bug report, please visit: +# https://bugreport.java.com/bugreport/crash.jsp +# The crash happened outside the Java Virtual Machine in native code. +# See problematic frame for where to report the bug. +# + +--------------- S U M M A R Y ------------ + +Command Line: /project/java-native/target/surefire/surefirebooter15072611568838389395.jar /project/java-native/target/surefire 2020-10-01T00-09-53_430-jvmRun2 surefire3272641396836511080tmp surefire_29468511371192344687tmp + +Host: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz, 1 cores, 1G, Oracle Linux Server release 8.2 +Time: Thu Oct 1 00:10:23 2020 UTC elapsed time: 13 seconds (0d 0h 0m 13s) + +--------------- T H R E A D --------------- + +Current thread (0x00007f7ec4028800): JavaThread "main" [_thread_in_native, id=115, stack(0x00007f7ecde0a000,0x00007f7ecdf0b000)] + +Stack: [0x00007f7ecde0a000,0x00007f7ecdf0b000], sp=0x00007f7ecdf07788, free space=1013k +Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) +C [libc.so.6+0x15e090] __memset_avx2_unaligned_erms+0x60 +j com.sun.jna.Native.setMemory(Lcom/sun/jna/Pointer;JJJB)V+0 +j com.sun.jna.Pointer.setMemory(JJB)V+9 +j com.baeldung.jna.StdCUnitTest.whenAccessViolation_thenShouldThrowError()V+17 +v ~StubRoutines::call_stub +V [libjvm.so+0x78e42b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2fb +V [libjvm.so+0xbb0efb] invoke(InstanceKlass*, methodHandle const&, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*) [clone .constprop.117]+0x85b +V [libjvm.so+0xbb19cd] Reflection::invoke_method(oopDesc*, Handle, objArrayHandle, Thread*)+0xfd +V [libjvm.so+0x83b8e3] JVM_InvokeMethod+0xf3 +j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.2 +j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.2 +j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.2 +j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.2 +j org.junit.platform.commons.util.ReflectionUtils.invokeMethod(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+41 +j org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/extension/ExtensionRegistry;)Ljava/lang/Object;+32 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;)V+24 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$232.execute()V+12 +j org.junit.jupiter.engine.execution.ThrowableCollector.execute(Lorg/junit/jupiter/api/function/Executable;)V+1 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)V+21 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;+44 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;+6 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+35 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 +j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 +j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 +j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 +j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 +j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 +j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 +j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 +j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 +j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 +j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 +j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 +j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 +j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 +j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 +j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 +j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute()V+23 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(Lorg/junit/platform/engine/ExecutionRequest;)V+13 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/engine/TestEngine;Lorg/junit/platform/engine/ExecutionRequest;)V+2 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/core/Root;Lorg/junit/platform/engine/ConfigurationParameters;[Lorg/junit/platform/launcher/TestExecutionListener;)V+101 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;[Lorg/junit/platform/launcher/TestExecutionListener;)V+36 +j org.junit.platform.surefire.provider.JUnitPlatformProvider.invokeAllTests(Lorg/apache/maven/surefire/util/TestsToRun;)Lorg/apache/maven/surefire/suite/RunResult;+55 +j org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(Ljava/lang/Object;)Lorg/apache/maven/surefire/suite/RunResult;+31 +j org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(Lorg/apache/maven/surefire/booter/ForkingReporterFactory;)Lorg/apache/maven/surefire/suite/RunResult;+9 +j org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess()Lorg/apache/maven/surefire/suite/RunResult;+7 +j org.apache.maven.surefire.booter.ForkedBooter.execute()V+1 +j org.apache.maven.surefire.booter.ForkedBooter.main([Ljava/lang/String;)V+35 +v ~StubRoutines::call_stub +V [libjvm.so+0x78e42b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2fb +V [libjvm.so+0x80d2e3] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.125] [clone .constprop.264]+0x193 +V [libjvm.so+0x80f338] jni_CallStaticVoidMethod+0x108 +C [libjli.so+0x4647] JavaMain+0xcd7 +C [libjli.so+0x85a9] ThreadJavaMain+0x9 + +Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) +j com.sun.jna.Native.setMemory(Lcom/sun/jna/Pointer;JJJB)V+0 +j com.sun.jna.Pointer.setMemory(JJB)V+9 +j com.baeldung.jna.StdCUnitTest.whenAccessViolation_thenShouldThrowError()V+17 +v ~StubRoutines::call_stub +j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.2 +j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.2 +j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.2 +j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.2 +j org.junit.platform.commons.util.ReflectionUtils.invokeMethod(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+41 +j org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/extension/ExtensionRegistry;)Ljava/lang/Object;+32 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;)V+24 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$232.execute()V+12 +j org.junit.jupiter.engine.execution.ThrowableCollector.execute(Lorg/junit/jupiter/api/function/Executable;)V+1 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)V+21 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;+44 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;+6 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+35 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 +j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 +j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 +j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 +j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 +j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 +j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 +j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 +j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 +j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 +j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 +j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 +j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 +j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 +j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 +j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 +j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute()V+23 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(Lorg/junit/platform/engine/ExecutionRequest;)V+13 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/engine/TestEngine;Lorg/junit/platform/engine/ExecutionRequest;)V+2 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/core/Root;Lorg/junit/platform/engine/ConfigurationParameters;[Lorg/junit/platform/launcher/TestExecutionListener;)V+101 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;[Lorg/junit/platform/launcher/TestExecutionListener;)V+36 +j org.junit.platform.surefire.provider.JUnitPlatformProvider.invokeAllTests(Lorg/apache/maven/surefire/util/TestsToRun;)Lorg/apache/maven/surefire/suite/RunResult;+55 +j org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(Ljava/lang/Object;)Lorg/apache/maven/surefire/suite/RunResult;+31 +j org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(Lorg/apache/maven/surefire/booter/ForkingReporterFactory;)Lorg/apache/maven/surefire/suite/RunResult;+9 +j org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess()Lorg/apache/maven/surefire/suite/RunResult;+7 +j org.apache.maven.surefire.booter.ForkedBooter.execute()V+1 +j org.apache.maven.surefire.booter.ForkedBooter.main([Ljava/lang/String;)V+35 +v ~StubRoutines::call_stub + +siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000 + +Register to memory mapping: + +RAX=0x0 is NULL +RBX={method} {0x00007f7ecb469628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' +RCX=0x0000000000000080 is an unknown value +RDX=0x0000000000019000 is an unknown value +RSP=0x00007f7ecdf07788 is pointing into the stack for thread: 0x00007f7ec4028800 +RBP=0x00007f7ecdf077c0 is pointing into the stack for thread: 0x00007f7ec4028800 +RSI=0x0 is NULL +RDI=0x0 is NULL +R8 =0x0 is NULL +R9 =0x0000000000019000 is an unknown value +R10=0x0000000000000009 is an unknown value +R11=0x00007f7ecd45bfd0: in /lib64/libc.so.6 at 0x00007f7ecd2fe000 +R12=0x0 is NULL +R13={method} {0x00007f7ecb469628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' +R14=0x00007f7ecdf078b8 is pointing into the stack for thread: 0x00007f7ec4028800 +R15=0x00007f7ec4028800 is a thread + + +Registers: +RAX=0x0000000000000000, RBX=0x00007f7ecb469628, RCX=0x0000000000000080, RDX=0x0000000000019000 +RSP=0x00007f7ecdf07788, RBP=0x00007f7ecdf077c0, RSI=0x0000000000000000, RDI=0x0000000000000000 +R8 =0x0000000000000000, R9 =0x0000000000019000, R10=0x0000000000000009, R11=0x00007f7ecd45bfd0 +R12=0x0000000000000000, R13=0x00007f7ecb469628, R14=0x00007f7ecdf078b8, R15=0x00007f7ec4028800 +RIP=0x00007f7ecd45c090, EFLAGS=0x0000000000010202, CSGSFS=0x002b000000000033, ERR=0x0000000000000006 + TRAPNO=0x000000000000000e + +Top of Stack: (sp=0x00007f7ecdf07788) +0x00007f7ecdf07788: 00007f7ec9756e8d 00007f7ecb469628 +0x00007f7ecdf07798: 00007f7ec4028b10 0000000000000000 +0x00007f7ecdf077a8: 0000000000019000 0000000000000000 +0x00007f7ecdf077b8: 0000000000000000 00007f7ecdf07860 + +Instructions: (pc=0x00007f7ecd45c090) +0x00007f7ecd45bf90: f3 0f 1e fa 48 39 d1 0f 82 53 d9 fa ff 0f 1f 00 +0x00007f7ecd45bfa0: f3 0f 1e fa 48 c1 e2 02 c5 f9 6e c6 48 89 f8 c4 +0x00007f7ecd45bfb0: e2 7d 58 c0 eb 2a 66 2e 0f 1f 84 00 00 00 00 00 +0x00007f7ecd45bfc0: f3 0f 1e fa 48 39 d1 0f 82 23 d9 fa ff 0f 1f 00 +0x00007f7ecd45bfd0: f3 0f 1e fa c5 f9 6e c6 48 89 f8 c4 e2 7d 78 c0 +0x00007f7ecd45bfe0: 48 83 fa 20 0f 82 04 01 00 00 48 83 fa 40 77 77 +0x00007f7ecd45bff0: c5 fe 7f 44 17 e0 c5 fe 7f 07 c5 f8 77 c3 66 90 +0x00007f7ecd45c000: f3 0f 1e fa c5 f8 77 48 89 d1 40 0f b6 c6 48 89 +0x00007f7ecd45c010: fa f3 aa 48 89 d0 c3 66 0f 1f 84 00 00 00 00 00 +0x00007f7ecd45c020: f3 0f 1e fa 48 39 d1 0f 82 c3 d8 fa ff 0f 1f 00 +0x00007f7ecd45c030: f3 0f 1e fa c5 f9 6e c6 48 89 f8 c4 e2 7d 78 c0 +0x00007f7ecd45c040: 48 83 fa 20 0f 82 a4 00 00 00 48 83 fa 40 77 0e +0x00007f7ecd45c050: c5 fe 7f 44 17 e0 c5 fe 7f 07 c5 f8 77 c3 48 81 +0x00007f7ecd45c060: fa 00 08 00 00 77 9d 48 81 fa 80 00 00 00 77 19 +0x00007f7ecd45c070: c5 fe 7f 07 c5 fe 7f 47 20 c5 fe 7f 44 17 e0 c5 +0x00007f7ecd45c080: fe 7f 44 17 c0 c5 f8 77 c3 48 8d 8f 80 00 00 00 +0x00007f7ecd45c090: c5 fe 7f 07 48 83 e1 80 c5 fe 7f 44 17 e0 c5 fe +0x00007f7ecd45c0a0: 7f 47 20 c5 fe 7f 44 17 c0 c5 fe 7f 47 40 c5 fe +0x00007f7ecd45c0b0: 7f 44 17 a0 c5 fe 7f 47 60 c5 fe 7f 44 17 80 48 +0x00007f7ecd45c0c0: 01 fa 48 83 e2 80 48 39 d1 74 ba c5 fd 7f 01 c5 +0x00007f7ecd45c0d0: fd 7f 41 20 c5 fd 7f 41 40 c5 fd 7f 41 60 48 81 +0x00007f7ecd45c0e0: c1 80 00 00 00 48 39 ca 75 e1 c5 f8 77 c3 80 fa +0x00007f7ecd45c0f0: 10 73 1c c4 e1 f9 7e c1 80 fa 08 73 20 80 fa 04 +0x00007f7ecd45c100: 73 27 80 fa 01 77 2c 72 02 88 0f c5 f8 77 c3 c5 +0x00007f7ecd45c110: fa 7f 44 17 f0 c5 fa 7f 07 c5 f8 77 c3 48 89 4c +0x00007f7ecd45c120: 17 f8 48 89 0f c5 f8 77 c3 89 4c 17 fc 89 0f c5 +0x00007f7ecd45c130: f8 77 c3 66 89 4c 17 fe 66 89 0f c5 f8 77 c3 90 +0x00007f7ecd45c140: f3 0f 1e fa 48 c1 e2 02 48 83 fa 20 0f 82 3e 01 +0x00007f7ecd45c150: 00 00 c5 fe 6f 16 c5 ed 76 17 c5 fd d7 c2 83 e8 +0x00007f7ecd45c160: ff 0f 85 e9 00 00 00 48 83 fa 40 0f 86 c0 00 00 +0x00007f7ecd45c170: 00 c5 fd 76 c0 48 81 fa 00 01 00 00 0f 87 9e 01 +0x00007f7ecd45c180: 00 00 48 81 fa 80 00 00 00 0f 82 28 02 00 00 c5 + + +Stack slot to memory mapping: +stack at sp + 0 slots: 0x00007f7ec9756e8d: Java_com_sun_jna_Native_setMemory+0x00000000000000bd in /root/.cache/JNA/temp/jna17886832672380520920.tmp at 0x00007f7ec9750000 +stack at sp + 1 slots: {method} {0x00007f7ecb469628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' +stack at sp + 2 slots: 0x00007f7ec4028b10 points into unknown readable memory: 80 b8 24 cd 7e 7f 00 00 +stack at sp + 3 slots: 0x0 is NULL +stack at sp + 4 slots: 0x0000000000019000 is an unknown value +stack at sp + 5 slots: 0x0 is NULL +stack at sp + 6 slots: 0x0 is NULL +stack at sp + 7 slots: 0x00007f7ecdf07860 is pointing into the stack for thread: 0x00007f7ec4028800 + + +--------------- P R O C E S S --------------- + +Threads class SMR info: +_java_thread_list=0x00007f7ec41c0640, length=12, elements={ +0x00007f7ec4028800, 0x00007f7ec40a2000, 0x00007f7ec40a3800, 0x00007f7ec40ad000, +0x00007f7ec40af000, 0x00007f7ec40b1000, 0x00007f7ec40b3000, 0x00007f7ec40b5000, +0x00007f7ec40ef800, 0x00007f7ec40f4800, 0x00007f7ec4188000, 0x00007f7ec41bf000 +} + +Java Threads: ( => current thread ) +=>0x00007f7ec4028800 JavaThread "main" [_thread_in_native, id=115, stack(0x00007f7ecde0a000,0x00007f7ecdf0b000)] + 0x00007f7ec40a2000 JavaThread "Reference Handler" daemon [_thread_blocked, id=121, stack(0x00007f7ecab9d000,0x00007f7ecac9e000)] + 0x00007f7ec40a3800 JavaThread "Finalizer" daemon [_thread_blocked, id=124, stack(0x00007f7ecaa9c000,0x00007f7ecab9d000)] + 0x00007f7ec40ad000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=125, stack(0x00007f7eca2a7000,0x00007f7eca3a8000)] + 0x00007f7ec40af000 JavaThread "Service Thread" daemon [_thread_blocked, id=128, stack(0x00007f7eca1a6000,0x00007f7eca2a7000)] + 0x00007f7ec40b1000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=132, stack(0x00007f7eca0a5000,0x00007f7eca1a6000)] + 0x00007f7ec40b3000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=135, stack(0x00007f7ec9fa4000,0x00007f7eca0a5000)] + 0x00007f7ec40b5000 JavaThread "Sweeper thread" daemon [_thread_blocked, id=137, stack(0x00007f7ec9ea3000,0x00007f7ec9fa4000)] + 0x00007f7ec40ef800 JavaThread "Notification Thread" daemon [_thread_blocked, id=146, stack(0x00007f7ec9da2000,0x00007f7ec9ea3000)] + 0x00007f7ec40f4800 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=148, stack(0x00007f7ec9b9f000,0x00007f7ec9ca0000)] + 0x00007f7ec4188000 JavaThread "surefire-forkedjvm-command-thread" daemon [_thread_in_native, id=151, stack(0x00007f7ec9a87000,0x00007f7ec9b88000)] + 0x00007f7ec41bf000 JavaThread "surefire-forkedjvm-ping-30s" daemon [_thread_blocked, id=154, stack(0x00007f7ec9979000,0x00007f7ec9a7a000)] + +Other Threads: + 0x00007f7ec409e800 VMThread "VM Thread" [stack: 0x00007f7ecaca0000,0x00007f7ecada0000] [id=118] + 0x00007f7ec40f2000 WatcherThread [stack: 0x00007f7ec9ca2000,0x00007f7ec9da2000] [id=147] + +Threads with active compile tasks: + +VM state:not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +Heap address: 0x00000000e0c00000, size: 500 MB, Compressed Oops mode: 32-bit +Narrow klass base: 0x0000000800000000, Narrow klass shift: 3 +Compressed class space size: 1073741824 Address: 0x0000000800b11000 + +Heap: + def new generation total 9792K, used 7588K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) + eden space 8704K, 74% used [0x00000000e0c00000, 0x00000000e1259340, 0x00000000e1480000) + from space 1088K, 100% used [0x00000000e1590000, 0x00000000e16a0000, 0x00000000e16a0000) + to space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) + tenured generation total 21888K, used 1321K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) + the space 21888K, 6% used [0x00000000eb2a0000, 0x00000000eb3ea620, 0x00000000eb3ea800, 0x00000000ec800000) + Metaspace used 4998K, capacity 7071K, committed 7296K, reserved 1056768K + class space used 637K, capacity 881K, committed 896K, reserved 1048576K + +Card table byte_map: [0x00007f7ecb723000,0x00007f7ecb81e000] _byte_map_base: 0x00007f7ecb01d000 + +Polling page: 0x00007f7ecdf20000 + +Metaspace: + +Usage: + Non-class: 6.04 MB capacity, 4.26 MB ( 70%) used, 1.76 MB ( 29%) free+waste, 30.81 KB ( <1%) overhead. + Class: 881.00 KB capacity, 637.46 KB ( 72%) used, 226.48 KB ( 26%) free+waste, 17.06 KB ( 2%) overhead. + Both: 6.91 MB capacity, 4.88 MB ( 71%) used, 1.98 MB ( 29%) free+waste, 47.88 KB ( <1%) overhead. + +Virtual space: + Non-class space: 8.00 MB reserved, 6.25 MB ( 78%) committed + Class space: 1.00 GB reserved, 896.00 KB ( <1%) committed + Both: 1.01 GB reserved, 7.12 MB ( <1%) committed + +Chunk freelists: + Non-Class: 34.00 KB + Class: 11.00 KB + Both: 45.00 KB + +MaxMetaspaceSize: unlimited +CompressedClassSpaceSize: 1.00 GB + +CodeHeap 'non-profiled nmethods': size=120036Kb used=272Kb max_used=272Kb free=119763Kb + bounds [0x00007f7eb419c000, 0x00007f7eb440c000, 0x00007f7ebb6d5000] +CodeHeap 'profiled nmethods': size=120032Kb used=1610Kb max_used=1610Kb free=118421Kb + bounds [0x00007f7eacc64000, 0x00007f7eaced4000, 0x00007f7eb419c000] +CodeHeap 'non-nmethods': size=5692Kb used=1155Kb max_used=1170Kb free=4536Kb + bounds [0x00007f7eac6d5000, 0x00007f7eac945000, 0x00007f7eacc64000] + total_blobs=1295 nmethods=879 adapters=332 + compilation: enabled + stopped_count=0, restarted_count=0 + full_count=0 + +Compilation events (20 events): +Event: 12.944 Thread 0x00007f7ec40b3000 876 ! 3 jdk.internal.loader.BuiltinClassLoader::findClassOnClassPathOrNull (64 bytes) +Event: 12.955 Thread 0x00007f7ec40b3000 nmethod 876 0x00007f7eacdf1a90 code [0x00007f7eacdf1e00, 0x00007f7eacdf3260] +Event: 12.963 Thread 0x00007f7ec40b3000 877 ! 3 java.util.zip.ZipFile$ZipFileInflaterInputStream::close (67 bytes) +Event: 12.969 Thread 0x00007f7ec40b3000 nmethod 877 0x00007f7eacdf3a90 code [0x00007f7eacdf3c80, 0x00007f7eacdf4390] +Event: 12.969 Thread 0x00007f7ec40b3000 878 3 java.util.ArrayDeque::add (7 bytes) +Event: 12.969 Thread 0x00007f7ec40b3000 nmethod 878 0x00007f7eacdf4690 code [0x00007f7eacdf4820, 0x00007f7eacdf4980] +Event: 12.969 Thread 0x00007f7ec40b3000 879 3 java.util.ArrayDeque::addLast (51 bytes) +Event: 12.974 Thread 0x00007f7ec40b3000 nmethod 879 0x00007f7eacdf4a10 code [0x00007f7eacdf4be0, 0x00007f7eacdf5090] +Event: 12.982 Thread 0x00007f7ec40b3000 880 3 java.util.zip.ZipFile$InflaterCleanupAction::run (12 bytes) +Event: 12.982 Thread 0x00007f7ec40b3000 nmethod 880 0x00007f7eacdf5210 code [0x00007f7eacdf53a0, 0x00007f7eacdf5500] +Event: 12.982 Thread 0x00007f7ec40b3000 881 ! 3 java.util.zip.ZipFile$CleanableResource::releaseInflater (53 bytes) +Event: 12.986 Thread 0x00007f7ec40b3000 nmethod 881 0x00007f7eacdf5610 code [0x00007f7eacdf57e0, 0x00007f7eacdf5d00] +Event: 12.986 Thread 0x00007f7ec40b3000 882 ! 3 java.util.zip.Inflater::reset (64 bytes) +Event: 12.991 Thread 0x00007f7ec40b3000 nmethod 882 0x00007f7eacdf5f10 code [0x00007f7eacdf60c0, 0x00007f7eacdf64b0] +Event: 12.993 Thread 0x00007f7ec40b1000 884 4 java.lang.Object:: (1 bytes) +Event: 12.995 Thread 0x00007f7ec40b1000 nmethod 884 0x00007f7eb41dfd90 code [0x00007f7eb41dff00, 0x00007f7eb41dffb8] +Event: 13.004 Thread 0x00007f7ec40b3000 885 3 sun.net.www.protocol.jar.Handler::checkNestedProtocol (18 bytes) +Event: 13.005 Thread 0x00007f7ec40b3000 nmethod 885 0x00007f7eacdf6690 code [0x00007f7eacdf6840, 0x00007f7eacdf6a20] +Event: 13.116 Thread 0x00007f7ec40b1000 886 4 java.lang.Math::min (11 bytes) +Event: 13.117 Thread 0x00007f7ec40b1000 nmethod 886 0x00007f7eb41e0090 code [0x00007f7eb41e0200, 0x00007f7eb41e0258] + +GC Heap History (2 events): +Event: 7.487 GC heap before +{Heap before GC invocations=0 (full 0): + def new generation total 9792K, used 8704K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) + eden space 8704K, 100% used [0x00000000e0c00000, 0x00000000e1480000, 0x00000000e1480000) + from space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) + to space 1088K, 0% used [0x00000000e1590000, 0x00000000e1590000, 0x00000000e16a0000) + tenured generation total 21888K, used 0K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) + the space 21888K, 0% used [0x00000000eb2a0000, 0x00000000eb2a0000, 0x00000000eb2a0200, 0x00000000ec800000) + Metaspace used 3048K, capacity 5805K, committed 6016K, reserved 1056768K + class space used 360K, capacity 627K, committed 640K, reserved 1048576K +} +Event: 7.606 GC heap after +{Heap after GC invocations=1 (full 0): + def new generation total 9792K, used 1088K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) + eden space 8704K, 0% used [0x00000000e0c00000, 0x00000000e0c00000, 0x00000000e1480000) + from space 1088K, 100% used [0x00000000e1590000, 0x00000000e16a0000, 0x00000000e16a0000) + to space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) + tenured generation total 21888K, used 1321K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) + the space 21888K, 6% used [0x00000000eb2a0000, 0x00000000eb3ea620, 0x00000000eb3ea800, 0x00000000ec800000) + Metaspace used 3048K, capacity 5805K, committed 6016K, reserved 1056768K + class space used 360K, capacity 627K, committed 640K, reserved 1048576K +} + +Deoptimization events (20 events): +Event: 1.087 Thread 0x00007f7ec4028800 Uncommon trap: trap_request=0xffffff45 fr.pc=0x00007f7eb41a0990 relative=0x00000000000001d0 +Event: 1.087 Thread 0x00007f7ec4028800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00007f7eb41a0990 method=java.lang.String.hashCode()I @ 42 c2 +Event: 1.087 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eb41a0990 sp=0x00007f7ecdf08320 +Event: 1.087 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71de25 sp=0x00007f7ecdf082d8 mode 2 +Event: 3.662 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eaccb7d84 sp=0x00007f7ecdf08350 +Event: 3.662 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf077e0 mode 0 +Event: 4.371 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eaccc4422 sp=0x00007f7ecdf044a0 +Event: 4.371 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf03928 mode 0 +Event: 4.510 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eacc890af sp=0x00007f7ecdf081b0 +Event: 4.510 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf07658 mode 0 +Event: 5.564 Thread 0x00007f7ec4028800 Uncommon trap: trap_request=0xffffff45 fr.pc=0x00007f7eb41a88e8 relative=0x0000000000000068 +Event: 5.564 Thread 0x00007f7ec4028800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00007f7eb41a88e8 method=java.lang.String.isLatin1()Z @ 10 c2 +Event: 5.564 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eb41a88e8 sp=0x00007f7ecdf088d0 +Event: 5.564 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71de25 sp=0x00007f7ecdf08880 mode 2 +Event: 6.331 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eacccd5e8 sp=0x00007f7ecdf08580 +Event: 6.331 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf079f0 mode 0 +Event: 6.941 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eacccd5e8 sp=0x00007f7ecdf07660 +Event: 6.941 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf06af8 mode 0 +Event: 12.327 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eaccc95c5 sp=0x00007f7ecdf06910 +Event: 12.327 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf05d90 mode 0 + +Classes unloaded (0 events): +No events + +Classes redefined (0 events): +No events + +Internal exceptions (17 events): +Event: 2.190 Thread 0x00007f7ec4028800 Exception (0x00000000e0dc5a48) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 5.245 Thread 0x00007f7ec4028800 Exception (0x00000000e12092c8) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 5.649 Thread 0x00007f7ec4028800 Exception (0x00000000e1280798) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.015 Thread 0x00007f7ec4028800 Exception (0x00000000e12d47e0) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.382 Thread 0x00007f7ec4028800 Exception (0x00000000e1346640) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.595 Thread 0x00007f7ec4028800 Exception (0x00000000e137b378) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.672 Thread 0x00007f7ec4028800 Exception (0x00000000e139ef70) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.707 Thread 0x00007f7ec4028800 Exception (0x00000000e13a9150) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.739 Thread 0x00007f7ec4028800 Exception (0x00000000e13b6dd8) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 832] +Event: 6.925 Thread 0x00007f7ec4028800 Exception (0x00000000e13ec548) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 7.737 Thread 0x00007f7ec4028800 Exception (0x00000000e0c25148) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 7.990 Thread 0x00007f7ec4028800 Exception (0x00000000e0c900c0) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 8.395 Thread 0x00007f7ec4028800 Exception (0x00000000e0cfd370) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 8.486 Thread 0x00007f7ec4028800 Exception (0x00000000e0d15688) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 8.487 Thread 0x00007f7ec4028800 Exception (0x00000000e0d18078) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 832] +Event: 10.634 Thread 0x00007f7ec4028800 Exception (0x00000000e0f88b50) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 10.647 Thread 0x00007f7ec4028800 Exception (0x00000000e0f8c210) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] + +Events (20 events): +Event: 12.778 loading class sun/security/provider/ByteArrayAccess +Event: 12.778 loading class sun/security/provider/ByteArrayAccess done +Event: 12.784 loading class java/io/DeleteOnExitHook +Event: 12.786 loading class java/io/DeleteOnExitHook done +Event: 12.786 loading class java/io/DeleteOnExitHook$1 +Event: 12.786 loading class java/io/DeleteOnExitHook$1 done +Event: 12.815 loading class java/io/FileOutputStream$1 +Event: 12.815 loading class java/io/FileOutputStream$1 done +Event: 12.822 Loaded shared library /root/.cache/JNA/temp/jna17886832672380520920.tmp +Event: 12.822 loading class java/nio/ShortBuffer +Event: 12.822 loading class java/nio/ShortBuffer done +Event: 12.822 loading class java/nio/FloatBuffer +Event: 12.834 loading class java/nio/FloatBuffer done +Event: 12.834 loading class java/nio/DoubleBuffer +Event: 12.835 loading class java/nio/DoubleBuffer done +Event: 12.922 Executing VM operation: HandshakeAllThreads +Event: 12.925 Executing VM operation: HandshakeAllThreads done +Event: 12.980 Loaded shared library /usr/java/openjdk-14/lib/libzip.so +Event: 13.028 Executing VM operation: HandshakeAllThreads +Event: 13.036 Executing VM operation: HandshakeAllThreads done + + +Dynamic libraries: +e0c00000-e16a0000 rw-p 00000000 00:00 0 +e16a0000-eb2a0000 ---p 00000000 00:00 0 +eb2a0000-ec800000 rw-p 00000000 00:00 0 +ec800000-100000000 ---p 00000000 00:00 0 +800000000-800003000 rwxp 00001000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa +800003000-8003e4000 rw-p 00004000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa +8003e4000-800b10000 r--p 003e5000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa +800b10000-800b11000 rw-p 00b11000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa +800b11000-800bf1000 rw-p 00000000 00:00 0 +800bf1000-840b11000 ---p 00000000 00:00 0 +55a64bfce000-55a64bfcf000 r-xp 00000000 08:01 3160482 /usr/java/openjdk-14/bin/java +55a64bfd0000-55a64bfd1000 r--p 00001000 08:01 3160482 /usr/java/openjdk-14/bin/java +55a64bfd1000-55a64bfd2000 rw-p 00002000 08:01 3160482 /usr/java/openjdk-14/bin/java +55a64c580000-55a64c5a1000 rw-p 00000000 00:00 0 [heap] +7f7e90000000-7f7e90288000 rw-p 00000000 00:00 0 +7f7e90288000-7f7e94000000 ---p 00000000 00:00 0 +7f7e94000000-7f7e94427000 rw-p 00000000 00:00 0 +7f7e94427000-7f7e98000000 ---p 00000000 00:00 0 +7f7e98000000-7f7e98021000 rw-p 00000000 00:00 0 +7f7e98021000-7f7e9c000000 ---p 00000000 00:00 0 +7f7e9c000000-7f7e9c021000 rw-p 00000000 00:00 0 +7f7e9c021000-7f7ea0000000 ---p 00000000 00:00 0 +7f7ea0000000-7f7ea0021000 rw-p 00000000 00:00 0 +7f7ea0021000-7f7ea4000000 ---p 00000000 00:00 0 +7f7ea4000000-7f7ea4021000 rw-p 00000000 00:00 0 +7f7ea4021000-7f7ea8000000 ---p 00000000 00:00 0 +7f7ea8000000-7f7ea8021000 rw-p 00000000 00:00 0 +7f7ea8021000-7f7eac000000 ---p 00000000 00:00 0 +7f7eac6d5000-7f7eac945000 rwxp 00000000 00:00 0 +7f7eac945000-7f7eacc64000 ---p 00000000 00:00 0 +7f7eacc64000-7f7eaced4000 rwxp 00000000 00:00 0 +7f7eaced4000-7f7eb419c000 ---p 00000000 00:00 0 +7f7eb419c000-7f7eb440c000 rwxp 00000000 00:00 0 +7f7eb440c000-7f7ebb6d5000 ---p 00000000 00:00 0 +7f7ebb6d5000-7f7ec4000000 r--s 00000000 08:01 3160985 /usr/java/openjdk-14/lib/modules +7f7ec4000000-7f7ec44c4000 rw-p 00000000 00:00 0 +7f7ec44c4000-7f7ec8000000 ---p 00000000 00:00 0 +7f7ec9292000-7f7ec9750000 rw-p 00000000 00:00 0 +7f7ec9750000-7f7ec9768000 r-xp 00000000 08:01 3163771 /root/.cache/JNA/temp/jna17886832672380520920.tmp (deleted) +7f7ec9768000-7f7ec9968000 ---p 00018000 08:01 3163771 /root/.cache/JNA/temp/jna17886832672380520920.tmp (deleted) +7f7ec9968000-7f7ec9969000 rw-p 00018000 08:01 3163771 /root/.cache/JNA/temp/jna17886832672380520920.tmp (deleted) +7f7ec9969000-7f7ec9976000 r-xp 00000000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so +7f7ec9976000-7f7ec9978000 r--p 0000c000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so +7f7ec9978000-7f7ec9979000 rw-p 0000e000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so +7f7ec9979000-7f7ec997d000 ---p 00000000 00:00 0 +7f7ec997d000-7f7ec9a7a000 rw-p 00000000 00:00 0 +7f7ec9a7a000-7f7ec9a7f000 r-xp 00000000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so +7f7ec9a7f000-7f7ec9a80000 r--p 00004000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so +7f7ec9a80000-7f7ec9a81000 rw-p 00005000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so +7f7ec9a81000-7f7ec9a85000 r-xp 00000000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so +7f7ec9a85000-7f7ec9a86000 r--p 00003000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so +7f7ec9a86000-7f7ec9a87000 rw-p 00004000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so +7f7ec9a87000-7f7ec9a8b000 ---p 00000000 00:00 0 +7f7ec9a8b000-7f7ec9b88000 rw-p 00000000 00:00 0 +7f7ec9b88000-7f7ec9b9d000 r-xp 00000000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so +7f7ec9b9d000-7f7ec9b9e000 r--p 00014000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so +7f7ec9b9e000-7f7ec9b9f000 rw-p 00015000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so +7f7ec9b9f000-7f7ec9ba3000 ---p 00000000 00:00 0 +7f7ec9ba3000-7f7ec9ca0000 rw-p 00000000 00:00 0 +7f7ec9ca0000-7f7ec9ca1000 ---p 00000000 00:00 0 +7f7ec9ca1000-7f7ec9da2000 rw-p 00000000 00:00 0 +7f7ec9da2000-7f7ec9da6000 ---p 00000000 00:00 0 +7f7ec9da6000-7f7ec9ea3000 rw-p 00000000 00:00 0 +7f7ec9ea3000-7f7ec9ea7000 ---p 00000000 00:00 0 +7f7ec9ea7000-7f7ec9fa4000 rw-p 00000000 00:00 0 +7f7ec9fa4000-7f7ec9fa8000 ---p 00000000 00:00 0 +7f7ec9fa8000-7f7eca0a5000 rw-p 00000000 00:00 0 +7f7eca0a5000-7f7eca0a9000 ---p 00000000 00:00 0 +7f7eca0a9000-7f7eca1a6000 rw-p 00000000 00:00 0 +7f7eca1a6000-7f7eca1aa000 ---p 00000000 00:00 0 +7f7eca1aa000-7f7eca2a7000 rw-p 00000000 00:00 0 +7f7eca2a7000-7f7eca2ab000 ---p 00000000 00:00 0 +7f7eca2ab000-7f7eca3a8000 rw-p 00000000 00:00 0 +7f7eca3a8000-7f7eca3fb000 r--p 00000000 08:01 3154692 /usr/lib/locale/C.utf8/LC_CTYPE +7f7eca3fb000-7f7ecaa9c000 r--p 00000000 08:01 3154691 /usr/lib/locale/C.utf8/LC_COLLATE +7f7ecaa9c000-7f7ecaaa0000 ---p 00000000 00:00 0 +7f7ecaaa0000-7f7ecab9d000 rw-p 00000000 00:00 0 +7f7ecab9d000-7f7ecaba1000 ---p 00000000 00:00 0 +7f7ecaba1000-7f7ecac9e000 rw-p 00000000 00:00 0 +7f7ecac9e000-7f7ecac9f000 ---p 00000000 00:00 0 +7f7ecac9f000-7f7ecb4bc000 rw-p 00000000 00:00 0 +7f7ecb4bc000-7f7ecb67c000 ---p 00000000 00:00 0 +7f7ecb67c000-7f7ecb687000 rw-p 00000000 00:00 0 +7f7ecb687000-7f7ecb723000 ---p 00000000 00:00 0 +7f7ecb723000-7f7ecb729000 rw-p 00000000 00:00 0 +7f7ecb729000-7f7ecb776000 ---p 00000000 00:00 0 +7f7ecb776000-7f7ecb781000 rw-p 00000000 00:00 0 +7f7ecb781000-7f7ecb81d000 ---p 00000000 00:00 0 +7f7ecb81d000-7f7ecb823000 rw-p 00000000 00:00 0 +7f7ecb823000-7f7ecb909000 ---p 00000000 00:00 0 +7f7ecb909000-7f7ecb90e000 rw-p 00000000 00:00 0 +7f7ecb90e000-7f7ecb9f4000 ---p 00000000 00:00 0 +7f7ecb9f4000-7f7ecb9ff000 r-xp 00000000 08:01 3155554 /usr/lib64/libnss_files-2.28.so +7f7ecb9ff000-7f7ecbbfe000 ---p 0000b000 08:01 3155554 /usr/lib64/libnss_files-2.28.so +7f7ecbbfe000-7f7ecbbff000 r--p 0000a000 08:01 3155554 /usr/lib64/libnss_files-2.28.so +7f7ecbbff000-7f7ecbc00000 rw-p 0000b000 08:01 3155554 /usr/lib64/libnss_files-2.28.so +7f7ecbc00000-7f7ecbc06000 rw-p 00000000 00:00 0 +7f7ecbc06000-7f7ecbc0d000 r-xp 00000000 08:01 3155596 /usr/lib64/librt-2.28.so +7f7ecbc0d000-7f7ecbe0d000 ---p 00007000 08:01 3155596 /usr/lib64/librt-2.28.so +7f7ecbe0d000-7f7ecbe0e000 r--p 00007000 08:01 3155596 /usr/lib64/librt-2.28.so +7f7ecbe0e000-7f7ecbe0f000 rw-p 00008000 08:01 3155596 /usr/lib64/librt-2.28.so +7f7ecbe0f000-7f7ecbf90000 r-xp 00000000 08:01 3155521 /usr/lib64/libm-2.28.so +7f7ecbf90000-7f7ecc18f000 ---p 00181000 08:01 3155521 /usr/lib64/libm-2.28.so +7f7ecc18f000-7f7ecc190000 r--p 00180000 08:01 3155521 /usr/lib64/libm-2.28.so +7f7ecc190000-7f7ecc191000 rw-p 00181000 08:01 3155521 /usr/lib64/libm-2.28.so +7f7ecc191000-7f7ecd1a0000 r-xp 00000000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so +7f7ecd1a0000-7f7ecd1a1000 ---p 0100f000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so +7f7ecd1a1000-7f7ecd245000 r--p 0100f000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so +7f7ecd245000-7f7ecd27d000 rw-p 010b3000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so +7f7ecd27d000-7f7ecd2fe000 rw-p 00000000 00:00 0 +7f7ecd2fe000-7f7ecd4b7000 r-xp 00000000 08:01 3155424 /usr/lib64/libc-2.28.so +7f7ecd4b7000-7f7ecd6b6000 ---p 001b9000 08:01 3155424 /usr/lib64/libc-2.28.so +7f7ecd6b6000-7f7ecd6ba000 r--p 001b8000 08:01 3155424 /usr/lib64/libc-2.28.so +7f7ecd6ba000-7f7ecd6bc000 rw-p 001bc000 08:01 3155424 /usr/lib64/libc-2.28.so +7f7ecd6bc000-7f7ecd6c0000 rw-p 00000000 00:00 0 +7f7ecd6c0000-7f7ecd6c3000 r-xp 00000000 08:01 3155440 /usr/lib64/libdl-2.28.so +7f7ecd6c3000-7f7ecd8c2000 ---p 00003000 08:01 3155440 /usr/lib64/libdl-2.28.so +7f7ecd8c2000-7f7ecd8c3000 r--p 00002000 08:01 3155440 /usr/lib64/libdl-2.28.so +7f7ecd8c3000-7f7ecd8c4000 rw-p 00003000 08:01 3155440 /usr/lib64/libdl-2.28.so +7f7ecd8c4000-7f7ecd8df000 r-xp 00000000 08:01 3155583 /usr/lib64/libpthread-2.28.so +7f7ecd8df000-7f7ecdade000 ---p 0001b000 08:01 3155583 /usr/lib64/libpthread-2.28.so +7f7ecdade000-7f7ecdadf000 r--p 0001a000 08:01 3155583 /usr/lib64/libpthread-2.28.so +7f7ecdadf000-7f7ecdae0000 rw-p 0001b000 08:01 3155583 /usr/lib64/libpthread-2.28.so +7f7ecdae0000-7f7ecdae4000 rw-p 00000000 00:00 0 +7f7ecdae4000-7f7ecdafa000 r-xp 00000000 08:01 3155650 /usr/lib64/libz.so.1.2.11 +7f7ecdafa000-7f7ecdcf9000 ---p 00016000 08:01 3155650 /usr/lib64/libz.so.1.2.11 +7f7ecdcf9000-7f7ecdcfa000 r--p 00015000 08:01 3155650 /usr/lib64/libz.so.1.2.11 +7f7ecdcfa000-7f7ecdcfb000 rw-p 00000000 00:00 0 +7f7ecdcfb000-7f7ecdd24000 r-xp 00000000 08:01 3155395 /usr/lib64/ld-2.28.so +7f7ecdd28000-7f7ecdd39000 r-xp 00000000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so +7f7ecdd39000-7f7ecdd3a000 ---p 00011000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so +7f7ecdd3a000-7f7ecdd3b000 r--p 00011000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so +7f7ecdd3b000-7f7ecdd3c000 rw-p 00012000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so +7f7ecdd3c000-7f7ecdd3d000 r--p 00000000 08:01 3154699 /usr/lib/locale/C.utf8/LC_NUMERIC +7f7ecdd3d000-7f7ecdd3e000 r--p 00000000 08:01 3154702 /usr/lib/locale/C.utf8/LC_TIME +7f7ecdd3e000-7f7ecdd3f000 r--p 00000000 08:01 3154697 /usr/lib/locale/C.utf8/LC_MONETARY +7f7ecdd3f000-7f7ecdd40000 r--p 00000000 08:01 3154696 /usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES +7f7ecdd40000-7f7ecdd41000 r--p 00000000 08:01 3154700 /usr/lib/locale/C.utf8/LC_PAPER +7f7ecdd41000-7f7ecdd42000 r--p 00000000 08:01 3154698 /usr/lib/locale/C.utf8/LC_NAME +7f7ecdd42000-7f7ecdd43000 r--p 00000000 08:01 3154690 /usr/lib/locale/C.utf8/LC_ADDRESS +7f7ecdd43000-7f7ecdd44000 r--p 00000000 08:01 3154701 /usr/lib/locale/C.utf8/LC_TELEPHONE +7f7ecdd44000-7f7ecdd45000 r--p 00000000 08:01 3154694 /usr/lib/locale/C.utf8/LC_MEASUREMENT +7f7ecdd45000-7f7ecdd4c000 r--s 00000000 08:01 3155357 /usr/lib64/gconv/gconv-modules.cache +7f7ecdd4c000-7f7ecdd4d000 r--p 00000000 08:01 3154693 /usr/lib/locale/C.utf8/LC_IDENTIFICATION +7f7ecdd4d000-7f7ecdd67000 r--p 00000000 08:01 3154703 /usr/lib/locale/locale-archive +7f7ecdd67000-7f7ecddad000 rw-p 00000000 00:00 0 +7f7ecddad000-7f7ecddb4000 ---p 00000000 00:00 0 +7f7ecddb4000-7f7ecddbb000 r-xp 00000000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so +7f7ecddbb000-7f7ecddbc000 r--p 00006000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so +7f7ecddbc000-7f7ecddbd000 rw-p 00007000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so +7f7ecddbd000-7f7ecdde1000 r-xp 00000000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so +7f7ecdde1000-7f7ecdde2000 r--p 00023000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so +7f7ecdde2000-7f7ecdde4000 rw-p 00024000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so +7f7ecdde4000-7f7ecddec000 rw-s 00000000 08:01 3163766 /tmp/hsperfdata_root/100 +7f7ecddec000-7f7ecde07000 r-xp 00000000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so +7f7ecde07000-7f7ecde09000 r--p 0001a000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so +7f7ecde09000-7f7ecde0a000 rw-p 0001c000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so +7f7ecde0a000-7f7ecde0e000 ---p 00000000 00:00 0 +7f7ecde0e000-7f7ecdf0d000 rw-p 00000000 00:00 0 +7f7ecdf0d000-7f7ecdf1b000 r-xp 00000000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so +7f7ecdf1b000-7f7ecdf1c000 ---p 0000e000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so +7f7ecdf1c000-7f7ecdf1d000 r--p 0000e000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so +7f7ecdf1d000-7f7ecdf1e000 rw-p 0000f000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so +7f7ecdf1e000-7f7ecdf20000 rw-p 00000000 00:00 0 +7f7ecdf20000-7f7ecdf21000 ---p 00000000 00:00 0 +7f7ecdf21000-7f7ecdf22000 r--p 00000000 00:00 0 +7f7ecdf22000-7f7ecdf23000 ---p 00000000 00:00 0 +7f7ecdf23000-7f7ecdf24000 r--p 00028000 08:01 3155395 /usr/lib64/ld-2.28.so +7f7ecdf24000-7f7ecdf25000 rw-p 00029000 08:01 3155395 /usr/lib64/ld-2.28.so +7f7ecdf25000-7f7ecdf26000 rw-p 00000000 00:00 0 +7ffd671f1000-7ffd67212000 rw-p 00000000 00:00 0 [stack] +7ffd67244000-7ffd67247000 r--p 00000000 00:00 0 [vvar] +7ffd67247000-7ffd67249000 r-xp 00000000 00:00 0 [vdso] +ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] + + +VM Arguments: +java_command: /project/java-native/target/surefire/surefirebooter15072611568838389395.jar /project/java-native/target/surefire 2020-10-01T00-09-53_430-jvmRun2 surefire3272641396836511080tmp surefire_29468511371192344687tmp +java_class_path (initial): /project/java-native/target/surefire/surefirebooter15072611568838389395.jar +Launcher Type: SUN_STANDARD + +[Global flags] + intx CICompilerCount = 2 {product} {ergonomic} + size_t InitialHeapSize = 33554432 {product} {ergonomic} + size_t MaxHeapSize = 524288000 {product} {ergonomic} + size_t MaxNewSize = 174718976 {product} {ergonomic} + size_t MinHeapDeltaBytes = 196608 {product} {ergonomic} + size_t MinHeapSize = 8388608 {product} {ergonomic} + size_t NewSize = 11141120 {product} {ergonomic} + uintx NonNMethodCodeHeapSize = 5826188 {pd product} {ergonomic} + uintx NonProfiledCodeHeapSize = 122916026 {pd product} {ergonomic} + size_t OldSize = 22413312 {product} {ergonomic} + uintx ProfiledCodeHeapSize = 122916026 {pd product} {ergonomic} + uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} + bool SegmentedCodeCache = true {product} {ergonomic} + size_t SoftMaxHeapSize = 524288000 {manageable} {ergonomic} + bool UseCompressedClassPointers = true {lp64_product} {ergonomic} + bool UseCompressedOops = true {lp64_product} {ergonomic} + bool UseSerialGC = true {product} {ergonomic} + +Logging: +Log output configuration: + #0: stdout all=warning uptime,level,tags + #1: stderr all=off uptime,level,tags + +Environment Variables: +JAVA_HOME=/usr/java/openjdk-14 +PATH=/usr/java/openjdk-14/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +Signal Handlers: +SIGSEGV: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGBUS: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGFPE: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGPIPE: [libjvm.so+0xb1bca0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGXFSZ: [libjvm.so+0xb1bca0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGILL: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGUSR2: [libjvm.so+0xb1bb30], sa_mask[0]=00100000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO +SIGHUP: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGINT: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGTERM: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGQUIT: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO + + +--------------- S Y S T E M --------------- + +OS:Oracle Linux Server release 8.2 +uname:Linux 4.14.154-boot2docker #1 SMP Thu Nov 14 19:19:08 UTC 2019 x86_64 +OS uptime: 0 days 13:49 hours +libc:glibc 2.28 NPTL 2.28 +rlimit: STACK 8192k, CORE infinity, NPROC infinity, NOFILE 1048576, AS infinity, DATA infinity, FSIZE infinity +load average:4.05 1.87 0.76 + +/proc/meminfo: +MemTotal: 2045412 kB +MemFree: 1098032 kB +MemAvailable: 1368704 kB +Buffers: 83692 kB +Cached: 471224 kB +SwapCached: 0 kB +Active: 573576 kB +Inactive: 305820 kB +Active(anon): 404060 kB +Inactive(anon): 199632 kB +Active(file): 169516 kB +Inactive(file): 106188 kB +Unevictable: 0 kB +Mlocked: 0 kB +SwapTotal: 1415172 kB +SwapFree: 1415172 kB +Dirty: 324 kB +Writeback: 0 kB +AnonPages: 324536 kB +Mapped: 120864 kB +Shmem: 290620 kB +Slab: 42348 kB +SReclaimable: 27356 kB +SUnreclaim: 14992 kB +KernelStack: 4672 kB +PageTables: 2744 kB +NFS_Unstable: 0 kB +Bounce: 0 kB +WritebackTmp: 0 kB +CommitLimit: 2437876 kB +Committed_AS: 1792468 kB +VmallocTotal: 34359738367 kB +VmallocUsed: 0 kB +VmallocChunk: 0 kB +HugePages_Total: 0 +HugePages_Free: 0 +HugePages_Rsvd: 0 +HugePages_Surp: 0 +Hugepagesize: 2048 kB +DirectMap4k: 42944 kB +DirectMap2M: 2054144 kB + + +/proc/sys/kernel/threads-max (system-wide limit on the number of threads): +15537 + + +/proc/sys/vm/max_map_count (maximum number of memory map areas a process may have): +65530 + + +/proc/sys/kernel/pid_max (system-wide limit on number of process identifiers): +32768 + + + +container (cgroup) information: +container_type: cgroupv1 +cpu_cpuset_cpus: 0 +cpu_memory_nodes: 0 +active_processor_count: 1 +cpu_quota: no quota +cpu_period: 100000 +cpu_shares: no shares +memory_limit_in_bytes: unlimited +memory_and_swap_limit_in_bytes: unlimited +memory_soft_limit_in_bytes: unlimited +memory_usage_in_bytes: 356708352 +memory_max_usage_in_bytes: 394252288 + +KVM virtualization detected +Steal ticks since vm start: 0 +Steal ticks percentage since vm start: 0.000 + +CPU:total 1 (initial active 1) (1 cores per cpu, 1 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, lzcnt, tsc, tscinvbit +CPU Model and flags from /proc/cpuinfo: +model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm invpcid_single pti fsgsbase avx2 invpcid md_clear flush_l1d + +Memory: 4k page, physical 2045412k(1098032k free), swap 1415172k(1415172k free) + +vm_info: OpenJDK 64-Bit Server VM (14.0.2+12-46) for linux-amd64 JRE (14.0.2+12-46), built on Jul 8 2020 23:30:21 by "mach5one" with gcc 8.3.0 + +END. diff --git a/java-native/hs_err_pid98.log b/java-native/hs_err_pid98.log new file mode 100644 index 0000000000..25a01096e2 --- /dev/null +++ b/java-native/hs_err_pid98.log @@ -0,0 +1,789 @@ +# +# A fatal error has been detected by the Java Runtime Environment: +# +# SIGSEGV (0xb) at pc=0x00007f01b8795090, pid=98, tid=114 +# +# JRE version: OpenJDK Runtime Environment (14.0.2+12) (build 14.0.2+12-46) +# Java VM: OpenJDK 64-Bit Server VM (14.0.2+12-46, mixed mode, sharing, tiered, compressed oops, serial gc, linux-amd64) +# Problematic frame: +# C [libc.so.6+0x15e090] __memset_avx2_unaligned_erms+0x60 +# +# Core dump will be written. Default location: /project/java-native/core +# +# If you would like to submit a bug report, please visit: +# https://bugreport.java.com/bugreport/crash.jsp +# The crash happened outside the Java Virtual Machine in native code. +# See problematic frame for where to report the bug. +# + +--------------- S U M M A R Y ------------ + +Command Line: /project/java-native/target/surefire/surefirebooter255261521587421006.jar /project/java-native/target/surefire 2020-10-01T00-29-55_633-jvmRun3 surefire15563279322398545368tmp surefire_13579138375161683305tmp + +Host: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz, 1 cores, 1G, Oracle Linux Server release 8.2 +Time: Thu Oct 1 00:30:20 2020 UTC elapsed time: 10 seconds (0d 0h 0m 10s) + +--------------- T H R E A D --------------- + +Current thread (0x00007f01b0028800): JavaThread "main" [_thread_in_native, id=114, stack(0x00007f01b9143000,0x00007f01b9244000)] + +Stack: [0x00007f01b9143000,0x00007f01b9244000], sp=0x00007f01b9240788, free space=1013k +Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) +C [libc.so.6+0x15e090] __memset_avx2_unaligned_erms+0x60 +j com.sun.jna.Native.setMemory(Lcom/sun/jna/Pointer;JJJB)V+0 +j com.sun.jna.Pointer.setMemory(JJB)V+9 +j com.baeldung.jna.StdCUnitTest.whenAccessViolation_thenShouldThrowError()V+17 +v ~StubRoutines::call_stub +V [libjvm.so+0x78e42b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2fb +V [libjvm.so+0xbb0efb] invoke(InstanceKlass*, methodHandle const&, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*) [clone .constprop.117]+0x85b +V [libjvm.so+0xbb19cd] Reflection::invoke_method(oopDesc*, Handle, objArrayHandle, Thread*)+0xfd +V [libjvm.so+0x83b8e3] JVM_InvokeMethod+0xf3 +j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.2 +j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.2 +j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.2 +j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.2 +j org.junit.platform.commons.util.ReflectionUtils.invokeMethod(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+41 +j org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/extension/ExtensionRegistry;)Ljava/lang/Object;+32 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;)V+24 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$232.execute()V+12 +j org.junit.jupiter.engine.execution.ThrowableCollector.execute(Lorg/junit/jupiter/api/function/Executable;)V+1 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)V+21 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;+44 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;+6 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+35 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 +j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 +j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 +j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 +j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 +j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 +j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 +j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 +j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 +j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 +j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 +j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 +j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 +j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 +j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 +j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 +j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute()V+23 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(Lorg/junit/platform/engine/ExecutionRequest;)V+13 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/engine/TestEngine;Lorg/junit/platform/engine/ExecutionRequest;)V+2 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/core/Root;Lorg/junit/platform/engine/ConfigurationParameters;[Lorg/junit/platform/launcher/TestExecutionListener;)V+101 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;[Lorg/junit/platform/launcher/TestExecutionListener;)V+36 +j org.junit.platform.surefire.provider.JUnitPlatformProvider.invokeAllTests(Lorg/apache/maven/surefire/util/TestsToRun;)Lorg/apache/maven/surefire/suite/RunResult;+55 +j org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(Ljava/lang/Object;)Lorg/apache/maven/surefire/suite/RunResult;+31 +j org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(Lorg/apache/maven/surefire/booter/ForkingReporterFactory;)Lorg/apache/maven/surefire/suite/RunResult;+9 +j org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess()Lorg/apache/maven/surefire/suite/RunResult;+7 +j org.apache.maven.surefire.booter.ForkedBooter.execute()V+1 +j org.apache.maven.surefire.booter.ForkedBooter.main([Ljava/lang/String;)V+35 +v ~StubRoutines::call_stub +V [libjvm.so+0x78e42b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2fb +V [libjvm.so+0x80d2e3] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.125] [clone .constprop.264]+0x193 +V [libjvm.so+0x80f338] jni_CallStaticVoidMethod+0x108 +C [libjli.so+0x4647] JavaMain+0xcd7 +C [libjli.so+0x85a9] ThreadJavaMain+0x9 + +Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) +j com.sun.jna.Native.setMemory(Lcom/sun/jna/Pointer;JJJB)V+0 +j com.sun.jna.Pointer.setMemory(JJB)V+9 +j com.baeldung.jna.StdCUnitTest.whenAccessViolation_thenShouldThrowError()V+17 +v ~StubRoutines::call_stub +j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.2 +j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.2 +j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.2 +j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.2 +j org.junit.platform.commons.util.ReflectionUtils.invokeMethod(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+41 +j org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/extension/ExtensionRegistry;)Ljava/lang/Object;+32 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;)V+24 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$232.execute()V+12 +j org.junit.jupiter.engine.execution.ThrowableCollector.execute(Lorg/junit/jupiter/api/function/Executable;)V+1 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)V+21 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;+44 +j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;+6 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+35 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 +j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 +j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 +j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 +j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 +j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 +j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 +j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 +j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 +j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 +j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 +j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 +j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 +j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 +j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 +j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 +j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 +j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 +j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute()V+23 +j org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(Lorg/junit/platform/engine/ExecutionRequest;)V+13 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/engine/TestEngine;Lorg/junit/platform/engine/ExecutionRequest;)V+2 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/core/Root;Lorg/junit/platform/engine/ConfigurationParameters;[Lorg/junit/platform/launcher/TestExecutionListener;)V+101 +j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;[Lorg/junit/platform/launcher/TestExecutionListener;)V+36 +j org.junit.platform.surefire.provider.JUnitPlatformProvider.invokeAllTests(Lorg/apache/maven/surefire/util/TestsToRun;)Lorg/apache/maven/surefire/suite/RunResult;+55 +j org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(Ljava/lang/Object;)Lorg/apache/maven/surefire/suite/RunResult;+31 +j org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(Lorg/apache/maven/surefire/booter/ForkingReporterFactory;)Lorg/apache/maven/surefire/suite/RunResult;+9 +j org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess()Lorg/apache/maven/surefire/suite/RunResult;+7 +j org.apache.maven.surefire.booter.ForkedBooter.execute()V+1 +j org.apache.maven.surefire.booter.ForkedBooter.main([Ljava/lang/String;)V+35 +v ~StubRoutines::call_stub + +siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000 + +Register to memory mapping: + +RAX=0x0 is NULL +RBX={method} {0x00007f01b6799628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' +RCX=0x0000000000000080 is an unknown value +RDX=0x0000000000019000 is an unknown value +RSP=0x00007f01b9240788 is pointing into the stack for thread: 0x00007f01b0028800 +RBP=0x00007f01b92407c0 is pointing into the stack for thread: 0x00007f01b0028800 +RSI=0x0 is NULL +RDI=0x0 is NULL +R8 =0x0 is NULL +R9 =0x0000000000019000 is an unknown value +R10=0x0000000000000009 is an unknown value +R11=0x00007f01b8794fd0: in /lib64/libc.so.6 at 0x00007f01b8637000 +R12=0x0 is NULL +R13={method} {0x00007f01b6799628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' +R14=0x00007f01b92408b8 is pointing into the stack for thread: 0x00007f01b0028800 +R15=0x00007f01b0028800 is a thread + + +Registers: +RAX=0x0000000000000000, RBX=0x00007f01b6799628, RCX=0x0000000000000080, RDX=0x0000000000019000 +RSP=0x00007f01b9240788, RBP=0x00007f01b92407c0, RSI=0x0000000000000000, RDI=0x0000000000000000 +R8 =0x0000000000000000, R9 =0x0000000000019000, R10=0x0000000000000009, R11=0x00007f01b8794fd0 +R12=0x0000000000000000, R13=0x00007f01b6799628, R14=0x00007f01b92408b8, R15=0x00007f01b0028800 +RIP=0x00007f01b8795090, EFLAGS=0x0000000000010202, CSGSFS=0x002b000000000033, ERR=0x0000000000000006 + TRAPNO=0x000000000000000e + +Top of Stack: (sp=0x00007f01b9240788) +0x00007f01b9240788: 00007f01b4a8fe8d 00007f01b6799628 +0x00007f01b9240798: 00007f01b0028b10 0000000000000000 +0x00007f01b92407a8: 0000000000019000 0000000000000000 +0x00007f01b92407b8: 0000000000000000 00007f01b9240860 + +Instructions: (pc=0x00007f01b8795090) +0x00007f01b8794f90: f3 0f 1e fa 48 39 d1 0f 82 53 d9 fa ff 0f 1f 00 +0x00007f01b8794fa0: f3 0f 1e fa 48 c1 e2 02 c5 f9 6e c6 48 89 f8 c4 +0x00007f01b8794fb0: e2 7d 58 c0 eb 2a 66 2e 0f 1f 84 00 00 00 00 00 +0x00007f01b8794fc0: f3 0f 1e fa 48 39 d1 0f 82 23 d9 fa ff 0f 1f 00 +0x00007f01b8794fd0: f3 0f 1e fa c5 f9 6e c6 48 89 f8 c4 e2 7d 78 c0 +0x00007f01b8794fe0: 48 83 fa 20 0f 82 04 01 00 00 48 83 fa 40 77 77 +0x00007f01b8794ff0: c5 fe 7f 44 17 e0 c5 fe 7f 07 c5 f8 77 c3 66 90 +0x00007f01b8795000: f3 0f 1e fa c5 f8 77 48 89 d1 40 0f b6 c6 48 89 +0x00007f01b8795010: fa f3 aa 48 89 d0 c3 66 0f 1f 84 00 00 00 00 00 +0x00007f01b8795020: f3 0f 1e fa 48 39 d1 0f 82 c3 d8 fa ff 0f 1f 00 +0x00007f01b8795030: f3 0f 1e fa c5 f9 6e c6 48 89 f8 c4 e2 7d 78 c0 +0x00007f01b8795040: 48 83 fa 20 0f 82 a4 00 00 00 48 83 fa 40 77 0e +0x00007f01b8795050: c5 fe 7f 44 17 e0 c5 fe 7f 07 c5 f8 77 c3 48 81 +0x00007f01b8795060: fa 00 08 00 00 77 9d 48 81 fa 80 00 00 00 77 19 +0x00007f01b8795070: c5 fe 7f 07 c5 fe 7f 47 20 c5 fe 7f 44 17 e0 c5 +0x00007f01b8795080: fe 7f 44 17 c0 c5 f8 77 c3 48 8d 8f 80 00 00 00 +0x00007f01b8795090: c5 fe 7f 07 48 83 e1 80 c5 fe 7f 44 17 e0 c5 fe +0x00007f01b87950a0: 7f 47 20 c5 fe 7f 44 17 c0 c5 fe 7f 47 40 c5 fe +0x00007f01b87950b0: 7f 44 17 a0 c5 fe 7f 47 60 c5 fe 7f 44 17 80 48 +0x00007f01b87950c0: 01 fa 48 83 e2 80 48 39 d1 74 ba c5 fd 7f 01 c5 +0x00007f01b87950d0: fd 7f 41 20 c5 fd 7f 41 40 c5 fd 7f 41 60 48 81 +0x00007f01b87950e0: c1 80 00 00 00 48 39 ca 75 e1 c5 f8 77 c3 80 fa +0x00007f01b87950f0: 10 73 1c c4 e1 f9 7e c1 80 fa 08 73 20 80 fa 04 +0x00007f01b8795100: 73 27 80 fa 01 77 2c 72 02 88 0f c5 f8 77 c3 c5 +0x00007f01b8795110: fa 7f 44 17 f0 c5 fa 7f 07 c5 f8 77 c3 48 89 4c +0x00007f01b8795120: 17 f8 48 89 0f c5 f8 77 c3 89 4c 17 fc 89 0f c5 +0x00007f01b8795130: f8 77 c3 66 89 4c 17 fe 66 89 0f c5 f8 77 c3 90 +0x00007f01b8795140: f3 0f 1e fa 48 c1 e2 02 48 83 fa 20 0f 82 3e 01 +0x00007f01b8795150: 00 00 c5 fe 6f 16 c5 ed 76 17 c5 fd d7 c2 83 e8 +0x00007f01b8795160: ff 0f 85 e9 00 00 00 48 83 fa 40 0f 86 c0 00 00 +0x00007f01b8795170: 00 c5 fd 76 c0 48 81 fa 00 01 00 00 0f 87 9e 01 +0x00007f01b8795180: 00 00 48 81 fa 80 00 00 00 0f 82 28 02 00 00 c5 + + +Stack slot to memory mapping: +stack at sp + 0 slots: 0x00007f01b4a8fe8d: Java_com_sun_jna_Native_setMemory+0x00000000000000bd in /root/.cache/JNA/temp/jna8092103267992246554.tmp at 0x00007f01b4a89000 +stack at sp + 1 slots: {method} {0x00007f01b6799628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' +stack at sp + 2 slots: 0x00007f01b0028b10 points into unknown readable memory: 80 48 58 b8 01 7f 00 00 +stack at sp + 3 slots: 0x0 is NULL +stack at sp + 4 slots: 0x0000000000019000 is an unknown value +stack at sp + 5 slots: 0x0 is NULL +stack at sp + 6 slots: 0x0 is NULL +stack at sp + 7 slots: 0x00007f01b9240860 is pointing into the stack for thread: 0x00007f01b0028800 + + +--------------- P R O C E S S --------------- + +Threads class SMR info: +_java_thread_list=0x00007f01b01d8a40, length=12, elements={ +0x00007f01b0028800, 0x00007f01b00a2000, 0x00007f01b00a3800, 0x00007f01b00ad000, +0x00007f01b00af000, 0x00007f01b00b1000, 0x00007f01b00b3000, 0x00007f01b00b5000, +0x00007f01b00ef800, 0x00007f01b00f4800, 0x00007f01b0188800, 0x00007f01b01d7800 +} + +Java Threads: ( => current thread ) +=>0x00007f01b0028800 JavaThread "main" [_thread_in_native, id=114, stack(0x00007f01b9143000,0x00007f01b9244000)] + 0x00007f01b00a2000 JavaThread "Reference Handler" daemon [_thread_blocked, id=120, stack(0x00007f01b5ed6000,0x00007f01b5fd7000)] + 0x00007f01b00a3800 JavaThread "Finalizer" daemon [_thread_blocked, id=123, stack(0x00007f01b5dd5000,0x00007f01b5ed6000)] + 0x00007f01b00ad000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=125, stack(0x00007f01b55e0000,0x00007f01b56e1000)] + 0x00007f01b00af000 JavaThread "Service Thread" daemon [_thread_blocked, id=128, stack(0x00007f01b54df000,0x00007f01b55e0000)] + 0x00007f01b00b1000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=130, stack(0x00007f01b53de000,0x00007f01b54df000)] + 0x00007f01b00b3000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=133, stack(0x00007f01b52dd000,0x00007f01b53de000)] + 0x00007f01b00b5000 JavaThread "Sweeper thread" daemon [_thread_blocked, id=138, stack(0x00007f01b51dc000,0x00007f01b52dd000)] + 0x00007f01b00ef800 JavaThread "Notification Thread" daemon [_thread_blocked, id=140, stack(0x00007f01b50db000,0x00007f01b51dc000)] + 0x00007f01b00f4800 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=146, stack(0x00007f01b4ed8000,0x00007f01b4fd9000)] + 0x00007f01b0188800 JavaThread "surefire-forkedjvm-command-thread" daemon [_thread_in_native, id=150, stack(0x00007f01b4dc0000,0x00007f01b4ec1000)] + 0x00007f01b01d7800 JavaThread "surefire-forkedjvm-ping-30s" daemon [_thread_blocked, id=153, stack(0x00007f01b4cb2000,0x00007f01b4db3000)] + +Other Threads: + 0x00007f01b009e800 VMThread "VM Thread" [stack: 0x00007f01b5fd9000,0x00007f01b60d9000] [id=117] + 0x00007f01b00f2000 WatcherThread [stack: 0x00007f01b4fdb000,0x00007f01b50db000] [id=141] + +Threads with active compile tasks: + +VM state:not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +Heap address: 0x00000000e0c00000, size: 500 MB, Compressed Oops mode: 32-bit +Narrow klass base: 0x0000000800000000, Narrow klass shift: 3 +Compressed class space size: 1073741824 Address: 0x0000000800b11000 + +Heap: + def new generation total 9792K, used 7590K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) + eden space 8704K, 74% used [0x00000000e0c00000, 0x00000000e1259a00, 0x00000000e1480000) + from space 1088K, 100% used [0x00000000e1590000, 0x00000000e16a0000, 0x00000000e16a0000) + to space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) + tenured generation total 21888K, used 1321K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) + the space 21888K, 6% used [0x00000000eb2a0000, 0x00000000eb3ea690, 0x00000000eb3ea800, 0x00000000ec800000) + Metaspace used 4992K, capacity 7071K, committed 7296K, reserved 1056768K + class space used 637K, capacity 881K, committed 896K, reserved 1048576K + +Card table byte_map: [0x00007f01b6a5c000,0x00007f01b6b57000] _byte_map_base: 0x00007f01b6356000 + +Polling page: 0x00007f01b9259000 + +Metaspace: + +Usage: + Non-class: 6.04 MB capacity, 4.25 MB ( 70%) used, 1.76 MB ( 29%) free+waste, 30.81 KB ( <1%) overhead. + Class: 881.00 KB capacity, 637.47 KB ( 72%) used, 226.47 KB ( 26%) free+waste, 17.06 KB ( 2%) overhead. + Both: 6.91 MB capacity, 4.88 MB ( 71%) used, 1.98 MB ( 29%) free+waste, 47.88 KB ( <1%) overhead. + +Virtual space: + Non-class space: 8.00 MB reserved, 6.25 MB ( 78%) committed + Class space: 1.00 GB reserved, 896.00 KB ( <1%) committed + Both: 1.01 GB reserved, 7.12 MB ( <1%) committed + +Chunk freelists: + Non-Class: 62.00 KB + Class: 11.00 KB + Both: 73.00 KB + +MaxMetaspaceSize: unlimited +CompressedClassSpaceSize: 1.00 GB + +CodeHeap 'non-profiled nmethods': size=120036Kb used=270Kb max_used=270Kb free=119765Kb + bounds [0x00007f01a019c000, 0x00007f01a040c000, 0x00007f01a76d5000] +CodeHeap 'profiled nmethods': size=120032Kb used=1585Kb max_used=1585Kb free=118446Kb + bounds [0x00007f0198c64000, 0x00007f0198ed4000, 0x00007f01a019c000] +CodeHeap 'non-nmethods': size=5692Kb used=1156Kb max_used=1171Kb free=4535Kb + bounds [0x00007f01986d5000, 0x00007f0198945000, 0x00007f0198c64000] + total_blobs=1295 nmethods=879 adapters=332 + compilation: enabled + stopped_count=0, restarted_count=0 + full_count=0 + +Compilation events (20 events): +Event: 10.134 Thread 0x00007f01b00b3000 876 3 java.util.zip.ZipEntry:: (74 bytes) +Event: 10.135 Thread 0x00007f01b00b3000 nmethod 876 0x00007f0198ded390 code [0x00007f0198ded580, 0x00007f0198dedaf0] +Event: 10.135 Thread 0x00007f01b00b3000 873 3 java.util.jar.JarFile$1::apply (13 bytes) +Event: 10.138 Thread 0x00007f01b00b3000 nmethod 873 0x00007f0198dedd10 code [0x00007f0198dedec0, 0x00007f0198dee1a0] +Event: 10.138 Thread 0x00007f01b00b3000 874 3 java.util.jar.JarFile$JarFileEntry:: (16 bytes) +Event: 10.138 Thread 0x00007f01b00b3000 nmethod 874 0x00007f0198dee310 code [0x00007f0198dee4c0, 0x00007f0198dee6c0] +Event: 10.141 Thread 0x00007f01b00b1000 877 4 java.lang.StringBuilder:: (7 bytes) +Event: 10.144 Thread 0x00007f01b00b1000 nmethod 877 0x00007f01a01df010 code [0x00007f01a01df180, 0x00007f01a01df298] +Event: 10.151 Thread 0x00007f01b00b3000 878 ! 3 java.util.zip.ZipFile$ZipFileInflaterInputStream::close (67 bytes) +Event: 10.152 Thread 0x00007f01b00b3000 nmethod 878 0x00007f0198dee790 code [0x00007f0198dee980, 0x00007f0198def090] +Event: 10.158 Thread 0x00007f01b00b3000 879 3 java.util.ArrayDeque::add (7 bytes) +Event: 10.159 Thread 0x00007f01b00b3000 nmethod 879 0x00007f0198def390 code [0x00007f0198def520, 0x00007f0198def680] +Event: 10.166 Thread 0x00007f01b00b3000 880 3 java.util.zip.ZipFile$InflaterCleanupAction::run (12 bytes) +Event: 10.167 Thread 0x00007f01b00b3000 nmethod 880 0x00007f0198def710 code [0x00007f0198def8a0, 0x00007f0198defa00] +Event: 10.167 Thread 0x00007f01b00b3000 881 ! 3 java.util.zip.Inflater::reset (64 bytes) +Event: 10.167 Thread 0x00007f01b00b3000 nmethod 881 0x00007f0198defb10 code [0x00007f0198defcc0, 0x00007f0198df00b0] +Event: 10.179 Thread 0x00007f01b00b1000 883 4 java.lang.Object:: (1 bytes) +Event: 10.180 Thread 0x00007f01b00b1000 nmethod 883 0x00007f01a01df710 code [0x00007f01a01df880, 0x00007f01a01df938] +Event: 10.185 Thread 0x00007f01b00b3000 884 3 sun.net.www.protocol.jar.Handler::checkNestedProtocol (18 bytes) +Event: 10.186 Thread 0x00007f01b00b3000 nmethod 884 0x00007f0198df0290 code [0x00007f0198df0440, 0x00007f0198df0620] + +GC Heap History (2 events): +Event: 5.704 GC heap before +{Heap before GC invocations=0 (full 0): + def new generation total 9792K, used 8704K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) + eden space 8704K, 100% used [0x00000000e0c00000, 0x00000000e1480000, 0x00000000e1480000) + from space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) + to space 1088K, 0% used [0x00000000e1590000, 0x00000000e1590000, 0x00000000e16a0000) + tenured generation total 21888K, used 0K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) + the space 21888K, 0% used [0x00000000eb2a0000, 0x00000000eb2a0000, 0x00000000eb2a0200, 0x00000000ec800000) + Metaspace used 3047K, capacity 5805K, committed 6016K, reserved 1056768K + class space used 361K, capacity 627K, committed 640K, reserved 1048576K +} +Event: 5.793 GC heap after +{Heap after GC invocations=1 (full 0): + def new generation total 9792K, used 1088K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) + eden space 8704K, 0% used [0x00000000e0c00000, 0x00000000e0c00000, 0x00000000e1480000) + from space 1088K, 100% used [0x00000000e1590000, 0x00000000e16a0000, 0x00000000e16a0000) + to space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) + tenured generation total 21888K, used 1321K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) + the space 21888K, 6% used [0x00000000eb2a0000, 0x00000000eb3ea690, 0x00000000eb3ea800, 0x00000000ec800000) + Metaspace used 3047K, capacity 5805K, committed 6016K, reserved 1056768K + class space used 361K, capacity 627K, committed 640K, reserved 1048576K +} + +Deoptimization events (16 events): +Event: 0.632 Thread 0x00007f01b0028800 Uncommon trap: trap_request=0xffffff45 fr.pc=0x00007f01a01a0598 relative=0x00000000000001d8 +Event: 0.632 Thread 0x00007f01b0028800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00007f01a01a0598 method=java.lang.String.hashCode()I @ 42 c2 +Event: 0.632 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f01a01a0598 sp=0x00007f01b9241330 +Event: 0.632 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871de25 sp=0x00007f01b92412e8 mode 2 +Event: 2.512 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f0198cb6484 sp=0x00007f01b9240b90 +Event: 2.513 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871e33a sp=0x00007f01b9240008 mode 0 +Event: 2.799 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f0198cc1322 sp=0x00007f01b92411c0 +Event: 2.799 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871e33a sp=0x00007f01b9240648 mode 0 +Event: 3.948 Thread 0x00007f01b0028800 Uncommon trap: trap_request=0xffffff45 fr.pc=0x00007f01a01a2068 relative=0x0000000000000068 +Event: 3.948 Thread 0x00007f01b0028800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00007f01a01a2068 method=java.lang.String.isLatin1()Z @ 10 c2 +Event: 3.948 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f01a01a2068 sp=0x00007f01b92418d0 +Event: 3.948 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871de25 sp=0x00007f01b9241880 mode 2 +Event: 6.052 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f0198cca4e8 sp=0x00007f01b9240f60 +Event: 6.052 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871e33a sp=0x00007f01b92403d0 mode 0 +Event: 9.484 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f0198cc64c5 sp=0x00007f01b923f9a0 +Event: 9.485 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871e33a sp=0x00007f01b923ee20 mode 0 + +Classes unloaded (0 events): +No events + +Classes redefined (0 events): +No events + +Internal exceptions (17 events): +Event: 1.373 Thread 0x00007f01b0028800 Exception (0x00000000e0dc59d8) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 3.603 Thread 0x00007f01b0028800 Exception (0x00000000e1209430) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 4.004 Thread 0x00007f01b0028800 Exception (0x00000000e12808b8) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 4.253 Thread 0x00007f01b0028800 Exception (0x00000000e12d4648) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 4.809 Thread 0x00007f01b0028800 Exception (0x00000000e1346010) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 4.925 Thread 0x00007f01b0028800 Exception (0x00000000e137ad28) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 4.993 Thread 0x00007f01b0028800 Exception (0x00000000e139e938) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 5.012 Thread 0x00007f01b0028800 Exception (0x00000000e13a8b18) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 5.041 Thread 0x00007f01b0028800 Exception (0x00000000e13b69e8) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 832] +Event: 5.141 Thread 0x00007f01b0028800 Exception (0x00000000e13ebf18) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 5.852 Thread 0x00007f01b0028800 Exception (0x00000000e0c24ce8) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.079 Thread 0x00007f01b0028800 Exception (0x00000000e0c8faf8) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.396 Thread 0x00007f01b0028800 Exception (0x00000000e0cfcd80) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.442 Thread 0x00007f01b0028800 Exception (0x00000000e0d15098) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 6.449 Thread 0x00007f01b0028800 Exception (0x00000000e0d17a88) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 832] +Event: 8.061 Thread 0x00007f01b0028800 Exception (0x00000000e0f73890) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] +Event: 8.061 Thread 0x00007f01b0028800 Exception (0x00000000e0f76c98) +thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] + +Events (20 events): +Event: 10.009 loading class sun/security/provider/ByteArrayAccess +Event: 10.009 loading class sun/security/provider/ByteArrayAccess done +Event: 10.010 loading class java/io/DeleteOnExitHook +Event: 10.010 loading class java/io/DeleteOnExitHook done +Event: 10.010 loading class java/io/DeleteOnExitHook$1 +Event: 10.011 loading class java/io/DeleteOnExitHook$1 done +Event: 10.043 loading class java/io/FileOutputStream$1 +Event: 10.043 loading class java/io/FileOutputStream$1 done +Event: 10.046 Loaded shared library /root/.cache/JNA/temp/jna8092103267992246554.tmp +Event: 10.046 loading class java/nio/ShortBuffer +Event: 10.048 loading class java/nio/ShortBuffer done +Event: 10.051 loading class java/nio/FloatBuffer +Event: 10.051 loading class java/nio/FloatBuffer done +Event: 10.054 loading class java/nio/DoubleBuffer +Event: 10.057 loading class java/nio/DoubleBuffer done +Event: 10.132 Executing VM operation: HandshakeAllThreads +Event: 10.132 Executing VM operation: HandshakeAllThreads done +Event: 10.168 Loaded shared library /usr/java/openjdk-14/lib/libzip.so +Event: 10.207 Executing VM operation: HandshakeAllThreads +Event: 10.210 Executing VM operation: HandshakeAllThreads done + + +Dynamic libraries: +e0c00000-e16a0000 rw-p 00000000 00:00 0 +e16a0000-eb2a0000 ---p 00000000 00:00 0 +eb2a0000-ec800000 rw-p 00000000 00:00 0 +ec800000-100000000 ---p 00000000 00:00 0 +800000000-800003000 rwxp 00001000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa +800003000-8003e4000 rw-p 00004000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa +8003e4000-800b10000 r--p 003e5000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa +800b10000-800b11000 rw-p 00b11000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa +800b11000-800bf1000 rw-p 00000000 00:00 0 +800bf1000-840b11000 ---p 00000000 00:00 0 +56394c07f000-56394c080000 r-xp 00000000 08:01 3160482 /usr/java/openjdk-14/bin/java +56394c081000-56394c082000 r--p 00001000 08:01 3160482 /usr/java/openjdk-14/bin/java +56394c082000-56394c083000 rw-p 00002000 08:01 3160482 /usr/java/openjdk-14/bin/java +56394c563000-56394c584000 rw-p 00000000 00:00 0 [heap] +7f017c000000-7f017c3ce000 rw-p 00000000 00:00 0 +7f017c3ce000-7f0180000000 ---p 00000000 00:00 0 +7f0180000000-7f01802f1000 rw-p 00000000 00:00 0 +7f01802f1000-7f0184000000 ---p 00000000 00:00 0 +7f0184000000-7f0184021000 rw-p 00000000 00:00 0 +7f0184021000-7f0188000000 ---p 00000000 00:00 0 +7f0188000000-7f0188021000 rw-p 00000000 00:00 0 +7f0188021000-7f018c000000 ---p 00000000 00:00 0 +7f018c000000-7f018c021000 rw-p 00000000 00:00 0 +7f018c021000-7f0190000000 ---p 00000000 00:00 0 +7f0190000000-7f0190021000 rw-p 00000000 00:00 0 +7f0190021000-7f0194000000 ---p 00000000 00:00 0 +7f0194000000-7f0194021000 rw-p 00000000 00:00 0 +7f0194021000-7f0198000000 ---p 00000000 00:00 0 +7f01986d5000-7f0198945000 rwxp 00000000 00:00 0 +7f0198945000-7f0198c64000 ---p 00000000 00:00 0 +7f0198c64000-7f0198ed4000 rwxp 00000000 00:00 0 +7f0198ed4000-7f01a019c000 ---p 00000000 00:00 0 +7f01a019c000-7f01a040c000 rwxp 00000000 00:00 0 +7f01a040c000-7f01a76d5000 ---p 00000000 00:00 0 +7f01a76d5000-7f01b0000000 r--s 00000000 08:01 3160985 /usr/java/openjdk-14/lib/modules +7f01b0000000-7f01b04f4000 rw-p 00000000 00:00 0 +7f01b04f4000-7f01b4000000 ---p 00000000 00:00 0 +7f01b45cb000-7f01b4a89000 rw-p 00000000 00:00 0 +7f01b4a89000-7f01b4aa1000 r-xp 00000000 08:01 3163771 /root/.cache/JNA/temp/jna8092103267992246554.tmp (deleted) +7f01b4aa1000-7f01b4ca1000 ---p 00018000 08:01 3163771 /root/.cache/JNA/temp/jna8092103267992246554.tmp (deleted) +7f01b4ca1000-7f01b4ca2000 rw-p 00018000 08:01 3163771 /root/.cache/JNA/temp/jna8092103267992246554.tmp (deleted) +7f01b4ca2000-7f01b4caf000 r-xp 00000000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so +7f01b4caf000-7f01b4cb1000 r--p 0000c000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so +7f01b4cb1000-7f01b4cb2000 rw-p 0000e000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so +7f01b4cb2000-7f01b4cb6000 ---p 00000000 00:00 0 +7f01b4cb6000-7f01b4db3000 rw-p 00000000 00:00 0 +7f01b4db3000-7f01b4db8000 r-xp 00000000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so +7f01b4db8000-7f01b4db9000 r--p 00004000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so +7f01b4db9000-7f01b4dba000 rw-p 00005000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so +7f01b4dba000-7f01b4dbe000 r-xp 00000000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so +7f01b4dbe000-7f01b4dbf000 r--p 00003000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so +7f01b4dbf000-7f01b4dc0000 rw-p 00004000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so +7f01b4dc0000-7f01b4dc4000 ---p 00000000 00:00 0 +7f01b4dc4000-7f01b4ec1000 rw-p 00000000 00:00 0 +7f01b4ec1000-7f01b4ed6000 r-xp 00000000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so +7f01b4ed6000-7f01b4ed7000 r--p 00014000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so +7f01b4ed7000-7f01b4ed8000 rw-p 00015000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so +7f01b4ed8000-7f01b4edc000 ---p 00000000 00:00 0 +7f01b4edc000-7f01b4fd9000 rw-p 00000000 00:00 0 +7f01b4fd9000-7f01b4fda000 ---p 00000000 00:00 0 +7f01b4fda000-7f01b50db000 rw-p 00000000 00:00 0 +7f01b50db000-7f01b50df000 ---p 00000000 00:00 0 +7f01b50df000-7f01b51dc000 rw-p 00000000 00:00 0 +7f01b51dc000-7f01b51e0000 ---p 00000000 00:00 0 +7f01b51e0000-7f01b52dd000 rw-p 00000000 00:00 0 +7f01b52dd000-7f01b52e1000 ---p 00000000 00:00 0 +7f01b52e1000-7f01b53de000 rw-p 00000000 00:00 0 +7f01b53de000-7f01b53e2000 ---p 00000000 00:00 0 +7f01b53e2000-7f01b54df000 rw-p 00000000 00:00 0 +7f01b54df000-7f01b54e3000 ---p 00000000 00:00 0 +7f01b54e3000-7f01b55e0000 rw-p 00000000 00:00 0 +7f01b55e0000-7f01b55e4000 ---p 00000000 00:00 0 +7f01b55e4000-7f01b56e1000 rw-p 00000000 00:00 0 +7f01b56e1000-7f01b5734000 r--p 00000000 08:01 3154692 /usr/lib/locale/C.utf8/LC_CTYPE +7f01b5734000-7f01b5dd5000 r--p 00000000 08:01 3154691 /usr/lib/locale/C.utf8/LC_COLLATE +7f01b5dd5000-7f01b5dd9000 ---p 00000000 00:00 0 +7f01b5dd9000-7f01b5ed6000 rw-p 00000000 00:00 0 +7f01b5ed6000-7f01b5eda000 ---p 00000000 00:00 0 +7f01b5eda000-7f01b5fd7000 rw-p 00000000 00:00 0 +7f01b5fd7000-7f01b5fd8000 ---p 00000000 00:00 0 +7f01b5fd8000-7f01b67f5000 rw-p 00000000 00:00 0 +7f01b67f5000-7f01b69b5000 ---p 00000000 00:00 0 +7f01b69b5000-7f01b69c0000 rw-p 00000000 00:00 0 +7f01b69c0000-7f01b6a5c000 ---p 00000000 00:00 0 +7f01b6a5c000-7f01b6a62000 rw-p 00000000 00:00 0 +7f01b6a62000-7f01b6aaf000 ---p 00000000 00:00 0 +7f01b6aaf000-7f01b6aba000 rw-p 00000000 00:00 0 +7f01b6aba000-7f01b6b56000 ---p 00000000 00:00 0 +7f01b6b56000-7f01b6b5c000 rw-p 00000000 00:00 0 +7f01b6b5c000-7f01b6c42000 ---p 00000000 00:00 0 +7f01b6c42000-7f01b6c47000 rw-p 00000000 00:00 0 +7f01b6c47000-7f01b6d2d000 ---p 00000000 00:00 0 +7f01b6d2d000-7f01b6d38000 r-xp 00000000 08:01 3155554 /usr/lib64/libnss_files-2.28.so +7f01b6d38000-7f01b6f37000 ---p 0000b000 08:01 3155554 /usr/lib64/libnss_files-2.28.so +7f01b6f37000-7f01b6f38000 r--p 0000a000 08:01 3155554 /usr/lib64/libnss_files-2.28.so +7f01b6f38000-7f01b6f39000 rw-p 0000b000 08:01 3155554 /usr/lib64/libnss_files-2.28.so +7f01b6f39000-7f01b6f3f000 rw-p 00000000 00:00 0 +7f01b6f3f000-7f01b6f46000 r-xp 00000000 08:01 3155596 /usr/lib64/librt-2.28.so +7f01b6f46000-7f01b7146000 ---p 00007000 08:01 3155596 /usr/lib64/librt-2.28.so +7f01b7146000-7f01b7147000 r--p 00007000 08:01 3155596 /usr/lib64/librt-2.28.so +7f01b7147000-7f01b7148000 rw-p 00008000 08:01 3155596 /usr/lib64/librt-2.28.so +7f01b7148000-7f01b72c9000 r-xp 00000000 08:01 3155521 /usr/lib64/libm-2.28.so +7f01b72c9000-7f01b74c8000 ---p 00181000 08:01 3155521 /usr/lib64/libm-2.28.so +7f01b74c8000-7f01b74c9000 r--p 00180000 08:01 3155521 /usr/lib64/libm-2.28.so +7f01b74c9000-7f01b74ca000 rw-p 00181000 08:01 3155521 /usr/lib64/libm-2.28.so +7f01b74ca000-7f01b84d9000 r-xp 00000000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so +7f01b84d9000-7f01b84da000 ---p 0100f000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so +7f01b84da000-7f01b857e000 r--p 0100f000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so +7f01b857e000-7f01b85b6000 rw-p 010b3000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so +7f01b85b6000-7f01b8637000 rw-p 00000000 00:00 0 +7f01b8637000-7f01b87f0000 r-xp 00000000 08:01 3155424 /usr/lib64/libc-2.28.so +7f01b87f0000-7f01b89ef000 ---p 001b9000 08:01 3155424 /usr/lib64/libc-2.28.so +7f01b89ef000-7f01b89f3000 r--p 001b8000 08:01 3155424 /usr/lib64/libc-2.28.so +7f01b89f3000-7f01b89f5000 rw-p 001bc000 08:01 3155424 /usr/lib64/libc-2.28.so +7f01b89f5000-7f01b89f9000 rw-p 00000000 00:00 0 +7f01b89f9000-7f01b89fc000 r-xp 00000000 08:01 3155440 /usr/lib64/libdl-2.28.so +7f01b89fc000-7f01b8bfb000 ---p 00003000 08:01 3155440 /usr/lib64/libdl-2.28.so +7f01b8bfb000-7f01b8bfc000 r--p 00002000 08:01 3155440 /usr/lib64/libdl-2.28.so +7f01b8bfc000-7f01b8bfd000 rw-p 00003000 08:01 3155440 /usr/lib64/libdl-2.28.so +7f01b8bfd000-7f01b8c18000 r-xp 00000000 08:01 3155583 /usr/lib64/libpthread-2.28.so +7f01b8c18000-7f01b8e17000 ---p 0001b000 08:01 3155583 /usr/lib64/libpthread-2.28.so +7f01b8e17000-7f01b8e18000 r--p 0001a000 08:01 3155583 /usr/lib64/libpthread-2.28.so +7f01b8e18000-7f01b8e19000 rw-p 0001b000 08:01 3155583 /usr/lib64/libpthread-2.28.so +7f01b8e19000-7f01b8e1d000 rw-p 00000000 00:00 0 +7f01b8e1d000-7f01b8e33000 r-xp 00000000 08:01 3155650 /usr/lib64/libz.so.1.2.11 +7f01b8e33000-7f01b9032000 ---p 00016000 08:01 3155650 /usr/lib64/libz.so.1.2.11 +7f01b9032000-7f01b9033000 r--p 00015000 08:01 3155650 /usr/lib64/libz.so.1.2.11 +7f01b9033000-7f01b9034000 rw-p 00000000 00:00 0 +7f01b9034000-7f01b905d000 r-xp 00000000 08:01 3155395 /usr/lib64/ld-2.28.so +7f01b9061000-7f01b9072000 r-xp 00000000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so +7f01b9072000-7f01b9073000 ---p 00011000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so +7f01b9073000-7f01b9074000 r--p 00011000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so +7f01b9074000-7f01b9075000 rw-p 00012000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so +7f01b9075000-7f01b9076000 r--p 00000000 08:01 3154699 /usr/lib/locale/C.utf8/LC_NUMERIC +7f01b9076000-7f01b9077000 r--p 00000000 08:01 3154702 /usr/lib/locale/C.utf8/LC_TIME +7f01b9077000-7f01b9078000 r--p 00000000 08:01 3154697 /usr/lib/locale/C.utf8/LC_MONETARY +7f01b9078000-7f01b9079000 r--p 00000000 08:01 3154696 /usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES +7f01b9079000-7f01b907a000 r--p 00000000 08:01 3154700 /usr/lib/locale/C.utf8/LC_PAPER +7f01b907a000-7f01b907b000 r--p 00000000 08:01 3154698 /usr/lib/locale/C.utf8/LC_NAME +7f01b907b000-7f01b907c000 r--p 00000000 08:01 3154690 /usr/lib/locale/C.utf8/LC_ADDRESS +7f01b907c000-7f01b907d000 r--p 00000000 08:01 3154701 /usr/lib/locale/C.utf8/LC_TELEPHONE +7f01b907d000-7f01b907e000 r--p 00000000 08:01 3154694 /usr/lib/locale/C.utf8/LC_MEASUREMENT +7f01b907e000-7f01b9085000 r--s 00000000 08:01 3155357 /usr/lib64/gconv/gconv-modules.cache +7f01b9085000-7f01b9086000 r--p 00000000 08:01 3154693 /usr/lib/locale/C.utf8/LC_IDENTIFICATION +7f01b9086000-7f01b90a0000 r--p 00000000 08:01 3154703 /usr/lib/locale/locale-archive +7f01b90a0000-7f01b90e6000 rw-p 00000000 00:00 0 +7f01b90e6000-7f01b90ed000 ---p 00000000 00:00 0 +7f01b90ed000-7f01b90f4000 r-xp 00000000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so +7f01b90f4000-7f01b90f5000 r--p 00006000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so +7f01b90f5000-7f01b90f6000 rw-p 00007000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so +7f01b90f6000-7f01b911a000 r-xp 00000000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so +7f01b911a000-7f01b911b000 r--p 00023000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so +7f01b911b000-7f01b911d000 rw-p 00024000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so +7f01b911d000-7f01b9125000 rw-s 00000000 08:01 3163742 /tmp/hsperfdata_root/98 +7f01b9125000-7f01b9140000 r-xp 00000000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so +7f01b9140000-7f01b9142000 r--p 0001a000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so +7f01b9142000-7f01b9143000 rw-p 0001c000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so +7f01b9143000-7f01b9147000 ---p 00000000 00:00 0 +7f01b9147000-7f01b9246000 rw-p 00000000 00:00 0 +7f01b9246000-7f01b9254000 r-xp 00000000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so +7f01b9254000-7f01b9255000 ---p 0000e000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so +7f01b9255000-7f01b9256000 r--p 0000e000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so +7f01b9256000-7f01b9257000 rw-p 0000f000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so +7f01b9257000-7f01b9259000 rw-p 00000000 00:00 0 +7f01b9259000-7f01b925a000 ---p 00000000 00:00 0 +7f01b925a000-7f01b925b000 r--p 00000000 00:00 0 +7f01b925b000-7f01b925c000 ---p 00000000 00:00 0 +7f01b925c000-7f01b925d000 r--p 00028000 08:01 3155395 /usr/lib64/ld-2.28.so +7f01b925d000-7f01b925e000 rw-p 00029000 08:01 3155395 /usr/lib64/ld-2.28.so +7f01b925e000-7f01b925f000 rw-p 00000000 00:00 0 +7fff92d75000-7fff92d96000 rw-p 00000000 00:00 0 [stack] +7fff92da2000-7fff92da5000 r--p 00000000 00:00 0 [vvar] +7fff92da5000-7fff92da7000 r-xp 00000000 00:00 0 [vdso] +ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] + + +VM Arguments: +java_command: /project/java-native/target/surefire/surefirebooter255261521587421006.jar /project/java-native/target/surefire 2020-10-01T00-29-55_633-jvmRun3 surefire15563279322398545368tmp surefire_13579138375161683305tmp +java_class_path (initial): /project/java-native/target/surefire/surefirebooter255261521587421006.jar +Launcher Type: SUN_STANDARD + +[Global flags] + intx CICompilerCount = 2 {product} {ergonomic} + size_t InitialHeapSize = 33554432 {product} {ergonomic} + size_t MaxHeapSize = 524288000 {product} {ergonomic} + size_t MaxNewSize = 174718976 {product} {ergonomic} + size_t MinHeapDeltaBytes = 196608 {product} {ergonomic} + size_t MinHeapSize = 8388608 {product} {ergonomic} + size_t NewSize = 11141120 {product} {ergonomic} + uintx NonNMethodCodeHeapSize = 5826188 {pd product} {ergonomic} + uintx NonProfiledCodeHeapSize = 122916026 {pd product} {ergonomic} + size_t OldSize = 22413312 {product} {ergonomic} + uintx ProfiledCodeHeapSize = 122916026 {pd product} {ergonomic} + uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} + bool SegmentedCodeCache = true {product} {ergonomic} + size_t SoftMaxHeapSize = 524288000 {manageable} {ergonomic} + bool UseCompressedClassPointers = true {lp64_product} {ergonomic} + bool UseCompressedOops = true {lp64_product} {ergonomic} + bool UseSerialGC = true {product} {ergonomic} + +Logging: +Log output configuration: + #0: stdout all=warning uptime,level,tags + #1: stderr all=off uptime,level,tags + +Environment Variables: +JAVA_HOME=/usr/java/openjdk-14 +PATH=/usr/java/openjdk-14/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +Signal Handlers: +SIGSEGV: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGBUS: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGFPE: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGPIPE: [libjvm.so+0xb1bca0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGXFSZ: [libjvm.so+0xb1bca0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGILL: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGUSR2: [libjvm.so+0xb1bb30], sa_mask[0]=00100000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO +SIGHUP: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGINT: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGTERM: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO +SIGQUIT: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO + + +--------------- S Y S T E M --------------- + +OS:Oracle Linux Server release 8.2 +uname:Linux 4.14.154-boot2docker #1 SMP Thu Nov 14 19:19:08 UTC 2019 x86_64 +OS uptime: 0 days 14:09 hours +libc:glibc 2.28 NPTL 2.28 +rlimit: STACK 8192k, CORE infinity, NPROC infinity, NOFILE 1048576, AS infinity, DATA infinity, FSIZE infinity +load average:3.31 1.71 0.93 + +/proc/meminfo: +MemTotal: 2045412 kB +MemFree: 1093300 kB +MemAvailable: 1371360 kB +Buffers: 84560 kB +Cached: 472628 kB +SwapCached: 0 kB +Active: 588744 kB +Inactive: 294936 kB +Active(anon): 402104 kB +Inactive(anon): 198736 kB +Active(file): 186640 kB +Inactive(file): 96200 kB +Unevictable: 0 kB +Mlocked: 0 kB +SwapTotal: 1415172 kB +SwapFree: 1415172 kB +Dirty: 676 kB +Writeback: 0 kB +AnonPages: 326512 kB +Mapped: 116960 kB +Shmem: 290620 kB +Slab: 42612 kB +SReclaimable: 27604 kB +SUnreclaim: 15008 kB +KernelStack: 4640 kB +PageTables: 2556 kB +NFS_Unstable: 0 kB +Bounce: 0 kB +WritebackTmp: 0 kB +CommitLimit: 2437876 kB +Committed_AS: 1765096 kB +VmallocTotal: 34359738367 kB +VmallocUsed: 0 kB +VmallocChunk: 0 kB +HugePages_Total: 0 +HugePages_Free: 0 +HugePages_Rsvd: 0 +HugePages_Surp: 0 +Hugepagesize: 2048 kB +DirectMap4k: 44992 kB +DirectMap2M: 2052096 kB + + +/proc/sys/kernel/threads-max (system-wide limit on the number of threads): +15537 + + +/proc/sys/vm/max_map_count (maximum number of memory map areas a process may have): +65530 + + +/proc/sys/kernel/pid_max (system-wide limit on number of process identifiers): +32768 + + + +container (cgroup) information: +container_type: cgroupv1 +cpu_cpuset_cpus: 0 +cpu_memory_nodes: 0 +active_processor_count: 1 +cpu_quota: no quota +cpu_period: 100000 +cpu_shares: no shares +memory_limit_in_bytes: unlimited +memory_and_swap_limit_in_bytes: unlimited +memory_soft_limit_in_bytes: unlimited +memory_usage_in_bytes: 348696576 +memory_max_usage_in_bytes: 387022848 + +KVM virtualization detected +Steal ticks since vm start: 0 +Steal ticks percentage since vm start: 0.000 + +CPU:total 1 (initial active 1) (1 cores per cpu, 1 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, lzcnt, tsc, tscinvbit +CPU Model and flags from /proc/cpuinfo: +model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm invpcid_single pti fsgsbase avx2 invpcid md_clear flush_l1d + +Memory: 4k page, physical 2045412k(1093300k free), swap 1415172k(1415172k free) + +vm_info: OpenJDK 64-Bit Server VM (14.0.2+12-46) for linux-amd64 JRE (14.0.2+12-46), built on Jul 8 2020 23:30:21 by "mach5one" with gcc 8.3.0 + +END. diff --git a/java-native/pom.xml b/java-native/pom.xml new file mode 100644 index 0000000000..29fc13b8d8 --- /dev/null +++ b/java-native/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + java-native + java-native + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + 5.6.0 + + + + + net.java.dev.jna + jna-platform + ${jna.version} + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + false + + + + + \ No newline at end of file diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp rename to java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h b/java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h rename to java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp rename to java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h b/java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h rename to java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h diff --git a/jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp rename to java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp diff --git a/jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h b/java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h rename to java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h diff --git a/jni/src/main/cpp/generateNativeLib.bat b/java-native/src/main/cpp/generateNativeLib.bat similarity index 100% rename from jni/src/main/cpp/generateNativeLib.bat rename to java-native/src/main/cpp/generateNativeLib.bat diff --git a/jni/src/main/cpp/generateNativeLib.sh b/java-native/src/main/cpp/generateNativeLib.sh old mode 100755 new mode 100644 similarity index 100% rename from jni/src/main/cpp/generateNativeLib.sh rename to java-native/src/main/cpp/generateNativeLib.sh diff --git a/jni/src/main/cpp/generateNativeLibMac.sh b/java-native/src/main/cpp/generateNativeLibMac.sh old mode 100755 new mode 100644 similarity index 100% rename from jni/src/main/cpp/generateNativeLibMac.sh rename to java-native/src/main/cpp/generateNativeLibMac.sh diff --git a/java-native/src/main/java/com/baeldung/jna/CMath.java b/java-native/src/main/java/com/baeldung/jna/CMath.java new file mode 100644 index 0000000000..3ab5bdf48b --- /dev/null +++ b/java-native/src/main/java/com/baeldung/jna/CMath.java @@ -0,0 +1,10 @@ +package com.baeldung.jna; + +import com.sun.jna.Library; +import com.sun.jna.Native; +import com.sun.jna.Platform; + +public interface CMath extends Library { + CMath INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c", CMath.class); + double cosh(double value); +} diff --git a/java-native/src/main/java/com/baeldung/jna/Main.java b/java-native/src/main/java/com/baeldung/jna/Main.java new file mode 100644 index 0000000000..a81c878cde --- /dev/null +++ b/java-native/src/main/java/com/baeldung/jna/Main.java @@ -0,0 +1,8 @@ +package com.baeldung.jna; + +public class Main { + + public static void main(String[] args) { + + } +} \ No newline at end of file diff --git a/java-native/src/main/java/com/baeldung/jna/NativeFS.java b/java-native/src/main/java/com/baeldung/jna/NativeFS.java new file mode 100644 index 0000000000..58f2bda035 --- /dev/null +++ b/java-native/src/main/java/com/baeldung/jna/NativeFS.java @@ -0,0 +1,46 @@ +package com.baeldung.jna; + +import java.util.Collections; +import java.util.Map; + +import com.sun.jna.FunctionMapper; +import com.sun.jna.LastErrorException; +import com.sun.jna.Library; +import com.sun.jna.Native; +import com.sun.jna.NativeLong; +import com.sun.jna.Platform; +import com.sun.jna.Structure; +import com.sun.jna.Structure.FieldOrder; + +public interface NativeFS extends Library { + + FunctionMapper mapper = (library,method) -> { + if (Platform.isWindows()) { + return "_" + method.getName(); + } + else { + return "__x" + method.getName(); // On Linux, stat is actually _xstat + } + }; + + public NativeFS INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c", + NativeFS.class, + Collections.singletonMap(Library.OPTION_FUNCTION_MAPPER, mapper)); + + int stat(String path, Stat stat) throws LastErrorException; + + @FieldOrder({"st_dev","st_ino","st_mode","st_nlink","st_uid","st_gid","st_rdev","st_size","st_atime","st_mtime","st_ctime"}) + public class Stat extends Structure { + public int st_dev; + public int st_ino; + public short st_mode; + public short st_nlink; + public short st_uid; + public short st_gid; + public int st_rdev; + public NativeLong st_size; + public NativeLong st_atime; + public NativeLong st_mtime; + public NativeLong st_ctime; + } +} diff --git a/java-native/src/main/java/com/baeldung/jna/StdC.java b/java-native/src/main/java/com/baeldung/jna/StdC.java new file mode 100644 index 0000000000..1adbe684c4 --- /dev/null +++ b/java-native/src/main/java/com/baeldung/jna/StdC.java @@ -0,0 +1,17 @@ +package com.baeldung.jna; + +import com.sun.jna.LastErrorException; +import com.sun.jna.Library; +import com.sun.jna.Native; +import com.sun.jna.Platform; +import com.sun.jna.Pointer; + +public interface StdC extends Library { + StdC INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c", StdC.class ); + Pointer malloc(long n); + void free(Pointer p); + Pointer memset(Pointer p, int c, long n); + int open(String path, int flags) throws LastErrorException; + int close(int fd) throws LastErrorException; +} + diff --git a/jni/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java b/java-native/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java similarity index 100% rename from jni/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java rename to java-native/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java diff --git a/jni/src/main/java/com/baeldung/jni/ExampleParametersJNI.java b/java-native/src/main/java/com/baeldung/jni/ExampleParametersJNI.java similarity index 100% rename from jni/src/main/java/com/baeldung/jni/ExampleParametersJNI.java rename to java-native/src/main/java/com/baeldung/jni/ExampleParametersJNI.java diff --git a/jni/src/main/java/com/baeldung/jni/HelloWorldJNI.java b/java-native/src/main/java/com/baeldung/jni/HelloWorldJNI.java similarity index 100% rename from jni/src/main/java/com/baeldung/jni/HelloWorldJNI.java rename to java-native/src/main/java/com/baeldung/jni/HelloWorldJNI.java diff --git a/jni/src/main/java/com/baeldung/jni/UserData.java b/java-native/src/main/java/com/baeldung/jni/UserData.java similarity index 100% rename from jni/src/main/java/com/baeldung/jni/UserData.java rename to java-native/src/main/java/com/baeldung/jni/UserData.java diff --git a/jni/src/main/resources/logback.xml b/java-native/src/main/resources/logback.xml similarity index 100% rename from jni/src/main/resources/logback.xml rename to java-native/src/main/resources/logback.xml diff --git a/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java b/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java new file mode 100644 index 0000000000..a9cc6ed1c4 --- /dev/null +++ b/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.jna; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +import com.sun.jna.Native; +import com.sun.jna.Platform; + +class CMathUnitTest { + @Test + void whenCallNative_thenSuccess() { + CMath lib = Native.load(Platform.isWindows() ? "msvcrt" : "c", CMath.class); + double result = lib.cosh(0); + assertEquals(1.0,result); + } + +} diff --git a/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java b/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java new file mode 100644 index 0000000000..d296f9e2ca --- /dev/null +++ b/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.jna; + +import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + +import org.junit.jupiter.api.Test; + +import com.baeldung.jna.NativeFS.Stat; +import com.sun.jna.LastErrorException; +import com.sun.jna.Platform; + +public class NativeFSUnitTest { + + + @Test + public void whenCallNative_thenSuccess() throws IOException { + NativeFS lib = NativeFS.INSTANCE; + + File f = Files.createTempFile("junit", ".bin").toFile(); + f.deleteOnExit(); + Stat stat = new Stat(); + try { + if (Platform.isWindows()) { + int rc = lib.stat(f.getAbsolutePath(), stat); + assertEquals(0, rc); + assertEquals(0,stat.st_size.longValue()); + } + } + catch(LastErrorException error) { + fail("stat failed: error code=" + error.getErrorCode()); + } + + } +} diff --git a/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java b/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java new file mode 100644 index 0000000000..c536fd63d5 --- /dev/null +++ b/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung.jna; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.BeforeClass; +import org.junit.jupiter.api.Test; + +import com.sun.jna.Native; +import com.sun.jna.Platform; +import com.sun.jna.Pointer; + +class StdCUnitTest { + + @BeforeClass + public static void setupProtectedMode() { + Native.setProtected(true); + } + + @Test + public void whenMalloc_thenSuccess() { + StdC lib = StdC.INSTANCE; + Pointer p = lib.malloc(1024); + p.setMemory(0l, 1024l, (byte) 0); + lib.free(p); + } + + @Test + public void whenAccessViolation_thenShouldThrowError() { + // Running this test on Linux requires additional setup using libjsig.so + // Details here: http://java-native-access.github.io/jna/5.6.0/javadoc/overview-summary.html#crash-protection + // IMPORTANT NOTICE: Code for illustration purposes only. DON'T DO THIS IN YOUR OWN CODE + if ( Platform.isWindows()) { + Error e = null; + Pointer p = new Pointer(0l); + + try { + p.setMemory(0, 100*1024, (byte) 0); + } + catch(Error err) { + e = err; + } + + assertNotNull(e, "Should throw Error"); + } + } + +} diff --git a/jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java b/java-native/src/test/java/com/baeldung/jni/JNINativeManualTest.java similarity index 100% rename from jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java rename to java-native/src/test/java/com/baeldung/jni/JNINativeManualTest.java diff --git a/jni/native/linux_x86_64/libnative.so b/jni/native/linux_x86_64/libnative.so deleted file mode 100755 index 213491e2688a87bdecd1fea411e578149f8e3f32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19856 zcmeHPe|%h3mA{iTZD>Oipe?0E7_fzg$~4m^ZD_ZWHkt5Jk`nSmBT!!_Gm~UOG81Rs zl(bq6hOmTe+Afvf)8NW(q2~8zDz_o@y$Qj7_pU zr*>(i20&6!R)^PZ5$M!h*KKcQ8(x|}G=0_6PrkY3&-1!mOJ90ppX*AJI}g{zxJb=B zTzAZ=>Yh`0|2gx|ec*=^x3~%^?|rx~!R5wvIj$ABD6ParN=gYqS}g$orS9$(D>@aJbRnUt`L zSfSS~IR!Y*?JQzPFBJHI%$<__B{u#Lx4(#WFBObo)SuEN(w-`54~=6=&r169G$9~u z5`aC;^)Jn`=N;J&B{n_xK<<3hcPBLn(mMjMJm{fzSSZ^^lk_goiT^vx1>r}M9+CDu zBK7}H(#O#bq-U*c{|ZU3ka~_wI{6KyUr0M&p#g{_A1CZVseiw$uj-cscu4;fvYl1? zFkSELjYjmi;g1=*&h&63Y%sk8fa!HD4SFyX3w4I$MkvVnC%gxY+ji+qQbTo*KOPUonSRsu4coTY`69b?@7nF5+nSA7IMUhLQtNBHKESs5 zclq@|v{!HUhkAmENT=Q%3F}&@rziU1Xsjm)Nj>i0%?YHc*s{OKkB0-O87Z#|G#g%TpvxcAjhH`d#3924NfM+N_hV?bkaN>R5{k-d1PYjH1a}Be#VkL3DUL(Tlz(w+h^<2fA+6 zJN)4ua<=|{y)P7tN69^m-TJOF-snbUI2uQX$3x|HaKKD&TIr$??qGf+)K8vja-|K| zg^aW-RimrXB$ax%aDc`x2gmaD`+NI(LXG~Izc&Ook8}S@^wvd;P$y8{GwA*7&d=2= zffn?7g-(7<&P3f3KCObKW4A;b(0k+!Etp*bH?(($0*0?~gWesW zsfuh*PgLdbF2NvGz_p@Wz{2JQTSLg`iU#XyGMeBIa(+qcTVL((=@AMAKX+E4vC&(m zcf%XGmOU2zWzb(6#>99M_2tdVT+VG)evRJUAv835c?+j)BB7dS0u%f!Lc!VnSyYLS zq5!5sBh(rX#ZFnI50kY)5;cCq&w9e`aU&R5z1kCxde##fNZ)k^FkcboWqK$`+`8T# zkBcW6NRc4BuDV)Z=P6^?)z@vU*4KK<(|2n<6|B0gZOhg=-RoH=$Zc(4F88eUno<66 zAG&XJGz6g;T;9lfg%R)C9g=%U}b_??H#b;^HK262CzuSpnl18=-y_X2vu`8jBm zT+sY=nNQE|Md9$d3}ydH(h|$U=g=GCYia&`_9dA|@-KYjR;&!>vUeoyW7A(iMe^BP zyhN2C-zfboUN!UBVtT1UQtz?q{j*H2dk)C=RYm`@Tu+SK=oicN%7l&nj9jlw+UO_b z`}%a5o0qTjD|~#7pi}j*1Wcz16CF#Ubec5Ll`hJhGSSgs>2$b9)J6(g zFLpC+Xxu1Bz6=l61`ifKC6vxod>UCZEAPN>@ugL`BfN_;Q%7cyR_-C3+&(qQ@fhLc zqN#C?cN0!SI`t^W+X<(koEqc!O@x!{ruK2XiEwhw)Bwk~5l$|d>f`uU!fD8-c5-|p z;WX4!jT~P~IJs)7isM%iPA-}%<;S<{TlhoQT}eI zqspX6<;>&`?jLmDj6u+*4exze8%~S`wUIe1S5eJ|eM#@QHtKs)8$O)818t{`wmu0Q zw2EipfJENG$%5q!>tv+)Nz9KLDkaQx0jvFC`D9Sq~?V(mgTwQ2tLz zWdFNFc}nOyoUG#vQ`$&FGN`R9;>H=9j+F}*Ze53Df$%&0HZ5F~$szlaA0T}2VB5_* zo}#Lw<|V^>-yKd&5AJ=}l~{ZG-szbcG=C}j^={aktS4JW7x$9wqZPLi7%AAWRMbsJ z=Dr_tMgK}-Ptr7y{4#aVQ~Q*9G%S27aRL>b)Iow+JMrEoafLWGm}CK%yBFJ z;nw5B4M`Nb8-pK(zCzuK3cmdgZ?6&GakMkq@^1+rtuTlS*)OZ?q{#lbz@gwPTmhG< zh2c=31tv#)No~L8lI1sRw;#WY_x;|xVDo@B{JDPAW_aSRAp_9v8zZBXi;CU#1cXpL z>T)<)%Dd0EA4bvY4JBVGO}|#zf=prE)rwNEAY%>vk+O?%Kkz*&oEeKbakPTg ziInF?LB}qT#QP+10hLZ(IMNCW8lZ$5_3GP_47q+)s1KFo9(M)hW<2gC!ORW#H=bql zzO~0zo7f))%P|aiayl;a1u28FdQevK+l1eKkXrT>{O$s@MDizpB6}DAVTqgkj#1-` z6g;^Y07`#@%#-<@TltYT+?vezp2mHTDCCh1@V|do&PUTgC8Va%^OKO8$m;IaNhm@# zZ?h(<)JW@uiF7UOI<|}&g0me?euio>42i?Z0B47^Wf&JE?2#c-w;)li!WwCFfm z^Z-P0`GE5#{4Zhg6iUGb^60r23VT*cdv*v8S=9z9OdfrJMqF}~%HwtB_Dq<^;r(0| zPFe9wEI;5rV;2bbIlzVflj`(!eoM3S2+!oR!zvP_iDB@dmgyG9c`~>N{h zxU^wkacS#Vap{gni%Ub}#ihNI#ifZO#ie^sn1w-gmPJXDT5da=UX zgC-oR1geb=H4+#eq7|SvGQ^GHkDjGu-RLNZYa_y}5n<#AH+cpFe`uAE65w-GB%ZsA z#B;YGdGrr6GucloKFe6z=>*omj_qW6&Sgthad)-1FdRtrep%XAFt^bRVd|a%F1**& zJv7PfouW~SVT{=hieMS7`!maY#&_G@9kFPyyL$C%_hpx%Nhtx@=x*r>xg&|*cI=kA zW1&DOyekxR`(q*ZMmKZ&BSCkDO>D+yxWaMpG{imliQxy^{%h2>{~B!juSstO)pz4q zU`>xd(z!T}ktTvqxbB#*M-e&VM*=6rQ3=Z+*UZiu3fh2 zs&y+aCwbzj!PSkr^L>ad3rp_It3G$`txzQM0hnt~V?8fn-n~P`ZnoT94wW_e=FH4H zfOF^|S?TZ%=I8xBqvvbL|9gy*I>0nfUJYj;JD#Bn`SjA0&Tq`f9|w6O+P=b^-@8g_-Y$W|_QBOKMob!H@o!Vf2{w=OF-<#l@hjNAh=Ui&yqxuMSyxl$l zJ=eo0oa*yM zWc2?9^4pRBJ9B7l`J2r0yE6K}i2M%ZYv%mC>a_mvBA=d* z&sy>)cs}*l&yfFPli!g!g>&Nx7NhiH(g!~%arTFZ{)GN^9peP`8;I5NI&2yS_|kasAqn_ zv*~OLoNa-#EpWC4&bGkW7C74iXIntDfI3H3=f>)sSe*;2b70k8SlaSLXW5h#PJ5hY zoX*ZE6$z03o>rY1w#o1F)LEE1-(D{H-4ZU7P@PZHx{?yT15x_Jdoxjj^xj8FE%mD8 zp{O*2J&ZLgC3Plxnao#bp|m+cNxr^ef$iqF6k}uZM!nZbasHl4jN^2|grw+g#R6A$ z@)I|Z=-`WzDi5!W-2MqV!9v331;>>gCnVl3^YJRn^Hsfs)c>Df_1(PPqR-32)`ukg zmV}2S{HcV$mhdeJ=gJ0OBHl3w@09TK5eK^@a6op-&^T(m>M5edI3{@W~I+%%0I32 zc})4am0p-04_12iclDH?k5M@w``gODfHlhYwbJq3Z%%slchN%sLe?ec8>^n;bR342 zUcw45GgHKUKE7nHrx##b%Ey<*YW^~3<+BTznzyX--nH$cx-uLn8*MeH1}8+V!K z+T*w<`){TVNhH3P0r)B|qO0eosvdp+Kb!vf4*Fk^4??AX3G|SD^*mPkKY9}V3mo(h z$_J;?e}mMop7TmS$T{sFLWT=prfD|+zlYPa{Q+un>iIj)kEfrsQ#~KC%Y&3X9-rg< z*?#`2)MJldpn1@h!~g%x>Dl9JE}rX`qn+*F;jfT%dmO=sCH;~2k-d!ZJvzY8fPOxw zSbrV_-EAdt>~RPB1lN;2k3Hw0{|(T|etUex5-cEc+0*GjzukfU5a_w=|A7Plyg9kc zy%BV>(;m+)0 zG|lxFF?-y{`BbgBdwj|xpi}$U<4~TLbbFl6 zpB(gSSm5Tee;=o3#|<3@oyxVx(Y)cHXA35TT>9y2*bx}K^^z8M_mmK(6AZEmkL`R1Qfe8Ax>L$IuuDJyPKACtP-RRW=6w!n4 z-1T5o@9c@gc9&FAo_p5Vk{H57=#Tx{A* z!5Yr-9H$>pV~QrR6iAT*6l>~1N>X`}onLU=r66a{`{L>0y%*`yP zqRfnoI5T>RA#k~h^ZmJHU}G8i$B%6m?DGB zQ_3j^H_aN0^*@MxwA4nq{h5VjT2##*|1?|dVa6Lz7T(BboYRf@!!*hR?JU;Had7%m zCA6tn+H8d~NDKa>0(LDt^fbr{4y~#(MQQyXgyC8&qGp)Yp>6$U3Ei|r!a}VKMU(N> zXEI%h@XRa=nJ2!x*YLLk8ZiO8)LkTMggl**gr_|b?g?HU4l<5)`Qu&86Wkqvq<}_D zd5FL53P>-Jkb^SwK@{xo4F@0>HK;&PDBjP5a6jh3Dzz6Y&+H}h z8Bu8e2(Jp*3lT}}e=4{_(iOn#p(W8i6Fx19DtWa}s^9_1jn`S8@OofLmB8qXK*_6f z1O@3sTuKCpN6D-G{VLE%w~|-;t_rGi2(a*kZ3;`$fYF(Nl2`k)X(+js{fbY)R^-ze zgTmE5u7dldJlRh=l>L&-g1Aw2BbwUpRZyL4sPdJ(s((bvZzW+Qbxxw-m^6&!X^YJ+ z-wztK30_BeQva7lLHo`n*=kO4AZB^B&#d62t-(vAu!5ho$*cWn1r?tvQ`xWZzqHA# z{ZR$q!uz5*+4YUuG zosRO9yxPy7Ghx$qK7>SLG`|`n0Wl zb&fE;1{p|I{5SKXEXLTS;S1PGjnp5-t!M8G|kPU*tHUGS%~xnXh{Lt+pV7!QF#OrxN7dg&!rE#WeWLZ?AP0}&A5)6`5w7-A*R zsK57izxyZIv5lFwGy2BgzJ0rI-@bkO_U(RePk!OeU%jY<)ss4J>R1I@+q4SY~GeN_oXcmcm0XU^$*FcR%<>o}mwi}@W}D=WUQ z>K$C6b9n1|tmBhy9W8oW$No+b74zG(PPROy7!ZCj`N&RcFcw{}+qQd~YDB=Xj|x>* zgp-|+?a@n*t{>>kGm{JQ^Ds3M@N?Qy5zXf+%BV-zJHmS8NPBZ;OIK%Ir{f@{{StyYc5)~MfM=%EsD zwZcg+3(tZE7BsM+fdvgLXkbAD3mRC^!2drDG-<}qwf=KenpyUu2S;FQ>8|$x7`?V; z#3nUkR5PBpxBey9bYXa!;hoWphH1_0otbT#20Eejk5uhF?S4-mjb8EdfCK1aOsAOy zy&xv8;24{({rC8)0%OXX-=>)}M(xj`EUVe`QXC?{*vN1_(r{ru z2SKQ&ip)4`vLC^xrM-hV8}UIj%vr5P=miWn{SB^z?Z#zpXaEIl!70kYh~r-boT?=; z3+#AnRuI!WX2Q6QcoLL`^$^jogyl)Qwi3YYC-D``roG5%cAOczpBdB46phq4&a2mq zvtAN}B+e#MpFx#orpd~V#|f$9COpk($yzp9%RVzsTDGOp$9s@>Y>BYErnv zsYa!&cmz&sDI0#~xtUQ)m4n6|@7?W&QOyViI+UF`t#1`0v?SpLKEtD96s4pE6_q-q!pRT01%CNRq3 z5MZ)PDS(lxrMmt%U=x1|wZaQXQQ{RSpZZ7G0*Xiw^v%+(hWCk&a{)^R>=gH+KulLHEIlNgpojjM3Q_wXJb#>^^os@wMW^)S1P$2~HkjILaG^ z)V3^vDrHaXF%7lPNdGws>!NWuESMpk5k^_Tva&$eyAY?6M%SNaJ-8n}k14BueHacz z7|%hR0g}q(+PdS?B8&#O-rm8wg!fz6IOrTOSa%$Gqk*>kF_e#@9QlR`)J>pl5^xgG z2DIyqH+*zzF|01|wjYKK!12OEr3rUG(==+AQ<>BEkhBiD`I%}Dv}#EWrUZuC3ey_v zChg}s35@g}i4kx=y`+EA)jtFOJ=97AGpv2o=P`;v!vF|@|4Bgn1jJ7QCIL?X;;pX$ z{T`4^QS>lN9^c0uSPTrc*GhmP$~p%9&$_^%N0u;fwqD5=9Em$QK=OVV9b2rKlA@-j z$*Qn68Ca9j#<(zRV_avZxQ=bii2F%kntSD4xB#|Cyxqr!Xe6*b$$E^yD0_HF3H`>o z#I!Q9eu9BDPC)J5qr{q&p;%}%0xO;%fI|rZ!(vQsnHMz1(fBbClL=2zfR&x(36vPt zqr}8YlO@^$S4C61P%p`mf%vlO=N07WiAg+T#Onav$8f}y<2JdV-*(~9#WjuSY3hDT z_?)#HISgVNbr5@o0DGMb<+2{&ht!>NSBfg@0S2UQPB2I%rHZ&PJ3Cxw%DMs%(96S! z_fTh+)hapl5E$hRMNWp?TFq3KtWPjV^${@n0H9?(fWv|q8u5LSQ#k-S%8me=5K5-% zQRLW$EgS5S4g9$VTw-c)w3bGdrbU&Sfsz9E4UCxLv`pL1-qTpsG>P^&PJe1QyNz&? z!*BPwA&s%ORE@(~VWZy&f`E4lVCyWT#`5oPTr$+D-A zB?%6N@GM&C6R6azA(|Px9rSVqT5&E{w!u3Qb|b@!od~bt#V&-GHwgYtK82m>6m}>a zvl|B8PcQ5LsjL4@3@6=1>@i+|?CwSg+D?LY5^b;<u?O4@}Ptr z{xGVgwqdoT3foQfhLvq$qG*M^b2auA%sKOqiG*b+WR6=45 z47J;+jU{!0>WuU$1}6t3C1WOkdE%^2iozL)Gy|RzON}u$#K0Julo$aV{-+5uhGt|T z0iTg7C%ZS&Ra|%8cpi)^x#lcp+Jl_^?Q3|lsFaF$oun8zM^|}*HBwcwj)B34+|l?A zC?i|xPg5@E5>@~+Eh@`*352stpbWbNn2A)L3|+vOd7Z$B3yeB%-NaWw((HmEzk|}k1ROE7j&|x@laiEW9-*jm~XolNBG-?W^_z9TlRseeueZU)Wjf<4*^4rmr zpde&Klo%=+GcYc8?sfP7#Dy;|G${x3><9_L2on%B0ktFn;bsaByaFW7fmf1Wl>;xa zg%TLBKZ^|jmCBGu46G>ESq!d=VvtPmIuw3@$P%HCFX$+X&{vN6^SUS%! zm0V7)*LhVTxK<6b%DJ6dv^1>S^4gyu_VV*lGW-lN#QsP$M@MK$f6VbaW}4dDzk-8M z9_Ab!ao&AidYHm^VgET#*1xcOL{#gaYuL9qQQ7kv1vkAmI};Cm%;&{l`_I*CR@q~; zuJYW}Ywl&_*D20>#vUMU6bvRDXB%6m0&DrFsFAhw2)D&4#;LwlR!3!ZOjg5+RqJ<2 zb{SQGc1@@xC-|)WKB|+1RGxXwUE!UymvAY1=pU)&!&`y;bI1Qc75GhKJm6V8_~Q8U zy!xA<{o#Tviu70L-x0Hh(L+y&j(&EUJT*ti=~ERNHR$v81rPu#}yz_+e^r=S(|Q`tuppu6nm>Pb+lWx(WE#=V-ut?t$QY2aS{%}MwW_v){XGdP)HkQ!uQ4KPqA>vRGb z4&i+aI0TDLr3)DLUv`DY&^~H#tOdh%S8_A=YQAM~S1MkXA3KM;Qgy&5ad)Na^&}mS z-IYp|P@lU}3D=%OL1i2Dmv--5h z5g*Luo_utKCU5U)``=KQoLzYzTF$QgYfeAT={`=IIc?!|Kc}sn9^^F4X$PlWoOW{> z<@7M8J)GXpDakjx@^3lqE}6p zg3~W>N_)rb$}e;J6{J4v-R+Bn*w#3^axY-A6$2Mjzra+sRsf%RnR2Ts_kGIMP;QKJ z2t|vjXDC-kxu+=CM!Bz3?itDrP_6!93G z%C%6A!pl?lQSMrJizzbc);lP72jzm4yNz;xN4fQsJ3~1##MU2E?ncVZP>#-wvycCi zDBTFjgpU$>C{vI3Bq3kJi_KA_@w&c+j_Ctj*w_gDHAZqxz9@RufN*6aG zSuM+j*g*|}FasZuRZa~g?{(oNJU8CAz?L7%P{TB_{2mhGpTyC}H34Kyj+1_)NYCu! z)1s6OV#ukWOafKoRIpr0{$b)y`v)=Ong)e@3D9*flB|3WRvA^fCfXNP8unRX&N!+PV zg6TNmvakxlxPb<`?2K!c-ar3CvFUP}uP&!l5bYCQ~ixHxNN=M>-974(qu@YE{k zhs^vy7xY}K;0+4is9>dn>lM6B!8;W6D|nxRq+fbk6yBj=kAhv82YN`~^gO7_A5!o! z1)o=PPbm0P1!b#+bU_0P8d%W4f(8~eu%Lkj4J>G2K?4gKSkSC}zbc3!} zZwz+EqF&KAL9se|T*%9J3^n<~0AQJKK3^s1iAykd*B1>Jp4e_JkUCjqW z!Dx=0ySr~!jtV>*LebXF`Ir`QT)!*yNf`=i+I@!?9Tzj(2xhXw?IfDlU!x!FWC7+- zHin{gow4R{hzFEM>EEIs+%E^&GG8mn|01m#tM%e`o3{tTVcAfQHNU^=D*a%)(!l-2 zEpNeyvP0h98t9gTl94rkYZ3XDJ75cH=vnPZi>R&+qO~6F4zxuhnELAK&>{RU1NdJM zU<%&0Hqlp+Zz9Fy8$zA?y@yqI^K;xB4s{%ew&u-?q+7pH*Slg-7;vCF5R8Vp^+@PY zEQB~-eQ;N!Ufh${>%E7HH#7$#Z9%;gLk$Jm>v!wBt8}lo@fO{`vvH%|F8ciW@`fYz zm(DA=n>cL-r=aM=TFR}PuJHUaf%g_nVP`N9?d*p3@KAT_rHpbmq=>t#!TX+_jax|0 z&9DS^B!{YKB{#|c+u@#2B!>8AQXERS#F6+A4Wn^tdy4Kwy2I93O(4_5oyDosdvNec6WYKYUsrL?KcI(p+L9yAoV{eNgAVD z;Kth9@Sk;rc+m}WxgP8Z=*^)6Z5=xNL=esycAl$&spiVZN{Y7j{eiYHH5jLg_E0-S zCUk;O_!szAptvB=MVTnM6E`CmMLPy1uTOMbpXlOd?Ej)cl<>{XM?1U2E!esBNZ<$; z2+i9QXzvP##8*m7#lVfY1(8ldG&{So_*JP`bj7apm6AV_tADkmc#{xQC0E~7KU!A0 zX!=G`x@i0++~DMIXQ|RT+vVp=)t30hQZ)DgS`E}7$<#oter$Bu(Q%w&{fjfDa_?tU z;P$vA)?VKc4IKc5_*to%pWU4eAz@=`#=%HTZULieacoi1p8i~!Sp0T}f=9~co|HaU zRxL)$E_Q-Dws@m37GK6u<iRZX#XQh5s0dZ|V3>FTSKy zWbPzF9|-3^8_t$p>@@fY`pfu;LjySA04Kh=_`(Oi<4Z)zC7soNxA+ncf_>iPtn~{ zj%#RFAKxcZQLn=3K9QbZE4)J8vt5JR?|0x@neHCxd6&ZJ4w9Y^DV**i>G>;#)14$e zcPpIkCh4L3PdBc4Yt_BrW`z%^d%<>v)4e7=U&BlEeudNhJK=OsO3!u3yD=W;{&ADS zoqNc874Fq^Q)Sq*YA6EE)holkWb56aw-+W5p z&i&;p3U}@?F{jMWxzAjsaOWQKGYWU^9nUJ;wu>M*NX7( z6yax!@c$^ne=YH>eoL`F^7Z}BBK*c8d{q%nKUZCf7k?fi$b{*-8Q1Uve^4Uu_c7uI zytEYQr#aXt1^sap{-&1y|0(*v!8~|x!uwvl@56gD-j#S);e9{eO1!J_(w}(K5~XEG zOOO6+mX^>uyj6Is@ovDo2`{Zd`l$h3QLo2KKd-q3FP_@}tMYn;KL1%n9X0ayy}YgA zlG_ySAQx{|wCUz=s+ZL;Z)?6ly9*qz=qu7WNL@5kQb2ftC`lpB#dgI4%DMY~LG?xA zBZYLA79E+>=92c?f>xJt+$d=Gc1NIm;-V82RjIGzw~L8fm{cA9E=-Vre9Te(kq*eY z4zBp{o?~(K57xzz59;d@LLPZ!*{``=tRp9IQ5a_4FX^`na$GHLh;IDBtn$Mee>k&T zJmU}L#UI*vOfDyaakQI#e - - 4.0.0 - jni - jni - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 065d6abbdd..bd73fcbf5e 100644 --- a/pom.xml +++ b/pom.xml @@ -465,7 +465,7 @@ jjwt jmeter jmh - jni + java-native jooby jsf json @@ -1502,4 +1502,4 @@ 1.4.197 - \ No newline at end of file + From 0e9ec5c2da96c35911ccbe2213d7b42255c82a0c Mon Sep 17 00:00:00 2001 From: Philippe Date: Wed, 30 Sep 2020 21:57:08 -0300 Subject: [PATCH 0853/1862] [BAEL-4203] JNA --- apache-bookkeeper/data/zk/myid | 1 - java-native/core | 0 java-native/hs_err_pid100.log | 793 --------------------------------- java-native/hs_err_pid98.log | 789 -------------------------------- 4 files changed, 1583 deletions(-) delete mode 100644 apache-bookkeeper/data/zk/myid delete mode 100644 java-native/core delete mode 100644 java-native/hs_err_pid100.log delete mode 100644 java-native/hs_err_pid98.log diff --git a/apache-bookkeeper/data/zk/myid b/apache-bookkeeper/data/zk/myid deleted file mode 100644 index d00491fd7e..0000000000 --- a/apache-bookkeeper/data/zk/myid +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/java-native/core b/java-native/core deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/java-native/hs_err_pid100.log b/java-native/hs_err_pid100.log deleted file mode 100644 index c05a3fad99..0000000000 --- a/java-native/hs_err_pid100.log +++ /dev/null @@ -1,793 +0,0 @@ -# -# A fatal error has been detected by the Java Runtime Environment: -# -# SIGSEGV (0xb) at pc=0x00007f7ecd45c090, pid=100, tid=115 -# -# JRE version: OpenJDK Runtime Environment (14.0.2+12) (build 14.0.2+12-46) -# Java VM: OpenJDK 64-Bit Server VM (14.0.2+12-46, mixed mode, sharing, tiered, compressed oops, serial gc, linux-amd64) -# Problematic frame: -# C [libc.so.6+0x15e090] __memset_avx2_unaligned_erms+0x60 -# -# Core dump will be written. Default location: /project/java-native/core -# -# If you would like to submit a bug report, please visit: -# https://bugreport.java.com/bugreport/crash.jsp -# The crash happened outside the Java Virtual Machine in native code. -# See problematic frame for where to report the bug. -# - ---------------- S U M M A R Y ------------ - -Command Line: /project/java-native/target/surefire/surefirebooter15072611568838389395.jar /project/java-native/target/surefire 2020-10-01T00-09-53_430-jvmRun2 surefire3272641396836511080tmp surefire_29468511371192344687tmp - -Host: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz, 1 cores, 1G, Oracle Linux Server release 8.2 -Time: Thu Oct 1 00:10:23 2020 UTC elapsed time: 13 seconds (0d 0h 0m 13s) - ---------------- T H R E A D --------------- - -Current thread (0x00007f7ec4028800): JavaThread "main" [_thread_in_native, id=115, stack(0x00007f7ecde0a000,0x00007f7ecdf0b000)] - -Stack: [0x00007f7ecde0a000,0x00007f7ecdf0b000], sp=0x00007f7ecdf07788, free space=1013k -Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) -C [libc.so.6+0x15e090] __memset_avx2_unaligned_erms+0x60 -j com.sun.jna.Native.setMemory(Lcom/sun/jna/Pointer;JJJB)V+0 -j com.sun.jna.Pointer.setMemory(JJB)V+9 -j com.baeldung.jna.StdCUnitTest.whenAccessViolation_thenShouldThrowError()V+17 -v ~StubRoutines::call_stub -V [libjvm.so+0x78e42b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2fb -V [libjvm.so+0xbb0efb] invoke(InstanceKlass*, methodHandle const&, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*) [clone .constprop.117]+0x85b -V [libjvm.so+0xbb19cd] Reflection::invoke_method(oopDesc*, Handle, objArrayHandle, Thread*)+0xfd -V [libjvm.so+0x83b8e3] JVM_InvokeMethod+0xf3 -j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.2 -j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.2 -j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.2 -j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.2 -j org.junit.platform.commons.util.ReflectionUtils.invokeMethod(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+41 -j org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/extension/ExtensionRegistry;)Ljava/lang/Object;+32 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;)V+24 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$232.execute()V+12 -j org.junit.jupiter.engine.execution.ThrowableCollector.execute(Lorg/junit/jupiter/api/function/Executable;)V+1 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)V+21 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;+44 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;+6 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+35 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 -j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 -j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 -j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 -j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 -j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 -j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 -j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 -j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 -j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 -j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 -j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 -j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 -j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 -j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 -j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 -j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute()V+23 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(Lorg/junit/platform/engine/ExecutionRequest;)V+13 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/engine/TestEngine;Lorg/junit/platform/engine/ExecutionRequest;)V+2 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/core/Root;Lorg/junit/platform/engine/ConfigurationParameters;[Lorg/junit/platform/launcher/TestExecutionListener;)V+101 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;[Lorg/junit/platform/launcher/TestExecutionListener;)V+36 -j org.junit.platform.surefire.provider.JUnitPlatformProvider.invokeAllTests(Lorg/apache/maven/surefire/util/TestsToRun;)Lorg/apache/maven/surefire/suite/RunResult;+55 -j org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(Ljava/lang/Object;)Lorg/apache/maven/surefire/suite/RunResult;+31 -j org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(Lorg/apache/maven/surefire/booter/ForkingReporterFactory;)Lorg/apache/maven/surefire/suite/RunResult;+9 -j org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess()Lorg/apache/maven/surefire/suite/RunResult;+7 -j org.apache.maven.surefire.booter.ForkedBooter.execute()V+1 -j org.apache.maven.surefire.booter.ForkedBooter.main([Ljava/lang/String;)V+35 -v ~StubRoutines::call_stub -V [libjvm.so+0x78e42b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2fb -V [libjvm.so+0x80d2e3] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.125] [clone .constprop.264]+0x193 -V [libjvm.so+0x80f338] jni_CallStaticVoidMethod+0x108 -C [libjli.so+0x4647] JavaMain+0xcd7 -C [libjli.so+0x85a9] ThreadJavaMain+0x9 - -Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) -j com.sun.jna.Native.setMemory(Lcom/sun/jna/Pointer;JJJB)V+0 -j com.sun.jna.Pointer.setMemory(JJB)V+9 -j com.baeldung.jna.StdCUnitTest.whenAccessViolation_thenShouldThrowError()V+17 -v ~StubRoutines::call_stub -j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.2 -j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.2 -j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.2 -j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.2 -j org.junit.platform.commons.util.ReflectionUtils.invokeMethod(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+41 -j org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/extension/ExtensionRegistry;)Ljava/lang/Object;+32 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;)V+24 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$232.execute()V+12 -j org.junit.jupiter.engine.execution.ThrowableCollector.execute(Lorg/junit/jupiter/api/function/Executable;)V+1 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)V+21 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;+44 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;+6 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+35 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 -j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 -j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 -j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 -j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 -j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 -j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 -j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 -j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 -j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 -j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 -j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 -j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 -j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 -j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 -j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 -j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute()V+23 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(Lorg/junit/platform/engine/ExecutionRequest;)V+13 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/engine/TestEngine;Lorg/junit/platform/engine/ExecutionRequest;)V+2 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/core/Root;Lorg/junit/platform/engine/ConfigurationParameters;[Lorg/junit/platform/launcher/TestExecutionListener;)V+101 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;[Lorg/junit/platform/launcher/TestExecutionListener;)V+36 -j org.junit.platform.surefire.provider.JUnitPlatformProvider.invokeAllTests(Lorg/apache/maven/surefire/util/TestsToRun;)Lorg/apache/maven/surefire/suite/RunResult;+55 -j org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(Ljava/lang/Object;)Lorg/apache/maven/surefire/suite/RunResult;+31 -j org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(Lorg/apache/maven/surefire/booter/ForkingReporterFactory;)Lorg/apache/maven/surefire/suite/RunResult;+9 -j org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess()Lorg/apache/maven/surefire/suite/RunResult;+7 -j org.apache.maven.surefire.booter.ForkedBooter.execute()V+1 -j org.apache.maven.surefire.booter.ForkedBooter.main([Ljava/lang/String;)V+35 -v ~StubRoutines::call_stub - -siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000 - -Register to memory mapping: - -RAX=0x0 is NULL -RBX={method} {0x00007f7ecb469628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' -RCX=0x0000000000000080 is an unknown value -RDX=0x0000000000019000 is an unknown value -RSP=0x00007f7ecdf07788 is pointing into the stack for thread: 0x00007f7ec4028800 -RBP=0x00007f7ecdf077c0 is pointing into the stack for thread: 0x00007f7ec4028800 -RSI=0x0 is NULL -RDI=0x0 is NULL -R8 =0x0 is NULL -R9 =0x0000000000019000 is an unknown value -R10=0x0000000000000009 is an unknown value -R11=0x00007f7ecd45bfd0: in /lib64/libc.so.6 at 0x00007f7ecd2fe000 -R12=0x0 is NULL -R13={method} {0x00007f7ecb469628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' -R14=0x00007f7ecdf078b8 is pointing into the stack for thread: 0x00007f7ec4028800 -R15=0x00007f7ec4028800 is a thread - - -Registers: -RAX=0x0000000000000000, RBX=0x00007f7ecb469628, RCX=0x0000000000000080, RDX=0x0000000000019000 -RSP=0x00007f7ecdf07788, RBP=0x00007f7ecdf077c0, RSI=0x0000000000000000, RDI=0x0000000000000000 -R8 =0x0000000000000000, R9 =0x0000000000019000, R10=0x0000000000000009, R11=0x00007f7ecd45bfd0 -R12=0x0000000000000000, R13=0x00007f7ecb469628, R14=0x00007f7ecdf078b8, R15=0x00007f7ec4028800 -RIP=0x00007f7ecd45c090, EFLAGS=0x0000000000010202, CSGSFS=0x002b000000000033, ERR=0x0000000000000006 - TRAPNO=0x000000000000000e - -Top of Stack: (sp=0x00007f7ecdf07788) -0x00007f7ecdf07788: 00007f7ec9756e8d 00007f7ecb469628 -0x00007f7ecdf07798: 00007f7ec4028b10 0000000000000000 -0x00007f7ecdf077a8: 0000000000019000 0000000000000000 -0x00007f7ecdf077b8: 0000000000000000 00007f7ecdf07860 - -Instructions: (pc=0x00007f7ecd45c090) -0x00007f7ecd45bf90: f3 0f 1e fa 48 39 d1 0f 82 53 d9 fa ff 0f 1f 00 -0x00007f7ecd45bfa0: f3 0f 1e fa 48 c1 e2 02 c5 f9 6e c6 48 89 f8 c4 -0x00007f7ecd45bfb0: e2 7d 58 c0 eb 2a 66 2e 0f 1f 84 00 00 00 00 00 -0x00007f7ecd45bfc0: f3 0f 1e fa 48 39 d1 0f 82 23 d9 fa ff 0f 1f 00 -0x00007f7ecd45bfd0: f3 0f 1e fa c5 f9 6e c6 48 89 f8 c4 e2 7d 78 c0 -0x00007f7ecd45bfe0: 48 83 fa 20 0f 82 04 01 00 00 48 83 fa 40 77 77 -0x00007f7ecd45bff0: c5 fe 7f 44 17 e0 c5 fe 7f 07 c5 f8 77 c3 66 90 -0x00007f7ecd45c000: f3 0f 1e fa c5 f8 77 48 89 d1 40 0f b6 c6 48 89 -0x00007f7ecd45c010: fa f3 aa 48 89 d0 c3 66 0f 1f 84 00 00 00 00 00 -0x00007f7ecd45c020: f3 0f 1e fa 48 39 d1 0f 82 c3 d8 fa ff 0f 1f 00 -0x00007f7ecd45c030: f3 0f 1e fa c5 f9 6e c6 48 89 f8 c4 e2 7d 78 c0 -0x00007f7ecd45c040: 48 83 fa 20 0f 82 a4 00 00 00 48 83 fa 40 77 0e -0x00007f7ecd45c050: c5 fe 7f 44 17 e0 c5 fe 7f 07 c5 f8 77 c3 48 81 -0x00007f7ecd45c060: fa 00 08 00 00 77 9d 48 81 fa 80 00 00 00 77 19 -0x00007f7ecd45c070: c5 fe 7f 07 c5 fe 7f 47 20 c5 fe 7f 44 17 e0 c5 -0x00007f7ecd45c080: fe 7f 44 17 c0 c5 f8 77 c3 48 8d 8f 80 00 00 00 -0x00007f7ecd45c090: c5 fe 7f 07 48 83 e1 80 c5 fe 7f 44 17 e0 c5 fe -0x00007f7ecd45c0a0: 7f 47 20 c5 fe 7f 44 17 c0 c5 fe 7f 47 40 c5 fe -0x00007f7ecd45c0b0: 7f 44 17 a0 c5 fe 7f 47 60 c5 fe 7f 44 17 80 48 -0x00007f7ecd45c0c0: 01 fa 48 83 e2 80 48 39 d1 74 ba c5 fd 7f 01 c5 -0x00007f7ecd45c0d0: fd 7f 41 20 c5 fd 7f 41 40 c5 fd 7f 41 60 48 81 -0x00007f7ecd45c0e0: c1 80 00 00 00 48 39 ca 75 e1 c5 f8 77 c3 80 fa -0x00007f7ecd45c0f0: 10 73 1c c4 e1 f9 7e c1 80 fa 08 73 20 80 fa 04 -0x00007f7ecd45c100: 73 27 80 fa 01 77 2c 72 02 88 0f c5 f8 77 c3 c5 -0x00007f7ecd45c110: fa 7f 44 17 f0 c5 fa 7f 07 c5 f8 77 c3 48 89 4c -0x00007f7ecd45c120: 17 f8 48 89 0f c5 f8 77 c3 89 4c 17 fc 89 0f c5 -0x00007f7ecd45c130: f8 77 c3 66 89 4c 17 fe 66 89 0f c5 f8 77 c3 90 -0x00007f7ecd45c140: f3 0f 1e fa 48 c1 e2 02 48 83 fa 20 0f 82 3e 01 -0x00007f7ecd45c150: 00 00 c5 fe 6f 16 c5 ed 76 17 c5 fd d7 c2 83 e8 -0x00007f7ecd45c160: ff 0f 85 e9 00 00 00 48 83 fa 40 0f 86 c0 00 00 -0x00007f7ecd45c170: 00 c5 fd 76 c0 48 81 fa 00 01 00 00 0f 87 9e 01 -0x00007f7ecd45c180: 00 00 48 81 fa 80 00 00 00 0f 82 28 02 00 00 c5 - - -Stack slot to memory mapping: -stack at sp + 0 slots: 0x00007f7ec9756e8d: Java_com_sun_jna_Native_setMemory+0x00000000000000bd in /root/.cache/JNA/temp/jna17886832672380520920.tmp at 0x00007f7ec9750000 -stack at sp + 1 slots: {method} {0x00007f7ecb469628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' -stack at sp + 2 slots: 0x00007f7ec4028b10 points into unknown readable memory: 80 b8 24 cd 7e 7f 00 00 -stack at sp + 3 slots: 0x0 is NULL -stack at sp + 4 slots: 0x0000000000019000 is an unknown value -stack at sp + 5 slots: 0x0 is NULL -stack at sp + 6 slots: 0x0 is NULL -stack at sp + 7 slots: 0x00007f7ecdf07860 is pointing into the stack for thread: 0x00007f7ec4028800 - - ---------------- P R O C E S S --------------- - -Threads class SMR info: -_java_thread_list=0x00007f7ec41c0640, length=12, elements={ -0x00007f7ec4028800, 0x00007f7ec40a2000, 0x00007f7ec40a3800, 0x00007f7ec40ad000, -0x00007f7ec40af000, 0x00007f7ec40b1000, 0x00007f7ec40b3000, 0x00007f7ec40b5000, -0x00007f7ec40ef800, 0x00007f7ec40f4800, 0x00007f7ec4188000, 0x00007f7ec41bf000 -} - -Java Threads: ( => current thread ) -=>0x00007f7ec4028800 JavaThread "main" [_thread_in_native, id=115, stack(0x00007f7ecde0a000,0x00007f7ecdf0b000)] - 0x00007f7ec40a2000 JavaThread "Reference Handler" daemon [_thread_blocked, id=121, stack(0x00007f7ecab9d000,0x00007f7ecac9e000)] - 0x00007f7ec40a3800 JavaThread "Finalizer" daemon [_thread_blocked, id=124, stack(0x00007f7ecaa9c000,0x00007f7ecab9d000)] - 0x00007f7ec40ad000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=125, stack(0x00007f7eca2a7000,0x00007f7eca3a8000)] - 0x00007f7ec40af000 JavaThread "Service Thread" daemon [_thread_blocked, id=128, stack(0x00007f7eca1a6000,0x00007f7eca2a7000)] - 0x00007f7ec40b1000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=132, stack(0x00007f7eca0a5000,0x00007f7eca1a6000)] - 0x00007f7ec40b3000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=135, stack(0x00007f7ec9fa4000,0x00007f7eca0a5000)] - 0x00007f7ec40b5000 JavaThread "Sweeper thread" daemon [_thread_blocked, id=137, stack(0x00007f7ec9ea3000,0x00007f7ec9fa4000)] - 0x00007f7ec40ef800 JavaThread "Notification Thread" daemon [_thread_blocked, id=146, stack(0x00007f7ec9da2000,0x00007f7ec9ea3000)] - 0x00007f7ec40f4800 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=148, stack(0x00007f7ec9b9f000,0x00007f7ec9ca0000)] - 0x00007f7ec4188000 JavaThread "surefire-forkedjvm-command-thread" daemon [_thread_in_native, id=151, stack(0x00007f7ec9a87000,0x00007f7ec9b88000)] - 0x00007f7ec41bf000 JavaThread "surefire-forkedjvm-ping-30s" daemon [_thread_blocked, id=154, stack(0x00007f7ec9979000,0x00007f7ec9a7a000)] - -Other Threads: - 0x00007f7ec409e800 VMThread "VM Thread" [stack: 0x00007f7ecaca0000,0x00007f7ecada0000] [id=118] - 0x00007f7ec40f2000 WatcherThread [stack: 0x00007f7ec9ca2000,0x00007f7ec9da2000] [id=147] - -Threads with active compile tasks: - -VM state:not at safepoint (normal execution) - -VM Mutex/Monitor currently owned by a thread: None - -Heap address: 0x00000000e0c00000, size: 500 MB, Compressed Oops mode: 32-bit -Narrow klass base: 0x0000000800000000, Narrow klass shift: 3 -Compressed class space size: 1073741824 Address: 0x0000000800b11000 - -Heap: - def new generation total 9792K, used 7588K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) - eden space 8704K, 74% used [0x00000000e0c00000, 0x00000000e1259340, 0x00000000e1480000) - from space 1088K, 100% used [0x00000000e1590000, 0x00000000e16a0000, 0x00000000e16a0000) - to space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) - tenured generation total 21888K, used 1321K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) - the space 21888K, 6% used [0x00000000eb2a0000, 0x00000000eb3ea620, 0x00000000eb3ea800, 0x00000000ec800000) - Metaspace used 4998K, capacity 7071K, committed 7296K, reserved 1056768K - class space used 637K, capacity 881K, committed 896K, reserved 1048576K - -Card table byte_map: [0x00007f7ecb723000,0x00007f7ecb81e000] _byte_map_base: 0x00007f7ecb01d000 - -Polling page: 0x00007f7ecdf20000 - -Metaspace: - -Usage: - Non-class: 6.04 MB capacity, 4.26 MB ( 70%) used, 1.76 MB ( 29%) free+waste, 30.81 KB ( <1%) overhead. - Class: 881.00 KB capacity, 637.46 KB ( 72%) used, 226.48 KB ( 26%) free+waste, 17.06 KB ( 2%) overhead. - Both: 6.91 MB capacity, 4.88 MB ( 71%) used, 1.98 MB ( 29%) free+waste, 47.88 KB ( <1%) overhead. - -Virtual space: - Non-class space: 8.00 MB reserved, 6.25 MB ( 78%) committed - Class space: 1.00 GB reserved, 896.00 KB ( <1%) committed - Both: 1.01 GB reserved, 7.12 MB ( <1%) committed - -Chunk freelists: - Non-Class: 34.00 KB - Class: 11.00 KB - Both: 45.00 KB - -MaxMetaspaceSize: unlimited -CompressedClassSpaceSize: 1.00 GB - -CodeHeap 'non-profiled nmethods': size=120036Kb used=272Kb max_used=272Kb free=119763Kb - bounds [0x00007f7eb419c000, 0x00007f7eb440c000, 0x00007f7ebb6d5000] -CodeHeap 'profiled nmethods': size=120032Kb used=1610Kb max_used=1610Kb free=118421Kb - bounds [0x00007f7eacc64000, 0x00007f7eaced4000, 0x00007f7eb419c000] -CodeHeap 'non-nmethods': size=5692Kb used=1155Kb max_used=1170Kb free=4536Kb - bounds [0x00007f7eac6d5000, 0x00007f7eac945000, 0x00007f7eacc64000] - total_blobs=1295 nmethods=879 adapters=332 - compilation: enabled - stopped_count=0, restarted_count=0 - full_count=0 - -Compilation events (20 events): -Event: 12.944 Thread 0x00007f7ec40b3000 876 ! 3 jdk.internal.loader.BuiltinClassLoader::findClassOnClassPathOrNull (64 bytes) -Event: 12.955 Thread 0x00007f7ec40b3000 nmethod 876 0x00007f7eacdf1a90 code [0x00007f7eacdf1e00, 0x00007f7eacdf3260] -Event: 12.963 Thread 0x00007f7ec40b3000 877 ! 3 java.util.zip.ZipFile$ZipFileInflaterInputStream::close (67 bytes) -Event: 12.969 Thread 0x00007f7ec40b3000 nmethod 877 0x00007f7eacdf3a90 code [0x00007f7eacdf3c80, 0x00007f7eacdf4390] -Event: 12.969 Thread 0x00007f7ec40b3000 878 3 java.util.ArrayDeque::add (7 bytes) -Event: 12.969 Thread 0x00007f7ec40b3000 nmethod 878 0x00007f7eacdf4690 code [0x00007f7eacdf4820, 0x00007f7eacdf4980] -Event: 12.969 Thread 0x00007f7ec40b3000 879 3 java.util.ArrayDeque::addLast (51 bytes) -Event: 12.974 Thread 0x00007f7ec40b3000 nmethod 879 0x00007f7eacdf4a10 code [0x00007f7eacdf4be0, 0x00007f7eacdf5090] -Event: 12.982 Thread 0x00007f7ec40b3000 880 3 java.util.zip.ZipFile$InflaterCleanupAction::run (12 bytes) -Event: 12.982 Thread 0x00007f7ec40b3000 nmethod 880 0x00007f7eacdf5210 code [0x00007f7eacdf53a0, 0x00007f7eacdf5500] -Event: 12.982 Thread 0x00007f7ec40b3000 881 ! 3 java.util.zip.ZipFile$CleanableResource::releaseInflater (53 bytes) -Event: 12.986 Thread 0x00007f7ec40b3000 nmethod 881 0x00007f7eacdf5610 code [0x00007f7eacdf57e0, 0x00007f7eacdf5d00] -Event: 12.986 Thread 0x00007f7ec40b3000 882 ! 3 java.util.zip.Inflater::reset (64 bytes) -Event: 12.991 Thread 0x00007f7ec40b3000 nmethod 882 0x00007f7eacdf5f10 code [0x00007f7eacdf60c0, 0x00007f7eacdf64b0] -Event: 12.993 Thread 0x00007f7ec40b1000 884 4 java.lang.Object:: (1 bytes) -Event: 12.995 Thread 0x00007f7ec40b1000 nmethod 884 0x00007f7eb41dfd90 code [0x00007f7eb41dff00, 0x00007f7eb41dffb8] -Event: 13.004 Thread 0x00007f7ec40b3000 885 3 sun.net.www.protocol.jar.Handler::checkNestedProtocol (18 bytes) -Event: 13.005 Thread 0x00007f7ec40b3000 nmethod 885 0x00007f7eacdf6690 code [0x00007f7eacdf6840, 0x00007f7eacdf6a20] -Event: 13.116 Thread 0x00007f7ec40b1000 886 4 java.lang.Math::min (11 bytes) -Event: 13.117 Thread 0x00007f7ec40b1000 nmethod 886 0x00007f7eb41e0090 code [0x00007f7eb41e0200, 0x00007f7eb41e0258] - -GC Heap History (2 events): -Event: 7.487 GC heap before -{Heap before GC invocations=0 (full 0): - def new generation total 9792K, used 8704K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) - eden space 8704K, 100% used [0x00000000e0c00000, 0x00000000e1480000, 0x00000000e1480000) - from space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) - to space 1088K, 0% used [0x00000000e1590000, 0x00000000e1590000, 0x00000000e16a0000) - tenured generation total 21888K, used 0K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) - the space 21888K, 0% used [0x00000000eb2a0000, 0x00000000eb2a0000, 0x00000000eb2a0200, 0x00000000ec800000) - Metaspace used 3048K, capacity 5805K, committed 6016K, reserved 1056768K - class space used 360K, capacity 627K, committed 640K, reserved 1048576K -} -Event: 7.606 GC heap after -{Heap after GC invocations=1 (full 0): - def new generation total 9792K, used 1088K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) - eden space 8704K, 0% used [0x00000000e0c00000, 0x00000000e0c00000, 0x00000000e1480000) - from space 1088K, 100% used [0x00000000e1590000, 0x00000000e16a0000, 0x00000000e16a0000) - to space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) - tenured generation total 21888K, used 1321K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) - the space 21888K, 6% used [0x00000000eb2a0000, 0x00000000eb3ea620, 0x00000000eb3ea800, 0x00000000ec800000) - Metaspace used 3048K, capacity 5805K, committed 6016K, reserved 1056768K - class space used 360K, capacity 627K, committed 640K, reserved 1048576K -} - -Deoptimization events (20 events): -Event: 1.087 Thread 0x00007f7ec4028800 Uncommon trap: trap_request=0xffffff45 fr.pc=0x00007f7eb41a0990 relative=0x00000000000001d0 -Event: 1.087 Thread 0x00007f7ec4028800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00007f7eb41a0990 method=java.lang.String.hashCode()I @ 42 c2 -Event: 1.087 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eb41a0990 sp=0x00007f7ecdf08320 -Event: 1.087 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71de25 sp=0x00007f7ecdf082d8 mode 2 -Event: 3.662 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eaccb7d84 sp=0x00007f7ecdf08350 -Event: 3.662 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf077e0 mode 0 -Event: 4.371 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eaccc4422 sp=0x00007f7ecdf044a0 -Event: 4.371 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf03928 mode 0 -Event: 4.510 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eacc890af sp=0x00007f7ecdf081b0 -Event: 4.510 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf07658 mode 0 -Event: 5.564 Thread 0x00007f7ec4028800 Uncommon trap: trap_request=0xffffff45 fr.pc=0x00007f7eb41a88e8 relative=0x0000000000000068 -Event: 5.564 Thread 0x00007f7ec4028800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00007f7eb41a88e8 method=java.lang.String.isLatin1()Z @ 10 c2 -Event: 5.564 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eb41a88e8 sp=0x00007f7ecdf088d0 -Event: 5.564 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71de25 sp=0x00007f7ecdf08880 mode 2 -Event: 6.331 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eacccd5e8 sp=0x00007f7ecdf08580 -Event: 6.331 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf079f0 mode 0 -Event: 6.941 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eacccd5e8 sp=0x00007f7ecdf07660 -Event: 6.941 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf06af8 mode 0 -Event: 12.327 Thread 0x00007f7ec4028800 DEOPT PACKING pc=0x00007f7eaccc95c5 sp=0x00007f7ecdf06910 -Event: 12.327 Thread 0x00007f7ec4028800 DEOPT UNPACKING pc=0x00007f7eac71e33a sp=0x00007f7ecdf05d90 mode 0 - -Classes unloaded (0 events): -No events - -Classes redefined (0 events): -No events - -Internal exceptions (17 events): -Event: 2.190 Thread 0x00007f7ec4028800 Exception (0x00000000e0dc5a48) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 5.245 Thread 0x00007f7ec4028800 Exception (0x00000000e12092c8) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 5.649 Thread 0x00007f7ec4028800 Exception (0x00000000e1280798) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.015 Thread 0x00007f7ec4028800 Exception (0x00000000e12d47e0) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.382 Thread 0x00007f7ec4028800 Exception (0x00000000e1346640) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.595 Thread 0x00007f7ec4028800 Exception (0x00000000e137b378) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.672 Thread 0x00007f7ec4028800 Exception (0x00000000e139ef70) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.707 Thread 0x00007f7ec4028800 Exception (0x00000000e13a9150) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.739 Thread 0x00007f7ec4028800 Exception (0x00000000e13b6dd8) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 832] -Event: 6.925 Thread 0x00007f7ec4028800 Exception (0x00000000e13ec548) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 7.737 Thread 0x00007f7ec4028800 Exception (0x00000000e0c25148) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 7.990 Thread 0x00007f7ec4028800 Exception (0x00000000e0c900c0) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 8.395 Thread 0x00007f7ec4028800 Exception (0x00000000e0cfd370) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 8.486 Thread 0x00007f7ec4028800 Exception (0x00000000e0d15688) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 8.487 Thread 0x00007f7ec4028800 Exception (0x00000000e0d18078) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 832] -Event: 10.634 Thread 0x00007f7ec4028800 Exception (0x00000000e0f88b50) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 10.647 Thread 0x00007f7ec4028800 Exception (0x00000000e0f8c210) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] - -Events (20 events): -Event: 12.778 loading class sun/security/provider/ByteArrayAccess -Event: 12.778 loading class sun/security/provider/ByteArrayAccess done -Event: 12.784 loading class java/io/DeleteOnExitHook -Event: 12.786 loading class java/io/DeleteOnExitHook done -Event: 12.786 loading class java/io/DeleteOnExitHook$1 -Event: 12.786 loading class java/io/DeleteOnExitHook$1 done -Event: 12.815 loading class java/io/FileOutputStream$1 -Event: 12.815 loading class java/io/FileOutputStream$1 done -Event: 12.822 Loaded shared library /root/.cache/JNA/temp/jna17886832672380520920.tmp -Event: 12.822 loading class java/nio/ShortBuffer -Event: 12.822 loading class java/nio/ShortBuffer done -Event: 12.822 loading class java/nio/FloatBuffer -Event: 12.834 loading class java/nio/FloatBuffer done -Event: 12.834 loading class java/nio/DoubleBuffer -Event: 12.835 loading class java/nio/DoubleBuffer done -Event: 12.922 Executing VM operation: HandshakeAllThreads -Event: 12.925 Executing VM operation: HandshakeAllThreads done -Event: 12.980 Loaded shared library /usr/java/openjdk-14/lib/libzip.so -Event: 13.028 Executing VM operation: HandshakeAllThreads -Event: 13.036 Executing VM operation: HandshakeAllThreads done - - -Dynamic libraries: -e0c00000-e16a0000 rw-p 00000000 00:00 0 -e16a0000-eb2a0000 ---p 00000000 00:00 0 -eb2a0000-ec800000 rw-p 00000000 00:00 0 -ec800000-100000000 ---p 00000000 00:00 0 -800000000-800003000 rwxp 00001000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa -800003000-8003e4000 rw-p 00004000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa -8003e4000-800b10000 r--p 003e5000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa -800b10000-800b11000 rw-p 00b11000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa -800b11000-800bf1000 rw-p 00000000 00:00 0 -800bf1000-840b11000 ---p 00000000 00:00 0 -55a64bfce000-55a64bfcf000 r-xp 00000000 08:01 3160482 /usr/java/openjdk-14/bin/java -55a64bfd0000-55a64bfd1000 r--p 00001000 08:01 3160482 /usr/java/openjdk-14/bin/java -55a64bfd1000-55a64bfd2000 rw-p 00002000 08:01 3160482 /usr/java/openjdk-14/bin/java -55a64c580000-55a64c5a1000 rw-p 00000000 00:00 0 [heap] -7f7e90000000-7f7e90288000 rw-p 00000000 00:00 0 -7f7e90288000-7f7e94000000 ---p 00000000 00:00 0 -7f7e94000000-7f7e94427000 rw-p 00000000 00:00 0 -7f7e94427000-7f7e98000000 ---p 00000000 00:00 0 -7f7e98000000-7f7e98021000 rw-p 00000000 00:00 0 -7f7e98021000-7f7e9c000000 ---p 00000000 00:00 0 -7f7e9c000000-7f7e9c021000 rw-p 00000000 00:00 0 -7f7e9c021000-7f7ea0000000 ---p 00000000 00:00 0 -7f7ea0000000-7f7ea0021000 rw-p 00000000 00:00 0 -7f7ea0021000-7f7ea4000000 ---p 00000000 00:00 0 -7f7ea4000000-7f7ea4021000 rw-p 00000000 00:00 0 -7f7ea4021000-7f7ea8000000 ---p 00000000 00:00 0 -7f7ea8000000-7f7ea8021000 rw-p 00000000 00:00 0 -7f7ea8021000-7f7eac000000 ---p 00000000 00:00 0 -7f7eac6d5000-7f7eac945000 rwxp 00000000 00:00 0 -7f7eac945000-7f7eacc64000 ---p 00000000 00:00 0 -7f7eacc64000-7f7eaced4000 rwxp 00000000 00:00 0 -7f7eaced4000-7f7eb419c000 ---p 00000000 00:00 0 -7f7eb419c000-7f7eb440c000 rwxp 00000000 00:00 0 -7f7eb440c000-7f7ebb6d5000 ---p 00000000 00:00 0 -7f7ebb6d5000-7f7ec4000000 r--s 00000000 08:01 3160985 /usr/java/openjdk-14/lib/modules -7f7ec4000000-7f7ec44c4000 rw-p 00000000 00:00 0 -7f7ec44c4000-7f7ec8000000 ---p 00000000 00:00 0 -7f7ec9292000-7f7ec9750000 rw-p 00000000 00:00 0 -7f7ec9750000-7f7ec9768000 r-xp 00000000 08:01 3163771 /root/.cache/JNA/temp/jna17886832672380520920.tmp (deleted) -7f7ec9768000-7f7ec9968000 ---p 00018000 08:01 3163771 /root/.cache/JNA/temp/jna17886832672380520920.tmp (deleted) -7f7ec9968000-7f7ec9969000 rw-p 00018000 08:01 3163771 /root/.cache/JNA/temp/jna17886832672380520920.tmp (deleted) -7f7ec9969000-7f7ec9976000 r-xp 00000000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so -7f7ec9976000-7f7ec9978000 r--p 0000c000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so -7f7ec9978000-7f7ec9979000 rw-p 0000e000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so -7f7ec9979000-7f7ec997d000 ---p 00000000 00:00 0 -7f7ec997d000-7f7ec9a7a000 rw-p 00000000 00:00 0 -7f7ec9a7a000-7f7ec9a7f000 r-xp 00000000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so -7f7ec9a7f000-7f7ec9a80000 r--p 00004000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so -7f7ec9a80000-7f7ec9a81000 rw-p 00005000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so -7f7ec9a81000-7f7ec9a85000 r-xp 00000000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so -7f7ec9a85000-7f7ec9a86000 r--p 00003000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so -7f7ec9a86000-7f7ec9a87000 rw-p 00004000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so -7f7ec9a87000-7f7ec9a8b000 ---p 00000000 00:00 0 -7f7ec9a8b000-7f7ec9b88000 rw-p 00000000 00:00 0 -7f7ec9b88000-7f7ec9b9d000 r-xp 00000000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so -7f7ec9b9d000-7f7ec9b9e000 r--p 00014000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so -7f7ec9b9e000-7f7ec9b9f000 rw-p 00015000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so -7f7ec9b9f000-7f7ec9ba3000 ---p 00000000 00:00 0 -7f7ec9ba3000-7f7ec9ca0000 rw-p 00000000 00:00 0 -7f7ec9ca0000-7f7ec9ca1000 ---p 00000000 00:00 0 -7f7ec9ca1000-7f7ec9da2000 rw-p 00000000 00:00 0 -7f7ec9da2000-7f7ec9da6000 ---p 00000000 00:00 0 -7f7ec9da6000-7f7ec9ea3000 rw-p 00000000 00:00 0 -7f7ec9ea3000-7f7ec9ea7000 ---p 00000000 00:00 0 -7f7ec9ea7000-7f7ec9fa4000 rw-p 00000000 00:00 0 -7f7ec9fa4000-7f7ec9fa8000 ---p 00000000 00:00 0 -7f7ec9fa8000-7f7eca0a5000 rw-p 00000000 00:00 0 -7f7eca0a5000-7f7eca0a9000 ---p 00000000 00:00 0 -7f7eca0a9000-7f7eca1a6000 rw-p 00000000 00:00 0 -7f7eca1a6000-7f7eca1aa000 ---p 00000000 00:00 0 -7f7eca1aa000-7f7eca2a7000 rw-p 00000000 00:00 0 -7f7eca2a7000-7f7eca2ab000 ---p 00000000 00:00 0 -7f7eca2ab000-7f7eca3a8000 rw-p 00000000 00:00 0 -7f7eca3a8000-7f7eca3fb000 r--p 00000000 08:01 3154692 /usr/lib/locale/C.utf8/LC_CTYPE -7f7eca3fb000-7f7ecaa9c000 r--p 00000000 08:01 3154691 /usr/lib/locale/C.utf8/LC_COLLATE -7f7ecaa9c000-7f7ecaaa0000 ---p 00000000 00:00 0 -7f7ecaaa0000-7f7ecab9d000 rw-p 00000000 00:00 0 -7f7ecab9d000-7f7ecaba1000 ---p 00000000 00:00 0 -7f7ecaba1000-7f7ecac9e000 rw-p 00000000 00:00 0 -7f7ecac9e000-7f7ecac9f000 ---p 00000000 00:00 0 -7f7ecac9f000-7f7ecb4bc000 rw-p 00000000 00:00 0 -7f7ecb4bc000-7f7ecb67c000 ---p 00000000 00:00 0 -7f7ecb67c000-7f7ecb687000 rw-p 00000000 00:00 0 -7f7ecb687000-7f7ecb723000 ---p 00000000 00:00 0 -7f7ecb723000-7f7ecb729000 rw-p 00000000 00:00 0 -7f7ecb729000-7f7ecb776000 ---p 00000000 00:00 0 -7f7ecb776000-7f7ecb781000 rw-p 00000000 00:00 0 -7f7ecb781000-7f7ecb81d000 ---p 00000000 00:00 0 -7f7ecb81d000-7f7ecb823000 rw-p 00000000 00:00 0 -7f7ecb823000-7f7ecb909000 ---p 00000000 00:00 0 -7f7ecb909000-7f7ecb90e000 rw-p 00000000 00:00 0 -7f7ecb90e000-7f7ecb9f4000 ---p 00000000 00:00 0 -7f7ecb9f4000-7f7ecb9ff000 r-xp 00000000 08:01 3155554 /usr/lib64/libnss_files-2.28.so -7f7ecb9ff000-7f7ecbbfe000 ---p 0000b000 08:01 3155554 /usr/lib64/libnss_files-2.28.so -7f7ecbbfe000-7f7ecbbff000 r--p 0000a000 08:01 3155554 /usr/lib64/libnss_files-2.28.so -7f7ecbbff000-7f7ecbc00000 rw-p 0000b000 08:01 3155554 /usr/lib64/libnss_files-2.28.so -7f7ecbc00000-7f7ecbc06000 rw-p 00000000 00:00 0 -7f7ecbc06000-7f7ecbc0d000 r-xp 00000000 08:01 3155596 /usr/lib64/librt-2.28.so -7f7ecbc0d000-7f7ecbe0d000 ---p 00007000 08:01 3155596 /usr/lib64/librt-2.28.so -7f7ecbe0d000-7f7ecbe0e000 r--p 00007000 08:01 3155596 /usr/lib64/librt-2.28.so -7f7ecbe0e000-7f7ecbe0f000 rw-p 00008000 08:01 3155596 /usr/lib64/librt-2.28.so -7f7ecbe0f000-7f7ecbf90000 r-xp 00000000 08:01 3155521 /usr/lib64/libm-2.28.so -7f7ecbf90000-7f7ecc18f000 ---p 00181000 08:01 3155521 /usr/lib64/libm-2.28.so -7f7ecc18f000-7f7ecc190000 r--p 00180000 08:01 3155521 /usr/lib64/libm-2.28.so -7f7ecc190000-7f7ecc191000 rw-p 00181000 08:01 3155521 /usr/lib64/libm-2.28.so -7f7ecc191000-7f7ecd1a0000 r-xp 00000000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so -7f7ecd1a0000-7f7ecd1a1000 ---p 0100f000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so -7f7ecd1a1000-7f7ecd245000 r--p 0100f000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so -7f7ecd245000-7f7ecd27d000 rw-p 010b3000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so -7f7ecd27d000-7f7ecd2fe000 rw-p 00000000 00:00 0 -7f7ecd2fe000-7f7ecd4b7000 r-xp 00000000 08:01 3155424 /usr/lib64/libc-2.28.so -7f7ecd4b7000-7f7ecd6b6000 ---p 001b9000 08:01 3155424 /usr/lib64/libc-2.28.so -7f7ecd6b6000-7f7ecd6ba000 r--p 001b8000 08:01 3155424 /usr/lib64/libc-2.28.so -7f7ecd6ba000-7f7ecd6bc000 rw-p 001bc000 08:01 3155424 /usr/lib64/libc-2.28.so -7f7ecd6bc000-7f7ecd6c0000 rw-p 00000000 00:00 0 -7f7ecd6c0000-7f7ecd6c3000 r-xp 00000000 08:01 3155440 /usr/lib64/libdl-2.28.so -7f7ecd6c3000-7f7ecd8c2000 ---p 00003000 08:01 3155440 /usr/lib64/libdl-2.28.so -7f7ecd8c2000-7f7ecd8c3000 r--p 00002000 08:01 3155440 /usr/lib64/libdl-2.28.so -7f7ecd8c3000-7f7ecd8c4000 rw-p 00003000 08:01 3155440 /usr/lib64/libdl-2.28.so -7f7ecd8c4000-7f7ecd8df000 r-xp 00000000 08:01 3155583 /usr/lib64/libpthread-2.28.so -7f7ecd8df000-7f7ecdade000 ---p 0001b000 08:01 3155583 /usr/lib64/libpthread-2.28.so -7f7ecdade000-7f7ecdadf000 r--p 0001a000 08:01 3155583 /usr/lib64/libpthread-2.28.so -7f7ecdadf000-7f7ecdae0000 rw-p 0001b000 08:01 3155583 /usr/lib64/libpthread-2.28.so -7f7ecdae0000-7f7ecdae4000 rw-p 00000000 00:00 0 -7f7ecdae4000-7f7ecdafa000 r-xp 00000000 08:01 3155650 /usr/lib64/libz.so.1.2.11 -7f7ecdafa000-7f7ecdcf9000 ---p 00016000 08:01 3155650 /usr/lib64/libz.so.1.2.11 -7f7ecdcf9000-7f7ecdcfa000 r--p 00015000 08:01 3155650 /usr/lib64/libz.so.1.2.11 -7f7ecdcfa000-7f7ecdcfb000 rw-p 00000000 00:00 0 -7f7ecdcfb000-7f7ecdd24000 r-xp 00000000 08:01 3155395 /usr/lib64/ld-2.28.so -7f7ecdd28000-7f7ecdd39000 r-xp 00000000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so -7f7ecdd39000-7f7ecdd3a000 ---p 00011000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so -7f7ecdd3a000-7f7ecdd3b000 r--p 00011000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so -7f7ecdd3b000-7f7ecdd3c000 rw-p 00012000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so -7f7ecdd3c000-7f7ecdd3d000 r--p 00000000 08:01 3154699 /usr/lib/locale/C.utf8/LC_NUMERIC -7f7ecdd3d000-7f7ecdd3e000 r--p 00000000 08:01 3154702 /usr/lib/locale/C.utf8/LC_TIME -7f7ecdd3e000-7f7ecdd3f000 r--p 00000000 08:01 3154697 /usr/lib/locale/C.utf8/LC_MONETARY -7f7ecdd3f000-7f7ecdd40000 r--p 00000000 08:01 3154696 /usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES -7f7ecdd40000-7f7ecdd41000 r--p 00000000 08:01 3154700 /usr/lib/locale/C.utf8/LC_PAPER -7f7ecdd41000-7f7ecdd42000 r--p 00000000 08:01 3154698 /usr/lib/locale/C.utf8/LC_NAME -7f7ecdd42000-7f7ecdd43000 r--p 00000000 08:01 3154690 /usr/lib/locale/C.utf8/LC_ADDRESS -7f7ecdd43000-7f7ecdd44000 r--p 00000000 08:01 3154701 /usr/lib/locale/C.utf8/LC_TELEPHONE -7f7ecdd44000-7f7ecdd45000 r--p 00000000 08:01 3154694 /usr/lib/locale/C.utf8/LC_MEASUREMENT -7f7ecdd45000-7f7ecdd4c000 r--s 00000000 08:01 3155357 /usr/lib64/gconv/gconv-modules.cache -7f7ecdd4c000-7f7ecdd4d000 r--p 00000000 08:01 3154693 /usr/lib/locale/C.utf8/LC_IDENTIFICATION -7f7ecdd4d000-7f7ecdd67000 r--p 00000000 08:01 3154703 /usr/lib/locale/locale-archive -7f7ecdd67000-7f7ecddad000 rw-p 00000000 00:00 0 -7f7ecddad000-7f7ecddb4000 ---p 00000000 00:00 0 -7f7ecddb4000-7f7ecddbb000 r-xp 00000000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so -7f7ecddbb000-7f7ecddbc000 r--p 00006000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so -7f7ecddbc000-7f7ecddbd000 rw-p 00007000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so -7f7ecddbd000-7f7ecdde1000 r-xp 00000000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so -7f7ecdde1000-7f7ecdde2000 r--p 00023000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so -7f7ecdde2000-7f7ecdde4000 rw-p 00024000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so -7f7ecdde4000-7f7ecddec000 rw-s 00000000 08:01 3163766 /tmp/hsperfdata_root/100 -7f7ecddec000-7f7ecde07000 r-xp 00000000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so -7f7ecde07000-7f7ecde09000 r--p 0001a000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so -7f7ecde09000-7f7ecde0a000 rw-p 0001c000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so -7f7ecde0a000-7f7ecde0e000 ---p 00000000 00:00 0 -7f7ecde0e000-7f7ecdf0d000 rw-p 00000000 00:00 0 -7f7ecdf0d000-7f7ecdf1b000 r-xp 00000000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so -7f7ecdf1b000-7f7ecdf1c000 ---p 0000e000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so -7f7ecdf1c000-7f7ecdf1d000 r--p 0000e000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so -7f7ecdf1d000-7f7ecdf1e000 rw-p 0000f000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so -7f7ecdf1e000-7f7ecdf20000 rw-p 00000000 00:00 0 -7f7ecdf20000-7f7ecdf21000 ---p 00000000 00:00 0 -7f7ecdf21000-7f7ecdf22000 r--p 00000000 00:00 0 -7f7ecdf22000-7f7ecdf23000 ---p 00000000 00:00 0 -7f7ecdf23000-7f7ecdf24000 r--p 00028000 08:01 3155395 /usr/lib64/ld-2.28.so -7f7ecdf24000-7f7ecdf25000 rw-p 00029000 08:01 3155395 /usr/lib64/ld-2.28.so -7f7ecdf25000-7f7ecdf26000 rw-p 00000000 00:00 0 -7ffd671f1000-7ffd67212000 rw-p 00000000 00:00 0 [stack] -7ffd67244000-7ffd67247000 r--p 00000000 00:00 0 [vvar] -7ffd67247000-7ffd67249000 r-xp 00000000 00:00 0 [vdso] -ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] - - -VM Arguments: -java_command: /project/java-native/target/surefire/surefirebooter15072611568838389395.jar /project/java-native/target/surefire 2020-10-01T00-09-53_430-jvmRun2 surefire3272641396836511080tmp surefire_29468511371192344687tmp -java_class_path (initial): /project/java-native/target/surefire/surefirebooter15072611568838389395.jar -Launcher Type: SUN_STANDARD - -[Global flags] - intx CICompilerCount = 2 {product} {ergonomic} - size_t InitialHeapSize = 33554432 {product} {ergonomic} - size_t MaxHeapSize = 524288000 {product} {ergonomic} - size_t MaxNewSize = 174718976 {product} {ergonomic} - size_t MinHeapDeltaBytes = 196608 {product} {ergonomic} - size_t MinHeapSize = 8388608 {product} {ergonomic} - size_t NewSize = 11141120 {product} {ergonomic} - uintx NonNMethodCodeHeapSize = 5826188 {pd product} {ergonomic} - uintx NonProfiledCodeHeapSize = 122916026 {pd product} {ergonomic} - size_t OldSize = 22413312 {product} {ergonomic} - uintx ProfiledCodeHeapSize = 122916026 {pd product} {ergonomic} - uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} - bool SegmentedCodeCache = true {product} {ergonomic} - size_t SoftMaxHeapSize = 524288000 {manageable} {ergonomic} - bool UseCompressedClassPointers = true {lp64_product} {ergonomic} - bool UseCompressedOops = true {lp64_product} {ergonomic} - bool UseSerialGC = true {product} {ergonomic} - -Logging: -Log output configuration: - #0: stdout all=warning uptime,level,tags - #1: stderr all=off uptime,level,tags - -Environment Variables: -JAVA_HOME=/usr/java/openjdk-14 -PATH=/usr/java/openjdk-14/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -Signal Handlers: -SIGSEGV: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGBUS: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGFPE: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGPIPE: [libjvm.so+0xb1bca0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGXFSZ: [libjvm.so+0xb1bca0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGILL: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGUSR2: [libjvm.so+0xb1bb30], sa_mask[0]=00100000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO -SIGHUP: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGINT: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGTERM: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGQUIT: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO - - ---------------- S Y S T E M --------------- - -OS:Oracle Linux Server release 8.2 -uname:Linux 4.14.154-boot2docker #1 SMP Thu Nov 14 19:19:08 UTC 2019 x86_64 -OS uptime: 0 days 13:49 hours -libc:glibc 2.28 NPTL 2.28 -rlimit: STACK 8192k, CORE infinity, NPROC infinity, NOFILE 1048576, AS infinity, DATA infinity, FSIZE infinity -load average:4.05 1.87 0.76 - -/proc/meminfo: -MemTotal: 2045412 kB -MemFree: 1098032 kB -MemAvailable: 1368704 kB -Buffers: 83692 kB -Cached: 471224 kB -SwapCached: 0 kB -Active: 573576 kB -Inactive: 305820 kB -Active(anon): 404060 kB -Inactive(anon): 199632 kB -Active(file): 169516 kB -Inactive(file): 106188 kB -Unevictable: 0 kB -Mlocked: 0 kB -SwapTotal: 1415172 kB -SwapFree: 1415172 kB -Dirty: 324 kB -Writeback: 0 kB -AnonPages: 324536 kB -Mapped: 120864 kB -Shmem: 290620 kB -Slab: 42348 kB -SReclaimable: 27356 kB -SUnreclaim: 14992 kB -KernelStack: 4672 kB -PageTables: 2744 kB -NFS_Unstable: 0 kB -Bounce: 0 kB -WritebackTmp: 0 kB -CommitLimit: 2437876 kB -Committed_AS: 1792468 kB -VmallocTotal: 34359738367 kB -VmallocUsed: 0 kB -VmallocChunk: 0 kB -HugePages_Total: 0 -HugePages_Free: 0 -HugePages_Rsvd: 0 -HugePages_Surp: 0 -Hugepagesize: 2048 kB -DirectMap4k: 42944 kB -DirectMap2M: 2054144 kB - - -/proc/sys/kernel/threads-max (system-wide limit on the number of threads): -15537 - - -/proc/sys/vm/max_map_count (maximum number of memory map areas a process may have): -65530 - - -/proc/sys/kernel/pid_max (system-wide limit on number of process identifiers): -32768 - - - -container (cgroup) information: -container_type: cgroupv1 -cpu_cpuset_cpus: 0 -cpu_memory_nodes: 0 -active_processor_count: 1 -cpu_quota: no quota -cpu_period: 100000 -cpu_shares: no shares -memory_limit_in_bytes: unlimited -memory_and_swap_limit_in_bytes: unlimited -memory_soft_limit_in_bytes: unlimited -memory_usage_in_bytes: 356708352 -memory_max_usage_in_bytes: 394252288 - -KVM virtualization detected -Steal ticks since vm start: 0 -Steal ticks percentage since vm start: 0.000 - -CPU:total 1 (initial active 1) (1 cores per cpu, 1 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, lzcnt, tsc, tscinvbit -CPU Model and flags from /proc/cpuinfo: -model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz -flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm invpcid_single pti fsgsbase avx2 invpcid md_clear flush_l1d - -Memory: 4k page, physical 2045412k(1098032k free), swap 1415172k(1415172k free) - -vm_info: OpenJDK 64-Bit Server VM (14.0.2+12-46) for linux-amd64 JRE (14.0.2+12-46), built on Jul 8 2020 23:30:21 by "mach5one" with gcc 8.3.0 - -END. diff --git a/java-native/hs_err_pid98.log b/java-native/hs_err_pid98.log deleted file mode 100644 index 25a01096e2..0000000000 --- a/java-native/hs_err_pid98.log +++ /dev/null @@ -1,789 +0,0 @@ -# -# A fatal error has been detected by the Java Runtime Environment: -# -# SIGSEGV (0xb) at pc=0x00007f01b8795090, pid=98, tid=114 -# -# JRE version: OpenJDK Runtime Environment (14.0.2+12) (build 14.0.2+12-46) -# Java VM: OpenJDK 64-Bit Server VM (14.0.2+12-46, mixed mode, sharing, tiered, compressed oops, serial gc, linux-amd64) -# Problematic frame: -# C [libc.so.6+0x15e090] __memset_avx2_unaligned_erms+0x60 -# -# Core dump will be written. Default location: /project/java-native/core -# -# If you would like to submit a bug report, please visit: -# https://bugreport.java.com/bugreport/crash.jsp -# The crash happened outside the Java Virtual Machine in native code. -# See problematic frame for where to report the bug. -# - ---------------- S U M M A R Y ------------ - -Command Line: /project/java-native/target/surefire/surefirebooter255261521587421006.jar /project/java-native/target/surefire 2020-10-01T00-29-55_633-jvmRun3 surefire15563279322398545368tmp surefire_13579138375161683305tmp - -Host: Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz, 1 cores, 1G, Oracle Linux Server release 8.2 -Time: Thu Oct 1 00:30:20 2020 UTC elapsed time: 10 seconds (0d 0h 0m 10s) - ---------------- T H R E A D --------------- - -Current thread (0x00007f01b0028800): JavaThread "main" [_thread_in_native, id=114, stack(0x00007f01b9143000,0x00007f01b9244000)] - -Stack: [0x00007f01b9143000,0x00007f01b9244000], sp=0x00007f01b9240788, free space=1013k -Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) -C [libc.so.6+0x15e090] __memset_avx2_unaligned_erms+0x60 -j com.sun.jna.Native.setMemory(Lcom/sun/jna/Pointer;JJJB)V+0 -j com.sun.jna.Pointer.setMemory(JJB)V+9 -j com.baeldung.jna.StdCUnitTest.whenAccessViolation_thenShouldThrowError()V+17 -v ~StubRoutines::call_stub -V [libjvm.so+0x78e42b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2fb -V [libjvm.so+0xbb0efb] invoke(InstanceKlass*, methodHandle const&, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*) [clone .constprop.117]+0x85b -V [libjvm.so+0xbb19cd] Reflection::invoke_method(oopDesc*, Handle, objArrayHandle, Thread*)+0xfd -V [libjvm.so+0x83b8e3] JVM_InvokeMethod+0xf3 -j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.2 -j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.2 -j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.2 -j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.2 -j org.junit.platform.commons.util.ReflectionUtils.invokeMethod(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+41 -j org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/extension/ExtensionRegistry;)Ljava/lang/Object;+32 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;)V+24 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$232.execute()V+12 -j org.junit.jupiter.engine.execution.ThrowableCollector.execute(Lorg/junit/jupiter/api/function/Executable;)V+1 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)V+21 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;+44 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;+6 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+35 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 -j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 -j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 -j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 -j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 -j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 -j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 -j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 -j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 -j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 -j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 -j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 -j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 -j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 -j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 -j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 -j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute()V+23 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(Lorg/junit/platform/engine/ExecutionRequest;)V+13 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/engine/TestEngine;Lorg/junit/platform/engine/ExecutionRequest;)V+2 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/core/Root;Lorg/junit/platform/engine/ConfigurationParameters;[Lorg/junit/platform/launcher/TestExecutionListener;)V+101 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;[Lorg/junit/platform/launcher/TestExecutionListener;)V+36 -j org.junit.platform.surefire.provider.JUnitPlatformProvider.invokeAllTests(Lorg/apache/maven/surefire/util/TestsToRun;)Lorg/apache/maven/surefire/suite/RunResult;+55 -j org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(Ljava/lang/Object;)Lorg/apache/maven/surefire/suite/RunResult;+31 -j org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(Lorg/apache/maven/surefire/booter/ForkingReporterFactory;)Lorg/apache/maven/surefire/suite/RunResult;+9 -j org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess()Lorg/apache/maven/surefire/suite/RunResult;+7 -j org.apache.maven.surefire.booter.ForkedBooter.execute()V+1 -j org.apache.maven.surefire.booter.ForkedBooter.main([Ljava/lang/String;)V+35 -v ~StubRoutines::call_stub -V [libjvm.so+0x78e42b] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2fb -V [libjvm.so+0x80d2e3] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.125] [clone .constprop.264]+0x193 -V [libjvm.so+0x80f338] jni_CallStaticVoidMethod+0x108 -C [libjli.so+0x4647] JavaMain+0xcd7 -C [libjli.so+0x85a9] ThreadJavaMain+0x9 - -Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) -j com.sun.jna.Native.setMemory(Lcom/sun/jna/Pointer;JJJB)V+0 -j com.sun.jna.Pointer.setMemory(JJB)V+9 -j com.baeldung.jna.StdCUnitTest.whenAccessViolation_thenShouldThrowError()V+17 -v ~StubRoutines::call_stub -j jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 java.base@14.0.2 -j jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 java.base@14.0.2 -j jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 java.base@14.0.2 -j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 java.base@14.0.2 -j org.junit.platform.commons.util.ReflectionUtils.invokeMethod(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+41 -j org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/extension/ExtensionRegistry;)Ljava/lang/Object;+32 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(Lorg/junit/jupiter/api/extension/ExtensionContext;Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;)V+24 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$232.execute()V+12 -j org.junit.jupiter.engine.execution.ThrowableCollector.execute(Lorg/junit/jupiter/api/function/Executable;)V+1 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)V+21 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/jupiter/engine/execution/JupiterEngineExecutionContext;+44 -j org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/Node$DynamicTestExecutor;)Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;+6 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+35 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 -j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 -j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 -j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 -j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 -j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 -j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 -j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 -j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;Lorg/junit/platform/engine/TestDescriptor;)V+17 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$190.accept(Ljava/lang/Object;)V+12 -j java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Ljava/lang/Object;)V+5 java.base@14.0.2 -j java.util.stream.ReferencePipeline$2$1.accept(Ljava/lang/Object;)V+21 java.base@14.0.2 -j java.util.Iterator.forEachRemaining(Ljava/util/function/Consumer;)V+21 java.base@14.0.2 -j java.util.Spliterators$IteratorSpliterator.forEachRemaining(Ljava/util/function/Consumer;)V+52 java.base@14.0.2 -j java.util.stream.AbstractPipeline.copyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)V+32 java.base@14.0.2 -j java.util.stream.AbstractPipeline.wrapAndCopyInto(Ljava/util/stream/Sink;Ljava/util/Spliterator;)Ljava/util/stream/Sink;+13 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Void;+3 java.base@14.0.2 -j java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Ljava/util/stream/PipelineHelper;Ljava/util/Spliterator;)Ljava/lang/Object;+3 java.base@14.0.2 -j java.util.stream.AbstractPipeline.evaluate(Ljava/util/stream/TerminalOp;)Ljava/lang/Object;+88 java.base@14.0.2 -j java.util.stream.ReferencePipeline.forEach(Ljava/util/function/Consumer;)V+6 java.base@14.0.2 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+75 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor$$Lambda$187.execute()V+8 -j org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(Lorg/junit/platform/engine/support/hierarchical/SingleTestExecutor$Executable;)Lorg/junit/platform/engine/TestExecutionResult;+1 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+27 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(Lorg/junit/platform/engine/support/hierarchical/EngineExecutionContext;Lorg/junit/platform/engine/support/hierarchical/ExecutionTracker;)V+53 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute()V+23 -j org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(Lorg/junit/platform/engine/ExecutionRequest;)V+13 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/engine/TestEngine;Lorg/junit/platform/engine/ExecutionRequest;)V+2 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/core/Root;Lorg/junit/platform/engine/ConfigurationParameters;[Lorg/junit/platform/launcher/TestExecutionListener;)V+101 -j org.junit.platform.launcher.core.DefaultLauncher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;[Lorg/junit/platform/launcher/TestExecutionListener;)V+36 -j org.junit.platform.surefire.provider.JUnitPlatformProvider.invokeAllTests(Lorg/apache/maven/surefire/util/TestsToRun;)Lorg/apache/maven/surefire/suite/RunResult;+55 -j org.junit.platform.surefire.provider.JUnitPlatformProvider.invoke(Ljava/lang/Object;)Lorg/apache/maven/surefire/suite/RunResult;+31 -j org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(Lorg/apache/maven/surefire/booter/ForkingReporterFactory;)Lorg/apache/maven/surefire/suite/RunResult;+9 -j org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess()Lorg/apache/maven/surefire/suite/RunResult;+7 -j org.apache.maven.surefire.booter.ForkedBooter.execute()V+1 -j org.apache.maven.surefire.booter.ForkedBooter.main([Ljava/lang/String;)V+35 -v ~StubRoutines::call_stub - -siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000 - -Register to memory mapping: - -RAX=0x0 is NULL -RBX={method} {0x00007f01b6799628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' -RCX=0x0000000000000080 is an unknown value -RDX=0x0000000000019000 is an unknown value -RSP=0x00007f01b9240788 is pointing into the stack for thread: 0x00007f01b0028800 -RBP=0x00007f01b92407c0 is pointing into the stack for thread: 0x00007f01b0028800 -RSI=0x0 is NULL -RDI=0x0 is NULL -R8 =0x0 is NULL -R9 =0x0000000000019000 is an unknown value -R10=0x0000000000000009 is an unknown value -R11=0x00007f01b8794fd0: in /lib64/libc.so.6 at 0x00007f01b8637000 -R12=0x0 is NULL -R13={method} {0x00007f01b6799628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' -R14=0x00007f01b92408b8 is pointing into the stack for thread: 0x00007f01b0028800 -R15=0x00007f01b0028800 is a thread - - -Registers: -RAX=0x0000000000000000, RBX=0x00007f01b6799628, RCX=0x0000000000000080, RDX=0x0000000000019000 -RSP=0x00007f01b9240788, RBP=0x00007f01b92407c0, RSI=0x0000000000000000, RDI=0x0000000000000000 -R8 =0x0000000000000000, R9 =0x0000000000019000, R10=0x0000000000000009, R11=0x00007f01b8794fd0 -R12=0x0000000000000000, R13=0x00007f01b6799628, R14=0x00007f01b92408b8, R15=0x00007f01b0028800 -RIP=0x00007f01b8795090, EFLAGS=0x0000000000010202, CSGSFS=0x002b000000000033, ERR=0x0000000000000006 - TRAPNO=0x000000000000000e - -Top of Stack: (sp=0x00007f01b9240788) -0x00007f01b9240788: 00007f01b4a8fe8d 00007f01b6799628 -0x00007f01b9240798: 00007f01b0028b10 0000000000000000 -0x00007f01b92407a8: 0000000000019000 0000000000000000 -0x00007f01b92407b8: 0000000000000000 00007f01b9240860 - -Instructions: (pc=0x00007f01b8795090) -0x00007f01b8794f90: f3 0f 1e fa 48 39 d1 0f 82 53 d9 fa ff 0f 1f 00 -0x00007f01b8794fa0: f3 0f 1e fa 48 c1 e2 02 c5 f9 6e c6 48 89 f8 c4 -0x00007f01b8794fb0: e2 7d 58 c0 eb 2a 66 2e 0f 1f 84 00 00 00 00 00 -0x00007f01b8794fc0: f3 0f 1e fa 48 39 d1 0f 82 23 d9 fa ff 0f 1f 00 -0x00007f01b8794fd0: f3 0f 1e fa c5 f9 6e c6 48 89 f8 c4 e2 7d 78 c0 -0x00007f01b8794fe0: 48 83 fa 20 0f 82 04 01 00 00 48 83 fa 40 77 77 -0x00007f01b8794ff0: c5 fe 7f 44 17 e0 c5 fe 7f 07 c5 f8 77 c3 66 90 -0x00007f01b8795000: f3 0f 1e fa c5 f8 77 48 89 d1 40 0f b6 c6 48 89 -0x00007f01b8795010: fa f3 aa 48 89 d0 c3 66 0f 1f 84 00 00 00 00 00 -0x00007f01b8795020: f3 0f 1e fa 48 39 d1 0f 82 c3 d8 fa ff 0f 1f 00 -0x00007f01b8795030: f3 0f 1e fa c5 f9 6e c6 48 89 f8 c4 e2 7d 78 c0 -0x00007f01b8795040: 48 83 fa 20 0f 82 a4 00 00 00 48 83 fa 40 77 0e -0x00007f01b8795050: c5 fe 7f 44 17 e0 c5 fe 7f 07 c5 f8 77 c3 48 81 -0x00007f01b8795060: fa 00 08 00 00 77 9d 48 81 fa 80 00 00 00 77 19 -0x00007f01b8795070: c5 fe 7f 07 c5 fe 7f 47 20 c5 fe 7f 44 17 e0 c5 -0x00007f01b8795080: fe 7f 44 17 c0 c5 f8 77 c3 48 8d 8f 80 00 00 00 -0x00007f01b8795090: c5 fe 7f 07 48 83 e1 80 c5 fe 7f 44 17 e0 c5 fe -0x00007f01b87950a0: 7f 47 20 c5 fe 7f 44 17 c0 c5 fe 7f 47 40 c5 fe -0x00007f01b87950b0: 7f 44 17 a0 c5 fe 7f 47 60 c5 fe 7f 44 17 80 48 -0x00007f01b87950c0: 01 fa 48 83 e2 80 48 39 d1 74 ba c5 fd 7f 01 c5 -0x00007f01b87950d0: fd 7f 41 20 c5 fd 7f 41 40 c5 fd 7f 41 60 48 81 -0x00007f01b87950e0: c1 80 00 00 00 48 39 ca 75 e1 c5 f8 77 c3 80 fa -0x00007f01b87950f0: 10 73 1c c4 e1 f9 7e c1 80 fa 08 73 20 80 fa 04 -0x00007f01b8795100: 73 27 80 fa 01 77 2c 72 02 88 0f c5 f8 77 c3 c5 -0x00007f01b8795110: fa 7f 44 17 f0 c5 fa 7f 07 c5 f8 77 c3 48 89 4c -0x00007f01b8795120: 17 f8 48 89 0f c5 f8 77 c3 89 4c 17 fc 89 0f c5 -0x00007f01b8795130: f8 77 c3 66 89 4c 17 fe 66 89 0f c5 f8 77 c3 90 -0x00007f01b8795140: f3 0f 1e fa 48 c1 e2 02 48 83 fa 20 0f 82 3e 01 -0x00007f01b8795150: 00 00 c5 fe 6f 16 c5 ed 76 17 c5 fd d7 c2 83 e8 -0x00007f01b8795160: ff 0f 85 e9 00 00 00 48 83 fa 40 0f 86 c0 00 00 -0x00007f01b8795170: 00 c5 fd 76 c0 48 81 fa 00 01 00 00 0f 87 9e 01 -0x00007f01b8795180: 00 00 48 81 fa 80 00 00 00 0f 82 28 02 00 00 c5 - - -Stack slot to memory mapping: -stack at sp + 0 slots: 0x00007f01b4a8fe8d: Java_com_sun_jna_Native_setMemory+0x00000000000000bd in /root/.cache/JNA/temp/jna8092103267992246554.tmp at 0x00007f01b4a89000 -stack at sp + 1 slots: {method} {0x00007f01b6799628} 'setMemory' '(Lcom/sun/jna/Pointer;JJJB)V' in 'com/sun/jna/Native' -stack at sp + 2 slots: 0x00007f01b0028b10 points into unknown readable memory: 80 48 58 b8 01 7f 00 00 -stack at sp + 3 slots: 0x0 is NULL -stack at sp + 4 slots: 0x0000000000019000 is an unknown value -stack at sp + 5 slots: 0x0 is NULL -stack at sp + 6 slots: 0x0 is NULL -stack at sp + 7 slots: 0x00007f01b9240860 is pointing into the stack for thread: 0x00007f01b0028800 - - ---------------- P R O C E S S --------------- - -Threads class SMR info: -_java_thread_list=0x00007f01b01d8a40, length=12, elements={ -0x00007f01b0028800, 0x00007f01b00a2000, 0x00007f01b00a3800, 0x00007f01b00ad000, -0x00007f01b00af000, 0x00007f01b00b1000, 0x00007f01b00b3000, 0x00007f01b00b5000, -0x00007f01b00ef800, 0x00007f01b00f4800, 0x00007f01b0188800, 0x00007f01b01d7800 -} - -Java Threads: ( => current thread ) -=>0x00007f01b0028800 JavaThread "main" [_thread_in_native, id=114, stack(0x00007f01b9143000,0x00007f01b9244000)] - 0x00007f01b00a2000 JavaThread "Reference Handler" daemon [_thread_blocked, id=120, stack(0x00007f01b5ed6000,0x00007f01b5fd7000)] - 0x00007f01b00a3800 JavaThread "Finalizer" daemon [_thread_blocked, id=123, stack(0x00007f01b5dd5000,0x00007f01b5ed6000)] - 0x00007f01b00ad000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=125, stack(0x00007f01b55e0000,0x00007f01b56e1000)] - 0x00007f01b00af000 JavaThread "Service Thread" daemon [_thread_blocked, id=128, stack(0x00007f01b54df000,0x00007f01b55e0000)] - 0x00007f01b00b1000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=130, stack(0x00007f01b53de000,0x00007f01b54df000)] - 0x00007f01b00b3000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=133, stack(0x00007f01b52dd000,0x00007f01b53de000)] - 0x00007f01b00b5000 JavaThread "Sweeper thread" daemon [_thread_blocked, id=138, stack(0x00007f01b51dc000,0x00007f01b52dd000)] - 0x00007f01b00ef800 JavaThread "Notification Thread" daemon [_thread_blocked, id=140, stack(0x00007f01b50db000,0x00007f01b51dc000)] - 0x00007f01b00f4800 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=146, stack(0x00007f01b4ed8000,0x00007f01b4fd9000)] - 0x00007f01b0188800 JavaThread "surefire-forkedjvm-command-thread" daemon [_thread_in_native, id=150, stack(0x00007f01b4dc0000,0x00007f01b4ec1000)] - 0x00007f01b01d7800 JavaThread "surefire-forkedjvm-ping-30s" daemon [_thread_blocked, id=153, stack(0x00007f01b4cb2000,0x00007f01b4db3000)] - -Other Threads: - 0x00007f01b009e800 VMThread "VM Thread" [stack: 0x00007f01b5fd9000,0x00007f01b60d9000] [id=117] - 0x00007f01b00f2000 WatcherThread [stack: 0x00007f01b4fdb000,0x00007f01b50db000] [id=141] - -Threads with active compile tasks: - -VM state:not at safepoint (normal execution) - -VM Mutex/Monitor currently owned by a thread: None - -Heap address: 0x00000000e0c00000, size: 500 MB, Compressed Oops mode: 32-bit -Narrow klass base: 0x0000000800000000, Narrow klass shift: 3 -Compressed class space size: 1073741824 Address: 0x0000000800b11000 - -Heap: - def new generation total 9792K, used 7590K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) - eden space 8704K, 74% used [0x00000000e0c00000, 0x00000000e1259a00, 0x00000000e1480000) - from space 1088K, 100% used [0x00000000e1590000, 0x00000000e16a0000, 0x00000000e16a0000) - to space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) - tenured generation total 21888K, used 1321K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) - the space 21888K, 6% used [0x00000000eb2a0000, 0x00000000eb3ea690, 0x00000000eb3ea800, 0x00000000ec800000) - Metaspace used 4992K, capacity 7071K, committed 7296K, reserved 1056768K - class space used 637K, capacity 881K, committed 896K, reserved 1048576K - -Card table byte_map: [0x00007f01b6a5c000,0x00007f01b6b57000] _byte_map_base: 0x00007f01b6356000 - -Polling page: 0x00007f01b9259000 - -Metaspace: - -Usage: - Non-class: 6.04 MB capacity, 4.25 MB ( 70%) used, 1.76 MB ( 29%) free+waste, 30.81 KB ( <1%) overhead. - Class: 881.00 KB capacity, 637.47 KB ( 72%) used, 226.47 KB ( 26%) free+waste, 17.06 KB ( 2%) overhead. - Both: 6.91 MB capacity, 4.88 MB ( 71%) used, 1.98 MB ( 29%) free+waste, 47.88 KB ( <1%) overhead. - -Virtual space: - Non-class space: 8.00 MB reserved, 6.25 MB ( 78%) committed - Class space: 1.00 GB reserved, 896.00 KB ( <1%) committed - Both: 1.01 GB reserved, 7.12 MB ( <1%) committed - -Chunk freelists: - Non-Class: 62.00 KB - Class: 11.00 KB - Both: 73.00 KB - -MaxMetaspaceSize: unlimited -CompressedClassSpaceSize: 1.00 GB - -CodeHeap 'non-profiled nmethods': size=120036Kb used=270Kb max_used=270Kb free=119765Kb - bounds [0x00007f01a019c000, 0x00007f01a040c000, 0x00007f01a76d5000] -CodeHeap 'profiled nmethods': size=120032Kb used=1585Kb max_used=1585Kb free=118446Kb - bounds [0x00007f0198c64000, 0x00007f0198ed4000, 0x00007f01a019c000] -CodeHeap 'non-nmethods': size=5692Kb used=1156Kb max_used=1171Kb free=4535Kb - bounds [0x00007f01986d5000, 0x00007f0198945000, 0x00007f0198c64000] - total_blobs=1295 nmethods=879 adapters=332 - compilation: enabled - stopped_count=0, restarted_count=0 - full_count=0 - -Compilation events (20 events): -Event: 10.134 Thread 0x00007f01b00b3000 876 3 java.util.zip.ZipEntry:: (74 bytes) -Event: 10.135 Thread 0x00007f01b00b3000 nmethod 876 0x00007f0198ded390 code [0x00007f0198ded580, 0x00007f0198dedaf0] -Event: 10.135 Thread 0x00007f01b00b3000 873 3 java.util.jar.JarFile$1::apply (13 bytes) -Event: 10.138 Thread 0x00007f01b00b3000 nmethod 873 0x00007f0198dedd10 code [0x00007f0198dedec0, 0x00007f0198dee1a0] -Event: 10.138 Thread 0x00007f01b00b3000 874 3 java.util.jar.JarFile$JarFileEntry:: (16 bytes) -Event: 10.138 Thread 0x00007f01b00b3000 nmethod 874 0x00007f0198dee310 code [0x00007f0198dee4c0, 0x00007f0198dee6c0] -Event: 10.141 Thread 0x00007f01b00b1000 877 4 java.lang.StringBuilder:: (7 bytes) -Event: 10.144 Thread 0x00007f01b00b1000 nmethod 877 0x00007f01a01df010 code [0x00007f01a01df180, 0x00007f01a01df298] -Event: 10.151 Thread 0x00007f01b00b3000 878 ! 3 java.util.zip.ZipFile$ZipFileInflaterInputStream::close (67 bytes) -Event: 10.152 Thread 0x00007f01b00b3000 nmethod 878 0x00007f0198dee790 code [0x00007f0198dee980, 0x00007f0198def090] -Event: 10.158 Thread 0x00007f01b00b3000 879 3 java.util.ArrayDeque::add (7 bytes) -Event: 10.159 Thread 0x00007f01b00b3000 nmethod 879 0x00007f0198def390 code [0x00007f0198def520, 0x00007f0198def680] -Event: 10.166 Thread 0x00007f01b00b3000 880 3 java.util.zip.ZipFile$InflaterCleanupAction::run (12 bytes) -Event: 10.167 Thread 0x00007f01b00b3000 nmethod 880 0x00007f0198def710 code [0x00007f0198def8a0, 0x00007f0198defa00] -Event: 10.167 Thread 0x00007f01b00b3000 881 ! 3 java.util.zip.Inflater::reset (64 bytes) -Event: 10.167 Thread 0x00007f01b00b3000 nmethod 881 0x00007f0198defb10 code [0x00007f0198defcc0, 0x00007f0198df00b0] -Event: 10.179 Thread 0x00007f01b00b1000 883 4 java.lang.Object:: (1 bytes) -Event: 10.180 Thread 0x00007f01b00b1000 nmethod 883 0x00007f01a01df710 code [0x00007f01a01df880, 0x00007f01a01df938] -Event: 10.185 Thread 0x00007f01b00b3000 884 3 sun.net.www.protocol.jar.Handler::checkNestedProtocol (18 bytes) -Event: 10.186 Thread 0x00007f01b00b3000 nmethod 884 0x00007f0198df0290 code [0x00007f0198df0440, 0x00007f0198df0620] - -GC Heap History (2 events): -Event: 5.704 GC heap before -{Heap before GC invocations=0 (full 0): - def new generation total 9792K, used 8704K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) - eden space 8704K, 100% used [0x00000000e0c00000, 0x00000000e1480000, 0x00000000e1480000) - from space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) - to space 1088K, 0% used [0x00000000e1590000, 0x00000000e1590000, 0x00000000e16a0000) - tenured generation total 21888K, used 0K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) - the space 21888K, 0% used [0x00000000eb2a0000, 0x00000000eb2a0000, 0x00000000eb2a0200, 0x00000000ec800000) - Metaspace used 3047K, capacity 5805K, committed 6016K, reserved 1056768K - class space used 361K, capacity 627K, committed 640K, reserved 1048576K -} -Event: 5.793 GC heap after -{Heap after GC invocations=1 (full 0): - def new generation total 9792K, used 1088K [0x00000000e0c00000, 0x00000000e16a0000, 0x00000000eb2a0000) - eden space 8704K, 0% used [0x00000000e0c00000, 0x00000000e0c00000, 0x00000000e1480000) - from space 1088K, 100% used [0x00000000e1590000, 0x00000000e16a0000, 0x00000000e16a0000) - to space 1088K, 0% used [0x00000000e1480000, 0x00000000e1480000, 0x00000000e1590000) - tenured generation total 21888K, used 1321K [0x00000000eb2a0000, 0x00000000ec800000, 0x0000000100000000) - the space 21888K, 6% used [0x00000000eb2a0000, 0x00000000eb3ea690, 0x00000000eb3ea800, 0x00000000ec800000) - Metaspace used 3047K, capacity 5805K, committed 6016K, reserved 1056768K - class space used 361K, capacity 627K, committed 640K, reserved 1048576K -} - -Deoptimization events (16 events): -Event: 0.632 Thread 0x00007f01b0028800 Uncommon trap: trap_request=0xffffff45 fr.pc=0x00007f01a01a0598 relative=0x00000000000001d8 -Event: 0.632 Thread 0x00007f01b0028800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00007f01a01a0598 method=java.lang.String.hashCode()I @ 42 c2 -Event: 0.632 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f01a01a0598 sp=0x00007f01b9241330 -Event: 0.632 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871de25 sp=0x00007f01b92412e8 mode 2 -Event: 2.512 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f0198cb6484 sp=0x00007f01b9240b90 -Event: 2.513 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871e33a sp=0x00007f01b9240008 mode 0 -Event: 2.799 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f0198cc1322 sp=0x00007f01b92411c0 -Event: 2.799 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871e33a sp=0x00007f01b9240648 mode 0 -Event: 3.948 Thread 0x00007f01b0028800 Uncommon trap: trap_request=0xffffff45 fr.pc=0x00007f01a01a2068 relative=0x0000000000000068 -Event: 3.948 Thread 0x00007f01b0028800 Uncommon trap: reason=unstable_if action=reinterpret pc=0x00007f01a01a2068 method=java.lang.String.isLatin1()Z @ 10 c2 -Event: 3.948 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f01a01a2068 sp=0x00007f01b92418d0 -Event: 3.948 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871de25 sp=0x00007f01b9241880 mode 2 -Event: 6.052 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f0198cca4e8 sp=0x00007f01b9240f60 -Event: 6.052 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871e33a sp=0x00007f01b92403d0 mode 0 -Event: 9.484 Thread 0x00007f01b0028800 DEOPT PACKING pc=0x00007f0198cc64c5 sp=0x00007f01b923f9a0 -Event: 9.485 Thread 0x00007f01b0028800 DEOPT UNPACKING pc=0x00007f019871e33a sp=0x00007f01b923ee20 mode 0 - -Classes unloaded (0 events): -No events - -Classes redefined (0 events): -No events - -Internal exceptions (17 events): -Event: 1.373 Thread 0x00007f01b0028800 Exception (0x00000000e0dc59d8) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 3.603 Thread 0x00007f01b0028800 Exception (0x00000000e1209430) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 4.004 Thread 0x00007f01b0028800 Exception (0x00000000e12808b8) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 4.253 Thread 0x00007f01b0028800 Exception (0x00000000e12d4648) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 4.809 Thread 0x00007f01b0028800 Exception (0x00000000e1346010) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 4.925 Thread 0x00007f01b0028800 Exception (0x00000000e137ad28) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 4.993 Thread 0x00007f01b0028800 Exception (0x00000000e139e938) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 5.012 Thread 0x00007f01b0028800 Exception (0x00000000e13a8b18) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 5.041 Thread 0x00007f01b0028800 Exception (0x00000000e13b69e8) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 832] -Event: 5.141 Thread 0x00007f01b0028800 Exception (0x00000000e13ebf18) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 5.852 Thread 0x00007f01b0028800 Exception (0x00000000e0c24ce8) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.079 Thread 0x00007f01b0028800 Exception (0x00000000e0c8faf8) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.396 Thread 0x00007f01b0028800 Exception (0x00000000e0cfcd80) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.442 Thread 0x00007f01b0028800 Exception (0x00000000e0d15098) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 6.449 Thread 0x00007f01b0028800 Exception (0x00000000e0d17a88) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 832] -Event: 8.061 Thread 0x00007f01b0028800 Exception (0x00000000e0f73890) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] -Event: 8.061 Thread 0x00007f01b0028800 Exception (0x00000000e0f76c98) -thrown [open/src/hotspot/share/interpreter/linkResolver.cpp, line 766] - -Events (20 events): -Event: 10.009 loading class sun/security/provider/ByteArrayAccess -Event: 10.009 loading class sun/security/provider/ByteArrayAccess done -Event: 10.010 loading class java/io/DeleteOnExitHook -Event: 10.010 loading class java/io/DeleteOnExitHook done -Event: 10.010 loading class java/io/DeleteOnExitHook$1 -Event: 10.011 loading class java/io/DeleteOnExitHook$1 done -Event: 10.043 loading class java/io/FileOutputStream$1 -Event: 10.043 loading class java/io/FileOutputStream$1 done -Event: 10.046 Loaded shared library /root/.cache/JNA/temp/jna8092103267992246554.tmp -Event: 10.046 loading class java/nio/ShortBuffer -Event: 10.048 loading class java/nio/ShortBuffer done -Event: 10.051 loading class java/nio/FloatBuffer -Event: 10.051 loading class java/nio/FloatBuffer done -Event: 10.054 loading class java/nio/DoubleBuffer -Event: 10.057 loading class java/nio/DoubleBuffer done -Event: 10.132 Executing VM operation: HandshakeAllThreads -Event: 10.132 Executing VM operation: HandshakeAllThreads done -Event: 10.168 Loaded shared library /usr/java/openjdk-14/lib/libzip.so -Event: 10.207 Executing VM operation: HandshakeAllThreads -Event: 10.210 Executing VM operation: HandshakeAllThreads done - - -Dynamic libraries: -e0c00000-e16a0000 rw-p 00000000 00:00 0 -e16a0000-eb2a0000 ---p 00000000 00:00 0 -eb2a0000-ec800000 rw-p 00000000 00:00 0 -ec800000-100000000 ---p 00000000 00:00 0 -800000000-800003000 rwxp 00001000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa -800003000-8003e4000 rw-p 00004000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa -8003e4000-800b10000 r--p 003e5000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa -800b10000-800b11000 rw-p 00b11000 08:01 3160994 /usr/java/openjdk-14/lib/server/classes.jsa -800b11000-800bf1000 rw-p 00000000 00:00 0 -800bf1000-840b11000 ---p 00000000 00:00 0 -56394c07f000-56394c080000 r-xp 00000000 08:01 3160482 /usr/java/openjdk-14/bin/java -56394c081000-56394c082000 r--p 00001000 08:01 3160482 /usr/java/openjdk-14/bin/java -56394c082000-56394c083000 rw-p 00002000 08:01 3160482 /usr/java/openjdk-14/bin/java -56394c563000-56394c584000 rw-p 00000000 00:00 0 [heap] -7f017c000000-7f017c3ce000 rw-p 00000000 00:00 0 -7f017c3ce000-7f0180000000 ---p 00000000 00:00 0 -7f0180000000-7f01802f1000 rw-p 00000000 00:00 0 -7f01802f1000-7f0184000000 ---p 00000000 00:00 0 -7f0184000000-7f0184021000 rw-p 00000000 00:00 0 -7f0184021000-7f0188000000 ---p 00000000 00:00 0 -7f0188000000-7f0188021000 rw-p 00000000 00:00 0 -7f0188021000-7f018c000000 ---p 00000000 00:00 0 -7f018c000000-7f018c021000 rw-p 00000000 00:00 0 -7f018c021000-7f0190000000 ---p 00000000 00:00 0 -7f0190000000-7f0190021000 rw-p 00000000 00:00 0 -7f0190021000-7f0194000000 ---p 00000000 00:00 0 -7f0194000000-7f0194021000 rw-p 00000000 00:00 0 -7f0194021000-7f0198000000 ---p 00000000 00:00 0 -7f01986d5000-7f0198945000 rwxp 00000000 00:00 0 -7f0198945000-7f0198c64000 ---p 00000000 00:00 0 -7f0198c64000-7f0198ed4000 rwxp 00000000 00:00 0 -7f0198ed4000-7f01a019c000 ---p 00000000 00:00 0 -7f01a019c000-7f01a040c000 rwxp 00000000 00:00 0 -7f01a040c000-7f01a76d5000 ---p 00000000 00:00 0 -7f01a76d5000-7f01b0000000 r--s 00000000 08:01 3160985 /usr/java/openjdk-14/lib/modules -7f01b0000000-7f01b04f4000 rw-p 00000000 00:00 0 -7f01b04f4000-7f01b4000000 ---p 00000000 00:00 0 -7f01b45cb000-7f01b4a89000 rw-p 00000000 00:00 0 -7f01b4a89000-7f01b4aa1000 r-xp 00000000 08:01 3163771 /root/.cache/JNA/temp/jna8092103267992246554.tmp (deleted) -7f01b4aa1000-7f01b4ca1000 ---p 00018000 08:01 3163771 /root/.cache/JNA/temp/jna8092103267992246554.tmp (deleted) -7f01b4ca1000-7f01b4ca2000 rw-p 00018000 08:01 3163771 /root/.cache/JNA/temp/jna8092103267992246554.tmp (deleted) -7f01b4ca2000-7f01b4caf000 r-xp 00000000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so -7f01b4caf000-7f01b4cb1000 r--p 0000c000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so -7f01b4cb1000-7f01b4cb2000 rw-p 0000e000 08:01 3160983 /usr/java/openjdk-14/lib/libverify.so -7f01b4cb2000-7f01b4cb6000 ---p 00000000 00:00 0 -7f01b4cb6000-7f01b4db3000 rw-p 00000000 00:00 0 -7f01b4db3000-7f01b4db8000 r-xp 00000000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so -7f01b4db8000-7f01b4db9000 r--p 00004000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so -7f01b4db9000-7f01b4dba000 rw-p 00005000 08:01 3160973 /usr/java/openjdk-14/lib/libmanagement_ext.so -7f01b4dba000-7f01b4dbe000 r-xp 00000000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so -7f01b4dbe000-7f01b4dbf000 r--p 00003000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so -7f01b4dbf000-7f01b4dc0000 rw-p 00004000 08:01 3160971 /usr/java/openjdk-14/lib/libmanagement.so -7f01b4dc0000-7f01b4dc4000 ---p 00000000 00:00 0 -7f01b4dc4000-7f01b4ec1000 rw-p 00000000 00:00 0 -7f01b4ec1000-7f01b4ed6000 r-xp 00000000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so -7f01b4ed6000-7f01b4ed7000 r--p 00014000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so -7f01b4ed7000-7f01b4ed8000 rw-p 00015000 08:01 3160975 /usr/java/openjdk-14/lib/libnet.so -7f01b4ed8000-7f01b4edc000 ---p 00000000 00:00 0 -7f01b4edc000-7f01b4fd9000 rw-p 00000000 00:00 0 -7f01b4fd9000-7f01b4fda000 ---p 00000000 00:00 0 -7f01b4fda000-7f01b50db000 rw-p 00000000 00:00 0 -7f01b50db000-7f01b50df000 ---p 00000000 00:00 0 -7f01b50df000-7f01b51dc000 rw-p 00000000 00:00 0 -7f01b51dc000-7f01b51e0000 ---p 00000000 00:00 0 -7f01b51e0000-7f01b52dd000 rw-p 00000000 00:00 0 -7f01b52dd000-7f01b52e1000 ---p 00000000 00:00 0 -7f01b52e1000-7f01b53de000 rw-p 00000000 00:00 0 -7f01b53de000-7f01b53e2000 ---p 00000000 00:00 0 -7f01b53e2000-7f01b54df000 rw-p 00000000 00:00 0 -7f01b54df000-7f01b54e3000 ---p 00000000 00:00 0 -7f01b54e3000-7f01b55e0000 rw-p 00000000 00:00 0 -7f01b55e0000-7f01b55e4000 ---p 00000000 00:00 0 -7f01b55e4000-7f01b56e1000 rw-p 00000000 00:00 0 -7f01b56e1000-7f01b5734000 r--p 00000000 08:01 3154692 /usr/lib/locale/C.utf8/LC_CTYPE -7f01b5734000-7f01b5dd5000 r--p 00000000 08:01 3154691 /usr/lib/locale/C.utf8/LC_COLLATE -7f01b5dd5000-7f01b5dd9000 ---p 00000000 00:00 0 -7f01b5dd9000-7f01b5ed6000 rw-p 00000000 00:00 0 -7f01b5ed6000-7f01b5eda000 ---p 00000000 00:00 0 -7f01b5eda000-7f01b5fd7000 rw-p 00000000 00:00 0 -7f01b5fd7000-7f01b5fd8000 ---p 00000000 00:00 0 -7f01b5fd8000-7f01b67f5000 rw-p 00000000 00:00 0 -7f01b67f5000-7f01b69b5000 ---p 00000000 00:00 0 -7f01b69b5000-7f01b69c0000 rw-p 00000000 00:00 0 -7f01b69c0000-7f01b6a5c000 ---p 00000000 00:00 0 -7f01b6a5c000-7f01b6a62000 rw-p 00000000 00:00 0 -7f01b6a62000-7f01b6aaf000 ---p 00000000 00:00 0 -7f01b6aaf000-7f01b6aba000 rw-p 00000000 00:00 0 -7f01b6aba000-7f01b6b56000 ---p 00000000 00:00 0 -7f01b6b56000-7f01b6b5c000 rw-p 00000000 00:00 0 -7f01b6b5c000-7f01b6c42000 ---p 00000000 00:00 0 -7f01b6c42000-7f01b6c47000 rw-p 00000000 00:00 0 -7f01b6c47000-7f01b6d2d000 ---p 00000000 00:00 0 -7f01b6d2d000-7f01b6d38000 r-xp 00000000 08:01 3155554 /usr/lib64/libnss_files-2.28.so -7f01b6d38000-7f01b6f37000 ---p 0000b000 08:01 3155554 /usr/lib64/libnss_files-2.28.so -7f01b6f37000-7f01b6f38000 r--p 0000a000 08:01 3155554 /usr/lib64/libnss_files-2.28.so -7f01b6f38000-7f01b6f39000 rw-p 0000b000 08:01 3155554 /usr/lib64/libnss_files-2.28.so -7f01b6f39000-7f01b6f3f000 rw-p 00000000 00:00 0 -7f01b6f3f000-7f01b6f46000 r-xp 00000000 08:01 3155596 /usr/lib64/librt-2.28.so -7f01b6f46000-7f01b7146000 ---p 00007000 08:01 3155596 /usr/lib64/librt-2.28.so -7f01b7146000-7f01b7147000 r--p 00007000 08:01 3155596 /usr/lib64/librt-2.28.so -7f01b7147000-7f01b7148000 rw-p 00008000 08:01 3155596 /usr/lib64/librt-2.28.so -7f01b7148000-7f01b72c9000 r-xp 00000000 08:01 3155521 /usr/lib64/libm-2.28.so -7f01b72c9000-7f01b74c8000 ---p 00181000 08:01 3155521 /usr/lib64/libm-2.28.so -7f01b74c8000-7f01b74c9000 r--p 00180000 08:01 3155521 /usr/lib64/libm-2.28.so -7f01b74c9000-7f01b74ca000 rw-p 00181000 08:01 3155521 /usr/lib64/libm-2.28.so -7f01b74ca000-7f01b84d9000 r-xp 00000000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so -7f01b84d9000-7f01b84da000 ---p 0100f000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so -7f01b84da000-7f01b857e000 r--p 0100f000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so -7f01b857e000-7f01b85b6000 rw-p 010b3000 08:01 3160996 /usr/java/openjdk-14/lib/server/libjvm.so -7f01b85b6000-7f01b8637000 rw-p 00000000 00:00 0 -7f01b8637000-7f01b87f0000 r-xp 00000000 08:01 3155424 /usr/lib64/libc-2.28.so -7f01b87f0000-7f01b89ef000 ---p 001b9000 08:01 3155424 /usr/lib64/libc-2.28.so -7f01b89ef000-7f01b89f3000 r--p 001b8000 08:01 3155424 /usr/lib64/libc-2.28.so -7f01b89f3000-7f01b89f5000 rw-p 001bc000 08:01 3155424 /usr/lib64/libc-2.28.so -7f01b89f5000-7f01b89f9000 rw-p 00000000 00:00 0 -7f01b89f9000-7f01b89fc000 r-xp 00000000 08:01 3155440 /usr/lib64/libdl-2.28.so -7f01b89fc000-7f01b8bfb000 ---p 00003000 08:01 3155440 /usr/lib64/libdl-2.28.so -7f01b8bfb000-7f01b8bfc000 r--p 00002000 08:01 3155440 /usr/lib64/libdl-2.28.so -7f01b8bfc000-7f01b8bfd000 rw-p 00003000 08:01 3155440 /usr/lib64/libdl-2.28.so -7f01b8bfd000-7f01b8c18000 r-xp 00000000 08:01 3155583 /usr/lib64/libpthread-2.28.so -7f01b8c18000-7f01b8e17000 ---p 0001b000 08:01 3155583 /usr/lib64/libpthread-2.28.so -7f01b8e17000-7f01b8e18000 r--p 0001a000 08:01 3155583 /usr/lib64/libpthread-2.28.so -7f01b8e18000-7f01b8e19000 rw-p 0001b000 08:01 3155583 /usr/lib64/libpthread-2.28.so -7f01b8e19000-7f01b8e1d000 rw-p 00000000 00:00 0 -7f01b8e1d000-7f01b8e33000 r-xp 00000000 08:01 3155650 /usr/lib64/libz.so.1.2.11 -7f01b8e33000-7f01b9032000 ---p 00016000 08:01 3155650 /usr/lib64/libz.so.1.2.11 -7f01b9032000-7f01b9033000 r--p 00015000 08:01 3155650 /usr/lib64/libz.so.1.2.11 -7f01b9033000-7f01b9034000 rw-p 00000000 00:00 0 -7f01b9034000-7f01b905d000 r-xp 00000000 08:01 3155395 /usr/lib64/ld-2.28.so -7f01b9061000-7f01b9072000 r-xp 00000000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so -7f01b9072000-7f01b9073000 ---p 00011000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so -7f01b9073000-7f01b9074000 r--p 00011000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so -7f01b9074000-7f01b9075000 rw-p 00012000 08:01 3160976 /usr/java/openjdk-14/lib/libnio.so -7f01b9075000-7f01b9076000 r--p 00000000 08:01 3154699 /usr/lib/locale/C.utf8/LC_NUMERIC -7f01b9076000-7f01b9077000 r--p 00000000 08:01 3154702 /usr/lib/locale/C.utf8/LC_TIME -7f01b9077000-7f01b9078000 r--p 00000000 08:01 3154697 /usr/lib/locale/C.utf8/LC_MONETARY -7f01b9078000-7f01b9079000 r--p 00000000 08:01 3154696 /usr/lib/locale/C.utf8/LC_MESSAGES/SYS_LC_MESSAGES -7f01b9079000-7f01b907a000 r--p 00000000 08:01 3154700 /usr/lib/locale/C.utf8/LC_PAPER -7f01b907a000-7f01b907b000 r--p 00000000 08:01 3154698 /usr/lib/locale/C.utf8/LC_NAME -7f01b907b000-7f01b907c000 r--p 00000000 08:01 3154690 /usr/lib/locale/C.utf8/LC_ADDRESS -7f01b907c000-7f01b907d000 r--p 00000000 08:01 3154701 /usr/lib/locale/C.utf8/LC_TELEPHONE -7f01b907d000-7f01b907e000 r--p 00000000 08:01 3154694 /usr/lib/locale/C.utf8/LC_MEASUREMENT -7f01b907e000-7f01b9085000 r--s 00000000 08:01 3155357 /usr/lib64/gconv/gconv-modules.cache -7f01b9085000-7f01b9086000 r--p 00000000 08:01 3154693 /usr/lib/locale/C.utf8/LC_IDENTIFICATION -7f01b9086000-7f01b90a0000 r--p 00000000 08:01 3154703 /usr/lib/locale/locale-archive -7f01b90a0000-7f01b90e6000 rw-p 00000000 00:00 0 -7f01b90e6000-7f01b90ed000 ---p 00000000 00:00 0 -7f01b90ed000-7f01b90f4000 r-xp 00000000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so -7f01b90f4000-7f01b90f5000 r--p 00006000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so -7f01b90f5000-7f01b90f6000 rw-p 00007000 08:01 3160984 /usr/java/openjdk-14/lib/libzip.so -7f01b90f6000-7f01b911a000 r-xp 00000000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so -7f01b911a000-7f01b911b000 r--p 00023000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so -7f01b911b000-7f01b911d000 rw-p 00024000 08:01 3160962 /usr/java/openjdk-14/lib/libjava.so -7f01b911d000-7f01b9125000 rw-s 00000000 08:01 3163742 /tmp/hsperfdata_root/98 -7f01b9125000-7f01b9140000 r-xp 00000000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so -7f01b9140000-7f01b9142000 r--p 0001a000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so -7f01b9142000-7f01b9143000 rw-p 0001c000 08:01 3160966 /usr/java/openjdk-14/lib/libjimage.so -7f01b9143000-7f01b9147000 ---p 00000000 00:00 0 -7f01b9147000-7f01b9246000 rw-p 00000000 00:00 0 -7f01b9246000-7f01b9254000 r-xp 00000000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so -7f01b9254000-7f01b9255000 ---p 0000e000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so -7f01b9255000-7f01b9256000 r--p 0000e000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so -7f01b9256000-7f01b9257000 rw-p 0000f000 08:01 3160967 /usr/java/openjdk-14/lib/libjli.so -7f01b9257000-7f01b9259000 rw-p 00000000 00:00 0 -7f01b9259000-7f01b925a000 ---p 00000000 00:00 0 -7f01b925a000-7f01b925b000 r--p 00000000 00:00 0 -7f01b925b000-7f01b925c000 ---p 00000000 00:00 0 -7f01b925c000-7f01b925d000 r--p 00028000 08:01 3155395 /usr/lib64/ld-2.28.so -7f01b925d000-7f01b925e000 rw-p 00029000 08:01 3155395 /usr/lib64/ld-2.28.so -7f01b925e000-7f01b925f000 rw-p 00000000 00:00 0 -7fff92d75000-7fff92d96000 rw-p 00000000 00:00 0 [stack] -7fff92da2000-7fff92da5000 r--p 00000000 00:00 0 [vvar] -7fff92da5000-7fff92da7000 r-xp 00000000 00:00 0 [vdso] -ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] - - -VM Arguments: -java_command: /project/java-native/target/surefire/surefirebooter255261521587421006.jar /project/java-native/target/surefire 2020-10-01T00-29-55_633-jvmRun3 surefire15563279322398545368tmp surefire_13579138375161683305tmp -java_class_path (initial): /project/java-native/target/surefire/surefirebooter255261521587421006.jar -Launcher Type: SUN_STANDARD - -[Global flags] - intx CICompilerCount = 2 {product} {ergonomic} - size_t InitialHeapSize = 33554432 {product} {ergonomic} - size_t MaxHeapSize = 524288000 {product} {ergonomic} - size_t MaxNewSize = 174718976 {product} {ergonomic} - size_t MinHeapDeltaBytes = 196608 {product} {ergonomic} - size_t MinHeapSize = 8388608 {product} {ergonomic} - size_t NewSize = 11141120 {product} {ergonomic} - uintx NonNMethodCodeHeapSize = 5826188 {pd product} {ergonomic} - uintx NonProfiledCodeHeapSize = 122916026 {pd product} {ergonomic} - size_t OldSize = 22413312 {product} {ergonomic} - uintx ProfiledCodeHeapSize = 122916026 {pd product} {ergonomic} - uintx ReservedCodeCacheSize = 251658240 {pd product} {ergonomic} - bool SegmentedCodeCache = true {product} {ergonomic} - size_t SoftMaxHeapSize = 524288000 {manageable} {ergonomic} - bool UseCompressedClassPointers = true {lp64_product} {ergonomic} - bool UseCompressedOops = true {lp64_product} {ergonomic} - bool UseSerialGC = true {product} {ergonomic} - -Logging: -Log output configuration: - #0: stdout all=warning uptime,level,tags - #1: stderr all=off uptime,level,tags - -Environment Variables: -JAVA_HOME=/usr/java/openjdk-14 -PATH=/usr/java/openjdk-14/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -Signal Handlers: -SIGSEGV: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGBUS: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGFPE: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGPIPE: [libjvm.so+0xb1bca0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGXFSZ: [libjvm.so+0xb1bca0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGILL: [libjvm.so+0xd30e60], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGUSR2: [libjvm.so+0xb1bb30], sa_mask[0]=00100000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO -SIGHUP: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGINT: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGTERM: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO -SIGQUIT: [libjvm.so+0xb1c2a0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO - - ---------------- S Y S T E M --------------- - -OS:Oracle Linux Server release 8.2 -uname:Linux 4.14.154-boot2docker #1 SMP Thu Nov 14 19:19:08 UTC 2019 x86_64 -OS uptime: 0 days 14:09 hours -libc:glibc 2.28 NPTL 2.28 -rlimit: STACK 8192k, CORE infinity, NPROC infinity, NOFILE 1048576, AS infinity, DATA infinity, FSIZE infinity -load average:3.31 1.71 0.93 - -/proc/meminfo: -MemTotal: 2045412 kB -MemFree: 1093300 kB -MemAvailable: 1371360 kB -Buffers: 84560 kB -Cached: 472628 kB -SwapCached: 0 kB -Active: 588744 kB -Inactive: 294936 kB -Active(anon): 402104 kB -Inactive(anon): 198736 kB -Active(file): 186640 kB -Inactive(file): 96200 kB -Unevictable: 0 kB -Mlocked: 0 kB -SwapTotal: 1415172 kB -SwapFree: 1415172 kB -Dirty: 676 kB -Writeback: 0 kB -AnonPages: 326512 kB -Mapped: 116960 kB -Shmem: 290620 kB -Slab: 42612 kB -SReclaimable: 27604 kB -SUnreclaim: 15008 kB -KernelStack: 4640 kB -PageTables: 2556 kB -NFS_Unstable: 0 kB -Bounce: 0 kB -WritebackTmp: 0 kB -CommitLimit: 2437876 kB -Committed_AS: 1765096 kB -VmallocTotal: 34359738367 kB -VmallocUsed: 0 kB -VmallocChunk: 0 kB -HugePages_Total: 0 -HugePages_Free: 0 -HugePages_Rsvd: 0 -HugePages_Surp: 0 -Hugepagesize: 2048 kB -DirectMap4k: 44992 kB -DirectMap2M: 2052096 kB - - -/proc/sys/kernel/threads-max (system-wide limit on the number of threads): -15537 - - -/proc/sys/vm/max_map_count (maximum number of memory map areas a process may have): -65530 - - -/proc/sys/kernel/pid_max (system-wide limit on number of process identifiers): -32768 - - - -container (cgroup) information: -container_type: cgroupv1 -cpu_cpuset_cpus: 0 -cpu_memory_nodes: 0 -active_processor_count: 1 -cpu_quota: no quota -cpu_period: 100000 -cpu_shares: no shares -memory_limit_in_bytes: unlimited -memory_and_swap_limit_in_bytes: unlimited -memory_soft_limit_in_bytes: unlimited -memory_usage_in_bytes: 348696576 -memory_max_usage_in_bytes: 387022848 - -KVM virtualization detected -Steal ticks since vm start: 0 -Steal ticks percentage since vm start: 0.000 - -CPU:total 1 (initial active 1) (1 cores per cpu, 1 threads per core) family 6 model 69 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, lzcnt, tsc, tscinvbit -CPU Model and flags from /proc/cpuinfo: -model name : Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz -flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm invpcid_single pti fsgsbase avx2 invpcid md_clear flush_l1d - -Memory: 4k page, physical 2045412k(1093300k free), swap 1415172k(1415172k free) - -vm_info: OpenJDK 64-Bit Server VM (14.0.2+12-46) for linux-amd64 JRE (14.0.2+12-46), built on Jul 8 2020 23:30:21 by "mach5one" with gcc 8.3.0 - -END. From 3dddb550b63ab5725ad0ac0d588dd7f55bb87772 Mon Sep 17 00:00:00 2001 From: psevestre Date: Thu, 1 Oct 2020 17:13:15 -0300 Subject: [PATCH 0854/1862] [BAEL-4204] JNA (#10113) * [BAEL-4203] JNA * [BAEL-4203] JNA --- {jni => java-native}/README.md | 0 java-native/pom.xml | 39 +++++++++++++++ .../com_baeldung_jni_ExampleObjectsJNI.cpp | 0 .../cpp/com_baeldung_jni_ExampleObjectsJNI.h | 0 .../com_baeldung_jni_ExampleParametersJNI.cpp | 0 .../com_baeldung_jni_ExampleParametersJNI.h | 0 .../cpp/com_baeldung_jni_HelloWorldJNI.cpp | 0 .../main/cpp/com_baeldung_jni_HelloWorldJNI.h | 0 .../src/main/cpp/generateNativeLib.bat | 0 .../src/main/cpp/generateNativeLib.sh | 0 .../src/main/cpp/generateNativeLibMac.sh | 0 .../src/main/java/com/baeldung/jna/CMath.java | 10 ++++ .../src/main/java/com/baeldung/jna/Main.java | 8 +++ .../main/java/com/baeldung/jna/NativeFS.java | 46 +++++++++++++++++ .../src/main/java/com/baeldung/jna/StdC.java | 17 +++++++ .../com/baeldung/jni/ExampleObjectsJNI.java | 0 .../baeldung/jni/ExampleParametersJNI.java | 0 .../java/com/baeldung/jni/HelloWorldJNI.java | 0 .../main/java/com/baeldung/jni/UserData.java | 0 .../src/main/resources/logback.xml | 0 .../java/com/baeldung/jna/CMathUnitTest.java | 18 +++++++ .../com/baeldung/jna/NativeFSUnitTest.java | 38 ++++++++++++++ .../java/com/baeldung/jna/StdCUnitTest.java | 47 ++++++++++++++++++ .../com/baeldung/jni/JNINativeManualTest.java | 0 jni/native/linux_x86_64/libnative.so | Bin 19856 -> 0 bytes jni/native/macos/libnative.dylib | Bin 23056 -> 0 bytes jni/pom.xml | 14 ------ pom.xml | 4 +- 28 files changed, 225 insertions(+), 16 deletions(-) rename {jni => java-native}/README.md (100%) create mode 100644 java-native/pom.xml rename {jni => java-native}/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp (100%) rename {jni => java-native}/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h (100%) rename {jni => java-native}/src/main/cpp/generateNativeLib.bat (100%) rename {jni => java-native}/src/main/cpp/generateNativeLib.sh (100%) mode change 100755 => 100644 rename {jni => java-native}/src/main/cpp/generateNativeLibMac.sh (100%) mode change 100755 => 100644 create mode 100644 java-native/src/main/java/com/baeldung/jna/CMath.java create mode 100644 java-native/src/main/java/com/baeldung/jna/Main.java create mode 100644 java-native/src/main/java/com/baeldung/jna/NativeFS.java create mode 100644 java-native/src/main/java/com/baeldung/jna/StdC.java rename {jni => java-native}/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java (100%) rename {jni => java-native}/src/main/java/com/baeldung/jni/ExampleParametersJNI.java (100%) rename {jni => java-native}/src/main/java/com/baeldung/jni/HelloWorldJNI.java (100%) rename {jni => java-native}/src/main/java/com/baeldung/jni/UserData.java (100%) rename {jni => java-native}/src/main/resources/logback.xml (100%) create mode 100644 java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java create mode 100644 java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java create mode 100644 java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java rename {jni => java-native}/src/test/java/com/baeldung/jni/JNINativeManualTest.java (100%) delete mode 100755 jni/native/linux_x86_64/libnative.so delete mode 100755 jni/native/macos/libnative.dylib delete mode 100644 jni/pom.xml diff --git a/jni/README.md b/java-native/README.md similarity index 100% rename from jni/README.md rename to java-native/README.md diff --git a/java-native/pom.xml b/java-native/pom.xml new file mode 100644 index 0000000000..29fc13b8d8 --- /dev/null +++ b/java-native/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + java-native + java-native + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + 5.6.0 + + + + + net.java.dev.jna + jna-platform + ${jna.version} + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + false + + + + + \ No newline at end of file diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp rename to java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.cpp diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h b/java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h rename to java-native/src/main/cpp/com_baeldung_jni_ExampleObjectsJNI.h diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp rename to java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.cpp diff --git a/jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h b/java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h rename to java-native/src/main/cpp/com_baeldung_jni_ExampleParametersJNI.h diff --git a/jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp b/java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp rename to java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.cpp diff --git a/jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h b/java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h similarity index 100% rename from jni/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h rename to java-native/src/main/cpp/com_baeldung_jni_HelloWorldJNI.h diff --git a/jni/src/main/cpp/generateNativeLib.bat b/java-native/src/main/cpp/generateNativeLib.bat similarity index 100% rename from jni/src/main/cpp/generateNativeLib.bat rename to java-native/src/main/cpp/generateNativeLib.bat diff --git a/jni/src/main/cpp/generateNativeLib.sh b/java-native/src/main/cpp/generateNativeLib.sh old mode 100755 new mode 100644 similarity index 100% rename from jni/src/main/cpp/generateNativeLib.sh rename to java-native/src/main/cpp/generateNativeLib.sh diff --git a/jni/src/main/cpp/generateNativeLibMac.sh b/java-native/src/main/cpp/generateNativeLibMac.sh old mode 100755 new mode 100644 similarity index 100% rename from jni/src/main/cpp/generateNativeLibMac.sh rename to java-native/src/main/cpp/generateNativeLibMac.sh diff --git a/java-native/src/main/java/com/baeldung/jna/CMath.java b/java-native/src/main/java/com/baeldung/jna/CMath.java new file mode 100644 index 0000000000..3ab5bdf48b --- /dev/null +++ b/java-native/src/main/java/com/baeldung/jna/CMath.java @@ -0,0 +1,10 @@ +package com.baeldung.jna; + +import com.sun.jna.Library; +import com.sun.jna.Native; +import com.sun.jna.Platform; + +public interface CMath extends Library { + CMath INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c", CMath.class); + double cosh(double value); +} diff --git a/java-native/src/main/java/com/baeldung/jna/Main.java b/java-native/src/main/java/com/baeldung/jna/Main.java new file mode 100644 index 0000000000..a81c878cde --- /dev/null +++ b/java-native/src/main/java/com/baeldung/jna/Main.java @@ -0,0 +1,8 @@ +package com.baeldung.jna; + +public class Main { + + public static void main(String[] args) { + + } +} \ No newline at end of file diff --git a/java-native/src/main/java/com/baeldung/jna/NativeFS.java b/java-native/src/main/java/com/baeldung/jna/NativeFS.java new file mode 100644 index 0000000000..58f2bda035 --- /dev/null +++ b/java-native/src/main/java/com/baeldung/jna/NativeFS.java @@ -0,0 +1,46 @@ +package com.baeldung.jna; + +import java.util.Collections; +import java.util.Map; + +import com.sun.jna.FunctionMapper; +import com.sun.jna.LastErrorException; +import com.sun.jna.Library; +import com.sun.jna.Native; +import com.sun.jna.NativeLong; +import com.sun.jna.Platform; +import com.sun.jna.Structure; +import com.sun.jna.Structure.FieldOrder; + +public interface NativeFS extends Library { + + FunctionMapper mapper = (library,method) -> { + if (Platform.isWindows()) { + return "_" + method.getName(); + } + else { + return "__x" + method.getName(); // On Linux, stat is actually _xstat + } + }; + + public NativeFS INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c", + NativeFS.class, + Collections.singletonMap(Library.OPTION_FUNCTION_MAPPER, mapper)); + + int stat(String path, Stat stat) throws LastErrorException; + + @FieldOrder({"st_dev","st_ino","st_mode","st_nlink","st_uid","st_gid","st_rdev","st_size","st_atime","st_mtime","st_ctime"}) + public class Stat extends Structure { + public int st_dev; + public int st_ino; + public short st_mode; + public short st_nlink; + public short st_uid; + public short st_gid; + public int st_rdev; + public NativeLong st_size; + public NativeLong st_atime; + public NativeLong st_mtime; + public NativeLong st_ctime; + } +} diff --git a/java-native/src/main/java/com/baeldung/jna/StdC.java b/java-native/src/main/java/com/baeldung/jna/StdC.java new file mode 100644 index 0000000000..1adbe684c4 --- /dev/null +++ b/java-native/src/main/java/com/baeldung/jna/StdC.java @@ -0,0 +1,17 @@ +package com.baeldung.jna; + +import com.sun.jna.LastErrorException; +import com.sun.jna.Library; +import com.sun.jna.Native; +import com.sun.jna.Platform; +import com.sun.jna.Pointer; + +public interface StdC extends Library { + StdC INSTANCE = Native.load(Platform.isWindows() ? "msvcrt" : "c", StdC.class ); + Pointer malloc(long n); + void free(Pointer p); + Pointer memset(Pointer p, int c, long n); + int open(String path, int flags) throws LastErrorException; + int close(int fd) throws LastErrorException; +} + diff --git a/jni/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java b/java-native/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java similarity index 100% rename from jni/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java rename to java-native/src/main/java/com/baeldung/jni/ExampleObjectsJNI.java diff --git a/jni/src/main/java/com/baeldung/jni/ExampleParametersJNI.java b/java-native/src/main/java/com/baeldung/jni/ExampleParametersJNI.java similarity index 100% rename from jni/src/main/java/com/baeldung/jni/ExampleParametersJNI.java rename to java-native/src/main/java/com/baeldung/jni/ExampleParametersJNI.java diff --git a/jni/src/main/java/com/baeldung/jni/HelloWorldJNI.java b/java-native/src/main/java/com/baeldung/jni/HelloWorldJNI.java similarity index 100% rename from jni/src/main/java/com/baeldung/jni/HelloWorldJNI.java rename to java-native/src/main/java/com/baeldung/jni/HelloWorldJNI.java diff --git a/jni/src/main/java/com/baeldung/jni/UserData.java b/java-native/src/main/java/com/baeldung/jni/UserData.java similarity index 100% rename from jni/src/main/java/com/baeldung/jni/UserData.java rename to java-native/src/main/java/com/baeldung/jni/UserData.java diff --git a/jni/src/main/resources/logback.xml b/java-native/src/main/resources/logback.xml similarity index 100% rename from jni/src/main/resources/logback.xml rename to java-native/src/main/resources/logback.xml diff --git a/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java b/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java new file mode 100644 index 0000000000..a9cc6ed1c4 --- /dev/null +++ b/java-native/src/test/java/com/baeldung/jna/CMathUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.jna; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +import com.sun.jna.Native; +import com.sun.jna.Platform; + +class CMathUnitTest { + @Test + void whenCallNative_thenSuccess() { + CMath lib = Native.load(Platform.isWindows() ? "msvcrt" : "c", CMath.class); + double result = lib.cosh(0); + assertEquals(1.0,result); + } + +} diff --git a/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java b/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java new file mode 100644 index 0000000000..d296f9e2ca --- /dev/null +++ b/java-native/src/test/java/com/baeldung/jna/NativeFSUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.jna; + +import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + +import org.junit.jupiter.api.Test; + +import com.baeldung.jna.NativeFS.Stat; +import com.sun.jna.LastErrorException; +import com.sun.jna.Platform; + +public class NativeFSUnitTest { + + + @Test + public void whenCallNative_thenSuccess() throws IOException { + NativeFS lib = NativeFS.INSTANCE; + + File f = Files.createTempFile("junit", ".bin").toFile(); + f.deleteOnExit(); + Stat stat = new Stat(); + try { + if (Platform.isWindows()) { + int rc = lib.stat(f.getAbsolutePath(), stat); + assertEquals(0, rc); + assertEquals(0,stat.st_size.longValue()); + } + } + catch(LastErrorException error) { + fail("stat failed: error code=" + error.getErrorCode()); + } + + } +} diff --git a/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java b/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java new file mode 100644 index 0000000000..c536fd63d5 --- /dev/null +++ b/java-native/src/test/java/com/baeldung/jna/StdCUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung.jna; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.BeforeClass; +import org.junit.jupiter.api.Test; + +import com.sun.jna.Native; +import com.sun.jna.Platform; +import com.sun.jna.Pointer; + +class StdCUnitTest { + + @BeforeClass + public static void setupProtectedMode() { + Native.setProtected(true); + } + + @Test + public void whenMalloc_thenSuccess() { + StdC lib = StdC.INSTANCE; + Pointer p = lib.malloc(1024); + p.setMemory(0l, 1024l, (byte) 0); + lib.free(p); + } + + @Test + public void whenAccessViolation_thenShouldThrowError() { + // Running this test on Linux requires additional setup using libjsig.so + // Details here: http://java-native-access.github.io/jna/5.6.0/javadoc/overview-summary.html#crash-protection + // IMPORTANT NOTICE: Code for illustration purposes only. DON'T DO THIS IN YOUR OWN CODE + if ( Platform.isWindows()) { + Error e = null; + Pointer p = new Pointer(0l); + + try { + p.setMemory(0, 100*1024, (byte) 0); + } + catch(Error err) { + e = err; + } + + assertNotNull(e, "Should throw Error"); + } + } + +} diff --git a/jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java b/java-native/src/test/java/com/baeldung/jni/JNINativeManualTest.java similarity index 100% rename from jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java rename to java-native/src/test/java/com/baeldung/jni/JNINativeManualTest.java diff --git a/jni/native/linux_x86_64/libnative.so b/jni/native/linux_x86_64/libnative.so deleted file mode 100755 index 213491e2688a87bdecd1fea411e578149f8e3f32..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19856 zcmeHPe|%h3mA{iTZD>Oipe?0E7_fzg$~4m^ZD_ZWHkt5Jk`nSmBT!!_Gm~UOG81Rs zl(bq6hOmTe+Afvf)8NW(q2~8zDz_o@y$Qj7_pU zr*>(i20&6!R)^PZ5$M!h*KKcQ8(x|}G=0_6PrkY3&-1!mOJ90ppX*AJI}g{zxJb=B zTzAZ=>Yh`0|2gx|ec*=^x3~%^?|rx~!R5wvIj$ABD6ParN=gYqS}g$orS9$(D>@aJbRnUt`L zSfSS~IR!Y*?JQzPFBJHI%$<__B{u#Lx4(#WFBObo)SuEN(w-`54~=6=&r169G$9~u z5`aC;^)Jn`=N;J&B{n_xK<<3hcPBLn(mMjMJm{fzSSZ^^lk_goiT^vx1>r}M9+CDu zBK7}H(#O#bq-U*c{|ZU3ka~_wI{6KyUr0M&p#g{_A1CZVseiw$uj-cscu4;fvYl1? zFkSELjYjmi;g1=*&h&63Y%sk8fa!HD4SFyX3w4I$MkvVnC%gxY+ji+qQbTo*KOPUonSRsu4coTY`69b?@7nF5+nSA7IMUhLQtNBHKESs5 zclq@|v{!HUhkAmENT=Q%3F}&@rziU1Xsjm)Nj>i0%?YHc*s{OKkB0-O87Z#|G#g%TpvxcAjhH`d#3924NfM+N_hV?bkaN>R5{k-d1PYjH1a}Be#VkL3DUL(Tlz(w+h^<2fA+6 zJN)4ua<=|{y)P7tN69^m-TJOF-snbUI2uQX$3x|HaKKD&TIr$??qGf+)K8vja-|K| zg^aW-RimrXB$ax%aDc`x2gmaD`+NI(LXG~Izc&Ook8}S@^wvd;P$y8{GwA*7&d=2= zffn?7g-(7<&P3f3KCObKW4A;b(0k+!Etp*bH?(($0*0?~gWesW zsfuh*PgLdbF2NvGz_p@Wz{2JQTSLg`iU#XyGMeBIa(+qcTVL((=@AMAKX+E4vC&(m zcf%XGmOU2zWzb(6#>99M_2tdVT+VG)evRJUAv835c?+j)BB7dS0u%f!Lc!VnSyYLS zq5!5sBh(rX#ZFnI50kY)5;cCq&w9e`aU&R5z1kCxde##fNZ)k^FkcboWqK$`+`8T# zkBcW6NRc4BuDV)Z=P6^?)z@vU*4KK<(|2n<6|B0gZOhg=-RoH=$Zc(4F88eUno<66 zAG&XJGz6g;T;9lfg%R)C9g=%U}b_??H#b;^HK262CzuSpnl18=-y_X2vu`8jBm zT+sY=nNQE|Md9$d3}ydH(h|$U=g=GCYia&`_9dA|@-KYjR;&!>vUeoyW7A(iMe^BP zyhN2C-zfboUN!UBVtT1UQtz?q{j*H2dk)C=RYm`@Tu+SK=oicN%7l&nj9jlw+UO_b z`}%a5o0qTjD|~#7pi}j*1Wcz16CF#Ubec5Ll`hJhGSSgs>2$b9)J6(g zFLpC+Xxu1Bz6=l61`ifKC6vxod>UCZEAPN>@ugL`BfN_;Q%7cyR_-C3+&(qQ@fhLc zqN#C?cN0!SI`t^W+X<(koEqc!O@x!{ruK2XiEwhw)Bwk~5l$|d>f`uU!fD8-c5-|p z;WX4!jT~P~IJs)7isM%iPA-}%<;S<{TlhoQT}eI zqspX6<;>&`?jLmDj6u+*4exze8%~S`wUIe1S5eJ|eM#@QHtKs)8$O)818t{`wmu0Q zw2EipfJENG$%5q!>tv+)Nz9KLDkaQx0jvFC`D9Sq~?V(mgTwQ2tLz zWdFNFc}nOyoUG#vQ`$&FGN`R9;>H=9j+F}*Ze53Df$%&0HZ5F~$szlaA0T}2VB5_* zo}#Lw<|V^>-yKd&5AJ=}l~{ZG-szbcG=C}j^={aktS4JW7x$9wqZPLi7%AAWRMbsJ z=Dr_tMgK}-Ptr7y{4#aVQ~Q*9G%S27aRL>b)Iow+JMrEoafLWGm}CK%yBFJ z;nw5B4M`Nb8-pK(zCzuK3cmdgZ?6&GakMkq@^1+rtuTlS*)OZ?q{#lbz@gwPTmhG< zh2c=31tv#)No~L8lI1sRw;#WY_x;|xVDo@B{JDPAW_aSRAp_9v8zZBXi;CU#1cXpL z>T)<)%Dd0EA4bvY4JBVGO}|#zf=prE)rwNEAY%>vk+O?%Kkz*&oEeKbakPTg ziInF?LB}qT#QP+10hLZ(IMNCW8lZ$5_3GP_47q+)s1KFo9(M)hW<2gC!ORW#H=bql zzO~0zo7f))%P|aiayl;a1u28FdQevK+l1eKkXrT>{O$s@MDizpB6}DAVTqgkj#1-` z6g;^Y07`#@%#-<@TltYT+?vezp2mHTDCCh1@V|do&PUTgC8Va%^OKO8$m;IaNhm@# zZ?h(<)JW@uiF7UOI<|}&g0me?euio>42i?Z0B47^Wf&JE?2#c-w;)li!WwCFfm z^Z-P0`GE5#{4Zhg6iUGb^60r23VT*cdv*v8S=9z9OdfrJMqF}~%HwtB_Dq<^;r(0| zPFe9wEI;5rV;2bbIlzVflj`(!eoM3S2+!oR!zvP_iDB@dmgyG9c`~>N{h zxU^wkacS#Vap{gni%Ub}#ihNI#ifZO#ie^sn1w-gmPJXDT5da=UX zgC-oR1geb=H4+#eq7|SvGQ^GHkDjGu-RLNZYa_y}5n<#AH+cpFe`uAE65w-GB%ZsA z#B;YGdGrr6GucloKFe6z=>*omj_qW6&Sgthad)-1FdRtrep%XAFt^bRVd|a%F1**& zJv7PfouW~SVT{=hieMS7`!maY#&_G@9kFPyyL$C%_hpx%Nhtx@=x*r>xg&|*cI=kA zW1&DOyekxR`(q*ZMmKZ&BSCkDO>D+yxWaMpG{imliQxy^{%h2>{~B!juSstO)pz4q zU`>xd(z!T}ktTvqxbB#*M-e&VM*=6rQ3=Z+*UZiu3fh2 zs&y+aCwbzj!PSkr^L>ad3rp_It3G$`txzQM0hnt~V?8fn-n~P`ZnoT94wW_e=FH4H zfOF^|S?TZ%=I8xBqvvbL|9gy*I>0nfUJYj;JD#Bn`SjA0&Tq`f9|w6O+P=b^-@8g_-Y$W|_QBOKMob!H@o!Vf2{w=OF-<#l@hjNAh=Ui&yqxuMSyxl$l zJ=eo0oa*yM zWc2?9^4pRBJ9B7l`J2r0yE6K}i2M%ZYv%mC>a_mvBA=d* z&sy>)cs}*l&yfFPli!g!g>&Nx7NhiH(g!~%arTFZ{)GN^9peP`8;I5NI&2yS_|kasAqn_ zv*~OLoNa-#EpWC4&bGkW7C74iXIntDfI3H3=f>)sSe*;2b70k8SlaSLXW5h#PJ5hY zoX*ZE6$z03o>rY1w#o1F)LEE1-(D{H-4ZU7P@PZHx{?yT15x_Jdoxjj^xj8FE%mD8 zp{O*2J&ZLgC3Plxnao#bp|m+cNxr^ef$iqF6k}uZM!nZbasHl4jN^2|grw+g#R6A$ z@)I|Z=-`WzDi5!W-2MqV!9v331;>>gCnVl3^YJRn^Hsfs)c>Df_1(PPqR-32)`ukg zmV}2S{HcV$mhdeJ=gJ0OBHl3w@09TK5eK^@a6op-&^T(m>M5edI3{@W~I+%%0I32 zc})4am0p-04_12iclDH?k5M@w``gODfHlhYwbJq3Z%%slchN%sLe?ec8>^n;bR342 zUcw45GgHKUKE7nHrx##b%Ey<*YW^~3<+BTznzyX--nH$cx-uLn8*MeH1}8+V!K z+T*w<`){TVNhH3P0r)B|qO0eosvdp+Kb!vf4*Fk^4??AX3G|SD^*mPkKY9}V3mo(h z$_J;?e}mMop7TmS$T{sFLWT=prfD|+zlYPa{Q+un>iIj)kEfrsQ#~KC%Y&3X9-rg< z*?#`2)MJldpn1@h!~g%x>Dl9JE}rX`qn+*F;jfT%dmO=sCH;~2k-d!ZJvzY8fPOxw zSbrV_-EAdt>~RPB1lN;2k3Hw0{|(T|etUex5-cEc+0*GjzukfU5a_w=|A7Plyg9kc zy%BV>(;m+)0 zG|lxFF?-y{`BbgBdwj|xpi}$U<4~TLbbFl6 zpB(gSSm5Tee;=o3#|<3@oyxVx(Y)cHXA35TT>9y2*bx}K^^z8M_mmK(6AZEmkL`R1Qfe8Ax>L$IuuDJyPKACtP-RRW=6w!n4 z-1T5o@9c@gc9&FAo_p5Vk{H57=#Tx{A* z!5Yr-9H$>pV~QrR6iAT*6l>~1N>X`}onLU=r66a{`{L>0y%*`yP zqRfnoI5T>RA#k~h^ZmJHU}G8i$B%6m?DGB zQ_3j^H_aN0^*@MxwA4nq{h5VjT2##*|1?|dVa6Lz7T(BboYRf@!!*hR?JU;Had7%m zCA6tn+H8d~NDKa>0(LDt^fbr{4y~#(MQQyXgyC8&qGp)Yp>6$U3Ei|r!a}VKMU(N> zXEI%h@XRa=nJ2!x*YLLk8ZiO8)LkTMggl**gr_|b?g?HU4l<5)`Qu&86Wkqvq<}_D zd5FL53P>-Jkb^SwK@{xo4F@0>HK;&PDBjP5a6jh3Dzz6Y&+H}h z8Bu8e2(Jp*3lT}}e=4{_(iOn#p(W8i6Fx19DtWa}s^9_1jn`S8@OofLmB8qXK*_6f z1O@3sTuKCpN6D-G{VLE%w~|-;t_rGi2(a*kZ3;`$fYF(Nl2`k)X(+js{fbY)R^-ze zgTmE5u7dldJlRh=l>L&-g1Aw2BbwUpRZyL4sPdJ(s((bvZzW+Qbxxw-m^6&!X^YJ+ z-wztK30_BeQva7lLHo`n*=kO4AZB^B&#d62t-(vAu!5ho$*cWn1r?tvQ`xWZzqHA# z{ZR$q!uz5*+4YUuG zosRO9yxPy7Ghx$qK7>SLG`|`n0Wl zb&fE;1{p|I{5SKXEXLTS;S1PGjnp5-t!M8G|kPU*tHUGS%~xnXh{Lt+pV7!QF#OrxN7dg&!rE#WeWLZ?AP0}&A5)6`5w7-A*R zsK57izxyZIv5lFwGy2BgzJ0rI-@bkO_U(RePk!OeU%jY<)ss4J>R1I@+q4SY~GeN_oXcmcm0XU^$*FcR%<>o}mwi}@W}D=WUQ z>K$C6b9n1|tmBhy9W8oW$No+b74zG(PPROy7!ZCj`N&RcFcw{}+qQd~YDB=Xj|x>* zgp-|+?a@n*t{>>kGm{JQ^Ds3M@N?Qy5zXf+%BV-zJHmS8NPBZ;OIK%Ir{f@{{StyYc5)~MfM=%EsD zwZcg+3(tZE7BsM+fdvgLXkbAD3mRC^!2drDG-<}qwf=KenpyUu2S;FQ>8|$x7`?V; z#3nUkR5PBpxBey9bYXa!;hoWphH1_0otbT#20Eejk5uhF?S4-mjb8EdfCK1aOsAOy zy&xv8;24{({rC8)0%OXX-=>)}M(xj`EUVe`QXC?{*vN1_(r{ru z2SKQ&ip)4`vLC^xrM-hV8}UIj%vr5P=miWn{SB^z?Z#zpXaEIl!70kYh~r-boT?=; z3+#AnRuI!WX2Q6QcoLL`^$^jogyl)Qwi3YYC-D``roG5%cAOczpBdB46phq4&a2mq zvtAN}B+e#MpFx#orpd~V#|f$9COpk($yzp9%RVzsTDGOp$9s@>Y>BYErnv zsYa!&cmz&sDI0#~xtUQ)m4n6|@7?W&QOyViI+UF`t#1`0v?SpLKEtD96s4pE6_q-q!pRT01%CNRq3 z5MZ)PDS(lxrMmt%U=x1|wZaQXQQ{RSpZZ7G0*Xiw^v%+(hWCk&a{)^R>=gH+KulLHEIlNgpojjM3Q_wXJb#>^^os@wMW^)S1P$2~HkjILaG^ z)V3^vDrHaXF%7lPNdGws>!NWuESMpk5k^_Tva&$eyAY?6M%SNaJ-8n}k14BueHacz z7|%hR0g}q(+PdS?B8&#O-rm8wg!fz6IOrTOSa%$Gqk*>kF_e#@9QlR`)J>pl5^xgG z2DIyqH+*zzF|01|wjYKK!12OEr3rUG(==+AQ<>BEkhBiD`I%}Dv}#EWrUZuC3ey_v zChg}s35@g}i4kx=y`+EA)jtFOJ=97AGpv2o=P`;v!vF|@|4Bgn1jJ7QCIL?X;;pX$ z{T`4^QS>lN9^c0uSPTrc*GhmP$~p%9&$_^%N0u;fwqD5=9Em$QK=OVV9b2rKlA@-j z$*Qn68Ca9j#<(zRV_avZxQ=bii2F%kntSD4xB#|Cyxqr!Xe6*b$$E^yD0_HF3H`>o z#I!Q9eu9BDPC)J5qr{q&p;%}%0xO;%fI|rZ!(vQsnHMz1(fBbClL=2zfR&x(36vPt zqr}8YlO@^$S4C61P%p`mf%vlO=N07WiAg+T#Onav$8f}y<2JdV-*(~9#WjuSY3hDT z_?)#HISgVNbr5@o0DGMb<+2{&ht!>NSBfg@0S2UQPB2I%rHZ&PJ3Cxw%DMs%(96S! z_fTh+)hapl5E$hRMNWp?TFq3KtWPjV^${@n0H9?(fWv|q8u5LSQ#k-S%8me=5K5-% zQRLW$EgS5S4g9$VTw-c)w3bGdrbU&Sfsz9E4UCxLv`pL1-qTpsG>P^&PJe1QyNz&? z!*BPwA&s%ORE@(~VWZy&f`E4lVCyWT#`5oPTr$+D-A zB?%6N@GM&C6R6azA(|Px9rSVqT5&E{w!u3Qb|b@!od~bt#V&-GHwgYtK82m>6m}>a zvl|B8PcQ5LsjL4@3@6=1>@i+|?CwSg+D?LY5^b;<u?O4@}Ptr z{xGVgwqdoT3foQfhLvq$qG*M^b2auA%sKOqiG*b+WR6=45 z47J;+jU{!0>WuU$1}6t3C1WOkdE%^2iozL)Gy|RzON}u$#K0Julo$aV{-+5uhGt|T z0iTg7C%ZS&Ra|%8cpi)^x#lcp+Jl_^?Q3|lsFaF$oun8zM^|}*HBwcwj)B34+|l?A zC?i|xPg5@E5>@~+Eh@`*352stpbWbNn2A)L3|+vOd7Z$B3yeB%-NaWw((HmEzk|}k1ROE7j&|x@laiEW9-*jm~XolNBG-?W^_z9TlRseeueZU)Wjf<4*^4rmr zpde&Klo%=+GcYc8?sfP7#Dy;|G${x3><9_L2on%B0ktFn;bsaByaFW7fmf1Wl>;xa zg%TLBKZ^|jmCBGu46G>ESq!d=VvtPmIuw3@$P%HCFX$+X&{vN6^SUS%! zm0V7)*LhVTxK<6b%DJ6dv^1>S^4gyu_VV*lGW-lN#QsP$M@MK$f6VbaW}4dDzk-8M z9_Ab!ao&AidYHm^VgET#*1xcOL{#gaYuL9qQQ7kv1vkAmI};Cm%;&{l`_I*CR@q~; zuJYW}Ywl&_*D20>#vUMU6bvRDXB%6m0&DrFsFAhw2)D&4#;LwlR!3!ZOjg5+RqJ<2 zb{SQGc1@@xC-|)WKB|+1RGxXwUE!UymvAY1=pU)&!&`y;bI1Qc75GhKJm6V8_~Q8U zy!xA<{o#Tviu70L-x0Hh(L+y&j(&EUJT*ti=~ERNHR$v81rPu#}yz_+e^r=S(|Q`tuppu6nm>Pb+lWx(WE#=V-ut?t$QY2aS{%}MwW_v){XGdP)HkQ!uQ4KPqA>vRGb z4&i+aI0TDLr3)DLUv`DY&^~H#tOdh%S8_A=YQAM~S1MkXA3KM;Qgy&5ad)Na^&}mS z-IYp|P@lU}3D=%OL1i2Dmv--5h z5g*Luo_utKCU5U)``=KQoLzYzTF$QgYfeAT={`=IIc?!|Kc}sn9^^F4X$PlWoOW{> z<@7M8J)GXpDakjx@^3lqE}6p zg3~W>N_)rb$}e;J6{J4v-R+Bn*w#3^axY-A6$2Mjzra+sRsf%RnR2Ts_kGIMP;QKJ z2t|vjXDC-kxu+=CM!Bz3?itDrP_6!93G z%C%6A!pl?lQSMrJizzbc);lP72jzm4yNz;xN4fQsJ3~1##MU2E?ncVZP>#-wvycCi zDBTFjgpU$>C{vI3Bq3kJi_KA_@w&c+j_Ctj*w_gDHAZqxz9@RufN*6aG zSuM+j*g*|}FasZuRZa~g?{(oNJU8CAz?L7%P{TB_{2mhGpTyC}H34Kyj+1_)NYCu! z)1s6OV#ukWOafKoRIpr0{$b)y`v)=Ong)e@3D9*flB|3WRvA^fCfXNP8unRX&N!+PV zg6TNmvakxlxPb<`?2K!c-ar3CvFUP}uP&!l5bYCQ~ixHxNN=M>-974(qu@YE{k zhs^vy7xY}K;0+4is9>dn>lM6B!8;W6D|nxRq+fbk6yBj=kAhv82YN`~^gO7_A5!o! z1)o=PPbm0P1!b#+bU_0P8d%W4f(8~eu%Lkj4J>G2K?4gKSkSC}zbc3!} zZwz+EqF&KAL9se|T*%9J3^n<~0AQJKK3^s1iAykd*B1>Jp4e_JkUCjqW z!Dx=0ySr~!jtV>*LebXF`Ir`QT)!*yNf`=i+I@!?9Tzj(2xhXw?IfDlU!x!FWC7+- zHin{gow4R{hzFEM>EEIs+%E^&GG8mn|01m#tM%e`o3{tTVcAfQHNU^=D*a%)(!l-2 zEpNeyvP0h98t9gTl94rkYZ3XDJ75cH=vnPZi>R&+qO~6F4zxuhnELAK&>{RU1NdJM zU<%&0Hqlp+Zz9Fy8$zA?y@yqI^K;xB4s{%ew&u-?q+7pH*Slg-7;vCF5R8Vp^+@PY zEQB~-eQ;N!Ufh${>%E7HH#7$#Z9%;gLk$Jm>v!wBt8}lo@fO{`vvH%|F8ciW@`fYz zm(DA=n>cL-r=aM=TFR}PuJHUaf%g_nVP`N9?d*p3@KAT_rHpbmq=>t#!TX+_jax|0 z&9DS^B!{YKB{#|c+u@#2B!>8AQXERS#F6+A4Wn^tdy4Kwy2I93O(4_5oyDosdvNec6WYKYUsrL?KcI(p+L9yAoV{eNgAVD z;Kth9@Sk;rc+m}WxgP8Z=*^)6Z5=xNL=esycAl$&spiVZN{Y7j{eiYHH5jLg_E0-S zCUk;O_!szAptvB=MVTnM6E`CmMLPy1uTOMbpXlOd?Ej)cl<>{XM?1U2E!esBNZ<$; z2+i9QXzvP##8*m7#lVfY1(8ldG&{So_*JP`bj7apm6AV_tADkmc#{xQC0E~7KU!A0 zX!=G`x@i0++~DMIXQ|RT+vVp=)t30hQZ)DgS`E}7$<#oter$Bu(Q%w&{fjfDa_?tU z;P$vA)?VKc4IKc5_*to%pWU4eAz@=`#=%HTZULieacoi1p8i~!Sp0T}f=9~co|HaU zRxL)$E_Q-Dws@m37GK6u<iRZX#XQh5s0dZ|V3>FTSKy zWbPzF9|-3^8_t$p>@@fY`pfu;LjySA04Kh=_`(Oi<4Z)zC7soNxA+ncf_>iPtn~{ zj%#RFAKxcZQLn=3K9QbZE4)J8vt5JR?|0x@neHCxd6&ZJ4w9Y^DV**i>G>;#)14$e zcPpIkCh4L3PdBc4Yt_BrW`z%^d%<>v)4e7=U&BlEeudNhJK=OsO3!u3yD=W;{&ADS zoqNc874Fq^Q)Sq*YA6EE)holkWb56aw-+W5p z&i&;p3U}@?F{jMWxzAjsaOWQKGYWU^9nUJ;wu>M*NX7( z6yax!@c$^ne=YH>eoL`F^7Z}BBK*c8d{q%nKUZCf7k?fi$b{*-8Q1Uve^4Uu_c7uI zytEYQr#aXt1^sap{-&1y|0(*v!8~|x!uwvl@56gD-j#S);e9{eO1!J_(w}(K5~XEG zOOO6+mX^>uyj6Is@ovDo2`{Zd`l$h3QLo2KKd-q3FP_@}tMYn;KL1%n9X0ayy}YgA zlG_ySAQx{|wCUz=s+ZL;Z)?6ly9*qz=qu7WNL@5kQb2ftC`lpB#dgI4%DMY~LG?xA zBZYLA79E+>=92c?f>xJt+$d=Gc1NIm;-V82RjIGzw~L8fm{cA9E=-Vre9Te(kq*eY z4zBp{o?~(K57xzz59;d@LLPZ!*{``=tRp9IQ5a_4FX^`na$GHLh;IDBtn$Mee>k&T zJmU}L#UI*vOfDyaakQI#e - - 4.0.0 - jni - jni - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index ab1c47361c..ac1a16a728 100644 --- a/pom.xml +++ b/pom.xml @@ -465,7 +465,7 @@ jjwt jmeter jmh - jni + java-native jooby jsf json @@ -1501,4 +1501,4 @@ 1.4.197 - \ No newline at end of file + From 76676ebfd86baa9960c2bb08d8547936de6fe8bc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:05:41 +0800 Subject: [PATCH 0855/1862] Update README.md --- core-java-modules/core-java-collections-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-collections-3/README.md b/core-java-modules/core-java-collections-3/README.md index c80e493767..e21e3642f9 100644 --- a/core-java-modules/core-java-collections-3/README.md +++ b/core-java-modules/core-java-collections-3/README.md @@ -13,3 +13,4 @@ - [Quick Guide to the Java Stack](https://www.baeldung.com/java-stack) - [Convert an Array of Primitives to a List](https://www.baeldung.com/java-primitive-array-to-list) - [A Guide to BitSet in Java](https://www.baeldung.com/java-bitset) +- [Get the First Key and Value From a HashMap](https://www.baeldung.com/java-hashmap-get-first-entry) From ffe826a6b6123c16b0a7c2ce08a95e77c4d116f2 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:07:19 +0800 Subject: [PATCH 0856/1862] Update README.md --- spring-boot-modules/spring-boot-mvc-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-mvc-3/README.md b/spring-boot-modules/spring-boot-mvc-3/README.md index 796ab72425..bc3eb9e496 100644 --- a/spring-boot-modules/spring-boot-mvc-3/README.md +++ b/spring-boot-modules/spring-boot-mvc-3/README.md @@ -8,4 +8,5 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Download an Image or a File with Spring MVC](https://www.baeldung.com/spring-controller-return-image-file) - [Spring MVC Async vs Spring WebFlux](https://www.baeldung.com/spring-mvc-async-vs-webflux) - [Differences in @Valid and @Validated Annotations in Spring](https://www.baeldung.com/spring-valid-vs-validated) +- [CharacterEncodingFilter In SpringBoot](https://www.baeldung.com/spring-boot-characterencodingfilter) - More articles: [[prev -->]](/spring-boot-modules/spring-boot-mvc-2) From cfdbef76ba47f959a9848abfd03636664d5a3484 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:09:22 +0800 Subject: [PATCH 0857/1862] Update README.md --- core-java-modules/core-java-security-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-security-2/README.md b/core-java-modules/core-java-security-2/README.md index ba8cce46a0..11f0a34fa9 100644 --- a/core-java-modules/core-java-security-2/README.md +++ b/core-java-modules/core-java-security-2/README.md @@ -10,4 +10,5 @@ This module contains articles about core Java Security - [SHA-256 and SHA3-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java) - [Checksums in Java](https://www.baeldung.com/java-checksums) - [How to Read PEM File to Get Public and Private Keys](https://www.baeldung.com/java-read-pem-file-keys) +- [Listing the Available Cipher Algorithms](https://www.baeldung.com/java-list-cipher-algorithms) - More articles: [[<-- prev]](/core-java-modules/core-java-security) From 92b4aba6b4c407f8843082d2b6fa56e8ca5dea54 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:13:08 +0800 Subject: [PATCH 0858/1862] Create README.md --- gradle/gradle-wrapper/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 gradle/gradle-wrapper/README.md diff --git a/gradle/gradle-wrapper/README.md b/gradle/gradle-wrapper/README.md new file mode 100644 index 0000000000..972ced46c8 --- /dev/null +++ b/gradle/gradle-wrapper/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Guide to the Gradle Wrapper](https://www.baeldung.com/gradle-wrapper) From 5bae06c7ff4319dcfd3e53d46e85e497a810ead5 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:15:04 +0800 Subject: [PATCH 0859/1862] Update README.md --- httpclient-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpclient-2/README.md b/httpclient-2/README.md index 52d8b8fcff..dc0fb553b6 100644 --- a/httpclient-2/README.md +++ b/httpclient-2/README.md @@ -8,5 +8,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: -- [How to Set TLS Version in Apache HttpClient](https://www.baeldung.com/TODO) +- [How to Set TLS Version in Apache HttpClient](https://www.baeldung.com/apache-httpclient-tls) - More articles: [[<-- prev]](../httpclient) From 39c0a4fa84e2a16da1e3580fa98a3c3a7ce599f1 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:16:46 +0800 Subject: [PATCH 0860/1862] Update README.md --- core-java-modules/core-java-io-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-io-3/README.md b/core-java-modules/core-java-io-3/README.md index 4b1a14ab3e..18caabc784 100644 --- a/core-java-modules/core-java-io-3/README.md +++ b/core-java-modules/core-java-io-3/README.md @@ -11,4 +11,5 @@ This module contains articles about core Java input and output (IO) - [Java Files Open Options](https://www.baeldung.com/java-file-options) - [Creating Temporary Directories in Java](https://www.baeldung.com/java-temp-directories) - [Reading a Line at a Given Line Number From a File in Java](https://www.baeldung.com/java-read-line-at-number) +- [Find the Last Modified File in a Directory with Java](https://www.baeldung.com/java-last-modified-file) - [[<-- Prev]](/core-java-modules/core-java-io-2) From f77d8a6b4e0315171c6ad89828a5f7d6e8ed2534 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:19:45 +0800 Subject: [PATCH 0861/1862] Update README.md --- core-java-modules/core-java-lang-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-3/README.md b/core-java-modules/core-java-lang-3/README.md index 121d30f20f..598014bb92 100644 --- a/core-java-modules/core-java-lang-3/README.md +++ b/core-java-modules/core-java-lang-3/README.md @@ -6,4 +6,5 @@ This module contains articles about core features in the Java language - [Converting a Java String Into a Boolean](https://www.baeldung.com/java-string-to-boolean) - [When are Static Variables Initialized in Java?](https://www.baeldung.com/java-static-variables-initialization) - [Checking if a Class Exists in Java](https://www.baeldung.com/java-check-class-exists) +- [The Difference Between a.getClass() and A.class in Java](https://www.baeldung.com/java-getclass-vs-class) - [[<-- Prev]](/core-java-modules/core-java-lang-2) From d0f0e197e401325b595a6d3dc3c06cd9b29ee2e9 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:22:31 +0800 Subject: [PATCH 0862/1862] Update README.md --- algorithms-miscellaneous-6/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-6/README.md b/algorithms-miscellaneous-6/README.md index 6ddae75f43..e1841fced7 100644 --- a/algorithms-miscellaneous-6/README.md +++ b/algorithms-miscellaneous-6/README.md @@ -9,4 +9,5 @@ - [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher) - [Implementing a 2048 Solver in Java](https://www.baeldung.com/2048-java-solver) - [Finding Top K Elements in an Array](https://www.baeldung.com/java-array-top-elements) +- [Reversing a Linked List in Java](https://www.baeldung.com/java-reverse-linked-list) - More articles: [[<-- prev]](/../algorithms-miscellaneous-5) From 511c0183cf0ba6e1226f1ad35dd24d691453f175 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:24:04 +0800 Subject: [PATCH 0863/1862] Update README.md --- spring-boot-modules/spring-boot-environment/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-environment/README.md b/spring-boot-modules/spring-boot-environment/README.md index e916c503bc..e7b0ace7a4 100644 --- a/spring-boot-modules/spring-boot-environment/README.md +++ b/spring-boot-modules/spring-boot-environment/README.md @@ -4,4 +4,5 @@ This module contains articles about configuring the Spring Boot `Environment` ### Relevant Articles: - [EnvironmentPostProcessor in Spring Boot](https://www.baeldung.com/spring-boot-environmentpostprocessor) - - [Spring Properties File Outside jar](https://www.baeldung.com/spring-properties-file-outside-jar) \ No newline at end of file + - [Spring Properties File Outside jar](https://www.baeldung.com/spring-properties-file-outside-jar) + - [Get the Running Port in Spring Boot](https://www.baeldung.com/spring-boot-running-port) From c1c380094cca00b54d019e6cdaeb77bd98189828 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:26:20 +0800 Subject: [PATCH 0864/1862] Update README.md --- testing-modules/junit-4/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/junit-4/README.md b/testing-modules/junit-4/README.md index 6cc3981ed4..cf20c8da91 100644 --- a/testing-modules/junit-4/README.md +++ b/testing-modules/junit-4/README.md @@ -5,3 +5,4 @@ - [Introduction to JUnitParams](http://www.baeldung.com/junit-params) - [Running JUnit Tests Programmatically, from a Java Application](https://www.baeldung.com/junit-tests-run-programmatically-from-java) - [Introduction to Lambda Behave](https://www.baeldung.com/lambda-behave) +- [Conditionally Run or Ignore Tests in JUnit 4](https://www.baeldung.com/junit-conditional-assume) From e9059bbb72c77664a14dbb7c42bc7b6608448ab9 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:29:42 +0800 Subject: [PATCH 0865/1862] Update README.md --- testing-modules/junit-5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index e62f2dd345..984b79c29d 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -7,3 +7,4 @@ - [Testing an Abstract Class With JUnit](https://www.baeldung.com/junit-test-abstract-class) - [Guide to Dynamic Tests in JUnit 5](https://www.baeldung.com/junit5-dynamic-tests) - [Determine the Execution Time of JUnit Tests](https://www.baeldung.com/junit-test-execution-time) +- [@BeforeAll and @AfterAll in Non-Static Methods](https://www.baeldung.com/java-beforeall-afterall-non-static) From c68b6f68b56e5fadb245054dd0726a372727f0a1 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:31:26 +0800 Subject: [PATCH 0866/1862] Update README.md --- core-java-modules/core-java-security-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-security-2/README.md b/core-java-modules/core-java-security-2/README.md index 11f0a34fa9..03a5a94acc 100644 --- a/core-java-modules/core-java-security-2/README.md +++ b/core-java-modules/core-java-security-2/README.md @@ -11,4 +11,5 @@ This module contains articles about core Java Security - [Checksums in Java](https://www.baeldung.com/java-checksums) - [How to Read PEM File to Get Public and Private Keys](https://www.baeldung.com/java-read-pem-file-keys) - [Listing the Available Cipher Algorithms](https://www.baeldung.com/java-list-cipher-algorithms) +- [Get a List of Trusted Certificates in Java](https://www.baeldung.com/java-list-trusted-certificates) - More articles: [[<-- prev]](/core-java-modules/core-java-security) From ea64a31131147d288046123a897e18cf71b407df Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:33:56 +0800 Subject: [PATCH 0867/1862] Update README.md --- httpclient-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/httpclient-2/README.md b/httpclient-2/README.md index dc0fb553b6..6fdd743fcc 100644 --- a/httpclient-2/README.md +++ b/httpclient-2/README.md @@ -9,4 +9,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: - [How to Set TLS Version in Apache HttpClient](https://www.baeldung.com/apache-httpclient-tls) +- [Reading an HTTP Response Body as a String in Java](https://www.baeldung.com/java-http-response-body-as-string) - More articles: [[<-- prev]](../httpclient) From 9ee2aee60f9f79584cb61301d9f8eab3ebe9de56 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:35:14 +0800 Subject: [PATCH 0868/1862] Update README.md --- httpclient-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/httpclient-2/README.md b/httpclient-2/README.md index 6fdd743fcc..9d7a9683cd 100644 --- a/httpclient-2/README.md +++ b/httpclient-2/README.md @@ -10,4 +10,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [How to Set TLS Version in Apache HttpClient](https://www.baeldung.com/apache-httpclient-tls) - [Reading an HTTP Response Body as a String in Java](https://www.baeldung.com/java-http-response-body-as-string) +- [How To Get Cookies From the Apache HttpClient Response](https://www.baeldung.com/java-apache-httpclient-cookies) - More articles: [[<-- prev]](../httpclient) From 99d35b68e37bf6adc1edf1bcc69df59011413193 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:36:59 +0800 Subject: [PATCH 0869/1862] Create README.md --- persistence-modules/jooq/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 persistence-modules/jooq/README.md diff --git a/persistence-modules/jooq/README.md b/persistence-modules/jooq/README.md new file mode 100644 index 0000000000..348baab50c --- /dev/null +++ b/persistence-modules/jooq/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Getting Started with jOOQ](https://www.baeldung.com/jooq-intro) From 67981e7cba0f746046088f3fd8e816fd1a131d7f Mon Sep 17 00:00:00 2001 From: Aaron Juarez Date: Fri, 2 Oct 2020 12:46:48 -0400 Subject: [PATCH 0870/1862] BAEL-3862: Spark differences DS, DF, RDD (#9976) --- apache-spark/data/Tourist.csv | 2247 +++++++++++++++++ .../dataframe/dataset/rdd/TouristData.java | 75 + .../differences/rdd/ActionsUnitTest.java | 67 + .../differences/rdd/DataFrameUnitTest.java | 74 + .../differences/rdd/DatasetUnitTest.java | 83 + .../rdd/TransformationsUnitTest.java | 63 + 6 files changed, 2609 insertions(+) create mode 100644 apache-spark/data/Tourist.csv create mode 100644 apache-spark/src/main/java/com/baeldung/differences/dataframe/dataset/rdd/TouristData.java create mode 100644 apache-spark/src/test/java/com/baeldung/differences/rdd/ActionsUnitTest.java create mode 100644 apache-spark/src/test/java/com/baeldung/differences/rdd/DataFrameUnitTest.java create mode 100644 apache-spark/src/test/java/com/baeldung/differences/rdd/DatasetUnitTest.java create mode 100644 apache-spark/src/test/java/com/baeldung/differences/rdd/TransformationsUnitTest.java diff --git a/apache-spark/data/Tourist.csv b/apache-spark/data/Tourist.csv new file mode 100644 index 0000000000..4970e8c2f0 --- /dev/null +++ b/apache-spark/data/Tourist.csv @@ -0,0 +1,2247 @@ +Region,Country,Year,Series,Series_Type,Series_Type_Footnote,Value,Footnotes,Source +4,Afghanistan,2010,Tourism expenditure (millions of US dollars),,,147.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +4,Afghanistan,2016,Tourism expenditure (millions of US dollars),,,62.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +4,Afghanistan,2017,Tourism expenditure (millions of US dollars),,,16.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +4,Afghanistan,2018,Tourism expenditure (millions of US dollars),,,50.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2010,Tourist/visitor arrivals (thousands),TF,,2191.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2016,Tourist/visitor arrivals (thousands),TF,,4070.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2017,Tourist/visitor arrivals (thousands),TF,,4643.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2018,Tourist/visitor arrivals (thousands),TF,,5340.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,1995,Tourism expenditure (millions of US dollars),,,70.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2005,Tourism expenditure (millions of US dollars),,,880.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2010,Tourism expenditure (millions of US dollars),,,1778.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2016,Tourism expenditure (millions of US dollars),,,1821.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2017,Tourism expenditure (millions of US dollars),,,2050.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +8,Albania,2018,Tourism expenditure (millions of US dollars),,,2306.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,1995,Tourist/visitor arrivals (thousands),VF,,520.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2005,Tourist/visitor arrivals (thousands),VF,,1443.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2010,Tourist/visitor arrivals (thousands),VF,,2070.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2016,Tourist/visitor arrivals (thousands),VF,,2039.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2017,Tourist/visitor arrivals (thousands),VF,,2451.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2018,Tourist/visitor arrivals (thousands),VF,,2657.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2005,Tourism expenditure (millions of US dollars),,,477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2010,Tourism expenditure (millions of US dollars),,,324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2016,Tourism expenditure (millions of US dollars),,,246.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +12,Algeria,2017,Tourism expenditure (millions of US dollars),,,172.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +16,American Samoa,1995,Tourist/visitor arrivals (thousands),TF,,34.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +16,American Samoa,2005,Tourist/visitor arrivals (thousands),TF,,24.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +16,American Samoa,2010,Tourist/visitor arrivals (thousands),TF,,23.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +16,American Samoa,2016,Tourist/visitor arrivals (thousands),TF,,20.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +16,American Samoa,2017,Tourist/visitor arrivals (thousands),TF,,20.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +16,American Samoa,2018,Tourist/visitor arrivals (thousands),TF,,20.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +16,American Samoa,2016,Tourism expenditure (millions of US dollars),,,22.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +16,American Samoa,2017,Tourism expenditure (millions of US dollars),,,22.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +20,Andorra,2005,Tourist/visitor arrivals (thousands),TF,,2418.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +20,Andorra,2010,Tourist/visitor arrivals (thousands),TF,,1808.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +20,Andorra,2016,Tourist/visitor arrivals (thousands),TF,,2819.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +20,Andorra,2017,Tourist/visitor arrivals (thousands),TF,,3003.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +20,Andorra,2018,Tourist/visitor arrivals (thousands),TF,,3042.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,1995,Tourist/visitor arrivals (thousands),TF,,9.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2005,Tourist/visitor arrivals (thousands),TF,,210.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2010,Tourist/visitor arrivals (thousands),TF,,425.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2016,Tourist/visitor arrivals (thousands),TF,,397.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2017,Tourist/visitor arrivals (thousands),TF,,261.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2018,Tourist/visitor arrivals (thousands),TF,,218.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,1995,Tourism expenditure (millions of US dollars),,,27.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2005,Tourism expenditure (millions of US dollars),,,103.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2010,Tourism expenditure (millions of US dollars),,,726.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2016,Tourism expenditure (millions of US dollars),,,628.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2017,Tourism expenditure (millions of US dollars),,,884.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +24,Angola,2018,Tourism expenditure (millions of US dollars),,,557.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,1995,Tourist/visitor arrivals (thousands),TF,,39.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2005,Tourist/visitor arrivals (thousands),TF,,62.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2010,Tourist/visitor arrivals (thousands),TF,,62.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2016,Tourist/visitor arrivals (thousands),TF,,79.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2017,Tourist/visitor arrivals (thousands),TF,,68.3000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2018,Tourist/visitor arrivals (thousands),TF,,55.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,1995,Tourism expenditure (millions of US dollars),,,50.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2005,Tourism expenditure (millions of US dollars),,,86.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2010,Tourism expenditure (millions of US dollars),,,99.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2016,Tourism expenditure (millions of US dollars),,,136.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2017,Tourism expenditure (millions of US dollars),,,141.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +660,Anguilla,2018,Tourism expenditure (millions of US dollars),,,102.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,1995,Tourist/visitor arrivals (thousands),TF,,220.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2005,Tourist/visitor arrivals (thousands),TF,,245.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2010,Tourist/visitor arrivals (thousands),TF,,230.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2016,Tourist/visitor arrivals (thousands),TF,,265.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2017,Tourist/visitor arrivals (thousands),TF,,247.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2018,Tourist/visitor arrivals (thousands),TF,,269.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,1995,Tourism expenditure (millions of US dollars),,,247.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2005,Tourism expenditure (millions of US dollars),,,309.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2010,Tourism expenditure (millions of US dollars),,,298.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2016,Tourism expenditure (millions of US dollars),,,753.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2017,Tourism expenditure (millions of US dollars),,,737.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +28,Antigua and Barbuda,2018,Tourism expenditure (millions of US dollars),,,881.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,1995,Tourist/visitor arrivals (thousands),TF,,2289.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2005,Tourist/visitor arrivals (thousands),TF,,3823.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2010,Tourist/visitor arrivals (thousands),TF,,6800.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2016,Tourist/visitor arrivals (thousands),TF,,6668.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2017,Tourist/visitor arrivals (thousands),TF,,6711.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2018,Tourist/visitor arrivals (thousands),TF,,6942.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,1995,Tourism expenditure (millions of US dollars),,,2550.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2005,Tourism expenditure (millions of US dollars),,,3209.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2010,Tourism expenditure (millions of US dollars),,,5605.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2016,Tourism expenditure (millions of US dollars),,,5466.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2017,Tourism expenditure (millions of US dollars),,,5835.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +32,Argentina,2018,Tourism expenditure (millions of US dollars),,,5999.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,1995,Tourist/visitor arrivals (thousands),TF,,12.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2005,Tourist/visitor arrivals (thousands),TF,,319.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2010,Tourist/visitor arrivals (thousands),TF,,684.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2016,Tourist/visitor arrivals (thousands),TF,,1260.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2017,Tourist/visitor arrivals (thousands),TF,,1495.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2018,Tourist/visitor arrivals (thousands),TF,,1652.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,1995,Tourism expenditure (millions of US dollars),,,14.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2005,Tourism expenditure (millions of US dollars),,,243.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2010,Tourism expenditure (millions of US dollars),,,694.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2016,Tourism expenditure (millions of US dollars),,,988.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2017,Tourism expenditure (millions of US dollars),,,1140.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +51,Armenia,2018,Tourism expenditure (millions of US dollars),,,1237.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,1995,Tourist/visitor arrivals (thousands),TF,,619.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2005,Tourist/visitor arrivals (thousands),TF,,733.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2010,Tourist/visitor arrivals (thousands),TF,,824.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2016,Tourist/visitor arrivals (thousands),TF,,1102.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2017,Tourist/visitor arrivals (thousands),TF,,1070.5000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2018,Tourist/visitor arrivals (thousands),TF,,1082.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,1995,Tourism expenditure (millions of US dollars),,,554.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2005,Tourism expenditure (millions of US dollars),,,1097.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2010,Tourism expenditure (millions of US dollars),,,1254.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2016,Tourism expenditure (millions of US dollars),,,1764.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2017,Tourism expenditure (millions of US dollars),,,1857.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +533,Aruba,2018,Tourism expenditure (millions of US dollars),,,2024.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,1995,Tourist/visitor arrivals (thousands),VF,,3726.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2005,Tourist/visitor arrivals (thousands),VF,,5499.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2010,Tourist/visitor arrivals (thousands),VF,,5790.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2016,Tourist/visitor arrivals (thousands),VF,,8269.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2017,Tourist/visitor arrivals (thousands),VF,,8815.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2018,Tourist/visitor arrivals (thousands),VF,,9246.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,1995,Tourism expenditure (millions of US dollars),,,10370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2005,Tourism expenditure (millions of US dollars),,,19719.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2010,Tourism expenditure (millions of US dollars),,,31064.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2016,Tourism expenditure (millions of US dollars),,,39059.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2017,Tourism expenditure (millions of US dollars),,,43975.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +36,Australia,2018,Tourism expenditure (millions of US dollars),,,47327.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,1995,Tourist/visitor arrivals (thousands),TCE,,17173.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2005,Tourist/visitor arrivals (thousands),TCE,,19952.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2010,Tourist/visitor arrivals (thousands),TCE,,22004.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2016,Tourist/visitor arrivals (thousands),TCE,,28121.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2017,Tourist/visitor arrivals (thousands),TCE,,29460.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2018,Tourist/visitor arrivals (thousands),TCE,,30816.0000,Only paid accommodation; excluding stays at friends and relatives and second homes.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,1995,Tourism expenditure (millions of US dollars),,,13435.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2005,Tourism expenditure (millions of US dollars),,,16243.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2010,Tourism expenditure (millions of US dollars),,,18751.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2016,Tourism expenditure (millions of US dollars),,,19244.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2017,Tourism expenditure (millions of US dollars),,,20333.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +40,Austria,2018,Tourism expenditure (millions of US dollars),,,23233.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2005,Tourist/visitor arrivals (thousands),TF,,693.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2010,Tourist/visitor arrivals (thousands),TF,,1280.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2016,Tourist/visitor arrivals (thousands),TF,,2044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2017,Tourist/visitor arrivals (thousands),TF,,2454.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2018,Tourist/visitor arrivals (thousands),TF,,2633.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,1995,Tourism expenditure (millions of US dollars),,,87.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2005,Tourism expenditure (millions of US dollars),,,100.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2010,Tourism expenditure (millions of US dollars),,,792.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2016,Tourism expenditure (millions of US dollars),,,2855.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2017,Tourism expenditure (millions of US dollars),,,3214.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +31,Azerbaijan,2018,Tourism expenditure (millions of US dollars),,,2830.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,1995,Tourist/visitor arrivals (thousands),TF,,1598.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2005,Tourist/visitor arrivals (thousands),TF,,1608.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2010,Tourist/visitor arrivals (thousands),TF,,1370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2016,Tourist/visitor arrivals (thousands),TF,,1500.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2017,Tourist/visitor arrivals (thousands),TF,,1442.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2018,Tourist/visitor arrivals (thousands),TF,,1633.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,1995,Tourism expenditure (millions of US dollars),,,1356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2005,Tourism expenditure (millions of US dollars),,,2081.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2010,Tourism expenditure (millions of US dollars),,,2159.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2016,Tourism expenditure (millions of US dollars),,,3091.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2017,Tourism expenditure (millions of US dollars),,,3017.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +44,Bahamas,2018,Tourism expenditure (millions of US dollars),,,3383.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,1995,Tourist/visitor arrivals (thousands),VF,,2311.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2005,Tourist/visitor arrivals (thousands),VF,,6313.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2010,Tourist/visitor arrivals (thousands),VF,,11952.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2016,Tourist/visitor arrivals (thousands),VF,,10158.0000,Break in the time series.;Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2017,Tourist/visitor arrivals (thousands),VF,,11374.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2018,Tourist/visitor arrivals (thousands),VF,,12045.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,1995,Tourism expenditure (millions of US dollars),,,593.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2005,Tourism expenditure (millions of US dollars),,,1603.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2010,Tourism expenditure (millions of US dollars),,,2163.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2016,Tourism expenditure (millions of US dollars),,,4021.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2017,Tourism expenditure (millions of US dollars),,,4380.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +48,Bahrain,2018,Tourism expenditure (millions of US dollars),,,3834.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,1995,Tourist/visitor arrivals (thousands),TF,,156.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2005,Tourist/visitor arrivals (thousands),TF,,208.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2010,Tourist/visitor arrivals (thousands),TF,,303.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2016,Tourist/visitor arrivals (thousands),TF,,830.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2017,Tourist/visitor arrivals (thousands),TF,,1026.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2005,Tourism expenditure (millions of US dollars),,,82.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2010,Tourism expenditure (millions of US dollars),,,103.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2016,Tourism expenditure (millions of US dollars),,,214.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2017,Tourism expenditure (millions of US dollars),,,348.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +50,Bangladesh,2018,Tourism expenditure (millions of US dollars),,,357.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,1995,Tourist/visitor arrivals (thousands),TF,,442.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,2005,Tourist/visitor arrivals (thousands),TF,,548.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,2010,Tourist/visitor arrivals (thousands),TF,,532.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,2016,Tourist/visitor arrivals (thousands),TF,,632.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,2017,Tourist/visitor arrivals (thousands),TF,,664.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,2018,Tourist/visitor arrivals (thousands),TF,,680.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,1995,Tourism expenditure (millions of US dollars),,,630.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,2005,Tourism expenditure (millions of US dollars),,,1081.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +52,Barbados,2010,Tourism expenditure (millions of US dollars),,,1074.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,1995,Tourist/visitor arrivals (thousands),TF,,160.6000,Excludes the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2005,Tourist/visitor arrivals (thousands),TF,,91.0000,Excludes the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2010,Tourist/visitor arrivals (thousands),TF,,119.3000,Excludes the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2016,Tourist/visitor arrivals (thousands),TF,,10935.4000,Includes estimation of the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2017,Tourist/visitor arrivals (thousands),TF,,11060.2000,Includes estimation of the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2018,Tourist/visitor arrivals (thousands),TF,,11501.6000,Includes estimation of the Belarusian-Russian border segment.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,1995,Tourism expenditure (millions of US dollars),,,28.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2005,Tourism expenditure (millions of US dollars),,,346.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2010,Tourism expenditure (millions of US dollars),,,665.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2016,Tourism expenditure (millions of US dollars),,,1019.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2017,Tourism expenditure (millions of US dollars),,,1124.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +112,Belarus,2018,Tourism expenditure (millions of US dollars),,,1221.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,1995,Tourist/visitor arrivals (thousands),TCE,,5560.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2005,Tourist/visitor arrivals (thousands),TCE,,6747.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2010,Tourist/visitor arrivals (thousands),TCE,,7186.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2016,Tourist/visitor arrivals (thousands),TCE,,7481.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2017,Tourist/visitor arrivals (thousands),TCE,,8385.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2018,Tourist/visitor arrivals (thousands),TCE,,9119.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2005,Tourism expenditure (millions of US dollars),,,10881.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2010,Tourism expenditure (millions of US dollars),,,12680.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2016,Tourism expenditure (millions of US dollars),,,8784.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2017,Tourism expenditure (millions of US dollars),,,9636.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +56,Belgium,2018,Tourism expenditure (millions of US dollars),,,10381.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,1995,Tourist/visitor arrivals (thousands),TF,,131.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2005,Tourist/visitor arrivals (thousands),TF,,237.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2010,Tourist/visitor arrivals (thousands),TF,,242.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2016,Tourist/visitor arrivals (thousands),TF,,386.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2017,Tourist/visitor arrivals (thousands),TF,,427.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2018,Tourist/visitor arrivals (thousands),TF,,489.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,1995,Tourism expenditure (millions of US dollars),,,78.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2005,Tourism expenditure (millions of US dollars),,,214.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2010,Tourism expenditure (millions of US dollars),,,264.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2016,Tourism expenditure (millions of US dollars),,,391.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2017,Tourism expenditure (millions of US dollars),,,427.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +84,Belize,2018,Tourism expenditure (millions of US dollars),,,487.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,1995,Tourist/visitor arrivals (thousands),TF,,138.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2005,Tourist/visitor arrivals (thousands),TF,,176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2010,Tourist/visitor arrivals (thousands),TF,,199.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2016,Tourist/visitor arrivals (thousands),TF,,267.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2017,Tourist/visitor arrivals (thousands),TF,,281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2018,Tourist/visitor arrivals (thousands),TF,,295.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2005,Tourism expenditure (millions of US dollars),,,107.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2010,Tourism expenditure (millions of US dollars),,,149.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2016,Tourism expenditure (millions of US dollars),,,129.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +204,Benin,2017,Tourism expenditure (millions of US dollars),,,160.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,1995,Tourist/visitor arrivals (thousands),TF,,387.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2005,Tourist/visitor arrivals (thousands),TF,,270.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2010,Tourist/visitor arrivals (thousands),TF,,232.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2016,Tourist/visitor arrivals (thousands),TF,,244.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2017,Tourist/visitor arrivals (thousands),TF,,270.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2018,Tourist/visitor arrivals (thousands),TF,,282.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,1995,Tourism expenditure (millions of US dollars),,,488.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2005,Tourism expenditure (millions of US dollars),,,429.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2010,Tourism expenditure (millions of US dollars),,,442.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2016,Tourism expenditure (millions of US dollars),,,441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2017,Tourism expenditure (millions of US dollars),,,513.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +60,Bermuda,2018,Tourism expenditure (millions of US dollars),,,583.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,1995,Tourist/visitor arrivals (thousands),TF,,4.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2005,Tourist/visitor arrivals (thousands),TF,,13.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2010,Tourist/visitor arrivals (thousands),TF,,41.0000,Break in the time series.;Including regional high end tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2016,Tourist/visitor arrivals (thousands),TF,,210.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2017,Tourist/visitor arrivals (thousands),TF,,255.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2018,Tourist/visitor arrivals (thousands),TF,,274.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,1995,Tourism expenditure (millions of US dollars),,,5.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2005,Tourism expenditure (millions of US dollars),,,19.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2010,Tourism expenditure (millions of US dollars),,,64.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2016,Tourism expenditure (millions of US dollars),,,139.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2017,Tourism expenditure (millions of US dollars),,,153.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +64,Bhutan,2018,Tourism expenditure (millions of US dollars),,,121.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),1995,Tourist/visitor arrivals (thousands),TF,,284.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2005,Tourist/visitor arrivals (thousands),TF,,524.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2010,Tourist/visitor arrivals (thousands),TF,,679.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2016,Tourist/visitor arrivals (thousands),TF,,961.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2017,Tourist/visitor arrivals (thousands),TF,,1109.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2018,Tourist/visitor arrivals (thousands),TF,,1142.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),1995,Tourism expenditure (millions of US dollars),,,92.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2005,Tourism expenditure (millions of US dollars),,,345.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2010,Tourism expenditure (millions of US dollars),,,339.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2016,Tourism expenditure (millions of US dollars),,,827.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2017,Tourism expenditure (millions of US dollars),,,912.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +68,Bolivia (Plurin. State of),2018,Tourism expenditure (millions of US dollars),,,970.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +669,Bonaire,1995,Tourist/visitor arrivals (thousands),TF,,59.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +669,Bonaire,2005,Tourist/visitor arrivals (thousands),TF,,63.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +669,Bonaire,2010,Tourist/visitor arrivals (thousands),TF,,71.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +669,Bonaire,1995,Tourism expenditure (millions of US dollars),,,37.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +669,Bonaire,2005,Tourism expenditure (millions of US dollars),,,87.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2005,Tourist/visitor arrivals (thousands),TCE,,217.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2010,Tourist/visitor arrivals (thousands),TCE,,365.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2016,Tourist/visitor arrivals (thousands),TCE,,778.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2017,Tourist/visitor arrivals (thousands),TCE,,923.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2018,Tourist/visitor arrivals (thousands),TCE,,1053.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2005,Tourism expenditure (millions of US dollars),,,557.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2010,Tourism expenditure (millions of US dollars),,,662.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2016,Tourism expenditure (millions of US dollars),,,876.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2017,Tourism expenditure (millions of US dollars),,,985.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +70,Bosnia and Herzegovina,2018,Tourism expenditure (millions of US dollars),,,1081.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,1995,Tourist/visitor arrivals (thousands),TF,,521.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2005,Tourist/visitor arrivals (thousands),TF,,1474.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2010,Tourist/visitor arrivals (thousands),TF,,1973.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2016,Tourist/visitor arrivals (thousands),TF,,1574.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2017,Tourist/visitor arrivals (thousands),TF,,1623.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,1995,Tourism expenditure (millions of US dollars),,,176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2005,Tourism expenditure (millions of US dollars),,,563.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2010,Tourism expenditure (millions of US dollars),,,440.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2016,Tourism expenditure (millions of US dollars),,,505.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2017,Tourism expenditure (millions of US dollars),,,541.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +72,Botswana,2018,Tourism expenditure (millions of US dollars),,,575.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,1995,Tourist/visitor arrivals (thousands),TF,,1991.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2005,Tourist/visitor arrivals (thousands),TF,,5358.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2010,Tourist/visitor arrivals (thousands),TF,,5161.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2016,Tourist/visitor arrivals (thousands),TF,,6547.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2017,Tourist/visitor arrivals (thousands),TF,,6589.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2018,Tourist/visitor arrivals (thousands),TF,,6621.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,1995,Tourism expenditure (millions of US dollars),,,1085.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2005,Tourism expenditure (millions of US dollars),,,4168.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2010,Tourism expenditure (millions of US dollars),,,5522.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2016,Tourism expenditure (millions of US dollars),,,6613.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2017,Tourism expenditure (millions of US dollars),,,6175.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +76,Brazil,2018,Tourism expenditure (millions of US dollars),,,6324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,1995,Tourist/visitor arrivals (thousands),TF,,219.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,2005,Tourist/visitor arrivals (thousands),TF,,337.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,2010,Tourist/visitor arrivals (thousands),TF,,330.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,2016,Tourist/visitor arrivals (thousands),TF,,408.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,2017,Tourist/visitor arrivals (thousands),TF,,335.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,2018,Tourist/visitor arrivals (thousands),TF,,192.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,1995,Tourism expenditure (millions of US dollars),,,211.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,2005,Tourism expenditure (millions of US dollars),,,412.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +92,British Virgin Islands,2010,Tourism expenditure (millions of US dollars),,,389.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2005,Tourist/visitor arrivals (thousands),TF,,126.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2010,Tourist/visitor arrivals (thousands),TF,,214.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2016,Tourist/visitor arrivals (thousands),TF,,219.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2017,Tourist/visitor arrivals (thousands),TF,,259.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2018,Tourist/visitor arrivals (thousands),TF,,278.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2005,Tourism expenditure (millions of US dollars),,,191.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2016,Tourism expenditure (millions of US dollars),,,144.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2017,Tourism expenditure (millions of US dollars),,,177.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +96,Brunei Darussalam,2018,Tourism expenditure (millions of US dollars),,,190.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,1995,Tourist/visitor arrivals (thousands),TF,,3466.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2005,Tourist/visitor arrivals (thousands),TF,,4837.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2010,Tourist/visitor arrivals (thousands),TF,,6047.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2016,Tourist/visitor arrivals (thousands),TF,,8252.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2017,Tourist/visitor arrivals (thousands),TF,,8883.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2018,Tourist/visitor arrivals (thousands),TF,,9273.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,1995,Tourism expenditure (millions of US dollars),,,662.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2005,Tourism expenditure (millions of US dollars),,,3063.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2010,Tourism expenditure (millions of US dollars),,,3807.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2016,Tourism expenditure (millions of US dollars),,,4164.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2017,Tourism expenditure (millions of US dollars),,,4678.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +100,Bulgaria,2018,Tourism expenditure (millions of US dollars),,,5072.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,1995,Tourist/visitor arrivals (thousands),THS,,124.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2005,Tourist/visitor arrivals (thousands),THS,,245.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2010,Tourist/visitor arrivals (thousands),THS,,274.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2016,Tourist/visitor arrivals (thousands),THS,,152.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2017,Tourist/visitor arrivals (thousands),THS,,143.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2018,Tourist/visitor arrivals (thousands),THS,,144.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2005,Tourism expenditure (millions of US dollars),,,46.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2010,Tourism expenditure (millions of US dollars),,,105.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2016,Tourism expenditure (millions of US dollars),,,172.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +854,Burkina Faso,2017,Tourism expenditure (millions of US dollars),,,172.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +108,Burundi,1995,Tourist/visitor arrivals (thousands),TF,,34.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +108,Burundi,2005,Tourist/visitor arrivals (thousands),TF,,148.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +108,Burundi,2010,Tourist/visitor arrivals (thousands),TF,,142.0000,Break in the time series.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +108,Burundi,2016,Tourist/visitor arrivals (thousands),TF,,187.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +108,Burundi,2017,Tourist/visitor arrivals (thousands),TF,,299.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +108,Burundi,1995,Tourism expenditure (millions of US dollars),,,2.4250,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +108,Burundi,2005,Tourism expenditure (millions of US dollars),,,1.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +108,Burundi,2010,Tourism expenditure (millions of US dollars),,,2.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,1995,Tourist/visitor arrivals (thousands),TF,,28.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2005,Tourist/visitor arrivals (thousands),TF,,198.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2010,Tourist/visitor arrivals (thousands),TF,,336.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2016,Tourist/visitor arrivals (thousands),TF,,598.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2017,Tourist/visitor arrivals (thousands),TF,,668.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2018,Tourist/visitor arrivals (thousands),TF,,710.0000,Non-resident tourists staying in hotels and similar establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,1995,Tourism expenditure (millions of US dollars),,,29.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2005,Tourism expenditure (millions of US dollars),,,177.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2010,Tourism expenditure (millions of US dollars),,,387.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2016,Tourism expenditure (millions of US dollars),,,397.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2017,Tourism expenditure (millions of US dollars),,,450.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +132,Cabo Verde,2018,Tourism expenditure (millions of US dollars),,,524.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,1995,Tourist/visitor arrivals (thousands),TF,,220.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2005,Tourist/visitor arrivals (thousands),TF,,1422.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2010,Tourist/visitor arrivals (thousands),TF,,2508.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2016,Tourist/visitor arrivals (thousands),TF,,5012.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2017,Tourist/visitor arrivals (thousands),TF,,5602.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2018,Tourist/visitor arrivals (thousands),TF,,6201.0000,Arrivals by all means of transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,1995,Tourism expenditure (millions of US dollars),,,71.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2005,Tourism expenditure (millions of US dollars),,,929.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2010,Tourism expenditure (millions of US dollars),,,1671.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2016,Tourism expenditure (millions of US dollars),,,3523.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2017,Tourism expenditure (millions of US dollars),,,4024.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +116,Cambodia,2018,Tourism expenditure (millions of US dollars),,,4832.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,2010,Tourist/visitor arrivals (thousands),VF,,573.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,2016,Tourist/visitor arrivals (thousands),VF,,994.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,2017,Tourist/visitor arrivals (thousands),VF,,1081.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,1995,Tourism expenditure (millions of US dollars),,,75.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,2005,Tourism expenditure (millions of US dollars),,,229.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,2010,Tourism expenditure (millions of US dollars),,,171.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,2016,Tourism expenditure (millions of US dollars),,,508.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,2017,Tourism expenditure (millions of US dollars),,,543.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +120,Cameroon,2018,Tourism expenditure (millions of US dollars),,,633.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,1995,Tourist/visitor arrivals (thousands),TF,,16932.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,2005,Tourist/visitor arrivals (thousands),TF,,18771.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,2010,Tourist/visitor arrivals (thousands),TF,,16219.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,2016,Tourist/visitor arrivals (thousands),TF,,19971.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,2017,Tourist/visitor arrivals (thousands),TF,,20883.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,2018,Tourist/visitor arrivals (thousands),TF,,21134.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,1995,Tourism expenditure (millions of US dollars),,,9176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,2005,Tourism expenditure (millions of US dollars),,,15887.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +124,Canada,2010,Tourism expenditure (millions of US dollars),,,18439.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,1995,Tourist/visitor arrivals (thousands),TF,,361.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2005,Tourist/visitor arrivals (thousands),TF,,168.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2010,Tourist/visitor arrivals (thousands),TF,,288.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2016,Tourist/visitor arrivals (thousands),TF,,385.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2017,Tourist/visitor arrivals (thousands),TF,,418.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2018,Tourist/visitor arrivals (thousands),TF,,463.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,1995,Tourism expenditure (millions of US dollars),,,394.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2005,Tourism expenditure (millions of US dollars),,,356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2010,Tourism expenditure (millions of US dollars),,,465.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2016,Tourism expenditure (millions of US dollars),,,696.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2017,Tourism expenditure (millions of US dollars),,,782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +136,Cayman Islands,2018,Tourism expenditure (millions of US dollars),,,880.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +140,Central African Republic,1995,Tourist/visitor arrivals (thousands),TF,,26.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +140,Central African Republic,2005,Tourist/visitor arrivals (thousands),TF,,12.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +140,Central African Republic,2010,Tourist/visitor arrivals (thousands),TF,,53.8000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +140,Central African Republic,2016,Tourist/visitor arrivals (thousands),TF,,82.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +140,Central African Republic,2017,Tourist/visitor arrivals (thousands),TF,,107.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +140,Central African Republic,1995,Tourism expenditure (millions of US dollars),,,4.0000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +140,Central African Republic,2005,Tourism expenditure (millions of US dollars),,,7.2000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +140,Central African Republic,2010,Tourism expenditure (millions of US dollars),,,14.4000,Arrivals by air at Bangui only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +148,Chad,2010,Tourist/visitor arrivals (thousands),TF,,71.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +148,Chad,2016,Tourist/visitor arrivals (thousands),TF,,98.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +148,Chad,2017,Tourist/visitor arrivals (thousands),TF,,87.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +148,Chad,1995,Tourism expenditure (millions of US dollars),,,43.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,1995,Tourist/visitor arrivals (thousands),TF,,1540.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2005,Tourist/visitor arrivals (thousands),TF,,2027.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2010,Tourist/visitor arrivals (thousands),TF,,2801.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2016,Tourist/visitor arrivals (thousands),TF,,5641.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2017,Tourist/visitor arrivals (thousands),TF,,6450.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2018,Tourist/visitor arrivals (thousands),TF,,5723.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,1995,Tourism expenditure (millions of US dollars),,,1186.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2005,Tourism expenditure (millions of US dollars),,,1608.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2010,Tourism expenditure (millions of US dollars),,,2362.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2016,Tourism expenditure (millions of US dollars),,,3744.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2017,Tourism expenditure (millions of US dollars),,,4372.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +152,Chile,2018,Tourism expenditure (millions of US dollars),,,3972.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,1995,Tourist/visitor arrivals (thousands),TF,,20034.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2005,Tourist/visitor arrivals (thousands),TF,,46809.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2010,Tourist/visitor arrivals (thousands),TF,,55664.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2016,Tourist/visitor arrivals (thousands),TF,,59270.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2017,Tourist/visitor arrivals (thousands),TF,,60740.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2018,Tourist/visitor arrivals (thousands),TF,,62900.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,1995,Tourism expenditure (millions of US dollars),,,8730.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2005,Tourism expenditure (millions of US dollars),,,29296.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2010,Tourism expenditure (millions of US dollars),,,45814.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2016,Tourism expenditure (millions of US dollars),,,44432.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2017,Tourism expenditure (millions of US dollars),,,38559.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +156,China,2018,Tourism expenditure (millions of US dollars),,,40386.0000,"For statistical purposes, the data for China do not include those for the Hong Kong Special Administrative Region (Hong Kong SAR), Macao Special Administrative Region (Macao SAR) and Taiwan Province of China.;Excluding passenger transport.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2005,Tourist/visitor arrivals (thousands),TF,,14773.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2010,Tourist/visitor arrivals (thousands),TF,,20085.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2016,Tourist/visitor arrivals (thousands),TF,,26553.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2017,Tourist/visitor arrivals (thousands),TF,,27884.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2018,Tourist/visitor arrivals (thousands),TF,,29263.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2005,Tourism expenditure (millions of US dollars),,,13588.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2010,Tourism expenditure (millions of US dollars),,,27208.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2016,Tourism expenditure (millions of US dollars),,,37838.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2017,Tourism expenditure (millions of US dollars),,,38170.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +344,"China, Hong Kong SAR",2018,Tourism expenditure (millions of US dollars),,,41870.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",1995,Tourist/visitor arrivals (thousands),TF,,4202.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2005,Tourist/visitor arrivals (thousands),TF,,9014.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2010,Tourist/visitor arrivals (thousands),TF,,11926.0000,"Does not include other non-residents namely workers, students, etc.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2016,Tourist/visitor arrivals (thousands),TF,,15703.6000,"Does not include other non-residents namely workers, students, etc.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2017,Tourist/visitor arrivals (thousands),TF,,17255.0000,"Does not include other non-residents namely workers, students, etc.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2018,Tourist/visitor arrivals (thousands),TF,,18493.0000,"Does not include other non-residents namely workers, students, etc.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",1995,Tourism expenditure (millions of US dollars),,,3233.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2005,Tourism expenditure (millions of US dollars),,,7181.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2010,Tourism expenditure (millions of US dollars),,,22688.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2016,Tourism expenditure (millions of US dollars),,,31015.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2017,Tourism expenditure (millions of US dollars),,,36465.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +446,"China, Macao SAR",2018,Tourism expenditure (millions of US dollars),,,40358.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,1995,Tourist/visitor arrivals (thousands),TF,,1399.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2005,Tourist/visitor arrivals (thousands),TF,,933.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2010,Tourist/visitor arrivals (thousands),TF,,1405.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2016,Tourist/visitor arrivals (thousands),TF,,3254.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2017,Tourist/visitor arrivals (thousands),TF,,3631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2018,Tourist/visitor arrivals (thousands),TF,,3904.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,1995,Tourism expenditure (millions of US dollars),,,887.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2005,Tourism expenditure (millions of US dollars),,,1891.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2010,Tourism expenditure (millions of US dollars),,,3441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2016,Tourism expenditure (millions of US dollars),,,5584.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2017,Tourism expenditure (millions of US dollars),,,5882.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +170,Colombia,2018,Tourism expenditure (millions of US dollars),,,6617.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,1995,Tourist/visitor arrivals (thousands),TF,,23.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2005,Tourist/visitor arrivals (thousands),TF,,25.9000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2010,Tourist/visitor arrivals (thousands),TF,,15.3000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2016,Tourist/visitor arrivals (thousands),TF,,26.8000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2017,Tourist/visitor arrivals (thousands),TF,,28.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2018,Tourist/visitor arrivals (thousands),TF,,35.9000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,1995,Tourism expenditure (millions of US dollars),,,22.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2005,Tourism expenditure (millions of US dollars),,,24.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2010,Tourism expenditure (millions of US dollars),,,35.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2016,Tourism expenditure (millions of US dollars),,,50.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2017,Tourism expenditure (millions of US dollars),,,60.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +174,Comoros,2018,Tourism expenditure (millions of US dollars),,,76.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +178,Congo,2005,Tourist/visitor arrivals (thousands),TF,,35.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +178,Congo,2010,Tourist/visitor arrivals (thousands),TF,,194.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +178,Congo,2016,Tourist/visitor arrivals (thousands),TF,,211.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +178,Congo,2017,Tourist/visitor arrivals (thousands),TF,,149.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +178,Congo,2018,Tourist/visitor arrivals (thousands),TF,,156.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +178,Congo,1995,Tourism expenditure (millions of US dollars),,,14.6691,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +178,Congo,2010,Tourism expenditure (millions of US dollars),,,39.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +178,Congo,2016,Tourism expenditure (millions of US dollars),,,42.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,1995,Tourist/visitor arrivals (thousands),TF,,48.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2005,Tourist/visitor arrivals (thousands),TF,,88.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2010,Tourist/visitor arrivals (thousands),TF,,104.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2016,Tourist/visitor arrivals (thousands),TF,,146.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2017,Tourist/visitor arrivals (thousands),TF,,161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2018,Tourist/visitor arrivals (thousands),TF,,169.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,1995,Tourism expenditure (millions of US dollars),,,28.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2005,Tourism expenditure (millions of US dollars),,,91.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2010,Tourism expenditure (millions of US dollars),,,111.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2016,Tourism expenditure (millions of US dollars),,,137.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +184,Cook Islands,2017,Tourism expenditure (millions of US dollars),,,153.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,1995,Tourist/visitor arrivals (thousands),TF,,785.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2005,Tourist/visitor arrivals (thousands),TF,,1679.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2010,Tourist/visitor arrivals (thousands),TF,,2100.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2016,Tourist/visitor arrivals (thousands),TF,,2925.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2017,Tourist/visitor arrivals (thousands),TF,,2960.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2018,Tourist/visitor arrivals (thousands),TF,,3017.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,1995,Tourism expenditure (millions of US dollars),,,763.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2005,Tourism expenditure (millions of US dollars),,,2008.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2010,Tourism expenditure (millions of US dollars),,,2426.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2016,Tourism expenditure (millions of US dollars),,,3776.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2017,Tourism expenditure (millions of US dollars),,,3826.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +188,Costa Rica,2018,Tourism expenditure (millions of US dollars),,,3995.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,2010,Tourist/visitor arrivals (thousands),VF,,252.0000,Arrivals to Félix Houphouët Boigny Airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,2016,Tourist/visitor arrivals (thousands),VF,,1583.0000,Arrivals to Félix Houphouët Boigny Airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,2017,Tourist/visitor arrivals (thousands),VF,,1800.0000,Arrivals to Félix Houphouët Boigny Airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,2018,Tourist/visitor arrivals (thousands),VF,,1965.0000,Arrivals to Félix Houphouët Boigny Airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,1995,Tourism expenditure (millions of US dollars),,,103.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,2005,Tourism expenditure (millions of US dollars),,,93.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,2010,Tourism expenditure (millions of US dollars),,,213.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,2016,Tourism expenditure (millions of US dollars),,,477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +384,Côte d’Ivoire,2017,Tourism expenditure (millions of US dollars),,,508.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,1995,Tourist/visitor arrivals (thousands),TCE,,1485.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2005,Tourist/visitor arrivals (thousands),TCE,,7743.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2010,Tourist/visitor arrivals (thousands),TCE,,9111.0000,Excluding arrivals in ports of nautical tourism.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2016,Tourist/visitor arrivals (thousands),TCE,,13809.0000,Excluding arrivals in ports of nautical tourism.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2017,Tourist/visitor arrivals (thousands),TCE,,15593.0000,Excluding arrivals in ports of nautical tourism.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2018,Tourist/visitor arrivals (thousands),TCE,,16645.0000,Excluding arrivals in ports of nautical tourism.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2005,Tourism expenditure (millions of US dollars),,,7625.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2010,Tourism expenditure (millions of US dollars),,,8299.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2016,Tourism expenditure (millions of US dollars),,,9820.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2017,Tourism expenditure (millions of US dollars),,,11128.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +191,Croatia,2018,Tourism expenditure (millions of US dollars),,,12075.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,1995,Tourist/visitor arrivals (thousands),TF,,742.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2005,Tourist/visitor arrivals (thousands),TF,,2261.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2010,Tourist/visitor arrivals (thousands),TF,,2507.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2016,Tourist/visitor arrivals (thousands),TF,,3975.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2017,Tourist/visitor arrivals (thousands),TF,,4594.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2018,Tourist/visitor arrivals (thousands),TF,,4684.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,1995,Tourism expenditure (millions of US dollars),,,1100.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2005,Tourism expenditure (millions of US dollars),,,2591.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2010,Tourism expenditure (millions of US dollars),,,2396.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2016,Tourism expenditure (millions of US dollars),,,3069.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2017,Tourism expenditure (millions of US dollars),,,3302.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +192,Cuba,2018,Tourism expenditure (millions of US dollars),,,2969.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,1995,Tourist/visitor arrivals (thousands),TF,,224.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2005,Tourist/visitor arrivals (thousands),TF,,222.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2010,Tourist/visitor arrivals (thousands),TF,,342.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2016,Tourist/visitor arrivals (thousands),TF,,441.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2017,Tourist/visitor arrivals (thousands),TF,,399.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2018,Tourist/visitor arrivals (thousands),TF,,432.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,1995,Tourism expenditure (millions of US dollars),,,175.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2005,Tourism expenditure (millions of US dollars),,,244.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2010,Tourism expenditure (millions of US dollars),,,438.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2016,Tourism expenditure (millions of US dollars),,,644.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2017,Tourism expenditure (millions of US dollars),,,572.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +531,Curaçao,2018,Tourism expenditure (millions of US dollars),,,605.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,1995,Tourist/visitor arrivals (thousands),TF,,2100.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2005,Tourist/visitor arrivals (thousands),TF,,2470.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2010,Tourist/visitor arrivals (thousands),TF,,2173.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2016,Tourist/visitor arrivals (thousands),TF,,3187.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2017,Tourist/visitor arrivals (thousands),TF,,3652.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2018,Tourist/visitor arrivals (thousands),TF,,3939.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,1995,Tourism expenditure (millions of US dollars),,,2018.0443,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2005,Tourism expenditure (millions of US dollars),,,2644.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2010,Tourism expenditure (millions of US dollars),,,2137.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2016,Tourism expenditure (millions of US dollars),,,2870.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2017,Tourism expenditure (millions of US dollars),,,3274.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +196,Cyprus,2018,Tourism expenditure (millions of US dollars),,,3449.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2005,Tourist/visitor arrivals (thousands),TF,,9404.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2010,Tourist/visitor arrivals (thousands),TF,,8629.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2016,Tourist/visitor arrivals (thousands),TF,,12808.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2017,Tourist/visitor arrivals (thousands),TF,,13665.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2005,Tourism expenditure (millions of US dollars),,,5772.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2010,Tourism expenditure (millions of US dollars),,,8068.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2016,Tourism expenditure (millions of US dollars),,,7041.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2017,Tourism expenditure (millions of US dollars),,,7695.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +203,Czechia,2018,Tourism expenditure (millions of US dollars),,,8291.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,1995,Tourist/visitor arrivals (thousands),TF,,35.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,2005,Tourist/visitor arrivals (thousands),TF,,61.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,2010,Tourist/visitor arrivals (thousands),TF,,81.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,2016,Tourist/visitor arrivals (thousands),TF,,351.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,2005,Tourism expenditure (millions of US dollars),,,3.2000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,2010,Tourism expenditure (millions of US dollars),,,10.7000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,2016,Tourism expenditure (millions of US dollars),,,4.3000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,2017,Tourism expenditure (millions of US dollars),,,6.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +180,Dem. Rep. of the Congo,2018,Tourism expenditure (millions of US dollars),,,60.5000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2005,Tourist/visitor arrivals (thousands),TCE,,9587.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2010,Tourist/visitor arrivals (thousands),TCE,,9425.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2016,Tourist/visitor arrivals (thousands),TCE,,10781.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2017,Tourist/visitor arrivals (thousands),TCE,,12426.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2018,Tourist/visitor arrivals (thousands),TCE,,12749.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,1995,Tourism expenditure (millions of US dollars),,,3691.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2005,Tourism expenditure (millions of US dollars),,,5293.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2010,Tourism expenditure (millions of US dollars),,,5704.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2016,Tourism expenditure (millions of US dollars),,,7494.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2017,Tourism expenditure (millions of US dollars),,,8508.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +208,Denmark,2018,Tourism expenditure (millions of US dollars),,,9097.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,1995,Tourist/visitor arrivals (thousands),THS,,21.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,2005,Tourist/visitor arrivals (thousands),THS,,30.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,2010,Tourist/visitor arrivals (thousands),THS,,51.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,1995,Tourism expenditure (millions of US dollars),,,5.4000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,2005,Tourism expenditure (millions of US dollars),,,7.1000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,2010,Tourism expenditure (millions of US dollars),,,18.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,2016,Tourism expenditure (millions of US dollars),,,33.5000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,2017,Tourism expenditure (millions of US dollars),,,36.2000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +262,Djibouti,2018,Tourism expenditure (millions of US dollars),,,57.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,1995,Tourist/visitor arrivals (thousands),TF,,60.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2005,Tourist/visitor arrivals (thousands),TF,,79.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2010,Tourist/visitor arrivals (thousands),TF,,77.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2016,Tourist/visitor arrivals (thousands),TF,,78.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2017,Tourist/visitor arrivals (thousands),TF,,72.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2018,Tourist/visitor arrivals (thousands),TF,,63.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,1995,Tourism expenditure (millions of US dollars),,,42.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2005,Tourism expenditure (millions of US dollars),,,57.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2010,Tourism expenditure (millions of US dollars),,,94.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2016,Tourism expenditure (millions of US dollars),,,198.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2017,Tourism expenditure (millions of US dollars),,,161.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +212,Dominica,2018,Tourism expenditure (millions of US dollars),,,111.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,1995,Tourist/visitor arrivals (thousands),TF,,1776.0000,Including nationals residing abroad.;Arrivals by air.;Excluding the passengers at Herrera airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2005,Tourist/visitor arrivals (thousands),TF,,3691.0000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2010,Tourist/visitor arrivals (thousands),TF,,4125.0000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2016,Tourist/visitor arrivals (thousands),TF,,5959.3000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2017,Tourist/visitor arrivals (thousands),TF,,6188.0000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2018,Tourist/visitor arrivals (thousands),TF,,6569.0000,Including nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,1995,Tourism expenditure (millions of US dollars),,,1571.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2005,Tourism expenditure (millions of US dollars),,,3518.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2010,Tourism expenditure (millions of US dollars),,,4162.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2016,Tourism expenditure (millions of US dollars),,,6720.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2017,Tourism expenditure (millions of US dollars),,,7184.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +214,Dominican Republic,2018,Tourism expenditure (millions of US dollars),,,7561.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,1995,Tourist/visitor arrivals (thousands),VF,,440.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2005,Tourist/visitor arrivals (thousands),VF,,860.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2010,Tourist/visitor arrivals (thousands),VF,,1047.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2016,Tourist/visitor arrivals (thousands),VF,,1569.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2017,Tourist/visitor arrivals (thousands),VF,,1806.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2018,Tourist/visitor arrivals (thousands),VF,,2535.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,1995,Tourism expenditure (millions of US dollars),,,315.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2005,Tourism expenditure (millions of US dollars),,,488.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2010,Tourism expenditure (millions of US dollars),,,786.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2016,Tourism expenditure (millions of US dollars),,,1450.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2017,Tourism expenditure (millions of US dollars),,,1554.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +218,Ecuador,2018,Tourism expenditure (millions of US dollars),,,1878.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,1995,Tourist/visitor arrivals (thousands),TF,,2871.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2005,Tourist/visitor arrivals (thousands),TF,,8244.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2010,Tourist/visitor arrivals (thousands),TF,,14051.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2016,Tourist/visitor arrivals (thousands),TF,,5258.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2017,Tourist/visitor arrivals (thousands),TF,,8157.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2018,Tourist/visitor arrivals (thousands),TF,,11196.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,1995,Tourism expenditure (millions of US dollars),,,2954.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2005,Tourism expenditure (millions of US dollars),,,7206.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2010,Tourism expenditure (millions of US dollars),,,13633.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2016,Tourism expenditure (millions of US dollars),,,3306.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2017,Tourism expenditure (millions of US dollars),,,8636.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +818,Egypt,2018,Tourism expenditure (millions of US dollars),,,12704.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,1995,Tourist/visitor arrivals (thousands),TF,,235.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2005,Tourist/visitor arrivals (thousands),TF,,1127.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2010,Tourist/visitor arrivals (thousands),TF,,1150.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2016,Tourist/visitor arrivals (thousands),TF,,1434.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2017,Tourist/visitor arrivals (thousands),TF,,1556.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2018,Tourist/visitor arrivals (thousands),TF,,1677.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,1995,Tourism expenditure (millions of US dollars),,,152.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2005,Tourism expenditure (millions of US dollars),,,656.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2010,Tourism expenditure (millions of US dollars),,,646.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2016,Tourism expenditure (millions of US dollars),,,1161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2017,Tourism expenditure (millions of US dollars),,,1227.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +222,El Salvador,2018,Tourism expenditure (millions of US dollars),,,1370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +226,Equatorial Guinea,1995,Tourism expenditure (millions of US dollars),,,1.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +232,Eritrea,1995,Tourist/visitor arrivals (thousands),VF,,315.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +232,Eritrea,2005,Tourist/visitor arrivals (thousands),VF,,83.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +232,Eritrea,2010,Tourist/visitor arrivals (thousands),VF,,84.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +232,Eritrea,2016,Tourist/visitor arrivals (thousands),VF,,142.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +232,Eritrea,1995,Tourism expenditure (millions of US dollars),,,58.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +232,Eritrea,2005,Tourism expenditure (millions of US dollars),,,66.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +232,Eritrea,2016,Tourism expenditure (millions of US dollars),,,48.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,1995,Tourist/visitor arrivals (thousands),TF,,530.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2005,Tourist/visitor arrivals (thousands),TF,,1917.0000,"Border statistics are not collected any more, surveys used instead.;Calculated on the basis of accommodation statistics and “Foreign Visitor Survey” carried out by the Statistical Office of Estonia.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2010,Tourist/visitor arrivals (thousands),TF,,2511.0000,"Border statistics are not collected any more, surveys used instead.;Based on mobile positioning data.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2016,Tourist/visitor arrivals (thousands),TF,,3131.0000,"Border statistics are not collected any more, surveys used instead.;Based on mobile positioning data.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2017,Tourist/visitor arrivals (thousands),TF,,3244.0000,"Border statistics are not collected any more, surveys used instead.;Based on mobile positioning data.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2018,Tourist/visitor arrivals (thousands),TF,,3234.0000,"Border statistics are not collected any more, surveys used instead.;Based on mobile positioning data.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,1995,Tourism expenditure (millions of US dollars),,,452.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2005,Tourism expenditure (millions of US dollars),,,1229.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2016,Tourism expenditure (millions of US dollars),,,1916.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2017,Tourism expenditure (millions of US dollars),,,2126.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +233,Estonia,2018,Tourism expenditure (millions of US dollars),,,2332.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,1995,Tourist/visitor arrivals (thousands),TF,,300.0000,Arrivals in hotels only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2005,Tourist/visitor arrivals (thousands),TF,,837.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2010,Tourist/visitor arrivals (thousands),TF,,868.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2016,Tourist/visitor arrivals (thousands),TF,,947.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2017,Tourist/visitor arrivals (thousands),TF,,921.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2018,Tourist/visitor arrivals (thousands),TF,,782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,1995,Tourism expenditure (millions of US dollars),,,54.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2005,Tourism expenditure (millions of US dollars),,,77.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2010,Tourism expenditure (millions of US dollars),,,51.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2016,Tourism expenditure (millions of US dollars),,,13.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2017,Tourism expenditure (millions of US dollars),,,13.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +748,Eswatini,2018,Tourism expenditure (millions of US dollars),,,16.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,1995,Tourist/visitor arrivals (thousands),TF,,103.0000,Arrivals to Bole airport only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2005,Tourist/visitor arrivals (thousands),TF,,227.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2010,Tourist/visitor arrivals (thousands),TF,,468.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2016,Tourist/visitor arrivals (thousands),TF,,871.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2017,Tourist/visitor arrivals (thousands),TF,,933.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2018,Tourist/visitor arrivals (thousands),TF,,849.0000,Including nationals residing abroad.;Arrivals through all ports of entry.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,1995,Tourism expenditure (millions of US dollars),,,177.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2005,Tourism expenditure (millions of US dollars),,,533.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2010,Tourism expenditure (millions of US dollars),,,1434.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2016,Tourism expenditure (millions of US dollars),,,2138.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2017,Tourism expenditure (millions of US dollars),,,2505.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +231,Ethiopia,2018,Tourism expenditure (millions of US dollars),,,3548.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,1995,Tourist/visitor arrivals (thousands),TF,,318.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2005,Tourist/visitor arrivals (thousands),TF,,545.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2010,Tourist/visitor arrivals (thousands),TF,,632.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2016,Tourist/visitor arrivals (thousands),TF,,792.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2017,Tourist/visitor arrivals (thousands),TF,,843.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2018,Tourist/visitor arrivals (thousands),TF,,870.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,1995,Tourism expenditure (millions of US dollars),,,369.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2005,Tourism expenditure (millions of US dollars),,,722.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2010,Tourism expenditure (millions of US dollars),,,825.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2016,Tourism expenditure (millions of US dollars),,,1149.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2017,Tourism expenditure (millions of US dollars),,,1243.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +242,Fiji,2018,Tourism expenditure (millions of US dollars),,,1370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,1995,Tourist/visitor arrivals (thousands),TCE,,1779.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2005,Tourist/visitor arrivals (thousands),TCE,,2080.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2010,Tourist/visitor arrivals (thousands),TCE,,2319.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2016,Tourist/visitor arrivals (thousands),TCE,,2789.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2017,Tourist/visitor arrivals (thousands),TCE,,3180.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2018,Tourist/visitor arrivals (thousands),TCE,,3224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,1995,Tourism expenditure (millions of US dollars),,,2383.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2005,Tourism expenditure (millions of US dollars),,,3069.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2010,Tourism expenditure (millions of US dollars),,,4497.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2016,Tourism expenditure (millions of US dollars),,,4016.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2017,Tourism expenditure (millions of US dollars),,,5207.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +246,Finland,2018,Tourism expenditure (millions of US dollars),,,5663.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,1995,Tourist/visitor arrivals (thousands),TF,,60033.0000,Estimated based on surveys at national borders.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2005,Tourist/visitor arrivals (thousands),TF,,74988.0000,Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2010,Tourist/visitor arrivals (thousands),TF,,76647.0000,Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2016,Tourist/visitor arrivals (thousands),TF,,82682.0000,Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2017,Tourist/visitor arrivals (thousands),TF,,86758.0000,Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2018,Tourist/visitor arrivals (thousands),TF,,89322.0000,Estimate.;Arrivals of non-resident visitors.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,1995,Tourism expenditure (millions of US dollars),,,31295.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2005,Tourism expenditure (millions of US dollars),,,52126.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2010,Tourism expenditure (millions of US dollars),,,56178.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2016,Tourism expenditure (millions of US dollars),,,63557.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2017,Tourism expenditure (millions of US dollars),,,67936.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +250,France,2018,Tourism expenditure (millions of US dollars),,,73125.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +254,French Guiana,2005,Tourist/visitor arrivals (thousands),TF,,95.0000,Survey at Cayenne-Rochambeau airport on departure.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +254,French Guiana,2016,Tourist/visitor arrivals (thousands),TF,,96.0000,Survey at Cayenne-Rochambeau airport on departure.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +254,French Guiana,2017,Tourist/visitor arrivals (thousands),TF,,111.0000,Survey at Cayenne-Rochambeau airport on departure.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +254,French Guiana,2005,Tourism expenditure (millions of US dollars),,,44.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,1995,Tourist/visitor arrivals (thousands),TF,,172.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,2005,Tourist/visitor arrivals (thousands),TF,,208.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,2010,Tourist/visitor arrivals (thousands),TF,,154.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,2016,Tourist/visitor arrivals (thousands),TF,,192.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,2017,Tourist/visitor arrivals (thousands),TF,,199.0000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,2018,Tourist/visitor arrivals (thousands),TF,,216.3000,Excluding nationals residing abroad.;Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,1995,Tourism expenditure (millions of US dollars),,,326.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,2005,Tourism expenditure (millions of US dollars),,,759.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,2010,Tourism expenditure (millions of US dollars),,,630.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +258,French Polynesia,2016,Tourism expenditure (millions of US dollars),,,782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +266,Gabon,1995,Tourist/visitor arrivals (thousands),TF,,125.0000,Arrivals of non-resident tourists at Libreville airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +266,Gabon,2005,Tourist/visitor arrivals (thousands),TF,,269.0000,Arrivals of non-resident tourists at Libreville airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +266,Gabon,1995,Tourism expenditure (millions of US dollars),,,94.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +266,Gabon,2005,Tourism expenditure (millions of US dollars),,,13.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +266,Gabon,2010,Tourism expenditure (millions of US dollars),,,89.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +266,Gabon,2016,Tourism expenditure (millions of US dollars),,,28.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,1995,Tourist/visitor arrivals (thousands),TF,,45.0000,Including nationals residing abroad.;Arrivals by air only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2005,Tourist/visitor arrivals (thousands),TF,,108.0000,Including nationals residing abroad.;Arrivals by air only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2010,Tourist/visitor arrivals (thousands),TF,,91.0000,Including nationals residing abroad.;Arrivals by air only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2016,Tourist/visitor arrivals (thousands),TF,,450.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2017,Tourist/visitor arrivals (thousands),TF,,522.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2018,Tourist/visitor arrivals (thousands),TF,,552.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2005,Tourism expenditure (millions of US dollars),,,59.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2010,Tourism expenditure (millions of US dollars),,,80.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2016,Tourism expenditure (millions of US dollars),,,120.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2017,Tourism expenditure (millions of US dollars),,,116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +270,Gambia,2018,Tourism expenditure (millions of US dollars),,,168.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2010,Tourist/visitor arrivals (thousands),TF,,1067.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2016,Tourist/visitor arrivals (thousands),TF,,3297.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2017,Tourist/visitor arrivals (thousands),TF,,4069.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2018,Tourist/visitor arrivals (thousands),TF,,4757.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2005,Tourism expenditure (millions of US dollars),,,287.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2010,Tourism expenditure (millions of US dollars),,,737.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2016,Tourism expenditure (millions of US dollars),,,2315.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2017,Tourism expenditure (millions of US dollars),,,2971.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +268,Georgia,2018,Tourism expenditure (millions of US dollars),,,3518.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,1995,Tourist/visitor arrivals (thousands),TCE,,14847.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2005,Tourist/visitor arrivals (thousands),TCE,,21500.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2010,Tourist/visitor arrivals (thousands),TCE,,26875.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2016,Tourist/visitor arrivals (thousands),TCE,,35555.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2017,Tourist/visitor arrivals (thousands),TCE,,37452.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2018,Tourist/visitor arrivals (thousands),TCE,,38881.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,1995,Tourism expenditure (millions of US dollars),,,24053.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2005,Tourism expenditure (millions of US dollars),,,40518.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2010,Tourism expenditure (millions of US dollars),,,49116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2016,Tourism expenditure (millions of US dollars),,,52229.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2017,Tourism expenditure (millions of US dollars),,,56330.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +276,Germany,2018,Tourism expenditure (millions of US dollars),,,60260.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,1995,Tourist/visitor arrivals (thousands),TF,,286.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,2005,Tourist/visitor arrivals (thousands),TF,,429.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,2010,Tourist/visitor arrivals (thousands),TF,,931.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,1995,Tourism expenditure (millions of US dollars),,,30.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,2005,Tourism expenditure (millions of US dollars),,,867.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,2010,Tourism expenditure (millions of US dollars),,,706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,2016,Tourism expenditure (millions of US dollars),,,952.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,2017,Tourism expenditure (millions of US dollars),,,919.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +288,Ghana,2018,Tourism expenditure (millions of US dollars),,,996.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,1995,Tourist/visitor arrivals (thousands),TF,,10130.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2005,Tourist/visitor arrivals (thousands),TF,,14765.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2010,Tourist/visitor arrivals (thousands),TF,,15007.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2016,Tourist/visitor arrivals (thousands),TF,,24799.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2017,Tourist/visitor arrivals (thousands),TF,,27194.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2018,Tourist/visitor arrivals (thousands),TF,,30123.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,1995,Tourism expenditure (millions of US dollars),,,4182.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2005,Tourism expenditure (millions of US dollars),,,13455.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2010,Tourism expenditure (millions of US dollars),,,13857.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2016,Tourism expenditure (millions of US dollars),,,16811.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2017,Tourism expenditure (millions of US dollars),,,19139.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +300,Greece,2018,Tourism expenditure (millions of US dollars),,,21594.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,1995,Tourist/visitor arrivals (thousands),TF,,108.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2005,Tourist/visitor arrivals (thousands),TF,,99.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2010,Tourist/visitor arrivals (thousands),TF,,110.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2016,Tourist/visitor arrivals (thousands),TF,,156.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2017,Tourist/visitor arrivals (thousands),TF,,168.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2018,Tourist/visitor arrivals (thousands),TF,,185.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,1995,Tourism expenditure (millions of US dollars),,,76.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2005,Tourism expenditure (millions of US dollars),,,71.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2010,Tourism expenditure (millions of US dollars),,,112.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2016,Tourism expenditure (millions of US dollars),,,437.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2017,Tourism expenditure (millions of US dollars),,,482.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +308,Grenada,2018,Tourism expenditure (millions of US dollars),,,548.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,1995,Tourist/visitor arrivals (thousands),TF,,640.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).;Non-resident tourists staying in all types of accommodation establishments.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,2005,Tourist/visitor arrivals (thousands),TF,,372.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,2010,Tourist/visitor arrivals (thousands),TF,,392.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,2016,Tourist/visitor arrivals (thousands),TF,,581.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,2017,Tourist/visitor arrivals (thousands),TF,,650.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,2018,Tourist/visitor arrivals (thousands),TF,,735.0000,"Arrivals by air.;Excluding the north islands, Saint Barthélemy and Saint Martin (French part).","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,1995,Tourism expenditure (millions of US dollars),,,458.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,2005,Tourism expenditure (millions of US dollars),,,306.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,2010,Tourism expenditure (millions of US dollars),,,510.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +312,Guadeloupe,2018,Tourism expenditure (millions of US dollars),,,860.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +316,Guam,1995,Tourist/visitor arrivals (thousands),TF,,1362.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +316,Guam,2005,Tourist/visitor arrivals (thousands),TF,,1228.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +316,Guam,2010,Tourist/visitor arrivals (thousands),TF,,1197.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +316,Guam,2016,Tourist/visitor arrivals (thousands),TF,,1536.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +316,Guam,2017,Tourist/visitor arrivals (thousands),TF,,1545.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +316,Guam,2018,Tourist/visitor arrivals (thousands),TF,,1549.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2010,Tourist/visitor arrivals (thousands),TF,,1119.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2016,Tourist/visitor arrivals (thousands),TF,,1585.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2017,Tourist/visitor arrivals (thousands),TF,,1660.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2018,Tourist/visitor arrivals (thousands),TF,,1781.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,1995,Tourism expenditure (millions of US dollars),,,213.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2005,Tourism expenditure (millions of US dollars),,,791.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2010,Tourism expenditure (millions of US dollars),,,1378.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2016,Tourism expenditure (millions of US dollars),,,1550.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2017,Tourism expenditure (millions of US dollars),,,1566.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +320,Guatemala,2018,Tourism expenditure (millions of US dollars),,,1549.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,2005,Tourist/visitor arrivals (thousands),TF,,45.0000,Arrivals by air at Conakry airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,2010,Tourist/visitor arrivals (thousands),TF,,12.4000,Arrivals by air at Conakry airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,2016,Tourist/visitor arrivals (thousands),TF,,63.0000,Arrivals by air at Conakry airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,2017,Tourist/visitor arrivals (thousands),TF,,99.0000,Arrivals by air at Conakry airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,1995,Tourism expenditure (millions of US dollars),,,0.9110,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,2010,Tourism expenditure (millions of US dollars),,,2.0400,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,2016,Tourism expenditure (millions of US dollars),,,16.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,2017,Tourism expenditure (millions of US dollars),,,16.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +324,Guinea,2018,Tourism expenditure (millions of US dollars),,,7.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +624,Guinea-Bissau,2005,Tourist/visitor arrivals (thousands),TF,,5.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +624,Guinea-Bissau,2010,Tourist/visitor arrivals (thousands),TF,,22.3000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +624,Guinea-Bissau,2016,Tourist/visitor arrivals (thousands),TF,,45.2000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +624,Guinea-Bissau,2005,Tourism expenditure (millions of US dollars),,,1.6000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +624,Guinea-Bissau,2010,Tourism expenditure (millions of US dollars),,,13.3000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +624,Guinea-Bissau,2016,Tourism expenditure (millions of US dollars),,,11.5000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +624,Guinea-Bissau,2017,Tourism expenditure (millions of US dollars),,,16.3000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +624,Guinea-Bissau,2018,Tourism expenditure (millions of US dollars),,,19.8000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,1995,Tourist/visitor arrivals (thousands),TF,,106.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2005,Tourist/visitor arrivals (thousands),TF,,117.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2010,Tourist/visitor arrivals (thousands),TF,,152.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2016,Tourist/visitor arrivals (thousands),TF,,235.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2017,Tourist/visitor arrivals (thousands),TF,,247.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2018,Tourist/visitor arrivals (thousands),TF,,287.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,1995,Tourism expenditure (millions of US dollars),,,33.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2005,Tourism expenditure (millions of US dollars),,,35.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2010,Tourism expenditure (millions of US dollars),,,80.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2016,Tourism expenditure (millions of US dollars),,,104.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2017,Tourism expenditure (millions of US dollars),,,95.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +328,Guyana,2018,Tourism expenditure (millions of US dollars),,,28.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,1995,Tourist/visitor arrivals (thousands),TF,,145.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2005,Tourist/visitor arrivals (thousands),TF,,112.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2010,Tourist/visitor arrivals (thousands),TF,,255.0000,Arrivals by air.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2016,Tourist/visitor arrivals (thousands),TF,,445.0000,Arrivals by air.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2017,Tourist/visitor arrivals (thousands),TF,,467.0000,Arrivals by air.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2018,Tourist/visitor arrivals (thousands),TF,,447.0000,Arrivals by air.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,1995,Tourism expenditure (millions of US dollars),,,90.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2005,Tourism expenditure (millions of US dollars),,,80.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2010,Tourism expenditure (millions of US dollars),,,383.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2016,Tourism expenditure (millions of US dollars),,,511.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2017,Tourism expenditure (millions of US dollars),,,460.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +332,Haiti,2018,Tourism expenditure (millions of US dollars),,,620.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,1995,Tourist/visitor arrivals (thousands),TF,,271.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2005,Tourist/visitor arrivals (thousands),TF,,673.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2010,Tourist/visitor arrivals (thousands),TF,,863.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2016,Tourist/visitor arrivals (thousands),TF,,838.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2017,Tourist/visitor arrivals (thousands),TF,,851.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,1995,Tourism expenditure (millions of US dollars),,,85.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2005,Tourism expenditure (millions of US dollars),,,465.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2010,Tourism expenditure (millions of US dollars),,,626.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2016,Tourism expenditure (millions of US dollars),,,700.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2017,Tourism expenditure (millions of US dollars),,,722.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +340,Honduras,2018,Tourism expenditure (millions of US dollars),,,745.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2005,Tourist/visitor arrivals (thousands),TF,,9979.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2010,Tourist/visitor arrivals (thousands),TF,,9510.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2016,Tourist/visitor arrivals (thousands),TF,,15255.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2017,Tourist/visitor arrivals (thousands),TF,,15785.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2018,Tourist/visitor arrivals (thousands),TF,,17552.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,1995,Tourism expenditure (millions of US dollars),,,2938.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2005,Tourism expenditure (millions of US dollars),,,4761.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2010,Tourism expenditure (millions of US dollars),,,6595.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2016,Tourism expenditure (millions of US dollars),,,7481.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2017,Tourism expenditure (millions of US dollars),,,8448.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +348,Hungary,2018,Tourism expenditure (millions of US dollars),,,9595.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,1995,Tourist/visitor arrivals (thousands),TF,,190.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2005,Tourist/visitor arrivals (thousands),TF,,374.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2010,Tourist/visitor arrivals (thousands),TF,,489.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2016,Tourist/visitor arrivals (thousands),TF,,1792.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2017,Tourist/visitor arrivals (thousands),TF,,2225.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2018,Tourist/visitor arrivals (thousands),TF,,2343.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,1995,Tourism expenditure (millions of US dollars),,,186.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2005,Tourism expenditure (millions of US dollars),,,413.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2010,Tourism expenditure (millions of US dollars),,,562.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2016,Tourism expenditure (millions of US dollars),,,2411.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2017,Tourism expenditure (millions of US dollars),,,3024.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +352,Iceland,2018,Tourism expenditure (millions of US dollars),,,3128.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,1995,Tourist/visitor arrivals (thousands),TF,,2124.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2005,Tourist/visitor arrivals (thousands),TF,,3919.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2010,Tourist/visitor arrivals (thousands),TF,,5776.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2016,Tourist/visitor arrivals (thousands),TF,,14570.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2017,Tourist/visitor arrivals (thousands),TF,,15543.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2018,Tourist/visitor arrivals (thousands),TF,,17423.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2005,Tourism expenditure (millions of US dollars),,,7659.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2016,Tourism expenditure (millions of US dollars),,,23111.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2017,Tourism expenditure (millions of US dollars),,,27878.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +356,India,2018,Tourism expenditure (millions of US dollars),,,29143.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,1995,Tourist/visitor arrivals (thousands),VF,,4324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2005,Tourist/visitor arrivals (thousands),VF,,5002.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2010,Tourist/visitor arrivals (thousands),VF,,7003.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2016,Tourist/visitor arrivals (thousands),VF,,11519.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2017,Tourist/visitor arrivals (thousands),VF,,14040.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2018,Tourist/visitor arrivals (thousands),VF,,15810.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2005,Tourism expenditure (millions of US dollars),,,5094.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2010,Tourism expenditure (millions of US dollars),,,7618.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2016,Tourism expenditure (millions of US dollars),,,12566.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2017,Tourism expenditure (millions of US dollars),,,14691.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +360,Indonesia,2018,Tourism expenditure (millions of US dollars),,,15600.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),1995,Tourist/visitor arrivals (thousands),VF,,568.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),2010,Tourist/visitor arrivals (thousands),VF,,2938.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),2016,Tourist/visitor arrivals (thousands),VF,,4942.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),2017,Tourist/visitor arrivals (thousands),VF,,4867.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),2018,Tourist/visitor arrivals (thousands),VF,,7295.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),1995,Tourism expenditure (millions of US dollars),,,205.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),2005,Tourism expenditure (millions of US dollars),,,1025.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),2010,Tourism expenditure (millions of US dollars),,,2631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),2016,Tourism expenditure (millions of US dollars),,,3914.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +364,Iran (Islamic Republic of),2017,Tourism expenditure (millions of US dollars),,,4632.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +368,Iraq,1995,Tourist/visitor arrivals (thousands),VF,,61.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +368,Iraq,2010,Tourist/visitor arrivals (thousands),VF,,1518.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +368,Iraq,2005,Tourism expenditure (millions of US dollars),,,186.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +368,Iraq,2010,Tourism expenditure (millions of US dollars),,,1736.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +368,Iraq,2016,Tourism expenditure (millions of US dollars),,,3120.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +368,Iraq,2017,Tourism expenditure (millions of US dollars),,,2959.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +368,Iraq,2018,Tourism expenditure (millions of US dollars),,,1986.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,1995,Tourist/visitor arrivals (thousands),TF,,4818.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2005,Tourist/visitor arrivals (thousands),TF,,7333.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2010,Tourist/visitor arrivals (thousands),TF,,7134.0000,Break in the time series.;Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2016,Tourist/visitor arrivals (thousands),TF,,10100.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2017,Tourist/visitor arrivals (thousands),TF,,10338.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2018,Tourist/visitor arrivals (thousands),TF,,10926.0000,Including tourists from Northern Ireland.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,1995,Tourism expenditure (millions of US dollars),,,2697.7927,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2005,Tourism expenditure (millions of US dollars),,,6779.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2010,Tourism expenditure (millions of US dollars),,,8185.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2016,Tourism expenditure (millions of US dollars),,,11429.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2017,Tourism expenditure (millions of US dollars),,,14294.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +372,Ireland,2018,Tourism expenditure (millions of US dollars),,,14658.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,1995,Tourist/visitor arrivals (thousands),TF,,2215.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2005,Tourist/visitor arrivals (thousands),TF,,1903.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2010,Tourist/visitor arrivals (thousands),TF,,2803.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2016,Tourist/visitor arrivals (thousands),TF,,2900.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2017,Tourist/visitor arrivals (thousands),TF,,3613.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2018,Tourist/visitor arrivals (thousands),TF,,4121.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,1995,Tourism expenditure (millions of US dollars),,,3491.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2005,Tourism expenditure (millions of US dollars),,,2750.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2010,Tourism expenditure (millions of US dollars),,,5621.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2016,Tourism expenditure (millions of US dollars),,,6587.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2017,Tourism expenditure (millions of US dollars),,,7578.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +376,Israel,2018,Tourism expenditure (millions of US dollars),,,8073.0000,Including the expenditures of foreign workers in Israel.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,1995,Tourist/visitor arrivals (thousands),TF,,31052.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2005,Tourist/visitor arrivals (thousands),TF,,36513.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2010,Tourist/visitor arrivals (thousands),TF,,43626.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2016,Tourist/visitor arrivals (thousands),TF,,52372.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2017,Tourist/visitor arrivals (thousands),TF,,58253.0000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2018,Tourist/visitor arrivals (thousands),TF,,61567.2000,Excluding seasonal and border workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,1995,Tourism expenditure (millions of US dollars),,,30411.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2005,Tourism expenditure (millions of US dollars),,,38364.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2016,Tourism expenditure (millions of US dollars),,,42423.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2017,Tourism expenditure (millions of US dollars),,,46719.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +380,Italy,2018,Tourism expenditure (millions of US dollars),,,51602.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,1995,Tourist/visitor arrivals (thousands),TF,,1147.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2005,Tourist/visitor arrivals (thousands),TF,,1479.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2010,Tourist/visitor arrivals (thousands),TF,,1922.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2016,Tourist/visitor arrivals (thousands),TF,,2182.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2017,Tourist/visitor arrivals (thousands),TF,,2353.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2018,Tourist/visitor arrivals (thousands),TF,,2473.0000,Including nationals residing abroad; E/D cards.;Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,1995,Tourism expenditure (millions of US dollars),,,1069.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2005,Tourism expenditure (millions of US dollars),,,1545.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2010,Tourism expenditure (millions of US dollars),,,2001.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2016,Tourism expenditure (millions of US dollars),,,2539.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2017,Tourism expenditure (millions of US dollars),,,2809.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +388,Jamaica,2018,Tourism expenditure (millions of US dollars),,,3099.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,1995,Tourist/visitor arrivals (thousands),VF,,3345.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2005,Tourist/visitor arrivals (thousands),VF,,6728.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2010,Tourist/visitor arrivals (thousands),VF,,8611.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2016,Tourist/visitor arrivals (thousands),VF,,24040.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2017,Tourist/visitor arrivals (thousands),VF,,28691.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2018,Tourist/visitor arrivals (thousands),VF,,31192.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,1995,Tourism expenditure (millions of US dollars),,,4894.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2005,Tourism expenditure (millions of US dollars),,,15554.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2010,Tourism expenditure (millions of US dollars),,,15356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2016,Tourism expenditure (millions of US dollars),,,33456.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2017,Tourism expenditure (millions of US dollars),,,36978.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +392,Japan,2018,Tourism expenditure (millions of US dollars),,,45276.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,1995,Tourist/visitor arrivals (thousands),TF,,1075.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2005,Tourist/visitor arrivals (thousands),TF,,2987.0000,Break in the time series.;Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2010,Tourist/visitor arrivals (thousands),TF,,4207.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2016,Tourist/visitor arrivals (thousands),TF,,3567.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2017,Tourist/visitor arrivals (thousands),TF,,3843.5000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2018,Tourist/visitor arrivals (thousands),TF,,4150.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,1995,Tourism expenditure (millions of US dollars),,,973.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2005,Tourism expenditure (millions of US dollars),,,1759.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2010,Tourism expenditure (millions of US dollars),,,4390.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2016,Tourism expenditure (millions of US dollars),,,4943.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2017,Tourism expenditure (millions of US dollars),,,5549.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +400,Jordan,2018,Tourism expenditure (millions of US dollars),,,6221.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +398,Kazakhstan,2005,Tourist/visitor arrivals (thousands),TF,,3143.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +398,Kazakhstan,2010,Tourist/visitor arrivals (thousands),TF,,2991.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +398,Kazakhstan,1995,Tourism expenditure (millions of US dollars),,,155.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +398,Kazakhstan,2005,Tourism expenditure (millions of US dollars),,,801.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +398,Kazakhstan,2010,Tourism expenditure (millions of US dollars),,,1236.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +398,Kazakhstan,2016,Tourism expenditure (millions of US dollars),,,2038.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +398,Kazakhstan,2017,Tourism expenditure (millions of US dollars),,,2356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +398,Kazakhstan,2018,Tourism expenditure (millions of US dollars),,,2651.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,1995,Tourist/visitor arrivals (thousands),TF,,918.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,2005,Tourist/visitor arrivals (thousands),TF,,1399.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,2010,Tourist/visitor arrivals (thousands),TF,,1470.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,2016,Tourist/visitor arrivals (thousands),TF,,1268.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,2017,Tourist/visitor arrivals (thousands),TF,,1364.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,1995,Tourism expenditure (millions of US dollars),,,785.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,2005,Tourism expenditure (millions of US dollars),,,969.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,2010,Tourism expenditure (millions of US dollars),,,1620.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,2016,Tourism expenditure (millions of US dollars),,,1471.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +404,Kenya,2017,Tourism expenditure (millions of US dollars),,,1564.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,1995,Tourist/visitor arrivals (thousands),TF,,3.9000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,2005,Tourist/visitor arrivals (thousands),TF,,4.1000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,2010,Tourist/visitor arrivals (thousands),TF,,4.7000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,2016,Tourist/visitor arrivals (thousands),TF,,5.7000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,2017,Tourist/visitor arrivals (thousands),TF,,5.8000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,2018,Tourist/visitor arrivals (thousands),TF,,7.1000,Air arrivals. Tarawa and Christmas Island.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,2010,Tourism expenditure (millions of US dollars),,,4.3000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,2016,Tourism expenditure (millions of US dollars),,,2.8000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +296,Kiribati,2017,Tourism expenditure (millions of US dollars),,,4.1000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,1995,Tourist/visitor arrivals (thousands),VF,,1443.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2005,Tourist/visitor arrivals (thousands),VF,,3474.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2010,Tourist/visitor arrivals (thousands),VF,,5208.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2016,Tourist/visitor arrivals (thousands),VF,,7055.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2017,Tourist/visitor arrivals (thousands),VF,,7407.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2018,Tourist/visitor arrivals (thousands),VF,,8508.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,1995,Tourism expenditure (millions of US dollars),,,307.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2005,Tourism expenditure (millions of US dollars),,,413.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2010,Tourism expenditure (millions of US dollars),,,574.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2016,Tourism expenditure (millions of US dollars),,,831.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2017,Tourism expenditure (millions of US dollars),,,643.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +414,Kuwait,2018,Tourism expenditure (millions of US dollars),,,919.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2005,Tourist/visitor arrivals (thousands),VF,,319.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2010,Tourist/visitor arrivals (thousands),VF,,1224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2016,Tourist/visitor arrivals (thousands),VF,,3853.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2017,Tourist/visitor arrivals (thousands),VF,,4568.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2018,Tourist/visitor arrivals (thousands),VF,,6947.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2005,Tourism expenditure (millions of US dollars),,,94.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2010,Tourism expenditure (millions of US dollars),,,212.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2016,Tourism expenditure (millions of US dollars),,,477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2017,Tourism expenditure (millions of US dollars),,,480.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +417,Kyrgyzstan,2018,Tourism expenditure (millions of US dollars),,,487.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,1995,Tourist/visitor arrivals (thousands),TF,,60.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2005,Tourist/visitor arrivals (thousands),TF,,672.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2010,Tourist/visitor arrivals (thousands),TF,,1670.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2016,Tourist/visitor arrivals (thousands),TF,,3315.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2017,Tourist/visitor arrivals (thousands),TF,,3257.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2018,Tourist/visitor arrivals (thousands),TF,,3770.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,1995,Tourism expenditure (millions of US dollars),,,52.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2005,Tourism expenditure (millions of US dollars),,,143.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2010,Tourism expenditure (millions of US dollars),,,385.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2016,Tourism expenditure (millions of US dollars),,,717.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2017,Tourism expenditure (millions of US dollars),,,655.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +418,Lao People's Dem. Rep.,2018,Tourism expenditure (millions of US dollars),,,757.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +428,Latvia,1995,Tourist/visitor arrivals (thousands),TF,,539.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +428,Latvia,2005,Tourist/visitor arrivals (thousands),TF,,1116.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +428,Latvia,2010,Tourist/visitor arrivals (thousands),TF,,1373.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +428,Latvia,2016,Tourist/visitor arrivals (thousands),TF,,1793.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +428,Latvia,2017,Tourist/visitor arrivals (thousands),TF,,1949.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +428,Latvia,2018,Tourist/visitor arrivals (thousands),TF,,1946.0000,Non-resident departures. Survey of persons crossing the state border.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +428,Latvia,1995,Tourism expenditure (millions of US dollars),,,37.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +428,Latvia,2005,Tourism expenditure (millions of US dollars),,,446.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,1995,Tourist/visitor arrivals (thousands),TF,,450.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2005,Tourist/visitor arrivals (thousands),TF,,1140.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2010,Tourist/visitor arrivals (thousands),TF,,2168.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2016,Tourist/visitor arrivals (thousands),TF,,1688.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2017,Tourist/visitor arrivals (thousands),TF,,1857.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2018,Tourist/visitor arrivals (thousands),TF,,1964.0000,"Excluding the Lebanon, Syria and Palestine nationalities.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,1995,Tourism expenditure (millions of US dollars),,,710.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2005,Tourism expenditure (millions of US dollars),,,5969.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2010,Tourism expenditure (millions of US dollars),,,8026.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2016,Tourism expenditure (millions of US dollars),,,7373.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2017,Tourism expenditure (millions of US dollars),,,8086.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +422,Lebanon,2018,Tourism expenditure (millions of US dollars),,,8694.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,1995,Tourist/visitor arrivals (thousands),VF,,209.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2005,Tourist/visitor arrivals (thousands),VF,,304.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2010,Tourist/visitor arrivals (thousands),VF,,426.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2016,Tourist/visitor arrivals (thousands),VF,,1196.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2017,Tourist/visitor arrivals (thousands),VF,,1137.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2018,Tourist/visitor arrivals (thousands),VF,,1173.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,1995,Tourism expenditure (millions of US dollars),,,27.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2005,Tourism expenditure (millions of US dollars),,,27.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2010,Tourism expenditure (millions of US dollars),,,23.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2016,Tourism expenditure (millions of US dollars),,,48.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2017,Tourism expenditure (millions of US dollars),,,23.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +426,Lesotho,2018,Tourism expenditure (millions of US dollars),,,24.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +430,Liberia,2005,Tourism expenditure (millions of US dollars),,,67.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +434,Libya,2005,Tourist/visitor arrivals (thousands),THS,,81.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +434,Libya,1995,Tourism expenditure (millions of US dollars),,,4.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +434,Libya,2005,Tourism expenditure (millions of US dollars),,,301.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +434,Libya,2010,Tourism expenditure (millions of US dollars),,,170.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +438,Liechtenstein,2010,Tourist/visitor arrivals (thousands),TCE,,64.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +438,Liechtenstein,2016,Tourist/visitor arrivals (thousands),TCE,,69.1000,Excluding long term tourists on campgrounds and in holiday flats.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +438,Liechtenstein,2017,Tourist/visitor arrivals (thousands),TCE,,79.3000,Excluding long term tourists on campgrounds and in holiday flats.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +438,Liechtenstein,2018,Tourist/visitor arrivals (thousands),TCE,,85.3000,Excluding long term tourists on campgrounds and in holiday flats.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,1995,Tourist/visitor arrivals (thousands),TF,,650.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2005,Tourist/visitor arrivals (thousands),TF,,2000.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2010,Tourist/visitor arrivals (thousands),TF,,1507.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2016,Tourist/visitor arrivals (thousands),TF,,2296.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2017,Tourist/visitor arrivals (thousands),TF,,2523.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2018,Tourist/visitor arrivals (thousands),TF,,2825.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,1995,Tourism expenditure (millions of US dollars),,,77.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2005,Tourism expenditure (millions of US dollars),,,920.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2010,Tourism expenditure (millions of US dollars),,,958.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2016,Tourism expenditure (millions of US dollars),,,1210.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2017,Tourism expenditure (millions of US dollars),,,1325.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +440,Lithuania,2018,Tourism expenditure (millions of US dollars),,,1419.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,1995,Tourist/visitor arrivals (thousands),TCE,,768.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2005,Tourist/visitor arrivals (thousands),TCE,,913.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2010,Tourist/visitor arrivals (thousands),TCE,,805.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2016,Tourist/visitor arrivals (thousands),TCE,,1054.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2017,Tourist/visitor arrivals (thousands),TCE,,1046.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2018,Tourist/visitor arrivals (thousands),TCE,,1018.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2005,Tourism expenditure (millions of US dollars),,,3770.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2010,Tourism expenditure (millions of US dollars),,,4519.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2016,Tourism expenditure (millions of US dollars),,,4766.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2017,Tourism expenditure (millions of US dollars),,,4993.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +442,Luxembourg,2018,Tourism expenditure (millions of US dollars),,,5537.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,1995,Tourist/visitor arrivals (thousands),TF,,75.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2005,Tourist/visitor arrivals (thousands),TF,,277.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2010,Tourist/visitor arrivals (thousands),TF,,196.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2016,Tourist/visitor arrivals (thousands),TF,,293.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2017,Tourist/visitor arrivals (thousands),TF,,255.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2018,Tourist/visitor arrivals (thousands),TF,,291.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,1995,Tourism expenditure (millions of US dollars),,,106.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2005,Tourism expenditure (millions of US dollars),,,275.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2010,Tourism expenditure (millions of US dollars),,,425.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2016,Tourism expenditure (millions of US dollars),,,913.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2017,Tourism expenditure (millions of US dollars),,,849.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +450,Madagascar,2018,Tourism expenditure (millions of US dollars),,,879.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,1995,Tourist/visitor arrivals (thousands),TF,,192.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2005,Tourist/visitor arrivals (thousands),TF,,438.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2010,Tourist/visitor arrivals (thousands),TF,,746.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2016,Tourist/visitor arrivals (thousands),TF,,849.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2017,Tourist/visitor arrivals (thousands),TF,,837.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2018,Tourist/visitor arrivals (thousands),TF,,871.0000,Departures.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,1995,Tourism expenditure (millions of US dollars),,,22.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2005,Tourism expenditure (millions of US dollars),,,48.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2010,Tourism expenditure (millions of US dollars),,,45.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2016,Tourism expenditure (millions of US dollars),,,30.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2017,Tourism expenditure (millions of US dollars),,,35.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +454,Malawi,2018,Tourism expenditure (millions of US dollars),,,43.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,1995,Tourist/visitor arrivals (thousands),TF,,7469.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2005,Tourist/visitor arrivals (thousands),TF,,16431.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2010,Tourist/visitor arrivals (thousands),TF,,24577.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2016,Tourist/visitor arrivals (thousands),TF,,26757.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2017,Tourist/visitor arrivals (thousands),TF,,25948.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2018,Tourist/visitor arrivals (thousands),TF,,25832.0000,Including Singapore residents crossing the frontier by road through Johore Causeway.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,1995,Tourism expenditure (millions of US dollars),,,5044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2005,Tourism expenditure (millions of US dollars),,,10389.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2010,Tourism expenditure (millions of US dollars),,,19619.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2016,Tourism expenditure (millions of US dollars),,,19682.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2017,Tourism expenditure (millions of US dollars),,,20311.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +458,Malaysia,2018,Tourism expenditure (millions of US dollars),,,21774.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,1995,Tourist/visitor arrivals (thousands),TF,,315.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,2005,Tourist/visitor arrivals (thousands),TF,,395.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,2010,Tourist/visitor arrivals (thousands),TF,,792.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,2016,Tourist/visitor arrivals (thousands),TF,,1286.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,2017,Tourist/visitor arrivals (thousands),TF,,1390.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,2018,Tourist/visitor arrivals (thousands),TF,,1484.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,2016,Tourism expenditure (millions of US dollars),,,2640.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,2017,Tourism expenditure (millions of US dollars),,,2771.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +462,Maldives,2018,Tourism expenditure (millions of US dollars),,,3054.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +466,Mali,2010,Tourist/visitor arrivals (thousands),TF,,169.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +466,Mali,2016,Tourist/visitor arrivals (thousands),TF,,173.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +466,Mali,2017,Tourist/visitor arrivals (thousands),TF,,193.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +466,Mali,1995,Tourism expenditure (millions of US dollars),,,26.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +466,Mali,2005,Tourism expenditure (millions of US dollars),,,149.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +466,Mali,2010,Tourism expenditure (millions of US dollars),,,208.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +466,Mali,2016,Tourism expenditure (millions of US dollars),,,201.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +466,Mali,2017,Tourism expenditure (millions of US dollars),,,206.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,1995,Tourist/visitor arrivals (thousands),TF,,1116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2005,Tourist/visitor arrivals (thousands),TF,,1171.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2010,Tourist/visitor arrivals (thousands),TF,,1339.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2016,Tourist/visitor arrivals (thousands),TF,,1966.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2017,Tourist/visitor arrivals (thousands),TF,,2274.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2018,Tourist/visitor arrivals (thousands),TF,,2599.0000,Departures by air and by sea.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,1995,Tourism expenditure (millions of US dollars),,,656.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2005,Tourism expenditure (millions of US dollars),,,755.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2010,Tourism expenditure (millions of US dollars),,,1066.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2016,Tourism expenditure (millions of US dollars),,,1451.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2017,Tourism expenditure (millions of US dollars),,,1746.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +470,Malta,2018,Tourism expenditure (millions of US dollars),,,1845.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,1995,Tourist/visitor arrivals (thousands),TF,,5.5000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2005,Tourist/visitor arrivals (thousands),TF,,9.2000,Air and sea arrivals.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2010,Tourist/visitor arrivals (thousands),TF,,4.6000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2016,Tourist/visitor arrivals (thousands),TF,,5.4000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2017,Tourist/visitor arrivals (thousands),TF,,6.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2018,Tourist/visitor arrivals (thousands),TF,,6.8000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,1995,Tourism expenditure (millions of US dollars),,,2.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2005,Tourism expenditure (millions of US dollars),,,3.6900,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2010,Tourism expenditure (millions of US dollars),,,3.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2016,Tourism expenditure (millions of US dollars),,,30.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2017,Tourism expenditure (millions of US dollars),,,18.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +584,Marshall Islands,2018,Tourism expenditure (millions of US dollars),,,20.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,1995,Tourist/visitor arrivals (thousands),TF,,457.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2005,Tourist/visitor arrivals (thousands),TF,,484.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2010,Tourist/visitor arrivals (thousands),TF,,478.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2016,Tourist/visitor arrivals (thousands),TF,,519.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2017,Tourist/visitor arrivals (thousands),TF,,536.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2018,Tourist/visitor arrivals (thousands),TF,,537.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,1995,Tourism expenditure (millions of US dollars),,,384.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2005,Tourism expenditure (millions of US dollars),,,280.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2010,Tourism expenditure (millions of US dollars),,,472.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2016,Tourism expenditure (millions of US dollars),,,348.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2017,Tourism expenditure (millions of US dollars),,,510.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +474,Martinique,2018,Tourism expenditure (millions of US dollars),,,530.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +478,Mauritania,2016,Tourism expenditure (millions of US dollars),,,33.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +478,Mauritania,2017,Tourism expenditure (millions of US dollars),,,24.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +478,Mauritania,2018,Tourism expenditure (millions of US dollars),,,6.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,1995,Tourist/visitor arrivals (thousands),TF,,422.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2005,Tourist/visitor arrivals (thousands),TF,,761.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2010,Tourist/visitor arrivals (thousands),TF,,935.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2016,Tourist/visitor arrivals (thousands),TF,,1275.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2017,Tourist/visitor arrivals (thousands),TF,,1342.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2018,Tourist/visitor arrivals (thousands),TF,,1399.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,1995,Tourism expenditure (millions of US dollars),,,616.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2005,Tourism expenditure (millions of US dollars),,,1189.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2010,Tourism expenditure (millions of US dollars),,,1585.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2016,Tourism expenditure (millions of US dollars),,,1824.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2017,Tourism expenditure (millions of US dollars),,,2005.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +480,Mauritius,2018,Tourism expenditure (millions of US dollars),,,2161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,1995,Tourist/visitor arrivals (thousands),TF,,20241.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2005,Tourist/visitor arrivals (thousands),TF,,21915.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2010,Tourist/visitor arrivals (thousands),TF,,23290.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2016,Tourist/visitor arrivals (thousands),TF,,35079.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2017,Tourist/visitor arrivals (thousands),TF,,39291.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2018,Tourist/visitor arrivals (thousands),TF,,41313.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,1995,Tourism expenditure (millions of US dollars),,,6847.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2005,Tourism expenditure (millions of US dollars),,,12801.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2010,Tourism expenditure (millions of US dollars),,,12628.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2016,Tourism expenditure (millions of US dollars),,,20619.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2017,Tourism expenditure (millions of US dollars),,,22467.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +484,Mexico,2018,Tourism expenditure (millions of US dollars),,,23802.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +583,Micronesia (Fed. States of),2005,Tourist/visitor arrivals (thousands),TF,,19.0000,"Arrivals in the States of Kosrae, Chuuk, Pohnpei and Yap; excluding FSM citizens.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +583,Micronesia (Fed. States of),2010,Tourist/visitor arrivals (thousands),TF,,44.7000,"Arrivals in the States of Kosrae, Chuuk, Pohnpei and Yap; excluding FSM citizens.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +583,Micronesia (Fed. States of),2016,Tourist/visitor arrivals (thousands),TF,,29.6000,"Arrivals in the States of Kosrae, Chuuk, Pohnpei and Yap; excluding FSM citizens.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +583,Micronesia (Fed. States of),2018,Tourist/visitor arrivals (thousands),TF,,19.2000,"Arrivals in the States of Kosrae, Chuuk, Pohnpei and Yap; excluding FSM citizens.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +583,Micronesia (Fed. States of),2010,Tourism expenditure (millions of US dollars),,,24.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +492,Monaco,1995,Tourist/visitor arrivals (thousands),THS,,233.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +492,Monaco,2005,Tourist/visitor arrivals (thousands),THS,,286.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +492,Monaco,2010,Tourist/visitor arrivals (thousands),THS,,279.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +492,Monaco,2016,Tourist/visitor arrivals (thousands),THS,,336.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +492,Monaco,2017,Tourist/visitor arrivals (thousands),THS,,355.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +492,Monaco,2018,Tourist/visitor arrivals (thousands),THS,,347.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2005,Tourist/visitor arrivals (thousands),TF,,339.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2010,Tourist/visitor arrivals (thousands),TF,,456.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2016,Tourist/visitor arrivals (thousands),TF,,404.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2017,Tourist/visitor arrivals (thousands),TF,,469.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2018,Tourist/visitor arrivals (thousands),TF,,529.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,1995,Tourism expenditure (millions of US dollars),,,33.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2005,Tourism expenditure (millions of US dollars),,,203.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2010,Tourism expenditure (millions of US dollars),,,288.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2016,Tourism expenditure (millions of US dollars),,,379.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2017,Tourism expenditure (millions of US dollars),,,462.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +496,Mongolia,2018,Tourism expenditure (millions of US dollars),,,526.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2005,Tourist/visitor arrivals (thousands),TCE,,272.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2010,Tourist/visitor arrivals (thousands),TCE,,1088.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2016,Tourist/visitor arrivals (thousands),TCE,,1662.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2017,Tourist/visitor arrivals (thousands),TCE,,1877.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2018,Tourist/visitor arrivals (thousands),TCE,,2077.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2010,Tourism expenditure (millions of US dollars),,,765.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2016,Tourism expenditure (millions of US dollars),,,978.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2017,Tourism expenditure (millions of US dollars),,,1110.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +499,Montenegro,2018,Tourism expenditure (millions of US dollars),,,1224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,1995,Tourist/visitor arrivals (thousands),TF,,17.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2005,Tourist/visitor arrivals (thousands),TF,,9.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2010,Tourist/visitor arrivals (thousands),TF,,6.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2016,Tourist/visitor arrivals (thousands),TF,,8.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2017,Tourist/visitor arrivals (thousands),TF,,8.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2018,Tourist/visitor arrivals (thousands),TF,,8.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,1995,Tourism expenditure (millions of US dollars),,,17.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2005,Tourism expenditure (millions of US dollars),,,9.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2010,Tourism expenditure (millions of US dollars),,,5.9000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2016,Tourism expenditure (millions of US dollars),,,8.6000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2017,Tourism expenditure (millions of US dollars),,,8.4000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +500,Montserrat,2018,Tourism expenditure (millions of US dollars),,,11.1000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,1995,Tourist/visitor arrivals (thousands),TF,,2602.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2005,Tourist/visitor arrivals (thousands),TF,,5843.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2010,Tourist/visitor arrivals (thousands),TF,,9288.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2016,Tourist/visitor arrivals (thousands),TF,,10332.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2017,Tourist/visitor arrivals (thousands),TF,,11349.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2018,Tourist/visitor arrivals (thousands),TF,,12289.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,1995,Tourism expenditure (millions of US dollars),,,1469.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2005,Tourism expenditure (millions of US dollars),,,5426.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2010,Tourism expenditure (millions of US dollars),,,8176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2016,Tourism expenditure (millions of US dollars),,,7922.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2017,Tourism expenditure (millions of US dollars),,,9086.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +504,Morocco,2018,Tourism expenditure (millions of US dollars),,,9523.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2005,Tourist/visitor arrivals (thousands),TF,,578.0000,The data correspond only to 12 border posts.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2010,Tourist/visitor arrivals (thousands),TF,,1718.0000,Break in the time series.;The data of all the border posts of the country are used.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2016,Tourist/visitor arrivals (thousands),TF,,1639.0000,The data of all the border posts of the country are used.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2017,Tourist/visitor arrivals (thousands),TF,,1447.0000,The data of all the border posts of the country are used.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2018,Tourist/visitor arrivals (thousands),TF,,2743.0000,The data of all the border posts of the country are used.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2005,Tourism expenditure (millions of US dollars),,,138.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2010,Tourism expenditure (millions of US dollars),,,135.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2016,Tourism expenditure (millions of US dollars),,,114.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2017,Tourism expenditure (millions of US dollars),,,164.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +508,Mozambique,2018,Tourism expenditure (millions of US dollars),,,331.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,1995,Tourist/visitor arrivals (thousands),TF,,194.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2005,Tourist/visitor arrivals (thousands),TF,,660.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2010,Tourist/visitor arrivals (thousands),TF,,792.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2016,Tourist/visitor arrivals (thousands),TF,,2907.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2017,Tourist/visitor arrivals (thousands),TF,,3443.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2018,Tourist/visitor arrivals (thousands),TF,,3551.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,1995,Tourism expenditure (millions of US dollars),,,169.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2005,Tourism expenditure (millions of US dollars),,,83.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2010,Tourism expenditure (millions of US dollars),,,91.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2016,Tourism expenditure (millions of US dollars),,,2289.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2017,Tourism expenditure (millions of US dollars),,,1988.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +104,Myanmar,2018,Tourism expenditure (millions of US dollars),,,1670.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,1995,Tourist/visitor arrivals (thousands),TF,,272.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2005,Tourist/visitor arrivals (thousands),TF,,778.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2010,Tourist/visitor arrivals (thousands),TF,,984.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2016,Tourist/visitor arrivals (thousands),TF,,1469.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2017,Tourist/visitor arrivals (thousands),TF,,1499.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2005,Tourism expenditure (millions of US dollars),,,363.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2010,Tourism expenditure (millions of US dollars),,,473.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2016,Tourism expenditure (millions of US dollars),,,349.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2017,Tourism expenditure (millions of US dollars),,,449.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +516,Namibia,2018,Tourism expenditure (millions of US dollars),,,488.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +520,Nauru,2010,Tourism expenditure (millions of US dollars),,,0.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +520,Nauru,2016,Tourism expenditure (millions of US dollars),,,3.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +520,Nauru,2017,Tourism expenditure (millions of US dollars),,,3.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +520,Nauru,2018,Tourism expenditure (millions of US dollars),,,1.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,1995,Tourist/visitor arrivals (thousands),TF,,363.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2005,Tourist/visitor arrivals (thousands),TF,,375.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2010,Tourist/visitor arrivals (thousands),TF,,603.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2016,Tourist/visitor arrivals (thousands),TF,,753.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2017,Tourist/visitor arrivals (thousands),TF,,940.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2018,Tourist/visitor arrivals (thousands),TF,,1173.0000,Including arrivals from India.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,1995,Tourism expenditure (millions of US dollars),,,232.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2005,Tourism expenditure (millions of US dollars),,,160.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2010,Tourism expenditure (millions of US dollars),,,378.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2016,Tourism expenditure (millions of US dollars),,,498.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2017,Tourism expenditure (millions of US dollars),,,712.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +524,Nepal,2018,Tourism expenditure (millions of US dollars),,,744.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,1995,Tourist/visitor arrivals (thousands),TCE,,6574.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,2005,Tourist/visitor arrivals (thousands),TCE,,10012.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,2010,Tourist/visitor arrivals (thousands),TCE,,10883.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,2016,Tourist/visitor arrivals (thousands),TCE,,15828.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,2017,Tourist/visitor arrivals (thousands),TCE,,17924.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,2018,Tourist/visitor arrivals (thousands),TCE,,18780.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,1995,Tourism expenditure (millions of US dollars),,,10611.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,2016,Tourism expenditure (millions of US dollars),,,21151.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,2017,Tourism expenditure (millions of US dollars),,,23414.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +528,Netherlands,2018,Tourism expenditure (millions of US dollars),,,25850.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,1995,Tourist/visitor arrivals (thousands),TF,,86.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,2005,Tourist/visitor arrivals (thousands),TF,,101.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,2010,Tourist/visitor arrivals (thousands),TF,,99.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,2016,Tourist/visitor arrivals (thousands),TF,,116.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,2017,Tourist/visitor arrivals (thousands),TF,,121.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,2018,Tourist/visitor arrivals (thousands),TF,,120.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,1995,Tourism expenditure (millions of US dollars),,,108.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,2005,Tourism expenditure (millions of US dollars),,,149.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,2010,Tourism expenditure (millions of US dollars),,,129.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +540,New Caledonia,2016,Tourism expenditure (millions of US dollars),,,159.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2005,Tourist/visitor arrivals (thousands),TF,,2353.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2010,Tourist/visitor arrivals (thousands),TF,,2435.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2016,Tourist/visitor arrivals (thousands),TF,,3370.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2017,Tourist/visitor arrivals (thousands),TF,,3555.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2018,Tourist/visitor arrivals (thousands),TF,,3686.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,1995,Tourism expenditure (millions of US dollars),,,2318.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2005,Tourism expenditure (millions of US dollars),,,6486.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2010,Tourism expenditure (millions of US dollars),,,6523.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2016,Tourism expenditure (millions of US dollars),,,9773.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2017,Tourism expenditure (millions of US dollars),,,10594.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +554,New Zealand,2018,Tourism expenditure (millions of US dollars),,,10961.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,1995,Tourist/visitor arrivals (thousands),TF,,281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2005,Tourist/visitor arrivals (thousands),TF,,712.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2010,Tourist/visitor arrivals (thousands),TF,,1011.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2016,Tourist/visitor arrivals (thousands),TF,,1504.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2017,Tourist/visitor arrivals (thousands),TF,,1787.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2018,Tourist/visitor arrivals (thousands),TF,,1256.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,1995,Tourism expenditure (millions of US dollars),,,50.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2005,Tourism expenditure (millions of US dollars),,,206.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2010,Tourism expenditure (millions of US dollars),,,314.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2016,Tourism expenditure (millions of US dollars),,,642.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2017,Tourism expenditure (millions of US dollars),,,841.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +558,Nicaragua,2018,Tourism expenditure (millions of US dollars),,,544.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,1995,Tourist/visitor arrivals (thousands),TF,,35.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2005,Tourist/visitor arrivals (thousands),TF,,58.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2010,Tourist/visitor arrivals (thousands),TF,,74.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2016,Tourist/visitor arrivals (thousands),TF,,152.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2017,Tourist/visitor arrivals (thousands),TF,,164.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2018,Tourist/visitor arrivals (thousands),TF,,157.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2005,Tourism expenditure (millions of US dollars),,,43.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2010,Tourism expenditure (millions of US dollars),,,105.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2016,Tourism expenditure (millions of US dollars),,,84.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +562,Niger,2017,Tourism expenditure (millions of US dollars),,,91.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,1995,Tourist/visitor arrivals (thousands),TF,,656.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,2005,Tourist/visitor arrivals (thousands),TF,,1010.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,2010,Tourist/visitor arrivals (thousands),TF,,1555.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,2016,Tourist/visitor arrivals (thousands),TF,,1889.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,1995,Tourism expenditure (millions of US dollars),,,47.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,2005,Tourism expenditure (millions of US dollars),,,139.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,2010,Tourism expenditure (millions of US dollars),,,736.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,2016,Tourism expenditure (millions of US dollars),,,1088.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,2017,Tourism expenditure (millions of US dollars),,,2615.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +566,Nigeria,2018,Tourism expenditure (millions of US dollars),,,1977.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +570,Niue,1995,Tourist/visitor arrivals (thousands),TF,,2.2000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +570,Niue,2005,Tourist/visitor arrivals (thousands),TF,,2.8000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +570,Niue,2010,Tourist/visitor arrivals (thousands),TF,,6.2000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +570,Niue,2016,Tourist/visitor arrivals (thousands),TF,,8.9000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +570,Niue,2017,Tourist/visitor arrivals (thousands),TF,,9.8000,Including Niueans residing usually in New Zealand.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +570,Niue,1995,Tourism expenditure (millions of US dollars),,,2.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +570,Niue,2005,Tourism expenditure (millions of US dollars),,,1.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +570,Niue,2010,Tourism expenditure (millions of US dollars),,,2.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,1995,Tourist/visitor arrivals (thousands),TCE,,147.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2005,Tourist/visitor arrivals (thousands),TCE,,197.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2010,Tourist/visitor arrivals (thousands),TCE,,262.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2016,Tourist/visitor arrivals (thousands),TCE,,510.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2017,Tourist/visitor arrivals (thousands),TCE,,631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2018,Tourist/visitor arrivals (thousands),TCE,,707.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2005,Tourism expenditure (millions of US dollars),,,116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2010,Tourism expenditure (millions of US dollars),,,199.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2016,Tourism expenditure (millions of US dollars),,,283.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2017,Tourism expenditure (millions of US dollars),,,331.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +807,North Macedonia,2018,Tourism expenditure (millions of US dollars),,,387.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +580,Northern Mariana Islands,1995,Tourist/visitor arrivals (thousands),TF,,669.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +580,Northern Mariana Islands,2005,Tourist/visitor arrivals (thousands),TF,,498.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +580,Northern Mariana Islands,2010,Tourist/visitor arrivals (thousands),TF,,375.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +580,Northern Mariana Islands,2016,Tourist/visitor arrivals (thousands),TF,,526.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +580,Northern Mariana Islands,2017,Tourist/visitor arrivals (thousands),TF,,656.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +580,Northern Mariana Islands,2018,Tourist/visitor arrivals (thousands),TF,,517.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +580,Northern Mariana Islands,1995,Tourism expenditure (millions of US dollars),,,655.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,1995,Tourist/visitor arrivals (thousands),TF,,2880.0000,Non-resident tourists staying in registered hotels.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2005,Tourist/visitor arrivals (thousands),TF,,3824.0000,Arrivals of non-resident tourists at national borders.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2010,Tourist/visitor arrivals (thousands),TF,,4767.0000,Arrivals of non-resident tourists at national borders.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2016,Tourist/visitor arrivals (thousands),TF,,5960.0000,Non-resident tourists staying in all types of accommodation establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2017,Tourist/visitor arrivals (thousands),TF,,6252.0000,Non-resident tourists staying in all types of accommodation establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2018,Tourist/visitor arrivals (thousands),TF,,5688.0000,Non-resident tourists staying in all types of accommodation establishments.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,1995,Tourism expenditure (millions of US dollars),,,2730.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2005,Tourism expenditure (millions of US dollars),,,4243.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2010,Tourism expenditure (millions of US dollars),,,5299.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2016,Tourism expenditure (millions of US dollars),,,6285.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2017,Tourism expenditure (millions of US dollars),,,6840.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +578,Norway,2018,Tourism expenditure (millions of US dollars),,,7096.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2005,Tourist/visitor arrivals (thousands),TF,,891.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2010,Tourist/visitor arrivals (thousands),TF,,1441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2016,Tourist/visitor arrivals (thousands),TF,,2335.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2017,Tourist/visitor arrivals (thousands),TF,,2316.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2018,Tourist/visitor arrivals (thousands),TF,,2301.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2005,Tourism expenditure (millions of US dollars),,,627.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2010,Tourism expenditure (millions of US dollars),,,1072.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2016,Tourism expenditure (millions of US dollars),,,2390.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2017,Tourism expenditure (millions of US dollars),,,2717.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +512,Oman,2018,Tourism expenditure (millions of US dollars),,,2975.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,1995,Tourist/visitor arrivals (thousands),VF,,2332.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2005,Tourist/visitor arrivals (thousands),VF,,3378.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2010,Tourist/visitor arrivals (thousands),VF,,5567.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2016,Tourist/visitor arrivals (thousands),VF,,10690.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2017,Tourist/visitor arrivals (thousands),VF,,10740.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2018,Tourist/visitor arrivals (thousands),VF,,11067.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,1995,Tourism expenditure (millions of US dollars),,,3985.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2005,Tourism expenditure (millions of US dollars),,,5740.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2010,Tourism expenditure (millions of US dollars),,,10387.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2016,Tourism expenditure (millions of US dollars),,,15825.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2017,Tourism expenditure (millions of US dollars),,,14847.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +158,Other non-specified areas,2018,Tourism expenditure (millions of US dollars),,,16366.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,1995,Tourist/visitor arrivals (thousands),TF,,378.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,2005,Tourist/visitor arrivals (thousands),TF,,798.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,2010,Tourist/visitor arrivals (thousands),TF,,907.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,1995,Tourism expenditure (millions of US dollars),,,582.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,2005,Tourism expenditure (millions of US dollars),,,828.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,2010,Tourism expenditure (millions of US dollars),,,998.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,2016,Tourism expenditure (millions of US dollars),,,791.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,2017,Tourism expenditure (millions of US dollars),,,866.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +586,Pakistan,2018,Tourism expenditure (millions of US dollars),,,818.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,1995,Tourist/visitor arrivals (thousands),TF,,53.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2005,Tourist/visitor arrivals (thousands),TF,,81.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2010,Tourist/visitor arrivals (thousands),TF,,85.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2016,Tourist/visitor arrivals (thousands),TF,,138.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2017,Tourist/visitor arrivals (thousands),TF,,123.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2018,Tourist/visitor arrivals (thousands),TF,,106.0000,Air arrivals (Palau International Airport).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2005,Tourism expenditure (millions of US dollars),,,63.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2010,Tourism expenditure (millions of US dollars),,,76.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2016,Tourism expenditure (millions of US dollars),,,148.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +585,Palau,2017,Tourism expenditure (millions of US dollars),,,123.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,1995,Tourist/visitor arrivals (thousands),TF,,345.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2005,Tourist/visitor arrivals (thousands),TF,,702.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2010,Tourist/visitor arrivals (thousands),TF,,1324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2016,Tourist/visitor arrivals (thousands),TF,,1921.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2017,Tourist/visitor arrivals (thousands),TF,,1843.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2018,Tourist/visitor arrivals (thousands),TF,,1785.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,1995,Tourism expenditure (millions of US dollars),,,372.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2005,Tourism expenditure (millions of US dollars),,,1108.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2010,Tourism expenditure (millions of US dollars),,,2621.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2016,Tourism expenditure (millions of US dollars),,,6280.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2017,Tourism expenditure (millions of US dollars),,,6824.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +591,Panama,2018,Tourism expenditure (millions of US dollars),,,5615.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,1995,Tourist/visitor arrivals (thousands),TF,,42.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2005,Tourist/visitor arrivals (thousands),TF,,69.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2010,Tourist/visitor arrivals (thousands),TF,,140.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2016,Tourist/visitor arrivals (thousands),TF,,179.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2017,Tourist/visitor arrivals (thousands),TF,,139.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2018,Tourist/visitor arrivals (thousands),TF,,140.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2005,Tourism expenditure (millions of US dollars),,,9.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2010,Tourism expenditure (millions of US dollars),,,2.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2016,Tourism expenditure (millions of US dollars),,,1.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +598,Papua New Guinea,2017,Tourism expenditure (millions of US dollars),,,15.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,1995,Tourist/visitor arrivals (thousands),TF,,438.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2005,Tourist/visitor arrivals (thousands),TF,,341.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2010,Tourist/visitor arrivals (thousands),TF,,465.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2016,Tourist/visitor arrivals (thousands),TF,,1308.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2017,Tourist/visitor arrivals (thousands),TF,,1584.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2018,Tourist/visitor arrivals (thousands),TF,,1181.0000,Excluding nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,1995,Tourism expenditure (millions of US dollars),,,162.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2005,Tourism expenditure (millions of US dollars),,,96.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2010,Tourism expenditure (millions of US dollars),,,243.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2016,Tourism expenditure (millions of US dollars),,,356.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2017,Tourism expenditure (millions of US dollars),,,399.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +600,Paraguay,2018,Tourism expenditure (millions of US dollars),,,393.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,1995,Tourist/visitor arrivals (thousands),TF,,479.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2005,Tourist/visitor arrivals (thousands),TF,,1571.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2010,Tourist/visitor arrivals (thousands),TF,,2299.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2016,Tourist/visitor arrivals (thousands),TF,,3744.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2017,Tourist/visitor arrivals (thousands),TF,,4032.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2018,Tourist/visitor arrivals (thousands),TF,,4419.0000,Including nationals residing abroad.;Including tourists with identity document other than a passport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,1995,Tourism expenditure (millions of US dollars),,,521.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2005,Tourism expenditure (millions of US dollars),,,1438.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2010,Tourism expenditure (millions of US dollars),,,2475.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2016,Tourism expenditure (millions of US dollars),,,4288.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2017,Tourism expenditure (millions of US dollars),,,4573.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +604,Peru,2018,Tourism expenditure (millions of US dollars),,,4894.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,1995,Tourist/visitor arrivals (thousands),TF,,1760.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2005,Tourist/visitor arrivals (thousands),TF,,2623.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2010,Tourist/visitor arrivals (thousands),TF,,3520.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2016,Tourist/visitor arrivals (thousands),TF,,5967.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2017,Tourist/visitor arrivals (thousands),TF,,6621.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2018,Tourist/visitor arrivals (thousands),TF,,7168.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,1995,Tourism expenditure (millions of US dollars),,,1141.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2005,Tourism expenditure (millions of US dollars),,,2863.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2010,Tourism expenditure (millions of US dollars),,,3441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2016,Tourism expenditure (millions of US dollars),,,6289.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2017,Tourism expenditure (millions of US dollars),,,8349.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +608,Philippines,2018,Tourism expenditure (millions of US dollars),,,9730.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,1995,Tourist/visitor arrivals (thousands),TF,,19215.0000,"Border statistics are not collected any more, surveys used instead.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2005,Tourist/visitor arrivals (thousands),TF,,15200.0000,"Border statistics are not collected any more, surveys used instead.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2010,Tourist/visitor arrivals (thousands),TF,,12470.0000,"Border statistics are not collected any more, surveys used instead.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2016,Tourist/visitor arrivals (thousands),TF,,17471.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2017,Tourist/visitor arrivals (thousands),TF,,18258.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2018,Tourist/visitor arrivals (thousands),TF,,19622.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,1995,Tourism expenditure (millions of US dollars),,,6927.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2005,Tourism expenditure (millions of US dollars),,,7161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2010,Tourism expenditure (millions of US dollars),,,10036.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2016,Tourism expenditure (millions of US dollars),,,12052.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2017,Tourism expenditure (millions of US dollars),,,14083.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +616,Poland,2018,Tourism expenditure (millions of US dollars),,,15748.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,1995,Tourist/visitor arrivals (thousands),TCE,,4572.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2005,Tourist/visitor arrivals (thousands),TCE,,5769.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2010,Tourist/visitor arrivals (thousands),TCE,,6756.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2016,Tourist/visitor arrivals (thousands),TCE,,13359.0000,"Include hotels, apartment hotels, “pousadas”, tourist apartments, tourist villages, camping sites, recreation centres, tourism in rural areas and local accommodation.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2017,Tourist/visitor arrivals (thousands),TCE,,15432.0000,"Include hotels, apartment hotels, “pousadas”, tourist apartments, tourist villages, camping sites, recreation centres, tourism in rural areas and local accommodation.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2018,Tourist/visitor arrivals (thousands),TCE,,16186.0000,"Include hotels, apartment hotels, “pousadas”, tourist apartments, tourist villages, camping sites, recreation centres, tourism in rural areas and local accommodation.","World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,1995,Tourism expenditure (millions of US dollars),,,5646.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2005,Tourism expenditure (millions of US dollars),,,9038.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2010,Tourism expenditure (millions of US dollars),,,12984.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2016,Tourism expenditure (millions of US dollars),,,17347.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2017,Tourism expenditure (millions of US dollars),,,21586.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +620,Portugal,2018,Tourism expenditure (millions of US dollars),,,24105.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,1995,Tourist/visitor arrivals (thousands),TF,,3131.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2005,Tourist/visitor arrivals (thousands),TF,,3686.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2010,Tourist/visitor arrivals (thousands),TF,,3186.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2016,Tourist/visitor arrivals (thousands),TF,,3736.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2017,Tourist/visitor arrivals (thousands),TF,,3513.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2018,Tourist/visitor arrivals (thousands),TF,,3068.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,1995,Tourism expenditure (millions of US dollars),,,1828.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2005,Tourism expenditure (millions of US dollars),,,3239.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2010,Tourism expenditure (millions of US dollars),,,3211.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2016,Tourism expenditure (millions of US dollars),,,3974.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2017,Tourism expenditure (millions of US dollars),,,3848.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +630,Puerto Rico,2018,Tourism expenditure (millions of US dollars),,,3282.0000,Data refer to fiscal years beginning 1 July.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +634,Qatar,2010,Tourist/visitor arrivals (thousands),TF,,1699.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +634,Qatar,2016,Tourist/visitor arrivals (thousands),TF,,2938.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +634,Qatar,2017,Tourist/visitor arrivals (thousands),TF,,2256.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +634,Qatar,2018,Tourist/visitor arrivals (thousands),TF,,1819.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +634,Qatar,2016,Tourism expenditure (millions of US dollars),,,12593.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +634,Qatar,2017,Tourism expenditure (millions of US dollars),,,15757.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +634,Qatar,2018,Tourism expenditure (millions of US dollars),,,15239.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,1995,Tourist/visitor arrivals (thousands),VF,,3753.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2005,Tourist/visitor arrivals (thousands),VF,,6023.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2010,Tourist/visitor arrivals (thousands),VF,,8798.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2016,Tourist/visitor arrivals (thousands),VF,,17242.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2017,Tourist/visitor arrivals (thousands),VF,,13336.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2018,Tourist/visitor arrivals (thousands),VF,,15347.0000,Including nationals residing abroad and crew members.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,1995,Tourism expenditure (millions of US dollars),,,6670.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2005,Tourism expenditure (millions of US dollars),,,8282.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2010,Tourism expenditure (millions of US dollars),,,14315.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2016,Tourism expenditure (millions of US dollars),,,20924.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2017,Tourism expenditure (millions of US dollars),,,17173.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +410,Republic of Korea,2018,Tourism expenditure (millions of US dollars),,,19856.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2005,Tourist/visitor arrivals (thousands),TCE,,67.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2010,Tourist/visitor arrivals (thousands),TCE,,64.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2016,Tourist/visitor arrivals (thousands),TCE,,121.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2017,Tourist/visitor arrivals (thousands),TCE,,145.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2018,Tourist/visitor arrivals (thousands),TCE,,160.0000,Excluding the left side of the river Nistru and the municipality of Bender.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,1995,Tourism expenditure (millions of US dollars),,,71.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2005,Tourism expenditure (millions of US dollars),,,138.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2010,Tourism expenditure (millions of US dollars),,,222.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2016,Tourism expenditure (millions of US dollars),,,344.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2017,Tourism expenditure (millions of US dollars),,,443.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +498,Republic of Moldova,2018,Tourism expenditure (millions of US dollars),,,500.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,1995,Tourist/visitor arrivals (thousands),TF,,304.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2005,Tourist/visitor arrivals (thousands),TF,,409.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2010,Tourist/visitor arrivals (thousands),TF,,420.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2016,Tourist/visitor arrivals (thousands),TF,,458.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2017,Tourist/visitor arrivals (thousands),TF,,508.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2018,Tourist/visitor arrivals (thousands),TF,,535.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,1995,Tourism expenditure (millions of US dollars),,,216.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2005,Tourism expenditure (millions of US dollars),,,364.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2010,Tourism expenditure (millions of US dollars),,,392.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2016,Tourism expenditure (millions of US dollars),,,343.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2017,Tourism expenditure (millions of US dollars),,,427.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +638,Réunion,2018,Tourism expenditure (millions of US dollars),,,495.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,1995,Tourist/visitor arrivals (thousands),VF,,5445.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2005,Tourist/visitor arrivals (thousands),VF,,5839.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2010,Tourist/visitor arrivals (thousands),VF,,7498.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2016,Tourist/visitor arrivals (thousands),VF,,10223.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2017,Tourist/visitor arrivals (thousands),VF,,10926.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2018,Tourist/visitor arrivals (thousands),VF,,11720.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,1995,Tourism expenditure (millions of US dollars),,,689.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2005,Tourism expenditure (millions of US dollars),,,1324.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2010,Tourism expenditure (millions of US dollars),,,1631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2016,Tourism expenditure (millions of US dollars),,,2172.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2017,Tourism expenditure (millions of US dollars),,,3008.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +642,Romania,2018,Tourism expenditure (millions of US dollars),,,3261.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,1995,Tourist/visitor arrivals (thousands),VF,,10290.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2005,Tourist/visitor arrivals (thousands),VF,,22201.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2010,Tourist/visitor arrivals (thousands),VF,,22281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2016,Tourist/visitor arrivals (thousands),VF,,24571.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2017,Tourist/visitor arrivals (thousands),VF,,24390.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2018,Tourist/visitor arrivals (thousands),VF,,24551.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2005,Tourism expenditure (millions of US dollars),,,7805.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2010,Tourism expenditure (millions of US dollars),,,13239.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2016,Tourism expenditure (millions of US dollars),,,12822.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2017,Tourism expenditure (millions of US dollars),,,14983.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +643,Russian Federation,2018,Tourism expenditure (millions of US dollars),,,18670.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +646,Rwanda,2010,Tourist/visitor arrivals (thousands),TF,,504.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +646,Rwanda,2016,Tourist/visitor arrivals (thousands),TF,,932.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +646,Rwanda,1995,Tourism expenditure (millions of US dollars),,,4.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +646,Rwanda,2005,Tourism expenditure (millions of US dollars),,,67.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +646,Rwanda,2010,Tourism expenditure (millions of US dollars),,,224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +646,Rwanda,2016,Tourism expenditure (millions of US dollars),,,443.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +646,Rwanda,2017,Tourism expenditure (millions of US dollars),,,548.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +646,Rwanda,2018,Tourism expenditure (millions of US dollars),,,528.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +667,Saba,1995,Tourist/visitor arrivals (thousands),TF,,10.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +667,Saba,2005,Tourist/visitor arrivals (thousands),TF,,11.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +667,Saba,2010,Tourist/visitor arrivals (thousands),TF,,12.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,1995,Tourist/visitor arrivals (thousands),TF,,79.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2005,Tourist/visitor arrivals (thousands),TF,,141.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2010,Tourist/visitor arrivals (thousands),TF,,98.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2016,Tourist/visitor arrivals (thousands),TF,,116.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2017,Tourist/visitor arrivals (thousands),TF,,115.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2018,Tourist/visitor arrivals (thousands),TF,,125.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,1995,Tourism expenditure (millions of US dollars),,,63.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2005,Tourism expenditure (millions of US dollars),,,121.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2010,Tourism expenditure (millions of US dollars),,,90.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2016,Tourism expenditure (millions of US dollars),,,332.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2017,Tourism expenditure (millions of US dollars),,,355.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +659,Saint Kitts and Nevis,2018,Tourism expenditure (millions of US dollars),,,367.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,1995,Tourist/visitor arrivals (thousands),TF,,231.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2005,Tourist/visitor arrivals (thousands),TF,,318.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2010,Tourist/visitor arrivals (thousands),TF,,306.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2016,Tourist/visitor arrivals (thousands),TF,,348.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2017,Tourist/visitor arrivals (thousands),TF,,386.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2018,Tourist/visitor arrivals (thousands),TF,,395.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,1995,Tourism expenditure (millions of US dollars),,,230.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2005,Tourism expenditure (millions of US dollars),,,382.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2010,Tourism expenditure (millions of US dollars),,,309.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2016,Tourism expenditure (millions of US dollars),,,776.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2017,Tourism expenditure (millions of US dollars),,,875.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +662,Saint Lucia,2018,Tourism expenditure (millions of US dollars),,,989.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,1995,Tourist/visitor arrivals (thousands),TF,,60.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2005,Tourist/visitor arrivals (thousands),TF,,96.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2010,Tourist/visitor arrivals (thousands),TF,,72.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2016,Tourist/visitor arrivals (thousands),TF,,79.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2017,Tourist/visitor arrivals (thousands),TF,,76.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2018,Tourist/visitor arrivals (thousands),TF,,80.0000,Arrivals of non-resident tourists by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,1995,Tourism expenditure (millions of US dollars),,,53.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2005,Tourism expenditure (millions of US dollars),,,104.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2010,Tourism expenditure (millions of US dollars),,,86.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2016,Tourism expenditure (millions of US dollars),,,216.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2017,Tourism expenditure (millions of US dollars),,,211.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +670,Saint Vincent & Grenadines,2018,Tourism expenditure (millions of US dollars),,,235.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,1995,Tourist/visitor arrivals (thousands),TF,,68.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2005,Tourist/visitor arrivals (thousands),TF,,102.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2010,Tourist/visitor arrivals (thousands),TF,,122.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2016,Tourist/visitor arrivals (thousands),TF,,134.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2017,Tourist/visitor arrivals (thousands),TF,,146.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2018,Tourist/visitor arrivals (thousands),TF,,164.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,1995,Tourism expenditure (millions of US dollars),,,35.6994,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2005,Tourism expenditure (millions of US dollars),,,73.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2010,Tourism expenditure (millions of US dollars),,,123.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2016,Tourism expenditure (millions of US dollars),,,148.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2017,Tourism expenditure (millions of US dollars),,,167.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +882,Samoa,2018,Tourism expenditure (millions of US dollars),,,191.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +674,San Marino,1995,Tourist/visitor arrivals (thousands),THS,,28.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +674,San Marino,2005,Tourist/visitor arrivals (thousands),THS,,50.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +674,San Marino,2010,Tourist/visitor arrivals (thousands),THS,,120.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +674,San Marino,2016,Tourist/visitor arrivals (thousands),THS,,60.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +674,San Marino,2017,Tourist/visitor arrivals (thousands),THS,,78.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +674,San Marino,2018,Tourist/visitor arrivals (thousands),THS,,84.0000,Including Italian tourists.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,1995,Tourist/visitor arrivals (thousands),TF,,6.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,2005,Tourist/visitor arrivals (thousands),TF,,15.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,2010,Tourist/visitor arrivals (thousands),TF,,8.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,2016,Tourist/visitor arrivals (thousands),TF,,28.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,2017,Tourist/visitor arrivals (thousands),TF,,28.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,2018,Tourist/visitor arrivals (thousands),TF,,33.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,2016,Tourism expenditure (millions of US dollars),,,69.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,2017,Tourism expenditure (millions of US dollars),,,65.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +678,Sao Tome and Principe,2018,Tourism expenditure (millions of US dollars),,,71.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,1995,Tourist/visitor arrivals (thousands),TF,,3325.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2005,Tourist/visitor arrivals (thousands),TF,,8037.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2010,Tourist/visitor arrivals (thousands),TF,,10850.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2016,Tourist/visitor arrivals (thousands),TF,,18044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2017,Tourist/visitor arrivals (thousands),TF,,16109.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2018,Tourist/visitor arrivals (thousands),TF,,15334.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2010,Tourism expenditure (millions of US dollars),,,7536.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2016,Tourism expenditure (millions of US dollars),,,13438.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2017,Tourism expenditure (millions of US dollars),,,15020.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +682,Saudi Arabia,2018,Tourism expenditure (millions of US dollars),,,16975.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,2005,Tourist/visitor arrivals (thousands),TF,,769.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,2010,Tourist/visitor arrivals (thousands),TF,,900.0000,Estimate.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,2016,Tourist/visitor arrivals (thousands),TF,,1210.0000,Estimate.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,2017,Tourist/visitor arrivals (thousands),TF,,1365.0000,Estimate.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,1995,Tourism expenditure (millions of US dollars),,,168.1803,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,2005,Tourism expenditure (millions of US dollars),,,334.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,2010,Tourism expenditure (millions of US dollars),,,464.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,2016,Tourism expenditure (millions of US dollars),,,438.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +686,Senegal,2017,Tourism expenditure (millions of US dollars),,,468.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2005,Tourist/visitor arrivals (thousands),TCE,,453.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2010,Tourist/visitor arrivals (thousands),TCE,,683.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2016,Tourist/visitor arrivals (thousands),TCE,,1281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2017,Tourist/visitor arrivals (thousands),TCE,,1497.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2018,Tourist/visitor arrivals (thousands),TCE,,1711.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2005,Tourism expenditure (millions of US dollars),,,308.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2010,Tourism expenditure (millions of US dollars),,,950.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2016,Tourism expenditure (millions of US dollars),,,1461.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2017,Tourism expenditure (millions of US dollars),,,1706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +688,Serbia,2018,Tourism expenditure (millions of US dollars),,,1921.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,1995,Tourist/visitor arrivals (thousands),TF,,121.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2005,Tourist/visitor arrivals (thousands),TF,,129.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2010,Tourist/visitor arrivals (thousands),TF,,175.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2016,Tourist/visitor arrivals (thousands),TF,,303.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2017,Tourist/visitor arrivals (thousands),TF,,350.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2018,Tourist/visitor arrivals (thousands),TF,,362.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,1995,Tourism expenditure (millions of US dollars),,,224.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2005,Tourism expenditure (millions of US dollars),,,269.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2010,Tourism expenditure (millions of US dollars),,,352.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2016,Tourism expenditure (millions of US dollars),,,505.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2017,Tourism expenditure (millions of US dollars),,,585.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +690,Seychelles,2018,Tourism expenditure (millions of US dollars),,,611.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,1995,Tourist/visitor arrivals (thousands),TF,,13.8000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2005,Tourist/visitor arrivals (thousands),TF,,40.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2010,Tourist/visitor arrivals (thousands),TF,,39.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2016,Tourist/visitor arrivals (thousands),TF,,55.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2017,Tourist/visitor arrivals (thousands),TF,,51.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2018,Tourist/visitor arrivals (thousands),TF,,57.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,1995,Tourism expenditure (millions of US dollars),,,57.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2005,Tourism expenditure (millions of US dollars),,,64.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2010,Tourism expenditure (millions of US dollars),,,26.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2016,Tourism expenditure (millions of US dollars),,,41.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2017,Tourism expenditure (millions of US dollars),,,39.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +694,Sierra Leone,2018,Tourism expenditure (millions of US dollars),,,39.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,1995,Tourist/visitor arrivals (thousands),TF,,6070.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2005,Tourist/visitor arrivals (thousands),TF,,7079.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2010,Tourist/visitor arrivals (thousands),TF,,9161.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2016,Tourist/visitor arrivals (thousands),TF,,12913.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2017,Tourist/visitor arrivals (thousands),TF,,13903.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2018,Tourist/visitor arrivals (thousands),TF,,14673.0000,Excluding Malaysian citizens arriving by land.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,1995,Tourism expenditure (millions of US dollars),,,7611.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2005,Tourism expenditure (millions of US dollars),,,6209.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2010,Tourism expenditure (millions of US dollars),,,14178.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2016,Tourism expenditure (millions of US dollars),,,18944.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2017,Tourism expenditure (millions of US dollars),,,19891.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +702,Singapore,2018,Tourism expenditure (millions of US dollars),,,20416.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +668,Sint Eustatius,1995,Tourist/visitor arrivals (thousands),TF,,8.8000,Excluding Netherlands Antillean residents.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +668,Sint Eustatius,2005,Tourist/visitor arrivals (thousands),TF,,10.4000,Excluding Netherlands Antillean residents.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +668,Sint Eustatius,2010,Tourist/visitor arrivals (thousands),TF,,11.4000,Excluding Netherlands Antillean residents.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),1995,Tourist/visitor arrivals (thousands),TF,,460.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2005,Tourist/visitor arrivals (thousands),TF,,468.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2010,Tourist/visitor arrivals (thousands),TF,,443.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2016,Tourist/visitor arrivals (thousands),TF,,528.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2017,Tourist/visitor arrivals (thousands),TF,,402.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2018,Tourist/visitor arrivals (thousands),TF,,178.0000,Arrivals by air. Including arrivals to Saint Martin (French part).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2010,Tourism expenditure (millions of US dollars),,,681.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2016,Tourism expenditure (millions of US dollars),,,871.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2017,Tourism expenditure (millions of US dollars),,,646.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +534,Sint Maarten (Dutch part),2018,Tourism expenditure (millions of US dollars),,,468.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,1995,Tourist/visitor arrivals (thousands),TCE,,903.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2005,Tourist/visitor arrivals (thousands),TCE,,1515.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2010,Tourist/visitor arrivals (thousands),TCE,,1327.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2016,Tourist/visitor arrivals (thousands),TCE,,2027.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2017,Tourist/visitor arrivals (thousands),TCE,,2162.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2018,Tourist/visitor arrivals (thousands),TCE,,2256.0000,Non-resident tourists staying in commercial accommodation only (representing approximately 25% of all tourists).,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,1995,Tourism expenditure (millions of US dollars),,,630.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2005,Tourism expenditure (millions of US dollars),,,1282.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2010,Tourism expenditure (millions of US dollars),,,2334.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2016,Tourism expenditure (millions of US dollars),,,2812.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2017,Tourism expenditure (millions of US dollars),,,3024.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +703,Slovakia,2018,Tourism expenditure (millions of US dollars),,,3318.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,1995,Tourist/visitor arrivals (thousands),TCE,,732.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2005,Tourist/visitor arrivals (thousands),TCE,,1555.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2010,Tourist/visitor arrivals (thousands),TCE,,2049.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2016,Tourist/visitor arrivals (thousands),TCE,,3397.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2017,Tourist/visitor arrivals (thousands),TCE,,3991.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2018,Tourist/visitor arrivals (thousands),TCE,,4425.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,1995,Tourism expenditure (millions of US dollars),,,1128.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2005,Tourism expenditure (millions of US dollars),,,1894.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2010,Tourism expenditure (millions of US dollars),,,2808.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2016,Tourism expenditure (millions of US dollars),,,2717.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2017,Tourism expenditure (millions of US dollars),,,3057.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +705,Slovenia,2018,Tourism expenditure (millions of US dollars),,,3378.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,1995,Tourist/visitor arrivals (thousands),TF,,11.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2005,Tourist/visitor arrivals (thousands),TF,,9.4000,Without first quarter.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2010,Tourist/visitor arrivals (thousands),TF,,20.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2016,Tourist/visitor arrivals (thousands),TF,,23.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2017,Tourist/visitor arrivals (thousands),TF,,25.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2018,Tourist/visitor arrivals (thousands),TF,,27.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,1995,Tourism expenditure (millions of US dollars),,,17.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2005,Tourism expenditure (millions of US dollars),,,6.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2010,Tourism expenditure (millions of US dollars),,,50.8000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2016,Tourism expenditure (millions of US dollars),,,71.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2017,Tourism expenditure (millions of US dollars),,,79.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +90,Solomon Islands,2018,Tourism expenditure (millions of US dollars),,,92.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,1995,Tourist/visitor arrivals (thousands),TF,,4488.0000,Excluding arrivals for work and contract workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2005,Tourist/visitor arrivals (thousands),TF,,7369.0000,Excluding arrivals for work and contract workers.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2010,Tourist/visitor arrivals (thousands),TF,,8074.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2016,Tourist/visitor arrivals (thousands),TF,,10044.0000,Break in the time series.;Excluding transit.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2017,Tourist/visitor arrivals (thousands),TF,,10285.0000,Excluding transit.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2018,Tourist/visitor arrivals (thousands),TF,,10472.0000,Excluding transit.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,1995,Tourism expenditure (millions of US dollars),,,2654.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2005,Tourism expenditure (millions of US dollars),,,8629.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2010,Tourism expenditure (millions of US dollars),,,10309.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2016,Tourism expenditure (millions of US dollars),,,8807.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2017,Tourism expenditure (millions of US dollars),,,9706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +710,South Africa,2018,Tourism expenditure (millions of US dollars),,,9789.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +728,South Sudan,2016,Tourism expenditure (millions of US dollars),,,23.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +728,South Sudan,2017,Tourism expenditure (millions of US dollars),,,26.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +728,South Sudan,2018,Tourism expenditure (millions of US dollars),,,12.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,1995,Tourist/visitor arrivals (thousands),TF,,32971.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2005,Tourist/visitor arrivals (thousands),TF,,55914.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2010,Tourist/visitor arrivals (thousands),TF,,52677.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2016,Tourist/visitor arrivals (thousands),TF,,75315.0000,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2017,Tourist/visitor arrivals (thousands),TF,,81869.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2018,Tourist/visitor arrivals (thousands),TF,,82773.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,1995,Tourism expenditure (millions of US dollars),,,25368.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2005,Tourism expenditure (millions of US dollars),,,51959.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2010,Tourism expenditure (millions of US dollars),,,58348.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2016,Tourism expenditure (millions of US dollars),,,66982.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2017,Tourism expenditure (millions of US dollars),,,75906.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +724,Spain,2018,Tourism expenditure (millions of US dollars),,,81250.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,1995,Tourist/visitor arrivals (thousands),TF,,403.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2005,Tourist/visitor arrivals (thousands),TF,,549.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2010,Tourist/visitor arrivals (thousands),TF,,654.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2016,Tourist/visitor arrivals (thousands),TF,,2051.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2017,Tourist/visitor arrivals (thousands),TF,,2116.4000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2018,Tourist/visitor arrivals (thousands),TF,,2334.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,1995,Tourism expenditure (millions of US dollars),,,367.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2005,Tourism expenditure (millions of US dollars),,,729.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2010,Tourism expenditure (millions of US dollars),,,1044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2016,Tourism expenditure (millions of US dollars),,,4591.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2017,Tourism expenditure (millions of US dollars),,,5083.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +144,Sri Lanka,2018,Tourism expenditure (millions of US dollars),,,5608.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2005,Tourist/visitor arrivals (thousands),THS,,88.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2010,Tourist/visitor arrivals (thousands),THS,,522.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2016,Tourist/visitor arrivals (thousands),THS,,400.0000,West Bank only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2017,Tourist/visitor arrivals (thousands),THS,,503.0000,West Bank only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2018,Tourist/visitor arrivals (thousands),THS,,606.0000,West Bank only.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,1995,Tourism expenditure (millions of US dollars),,,255.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2005,Tourism expenditure (millions of US dollars),,,52.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2010,Tourism expenditure (millions of US dollars),,,409.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2016,Tourism expenditure (millions of US dollars),,,235.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2017,Tourism expenditure (millions of US dollars),,,225.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +275,State of Palestine,2018,Tourism expenditure (millions of US dollars),,,245.0000,Excluding passenger transport.;West Bank and Gaza.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,1995,Tourist/visitor arrivals (thousands),TF,,29.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2005,Tourist/visitor arrivals (thousands),TF,,246.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2010,Tourist/visitor arrivals (thousands),TF,,495.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2016,Tourist/visitor arrivals (thousands),TF,,800.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2017,Tourist/visitor arrivals (thousands),TF,,813.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2018,Tourist/visitor arrivals (thousands),TF,,836.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,1995,Tourism expenditure (millions of US dollars),,,8.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2005,Tourism expenditure (millions of US dollars),,,114.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2010,Tourism expenditure (millions of US dollars),,,82.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2016,Tourism expenditure (millions of US dollars),,,1009.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2017,Tourism expenditure (millions of US dollars),,,1029.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +729,Sudan,2018,Tourism expenditure (millions of US dollars),,,1043.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,1995,Tourist/visitor arrivals (thousands),TF,,43.0000,Arrivals at Zanderij Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2005,Tourist/visitor arrivals (thousands),TF,,161.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2010,Tourist/visitor arrivals (thousands),TF,,205.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2016,Tourist/visitor arrivals (thousands),TF,,256.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2017,Tourist/visitor arrivals (thousands),TF,,278.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,1995,Tourism expenditure (millions of US dollars),,,52.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2005,Tourism expenditure (millions of US dollars),,,96.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2010,Tourism expenditure (millions of US dollars),,,69.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2016,Tourism expenditure (millions of US dollars),,,74.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2017,Tourism expenditure (millions of US dollars),,,61.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +740,Suriname,2018,Tourism expenditure (millions of US dollars),,,73.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,1995,Tourist/visitor arrivals (thousands),TCE,,2310.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2005,Tourist/visitor arrivals (thousands),TCE,,4883.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2010,Tourist/visitor arrivals (thousands),TCE,,5183.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2016,Tourist/visitor arrivals (thousands),TCE,,6782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2017,Tourist/visitor arrivals (thousands),TCE,,7054.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2018,Tourist/visitor arrivals (thousands),TCE,,7440.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,1995,Tourism expenditure (millions of US dollars),,,3471.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2005,Tourism expenditure (millions of US dollars),,,6554.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2010,Tourism expenditure (millions of US dollars),,,8336.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2016,Tourism expenditure (millions of US dollars),,,12764.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2017,Tourism expenditure (millions of US dollars),,,14168.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +752,Sweden,2018,Tourism expenditure (millions of US dollars),,,14926.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,1995,Tourist/visitor arrivals (thousands),THS,,6946.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2005,Tourist/visitor arrivals (thousands),THS,,7229.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2010,Tourist/visitor arrivals (thousands),THS,,8628.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2016,Tourist/visitor arrivals (thousands),THS,,9205.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2017,Tourist/visitor arrivals (thousands),THS,,9889.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2018,Tourist/visitor arrivals (thousands),THS,,10362.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,1995,Tourism expenditure (millions of US dollars),,,11354.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2005,Tourism expenditure (millions of US dollars),,,11952.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2010,Tourism expenditure (millions of US dollars),,,17614.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2016,Tourism expenditure (millions of US dollars),,,19042.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2017,Tourism expenditure (millions of US dollars),,,19654.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +756,Switzerland,2018,Tourism expenditure (millions of US dollars),,,20276.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +760,Syrian Arab Republic,1995,Tourist/visitor arrivals (thousands),TCE,,815.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +760,Syrian Arab Republic,2005,Tourist/visitor arrivals (thousands),TCE,,3571.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +760,Syrian Arab Republic,2010,Tourist/visitor arrivals (thousands),TCE,,8546.0000,Including nationals residing abroad.;Including Iraqi nationals.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +760,Syrian Arab Republic,2005,Tourism expenditure (millions of US dollars),,,2035.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +760,Syrian Arab Republic,2010,Tourism expenditure (millions of US dollars),,,6308.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2010,Tourist/visitor arrivals (thousands),VF,,160.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2016,Tourist/visitor arrivals (thousands),VF,,344.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2017,Tourist/visitor arrivals (thousands),VF,,431.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2018,Tourist/visitor arrivals (thousands),VF,,1035.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2005,Tourism expenditure (millions of US dollars),,,9.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2010,Tourism expenditure (millions of US dollars),,,141.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2016,Tourism expenditure (millions of US dollars),,,149.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2017,Tourism expenditure (millions of US dollars),,,171.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +762,Tajikistan,2018,Tourism expenditure (millions of US dollars),,,170.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,1995,Tourist/visitor arrivals (thousands),TF,,6952.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2005,Tourist/visitor arrivals (thousands),TF,,11567.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2010,Tourist/visitor arrivals (thousands),TF,,15936.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2016,Tourist/visitor arrivals (thousands),TF,,32530.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2017,Tourist/visitor arrivals (thousands),TF,,35592.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2018,Tourist/visitor arrivals (thousands),TF,,38178.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,1995,Tourism expenditure (millions of US dollars),,,9257.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2005,Tourism expenditure (millions of US dollars),,,12103.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2010,Tourism expenditure (millions of US dollars),,,23796.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2016,Tourism expenditure (millions of US dollars),,,48459.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2017,Tourism expenditure (millions of US dollars),,,57057.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +764,Thailand,2018,Tourism expenditure (millions of US dollars),,,65242.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +626,Timor-Leste,2010,Tourist/visitor arrivals (thousands),TF,,40.0000,Arrivals by air at Dili Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +626,Timor-Leste,2016,Tourist/visitor arrivals (thousands),TF,,66.0000,Arrivals by air at Dili Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +626,Timor-Leste,2017,Tourist/visitor arrivals (thousands),TF,,74.0000,Arrivals by air at Dili Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +626,Timor-Leste,2018,Tourist/visitor arrivals (thousands),TF,,75.0000,Arrivals by air at Dili Airport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +626,Timor-Leste,2010,Tourism expenditure (millions of US dollars),,,24.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +626,Timor-Leste,2016,Tourism expenditure (millions of US dollars),,,58.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +626,Timor-Leste,2017,Tourism expenditure (millions of US dollars),,,73.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +626,Timor-Leste,2018,Tourism expenditure (millions of US dollars),,,78.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,1995,Tourist/visitor arrivals (thousands),THS,,53.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2005,Tourist/visitor arrivals (thousands),THS,,81.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2010,Tourist/visitor arrivals (thousands),THS,,202.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2016,Tourist/visitor arrivals (thousands),THS,,338.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2017,Tourist/visitor arrivals (thousands),THS,,514.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2018,Tourist/visitor arrivals (thousands),THS,,573.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2005,Tourism expenditure (millions of US dollars),,,27.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2010,Tourism expenditure (millions of US dollars),,,105.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2016,Tourism expenditure (millions of US dollars),,,223.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +768,Togo,2017,Tourism expenditure (millions of US dollars),,,245.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,1995,Tourist/visitor arrivals (thousands),TF,,29.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2005,Tourist/visitor arrivals (thousands),TF,,42.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2010,Tourist/visitor arrivals (thousands),TF,,47.1000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2016,Tourist/visitor arrivals (thousands),TF,,59.1000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2017,Tourist/visitor arrivals (thousands),TF,,62.5000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2018,Tourist/visitor arrivals (thousands),TF,,54.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2005,Tourism expenditure (millions of US dollars),,,15.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2010,Tourism expenditure (millions of US dollars),,,17.3000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2016,Tourism expenditure (millions of US dollars),,,52.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2017,Tourism expenditure (millions of US dollars),,,48.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +776,Tonga,2018,Tourism expenditure (millions of US dollars),,,48.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,1995,Tourist/visitor arrivals (thousands),TF,,260.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2005,Tourist/visitor arrivals (thousands),TF,,463.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2010,Tourist/visitor arrivals (thousands),TF,,388.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2016,Tourist/visitor arrivals (thousands),TF,,409.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2017,Tourist/visitor arrivals (thousands),TF,,395.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2018,Tourist/visitor arrivals (thousands),TF,,375.0000,Arrivals by air.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,1995,Tourism expenditure (millions of US dollars),,,232.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2005,Tourism expenditure (millions of US dollars),,,593.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2010,Tourism expenditure (millions of US dollars),,,630.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2016,Tourism expenditure (millions of US dollars),,,708.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2017,Tourism expenditure (millions of US dollars),,,717.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +780,Trinidad and Tobago,2018,Tourism expenditure (millions of US dollars),,,541.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,1995,Tourist/visitor arrivals (thousands),TF,,4120.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2005,Tourist/visitor arrivals (thousands),TF,,6378.0000,Excluding nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2010,Tourist/visitor arrivals (thousands),TF,,7828.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2016,Tourist/visitor arrivals (thousands),TF,,5724.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2017,Tourist/visitor arrivals (thousands),TF,,7052.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2018,Tourist/visitor arrivals (thousands),TF,,8299.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,1995,Tourism expenditure (millions of US dollars),,,1838.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2005,Tourism expenditure (millions of US dollars),,,2800.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2010,Tourism expenditure (millions of US dollars),,,3477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2016,Tourism expenditure (millions of US dollars),,,1706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2017,Tourism expenditure (millions of US dollars),,,1782.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +788,Tunisia,2018,Tourism expenditure (millions of US dollars),,,2320.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,1995,Tourist/visitor arrivals (thousands),TF,,7083.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2005,Tourist/visitor arrivals (thousands),TF,,20273.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2010,Tourist/visitor arrivals (thousands),TF,,31364.0000,Turkish citizens resident abroad are included.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2016,Tourist/visitor arrivals (thousands),TF,,30289.0000,Turkish citizens resident abroad are included.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2017,Tourist/visitor arrivals (thousands),TF,,37601.0000,Turkish citizens resident abroad are included.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2018,Tourist/visitor arrivals (thousands),TF,,45768.0000,Turkish citizens resident abroad are included.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2005,Tourism expenditure (millions of US dollars),,,20760.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2010,Tourism expenditure (millions of US dollars),,,26318.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2016,Tourism expenditure (millions of US dollars),,,26788.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2017,Tourism expenditure (millions of US dollars),,,31870.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +792,Turkey,2018,Tourism expenditure (millions of US dollars),,,37140.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +795,Turkmenistan,1995,Tourist/visitor arrivals (thousands),TF,,218.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +795,Turkmenistan,2005,Tourist/visitor arrivals (thousands),TF,,11.6000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +796,Turks and Caicos Islands,1995,Tourist/visitor arrivals (thousands),TF,,79.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +796,Turks and Caicos Islands,2005,Tourist/visitor arrivals (thousands),TF,,176.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +796,Turks and Caicos Islands,2010,Tourist/visitor arrivals (thousands),TF,,281.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +796,Turks and Caicos Islands,2016,Tourist/visitor arrivals (thousands),TF,,449.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +796,Turks and Caicos Islands,2017,Tourist/visitor arrivals (thousands),TF,,416.4000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +796,Turks and Caicos Islands,2018,Tourist/visitor arrivals (thousands),TF,,441.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +796,Turks and Caicos Islands,1995,Tourism expenditure (millions of US dollars),,,53.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +798,Tuvalu,1995,Tourist/visitor arrivals (thousands),TF,,0.9000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +798,Tuvalu,2005,Tourist/visitor arrivals (thousands),TF,,1.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +798,Tuvalu,2010,Tourist/visitor arrivals (thousands),TF,,1.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +798,Tuvalu,2016,Tourist/visitor arrivals (thousands),TF,,2.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +798,Tuvalu,2017,Tourist/visitor arrivals (thousands),TF,,2.5000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +798,Tuvalu,2018,Tourist/visitor arrivals (thousands),TF,,2.7000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +798,Tuvalu,2005,Tourism expenditure (millions of US dollars),,,1.2000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +798,Tuvalu,2010,Tourism expenditure (millions of US dollars),,,2.4000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,1995,Tourist/visitor arrivals (thousands),TF,,160.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2005,Tourist/visitor arrivals (thousands),TF,,468.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2010,Tourist/visitor arrivals (thousands),TF,,946.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2016,Tourist/visitor arrivals (thousands),TF,,1323.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2017,Tourist/visitor arrivals (thousands),TF,,1402.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2005,Tourism expenditure (millions of US dollars),,,382.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2010,Tourism expenditure (millions of US dollars),,,802.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2016,Tourism expenditure (millions of US dollars),,,1118.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2017,Tourism expenditure (millions of US dollars),,,957.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +800,Uganda,2018,Tourism expenditure (millions of US dollars),,,1044.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,1995,Tourist/visitor arrivals (thousands),TF,,3716.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2005,Tourist/visitor arrivals (thousands),TF,,17631.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2010,Tourist/visitor arrivals (thousands),TF,,21203.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2016,Tourist/visitor arrivals (thousands),TF,,13333.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2017,Tourist/visitor arrivals (thousands),TF,,14230.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2018,Tourist/visitor arrivals (thousands),TF,,14104.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2005,Tourism expenditure (millions of US dollars),,,3542.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2010,Tourism expenditure (millions of US dollars),,,4696.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2016,Tourism expenditure (millions of US dollars),,,1723.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2017,Tourism expenditure (millions of US dollars),,,2019.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +804,Ukraine,2018,Tourism expenditure (millions of US dollars),,,2269.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,1995,Tourist/visitor arrivals (thousands),THS,,2315.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2005,Tourist/visitor arrivals (thousands),THS,,7126.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2016,Tourist/visitor arrivals (thousands),THS,,18967.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2017,Tourist/visitor arrivals (thousands),THS,,20394.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2018,Tourist/visitor arrivals (thousands),THS,,21286.0000,Arrivals in hotels only. Including domestic tourism and nationals of the country residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,1995,Tourism expenditure (millions of US dollars),,,632.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2005,Tourism expenditure (millions of US dollars),,,3218.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2010,Tourism expenditure (millions of US dollars),,,8577.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2016,Tourism expenditure (millions of US dollars),,,19496.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2017,Tourism expenditure (millions of US dollars),,,21048.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +784,United Arab Emirates,2018,Tourism expenditure (millions of US dollars),,,21390.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,1995,Tourist/visitor arrivals (thousands),TF,,21719.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2005,Tourist/visitor arrivals (thousands),TF,,28039.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2010,Tourist/visitor arrivals (thousands),TF,,28295.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2016,Tourist/visitor arrivals (thousands),TF,,35814.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2017,Tourist/visitor arrivals (thousands),TF,,37651.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2018,Tourist/visitor arrivals (thousands),TF,,36316.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,1995,Tourism expenditure (millions of US dollars),,,27577.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2005,Tourism expenditure (millions of US dollars),,,32948.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2010,Tourism expenditure (millions of US dollars),,,34715.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2016,Tourism expenditure (millions of US dollars),,,47777.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2017,Tourism expenditure (millions of US dollars),,,47719.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +826,United Kingdom,2018,Tourism expenditure (millions of US dollars),,,48515.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,1995,Tourist/visitor arrivals (thousands),TF,,285.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2005,Tourist/visitor arrivals (thousands),TF,,590.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2010,Tourist/visitor arrivals (thousands),TF,,754.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2016,Tourist/visitor arrivals (thousands),TF,,1233.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2017,Tourist/visitor arrivals (thousands),TF,,1275.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2018,Tourist/visitor arrivals (thousands),TF,,1378.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2005,Tourism expenditure (millions of US dollars),,,835.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2010,Tourism expenditure (millions of US dollars),,,1279.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2016,Tourism expenditure (millions of US dollars),,,2149.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2017,Tourism expenditure (millions of US dollars),,,2265.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +834,United Rep. of Tanzania,2018,Tourism expenditure (millions of US dollars),,,2465.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,1995,Tourist/visitor arrivals (thousands),TF,,43318.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2005,Tourist/visitor arrivals (thousands),TF,,49206.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2010,Tourist/visitor arrivals (thousands),TF,,60010.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2016,Tourist/visitor arrivals (thousands),TF,,76407.4880,Break in the time series.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2017,Tourist/visitor arrivals (thousands),TF,,77186.7460,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2018,Tourist/visitor arrivals (thousands),TF,,79745.9180,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,1995,Tourism expenditure (millions of US dollars),,,93743.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2005,Tourism expenditure (millions of US dollars),,,122077.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2010,Tourism expenditure (millions of US dollars),,,167996.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2016,Tourism expenditure (millions of US dollars),,,245991.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2017,Tourism expenditure (millions of US dollars),,,251544.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +840,United States of America,2018,Tourism expenditure (millions of US dollars),,,256145.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,1995,Tourist/visitor arrivals (thousands),TF,,454.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2005,Tourist/visitor arrivals (thousands),TF,,594.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2010,Tourist/visitor arrivals (thousands),TF,,572.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2016,Tourist/visitor arrivals (thousands),TF,,667.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2017,Tourist/visitor arrivals (thousands),TF,,535.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2018,Tourist/visitor arrivals (thousands),TF,,381.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,1995,Tourism expenditure (millions of US dollars),,,822.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2005,Tourism expenditure (millions of US dollars),,,1432.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2010,Tourism expenditure (millions of US dollars),,,1223.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2016,Tourism expenditure (millions of US dollars),,,1343.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2017,Tourism expenditure (millions of US dollars),,,1202.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +850,United States Virgin Islands,2018,Tourism expenditure (millions of US dollars),,,1046.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,1995,Tourist/visitor arrivals (thousands),TF,,2022.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2005,Tourist/visitor arrivals (thousands),TF,,1808.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2010,Tourist/visitor arrivals (thousands),TF,,2353.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2016,Tourist/visitor arrivals (thousands),TF,,3037.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2017,Tourist/visitor arrivals (thousands),TF,,3674.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2018,Tourist/visitor arrivals (thousands),TF,,3469.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,1995,Tourism expenditure (millions of US dollars),,,725.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2005,Tourism expenditure (millions of US dollars),,,699.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2010,Tourism expenditure (millions of US dollars),,,1669.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2016,Tourism expenditure (millions of US dollars),,,2182.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2017,Tourism expenditure (millions of US dollars),,,2660.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +858,Uruguay,2018,Tourism expenditure (millions of US dollars),,,2439.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,1995,Tourist/visitor arrivals (thousands),TF,,92.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2005,Tourist/visitor arrivals (thousands),TF,,242.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2010,Tourist/visitor arrivals (thousands),TF,,975.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2016,Tourist/visitor arrivals (thousands),TF,,2027.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2017,Tourist/visitor arrivals (thousands),TF,,2690.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2018,Tourist/visitor arrivals (thousands),TF,,5346.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2005,Tourism expenditure (millions of US dollars),,,28.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2010,Tourism expenditure (millions of US dollars),,,121.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2016,Tourism expenditure (millions of US dollars),,,458.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2017,Tourism expenditure (millions of US dollars),,,689.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +860,Uzbekistan,2018,Tourism expenditure (millions of US dollars),,,1144.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,1995,Tourist/visitor arrivals (thousands),TF,,44.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2005,Tourist/visitor arrivals (thousands),TF,,62.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2010,Tourist/visitor arrivals (thousands),TF,,97.2000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2016,Tourist/visitor arrivals (thousands),TF,,95.1000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2017,Tourist/visitor arrivals (thousands),TF,,109.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2018,Tourist/visitor arrivals (thousands),TF,,116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2005,Tourism expenditure (millions of US dollars),,,104.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2010,Tourism expenditure (millions of US dollars),,,242.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2016,Tourism expenditure (millions of US dollars),,,275.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2017,Tourism expenditure (millions of US dollars),,,289.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +548,Vanuatu,2018,Tourism expenditure (millions of US dollars),,,325.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),1995,Tourist/visitor arrivals (thousands),TF,,700.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),2005,Tourist/visitor arrivals (thousands),TF,,706.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),2010,Tourist/visitor arrivals (thousands),TF,,526.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),2016,Tourist/visitor arrivals (thousands),TF,,601.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),2017,Tourist/visitor arrivals (thousands),TF,,427.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),1995,Tourism expenditure (millions of US dollars),,,995.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),2005,Tourism expenditure (millions of US dollars),,,722.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),2010,Tourism expenditure (millions of US dollars),,,885.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +862,Venezuela (Boliv. Rep. of),2016,Tourism expenditure (millions of US dollars),,,546.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,1995,Tourist/visitor arrivals (thousands),VF,,1351.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2005,Tourist/visitor arrivals (thousands),VF,,3477.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2010,Tourist/visitor arrivals (thousands),VF,,5050.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2016,Tourist/visitor arrivals (thousands),VF,,10013.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2017,Tourist/visitor arrivals (thousands),VF,,12922.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2018,Tourist/visitor arrivals (thousands),VF,,15498.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2005,Tourism expenditure (millions of US dollars),,,2300.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2010,Tourism expenditure (millions of US dollars),,,4450.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2016,Tourism expenditure (millions of US dollars),,,8500.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2017,Tourism expenditure (millions of US dollars),,,8890.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +704,Viet Nam,2018,Tourism expenditure (millions of US dollars),,,10080.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +887,Yemen,1995,Tourist/visitor arrivals (thousands),TF,,61.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +887,Yemen,2005,Tourist/visitor arrivals (thousands),TF,,336.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +887,Yemen,2010,Tourist/visitor arrivals (thousands),TF,,1025.0000,Including nationals residing abroad.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +887,Yemen,2010,Tourism expenditure (millions of US dollars),,,1291.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +887,Yemen,2016,Tourism expenditure (millions of US dollars),,,116.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,1995,Tourist/visitor arrivals (thousands),TF,,163.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2005,Tourist/visitor arrivals (thousands),TF,,669.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2010,Tourist/visitor arrivals (thousands),TF,,815.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2016,Tourist/visitor arrivals (thousands),TF,,956.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2017,Tourist/visitor arrivals (thousands),TF,,1083.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2018,Tourist/visitor arrivals (thousands),TF,,1072.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2005,Tourism expenditure (millions of US dollars),,,447.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2010,Tourism expenditure (millions of US dollars),,,492.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2016,Tourism expenditure (millions of US dollars),,,683.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2017,Tourism expenditure (millions of US dollars),,,653.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +894,Zambia,2018,Tourism expenditure (millions of US dollars),,,742.0000,Excluding passenger transport.,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,1995,Tourist/visitor arrivals (thousands),VF,,1416.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2005,Tourist/visitor arrivals (thousands),VF,,1559.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2010,Tourist/visitor arrivals (thousands),VF,,2239.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2016,Tourist/visitor arrivals (thousands),VF,,2168.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2017,Tourist/visitor arrivals (thousands),VF,,2423.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2018,Tourist/visitor arrivals (thousands),VF,,2580.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,1995,Tourism expenditure (millions of US dollars),,,145.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2005,Tourism expenditure (millions of US dollars),,,99.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2010,Tourism expenditure (millions of US dollars),,,135.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2016,Tourism expenditure (millions of US dollars),,,194.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." +716,Zimbabwe,2017,Tourism expenditure (millions of US dollars),,,158.0000,,"World Tourism Organization (UNWTO), Madrid, the UNWTO Statistics Database, last accessed January 2020." diff --git a/apache-spark/src/main/java/com/baeldung/differences/dataframe/dataset/rdd/TouristData.java b/apache-spark/src/main/java/com/baeldung/differences/dataframe/dataset/rdd/TouristData.java new file mode 100644 index 0000000000..fbeef4283a --- /dev/null +++ b/apache-spark/src/main/java/com/baeldung/differences/dataframe/dataset/rdd/TouristData.java @@ -0,0 +1,75 @@ +package com.baeldung.differences.dataframe.dataset.rdd; + + +public class TouristData { + + private String region; + private String country; + private String year; + private String series; + private Double value; + private String footnotes; + private String source; + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + public String getSeries() { + return series; + } + + public void setSeries(String series) { + this.series = series; + } + + public Double getValue() { + return value; + } + + public void setValue(Double value) { + this.value = value; + } + + public String getFootnotes() { + return footnotes; + } + + public void setFootnotes(String footnotes) { + this.footnotes = footnotes; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + @Override + public String toString() { + return "TouristData [region=" + region + ", country=" + country + ", year=" + year + ", series=" + series + ", value=" + value + ", footnotes=" + footnotes + ", source=" + source + "]"; + } + +} diff --git a/apache-spark/src/test/java/com/baeldung/differences/rdd/ActionsUnitTest.java b/apache-spark/src/test/java/com/baeldung/differences/rdd/ActionsUnitTest.java new file mode 100644 index 0000000000..a3e1811e6f --- /dev/null +++ b/apache-spark/src/test/java/com/baeldung/differences/rdd/ActionsUnitTest.java @@ -0,0 +1,67 @@ +package com.baeldung.differences.rdd; + +import static org.junit.Assert.assertEquals; + +import java.util.List; + +import org.apache.spark.SparkConf; +import org.apache.spark.api.java.JavaPairRDD; +import org.apache.spark.api.java.JavaRDD; +import org.apache.spark.api.java.JavaSparkContext; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import scala.Tuple2; + +public class ActionsUnitTest { + private static JavaRDD tourists; + private static JavaSparkContext sc; + public static final String COMMA_DELIMITER = ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"; + + @BeforeClass + public static void init() { + SparkConf conf = new SparkConf().setAppName("reduce") + .setMaster("local[*]"); + sc = new JavaSparkContext(conf); + tourists = sc.textFile("data/Tourist.csv").filter(line -> !line.startsWith("Region")); + } + + @AfterClass + public static void cleanup() { + sc.close(); + } + + @Test + public void whenDistinctCount_thenReturnDistinctNumRecords() { + JavaRDD countries = tourists.map(line -> { + String[] columns = line.split(COMMA_DELIMITER); + return columns[1]; + }) + .distinct(); + Long numberOfCountries = countries.count(); + System.out.println("Count: " + numberOfCountries); + + assertEquals(Long.valueOf(220), numberOfCountries); + } + + @Test + public void whenReduceByKeySum_thenTotalValuePerKey() { + JavaRDD touristsExpenditure = tourists.filter(line -> line.split(COMMA_DELIMITER)[3].contains("expenditure")); + + JavaPairRDD expenditurePairRdd = touristsExpenditure.mapToPair(line -> { + String[] columns = line.split(COMMA_DELIMITER); + return new Tuple2<>(columns[1], Double.valueOf(columns[6])); + }); + List> totalByCountry = expenditurePairRdd.reduceByKey((x, y) -> x + y) + .collect(); + System.out.println("Total per Country: " + totalByCountry); + + for(Tuple2 tuple : totalByCountry) { + if (tuple._1.equals("Mexico")) { + assertEquals(Double.valueOf(99164), tuple._2); + } + } + } + +} diff --git a/apache-spark/src/test/java/com/baeldung/differences/rdd/DataFrameUnitTest.java b/apache-spark/src/test/java/com/baeldung/differences/rdd/DataFrameUnitTest.java new file mode 100644 index 0000000000..f294e5bc66 --- /dev/null +++ b/apache-spark/src/test/java/com/baeldung/differences/rdd/DataFrameUnitTest.java @@ -0,0 +1,74 @@ +package com.baeldung.differences.rdd; + +import static org.apache.spark.sql.functions.col; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; + +import org.apache.spark.sql.DataFrameReader; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.SparkSession; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class DataFrameUnitTest { + private static SparkSession session; + private static Dataset data; + + @BeforeClass + public static void init() { + session = SparkSession.builder() + .appName("TouristDataFrameExample") + .master("local[*]") + .getOrCreate(); + DataFrameReader dataFrameReader = session.read(); + data = dataFrameReader.option("header", "true") + .csv("data/Tourist.csv"); + } + + @AfterClass + public static void cleanup() { + session.stop(); + } + + @Test + public void whenSelectSpecificColumns_thenColumnsFiltered() { + Dataset selectedData = data.select(col("country"), col("year"), col("value")); + selectedData.show(); + + List resultList = Arrays.asList(selectedData.columns()); + assertTrue(resultList.contains("country")); + assertTrue(resultList.contains("year")); + assertTrue(resultList.contains("value")); + assertFalse(resultList.contains("Series")); + + } + + @Test + public void whenFilteringByCountry_thenCountryRecordsSelected() { + Dataset filteredData = data.filter(col("country").equalTo("Mexico")); + filteredData.show(); + + filteredData.foreach(record -> { + assertEquals("Mexico", record.get(1)); + }); + + } + + @Test + public void whenGroupCountByCountry_thenContryTotalRecords() { + Dataset recordsPerCountry = data.groupBy(col("country")) + .count(); + recordsPerCountry.show(); + + Dataset filteredData = recordsPerCountry.filter(col("country").equalTo("Sweden")); + assertEquals(new Long(12), filteredData.first() + .get(1)); + } + +} diff --git a/apache-spark/src/test/java/com/baeldung/differences/rdd/DatasetUnitTest.java b/apache-spark/src/test/java/com/baeldung/differences/rdd/DatasetUnitTest.java new file mode 100644 index 0000000000..1d83505812 --- /dev/null +++ b/apache-spark/src/test/java/com/baeldung/differences/rdd/DatasetUnitTest.java @@ -0,0 +1,83 @@ +package com.baeldung.differences.rdd; + +import static org.apache.spark.sql.functions.col; +import static org.apache.spark.sql.functions.sum; +import static org.junit.Assert.assertEquals; + +import org.apache.spark.api.java.function.FilterFunction; +import org.apache.spark.sql.DataFrameReader; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Encoders; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.SparkSession; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.baeldung.differences.dataframe.dataset.rdd.TouristData; + +public class DatasetUnitTest { + private static SparkSession session; + private static Dataset typedDataset; + + @BeforeClass + public static void init() { + session = SparkSession.builder() + .appName("TouristDatasetExample") + .master("local[*]") + .getOrCreate(); + DataFrameReader dataFrameReader = session.read(); + Dataset data = dataFrameReader.option("header", "true") + .csv("data/Tourist.csv"); + Dataset responseWithSelectedColumns = data.select(col("region"), + col("country"), col("year"), col("series"), col("value").cast("double"), + col("footnotes"), col("source")); + typedDataset = responseWithSelectedColumns.as(Encoders.bean(TouristData.class)); + } + + @AfterClass + public static void cleanup() { + session.stop(); + } + + @Test + public void whenFilteringByCountry_thenCountryRecordsSelected() { + Dataset selectedData = typedDataset + .filter((FilterFunction) record -> record.getCountry() + .equals("Norway")); + selectedData.show(); + + selectedData.foreach(record -> { + assertEquals("Norway", record.getCountry()); + }); + } + + @Test + public void whenGroupCountByCountry_thenContryTotalRecords() { + Dataset countriesCount = typedDataset.groupBy(typedDataset.col("country")) + .count(); + countriesCount.show(); + + assertEquals(Long.valueOf(220), Long.valueOf(countriesCount.count())); + } + + @Test + public void whenFilteredByPropertyRange_thenRetreiveValidRecords() { + // Filter records with existing data for years between 2010 and 2017 + typedDataset.filter((FilterFunction) record -> record.getYear() != null + && (Long.valueOf(record.getYear()) > 2010 && Long.valueOf(record.getYear()) < 2017)) + .show(); + } + + @Test + public void whenSumValue_thenRetreiveTotalValue() { + // Total tourist expenditure by country + typedDataset.filter((FilterFunction) record -> record.getValue() != null + && record.getSeries() + .contains("expenditure")) + .groupBy("country") + .agg(sum("value")) + .show(); + } + +} diff --git a/apache-spark/src/test/java/com/baeldung/differences/rdd/TransformationsUnitTest.java b/apache-spark/src/test/java/com/baeldung/differences/rdd/TransformationsUnitTest.java new file mode 100644 index 0000000000..4b2d9e1127 --- /dev/null +++ b/apache-spark/src/test/java/com/baeldung/differences/rdd/TransformationsUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.differences.rdd; + + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.lang3.StringUtils; +import org.apache.spark.SparkConf; +import org.apache.spark.api.java.JavaRDD; +import org.apache.spark.api.java.JavaSparkContext; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TransformationsUnitTest { + + public static final String COMMA_DELIMITER = ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"; + private static JavaSparkContext sc; + private static JavaRDD tourists; + + @BeforeClass + public static void init() { + SparkConf conf = new SparkConf().setAppName("uppercaseCountries") + .setMaster("local[*]"); + sc = new JavaSparkContext(conf); + tourists = sc.textFile("data/Tourist.csv") + .filter(line -> !line.startsWith("Region")); //filter header row + } + + @AfterClass + public static void cleanup() { + sc.close(); + } + + @Test + public void whenMapUpperCase_thenCountryNameUppercased() { + JavaRDD upperCaseCountries = tourists.map(line -> { + String[] columns = line.split(COMMA_DELIMITER); + return columns[1].toUpperCase(); + }) + .distinct(); + + upperCaseCountries.saveAsTextFile("data/output/uppercase.txt"); + + upperCaseCountries.foreach(country -> { + //replace non alphanumerical characters + country = country.replaceAll("[^a-zA-Z]", ""); + assertTrue(StringUtils.isAllUpperCase(country)); + }); + } + + @Test + public void whenFilterByCountry_thenShowRequestedCountryRecords() { + JavaRDD touristsInMexico = tourists.filter(line -> line.split(COMMA_DELIMITER)[1].equals("Mexico")); + + touristsInMexico.saveAsTextFile("data/output/touristInMexico.txt"); + + touristsInMexico.foreach(record -> { + assertEquals("Mexico", record.split(COMMA_DELIMITER)[1]); + }); + } + +} From b9dbeb6c58d19e7ca88e56086136678cc2883a66 Mon Sep 17 00:00:00 2001 From: andrebrowne <42154231+andrebrowne@users.noreply.github.com> Date: Fri, 2 Oct 2020 13:21:18 -0400 Subject: [PATCH 0871/1862] BAEL-4012 Add Netflix Feign (#10110) * BAEL-4012 Add Netflix Feign * BAEL-4012 Cleanup pom --- .../spring-cloud-netflix-feign/pom.xml | 71 +++++++++++++++++++ .../netflix/feign/ExampleApplication.java | 16 +++++ .../feign/client/JSONPlaceHolderClient.java | 25 +++++++ .../feign/config/ClientConfiguration.java | 38 ++++++++++ .../feign/config/CustomErrorDecoder.java | 21 ++++++ .../feign/exception/BadRequestException.java | 21 ++++++ .../feign/exception/NotFoundException.java | 21 ++++++ .../hystrix/JSONPlaceHolderFallback.java | 22 ++++++ .../cloud/netflix/feign/model/Post.java | 41 +++++++++++ .../feign/service/JSONPlaceHolderService.java | 12 ++++ .../impl/JSONPlaceHolderServiceImpl.java | 26 +++++++ .../src/main/resources/application.properties | 3 + .../netflix/feign/ExampleTestApplication.java | 21 ++++++ .../netflix/feign/NetflixFeignUnitTest.java | 43 +++++++++++ 14 files changed, 381 insertions(+) create mode 100644 spring-cloud/spring-cloud-netflix-feign/pom.xml create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/ExampleApplication.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/client/JSONPlaceHolderClient.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/ClientConfiguration.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/CustomErrorDecoder.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/BadRequestException.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/NotFoundException.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/hystrix/JSONPlaceHolderFallback.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/model/Post.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/JSONPlaceHolderService.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/impl/JSONPlaceHolderServiceImpl.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/main/resources/application.properties create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/ExampleTestApplication.java create mode 100644 spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/NetflixFeignUnitTest.java diff --git a/spring-cloud/spring-cloud-netflix-feign/pom.xml b/spring-cloud/spring-cloud-netflix-feign/pom.xml new file mode 100644 index 0000000000..aa5ba5dbdb --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/pom.xml @@ -0,0 +1,71 @@ + + + 4.0.0 + com.baeldung.cloud + spring-cloud-netlix-feign + 0.0.1-SNAPSHOT + spring-cloud-netflix-feign + Netflix Feign project for Spring Boot + + + com.baeldung + parent-boot-1 + 0.0.1-SNAPSHOT + ../../parent-boot-1 + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + org.springframework.cloud + spring-cloud-starter-feign + + + + com.netflix.feign + feign-okhttp + ${feign-ok.version} + + + + org.springframework.boot + spring-boot-starter-web + + + + org.apache.httpcomponents + httpcore + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + Camden.SR7 + 8.18.0 + + + + + diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/ExampleApplication.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/ExampleApplication.java new file mode 100644 index 0000000000..e5ed9cbecf --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/ExampleApplication.java @@ -0,0 +1,16 @@ +package com.baeldung.cloud.netflix.feign; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.feign.EnableFeignClients; + +@SpringBootApplication +@EnableFeignClients +public class ExampleApplication { + + public static void main(String[] args) { + SpringApplication.run(ExampleApplication.class, args); + } + +} + diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/client/JSONPlaceHolderClient.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/client/JSONPlaceHolderClient.java new file mode 100644 index 0000000000..80a455a4c4 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/client/JSONPlaceHolderClient.java @@ -0,0 +1,25 @@ +package com.baeldung.cloud.netflix.feign.client; + +import com.baeldung.cloud.netflix.feign.config.ClientConfiguration; +import com.baeldung.cloud.netflix.feign.hystrix.JSONPlaceHolderFallback; +import com.baeldung.cloud.netflix.feign.model.Post; +import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import java.util.List; + +@FeignClient(value = "jplaceholder", + url = "https://jsonplaceholder.typicode.com/", + configuration = ClientConfiguration.class, + fallback = JSONPlaceHolderFallback.class) +public interface JSONPlaceHolderClient { + + @RequestMapping(method = RequestMethod.GET, value = "/posts") + List getPosts(); + + + @RequestMapping(method = RequestMethod.GET, value = "/posts/{postId}", produces = "application/json") + Post getPostById(@PathVariable("postId") Long postId); +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/ClientConfiguration.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/ClientConfiguration.java new file mode 100644 index 0000000000..bc211b181e --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/ClientConfiguration.java @@ -0,0 +1,38 @@ +package com.baeldung.cloud.netflix.feign.config; + +import feign.Logger; +import feign.RequestInterceptor; +import feign.codec.ErrorDecoder; +import feign.okhttp.OkHttpClient; + +import org.apache.http.entity.ContentType; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ClientConfiguration { + + @Bean + public Logger.Level feignLoggerLevel() { + return Logger.Level.FULL; + } + + @Bean + public ErrorDecoder errorDecoder() { + return new ErrorDecoder.Default(); + } + + @Bean + public OkHttpClient client() { + return new OkHttpClient(); + } + + @Bean + public RequestInterceptor requestInterceptor() { + return requestTemplate -> { + requestTemplate.header("user", "ajeje"); + requestTemplate.header("password", "brazof"); + requestTemplate.header("Accept", ContentType.APPLICATION_JSON.getMimeType()); + }; + } +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/CustomErrorDecoder.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/CustomErrorDecoder.java new file mode 100644 index 0000000000..3e0e80f6d5 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/config/CustomErrorDecoder.java @@ -0,0 +1,21 @@ +package com.baeldung.cloud.netflix.feign.config; + +import com.baeldung.cloud.netflix.feign.exception.BadRequestException; +import com.baeldung.cloud.netflix.feign.exception.NotFoundException; +import feign.Response; +import feign.codec.ErrorDecoder; + +public class CustomErrorDecoder implements ErrorDecoder { + @Override + public Exception decode(String methodKey, Response response) { + + switch (response.status()){ + case 400: + return new BadRequestException(); + case 404: + return new NotFoundException(); + default: + return new Exception("Generic error"); + } + } +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/BadRequestException.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/BadRequestException.java new file mode 100644 index 0000000000..6a5f60f7c0 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/BadRequestException.java @@ -0,0 +1,21 @@ +package com.baeldung.cloud.netflix.feign.exception; + +public class BadRequestException extends Exception { + + public BadRequestException() { + } + + public BadRequestException(String message) { + super(message); + } + + public BadRequestException(Throwable cause) { + super(cause); + } + + @Override + public String toString() { + return "BadRequestException: "+getMessage(); + } + +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/NotFoundException.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/NotFoundException.java new file mode 100644 index 0000000000..a8d89049fd --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/exception/NotFoundException.java @@ -0,0 +1,21 @@ +package com.baeldung.cloud.netflix.feign.exception; + +public class NotFoundException extends Exception { + + public NotFoundException() { + } + + public NotFoundException(String message) { + super(message); + } + + public NotFoundException(Throwable cause) { + super(cause); + } + + @Override + public String toString() { + return "NotFoundException: "+getMessage(); + } + +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/hystrix/JSONPlaceHolderFallback.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/hystrix/JSONPlaceHolderFallback.java new file mode 100644 index 0000000000..ab1aa6bf50 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/hystrix/JSONPlaceHolderFallback.java @@ -0,0 +1,22 @@ +package com.baeldung.cloud.netflix.feign.hystrix; + +import com.baeldung.cloud.netflix.feign.client.JSONPlaceHolderClient; +import com.baeldung.cloud.netflix.feign.model.Post; +import org.springframework.stereotype.Component; + +import java.util.Collections; +import java.util.List; + +@Component +public class JSONPlaceHolderFallback implements JSONPlaceHolderClient { + + @Override + public List getPosts() { + return Collections.emptyList(); + } + + @Override + public Post getPostById(Long postId) { + return null; + } +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/model/Post.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/model/Post.java new file mode 100644 index 0000000000..73dd2bc198 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/model/Post.java @@ -0,0 +1,41 @@ +package com.baeldung.cloud.netflix.feign.model; + +public class Post { + + private String userId; + private Long id; + private String title; + private String body; + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/JSONPlaceHolderService.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/JSONPlaceHolderService.java new file mode 100644 index 0000000000..d2e174a1f0 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/JSONPlaceHolderService.java @@ -0,0 +1,12 @@ +package com.baeldung.cloud.netflix.feign.service; + +import com.baeldung.cloud.netflix.feign.model.Post; + +import java.util.List; + +public interface JSONPlaceHolderService { + + List getPosts(); + + Post getPostById(Long id); +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/impl/JSONPlaceHolderServiceImpl.java b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/impl/JSONPlaceHolderServiceImpl.java new file mode 100644 index 0000000000..0cc8d296f0 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/java/com/baeldung/cloud/netflix/feign/service/impl/JSONPlaceHolderServiceImpl.java @@ -0,0 +1,26 @@ +package com.baeldung.cloud.netflix.feign.service.impl; + +import com.baeldung.cloud.netflix.feign.client.JSONPlaceHolderClient; +import com.baeldung.cloud.netflix.feign.model.Post; +import com.baeldung.cloud.netflix.feign.service.JSONPlaceHolderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class JSONPlaceHolderServiceImpl implements JSONPlaceHolderService { + + @Autowired + private JSONPlaceHolderClient jsonPlaceHolderClient; + + @Override + public List getPosts() { + return jsonPlaceHolderClient.getPosts(); + } + + @Override + public Post getPostById(Long id) { + return jsonPlaceHolderClient.getPostById(id); + } +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/main/resources/application.properties b/spring-cloud/spring-cloud-netflix-feign/src/main/resources/application.properties new file mode 100644 index 0000000000..5927ccb9c1 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.application.name=netflix-feign +logging.level.com.baeldung.cloud.netflix.feign.client=DEBUG +feign.hystrix.enabled=true diff --git a/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/ExampleTestApplication.java b/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/ExampleTestApplication.java new file mode 100644 index 0000000000..f3c8459f87 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/ExampleTestApplication.java @@ -0,0 +1,21 @@ +package com.baeldung.cloud.netflix.feign; + +import com.baeldung.cloud.netflix.feign.config.ClientConfiguration; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +@EnableAutoConfiguration +@ContextConfiguration(classes = { ClientConfiguration.class }) +public class ExampleTestApplication { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/NetflixFeignUnitTest.java b/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/NetflixFeignUnitTest.java new file mode 100644 index 0000000000..880948d6d1 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/src/test/java/com/baeldung/cloud/netflix/feign/NetflixFeignUnitTest.java @@ -0,0 +1,43 @@ +package com.baeldung.cloud.netflix.feign; + +import com.baeldung.cloud.netflix.feign.model.Post; +import com.baeldung.cloud.netflix.feign.service.JSONPlaceHolderService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.List; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class NetflixFeignUnitTest { + + @Autowired + private JSONPlaceHolderService jsonPlaceHolderService; + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } + + @Test + public void whenGetPosts_thenListPostSizeGreaterThanZero() { + + List posts = jsonPlaceHolderService.getPosts(); + + assertFalse(posts.isEmpty()); + } + + @Test + public void whenGetPostWithId_thenPostExist() { + + Post post = jsonPlaceHolderService.getPostById(1L); + + assertNotNull(post); + } + +} From d3744f76947a78fb5ed6595b0a6530c37bab85e0 Mon Sep 17 00:00:00 2001 From: majajoksovic Date: Fri, 2 Oct 2020 19:23:50 +0200 Subject: [PATCH 0872/1862] BAEL-4505 (#10119) * initial commit * fixed formatting * formatting changes * test fix --- .../application-persistent-on.properties | 10 ++++ .../persistent/FilesLocationUnitTest.java | 52 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties create mode 100644 persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/persistent/FilesLocationUnitTest.java diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties new file mode 100644 index 0000000000..be939ffa69 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-persistent-on.properties @@ -0,0 +1,10 @@ +#spring.datasource.url=jdbc:h2:file:C:/data/demodb +#spring.datasource.url=jdbc:h2:file:~/demodb +spring.datasource.url=jdbc:h2:file:./src/main/resources/db/demodb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.h2.console.enabled=true +spring.jpa.hibernate.ddl-auto=create-drop +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.h2.console.path=/h2-console diff --git a/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/persistent/FilesLocationUnitTest.java b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/persistent/FilesLocationUnitTest.java new file mode 100644 index 0000000000..63f195e88d --- /dev/null +++ b/persistence-modules/spring-boot-persistence-h2/src/test/java/com/baeldung/persistent/FilesLocationUnitTest.java @@ -0,0 +1,52 @@ +package com.baeldung.persistent; + +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.h2db.auto.configuration.AutoConfigurationDemo; + +@ActiveProfiles("persistent-on") +@RunWith(SpringRunner.class) +@DirtiesContext(classMode = ClassMode.BEFORE_EACH_TEST_METHOD) +@SpringBootTest(classes = AutoConfigurationDemo.class) +public class FilesLocationUnitTest { + + @BeforeClass + public static void beforeClass() { + + } + + @Test(expected = Test.None.class) + public void whenApplicationStarted_thenEmbeddedDbSubfolderCreated() { + File subdirectory = new File("src/main/resources/db"); + System.out.println(subdirectory.getAbsolutePath()); + assertTrue(subdirectory.exists()); + assertTrue(subdirectory.isDirectory()); + } + + @Test(expected = Test.None.class) + public void whenApplicationStarted_thenEmbeddedDbFilesCreated() { + File dbFile = new File("src/main/resources/db/demodb.mv.db"); + System.out.println(dbFile.getAbsolutePath()); + + assertTrue(dbFile.exists()); + assertTrue(dbFile.isFile()); + } + + @AfterClass + public static void cleanUp() { + File dbFile = new File("src/main/resources/db/demodb.mv.db"); + dbFile.deleteOnExit(); + } +} From 67e2165bb6d35707a05dc18f477f342a732afec3 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 2 Oct 2020 19:26:00 +0200 Subject: [PATCH 0873/1862] BAEL-4658: Upgrade to Cucumber 6.8.0 (#10121) --- spring-cucumber/pom.xml | 18 +++++++++--------- .../java/com/baeldung/BaeldungController.java | 6 ++---- .../java/com/baeldung/VersionController.java | 5 ++--- .../com/baeldung/CucumberIntegrationTest.java | 6 +++--- .../com/baeldung/SpringIntegrationTest.java | 4 ++-- .../com/baeldung/StepDefsIntegrationTest.java | 12 ++++++------ 6 files changed, 24 insertions(+), 27 deletions(-) diff --git a/spring-cucumber/pom.xml b/spring-cucumber/pom.xml index 245d10e77b..a945797ee1 100644 --- a/spring-cucumber/pom.xml +++ b/spring-cucumber/pom.xml @@ -21,27 +21,27 @@ spring-boot-starter-web - info.cukes + io.cucumber cucumber-core - ${cucumber.java.version} + ${cucumber.version} test - info.cukes + io.cucumber cucumber-java - ${cucumber.java.version} + ${cucumber.version} test - info.cukes + io.cucumber cucumber-junit - ${cucumber.java.version} + ${cucumber.version} test - info.cukes + io.cucumber cucumber-spring - ${cucumber.java.version} + ${cucumber.version} test @@ -53,7 +53,7 @@ - 1.2.5 + 6.8.0 1.3.2 diff --git a/spring-cucumber/src/main/java/com/baeldung/BaeldungController.java b/spring-cucumber/src/main/java/com/baeldung/BaeldungController.java index e74e773106..713c1022c5 100644 --- a/spring-cucumber/src/main/java/com/baeldung/BaeldungController.java +++ b/spring-cucumber/src/main/java/com/baeldung/BaeldungController.java @@ -4,18 +4,16 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; -import javax.servlet.http.HttpServletResponse; - @RestController public class BaeldungController { @GetMapping("/hello") - public String sayHello(HttpServletResponse response) { + public String sayHello() { return "hello"; } @PostMapping("/baeldung") - public String sayHelloPost(HttpServletResponse response) { + public String sayHelloPost() { return "hello"; } } diff --git a/spring-cucumber/src/main/java/com/baeldung/VersionController.java b/spring-cucumber/src/main/java/com/baeldung/VersionController.java index f673f0e31f..e46ca64a01 100644 --- a/spring-cucumber/src/main/java/com/baeldung/VersionController.java +++ b/spring-cucumber/src/main/java/com/baeldung/VersionController.java @@ -1,13 +1,12 @@ package com.baeldung; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class VersionController { - @RequestMapping(method = { RequestMethod.GET }, value = { "/version" }) + @GetMapping("/version") public String getVersion() { return "1.0"; } diff --git a/spring-cucumber/src/test/java/com/baeldung/CucumberIntegrationTest.java b/spring-cucumber/src/test/java/com/baeldung/CucumberIntegrationTest.java index f48ab410ca..2077a28146 100644 --- a/spring-cucumber/src/test/java/com/baeldung/CucumberIntegrationTest.java +++ b/spring-cucumber/src/test/java/com/baeldung/CucumberIntegrationTest.java @@ -1,11 +1,11 @@ package com.baeldung; +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; import org.junit.runner.RunWith; -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(features = "src/test/resources") -public class CucumberIntegrationTest extends SpringIntegrationTest{ +public class CucumberIntegrationTest extends SpringIntegrationTest { } \ No newline at end of file diff --git a/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java b/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java index 8655a02469..7b5c4e21ff 100644 --- a/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java +++ b/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import io.cucumber.spring.CucumberContextConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; @@ -13,9 +14,8 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.RestTemplate; -//@RunWith(SpringJUnit4ClassRunner.class) +@CucumberContextConfiguration @SpringBootTest(classes = SpringDemoApplication.class, webEnvironment = WebEnvironment.DEFINED_PORT) -@ContextConfiguration public class SpringIntegrationTest { static ResponseResults latestResponse = null; diff --git a/spring-cucumber/src/test/java/com/baeldung/StepDefsIntegrationTest.java b/spring-cucumber/src/test/java/com/baeldung/StepDefsIntegrationTest.java index e1b6e370c7..9611e95dcf 100644 --- a/spring-cucumber/src/test/java/com/baeldung/StepDefsIntegrationTest.java +++ b/spring-cucumber/src/test/java/com/baeldung/StepDefsIntegrationTest.java @@ -1,14 +1,14 @@ package com.baeldung; +import io.cucumber.java.en.And; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import org.springframework.http.HttpStatus; + import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import cucumber.api.java.en.Given; -import org.springframework.http.HttpStatus; - -import cucumber.api.java.en.And; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; public class StepDefsIntegrationTest extends SpringIntegrationTest { From be481348409fb7b5b24f36417ffb9d3818f9c6f8 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Fri, 2 Oct 2020 19:28:05 +0200 Subject: [PATCH 0874/1862] BAEL-4659: Upgrade Cucumber to 6.8.0 (#10115) --- testing-modules/rest-testing/pom.xml | 76 ++++++++----------- .../main/resources/karate/cucumber.feature | 10 --- .../cucumber/CucumberIntegrationTest.java | 4 +- .../rest/cucumber/StepDefinition.java | 11 +-- .../test/resources/Feature/cucumber.feature | 2 +- 5 files changed, 41 insertions(+), 62 deletions(-) delete mode 100644 testing-modules/rest-testing/src/main/resources/karate/cucumber.feature diff --git a/testing-modules/rest-testing/pom.xml b/testing-modules/rest-testing/pom.xml index 1e8a27afa5..b3966c1b6a 100644 --- a/testing-modules/rest-testing/pom.xml +++ b/testing-modules/rest-testing/pom.xml @@ -65,13 +65,13 @@ - info.cukes + io.cucumber cucumber-java ${cucumber.version} test - info.cukes + io.cucumber cucumber-junit ${cucumber.version} @@ -105,56 +105,44 @@ true - - - - maven-failsafe-plugin - ${maven-failsafe-plugin.version} - - classes - 4 - - - - - integration-test - verify - - - - - - com.github.temyers - cucumber-jvm-parallel-plugin - 5.0.0 - - - generateRunners - generate-test-sources - - generateRunners - - - - com.baeldung.rest.cucumber - - src/test/resources/Feature/ - SCENARIO - - - - - - + + + parallel + + + + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + CucumberIntegrationTest.java + + methods + 2 + + + + + integration-test + verify + + + + + + + + + 19.0 2.9.0 - 1.2.5 + 6.8.0 2.21.0 0.6.1 diff --git a/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature b/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature deleted file mode 100644 index 99dd8249fe..0000000000 --- a/testing-modules/rest-testing/src/main/resources/karate/cucumber.feature +++ /dev/null @@ -1,10 +0,0 @@ -Feature: Testing a REST API - Users should be able to submit GET and POST requests to a web service, represented by WireMock - - Scenario: Data Upload to a web service - When users upload data on a project - Then the server should handle it and return a success status - - Scenario: Data retrieval from a web service - When users want to get information on the Cucumber project - Then the requested data is returned \ No newline at end of file diff --git a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java index f80178a43d..33e2c62301 100644 --- a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java +++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/CucumberIntegrationTest.java @@ -1,8 +1,8 @@ package com.baeldung.rest.cucumber; +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; import org.junit.runner.RunWith; -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(features = "classpath:Feature") diff --git a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java index 35a913ae25..f1fcb48f01 100644 --- a/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java +++ b/testing-modules/rest-testing/src/test/java/com/baeldung/rest/cucumber/StepDefinition.java @@ -20,6 +20,8 @@ import java.io.IOException; import java.io.InputStream; import java.util.Scanner; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; @@ -29,8 +31,6 @@ import org.apache.http.impl.client.HttpClients; import com.github.tomakehurst.wiremock.WireMockServer; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; public class StepDefinition { @@ -66,7 +66,8 @@ public class StepDefinition { wireMockServer.stop(); } - @When("^users want to get information on the (.+) project$") +// @When("^users want to get information on the '(.+)' project$") + @When("users want to get information on the {string} project") public void usersGetInformationOnAProject(String projectName) throws IOException { wireMockServer.start(); @@ -86,11 +87,11 @@ public class StepDefinition { wireMockServer.stop(); } - @Then("^the server should handle it and return a success status$") + @Then("the server should handle it and return a success status") public void theServerShouldReturnASuccessStatus() { } - @Then("^the requested data is returned$") + @Then("the requested data is returned") public void theRequestedDataIsReturned() { } diff --git a/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature b/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature index 99dd8249fe..f8bbd809de 100644 --- a/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature +++ b/testing-modules/rest-testing/src/test/resources/Feature/cucumber.feature @@ -6,5 +6,5 @@ Feature: Testing a REST API Then the server should handle it and return a success status Scenario: Data retrieval from a web service - When users want to get information on the Cucumber project + When users want to get information on the 'Cucumber' project Then the requested data is returned \ No newline at end of file From d48defc3e223c176e41e6f8b7b161ac313b9db8d Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Sat, 3 Oct 2020 08:28:12 +0530 Subject: [PATCH 0875/1862] BAEL-4531 (#10093) * Added code for checking if a class is abstract or not. * Renamed test name as per review comments. --- .../check/abstractclass/AbstractExample.java | 15 +++++++++++++++ .../abstractclass/AbstractExampleUnitTest.java | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/check/abstractclass/AbstractExample.java create mode 100644 core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/check/abstractclass/AbstractExampleUnitTest.java diff --git a/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/check/abstractclass/AbstractExample.java b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/check/abstractclass/AbstractExample.java new file mode 100644 index 0000000000..e8ad3bc3bd --- /dev/null +++ b/core-java-modules/core-java-reflection-2/src/main/java/com/baeldung/reflection/check/abstractclass/AbstractExample.java @@ -0,0 +1,15 @@ +package com.baeldung.reflection.check.abstractclass; + +import java.time.LocalDate; +import java.time.LocalTime; + +public abstract class AbstractExample { + + public static String getAuthorName() { + return "Umang Budhwar"; + } + + public abstract LocalDate getLocalDate(); + + public abstract LocalTime getLocalTime(); +} diff --git a/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/check/abstractclass/AbstractExampleUnitTest.java b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/check/abstractclass/AbstractExampleUnitTest.java new file mode 100644 index 0000000000..cb5d927c23 --- /dev/null +++ b/core-java-modules/core-java-reflection-2/src/test/java/com/baeldung/reflection/check/abstractclass/AbstractExampleUnitTest.java @@ -0,0 +1,16 @@ +package com.baeldung.reflection.check.abstractclass; + +import java.lang.reflect.Modifier; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class AbstractExampleUnitTest { + + @Test + void givenAbstractClass_whenCheckModifierIsAbstract_thenTrue() throws Exception { + Class clazz = AbstractExample.class; + Assertions.assertTrue(Modifier.isAbstract(clazz.getModifiers())); + } + +} From 43ad7afa07acd43c177ac09c81befd01ed79d508 Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Sat, 3 Oct 2020 00:42:54 -0500 Subject: [PATCH 0876/1862] Added code examples from the article. --- .../TransactionalDetectionTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java new file mode 100644 index 0000000000..304704a0a6 --- /dev/null +++ b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java @@ -0,0 +1,28 @@ +package com.baeldung.transactional; + +import com.baeldung.persistence.service.transactional.PersistenceTransactionalTestConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.TransactionSynchronizationManager; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +@ContextConfiguration(classes = PersistenceTransactionalTestConfig.class) +@RunWith(SpringJUnit4ClassRunner.class) +public class TransactionalDetectionTest { + + @Test + @Transactional + public void givenTransactional_whenCheckingForActiveTransaction_thenReceiveTrue() { + assertTrue(TransactionSynchronizationManager.isActualTransactionActive()); + } + + @Test + public void givenNoTransactional_whenCheckingForActiveTransaction_thenReceiveFalse() { + assertFalse(TransactionSynchronizationManager.isActualTransactionActive()); + } +} From b5e0e559e370178199efda67e5509d60bdecac64 Mon Sep 17 00:00:00 2001 From: sharifi Date: Sat, 3 Oct 2020 11:32:38 +0330 Subject: [PATCH 0877/1862] add new module to parent pom --- spring-boot-modules/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/pom.xml b/spring-boot-modules/pom.xml index fa70a9f058..19dfcbb962 100644 --- a/spring-boot-modules/pom.xml +++ b/spring-boot-modules/pom.xml @@ -26,6 +26,7 @@ spring-boot-artifacts spring-boot-autoconfiguration spring-boot-basic-customization + spring-boot-basic-customization-2 spring-boot-bootstrap spring-boot-client spring-boot-config-jpa-error From 7e56ea33036c8748faa9748244cc7a01ba7c9e24 Mon Sep 17 00:00:00 2001 From: sharifi Date: Sat, 3 Oct 2020 11:33:33 +0330 Subject: [PATCH 0878/1862] add README file --- .../spring-boot-basic-customization-2/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/README.md diff --git a/spring-boot-modules/spring-boot-basic-customization-2/README.md b/spring-boot-modules/spring-boot-basic-customization-2/README.md new file mode 100644 index 0000000000..faaee0962e --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/README.md @@ -0,0 +1,7 @@ +## Spring Boot Basic Customization 2 + +This module contains articles about Spring Boot customization 2 + +### Relevant Articles: + + - [DispatcherServlet and web.xml in Spring Boot](https://www.baeldung.com/) From 7ffa8ce6a521c5570b305469f8fd7220f1f3e089 Mon Sep 17 00:00:00 2001 From: sharifi Date: Sat, 3 Oct 2020 11:33:57 +0330 Subject: [PATCH 0879/1862] add gitignore file --- .../.gitignore | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/.gitignore diff --git a/spring-boot-modules/spring-boot-basic-customization-2/.gitignore b/spring-boot-modules/spring-boot-basic-customization-2/.gitignore new file mode 100644 index 0000000000..2af7cefb0a --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/.gitignore @@ -0,0 +1,24 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ \ No newline at end of file From 17d3411f7c61ef40446e397b55a6f2cd4ed9dc55 Mon Sep 17 00:00:00 2001 From: sharifi Date: Sat, 3 Oct 2020 11:35:16 +0330 Subject: [PATCH 0880/1862] add main source --- .../spring-boot-basic-customization-2/pom.xml | 33 +++++++++++++++++++ .../com.baeldung.demo/DemoApplication.java | 15 +++++++++ .../java/com.baeldung.demo/conf/WebConf.java | 29 ++++++++++++++++ .../controller/Controller.java | 15 +++++++++ .../filter/CustomFilter.java | 30 +++++++++++++++++ .../listener/CustomListener.java | 22 +++++++++++++ .../servlet/CustomServlet.java | 29 ++++++++++++++++ .../src/main/resources/application.properties | 2 ++ 8 files changed, 175 insertions(+) create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/pom.xml create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/DemoApplication.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/conf/WebConf.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/controller/Controller.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/filter/CustomFilter.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/listener/CustomListener.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/servlet/CustomServlet.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties diff --git a/spring-boot-modules/spring-boot-basic-customization-2/pom.xml b/spring-boot-modules/spring-boot-basic-customization-2/pom.xml new file mode 100644 index 0000000000..3ce9266ebe --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + + + com.baeldung.spring-boot-modules + spring-boot-modules + 1.0.0-SNAPSHOT + ../ + + + spring-boot-basic-customization-2 + jar + + spring-boot-basic-customization-2 + Module For Spring Boot Basic Customization 2 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/DemoApplication.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/DemoApplication.java new file mode 100644 index 0000000000..9e8148f043 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/DemoApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.demo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.annotation.Configuration; + +@SpringBootApplication +public class DemoApplication { + + public static void main(String[] args) { + SpringApplication.run(DemoApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/conf/WebConf.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/conf/WebConf.java new file mode 100644 index 0000000000..02fcf152f1 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/conf/WebConf.java @@ -0,0 +1,29 @@ +package com.baeldung.demo.conf; + +import com.baeldung.demo.listener.CustomListener; +import com.baeldung.demo.servlet.CustomServlet; +import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.ServletContextListener; + +@Configuration +public class WebConf { + + @Bean + public ServletRegistrationBean customServletBean() { + ServletRegistrationBean bean = + new ServletRegistrationBean(new CustomServlet(), "/servlet"); + return bean; + } + + @Bean + public ServletListenerRegistrationBean customListenerBean() { + ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean(); + bean.setListener(new CustomListener()); + return bean; + } + +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/controller/Controller.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/controller/Controller.java new file mode 100644 index 0000000000..a6d1812511 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/controller/Controller.java @@ -0,0 +1,15 @@ +package com.baeldung.demo.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(value = "/") +public class Controller { + + @GetMapping + public String getRequest(){ + return "Baeldung DispatcherServlet"; + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/filter/CustomFilter.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/filter/CustomFilter.java new file mode 100644 index 0000000000..c661aecf6d --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/filter/CustomFilter.java @@ -0,0 +1,30 @@ +package com.baeldung.demo.filter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.servlet.*; +import java.io.IOException; + +@Component +public class CustomFilter implements Filter { + + Logger logger = LoggerFactory.getLogger(CustomFilter.class); + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + logger.info("CustomFilter is invoked"); + chain.doFilter(request, response); + } + + @Override + public void destroy() { + + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/listener/CustomListener.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/listener/CustomListener.java new file mode 100644 index 0000000000..a9e3ad680f --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/listener/CustomListener.java @@ -0,0 +1,22 @@ +package com.baeldung.demo.listener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +public class CustomListener implements ServletContextListener { + + Logger logger = LoggerFactory.getLogger(CustomListener.class); + + @Override + public void contextInitialized(ServletContextEvent sce) { + logger.info("CustomListener is initialized"); + } + + @Override + public void contextDestroyed(ServletContextEvent sce) { + logger.info("CustomListener is destroyed"); + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/servlet/CustomServlet.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/servlet/CustomServlet.java new file mode 100644 index 0000000000..fd3e92bedc --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/servlet/CustomServlet.java @@ -0,0 +1,29 @@ +package com.baeldung.demo.servlet; + +import com.baeldung.demo.filter.CustomFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class CustomServlet extends HttpServlet { + + Logger logger = LoggerFactory.getLogger(CustomServlet.class); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + logger.info("CustomServlet doGet() method is invoked"); + super.doGet(req, resp); + } + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + logger.info("CustomServlet doPost() method is invoked"); + super.doPost(req, resp); + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties b/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties new file mode 100644 index 0000000000..8c4690dedc --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties @@ -0,0 +1,2 @@ +server.servlet.context-path=/demo +spring.mvc.servlet.path=/baeldung \ No newline at end of file From b37b135504bd5893ac657cced2434f3621b4c256 Mon Sep 17 00:00:00 2001 From: Thibauld Dujardin <22295595+ThibDujardin@users.noreply.github.com> Date: Sat, 3 Oct 2020 16:25:03 +0200 Subject: [PATCH 0881/1862] Add Vavr.Tuple example --- .../java/com/baeldung/vavr/VavrUnitTest.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/vavr/src/test/java/com/baeldung/vavr/VavrUnitTest.java b/vavr/src/test/java/com/baeldung/vavr/VavrUnitTest.java index 7beb75632e..b1a9405605 100644 --- a/vavr/src/test/java/com/baeldung/vavr/VavrUnitTest.java +++ b/vavr/src/test/java/com/baeldung/vavr/VavrUnitTest.java @@ -93,6 +93,37 @@ public class VavrUnitTest { assertEquals("JavaVavr 4", transformed); } + @Test + public void editTupleValueForNewTupleInstance(){ + final Tuple2 java9 = Tuple.of("Java", 8); + final Tuple2 transformed = java9.update2(9); + int num = transformed._2(); + assertEquals(9,num); + } + + @Test + public void editTupleValueForSameInstance(){ + Tuple2 java9 = Tuple.of("Java", 8); + java9 = java9.update2(9); + final int num = java9._2(); + assertEquals(9,num); + } + + @Test + public void getNumberOfElementTuple(){ + Tuple2 java8 = Tuple.of("Java", 8); + Tuple3 java8Triple = Tuple.of("Java", 8, 1.8); + Tuple3 java8TripleWnull = Tuple.of("Java", null, 1.8); + + int num = java8.arity(); + int numTriple = java8Triple.arity(); + int numTripleWnull = java8TripleWnull.arity(); + assertEquals(2,num); + assertEquals(3,numTriple); + assertEquals(3,numTripleWnull); + } + + /* * Functions */ From 23c667077b3d8f6e4e8f74d332be25247accf17e Mon Sep 17 00:00:00 2001 From: Gerardo Roza Date: Sat, 3 Oct 2020 15:59:34 -0300 Subject: [PATCH 0882/1862] updated Keycloak dependencies version to 11.0.2 --- spring-boot-modules/spring-boot-keycloak/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-keycloak/pom.xml b/spring-boot-modules/spring-boot-keycloak/pom.xml index 5049cc3651..cfcdcf2c37 100644 --- a/spring-boot-modules/spring-boot-keycloak/pom.xml +++ b/spring-boot-modules/spring-boot-keycloak/pom.xml @@ -76,7 +76,7 @@ - 10.0.2 + 11.0.2 From 9735c8c093ab13f69d00edef5eac84ca27909ea2 Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Sat, 3 Oct 2020 17:07:52 -0400 Subject: [PATCH 0883/1862] BAEL-4503 --- .../constantspatterns/Calculator.java | 37 +++++++++++++++++++ .../CalculatorConstants.java | 10 +++++ .../constantspatterns/GeometryCalculator.java | 32 ++++++++++++++++ .../calculations/MathConstants.java | 16 ++++++++ .../ConstantPatternUnitTest.java | 23 ++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/Calculator.java create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/CalculatorConstants.java create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/GeometryCalculator.java create mode 100644 core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java create mode 100644 core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/Calculator.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/Calculator.java new file mode 100644 index 0000000000..78b51c1c93 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/Calculator.java @@ -0,0 +1,37 @@ +package com.baeldung.constantspatterns; + +public class Calculator { + public static final double PI = 3.14159265359; + private static final double UPPER_LIMIT = 0x1.fffffffffffffP+1023; + + public enum Operation { + ADD, SUBTRACT, DIVIDE, MULTIPLY + } + + public double operateOnTwoNumbers(double numberOne, double numberTwo, Operation operation) { + if (numberOne > UPPER_LIMIT) { + throw new IllegalArgumentException("'numberOne' is too large"); + } + if (numberTwo > UPPER_LIMIT) { + throw new IllegalArgumentException("'numberTwo' is too large"); + } + double answer = 0; + + switch (operation) { + case ADD: + answer = numberOne + numberTwo; + break; + case SUBTRACT: + answer = numberOne - numberTwo; + break; + case DIVIDE: + answer = numberOne / numberTwo; + break; + case MULTIPLY: + answer = numberOne * numberTwo; + break; + } + + return answer; + } +} diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/CalculatorConstants.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/CalculatorConstants.java new file mode 100644 index 0000000000..2237782b00 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/CalculatorConstants.java @@ -0,0 +1,10 @@ +package com.baeldung.constantspatterns; + +public interface CalculatorConstants { + double PI = 3.14159265359; + double UPPER_LIMIT = 0x1.fffffffffffffP+1023; + + enum Operation { + ADD, SUBTRACT, MULTIPLY, DIVIDE + }; +} diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/GeometryCalculator.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/GeometryCalculator.java new file mode 100644 index 0000000000..47a0dc5233 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/GeometryCalculator.java @@ -0,0 +1,32 @@ +package com.baeldung.constantspatterns; + +public class GeometryCalculator implements CalculatorConstants { + public static final double UPPER_LIMIT = 100000000000000000000.0; + + public double operateOnTwoNumbers(double numberOne, double numberTwo, Operation operation) { + if (numberOne > UPPER_LIMIT) { + throw new IllegalArgumentException("'numberOne' is too large"); + } + if (numberTwo > UPPER_LIMIT) { + throw new IllegalArgumentException("'numberTwo' is too large"); + } + double answer = 0; + + switch (operation) { + case ADD: + answer = numberOne + numberTwo; + break; + case SUBTRACT: + answer = numberOne - numberTwo; + break; + case DIVIDE: + answer = numberOne / numberTwo; + break; + case MULTIPLY: + answer = numberOne * numberTwo; + break; + } + + return answer; + } +} diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java new file mode 100644 index 0000000000..a7ecf7aabe --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java @@ -0,0 +1,16 @@ +package com.baeldung.constantspatterns.calculations; + +public final class MathConstants { + public static final double PI = 3.14159265359; + public static final double GOLDEN_RATIO = 1.6180; + public static final double GRAVITATIONAL_ACCELERATION = 9.8; + public static final double EULERS_NUMBER = 2.7182818284590452353602874713527; + + public enum Operation { + ADD, SUBTRACT, DIVIDE, MULTIPLY + } + + private MathConstants() { + + } +} diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java new file mode 100644 index 0000000000..39cb8f82f9 --- /dev/null +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.constantspatterns; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.Test; + +public class ConstantPatternUnitTest { + @Test + public void givenTwoNumbersAndAdd_whenCallingCalculatorOperatOneTwoNumbers_correctAnswerReturned() { + Calculator calculator = new Calculator(); + double expected = 4; + double answer = calculator.operateOnTwoNumbers(2, 2, Calculator.Operation.ADD); + assertEquals(expected, answer); + } + + @Test + public void givenTwoNumbersAndAdd_whenCallingGeometryCalculatorOperatOneTwoNumbers_correctAnswerReturned() { + GeometryCalculator calculator = new GeometryCalculator(); + double expected = 4; + double answer = calculator.operateOnTwoNumbers(2, 2, GeometryCalculator.Operation.ADD); + assertEquals(expected, answer); + } +} From 969cedfecd6801d2b97a507664802ef0862e6c8a Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Sat, 3 Oct 2020 21:28:40 +0200 Subject: [PATCH 0884/1862] [BAEL-3600] setup initial mantis job --- netflix-modules/mantis/pom.xml | 64 +++++++++++++++++++ .../netflix/mantis/MantisApplication.java | 24 +++++++ .../netflix/mantis/job/LogAggregationJob.java | 30 +++++++++ .../netflix/mantis/job/LogCollectingJob.java | 31 +++++++++ .../netflix/mantis/model/LogAggregate.java | 27 ++++++++ .../netflix/mantis/model/LogEvent.java | 36 +++++++++++ .../baeldung/netflix/mantis/sink/LogSink.java | 37 +++++++++++ .../mantis/source/RandomLogSource.java | 46 +++++++++++++ .../netflix/mantis/stage/CountLogStage.java | 58 +++++++++++++++++ .../netflix/mantis/stage/GroupLogStage.java | 25 ++++++++ .../mantis/stage/TransformLogStage.java | 24 +++++++ netflix-modules/pom.xml | 1 + 12 files changed, 403 insertions(+) create mode 100644 netflix-modules/mantis/pom.xml create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/sink/LogSink.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/source/RandomLogSource.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/CountLogStage.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/GroupLogStage.java create mode 100644 netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/TransformLogStage.java diff --git a/netflix-modules/mantis/pom.xml b/netflix-modules/mantis/pom.xml new file mode 100644 index 0000000000..48151c142f --- /dev/null +++ b/netflix-modules/mantis/pom.xml @@ -0,0 +1,64 @@ + + + 4.0.0 + mantis + Mantis + jar + Sample project for Netflix Mantis + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + + org.springframework.boot + spring-boot-starter + 2.1.3.RELEASE + + + + io.mantisrx + mantis-runtime + 1.2.63 + + + org.slf4j + slf4j-log4j12 + + + + + + com.fasterxml.jackson.core + jackson-databind + 2.10.2 + + + + net.andreinc.mockneat + mockneat + 0.3.8 + + + + org.projectlombok + lombok + 1.18.12 + + + + + + + SpringLibReleaseRepo + https://repo.spring.io/libs-release/ + + + + diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java new file mode 100644 index 0000000000..ad2b7f9aed --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java @@ -0,0 +1,24 @@ +package com.baeldung.netflix.mantis; + +import com.baeldung.netflix.mantis.job.LogAggregationJob; +import com.baeldung.netflix.mantis.job.LogCollectingJob; +import io.mantisrx.runtime.executor.LocalJobExecutorNetworked; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@Slf4j +@SpringBootApplication +public class MantisApplication implements CommandLineRunner { + + public static void main(String[] args) { + SpringApplication.run(MantisApplication.class, args); + } + + @Override + public void run(String... args) { + LocalJobExecutorNetworked.execute(new LogAggregationJob().getJobInstance()); + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java new file mode 100644 index 0000000000..229d11d39d --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java @@ -0,0 +1,30 @@ +package com.baeldung.netflix.mantis.job; + +import com.baeldung.netflix.mantis.model.LogAggregate; +import com.baeldung.netflix.mantis.source.RandomLogSource; +import com.baeldung.netflix.mantis.stage.CountLogStage; +import com.baeldung.netflix.mantis.stage.GroupLogStage; +import com.baeldung.netflix.mantis.stage.TransformLogStage; +import io.mantisrx.runtime.Job; +import io.mantisrx.runtime.MantisJob; +import io.mantisrx.runtime.MantisJobProvider; +import io.mantisrx.runtime.Metadata; +import io.mantisrx.runtime.sink.Sinks; + +public class LogAggregationJob extends MantisJobProvider { + + @Override + public Job getJobInstance() { + + return MantisJob + .source(new RandomLogSource()) + .stage(new TransformLogStage(), TransformLogStage.stageConfig()) + .stage(new GroupLogStage(), GroupLogStage.config()) + .stage(new CountLogStage(), CountLogStage.config()) + .sink(Sinks.eagerSubscribe(Sinks.sse(LogAggregate::toJsonString))) + .metadata(new Metadata.Builder().build()) + .create(); + + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java new file mode 100644 index 0000000000..9bb6ae7f6d --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java @@ -0,0 +1,31 @@ +package com.baeldung.netflix.mantis.job; + +import com.baeldung.netflix.mantis.model.LogEvent; +import com.baeldung.netflix.mantis.sink.LogSink; +import com.baeldung.netflix.mantis.source.RandomLogSource; +import com.baeldung.netflix.mantis.stage.TransformLogStage; +import io.mantisrx.runtime.Job; +import io.mantisrx.runtime.MantisJob; +import io.mantisrx.runtime.MantisJobProvider; +import io.mantisrx.runtime.Metadata; +import io.mantisrx.runtime.ScalarToScalar; +import io.mantisrx.runtime.sink.Sinks; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class LogCollectingJob extends MantisJobProvider { + + @Override + public Job getJobInstance() { + + return MantisJob + .source(new RandomLogSource()) + .stage(new TransformLogStage(), new ScalarToScalar.Config<>()) +// .sink(Sinks.eagerSubscribe(Sinks.sse(LogEvent::toJsonString))) + .sink(new LogSink()) + .metadata(new Metadata.Builder().build()) + .create(); + + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java new file mode 100644 index 0000000000..a9f1818b9a --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java @@ -0,0 +1,27 @@ +package com.baeldung.netflix.mantis.model; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.mantisrx.runtime.codec.JsonType; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class LogAggregate implements JsonType { + + private static final ObjectMapper mapper = new ObjectMapper(); + + private final Integer count; + private final String level; + + public String toJsonString() { + try { + return mapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java new file mode 100644 index 0000000000..36665b0264 --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java @@ -0,0 +1,36 @@ +package com.baeldung.netflix.mantis.model; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.mantisrx.runtime.codec.JsonType; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class LogEvent implements JsonType { + + private static final ObjectMapper mapper = new ObjectMapper(); + + private Long index; + private String level; + private String message; + + public LogEvent(String[] parts) { + this.index = Long.valueOf(parts[0]); + this.level = parts[1]; + this.message = parts[2]; + } + + public String toJsonString() { + try { + return mapper.writeValueAsString(this); + } catch (JsonProcessingException e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/sink/LogSink.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/sink/LogSink.java new file mode 100644 index 0000000000..ae2177bf87 --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/sink/LogSink.java @@ -0,0 +1,37 @@ +package com.baeldung.netflix.mantis.sink; + +import com.baeldung.netflix.mantis.model.LogEvent; +import io.mantisrx.runtime.Context; +import io.mantisrx.runtime.PortRequest; +import io.mantisrx.runtime.sink.SelfDocumentingSink; +import io.mantisrx.runtime.sink.ServerSentEventsSink; +import io.mantisrx.runtime.sink.Sink; +import io.mantisrx.runtime.sink.predicate.Predicate; +import rx.Observable; + +public class LogSink implements Sink { + + @Override + public void call(Context context, PortRequest portRequest, Observable logEventObservable) { + + SelfDocumentingSink sink = new ServerSentEventsSink.Builder() + .withEncoder(LogEvent::toJsonString) + .withPredicate(filterByLogMessage()) + .build(); + + logEventObservable.subscribe(); + + sink.call(context, portRequest, logEventObservable); + } + + private Predicate filterByLogMessage() { + return new Predicate<>("filter by message", + parameters -> { + if (parameters != null && parameters.containsKey("filter")) { + return logEvent -> logEvent.getMessage().contains(parameters.get("filter").get(0)); + } + return logEvent -> true; + }); + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/source/RandomLogSource.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/source/RandomLogSource.java new file mode 100644 index 0000000000..fe607d9866 --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/source/RandomLogSource.java @@ -0,0 +1,46 @@ +package com.baeldung.netflix.mantis.source; + +import io.mantisrx.runtime.Context; +import io.mantisrx.runtime.source.Index; +import io.mantisrx.runtime.source.Source; +import lombok.extern.slf4j.Slf4j; +import net.andreinc.mockneat.MockNeat; +import rx.Observable; + +import java.util.Date; +import java.util.concurrent.TimeUnit; + +@Slf4j +public class RandomLogSource implements Source { + + private MockNeat mockDataGenerator; + + @Override + public void init(Context context, Index index) { + mockDataGenerator = MockNeat.threadLocal(); + } + + @Override + public Observable> call(Context context, Index index) { + return Observable.just( + Observable + .interval(250, TimeUnit.MILLISECONDS) + .map(this::createRandomLogEvent)); + } + + private String createRandomLogEvent(Long tick) { + String level = mockDataGenerator.probabilites(String.class) + .add(0.5, "INFO") + .add(0.3, "WARN") + .add(0.2, "ERROR") + .get(); + + String message = mockDataGenerator.probabilites(String.class) + .add(0.5, "login attempt") + .add(0.5, "user created") + .get(); + + return tick + "#" + level + "#" + message; + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/CountLogStage.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/CountLogStage.java new file mode 100644 index 0000000000..5f02d783d0 --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/CountLogStage.java @@ -0,0 +1,58 @@ +package com.baeldung.netflix.mantis.stage; + +import com.baeldung.netflix.mantis.model.LogAggregate; +import com.baeldung.netflix.mantis.model.LogEvent; +import io.mantisrx.common.MantisGroup; +import io.mantisrx.runtime.Context; +import io.mantisrx.runtime.GroupToScalar; +import io.mantisrx.runtime.codec.JacksonCodecs; +import io.mantisrx.runtime.computation.GroupToScalarComputation; +import io.mantisrx.runtime.parameter.ParameterDefinition; +import io.mantisrx.runtime.parameter.type.IntParameter; +import io.mantisrx.runtime.parameter.validator.Validators; +import rx.Observable; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +public class CountLogStage implements GroupToScalarComputation { + + private int duration; + + @Override + public void init(Context context) { + duration = (int)context.getParameters().get("LogAggregationDuration", 1000); + } + + @Override + public Observable call(Context context, Observable> mantisGroup) { + return mantisGroup + .window(duration, TimeUnit.MILLISECONDS) + .flatMap(o -> o.groupBy(MantisGroup::getKeyValue) + .flatMap(group -> group.reduce(0, (count, value) -> count = count + 1) + .map((count) -> new LogAggregate(count, group.getKey())) + )); + } + + public static GroupToScalar.Config config(){ + return new GroupToScalar.Config() + .description("sum events for a log level") + .codec(JacksonCodecs.pojo(LogAggregate.class)) + .withParameters(getParameters()); + } + + public static List> getParameters() { + List> params = new ArrayList<>(); + + params.add(new IntParameter() + .name("LogAggregationDuration") + .description("window size for aggregation in milliseconds") + .validator(Validators.range(100, 10000)) + .defaultValue(5000) + .build()) ; + + return params; + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/GroupLogStage.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/GroupLogStage.java new file mode 100644 index 0000000000..f21c4aba7d --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/GroupLogStage.java @@ -0,0 +1,25 @@ +package com.baeldung.netflix.mantis.stage; + +import com.baeldung.netflix.mantis.model.LogEvent; +import io.mantisrx.common.MantisGroup; +import io.mantisrx.runtime.Context; +import io.mantisrx.runtime.ScalarToGroup; +import io.mantisrx.runtime.codec.JacksonCodecs; +import io.mantisrx.runtime.computation.ToGroupComputation; +import rx.Observable; + +public class GroupLogStage implements ToGroupComputation { + + @Override + public Observable> call(Context context, Observable logEvent) { + return logEvent.map(log -> new MantisGroup<>(log.getLevel(), log)); + } + + public static ScalarToGroup.Config config(){ + return new ScalarToGroup.Config() + .description("Group event data by level") + .codec(JacksonCodecs.pojo(LogEvent.class)) + .concurrentInput(); + } + +} diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/TransformLogStage.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/TransformLogStage.java new file mode 100644 index 0000000000..33e6567d13 --- /dev/null +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/stage/TransformLogStage.java @@ -0,0 +1,24 @@ +package com.baeldung.netflix.mantis.stage; + +import com.baeldung.netflix.mantis.model.LogEvent; +import io.mantisrx.runtime.Context; +import io.mantisrx.runtime.ScalarToScalar; +import io.mantisrx.runtime.codec.JacksonCodecs; +import io.mantisrx.runtime.computation.ScalarComputation; +import rx.Observable; + +public class TransformLogStage implements ScalarComputation { + + @Override + public Observable call(Context context, Observable logEntry) { + return logEntry + .map(log -> log.split("#")) + .filter(parts -> parts.length == 3) + .map(LogEvent::new); + } + + public static ScalarToScalar.Config stageConfig() { + return new ScalarToScalar.Config() + .codec(JacksonCodecs.pojo(LogEvent.class)); + } +} diff --git a/netflix-modules/pom.xml b/netflix-modules/pom.xml index 9ed22498d8..538126fb34 100644 --- a/netflix-modules/pom.xml +++ b/netflix-modules/pom.xml @@ -15,6 +15,7 @@ genie + mantis \ No newline at end of file From 795bcbe2b78213abcda781536e7d9a3a0b7d8ece Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Sun, 4 Oct 2020 12:53:41 +0200 Subject: [PATCH 0885/1862] [BAEL-3600] small fixes --- .../java/com/baeldung/netflix/mantis/MantisApplication.java | 1 - .../java/com/baeldung/netflix/mantis/job/LogCollectingJob.java | 2 -- .../java/com/baeldung/netflix/mantis/model/LogAggregate.java | 1 - .../main/java/com/baeldung/netflix/mantis/model/LogEvent.java | 1 - 4 files changed, 5 deletions(-) diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java index ad2b7f9aed..d5ffe977c3 100644 --- a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/MantisApplication.java @@ -1,7 +1,6 @@ package com.baeldung.netflix.mantis; import com.baeldung.netflix.mantis.job.LogAggregationJob; -import com.baeldung.netflix.mantis.job.LogCollectingJob; import io.mantisrx.runtime.executor.LocalJobExecutorNetworked; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.CommandLineRunner; diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java index 9bb6ae7f6d..492f30c43a 100644 --- a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java @@ -9,7 +9,6 @@ import io.mantisrx.runtime.MantisJob; import io.mantisrx.runtime.MantisJobProvider; import io.mantisrx.runtime.Metadata; import io.mantisrx.runtime.ScalarToScalar; -import io.mantisrx.runtime.sink.Sinks; import lombok.extern.slf4j.Slf4j; @Slf4j @@ -21,7 +20,6 @@ public class LogCollectingJob extends MantisJobProvider { return MantisJob .source(new RandomLogSource()) .stage(new TransformLogStage(), new ScalarToScalar.Config<>()) -// .sink(Sinks.eagerSubscribe(Sinks.sse(LogEvent::toJsonString))) .sink(new LogSink()) .metadata(new Metadata.Builder().build()) .create(); diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java index a9f1818b9a..0eeb7ea086 100644 --- a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java @@ -19,7 +19,6 @@ public class LogAggregate implements JsonType { try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { - e.printStackTrace(); return null; } } diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java index 36665b0264..a48dfcd5dd 100644 --- a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogEvent.java @@ -28,7 +28,6 @@ public class LogEvent implements JsonType { try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { - e.printStackTrace(); return null; } } From 14593ca02a9a316657a929c1cda6cf664d4beab8 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Sun, 4 Oct 2020 12:55:22 +0200 Subject: [PATCH 0886/1862] Refined bean methods --- .../EmployeeApplication.java | 9 +++++---- .../componentscanautoconfigure/doctor/Doctor.java | 7 ------- .../employee/SeniorEmployee.java | 2 +- .../healthcare/Doctor.java | 9 +++++++++ .../healthcare/Hospital.java | 13 +++++++++++++ 5 files changed, 28 insertions(+), 12 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/doctor/Doctor.java create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Doctor.java create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Hospital.java diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java index d429b0cdc9..578479a81c 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java @@ -8,18 +8,19 @@ import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -@Configuration -@ComponentScan(basePackages = {"com.baeldung.annotations.componentscanautoconfigure.doctor", "com.baeldung.annotations.componentscanautoconfigure.employee"}, +//@Configuration +@ComponentScan(basePackages = {"com.baeldung.annotations.componentscanautoconfigure.healthcare", "com.baeldung.annotations.componentscanautoconfigure.employee"}, basePackageClasses = Teacher.class) -@EnableAutoConfiguration(exclude={JdbcTemplateAutoConfiguration.class}) +@EnableAutoConfiguration(exclude = {JdbcTemplateAutoConfiguration.class}) //@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration"}) public class EmployeeApplication { public static void main(String[] args) { ApplicationContext context = SpringApplication.run(EmployeeApplication.class, args); - System.out.println("Configures Doctor: " + context.containsBeanDefinition("doctor")); System.out.println("Configures Employee: " + context.containsBeanDefinition("employee")); System.out.println("Configures Senior Employee: " + context.containsBeanDefinition("seniorEmployee")); + System.out.println("Configures Doctor: " + context.containsBeanDefinition("doctor")); + System.out.println("Configures Hospital: " + context.containsBeanDefinition("hospital")); System.out.println("Configures Student: " + context.containsBeanDefinition("student")); System.out.println("Configures Teacher: " + context.containsBeanDefinition("teacher")); } diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/doctor/Doctor.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/doctor/Doctor.java deleted file mode 100644 index 40bb68259a..0000000000 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/doctor/Doctor.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.baeldung.annotations.componentscanautoconfigure.doctor; - -import org.springframework.stereotype.Component; - -@Component("doctor") -public class Doctor { -} diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java index fc02a17df6..ef75b4af0a 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java @@ -2,6 +2,6 @@ package com.baeldung.annotations.componentscanautoconfigure.employee; import org.springframework.stereotype.Component; -@Component("seniorEmployee") +@Component public class SeniorEmployee { } diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Doctor.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Doctor.java new file mode 100644 index 0000000000..7e7e6cb03b --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Doctor.java @@ -0,0 +1,9 @@ +package com.baeldung.annotations.componentscanautoconfigure.healthcare; + +public class Doctor { + + @Override + public String toString() { + return "Doctor" + this.hashCode(); + } +} diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Hospital.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Hospital.java new file mode 100644 index 0000000000..0711544060 --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/healthcare/Hospital.java @@ -0,0 +1,13 @@ +package com.baeldung.annotations.componentscanautoconfigure.healthcare; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class Hospital { + + @Bean("doctor") + public Doctor getDoctor() { + return new Doctor(); + } +} From b63aad504835aced570714e85aedfb45c1d5a49b Mon Sep 17 00:00:00 2001 From: Benjamin Caure Date: Mon, 5 Oct 2020 09:50:54 +0200 Subject: [PATCH 0887/1862] BAEL-4436 : move template dir to main/resources (#10100) + configure location from application.properties --- .../configuration/EmailConfiguration.java | 93 +++++++++++++------ .../spring/mail/EmailServiceImpl.java | 2 +- .../src/main/resources/application.properties | 14 ++- .../mail-templates}/template-freemarker.ftl | 0 .../mail-templates}/template-thymeleaf.html | 0 5 files changed, 78 insertions(+), 31 deletions(-) rename spring-mvc-basics-2/src/main/{webapp/WEB-INF/views/mail => resources/mail-templates}/template-freemarker.ftl (100%) rename spring-mvc-basics-2/src/main/{webapp/WEB-INF/views/mail => resources/mail-templates}/template-thymeleaf.html (100%) diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java index 4bd692f609..86a7f1162c 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java @@ -1,37 +1,61 @@ package com.baeldung.spring.configuration; +import freemarker.cache.ClassTemplateLoader; +import freemarker.cache.TemplateLoader; +import freemarker.template.Configuration; import java.util.Properties; - +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.mail.SimpleMailMessage; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; -import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; import org.thymeleaf.spring5.SpringTemplateEngine; -import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver; +import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver; +import org.thymeleaf.templateresolver.ITemplateResolver; -@Configuration @ComponentScan(basePackages = { "com.baeldung.spring.mail" }) +@PropertySource(value={"classpath:application.properties"}) public class EmailConfiguration { + + @Value("${spring.mail.host}") + private String mailServerHost; + + @Value("${spring.mail.port}") + private Integer mailServerPort; + + @Value("${spring.mail.username}") + private String mailServerUsername; + + @Value("${spring.mail.password}") + private String mailServerPassword; + + @Value("${spring.mail.properties.mail.smtp.auth}") + private String mailServerAuth; + + @Value("${spring.mail.properties.mail.smtp.starttls.enable}") + private String mailServerStartTls; + + @Value("${spring.mail.templates.path}") + private String mailTemplatesPath; @Bean public JavaMailSender getJavaMailSender() { JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); - mailSender.setHost("smtp.gmail.com"); - mailSender.setPort(587); + mailSender.setHost(mailServerHost); + mailSender.setPort(mailServerPort); - mailSender.setUsername("my.gmail@gmail.com"); - mailSender.setPassword("password"); + mailSender.setUsername(mailServerUsername); + mailSender.setPassword(mailServerPassword); Properties props = mailSender.getJavaMailProperties(); props.put("mail.transport.protocol", "smtp"); - props.put("mail.smtp.auth", "true"); - props.put("mail.smtp.starttls.enable", "false"); + props.put("mail.smtp.auth", mailServerAuth); + props.put("mail.smtp.starttls.enable", mailServerStartTls); props.put("mail.debug", "true"); return mailSender; @@ -45,39 +69,52 @@ public class EmailConfiguration { } @Bean - public SpringTemplateEngine thymeleafTemplateEngine() { + public SpringTemplateEngine thymeleafTemplateEngine(ITemplateResolver templateResolver) { SpringTemplateEngine templateEngine = new SpringTemplateEngine(); - templateEngine.setTemplateResolver(thymeleafTemplateResolver()); + templateEngine.setTemplateResolver(templateResolver); templateEngine.setTemplateEngineMessageSource(emailMessageSource()); return templateEngine; } @Bean - public SpringResourceTemplateResolver thymeleafTemplateResolver() { - SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver(); - templateResolver.setPrefix("/WEB-INF/views/mail/"); + public ITemplateResolver thymeleafClassLoaderTemplateResolver() { + ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver(); + templateResolver.setPrefix(mailTemplatesPath + "/"); templateResolver.setSuffix(".html"); templateResolver.setTemplateMode("HTML"); templateResolver.setCharacterEncoding("UTF-8"); return templateResolver; } + +// @Bean +// public ITemplateResolver thymeleafFilesystemTemplateResolver() { +// FileTemplateResolver templateResolver = new FileTemplateResolver(); +// templateResolver.setPrefix(mailTemplatesPath + "/"); +// templateResolver.setSuffix(".html"); +// templateResolver.setTemplateMode("HTML"); +// templateResolver.setCharacterEncoding("UTF-8"); +// return templateResolver; +// } @Bean - public FreeMarkerConfigurer freemarkerConfig() { - FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer(); - freeMarkerConfigurer.setTemplateLoaderPath("/WEB-INF/views/mail"); + public FreeMarkerConfigurer freemarkerClassLoaderConfig() { + Configuration configuration = new Configuration(Configuration.VERSION_2_3_27); + TemplateLoader templateLoader = new ClassTemplateLoader(this.getClass(), "/" + mailTemplatesPath); + configuration.setTemplateLoader(templateLoader); + FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer(); + freeMarkerConfigurer.setConfiguration(configuration); return freeMarkerConfigurer; } - @Bean - public FreeMarkerViewResolver freemarkerViewResolver() { - FreeMarkerViewResolver resolver = new FreeMarkerViewResolver(); - resolver.setCache(true); - resolver.setPrefix(""); - resolver.setSuffix(".ftl"); - return resolver; - } - +// @Bean +// public FreeMarkerConfigurer freemarkerFilesystemConfig() throws IOException { +// Configuration configuration = new Configuration(Configuration.VERSION_2_3_27); +// TemplateLoader templateLoader = new FileTemplateLoader(new File(mailTemplatesPath)); +// configuration.setTemplateLoader(templateLoader); +// FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer(); +// freeMarkerConfigurer.setConfiguration(configuration); +// return freeMarkerConfigurer; +// } @Bean public ResourceBundleMessageSource emailMessageSource() { diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java index 1eb7a5f8b4..a0c8907a87 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java @@ -112,7 +112,7 @@ public class EmailServiceImpl implements EmailService { String to, String subject, Map templateModel) throws IOException, TemplateException, MessagingException { - Template freemarkerTemplate = freemarkerConfigurer.createConfiguration().getTemplate("template-freemarker.ftl"); + Template freemarkerTemplate = freemarkerConfigurer.getConfiguration().getTemplate("template-freemarker.ftl"); String htmlBody = FreeMarkerTemplateUtils.processTemplateIntoString(freemarkerTemplate, templateModel); sendHtmlMessage(to, subject, htmlBody); diff --git a/spring-mvc-basics-2/src/main/resources/application.properties b/spring-mvc-basics-2/src/main/resources/application.properties index 9a804c07d8..7ca8d33d5c 100644 --- a/spring-mvc-basics-2/src/main/resources/application.properties +++ b/spring-mvc-basics-2/src/main/resources/application.properties @@ -6,7 +6,7 @@ spring.mail.port=587 spring.mail.username=username spring.mail.password=password spring.mail.properties.mail.smtp.auth=true -spring.mail.properties.mail.smtp.starttls.enable=true +spring.mail.properties.mail.smtp.starttls.enable=false # Amazon SES SMTP #spring.mail.host=email-smtp.us-west-2.amazonaws.com @@ -19,4 +19,14 @@ spring.mail.properties.mail.smtp.starttls.enable=true #spring.mail.properties.mail.smtp.starttls.required=true # path to attachment file -attachment.invoice=path_to_file \ No newline at end of file +attachment.invoice=path_to_file + + +# +# Mail templates +# + +# Templates directory inside main/resources or absolute filesystem path +spring.mail.templates.path=mail-templates +#spring.mail.templates.path=/path/to/templates + diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/template-freemarker.ftl b/spring-mvc-basics-2/src/main/resources/mail-templates/template-freemarker.ftl similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/template-freemarker.ftl rename to spring-mvc-basics-2/src/main/resources/mail-templates/template-freemarker.ftl diff --git a/spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/template-thymeleaf.html b/spring-mvc-basics-2/src/main/resources/mail-templates/template-thymeleaf.html similarity index 100% rename from spring-mvc-basics-2/src/main/webapp/WEB-INF/views/mail/template-thymeleaf.html rename to spring-mvc-basics-2/src/main/resources/mail-templates/template-thymeleaf.html From 2d128104d4c6463d7e1481e3faec441ac4474912 Mon Sep 17 00:00:00 2001 From: rdevarakonda Date: Mon, 5 Oct 2020 18:45:51 +0100 Subject: [PATCH 0888/1862] KTLN-153 | Examples for article + Upgrade Kotlin version to 1.4.0 (#10108) * KTLN-153 | Examples for article + Upgrade Kotlin version to 1.4.0 * KTLN-153 | UNDO Upgrade to Kotlin 1.4.0 * KTLN-153 | Update examples to match the article edits * KTLN-153 | Update examples to match the article edits - 2 Co-authored-by: tpurdeva --- .../baeldung/arguments/DefaultArguments.kt | 37 +++++++++++++++++++ .../com/baeldung/arguments/NamedArguments.kt | 28 ++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/DefaultArguments.kt create mode 100644 core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/NamedArguments.kt diff --git a/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/DefaultArguments.kt b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/DefaultArguments.kt new file mode 100644 index 0000000000..691b3475b4 --- /dev/null +++ b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/DefaultArguments.kt @@ -0,0 +1,37 @@ +package com.baeldung.arguments + +fun main() { + + // Skip both the connectTimeout and enableRetry arguments + connect("http://www.baeldung.com") + + // Skip only the enableRetry argument: + connect("http://www.baeldung.com", 5000) + + // Skip only the middle argument connectTimeout + // connect("http://www.baeldung.com", false) // This results in a compiler error + + // Because we skipped the connectTimeout argument, we must pass the enableRetry as a named argument + connect("http://www.baeldung.com", enableRetry = false) + + // Overriding Functions and Default Arguments + val realConnector = RealConnector() + realConnector.connect("www.baeldung.com") + realConnector.connect() +} + +fun connect(url: String, connectTimeout: Int = 1000, enableRetry: Boolean = true) { + println("The parameters are url = $url, connectTimeout = $connectTimeout, enableRetry = $enableRetry") +} + +open class AbstractConnector { + open fun connect(url: String = "localhost") { + // function implementation + } +} + +class RealConnector : AbstractConnector() { + override fun connect(url: String) { + println("The parameter is url = $url") + } +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/NamedArguments.kt b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/NamedArguments.kt new file mode 100644 index 0000000000..0cbf6f158a --- /dev/null +++ b/core-kotlin-modules/core-kotlin/src/main/kotlin/com/baeldung/arguments/NamedArguments.kt @@ -0,0 +1,28 @@ +package com.baeldung.arguments + +fun main() { + resizePane(newSize = 10, forceResize = true, noAnimation = false) + + // Swap the order of last two named arguments + resizePane(newSize = 11, noAnimation = false, forceResize = true) + + // Named arguments can be passed in any order + resizePane(forceResize = true, newSize = 12, noAnimation = false) + + // Mixing Named and Positional Arguments + // Kotlin 1.3 would allow us to name only the arguments after the positional ones + resizePane(20, true, noAnimation = false) + + // Using a positional argument in the middle of named arguments (supported from Kotlin 1.4.0) + // resizePane(newSize = 20, true, noAnimation = false) + + // Only the last argument as a positional argument (supported from Kotlin 1.4.0) + // resizePane(newSize = 30, forceResize = true, false) + + // Use a named argument in the middle of positional arguments (supported from Kotlin 1.4.0) + // resizePane(40, forceResize = true, false) +} + +fun resizePane(newSize: Int, forceResize: Boolean, noAnimation: Boolean) { + println("The parameters are newSize = $newSize, forceResize = $forceResize, noAnimation = $noAnimation") +} \ No newline at end of file From 90382576f6aeac397a968e28b167e6cdd1bda81b Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 6 Oct 2020 08:08:09 +0200 Subject: [PATCH 0889/1862] BAEL-4661: Add an example of creating a file using FileOutputStream (#10131) --- .../java/com/baeldung/createfile/CreateFileUnitTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java index f3cdb22f4d..f26a1ab3ad 100644 --- a/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java +++ b/core-java-modules/core-java-io-3/src/test/java/com/baeldung/createfile/CreateFileUnitTest.java @@ -6,6 +6,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -37,6 +38,12 @@ public class CreateFileUnitTest { assertTrue(success); } + @Test + void givenUsingFileOutputStream_whenCreatingFile_thenCorrect() throws IOException { + try(FileOutputStream fileOutputStream = new FileOutputStream(FILE_NAME)){ + } + } + @Test public void givenUsingGuava_whenCreatingFile_thenCorrect() throws IOException { com.google.common.io.Files.touch(new File(FILE_NAME)); From 542c52081bea594deac649f2925dc30099e2394c Mon Sep 17 00:00:00 2001 From: Philippe Date: Tue, 6 Oct 2020 17:03:49 -0300 Subject: [PATCH 0890/1862] [BAEL-4203] Rename jni module to java-native --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ac1a16a728..cba7e33b03 100644 --- a/pom.xml +++ b/pom.xml @@ -977,7 +977,7 @@ jjwt jmeter jmh - jni + java-native jooby jsf json From bd53673e2b175f9450829b20e5e81394ab7b0ac3 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Tue, 6 Oct 2020 22:33:24 +0200 Subject: [PATCH 0891/1862] Added unit test --- .../EmployeeApplication.java | 8 +++---- .../EmployeeApplicationTest.java | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) rename spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/{componentscanautoconfigure => }/EmployeeApplication.java (86%) create mode 100644 spring-boot-modules/spring-boot-annotations/src/main/test/com.baeldung.annotations/EmployeeApplicationTest.java diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java similarity index 86% rename from spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java rename to spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java index 578479a81c..263df30e16 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/EmployeeApplication.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.annotations.componentscanautoconfigure; +package com.baeldung.annotations; import com.baeldung.annotations.componentscanautoconfigure.teacher.Teacher; import org.springframework.boot.SpringApplication; @@ -6,15 +6,13 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -//@Configuration -@ComponentScan(basePackages = {"com.baeldung.annotations.componentscanautoconfigure.healthcare", "com.baeldung.annotations.componentscanautoconfigure.employee"}, +@ComponentScan(basePackages = {"com.baeldung.annotations.componentscanautoconfigure.healthcare", + "com.baeldung.annotations.componentscanautoconfigure.employee"}, basePackageClasses = Teacher.class) @EnableAutoConfiguration(exclude = {JdbcTemplateAutoConfiguration.class}) //@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration"}) public class EmployeeApplication { - public static void main(String[] args) { ApplicationContext context = SpringApplication.run(EmployeeApplication.class, args); System.out.println("Configures Employee: " + context.containsBeanDefinition("employee")); diff --git a/spring-boot-modules/spring-boot-annotations/src/main/test/com.baeldung.annotations/EmployeeApplicationTest.java b/spring-boot-modules/spring-boot-annotations/src/main/test/com.baeldung.annotations/EmployeeApplicationTest.java new file mode 100644 index 0000000000..66700cf781 --- /dev/null +++ b/spring-boot-modules/spring-boot-annotations/src/main/test/com.baeldung.annotations/EmployeeApplicationTest.java @@ -0,0 +1,23 @@ +package com.baeldung.annotations; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertAll; + +public class EmployeeApplicationTest { + private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() + .withUserConfiguration(EmployeeApplication.class); + + @Test + void whenApplicationContextRuns_thenContainAllDefinedBeans() { + contextRunner.run(context -> assertAll( + () -> assertTrue(context.containsBeanDefinition("employee")), + () -> assertTrue(context.containsBeanDefinition("seniorEmployee")), + () -> assertTrue(context.containsBeanDefinition("doctor")), + () -> assertTrue(context.containsBeanDefinition("hospital")), + () -> assertFalse(context.containsBeanDefinition("student")), + () -> assertTrue(context.containsBeanDefinition("teacher")))); + } +} From d27cbbc4a6507d3ba0a76057c34cd6cdf4b21e8c Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Wed, 7 Oct 2020 09:32:33 +0200 Subject: [PATCH 0892/1862] Removed boilerplate code --- .../com/baeldung/annotations/EmployeeApplication.java | 8 +------- .../componentscanautoconfigure/employee/Employee.java | 5 +++++ .../employee/SeniorEmployee.java | 5 +++++ .../componentscanautoconfigure/student/Student.java | 5 +++++ .../componentscanautoconfigure/teacher/Teacher.java | 5 +++++ 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java index 263df30e16..17c7af858b 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/EmployeeApplication.java @@ -14,12 +14,6 @@ import org.springframework.context.annotation.ComponentScan; //@EnableAutoConfiguration(excludeName = {"org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration"}) public class EmployeeApplication { public static void main(String[] args) { - ApplicationContext context = SpringApplication.run(EmployeeApplication.class, args); - System.out.println("Configures Employee: " + context.containsBeanDefinition("employee")); - System.out.println("Configures Senior Employee: " + context.containsBeanDefinition("seniorEmployee")); - System.out.println("Configures Doctor: " + context.containsBeanDefinition("doctor")); - System.out.println("Configures Hospital: " + context.containsBeanDefinition("hospital")); - System.out.println("Configures Student: " + context.containsBeanDefinition("student")); - System.out.println("Configures Teacher: " + context.containsBeanDefinition("teacher")); + SpringApplication.run(EmployeeApplication.class, args); } } diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java index bdc0b3f2d9..9be3388046 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/Employee.java @@ -4,4 +4,9 @@ import org.springframework.stereotype.Component; @Component("employee") public class Employee { + + @Override + public String toString() { + return "Employee" + this.hashCode(); + } } diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java index ef75b4af0a..242e84f887 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/employee/SeniorEmployee.java @@ -4,4 +4,9 @@ import org.springframework.stereotype.Component; @Component public class SeniorEmployee { + + @Override + public String toString() { + return "Senior Employee" + this.hashCode(); + } } diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java index 820d0bea10..56f2ac9830 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/student/Student.java @@ -4,4 +4,9 @@ import org.springframework.stereotype.Component; @Component("student") public class Student { + + @Override + public String toString() { + return "Student" + this.hashCode(); + } } diff --git a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java index 699b8ccfb4..e2c653204d 100644 --- a/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java +++ b/spring-boot-modules/spring-boot-annotations/src/main/java/com/baeldung/annotations/componentscanautoconfigure/teacher/Teacher.java @@ -4,4 +4,9 @@ import org.springframework.stereotype.Component; @Component("teacher") public class Teacher { + + @Override + public String toString() { + return "Teacher" + this.hashCode(); + } } From cfa4438c78f0b1a02321955d1b2e8448537a06f6 Mon Sep 17 00:00:00 2001 From: catull Date: Wed, 7 Oct 2020 10:21:11 +0200 Subject: [PATCH 0893/1862] Eliminate duplicate dependency spring-boot-starter-web --- persistence-modules/spring-data-jpa-crud/pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/persistence-modules/spring-data-jpa-crud/pom.xml b/persistence-modules/spring-data-jpa-crud/pom.xml index 44944298e0..7af5b38a38 100644 --- a/persistence-modules/spring-data-jpa-crud/pom.xml +++ b/persistence-modules/spring-data-jpa-crud/pom.xml @@ -16,10 +16,6 @@ - - org.springframework.boot - spring-boot-starter-web - org.springframework.boot spring-boot-starter-data-jpa From a1229f66e4096650853326c9ac1ee0bd73fe1e68 Mon Sep 17 00:00:00 2001 From: Nikolaos Themelis <29039541+tjrbrom@users.noreply.github.com> Date: Wed, 7 Oct 2020 11:41:31 +0300 Subject: [PATCH 0894/1862] Pass unused "millis" argument to lock.tryLock method, line 76. --- .../java/com/baeldung/deadlockAndLivelock/LivelockExample.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/deadlockAndLivelock/LivelockExample.java b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/deadlockAndLivelock/LivelockExample.java index b0d66a92c2..7c3ea6f94e 100644 --- a/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/deadlockAndLivelock/LivelockExample.java +++ b/core-java-modules/core-java-concurrency-advanced-3/src/main/java/com/baeldung/deadlockAndLivelock/LivelockExample.java @@ -73,7 +73,7 @@ public class LivelockExample { public void tryLock(Lock lock, long millis) { try { - lock.tryLock(10, TimeUnit.MILLISECONDS); + lock.tryLock(millis, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } From d970484275700d9ffc9d83e30ad80d4e09b598be Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Wed, 7 Oct 2020 10:47:15 +0200 Subject: [PATCH 0895/1862] BAEL-4657: Add BasicAuthRequestInterceptor example --- .../cloud/openfeign/config/ClientConfiguration.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java b/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java index 0b16134e92..55c27dde2f 100644 --- a/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java +++ b/spring-cloud/spring-cloud-openfeign/src/main/java/com/baeldung/cloud/openfeign/config/ClientConfiguration.java @@ -2,6 +2,7 @@ package com.baeldung.cloud.openfeign.config; import feign.Logger; import feign.RequestInterceptor; +import feign.auth.BasicAuthRequestInterceptor; import feign.codec.ErrorDecoder; import feign.okhttp.OkHttpClient; import org.apache.http.entity.ContentType; @@ -34,4 +35,9 @@ public class ClientConfiguration { requestTemplate.header("Accept", ContentType.APPLICATION_JSON.getMimeType()); }; } + + // @Bean - uncomment to use this interceptor and remove @Bean from the requestInterceptor() + public BasicAuthRequestInterceptor basicAuthRequestInterceptor() { + return new BasicAuthRequestInterceptor("ajeje", "brazof"); + } } From 4947f541ea5cc77650a61163b7b5499ca844ca24 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:15:44 +0800 Subject: [PATCH 0896/1862] Update README.md --- libraries-6/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-6/README.md b/libraries-6/README.md index 3748522b9d..5be600f50e 100644 --- a/libraries-6/README.md +++ b/libraries-6/README.md @@ -16,4 +16,5 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m - [Exactly Once Processing in Kafka](https://www.baeldung.com/kafka-exactly-once) - [Introduction to Protonpack](https://www.baeldung.com/java-protonpack) - [Java-R Integration](https://www.baeldung.com/java-r-integration) +- [Using libphonenumber to Validate Phone Numbers](https://www.baeldung.com/java-libphonenumber) - More articles [[<-- prev]](/libraries-5) From b1cdcff9c17e1fb4bcd43e09b8afc899ace4851a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:17:12 +0800 Subject: [PATCH 0897/1862] Update README.md --- java-native/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-native/README.md b/java-native/README.md index 6b984e6590..2e2047924b 100644 --- a/java-native/README.md +++ b/java-native/README.md @@ -5,3 +5,4 @@ This module contains articles about the Java Native Interface (JNI). ### Relevant Articles: - [Guide to JNI (Java Native Interface)](https://www.baeldung.com/jni) +- [Using JNA to Access Native Dynamic Libraries](https://www.baeldung.com/java-jna-dynamic-libraries) From 9d8d8a6587c1fc8efbf9d16ac9b8f0b87f136f7e Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:18:48 +0800 Subject: [PATCH 0898/1862] Update README.md --- core-java-modules/core-java-reflection-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-reflection-2/README.md b/core-java-modules/core-java-reflection-2/README.md index 1668eeade3..9ed14f08dc 100644 --- a/core-java-modules/core-java-reflection-2/README.md +++ b/core-java-modules/core-java-reflection-2/README.md @@ -3,3 +3,4 @@ - [Reading the Value of ‘private’ Fields from a Different Class in Java](https://www.baeldung.com/java-reflection-read-private-field-value) - [Set Field Value With Reflection](https://www.baeldung.com/java-set-private-field-value) - [Checking If a Method is Static Using Reflection in Java](https://www.baeldung.com/java-check-method-is-static) +- [Checking if a Java Class is ‘abstract’ Using Reflection](https://www.baeldung.com/java-reflection-is-class-abstract) From 3ebd90bfd762b5d6cbf70aa1e3236047c7f576f0 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:21:34 +0800 Subject: [PATCH 0899/1862] Update README.md --- spring-cloud/spring-cloud-openfeign/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud/spring-cloud-openfeign/README.md b/spring-cloud/spring-cloud-openfeign/README.md index e5777732e4..735903db72 100644 --- a/spring-cloud/spring-cloud-openfeign/README.md +++ b/spring-cloud/spring-cloud-openfeign/README.md @@ -1,4 +1,4 @@ ### Relevant Articles: - [Introduction to Spring Cloud OpenFeign](https://www.baeldung.com/spring-cloud-openfeign) - +- [Differences Between Netflix Feign and OpenFeign](https://www.baeldung.com/netflix-feign-vs-openfeign) From 962063264a958a1878f9d2689a0f99bb87c0ae79 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:22:49 +0800 Subject: [PATCH 0900/1862] Create README.md --- spring-cloud/spring-cloud-netflix-feign/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 spring-cloud/spring-cloud-netflix-feign/README.md diff --git a/spring-cloud/spring-cloud-netflix-feign/README.md b/spring-cloud/spring-cloud-netflix-feign/README.md new file mode 100644 index 0000000000..28dfc88a43 --- /dev/null +++ b/spring-cloud/spring-cloud-netflix-feign/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [https://www.baeldung.com/netflix-feign-vs-openfeign](https://www.baeldung.com/netflix-feign-vs-openfeign) From c1238eec639af814f79297b45b86a1ba86b15204 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:23:20 +0800 Subject: [PATCH 0901/1862] Update README.md --- spring-cloud/spring-cloud-netflix-feign/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud/spring-cloud-netflix-feign/README.md b/spring-cloud/spring-cloud-netflix-feign/README.md index 28dfc88a43..2e96a0045d 100644 --- a/spring-cloud/spring-cloud-netflix-feign/README.md +++ b/spring-cloud/spring-cloud-netflix-feign/README.md @@ -1,3 +1,3 @@ ### Relevant Articles: -- [https://www.baeldung.com/netflix-feign-vs-openfeign](https://www.baeldung.com/netflix-feign-vs-openfeign) +- [Differences Between Netflix Feign and OpenFeign](https://www.baeldung.com/netflix-feign-vs-openfeign) From b24db3ed9986b220d08d82354b481b25a472b358 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:27:34 +0800 Subject: [PATCH 0902/1862] Update README.md --- spring-boot-modules/spring-boot-libraries-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-libraries-2/README.md b/spring-boot-modules/spring-boot-libraries-2/README.md index b0840798e3..4218dfc1be 100644 --- a/spring-boot-modules/spring-boot-libraries-2/README.md +++ b/spring-boot-modules/spring-boot-libraries-2/README.md @@ -4,4 +4,4 @@ This module contains articles about various Spring Boot libraries ### Relevant Articles: -- Running background jobs in Spring with JobRunr +- [Background Jobs in Spring with JobRunr](https://www.baeldung.com/java-jobrunr-spring) From ac480ad0cc18a6c07c7c943806189f42c8758439 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:29:57 +0800 Subject: [PATCH 0903/1862] Update README.md --- core-java-modules/core-java-concurrency-basic-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-concurrency-basic-2/README.md b/core-java-modules/core-java-concurrency-basic-2/README.md index a8daf14ea9..bf973f7036 100644 --- a/core-java-modules/core-java-concurrency-basic-2/README.md +++ b/core-java-modules/core-java-concurrency-basic-2/README.md @@ -11,4 +11,5 @@ This module contains articles about basic Java concurrency - [Life Cycle of a Thread in Java](https://www.baeldung.com/java-thread-lifecycle) - [Guide to AtomicMarkableReference](https://www.baeldung.com/java-atomicmarkablereference) - [Why are Local Variables Thread-Safe in Java](https://www.baeldung.com/java-local-variables-thread-safe) +- [How to Stop Execution After a Certain Time in Java](https://www.baeldung.com/java-stop-execution-after-certain-time) - [[<-- Prev]](/core-java-modules/core-java-concurrency-basic) From 539324181f8be0bd88324b347a0eb12cf0f45207 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:32:44 +0800 Subject: [PATCH 0904/1862] Update README.md --- persistence-modules/spring-boot-persistence-h2/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persistence-modules/spring-boot-persistence-h2/README.md b/persistence-modules/spring-boot-persistence-h2/README.md index d11ec1f409..1d47907a98 100644 --- a/persistence-modules/spring-boot-persistence-h2/README.md +++ b/persistence-modules/spring-boot-persistence-h2/README.md @@ -1,5 +1,7 @@ ### Relevant Articles: + - [Access the Same In-Memory H2 Database in Multiple Spring Boot Applications](https://www.baeldung.com/spring-boot-access-h2-database-multiple-apps) - [Spring Boot With H2 Database](https://www.baeldung.com/spring-boot-h2-database) - [Hibernate @NotNull vs @Column(nullable = false)](https://www.baeldung.com/hibernate-notnull-vs-nullable) - [Quick Guide to Hibernate enable_lazy_load_no_trans Property](https://www.baeldung.com/hibernate-lazy-loading-workaround) +- [Where Does H2’s Embedded Database Store The Data?](https://www.baeldung.com/h2-embedded-db-data-storage) From b69c36f2d6577a939046b2c60bec3cf204888d55 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 7 Oct 2020 17:41:09 +0800 Subject: [PATCH 0905/1862] Update README.md --- core-kotlin-modules/core-kotlin/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-kotlin-modules/core-kotlin/README.md b/core-kotlin-modules/core-kotlin/README.md index 33f8745937..a890658e95 100644 --- a/core-kotlin-modules/core-kotlin/README.md +++ b/core-kotlin-modules/core-kotlin/README.md @@ -12,3 +12,4 @@ This module contains articles about Kotlin core features. - [Sequences in Kotlin](https://www.baeldung.com/kotlin/sequences) - [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class) - [Exception Handling in Kotlin](https://www.baeldung.com/kotlin/exception-handling) +- [Quick Guide to Kotlin Default and Named Arguments](https://www.baeldung.com/kotlin/default-named-arguments) From 9ee0ab2af0b68a2341962c5e8d9dce0e91ea2d26 Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Wed, 7 Oct 2020 23:13:14 -0500 Subject: [PATCH 0906/1862] Fixed test code after merge from master. --- persistence-modules/spring-persistence-simple/pom.xml | 6 ++++++ .../baeldung/transactional/TransactionalDetectionTest.java | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml index a069f70994..13898d01e7 100644 --- a/persistence-modules/spring-persistence-simple/pom.xml +++ b/persistence-modules/spring-persistence-simple/pom.xml @@ -72,6 +72,12 @@ ${org.springframework.version} test + + org.springframework.boot + spring-boot-starter-test + test + ${spring-boot-starter.version} + org.mockito mockito-core diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java index 304704a0a6..d82aed86b8 100644 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java +++ b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java @@ -1,9 +1,8 @@ package com.baeldung.transactional; -import com.baeldung.persistence.service.transactional.PersistenceTransactionalTestConfig; import org.junit.Test; import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionSynchronizationManager; @@ -11,7 +10,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -@ContextConfiguration(classes = PersistenceTransactionalTestConfig.class) +@SpringBootApplication @RunWith(SpringJUnit4ClassRunner.class) public class TransactionalDetectionTest { From e126cc2287831e32fd9d3681b42bb1f8259b2682 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 8 Oct 2020 14:12:45 +0800 Subject: [PATCH 0907/1862] Update README.md --- persistence-modules/spring-jpa-2/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/persistence-modules/spring-jpa-2/README.md b/persistence-modules/spring-jpa-2/README.md index fe661c2f28..59543cade7 100644 --- a/persistence-modules/spring-jpa-2/README.md +++ b/persistence-modules/spring-jpa-2/README.md @@ -3,8 +3,7 @@ ### Relevant Articles: - [Many-To-Many Relationship in JPA](https://www.baeldung.com/jpa-many-to-many) - [A Guide to JPA with Spring](https://www.baeldung.com/the-persistence-layer-with-spring-and-jpa) -- [Bootstrapping Hibernate 5 with Spring](https://www.baeldung.com/hibernate-5-spring) - [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) - [The DAO with Spring and Hibernate](https://www.baeldung.com/persistence-layer-with-spring-and-hibernate) - [Simplify the DAO with Spring and Java Generics](https://www.baeldung.com/simplifying-the-data-access-layer-with-spring-and-java-generics) -- More articles: [[<-- prev]](/spring-jpa) \ No newline at end of file +- More articles: [[<-- prev]](/spring-jpa) From d4ccef2d443fd8c11cbbd899f62754217883eaa4 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 8 Oct 2020 14:14:07 +0800 Subject: [PATCH 0908/1862] Update README.md --- persistence-modules/spring-hibernate-5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-hibernate-5/README.md b/persistence-modules/spring-hibernate-5/README.md index cb227592f6..eff59a0362 100644 --- a/persistence-modules/spring-hibernate-5/README.md +++ b/persistence-modules/spring-hibernate-5/README.md @@ -13,3 +13,4 @@ This module contains articles about Hibernate 5 with Spring. - [Deleting Objects with Hibernate](http://www.baeldung.com/delete-with-hibernate) - [Spring, Hibernate and a JNDI Datasource](http://www.baeldung.com/spring-persistence-jpa-jndi-datasource) - [@Immutable in Hibernate](http://www.baeldung.com/hibernate-immutable) +- [Bootstrapping Hibernate 5 with Spring](https://www.baeldung.com/hibernate-5-spring) From b67de9d7a24d88d6f2e16d6f46e1ec1187a51a76 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 8 Oct 2020 14:27:59 +0800 Subject: [PATCH 0909/1862] Update README.md --- spring-security-modules/spring-security-web-login/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-login/README.md b/spring-security-modules/spring-security-web-login/README.md index 5d92a8e1b4..9521a430c2 100644 --- a/spring-security-modules/spring-security-web-login/README.md +++ b/spring-security-modules/spring-security-web-login/README.md @@ -8,7 +8,6 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com ### Relevant Articles: - [Spring Security Form Login](https://www.baeldung.com/spring-security-login) - [Spring Security Logout](https://www.baeldung.com/spring-security-logout) -- [Spring Security Expressions – hasRole Example](https://www.baeldung.com/spring-security-expressions-basic) - [Spring HTTP/HTTPS Channel Security](https://www.baeldung.com/spring-channel-security-https) - [Spring Security – Customize the 403 Forbidden/Access Denied Page](https://www.baeldung.com/spring-security-custom-access-denied-page) - [Spring Security – Redirect to the Previous URL After Login](https://www.baeldung.com/spring-security-redirect-login) From 5774d7526656cb9fe26496576e97ca0e77437b0b Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 8 Oct 2020 14:38:49 +0800 Subject: [PATCH 0910/1862] Update README.md --- spring-security-modules/spring-security-web-rest/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-rest/README.md b/spring-security-modules/spring-security-web-rest/README.md index c13668798d..fd1f86f6b8 100644 --- a/spring-security-modules/spring-security-web-rest/README.md +++ b/spring-security-modules/spring-security-web-rest/README.md @@ -14,5 +14,4 @@ The "Learn Spring Security" Classes: http://github.learnspringsecurity.com - [Spring Security Context Propagation with @Async](https://www.baeldung.com/spring-security-async-principal-propagation) - [Servlet 3 Async Support with Spring MVC and Spring Security](https://www.baeldung.com/spring-mvc-async-security) - [Intro to Spring Security Expressions](https://www.baeldung.com/spring-security-expressions) -- [Spring Security Expressions - hasRole Example](https://www.baeldung.com/spring-security-expressions-basic) - [Error Handling for REST with Spring](https://www.baeldung.com/exception-handling-for-rest-with-spring) From 8b3b51c8c12bc23ba35c0f00be2bc90a2fb777bb Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 8 Oct 2020 14:56:50 +0800 Subject: [PATCH 0911/1862] Update README.md --- persistence-modules/spring-persistence-simple/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index baa9107f4e..8bef16868d 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -6,7 +6,7 @@ ### Relevant Articles: - [Transaction Propagation and Isolation in Spring @Transactional](https://www.baeldung.com/spring-transactional-propagation-isolation) - [JTA Transaction with Spring](https://www.baeldung.com/spring-vs-jta-transactional) -- [Mock JNDI Datasource](https://www.baeldung.com/spring-mock-jndi-datasource) +- [Test a Mock JNDI Datasource with Spring](https://www.baeldung.com/spring-mock-jndi-datasource) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From dc2fb66c6e2c2ca0db46546e34892b7e0d814c45 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 8 Oct 2020 18:23:11 +0800 Subject: [PATCH 0912/1862] Create README.md --- docker/docker-spring-boot/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docker/docker-spring-boot/README.md diff --git a/docker/docker-spring-boot/README.md b/docker/docker-spring-boot/README.md new file mode 100644 index 0000000000..4af9378290 --- /dev/null +++ b/docker/docker-spring-boot/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Creating Docker Images with Spring Boot](https://www.baeldung.com/spring-boot-docker-images) From 9f5144ce3329091170e632f5007065b1aed75c7f Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 8 Oct 2020 18:23:49 +0800 Subject: [PATCH 0913/1862] Update README.md --- docker/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 8e5cc2b621..7948b3d663 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,4 +1,3 @@ ## Relevant Articles: - [Introduction to Docker Compose](https://www.baeldung.com/docker-compose) -- [Creating Docker Images with Spring Boot](https://www.baeldung.com/spring-boot-docker-images) From 7afe0a51ca08a4b4809c4dd53c1cd34a1dba306e Mon Sep 17 00:00:00 2001 From: Jordan Simpson Date: Thu, 8 Oct 2020 08:42:56 -0500 Subject: [PATCH 0914/1862] Added "Unit" to the class name to satisfy the pmd.xml violation. --- ...alDetectionTest.java => TransactionalDetectionUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/{TransactionalDetectionTest.java => TransactionalDetectionUnitTest.java} (95%) diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionUnitTest.java similarity index 95% rename from persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java rename to persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionUnitTest.java index d82aed86b8..db4dbd630a 100644 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionTest.java +++ b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/transactional/TransactionalDetectionUnitTest.java @@ -12,7 +12,7 @@ import static org.junit.Assert.assertTrue; @SpringBootApplication @RunWith(SpringJUnit4ClassRunner.class) -public class TransactionalDetectionTest { +public class TransactionalDetectionUnitTest { @Test @Transactional From 53609d6594c8c6888b64572ac2c1c40c3b379bc6 Mon Sep 17 00:00:00 2001 From: mdabrowski-eu <57441874+mdabrowski-eu@users.noreply.github.com> Date: Fri, 9 Oct 2020 06:59:51 +0200 Subject: [PATCH 0915/1862] BAEL-4565 Object States in Hibernate's Session (#10107) --- .../java/com/baeldung/states/Application.java | 12 ++ .../java/com/baeldung/states/UserEntity.java | 27 ++++ .../states/UserEntityWithCascade.java | 28 ++++ .../states/UserEntityIntegrationTest.java | 136 ++++++++++++++++++ 4 files changed, 203 insertions(+) create mode 100644 persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/Application.java create mode 100644 persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntity.java create mode 100644 persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntityWithCascade.java create mode 100644 persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/states/UserEntityIntegrationTest.java diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/Application.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/Application.java new file mode 100644 index 0000000000..38118354e0 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/Application.java @@ -0,0 +1,12 @@ +package com.baeldung.states; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntity.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntity.java new file mode 100644 index 0000000000..90bd275240 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntity.java @@ -0,0 +1,27 @@ +package com.baeldung.states; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class UserEntity { + @Id + private String name; + + @ManyToOne + private UserEntity manager; + + public UserEntity(String name) { + this.name = name; + } +} diff --git a/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntityWithCascade.java b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntityWithCascade.java new file mode 100644 index 0000000000..de0d62bfe2 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-2/src/main/java/com/baeldung/states/UserEntityWithCascade.java @@ -0,0 +1,28 @@ +package com.baeldung.states; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import javax.persistence.CascadeType; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +@AllArgsConstructor +@NoArgsConstructor +@Getter +@Setter +public class UserEntityWithCascade { + @Id + private String name; + + @ManyToOne(cascade = CascadeType.PERSIST) + private UserEntityWithCascade manager; + + public UserEntityWithCascade(String name) { + this.name = name; + } +} diff --git a/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/states/UserEntityIntegrationTest.java b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/states/UserEntityIntegrationTest.java new file mode 100644 index 0000000000..5d0dc99ad7 --- /dev/null +++ b/persistence-modules/spring-boot-persistence-2/src/test/java/com/baeldung/states/UserEntityIntegrationTest.java @@ -0,0 +1,136 @@ +package com.baeldung.states; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.Transaction; +import org.junit.jupiter.api.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import javax.persistence.EntityManagerFactory; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +@RunWith(SpringRunner.class) +@SpringBootTest +class UserEntityIntegrationTest { + @Autowired + private EntityManagerFactory entityManagerFactory; + + @Test + void givenName_thenShouldCreateDetachedUserEntity() { + // given + Session session = openSession(); + UserEntity userEntity = new UserEntity("John"); + + // then + assertThat(session.contains(userEntity)).isFalse(); + session.close(); + } + + @Test + void givenName_whenPersisted_thenShouldCreatePersistentUserEntity() { + // given + Session session = openSession(); + UserEntity userEntity = new UserEntity("John"); + + // when + session.persist(userEntity); + + // then + assertThat(session.contains(userEntity)).isTrue(); + session.close(); + } + + @Test + void givenPersistentEntity_whenSessionClosed_thenShouldDetachEntity() { + // given + Session session = openSession(); + UserEntity userEntity = new UserEntity("John"); + session.persist(userEntity); + assertThat(session.contains(userEntity)).isTrue(); + + // when + session.close(); + + // then + assertThat(session.isOpen()).isFalse(); + assertThatThrownBy(() -> session.contains(userEntity)); + } + + @Test + void givenPersistentEntity_whenAddedTransientManager_thenShouldThrowException() { + // given + Session session = openSession(); + Transaction transaction = session.beginTransaction(); + UserEntity userEntity = new UserEntity("John"); + session.persist(userEntity); + UserEntity manager = new UserEntity("Adam"); + + // when + userEntity.setManager(manager); + + + // then + assertThatThrownBy(() -> { + session.saveOrUpdate(userEntity); + transaction.commit(); + }); + session.close(); + } + + @Test + void givenPersistentEntity_whenAddedPersistentManager_thenShouldSave() { + // given + Session session = openSession(); + Transaction transaction = session.beginTransaction(); + UserEntity userEntity = new UserEntity("John"); + session.persist(userEntity); + UserEntity manager = new UserEntity("Adam"); + session.persist(manager); + + // when + userEntity.setManager(manager); + + + // then + session.saveOrUpdate(userEntity); + transaction.commit(); + session.close(); + + Session otherSession = openSession(); + UserEntity savedUser = otherSession.get(UserEntity.class, "John"); + assertThat(savedUser.getManager().getName()).isEqualTo("Adam"); + } + + @Test + void givenPersistentEntityWithCascade_whenAddedTransientManager_thenShouldSave() { + // given + Session session = openSession(); + Transaction transaction = session.beginTransaction(); + UserEntityWithCascade userEntity = new UserEntityWithCascade("John"); + session.persist(userEntity); + UserEntityWithCascade manager = new UserEntityWithCascade("Adam"); + + // when + userEntity.setManager(manager); + + + // then + session.saveOrUpdate(userEntity); + transaction.commit(); + session.close(); + + Session otherSession = openSession(); + UserEntityWithCascade savedUser = otherSession.get(UserEntityWithCascade.class, "John"); + assertThat(savedUser.getManager().getName()).isEqualTo("Adam"); + } + + + private Session openSession() { + return entityManagerFactory.unwrap(SessionFactory.class).openSession(); + } +} \ No newline at end of file From da6fb652fbf0c732dd7a0a4d34736a15d06aa343 Mon Sep 17 00:00:00 2001 From: sharifi Date: Fri, 9 Oct 2020 11:36:07 +0330 Subject: [PATCH 0916/1862] remove gitignore file --- .../.gitignore | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-basic-customization-2/.gitignore diff --git a/spring-boot-modules/spring-boot-basic-customization-2/.gitignore b/spring-boot-modules/spring-boot-basic-customization-2/.gitignore deleted file mode 100644 index 2af7cefb0a..0000000000 --- a/spring-boot-modules/spring-boot-basic-customization-2/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ \ No newline at end of file From 5cb3bc85bea94ab6414df0e218ec0c7898f27d55 Mon Sep 17 00:00:00 2001 From: sharifi Date: Fri, 9 Oct 2020 11:48:10 +0330 Subject: [PATCH 0917/1862] change package name and main class's name --- .../DispatchServletApplication.java} | 6 +++--- .../conf/WebConf.java | 6 +++--- .../controller/Controller.java | 2 +- .../filter/CustomFilter.java | 2 +- .../listener/CustomListener.java | 2 +- .../servlet/CustomServlet.java | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) rename spring-boot-modules/spring-boot-basic-customization-2/src/main/java/{com.baeldung.demo/DemoApplication.java => com.baeldung.dispatchservlet/DispatchServletApplication.java} (68%) rename spring-boot-modules/spring-boot-basic-customization-2/src/main/java/{com.baeldung.demo => com.baeldung.dispatchservlet}/conf/WebConf.java (83%) rename spring-boot-modules/spring-boot-basic-customization-2/src/main/java/{com.baeldung.demo => com.baeldung.dispatchservlet}/controller/Controller.java (88%) rename spring-boot-modules/spring-boot-basic-customization-2/src/main/java/{com.baeldung.demo => com.baeldung.dispatchservlet}/filter/CustomFilter.java (93%) rename spring-boot-modules/spring-boot-basic-customization-2/src/main/java/{com.baeldung.demo => com.baeldung.dispatchservlet}/listener/CustomListener.java (92%) rename spring-boot-modules/spring-boot-basic-customization-2/src/main/java/{com.baeldung.demo => com.baeldung.dispatchservlet}/servlet/CustomServlet.java (89%) diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/DemoApplication.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/DispatchServletApplication.java similarity index 68% rename from spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/DemoApplication.java rename to spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/DispatchServletApplication.java index 9e8148f043..4d58715d88 100644 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/DemoApplication.java +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/DispatchServletApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.demo; +package com.baeldung.dispatchservlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -6,10 +6,10 @@ import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.context.annotation.Configuration; @SpringBootApplication -public class DemoApplication { +public class DispatchServletApplication { public static void main(String[] args) { - SpringApplication.run(DemoApplication.class, args); + SpringApplication.run(DispatchServletApplication.class, args); } } diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/conf/WebConf.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/conf/WebConf.java similarity index 83% rename from spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/conf/WebConf.java rename to spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/conf/WebConf.java index 02fcf152f1..9a1170ca34 100644 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/conf/WebConf.java +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/conf/WebConf.java @@ -1,7 +1,7 @@ -package com.baeldung.demo.conf; +package com.baeldung.dispatchservlet.conf; -import com.baeldung.demo.listener.CustomListener; -import com.baeldung.demo.servlet.CustomServlet; +import com.baeldung.dispatchservlet.listener.CustomListener; +import com.baeldung.dispatchservlet.servlet.CustomServlet; import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/controller/Controller.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/controller/Controller.java similarity index 88% rename from spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/controller/Controller.java rename to spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/controller/Controller.java index a6d1812511..14d71c60fb 100644 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/controller/Controller.java +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/controller/Controller.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.controller; +package com.baeldung.dispatchservlet.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/filter/CustomFilter.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/filter/CustomFilter.java similarity index 93% rename from spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/filter/CustomFilter.java rename to spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/filter/CustomFilter.java index c661aecf6d..8429fc855f 100644 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/filter/CustomFilter.java +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/filter/CustomFilter.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.filter; +package com.baeldung.dispatchservlet.filter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/listener/CustomListener.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/listener/CustomListener.java similarity index 92% rename from spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/listener/CustomListener.java rename to spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/listener/CustomListener.java index a9e3ad680f..62b316c012 100644 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/listener/CustomListener.java +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/listener/CustomListener.java @@ -1,4 +1,4 @@ -package com.baeldung.demo.listener; +package com.baeldung.dispatchservlet.listener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/servlet/CustomServlet.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/servlet/CustomServlet.java similarity index 89% rename from spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/servlet/CustomServlet.java rename to spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/servlet/CustomServlet.java index fd3e92bedc..2a99e797ce 100644 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.demo/servlet/CustomServlet.java +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/servlet/CustomServlet.java @@ -1,6 +1,6 @@ -package com.baeldung.demo.servlet; +package com.baeldung.dispatchservlet.servlet; -import com.baeldung.demo.filter.CustomFilter; +import com.baeldung.dispatchservlet.filter.CustomFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From 271ad4e3c7224b1ea65fe66146767622598832fe Mon Sep 17 00:00:00 2001 From: sharifi Date: Fri, 9 Oct 2020 11:48:57 +0330 Subject: [PATCH 0918/1862] remove context-path and path --- .../src/main/resources/application.properties | 2 -- 1 file changed, 2 deletions(-) diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties b/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties index 8c4690dedc..e69de29bb2 100644 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/resources/application.properties @@ -1,2 +0,0 @@ -server.servlet.context-path=/demo -spring.mvc.servlet.path=/baeldung \ No newline at end of file From 4260a798d11a749c2f987ef2ebc318d863b68c2d Mon Sep 17 00:00:00 2001 From: Simone Cusimano Date: Fri, 9 Oct 2020 12:41:53 +0200 Subject: [PATCH 0919/1862] Update dependencies --- .../gradle-dependency-management/build.gradle | 40 ++++++------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/gradle/gradle-dependency-management/build.gradle b/gradle/gradle-dependency-management/build.gradle index db908b6457..88ed84f4b1 100644 --- a/gradle/gradle-dependency-management/build.gradle +++ b/gradle/gradle-dependency-management/build.gradle @@ -1,44 +1,30 @@ plugins { - id 'org.springframework.boot' version '2.3.4.RELEASE' - id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'java' + id 'org.springframework.boot' version '2.3.4.RELEASE' } group = 'com.gradle' version = '1.0.0' sourceCompatibility = '14' -configurations { - compileOnly { - extendsFrom annotationProcessor - } -} - repositories { mavenCentral() } -ext { - set('testcontainersVersion', "1.14.3") -} - dependencies { - implementation 'org.springframework.boot:spring-boot-starter-security' - implementation 'org.springframework.boot:spring-boot-starter-webflux' - developmentOnly 'org.springframework.boot:spring-boot-devtools' - annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' - testImplementation('org.springframework.boot:spring-boot-starter-test') { - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - testImplementation 'io.projectreactor:reactor-test' - testImplementation 'org.springframework.security:spring-security-test' - testImplementation 'org.testcontainers:junit-jupiter' -} + implementation 'org.springframework.boot:spring-boot-starter:2.3.4.RELEASE' -dependencyManagement { - imports { - mavenBom "org.testcontainers:testcontainers-bom:${testcontainersVersion}" - } + testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.4.RELEASE' + + compileOnly 'org.projectlombok:lombok:1.18.14' + + testCompileOnly 'org.projectlombok:lombok:1.18.14' + + runtimeOnly files('libs/sampleOne.jar', 'libs/sampleTwo.jar') + + runtimeOnly fileTree('libs') { include '*.jar' } + +// implementation gradleApi() } test { From 565d4f32c2b8e8b9b24308f49b774b7b48aac5cc Mon Sep 17 00:00:00 2001 From: Benjamin Caure Date: Fri, 9 Oct 2020 12:53:19 +0200 Subject: [PATCH 0920/1862] BAEL-4328 --- .../RestTemplateConfigurationApplication.java | 1 - .../RestTemplateConfigurationApplication.java | 14 ---------- .../logging/LoggingInterceptor.java | 14 +++++----- .../logging/RestTemplateLoggingLiveTest.java | 26 ++++++++++++++----- .../src/test/resources/application.properties | 2 +- 5 files changed, 29 insertions(+), 28 deletions(-) delete mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/logging/RestTemplateConfigurationApplication.java diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java index 8df3c13d7b..a7e65fc96c 100644 --- a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java +++ b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/RestTemplateConfigurationApplication.java @@ -1,7 +1,6 @@ package com.baeldung.resttemplate; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/logging/RestTemplateConfigurationApplication.java b/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/logging/RestTemplateConfigurationApplication.java deleted file mode 100644 index 4fa14edda1..0000000000 --- a/spring-resttemplate-2/src/main/java/com/baeldung/resttemplate/logging/RestTemplateConfigurationApplication.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.resttemplate.logging; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -@EnableAutoConfiguration -public class RestTemplateConfigurationApplication { - - public static void main(String[] args) { - SpringApplication.run(RestTemplateConfigurationApplication.class, args); - } -} diff --git a/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/LoggingInterceptor.java b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/LoggingInterceptor.java index 17ce390d8a..c699d9d9dc 100644 --- a/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/LoggingInterceptor.java +++ b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/LoggingInterceptor.java @@ -14,16 +14,18 @@ import org.springframework.http.client.ClientHttpResponse; public class LoggingInterceptor implements ClientHttpRequestInterceptor { - final static Logger log = LoggerFactory.getLogger(LoggingInterceptor.class); + final static Logger LOGGER = LoggerFactory.getLogger(LoggingInterceptor.class); @Override public ClientHttpResponse intercept(HttpRequest req, byte[] reqBody, ClientHttpRequestExecution ex) throws IOException { - log.debug("Request body: {}", new String(reqBody, StandardCharsets.UTF_8)); + LOGGER.debug("Request body: {}", new String(reqBody, StandardCharsets.UTF_8)); ClientHttpResponse response = ex.execute(req, reqBody); - InputStreamReader isr = new InputStreamReader(response.getBody(), StandardCharsets.UTF_8); - String body = new BufferedReader(isr).lines() - .collect(Collectors.joining("\n")); - log.debug("Response body: {}", body); + if (LOGGER.isDebugEnabled()) { + InputStreamReader isr = new InputStreamReader(response.getBody(), StandardCharsets.UTF_8); + String body = new BufferedReader(isr).lines() + .collect(Collectors.joining("\n")); + LOGGER.debug("Response body: {}", body); + } return response; } } diff --git a/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/RestTemplateLoggingLiveTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/RestTemplateLoggingLiveTest.java index 99d0201eff..86ffa574a0 100644 --- a/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/RestTemplateLoggingLiveTest.java +++ b/spring-resttemplate-2/src/test/java/com/baeldung/resttemplate/logging/RestTemplateLoggingLiveTest.java @@ -1,18 +1,21 @@ package com.baeldung.resttemplate.logging; -import static org.hamcrest.CoreMatchers.equalTo; - -import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.http.client.BufferingClientHttpRequestFactory; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.util.CollectionUtils; import org.springframework.web.client.RestTemplate; @@ -22,6 +25,7 @@ import org.springframework.web.client.RestTemplate; public class RestTemplateLoggingLiveTest { private static final String baseUrl = "http://localhost:8080/spring-rest"; + private static final Logger LOGGER = LoggerFactory.getLogger(RestTemplateLoggingLiveTest.class); @Test public void givenHttpClientConfiguration_whenSendGetForRequestEntity_thenRequestResponseFullLog() { @@ -30,13 +34,22 @@ public class RestTemplateLoggingLiveTest { restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory()); final ResponseEntity response = restTemplate.postForEntity(baseUrl + "/persons", "my request body", String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); + assertEquals(HttpStatus.OK, response.getStatusCode()); + assertEquals("[\"Lucie\",\"Jackie\",\"Danesh\",\"Tao\"]", response.getBody()); } @Test public void givenLoggingInterceptorConfiguration_whenSendGetForRequestEntity_thenRequestResponseCustomLog() { - RestTemplate restTemplate = new RestTemplate(); + RestTemplate restTemplate = null; + if (LOGGER.isDebugEnabled()) { + ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory( + new SimpleClientHttpRequestFactory()); + restTemplate = new RestTemplate(factory); + } else { + restTemplate = new RestTemplate(); + } + List interceptors = restTemplate.getInterceptors(); if (CollectionUtils.isEmpty(interceptors)) { interceptors = new ArrayList<>(); @@ -45,6 +58,7 @@ public class RestTemplateLoggingLiveTest { restTemplate.setInterceptors(interceptors); final ResponseEntity response = restTemplate.postForEntity(baseUrl + "/persons", "my request body", String.class); - assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); + assertEquals(HttpStatus.OK, response.getStatusCode()); + assertEquals("[\"Lucie\",\"Jackie\",\"Danesh\",\"Tao\"]", response.getBody()); } } diff --git a/spring-resttemplate-2/src/test/resources/application.properties b/spring-resttemplate-2/src/test/resources/application.properties index 7bc9e56041..286ea95a4f 100644 --- a/spring-resttemplate-2/src/test/resources/application.properties +++ b/spring-resttemplate-2/src/test/resources/application.properties @@ -1,5 +1,5 @@ logging.level.org.springframework.web.client.RestTemplate=DEBUG -logging.level.com.baeldung.resttemplate.logging.LoggingInterceptor=DEBUG +logging.level.com.baeldung.resttemplate.logging=DEBUG logging.level.org.apache.http=DEBUG logging.level.httpclient.wire=DEBUG logging.pattern.console=%20logger{20} - %msg%n From 6cf54b019aecfc09a0f37b279a5a5e8b8aaae762 Mon Sep 17 00:00:00 2001 From: Simone Cusimano Date: Fri, 9 Oct 2020 12:53:49 +0200 Subject: [PATCH 0921/1862] Add article to README --- gradle/README.md | 1 + gradle/gradle-dependency-management/README.md | 3 +++ ...ests.java => DependencyManagementApplicationUnitTests.java} | 0 3 files changed, 4 insertions(+) create mode 100644 gradle/gradle-dependency-management/README.md rename gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/{DependencyManagementApplicationTests.java => DependencyManagementApplicationUnitTests.java} (100%) diff --git a/gradle/README.md b/gradle/README.md index 84a8508e2c..422bc0fcc5 100644 --- a/gradle/README.md +++ b/gradle/README.md @@ -8,3 +8,4 @@ This module contains articles about Gradle - [Creating a Fat Jar in Gradle](https://www.baeldung.com/gradle-fat-jar) - [A Custom Task in Gradle](https://www.baeldung.com/gradle-custom-task) - [Using JUnit 5 with Gradle](https://www.baeldung.com/junit-5-gradle) +- [Dependency Management in Gradle](https://www.baeldung.com/TBD) diff --git a/gradle/gradle-dependency-management/README.md b/gradle/gradle-dependency-management/README.md new file mode 100644 index 0000000000..b46ae5b596 --- /dev/null +++ b/gradle/gradle-dependency-management/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Dependency Management in Gradle](https://www.baeldung.com/TBD) diff --git a/gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationTests.java b/gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationUnitTests.java similarity index 100% rename from gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationTests.java rename to gradle/gradle-dependency-management/src/test/java/com/gradle/dependencymanagement/DependencyManagementApplicationUnitTests.java From 68f35280c3e394f5ba0ae5a5666853454b6b9d77 Mon Sep 17 00:00:00 2001 From: Loredana Date: Fri, 9 Oct 2020 15:48:30 +0300 Subject: [PATCH 0922/1862] remove lombok, update scripts threads --- .../load-testing-comparison/pom.xml | 5 --- .../loadtesting/TransactionController.java | 26 --------------- .../model/CustomerRewardsAccount.java | 17 ++++++++-- .../loadtesting/model/Transaction.java | 33 +++++++++++++++++-- .../src/main/resources/application.properties | 7 ++++ .../scripts/Gatling/GatlingScenario.scala | 9 ++--- .../resources/scripts/JMeter/Test Plan.jmx | 2 +- .../scripts/The Grinder/grinder.properties | 2 +- .../resources/scripts/The Grinder/grinder.py | 8 +++-- 9 files changed, 64 insertions(+), 45 deletions(-) delete mode 100644 testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java create mode 100644 testing-modules/load-testing-comparison/src/main/resources/application.properties diff --git a/testing-modules/load-testing-comparison/pom.xml b/testing-modules/load-testing-comparison/pom.xml index 1143ecb9ac..adc768b563 100644 --- a/testing-modules/load-testing-comparison/pom.xml +++ b/testing-modules/load-testing-comparison/pom.xml @@ -55,11 +55,6 @@ com.h2database h2 - - org.projectlombok - lombok - compile - diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java deleted file mode 100644 index 2ea2c06a41..0000000000 --- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/TransactionController.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.loadtesting; - -import com.baeldung.loadtesting.model.Transaction; -import com.baeldung.loadtesting.repository.TransactionRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -@RestController -@Deprecated -public class TransactionController { - - @Autowired - private TransactionRepository transactionRepository; - - @PostMapping(path="/addTransaction") - public @ResponseBody - String saveTransactions(@RequestBody Transaction trnsctn){ - transactionRepository.save(trnsctn); - return "Saved Transaction."; - } - - @GetMapping(path="/findAll/{rewardId}") - public @ResponseBody Iterable getTransactions(@RequestParam Integer id){ - return transactionRepository.findByCustomerRewardsId(id); - } -} diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java index 2c6742fbaf..0599020700 100644 --- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java @@ -5,10 +5,7 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import lombok.Data; - @Entity -@Data public class CustomerRewardsAccount { @Id @@ -19,4 +16,18 @@ public class CustomerRewardsAccount { public Integer getCustomerId(){ return this.customerId; } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public void setCustomerId(Integer customerId) { + this.customerId = customerId; + } + + } diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java index 312f52f4ab..1a6e0d4360 100644 --- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java @@ -1,7 +1,5 @@ package com.baeldung.loadtesting.model; -import lombok.Data; - import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; @@ -10,7 +8,6 @@ import java.util.Date; import java.util.Calendar; @Entity -@Data public class Transaction { @Id @@ -27,4 +24,34 @@ public class Transaction { public void setTransactionDate(Date transactionDate){ this.transactionDate = transactionDate; } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCustomerRewardsId() { + return customerRewardsId; + } + + public void setCustomerRewardsId(Integer customerRewardsId) { + this.customerRewardsId = customerRewardsId; + } + + public Integer getCustomerId() { + return customerId; + } + + public void setCustomerId(Integer customerId) { + this.customerId = customerId; + } + + public Date getTransactionDate() { + return transactionDate; + } + + } diff --git a/testing-modules/load-testing-comparison/src/main/resources/application.properties b/testing-modules/load-testing-comparison/src/main/resources/application.properties new file mode 100644 index 0000000000..424d3d0290 --- /dev/null +++ b/testing-modules/load-testing-comparison/src/main/resources/application.properties @@ -0,0 +1,7 @@ +spring.h2.console.enabled=true +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=password +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect + diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index f17f5f6124..6904d838cb 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -17,7 +17,8 @@ class RewardsScenario extends Simulation { .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0") val scn = scenario("RewardsScenario") - .repeat(10){ + .repeat(100){ + exec(http("transactions_add") .post("/transactions/add/") .body(StringBody(_ => s"""{ "customerRewardsId":null,"customerId":"${randCustId()}","transactionDate":null }""")).asJson @@ -36,14 +37,14 @@ class RewardsScenario extends Simulation { .check(jsonPath("$.id").saveAs("rwdId"))) } - .exec(http("transactions_add") + .exec(http("transactions_update") .post("/transactions/add/") .body(StringBody("""{ "customerRewardsId":"${rwdId}","customerId":"${custId}","transactionDate":"${txtDate}" }""")).asJson) - .exec(http("get_reward") + .exec(http("get_transactions") .get("/transactions/findAll/${rwdId}")) } setUp( scn.inject(atOnceUsers(100)) ).protocols(httpProtocol) -} \ No newline at end of file +} diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx index 97640dfac7..413a8d3387 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx @@ -16,7 +16,7 @@ continue false - 10 + 100 100 0 diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties index 68adf90856..f256f5a7dd 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties @@ -1,5 +1,5 @@ grinder.script = grinder.py grinder.threads = 100 grinder.processes = 1 -grinder.runs = 10 +grinder.runs = 100 grinder.logDirectory = /logs diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py index 025f90d38b..bbb253c220 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py @@ -21,20 +21,24 @@ request1.setHeaders(headers) utilities = HTTPPluginControl.getHTTPUtilities() test1.record(request1) random=java.util.Random() +log = grinder.logger.info class TestRunner: def __call__(self): - customerId = str(random.nextInt()); + + customerId = str(random.nextInt()); result = request1.POST("http://localhost:8080/transactions/add", "{"'"customerRewardsId"'":null,"'"customerId"'":"+ customerId + ","'"transactionDate"'":null}") txnId = parseJsonString(result.getText(), "id") result = request1.GET("http://localhost:8080/rewards/find/"+ customerId) rwdId = parseJsonString(result.getText(), "id") + log("rwdid %s" % rwdId) if rwdId == "": result = request1.POST("http://localhost:8080/rewards/add", "{"'"customerId"'":"+ customerId + "}") rwdId = parseJsonString(result.getText(), "id") result = request1.POST("http://localhost:8080/transactions/add", "{"'"id"'":" + txnId + ","'"customerRewardsId"'":" + rwdId + ","'"customerId"'":"+ customerId + ","'"transactionDate"'":null}") - result = request1.GET("http://localhost:8080/transactions/findAll/" + rwdId) \ No newline at end of file + result = request1.GET("http://localhost:8080/transactions/findAll/" + rwdId) + From f3aee7ea037cce604329755732e38e754865db89 Mon Sep 17 00:00:00 2001 From: Loredana Date: Fri, 9 Oct 2020 15:50:27 +0300 Subject: [PATCH 0923/1862] remove log, formatting --- .../src/main/resources/scripts/The Grinder/grinder.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py index bbb253c220..a71f101b41 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.py @@ -21,19 +21,17 @@ request1.setHeaders(headers) utilities = HTTPPluginControl.getHTTPUtilities() test1.record(request1) random=java.util.Random() -log = grinder.logger.info class TestRunner: def __call__(self): - customerId = str(random.nextInt()); + customerId = str(random.nextInt()); result = request1.POST("http://localhost:8080/transactions/add", "{"'"customerRewardsId"'":null,"'"customerId"'":"+ customerId + ","'"transactionDate"'":null}") txnId = parseJsonString(result.getText(), "id") result = request1.GET("http://localhost:8080/rewards/find/"+ customerId) rwdId = parseJsonString(result.getText(), "id") - log("rwdid %s" % rwdId) if rwdId == "": result = request1.POST("http://localhost:8080/rewards/add", "{"'"customerId"'":"+ customerId + "}") From eea42f2289e3264420728c702a75966c4b160b1c Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Fri, 9 Oct 2020 21:05:09 +0200 Subject: [PATCH 0924/1862] Reset Gatling user state on each iteration --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index 6904d838cb..15d86ebedb 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -43,6 +43,8 @@ class RewardsScenario extends Simulation { .exec(http("get_transactions") .get("/transactions/findAll/${rwdId}")) + + .exec(_.removeAll("txnId", "txtDate", "custId", "rwdId")) } setUp( scn.inject(atOnceUsers(100)) From 4cd2feed942af0f1189620c8ce037581fb111511 Mon Sep 17 00:00:00 2001 From: Maiklins Date: Sat, 10 Oct 2020 09:17:35 +0200 Subject: [PATCH 0925/1862] Java-82 Correctly configure Netty server and security (#10034) * Java-82 Correctly configure netty server and security * Java-82 Align WebSecurity with article * Java-82 Change port Co-authored-by: mikr --- .../reactive/actuator/FeaturesEndpoint.java | 2 +- .../actuator/Spring5ReactiveApplication.java | 2 +- .../reactive/actuator/WebSecurityConfig.java | 19 +++++++------------ .../reactive/security/SecurityConfig.java | 4 ++-- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java index b2bc1e037f..d6cf1eb781 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/FeaturesEndpoint.java @@ -7,7 +7,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @Component -@Endpoint(id = "features", enableByDefault = true) +@Endpoint(id = "features") public class FeaturesEndpoint { private Map features = new ConcurrentHashMap<>(); diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java index 03943d436d..600bff5948 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/Spring5ReactiveApplication.java @@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication -public class Spring5ReactiveApplication{ +public class Spring5ReactiveApplication { public static void main(String[] args) { SpringApplication.run(Spring5ReactiveApplication.class, args); diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java index 07f805fea4..384e26ac8c 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/actuator/WebSecurityConfig.java @@ -1,10 +1,7 @@ package com.baeldung.reactive.actuator; -import org.springframework.boot.actuate.autoconfigure.security.reactive.EndpointRequest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.web.server.SecurityWebFilterChain; @@ -12,17 +9,15 @@ import org.springframework.security.web.server.SecurityWebFilterChain; @Configuration @EnableWebFluxSecurity public class WebSecurityConfig { - - + @Bean public SecurityWebFilterChain securitygWebFilterChain( ServerHttpSecurity http) { - return http - - .authorizeExchange() - .matchers(EndpointRequest.to( - FeaturesEndpoint.class - )).permitAll().anyExchange().permitAll().and().csrf().disable().build(); + + return http.authorizeExchange() + .pathMatchers("/actuator/**").permitAll() + .anyExchange().authenticated() + .and().build(); } - + } diff --git a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java index 225f78b3f7..64e96ddae1 100644 --- a/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java +++ b/spring-5-reactive-security/src/main/java/com/baeldung/reactive/security/SecurityConfig.java @@ -21,12 +21,12 @@ public class SecurityConfig { @Bean public SecurityWebFilterChain securitygWebFilterChain(ServerHttpSecurity http) { return http.authorizeExchange() - .pathMatchers("/", "/admin") + .pathMatchers("/admin") .hasAuthority("ROLE_ADMIN") .matchers(EndpointRequest.to(FeaturesEndpoint.class)) .permitAll() .anyExchange() - .permitAll() + .authenticated() .and() .formLogin() .and() From 2fb06fdcdd3c7827a2d67c04e80dc615d6fb4b83 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 10 Oct 2020 13:38:26 +0300 Subject: [PATCH 0926/1862] remove explicit version overrides JAVA-1671 --- spring-cloud/pom.xml | 6 ------ spring-cloud/spring-cloud-aws/pom.xml | 4 ---- spring-cloud/spring-cloud-bootstrap/config/pom.xml | 11 ----------- .../spring-cloud-bootstrap/customer-service/pom.xml | 12 ------------ .../spring-cloud-bootstrap/discovery/pom.xml | 4 ---- spring-cloud/spring-cloud-bootstrap/gateway/pom.xml | 4 ---- .../spring-cloud-bootstrap/order-service/pom.xml | 11 ----------- spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml | 4 ---- .../spring-cloud-bootstrap/svc-rating/pom.xml | 4 ---- spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml | 11 ----------- spring-cloud/spring-cloud-config/pom.xml | 11 ----------- spring-cloud/spring-cloud-connectors-heroku/pom.xml | 4 ---- spring-cloud/spring-cloud-functions/pom.xml | 4 ---- .../spring/cloudfunction/aws/functions/Greeter.java | 2 +- spring-cloud/spring-cloud-kubernetes/pom.xml | 4 ---- .../spring-cloud-rest-books-api/pom.xml | 4 ---- .../spring-cloud-rest-config-server/pom.xml | 4 ---- .../spring-cloud-rest-discovery-server/pom.xml | 4 ---- .../spring-cloud-rest-reviews-api/pom.xml | 4 ---- spring-cloud/spring-cloud-ribbon-client/pom.xml | 5 ----- spring-cloud/spring-cloud-ribbon-retry/pom.xml | 4 ---- spring-cloud/spring-cloud-security/pom.xml | 4 ---- .../spring-cloud-stream-kafka/pom.xml | 4 ---- .../spring-cloud-stream-kinesis/pom.xml | 5 ----- spring-cloud/spring-cloud-task/pom.xml | 4 ---- spring-cloud/spring-cloud-vault/pom.xml | 5 ----- spring-cloud/spring-cloud-zuul/pom.xml | 4 ---- 27 files changed, 1 insertion(+), 146 deletions(-) diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 928db8adb7..7894365a41 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -85,13 +85,7 @@ 1.4.7.RELEASE 1.4.7.RELEASE 3.0.6.RELEASE - 2.3.1.RELEASE - 2.3.1.RELEASE - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml index 3952ffdec1..f65db6a2fe 100644 --- a/spring-cloud/spring-cloud-aws/pom.xml +++ b/spring-cloud/spring-cloud-aws/pom.xml @@ -68,10 +68,6 @@ Dalston.SR4 2.2.1.RELEASE - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-bootstrap/config/pom.xml b/spring-cloud/spring-cloud-bootstrap/config/pom.xml index 65a9830495..6ebf23637e 100644 --- a/spring-cloud/spring-cloud-bootstrap/config/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/config/pom.xml @@ -30,13 +30,6 @@ - - org.junit - junit-bom - ${junit-jupiter.version} - pom - import - org.springframework.cloud spring-cloud-dependencies @@ -50,10 +43,6 @@ Brixton.SR7 - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml b/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml index 026a7a1841..729abb4f05 100644 --- a/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/customer-service/pom.xml @@ -17,13 +17,6 @@ - - org.springframework.boot - spring-boot-dependencies - ${spring-boot.version} - pom - import - org.springframework.boot spring-boot-starter-web @@ -78,10 +71,5 @@ 1.8 1.8 - - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml index eaebaacc4d..d77e29768f 100644 --- a/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/discovery/pom.xml @@ -52,10 +52,6 @@ Edgware.SR5 - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml index aacd2cdbf7..34b7af7c0a 100644 --- a/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/gateway/pom.xml @@ -101,10 +101,6 @@ Dalston.RELEASE - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml b/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml index 04901f9936..a32bd5a2d3 100644 --- a/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/order-service/pom.xml @@ -23,13 +23,6 @@ - - org.junit - junit-bom - ${junit-jupiter.version} - pom - import - org.springframework.boot spring-boot-dependencies @@ -126,9 +119,5 @@ 1.8 com.baeldung.orderservice.OrderApplication - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml index cf34e44f24..de0785bd45 100644 --- a/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/pom.xml @@ -74,10 +74,6 @@ Dalston.RELEASE - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml index a232861cad..0cce78276a 100644 --- a/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/pom.xml @@ -83,10 +83,6 @@ Dalston.RELEASE - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml index 134038b94a..b83c5a2aaa 100644 --- a/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml +++ b/spring-cloud/spring-cloud-bootstrap/zipkin/pom.xml @@ -38,13 +38,6 @@ - - org.junit - junit-bom - ${junit-jupiter.version} - pom - import - org.springframework.cloud spring-cloud-dependencies @@ -58,10 +51,6 @@ Brixton.SR7 - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-config/pom.xml b/spring-cloud/spring-cloud-config/pom.xml index e693bc7a29..7fb0c1fd68 100644 --- a/spring-cloud/spring-cloud-config/pom.xml +++ b/spring-cloud/spring-cloud-config/pom.xml @@ -22,13 +22,6 @@ - - org.junit - junit-bom - ${junit-jupiter.version} - pom - import - org.springframework.cloud spring-cloud-dependencies @@ -42,10 +35,6 @@ Hoxton.SR4 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index 2e84061be9..e71e1350a2 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -65,10 +65,6 @@ 42.2.10 1.10.10 - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-functions/pom.xml b/spring-cloud/spring-cloud-functions/pom.xml index 19b5e3cd8d..0be3941db1 100644 --- a/spring-cloud/spring-cloud-functions/pom.xml +++ b/spring-cloud/spring-cloud-functions/pom.xml @@ -87,10 +87,6 @@ 1.1.0 1.0.10.RELEASE - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-functions/src/main/java/com/baeldung/spring/cloudfunction/aws/functions/Greeter.java b/spring-cloud/spring-cloud-functions/src/main/java/com/baeldung/spring/cloudfunction/aws/functions/Greeter.java index c443b98c18..bbc87a4ae2 100644 --- a/spring-cloud/spring-cloud-functions/src/main/java/com/baeldung/spring/cloudfunction/aws/functions/Greeter.java +++ b/spring-cloud/spring-cloud-functions/src/main/java/com/baeldung/spring/cloudfunction/aws/functions/Greeter.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.cloudfunction.functions.aws; +package com.baeldung.spring.cloudfunction.aws.functions; import java.util.function.Function; diff --git a/spring-cloud/spring-cloud-kubernetes/pom.xml b/spring-cloud/spring-cloud-kubernetes/pom.xml index c936024753..a3669d2d55 100644 --- a/spring-cloud/spring-cloud-kubernetes/pom.xml +++ b/spring-cloud/spring-cloud-kubernetes/pom.xml @@ -25,9 +25,5 @@ - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml index 1dcf14f104..8ba0fc5cad 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/pom.xml @@ -75,9 +75,5 @@ - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml index 736b8bdf78..c64341f652 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/pom.xml @@ -53,10 +53,6 @@ Camden.SR4 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml index 12f8b6ae6a..85790bf895 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/pom.xml @@ -61,10 +61,6 @@ Edgware.SR4 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml index 0e7aed7f6a..35d0e79543 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/pom.xml @@ -83,10 +83,6 @@ 3.0.1 0.6 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-ribbon-client/pom.xml b/spring-cloud/spring-cloud-ribbon-client/pom.xml index ce57cfd7d3..fa9cee29a2 100644 --- a/spring-cloud/spring-cloud-ribbon-client/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-client/pom.xml @@ -46,11 +46,6 @@ Hoxton.SR4 - - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-ribbon-retry/pom.xml b/spring-cloud/spring-cloud-ribbon-retry/pom.xml index 198473d5e5..99eb882421 100644 --- a/spring-cloud/spring-cloud-ribbon-retry/pom.xml +++ b/spring-cloud/spring-cloud-ribbon-retry/pom.xml @@ -56,9 +56,5 @@ Hoxton.SR3 - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-security/pom.xml b/spring-cloud/spring-cloud-security/pom.xml index 0997b1f3aa..3a007c8df1 100644 --- a/spring-cloud/spring-cloud-security/pom.xml +++ b/spring-cloud/spring-cloud-security/pom.xml @@ -21,9 +21,5 @@ - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml index 3283d4d07c..52230dd1c1 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kafka/pom.xml @@ -106,10 +106,6 @@ 4.0.0 1.8.2 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml index d3182433e9..9e706cc239 100644 --- a/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-kinesis/pom.xml @@ -43,11 +43,6 @@ 1.11.632 2.0.2.RELEASE 2.2.1.RELEASE - - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/spring-cloud/spring-cloud-task/pom.xml b/spring-cloud/spring-cloud-task/pom.xml index bb18c1390b..21d8a4e42b 100644 --- a/spring-cloud/spring-cloud-task/pom.xml +++ b/spring-cloud/spring-cloud-task/pom.xml @@ -50,10 +50,6 @@ Hoxton.SR4 2.2.3.RELEASE - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-vault/pom.xml b/spring-cloud/spring-cloud-vault/pom.xml index a713e47fe2..d9ae6b515f 100644 --- a/spring-cloud/spring-cloud-vault/pom.xml +++ b/spring-cloud/spring-cloud-vault/pom.xml @@ -83,11 +83,6 @@ Greenwich.RELEASE - - - 2.22.2 - 5.6.2 - 4.13 diff --git a/spring-cloud/spring-cloud-zuul/pom.xml b/spring-cloud/spring-cloud-zuul/pom.xml index 3884e67388..b8db1f2fc7 100644 --- a/spring-cloud/spring-cloud-zuul/pom.xml +++ b/spring-cloud/spring-cloud-zuul/pom.xml @@ -81,10 +81,6 @@ Hoxton.SR4 - - 2.22.2 - 5.6.2 - 4.13 From 6f4ec4704fa9a127bca7344c9abc65b08fde4bf7 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 10 Oct 2020 13:49:25 +0300 Subject: [PATCH 0927/1862] fix unknown version --- spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml | 1 - spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml | 4 ---- spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml | 2 -- .../bin/eureka-client/pom.xml | 1 - .../eureka-client/pom.xml | 4 ++-- .../eureka-server/pom.xml | 2 +- .../spring-cloud-zuul-eureka-integration/zuul-server/pom.xml | 1 - 7 files changed, 3 insertions(+), 12 deletions(-) diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml index 9b43542f02..204cb8765c 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml @@ -58,7 +58,6 @@ org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} org.springframework.boot diff --git a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml index 7989b09ed4..44e5bf2501 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-consumer/pom.xml @@ -47,24 +47,20 @@ org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-thymeleaf - ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-actuator - ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-test test - ${spring-boot-starter-web.version} diff --git a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml index cb7377d705..e7be8f2c58 100644 --- a/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/rest-producer/pom.xml @@ -18,13 +18,11 @@ org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-test - ${spring-boot-starter-web.version} test diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml index 118a9e2c11..321da7527a 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/bin/eureka-client/pom.xml @@ -35,7 +35,6 @@ org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml index 9cf96df60e..77e8ef7c20 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-client/pom.xml @@ -35,13 +35,13 @@ org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} + ${spring-boot.version} org.springframework.boot spring-boot-starter-test - ${spring-boot-starter-web.version} + ${spring-boot.version} test diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml index cd25f5f294..c3f6642351 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/eureka-server/pom.xml @@ -41,7 +41,7 @@ org.springframework.boot spring-boot-starter-test - ${spring-boot-starter-web.version} + ${spring-boot.version} test diff --git a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml index 3d238d5d5f..ddffe540c5 100644 --- a/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml +++ b/spring-cloud/spring-cloud-zuul-eureka-integration/zuul-server/pom.xml @@ -50,7 +50,6 @@ org.springframework.boot spring-boot-starter-test - ${spring-boot-starter-web.version} test From 5792db85bd0b2900aab6426d59f63a56d42583c7 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 10 Oct 2020 13:56:42 +0300 Subject: [PATCH 0928/1862] fix unknown version --- spring-cloud/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index 7894365a41..c0e452afaf 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -52,7 +52,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring-boot-maven-plugin.version} From e4007b9b98fa716acee458e6b2dc3244287185ff Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 10 Oct 2020 14:18:20 +0300 Subject: [PATCH 0929/1862] fix test --- .../src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud/spring-cloud-functions/src/main/resources/application.properties b/spring-cloud/spring-cloud-functions/src/main/resources/application.properties index b445bfa4ed..2cb479879c 100644 --- a/spring-cloud/spring-cloud-functions/src/main/resources/application.properties +++ b/spring-cloud/spring-cloud-functions/src/main/resources/application.properties @@ -1 +1 @@ -spring.cloud.function.scan.packages: com.baeldung.spring.cloudfunction.functions.aws \ No newline at end of file +spring.cloud.function.scan.packages: com.baeldung.spring.cloudfunction.aws.functions \ No newline at end of file From 103bd4cf6500b8a4b943697981f0180d9a9e5ba1 Mon Sep 17 00:00:00 2001 From: dgcd Date: Sun, 11 Oct 2020 01:23:32 +0300 Subject: [PATCH 0930/1862] Fixed typos in core-java-9-jigsaw module --- .../com/baeldung/student/service/dbimpl/StudentDbService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-9-jigsaw/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java b/core-java-modules/core-java-9-jigsaw/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java index 2519da085b..617a0a7e70 100644 --- a/core-java-modules/core-java-9-jigsaw/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java +++ b/core-java-modules/core-java-9-jigsaw/src/modules/com.baeldung.student.service.dbimpl/com/baeldung/student/service/dbimpl/StudentDbService.java @@ -19,12 +19,12 @@ public class StudentDbService implements StudentService { } public Student update(Student student) { - logger.log(Level.INFO, "Updating sutdent in DB..."); + logger.log(Level.INFO, "Updating student in DB..."); return student; } public String delete(String registrationId) { - logger.log(Level.INFO, "Deleteing sutdent in DB..."); + logger.log(Level.INFO, "Deleting student in DB..."); return registrationId; } } \ No newline at end of file From f80f82781fa29f76068cd25368d00cbb5926566c Mon Sep 17 00:00:00 2001 From: Daniel Strmecki Date: Sun, 11 Oct 2020 10:22:42 +0200 Subject: [PATCH 0931/1862] BAEL-4504: Move find free port to networking-3 --- .../core-java-networking-3/README.md | 8 + .../core-java-networking-3/pom.xml | 59 +++++++ .../baeldung/socket/FindFreePortUnitTest.java | 146 ++++++++++++++++++ 3 files changed, 213 insertions(+) create mode 100644 core-java-modules/core-java-networking-3/README.md create mode 100644 core-java-modules/core-java-networking-3/pom.xml create mode 100644 core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java diff --git a/core-java-modules/core-java-networking-3/README.md b/core-java-modules/core-java-networking-3/README.md new file mode 100644 index 0000000000..a81e85751d --- /dev/null +++ b/core-java-modules/core-java-networking-3/README.md @@ -0,0 +1,8 @@ +## Core Java Networking (Part 3) + +This module contains articles about networking in Java + +### Relevant Articles + +- TODO: add link once live +- [[<-- Prev]](/core-java-modules/core-java-networking-2) diff --git a/core-java-modules/core-java-networking-3/pom.xml b/core-java-modules/core-java-networking-3/pom.xml new file mode 100644 index 0000000000..2a5522074a --- /dev/null +++ b/core-java-modules/core-java-networking-3/pom.xml @@ -0,0 +1,59 @@ + + + 4.0.0 + core-java-networking-4 + core-java-networking-3 + jar + + + com.baeldung.core-java-modules + core-java-modules + 0.0.1-SNAPSHOT + ../pom.xml + + + + + org.springframework + spring-core + ${spring.core.version} + + + org.eclipse.jetty + jetty-server + ${jetty.embeded.version} + + + org.apache.tomcat.embed + tomcat-embed-core + ${tomcat.embeded.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + core-java-networking-3 + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + 5.2.8.RELEASE + 9.4.31.v20200723 + 10.0.0-M7 + 3.11.1 + + + diff --git a/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java b/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java new file mode 100644 index 0000000000..6402a086e6 --- /dev/null +++ b/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java @@ -0,0 +1,146 @@ +package com.baeldung.socket; + +import org.apache.catalina.LifecycleException; +import org.apache.catalina.startup.Tomcat; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.springframework.util.SocketUtils; + +import java.io.IOException; +import java.net.ServerSocket; + +import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; + +public class FindFreePortUnitTest { + + private static int FREE_PORT_NUMBER; + private static int[] FREE_PORT_RANGE; + + @BeforeAll + public static void getExplicitFreePortNumberAndRange() { + try (ServerSocket serverSocket = new ServerSocket(0);) { + FREE_PORT_NUMBER = serverSocket.getLocalPort(); + FREE_PORT_RANGE = new int[] {FREE_PORT_NUMBER, FREE_PORT_NUMBER + 1, FREE_PORT_NUMBER + 2}; + } catch (IOException e) { + fail("No free port is available"); + } + } + + @Test + public void givenExplicitFreePort_whenCreatingServerSocket_thenThatPortIsAssigned() { + try (ServerSocket serverSocket = new ServerSocket(FREE_PORT_NUMBER);) { + assertThat(serverSocket).isNotNull(); + assertThat(serverSocket.getLocalPort()).isEqualTo(FREE_PORT_NUMBER); + } catch (IOException e) { + fail("Port is not available"); + } + } + + @Test + public void givenExplicitOccupiedPort_whenCreatingServerSocket_thenExceptionIsThrown() { + try (ServerSocket serverSocket = new ServerSocket(FREE_PORT_NUMBER)) { + new ServerSocket(FREE_PORT_NUMBER); + fail("Same port cannot be used twice"); + } catch (IOException e) { + assertThat(e).hasMessageContaining("Address already in use"); + } + } + + @Test + public void givenExplicitPortRange_whenCreatingServerSocket_thenOnePortIsAssigned() { + for (int port : FREE_PORT_RANGE) { + try (ServerSocket serverSocket = new ServerSocket(port)) { + assertThat(serverSocket).isNotNull(); + assertThat(serverSocket.getLocalPort()).isGreaterThan(0); + return; + } catch (IOException e) { + assertThat(e).hasMessageContaining("Address already in use"); + } + } + fail("No free port in the range found"); + } + + @Test + public void givenPortZero_whenCreatingServerSocket_thenFreePortIsAssigned() { + try (ServerSocket serverSocket = new ServerSocket(0)) { + assertThat(serverSocket).isNotNull(); + assertThat(serverSocket.getLocalPort()).isGreaterThan(0); + } catch (IOException e) { + fail("Port is not available"); + } + } + + @Test + public void givenAvailableTcpPort_whenCreatingServerSocket_thenThatPortIsAssigned() { + int port = SocketUtils.findAvailableTcpPort(); + try (ServerSocket serverSocket = new ServerSocket(port)) { + assertThat(serverSocket).isNotNull(); + assertThat(serverSocket.getLocalPort()).isGreaterThan(0); + } catch (IOException e) { + fail("Port is not available"); + } + } + + @Test + public void givenNoPortDefined_whenCreatingJettyServer_thenFreePortIsAssigned() { + Server jettyServer = new Server(); + ServerConnector serverConnector = new ServerConnector(jettyServer); + jettyServer.addConnector(serverConnector); + try { + jettyServer.start(); + assertThat(serverConnector.getLocalPort()).isGreaterThan(0); + jettyServer.stop(); + jettyServer.destroy(); + } catch (Exception e) { + fail("Failed to start Jetty server"); + } + } + + @Test + public void givenExplicitFreePort_whenCreatingJettyServer_thenThatPortIsAssigned() { + Server jettyServer = new Server(); + ServerConnector serverConnector = new ServerConnector(jettyServer); + serverConnector.setPort(FREE_PORT_NUMBER); + jettyServer.addConnector(serverConnector); + try { + jettyServer.start(); + assertThat(serverConnector.getLocalPort()).isEqualTo(FREE_PORT_NUMBER); + jettyServer.stop(); + jettyServer.destroy(); + } catch (Exception e) { + fail("Failed to start Jetty server"); + } + } + + @Test + public void givenPortZero_whenCreatingTomcatServer_thenFreePortIsAssigned() { + Tomcat tomcatServer = new Tomcat(); + tomcatServer.setPort(0); + try { + tomcatServer.start(); + assertThat(tomcatServer.getConnector().getLocalPort()).isGreaterThan(0); + tomcatServer.stop(); + tomcatServer.destroy(); + } catch (LifecycleException e) { + fail("Failed to start Tomcat server"); + } + } + + @Test + public void givenExplicitFreePort_whenCreatingTomcatServer_thenThatPortIsAssigned() { + Tomcat tomcatServer = new Tomcat(); + tomcatServer.setPort(FREE_PORT_NUMBER); + try { + tomcatServer.start(); + assertThat(tomcatServer.getConnector().getLocalPort()).isEqualTo(FREE_PORT_NUMBER); + tomcatServer.stop(); + tomcatServer.destroy(); + } catch (LifecycleException e) { + fail("Failed to start Tomcat server"); + } + } + +} From 42455830c0b186042f4073b9dccaaee824cc7a86 Mon Sep 17 00:00:00 2001 From: Daniel Strmecki Date: Sun, 11 Oct 2020 11:14:36 +0200 Subject: [PATCH 0932/1862] BAEL-4504: Fix PR comments --- .../java/com/baeldung/socket/FindFreePortUnitTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java b/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java index 6402a086e6..d045f753ea 100644 --- a/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java +++ b/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java @@ -21,7 +21,7 @@ public class FindFreePortUnitTest { @BeforeAll public static void getExplicitFreePortNumberAndRange() { - try (ServerSocket serverSocket = new ServerSocket(0);) { + try (ServerSocket serverSocket = new ServerSocket(0)) { FREE_PORT_NUMBER = serverSocket.getLocalPort(); FREE_PORT_RANGE = new int[] {FREE_PORT_NUMBER, FREE_PORT_NUMBER + 1, FREE_PORT_NUMBER + 2}; } catch (IOException e) { @@ -31,7 +31,7 @@ public class FindFreePortUnitTest { @Test public void givenExplicitFreePort_whenCreatingServerSocket_thenThatPortIsAssigned() { - try (ServerSocket serverSocket = new ServerSocket(FREE_PORT_NUMBER);) { + try (ServerSocket serverSocket = new ServerSocket(FREE_PORT_NUMBER)) { assertThat(serverSocket).isNotNull(); assertThat(serverSocket.getLocalPort()).isEqualTo(FREE_PORT_NUMBER); } catch (IOException e) { @@ -54,7 +54,7 @@ public class FindFreePortUnitTest { for (int port : FREE_PORT_RANGE) { try (ServerSocket serverSocket = new ServerSocket(port)) { assertThat(serverSocket).isNotNull(); - assertThat(serverSocket.getLocalPort()).isGreaterThan(0); + assertThat(serverSocket.getLocalPort()).isEqualTo(port); return; } catch (IOException e) { assertThat(e).hasMessageContaining("Address already in use"); @@ -78,7 +78,7 @@ public class FindFreePortUnitTest { int port = SocketUtils.findAvailableTcpPort(); try (ServerSocket serverSocket = new ServerSocket(port)) { assertThat(serverSocket).isNotNull(); - assertThat(serverSocket.getLocalPort()).isGreaterThan(0); + assertThat(serverSocket.getLocalPort()).isEqualTo(port); } catch (IOException e) { fail("Port is not available"); } From 40029ed9fc95dd04b548b51f91d564c93299a969 Mon Sep 17 00:00:00 2001 From: Daniel Strmecki Date: Sun, 11 Oct 2020 11:16:32 +0200 Subject: [PATCH 0933/1862] BAEL-4504: Wrong artifact ID --- core-java-modules/core-java-networking-3/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-networking-3/pom.xml b/core-java-modules/core-java-networking-3/pom.xml index 2a5522074a..d72981f862 100644 --- a/core-java-modules/core-java-networking-3/pom.xml +++ b/core-java-modules/core-java-networking-3/pom.xml @@ -4,7 +4,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - core-java-networking-4 + core-java-networking-3 core-java-networking-3 jar From b447b94b5037f2c9078d2104d4b92e7759eefbfc Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 11 Oct 2020 16:26:31 +0530 Subject: [PATCH 0934/1862] moved spring-rest-compress module to spring-resttemplate-2 module --- spring-resttemplate-2/README.md | 1 + spring-resttemplate-2/pom.xml | 23 ++++++++ ...mpressingClientHttpRequestInterceptor.java | 38 +++++++++++++ .../java/com/baeldung/compress/GzipUtils.java | 52 +++++++++++++++++ .../compress/JettyWebServerConfiguration.java | 38 +++++++++++++ .../java/com/baeldung/compress/Message.java | 29 ++++++++++ .../baeldung/compress/MessageController.java | 38 +++++++++++++ .../compress/RestTemplateConfiguration.java | 21 +++++++ .../SpringCompressRequestApplication.java | 15 +++++ .../baeldung/compress/GzipUtilsUnitTest.java | 19 +++++++ .../compress/MessageControllerUnitTest.java | 56 +++++++++++++++++++ 11 files changed, 330 insertions(+) create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/compress/CompressingClientHttpRequestInterceptor.java create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/compress/GzipUtils.java create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/compress/JettyWebServerConfiguration.java create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/compress/Message.java create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/compress/MessageController.java create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/compress/RestTemplateConfiguration.java create mode 100644 spring-resttemplate-2/src/main/java/com/baeldung/compress/SpringCompressRequestApplication.java create mode 100644 spring-resttemplate-2/src/test/java/com/baeldung/compress/GzipUtilsUnitTest.java create mode 100644 spring-resttemplate-2/src/test/java/com/baeldung/compress/MessageControllerUnitTest.java diff --git a/spring-resttemplate-2/README.md b/spring-resttemplate-2/README.md index e1e0ba40b0..37d8ac9740 100644 --- a/spring-resttemplate-2/README.md +++ b/spring-resttemplate-2/README.md @@ -8,3 +8,4 @@ This module contains articles about Spring RestTemplate - [Proxies With RestTemplate](https://www.baeldung.com/java-resttemplate-proxy) - [A Custom Media Type for a Spring REST API](https://www.baeldung.com/spring-rest-custom-media-type) - [RestTemplate Post Request with JSON](https://www.baeldung.com/spring-resttemplate-post-json) +- [How to compress requests using the Spring RestTemplate](https://www.baeldung.com/spring-resttemplate-compressing-requests) diff --git a/spring-resttemplate-2/pom.xml b/spring-resttemplate-2/pom.xml index b1d6f60c53..2aed154be6 100644 --- a/spring-resttemplate-2/pom.xml +++ b/spring-resttemplate-2/pom.xml @@ -20,7 +20,30 @@ org.springframework.boot spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-jetty + + + + org.apache.httpcomponents + httpclient + + + + commons-io + commons-io + ${commons-io.version} + + org.springframework.boot spring-boot-starter-test diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/compress/CompressingClientHttpRequestInterceptor.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/CompressingClientHttpRequestInterceptor.java new file mode 100644 index 0000000000..e880e8f915 --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/CompressingClientHttpRequestInterceptor.java @@ -0,0 +1,38 @@ +package com.baeldung.compress; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; + +import java.io.IOException; + +public class CompressingClientHttpRequestInterceptor implements ClientHttpRequestInterceptor { + + private static final Logger LOG = LoggerFactory.getLogger(CompressingClientHttpRequestInterceptor.class); + + private static final String GZIP_ENCODING = "gzip"; + + /** + * Compress a request body using Gzip and add Http headers. + * + * @param req + * @param body + * @param exec + * @return + * @throws IOException + */ + @Override + public ClientHttpResponse intercept(HttpRequest req, byte[] body, ClientHttpRequestExecution exec) + throws IOException { + LOG.info("Compressing request..."); + HttpHeaders httpHeaders = req.getHeaders(); + httpHeaders.add(HttpHeaders.CONTENT_ENCODING, GZIP_ENCODING); + httpHeaders.add(HttpHeaders.ACCEPT_ENCODING, GZIP_ENCODING); + return exec.execute(req, GzipUtils.compress(body)); + } + +} diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/compress/GzipUtils.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/GzipUtils.java new file mode 100644 index 0000000000..50c565d92c --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/GzipUtils.java @@ -0,0 +1,52 @@ +package com.baeldung.compress; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import org.apache.commons.io.IOUtils; + +public class GzipUtils { + + /** + * Gzip a string. + * + * @param text + * @return + * @throws Exception + */ + public static byte[] compress(String text) throws Exception { + return GzipUtils.compress(text.getBytes(StandardCharsets.UTF_8)); + } + + /** + * Gzip a byte array. + * + * @param body + * @return + * @throws IOException + */ + public static byte[] compress(byte[] body) throws IOException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try (GZIPOutputStream gzipOutputStream = new GZIPOutputStream(baos)) { + gzipOutputStream.write(body); + } + return baos.toByteArray(); + } + + /** + * Decompress a Gzipped byte array to a String. + * + * @param body + * @return + * @throws IOException + */ + public static String decompress(byte[] body) throws IOException { + try (GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(body))) { + return IOUtils.toString(gzipInputStream, StandardCharsets.UTF_8); + } + } +} diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/compress/JettyWebServerConfiguration.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/JettyWebServerConfiguration.java new file mode 100644 index 0000000000..3ac8c31ab3 --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/JettyWebServerConfiguration.java @@ -0,0 +1,38 @@ +package com.baeldung.compress; + +import org.eclipse.jetty.server.handler.HandlerCollection; +import org.eclipse.jetty.server.handler.gzip.GzipHandler; +import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Configure Jetty web server so it handles compressed requests. + */ +@Configuration +public class JettyWebServerConfiguration { + + private static final int MIN_BYTES = 1; + + /** + * Customise the Jetty web server to automatically decompress requests. + */ + @Bean + public JettyServletWebServerFactory jettyServletWebServerFactory() { + + JettyServletWebServerFactory factory = new JettyServletWebServerFactory(); + factory.addServerCustomizers(server -> { + + GzipHandler gzipHandler = new GzipHandler(); + // Enable request decompression + gzipHandler.setInflateBufferSize(MIN_BYTES); + gzipHandler.setHandler(server.getHandler()); + + HandlerCollection handlerCollection = new HandlerCollection(gzipHandler); + server.setHandler(handlerCollection); + }); + + return factory; + } + +} diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/compress/Message.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/Message.java new file mode 100644 index 0000000000..f43d06c2fc --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/Message.java @@ -0,0 +1,29 @@ +package com.baeldung.compress; + +public class Message { + + private String text; + + public Message() { + } + + public Message(String text) { + this.text = text; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("Message {"); + sb.append("text='").append(text).append('\''); + sb.append('}'); + return sb.toString(); + } +} diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/compress/MessageController.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/MessageController.java new file mode 100644 index 0000000000..ec574d9dec --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/MessageController.java @@ -0,0 +1,38 @@ +package com.baeldung.compress; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +@RestController +public class MessageController { + + protected static final String PROCESSED = "Processed "; + + protected static final String REQUEST_MAPPING = "process"; + + private static final Logger LOG = LoggerFactory.getLogger(MessageController.class); + + /** + * A simple endpoint that responds with "Processed " + supplied Message content. + * + * @param headers + * @param message + * @return + */ + @PostMapping(value = REQUEST_MAPPING) + public ResponseEntity processMessage(@RequestHeader Map headers, + @RequestBody Message message) { + + // Print headers + headers.forEach((k, v) -> LOG.info(k + "=" + v)); + + return ResponseEntity.ok(PROCESSED + message.getText()); + } +} diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/compress/RestTemplateConfiguration.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/RestTemplateConfiguration.java new file mode 100644 index 0000000000..12b1e4249e --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/RestTemplateConfiguration.java @@ -0,0 +1,21 @@ +package com.baeldung.compress; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfiguration { + + /** + * A RestTemplate that compresses requests. + * + * @return RestTemplate + */ + @Bean + public RestTemplate getRestTemplate() { + RestTemplate restTemplate = new RestTemplate(); + restTemplate.getInterceptors().add(new CompressingClientHttpRequestInterceptor()); + return restTemplate; + } +} diff --git a/spring-resttemplate-2/src/main/java/com/baeldung/compress/SpringCompressRequestApplication.java b/spring-resttemplate-2/src/main/java/com/baeldung/compress/SpringCompressRequestApplication.java new file mode 100644 index 0000000000..9ff88ab257 --- /dev/null +++ b/spring-resttemplate-2/src/main/java/com/baeldung/compress/SpringCompressRequestApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.compress; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableAutoConfiguration +public class SpringCompressRequestApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringCompressRequestApplication.class, args); + } + +} diff --git a/spring-resttemplate-2/src/test/java/com/baeldung/compress/GzipUtilsUnitTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/compress/GzipUtilsUnitTest.java new file mode 100644 index 0000000000..10c2eeb748 --- /dev/null +++ b/spring-resttemplate-2/src/test/java/com/baeldung/compress/GzipUtilsUnitTest.java @@ -0,0 +1,19 @@ +package com.baeldung.compress; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class GzipUtilsUnitTest { + + @Test + public void givenCompressedText_whenDecompressed_thenSuccessful() throws Exception { + final String expectedText = "Hello Baeldung!"; + byte[] compressedText = GzipUtils.compress(expectedText); + String decompressedText = GzipUtils.decompress(compressedText); + assertNotNull(compressedText); + assertEquals(expectedText, decompressedText); + } + +} \ No newline at end of file diff --git a/spring-resttemplate-2/src/test/java/com/baeldung/compress/MessageControllerUnitTest.java b/spring-resttemplate-2/src/test/java/com/baeldung/compress/MessageControllerUnitTest.java new file mode 100644 index 0000000000..643e3f6881 --- /dev/null +++ b/spring-resttemplate-2/src/test/java/com/baeldung/compress/MessageControllerUnitTest.java @@ -0,0 +1,56 @@ +package com.baeldung.compress; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.web.client.RestTemplate; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class MessageControllerUnitTest { + + private static final Logger LOG = LoggerFactory.getLogger(MessageControllerUnitTest.class); + + @Autowired + private RestTemplate restTemplate; + + @LocalServerPort + private int randomServerPort; + + /** + * As a further test you can intercept the request body, using a tool like + * Wireshark, to see the request body is actually gzipped. + * + * @throws Exception + */ + @Test + public void givenRestTemplate_whenPostCompressedRequest_thenRespondsSuccessfully() throws Exception { + + final String text = "Hello Baeldung!"; + Message message = new Message(text); + + HttpEntity request = new HttpEntity<>(message); + String uri = String.format("http://localhost:%s/%s", randomServerPort, MessageController.REQUEST_MAPPING); + + ResponseEntity responseEntity = restTemplate.postForEntity(uri, request, String.class); + + String response = responseEntity.getBody(); + LOG.info("Got response [{}]", response); + + assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); + assertNotNull(response); + assertEquals(MessageController.PROCESSED + text, response); + } + +} From cbb0d50370075b4d326eb4248b0d748c2fee2458 Mon Sep 17 00:00:00 2001 From: Mithu Tokder Date: Sun, 11 Oct 2020 23:47:08 +0530 Subject: [PATCH 0935/1862] updated junit 5 version to latest version --- testing-modules/junit5-annotations/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing-modules/junit5-annotations/pom.xml b/testing-modules/junit5-annotations/pom.xml index 9e51d0ab55..7ffc17c69b 100644 --- a/testing-modules/junit5-annotations/pom.xml +++ b/testing-modules/junit5-annotations/pom.xml @@ -55,8 +55,8 @@ - 5.6.2 - 1.6.0 + 5.7.0 + 1.7.0 2.8.2 3.11.1 From afe9a94a4e8f5afdf1e3f355ae64e2ceb21e0a85 Mon Sep 17 00:00:00 2001 From: Simone Cusimano Date: Mon, 12 Oct 2020 08:07:01 +0200 Subject: [PATCH 0936/1862] Remove unnecessary files --- gradle/gradle-dependency-management/gradlew | 184 ------------------ .../gradle-dependency-management/gradlew.bat | 89 --------- 2 files changed, 273 deletions(-) delete mode 100644 gradle/gradle-dependency-management/gradlew delete mode 100644 gradle/gradle-dependency-management/gradlew.bat diff --git a/gradle/gradle-dependency-management/gradlew b/gradle/gradle-dependency-management/gradlew deleted file mode 100644 index 8f8904743c..0000000000 --- a/gradle/gradle-dependency-management/gradlew +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ]; do - ls=$(ls -ld "$PRG") - link=$(expr "$ls" : '.*-> \(.*\)$') - if expr "$link" : '/.*' >/dev/null; then - PRG="$link" - else - PRG=$(dirname "$PRG")"/$link" - fi -done -SAVED="$(pwd)" -cd "$(dirname \"$PRG\")/" >/dev/null -APP_HOME="$(pwd -P)" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=$(basename "$0") - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn() { - echo "$*" -} - -die() { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$(uname)" in -CYGWIN*) - cygwin=true - ;; -Darwin*) - darwin=true - ;; -MINGW*) - msys=true - ;; -NONSTOP*) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ]; then - if [ -x "$JAVA_HOME/jre/sh/java" ]; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ]; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then - MAX_FD_LIMIT=$(ulimit -H -n) - if [ $? -eq 0 ]; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ]; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ]; then - APP_HOME=$(cygpath --path --mixed "$APP_HOME") - CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") - - JAVACMD=$(cygpath --unix "$JAVACMD") - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) - SEP="" - for dir in $ROOTDIRSRAW; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ]; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@"; do - CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) - CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition - eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") - else - eval $(echo args$i)="\"$arg\"" - fi - i=$(expr $i + 1) - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save() { - for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/gradle/gradle-dependency-management/gradlew.bat b/gradle/gradle-dependency-management/gradlew.bat deleted file mode 100644 index 107acd32c4..0000000000 --- a/gradle/gradle-dependency-management/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega From 4c748f7a23f80242656cd3574dded30459d8f2ae Mon Sep 17 00:00:00 2001 From: Cristian Stancalau Date: Mon, 12 Oct 2020 16:35:24 +0300 Subject: [PATCH 0937/1862] =?UTF-8?q?Explanation=20of=20=E2=80=9CClassCast?= =?UTF-8?q?Exception=E2=80=9D=20in=20Java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exceptions/classcastexception/Main.java | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java new file mode 100644 index 0000000000..ef891ccde6 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java @@ -0,0 +1,97 @@ +package com.baeldung.exceptions.classcastexception; + +import java.io.Serializable; + +public class Main { + + public static void main(String[] args) { + + checkedCasts(); + uncheckedConversion(); + genericConversion(); + } + + private static void checkedCasts() { + + Animal animal = new Frog(); + + try { + Mammal mammal = (Mammal) animal; + } catch (ClassCastException e) { + System.out.println("A checked downcast to Mammal is incompatible from Frog because Frog is not a subtype of Mammal."); + } + + try { + Serializable serial = (Serializable) animal; + } catch (ClassCastException e) { + System.out.println("A checked cast to Serializable is incompatible from Frog because Frog is not a subtype of Serializable."); + } + + Object primitives = new int[1]; + + try { + Integer[] integers = (Integer[]) primitives; + } catch (ClassCastException e) { + System.out.println("A checked cast to Integer[] is incompatible from primitive arrays. Auto-boxing does not work for arrays."); + } + + try { + long[] longs = (long[]) primitives; + } catch (ClassCastException e) { + System.out.println("A checked cast to long[] is incompatible from int[]. Type promotion does not work for arrays."); + } + } + + private static void uncheckedConversion() { + Box originalBox = new Box<>(); + Box raw = originalBox; + raw.setContent(2.5); + Box bound = (Box) raw; + try { + Long content = bound.getContent(); + } catch (ClassCastException e) { + System.out.println("An incompatible element was found in the raw box."); + } + } + + private static void genericConversion() { + try { + String shouldBeNull = convertInstanceOfObject(123); + } catch (ClassCastException e) { + System.out.println("Should have been null, but due to type erasure, inside convertInstanceOfObject, " + + "it will attempt to cast to Object instead of String, so it casts to Object, which is always possible."); + } + } + + public static T convertInstanceOfObject(Object o) { + try { + return (T) o; + } catch (ClassCastException e) { + return null; + } + } + + public interface Animal { + } + + public static class Reptile implements Animal { + } + + public static class Frog extends Reptile { + } + + public static class Mammal implements Animal { + } + + public static class Box { + private T content; + + public T getContent() { + return content; + } + + public void setContent(T content) { + this.content = content; + } + } +} From 6a82d1cde60aeca86944d3ce7a86346ba93ee389 Mon Sep 17 00:00:00 2001 From: Cristian Stancalau Date: Mon, 12 Oct 2020 16:37:08 +0300 Subject: [PATCH 0938/1862] Reformat --- .../com/baeldung/exceptions/classcastexception/Main.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java index ef891ccde6..a92c9c6d74 100644 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java @@ -5,16 +5,13 @@ import java.io.Serializable; public class Main { public static void main(String[] args) { - checkedCasts(); uncheckedConversion(); genericConversion(); } private static void checkedCasts() { - Animal animal = new Frog(); - try { Mammal mammal = (Mammal) animal; } catch (ClassCastException e) { @@ -28,7 +25,6 @@ public class Main { } Object primitives = new int[1]; - try { Integer[] integers = (Integer[]) primitives; } catch (ClassCastException e) { @@ -94,4 +90,5 @@ public class Main { this.content = content; } } + } From 453327db2b1385477d8d4d3982156dd1bcd937dd Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Mon, 12 Oct 2020 18:49:59 +0200 Subject: [PATCH 0939/1862] Upgrade Gatling versions --- testing-modules/load-testing-comparison/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing-modules/load-testing-comparison/pom.xml b/testing-modules/load-testing-comparison/pom.xml index adc768b563..55e94379db 100644 --- a/testing-modules/load-testing-comparison/pom.xml +++ b/testing-modules/load-testing-comparison/pom.xml @@ -117,10 +117,10 @@ 1.8 1.8 UTF-8 - 2.11.12 - 2.2.5 - 3.2.2 - 2.2.1 + 2.12.12 + 3.4.0 + 4.4.0 + 3.1.0 5.0 From c608c133f64b708b4fa3dcc6afba60723c1080ea Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Mon, 12 Oct 2020 18:50:26 +0200 Subject: [PATCH 0940/1862] Remove extra headers as the other tools don't set them and that's extra traffic --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 5 ----- 1 file changed, 5 deletions(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index 15d86ebedb..050c99d9d4 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -10,11 +10,6 @@ class RewardsScenario extends Simulation { def randCustId() = java.util.concurrent.ThreadLocalRandom.current().nextInt(1, 10000) val httpProtocol = http.baseUrl("http://localhost:8080") - .acceptHeader("text/html,application/json;q=0.9,*/*;q=0.8") - .doNotTrackHeader("1") - .acceptLanguageHeader("en-US,en;q=0.5") - .acceptEncodingHeader("gzip, deflate") - .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0") val scn = scenario("RewardsScenario") .repeat(100){ From 024da8003bb3c445e32b8d57bed5edd6a756dcbb Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Mon, 12 Oct 2020 18:51:09 +0200 Subject: [PATCH 0941/1862] Remove RNG upper bound like in Grinder test to avoid race condition in application under test --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index 050c99d9d4..540e40a225 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -7,7 +7,7 @@ import scala.concurrent.duration._ class RewardsScenario extends Simulation { - def randCustId() = java.util.concurrent.ThreadLocalRandom.current().nextInt(1, 10000) + def randCustId() = java.util.concurrent.ThreadLocalRandom.current().nextInt() val httpProtocol = http.baseUrl("http://localhost:8080") From 775f790d1d3f6a19db6a1521a3d5d7c22264e950 Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Mon, 12 Oct 2020 23:37:44 +0530 Subject: [PATCH 0942/1862] renamed junit test case to manual test case (#10154) --- .../{OpenfeignUnitTest.java => OpenfeignManualTest.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/{OpenfeignUnitTest.java => OpenfeignManualTest.java} (100%) diff --git a/spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/OpenfeignUnitTest.java b/spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/OpenfeignManualTest.java similarity index 100% rename from spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/OpenfeignUnitTest.java rename to spring-cloud/spring-cloud-openfeign/src/test/java/com/baeldung/cloud/openfeign/OpenfeignManualTest.java From f0b9b3db29ccb0b59b7cbefb219c0584a06278bd Mon Sep 17 00:00:00 2001 From: sharifi Date: Mon, 12 Oct 2020 23:07:48 +0330 Subject: [PATCH 0943/1862] separate directories --- .../DispatchServletApplication.java | 15 ++++++++++ .../dispatchservlet/conf/WebConf.java | 29 ++++++++++++++++++ .../controller/Controller.java | 15 ++++++++++ .../dispatchservlet/filter/CustomFilter.java | 30 +++++++++++++++++++ .../listener/CustomListener.java | 22 ++++++++++++++ .../servlet/CustomServlet.java | 29 ++++++++++++++++++ 6 files changed, 140 insertions(+) create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/DispatchServletApplication.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/conf/WebConf.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/controller/Controller.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/filter/CustomFilter.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/listener/CustomListener.java create mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/servlet/CustomServlet.java diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/DispatchServletApplication.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/DispatchServletApplication.java new file mode 100644 index 0000000000..4d58715d88 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/DispatchServletApplication.java @@ -0,0 +1,15 @@ +package com.baeldung.dispatchservlet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.annotation.Configuration; + +@SpringBootApplication +public class DispatchServletApplication { + + public static void main(String[] args) { + SpringApplication.run(DispatchServletApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/conf/WebConf.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/conf/WebConf.java new file mode 100644 index 0000000000..9a1170ca34 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/conf/WebConf.java @@ -0,0 +1,29 @@ +package com.baeldung.dispatchservlet.conf; + +import com.baeldung.dispatchservlet.listener.CustomListener; +import com.baeldung.dispatchservlet.servlet.CustomServlet; +import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.ServletContextListener; + +@Configuration +public class WebConf { + + @Bean + public ServletRegistrationBean customServletBean() { + ServletRegistrationBean bean = + new ServletRegistrationBean(new CustomServlet(), "/servlet"); + return bean; + } + + @Bean + public ServletListenerRegistrationBean customListenerBean() { + ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean(); + bean.setListener(new CustomListener()); + return bean; + } + +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/controller/Controller.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/controller/Controller.java new file mode 100644 index 0000000000..14d71c60fb --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/controller/Controller.java @@ -0,0 +1,15 @@ +package com.baeldung.dispatchservlet.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping(value = "/") +public class Controller { + + @GetMapping + public String getRequest(){ + return "Baeldung DispatcherServlet"; + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/filter/CustomFilter.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/filter/CustomFilter.java new file mode 100644 index 0000000000..8429fc855f --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/filter/CustomFilter.java @@ -0,0 +1,30 @@ +package com.baeldung.dispatchservlet.filter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.servlet.*; +import java.io.IOException; + +@Component +public class CustomFilter implements Filter { + + Logger logger = LoggerFactory.getLogger(CustomFilter.class); + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + logger.info("CustomFilter is invoked"); + chain.doFilter(request, response); + } + + @Override + public void destroy() { + + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/listener/CustomListener.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/listener/CustomListener.java new file mode 100644 index 0000000000..62b316c012 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/listener/CustomListener.java @@ -0,0 +1,22 @@ +package com.baeldung.dispatchservlet.listener; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +public class CustomListener implements ServletContextListener { + + Logger logger = LoggerFactory.getLogger(CustomListener.class); + + @Override + public void contextInitialized(ServletContextEvent sce) { + logger.info("CustomListener is initialized"); + } + + @Override + public void contextDestroyed(ServletContextEvent sce) { + logger.info("CustomListener is destroyed"); + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/servlet/CustomServlet.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/servlet/CustomServlet.java new file mode 100644 index 0000000000..2a99e797ce --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com/baeldung/dispatchservlet/servlet/CustomServlet.java @@ -0,0 +1,29 @@ +package com.baeldung.dispatchservlet.servlet; + +import com.baeldung.dispatchservlet.filter.CustomFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class CustomServlet extends HttpServlet { + + Logger logger = LoggerFactory.getLogger(CustomServlet.class); + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + logger.info("CustomServlet doGet() method is invoked"); + super.doGet(req, resp); + } + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + logger.info("CustomServlet doPost() method is invoked"); + super.doPost(req, resp); + } +} From 450614d511d5d3c2ce42b78cc9881d9b60ffc5c3 Mon Sep 17 00:00:00 2001 From: Loredana Date: Tue, 13 Oct 2020 16:44:18 +0300 Subject: [PATCH 0944/1862] update loops count JAVA-2603 --- .../src/main/resources/scripts/Gatling/GatlingScenario.scala | 2 +- .../src/main/resources/scripts/JMeter/Test Plan.jmx | 4 ++-- .../src/main/resources/scripts/The Grinder/grinder.properties | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index 540e40a225..fc639881f5 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -12,7 +12,7 @@ class RewardsScenario extends Simulation { val httpProtocol = http.baseUrl("http://localhost:8080") val scn = scenario("RewardsScenario") - .repeat(100){ + .repeat(1000){ exec(http("transactions_add") .post("/transactions/add/") diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx index 413a8d3387..cbb036b77b 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/JMeter/Test Plan.jmx @@ -16,7 +16,7 @@ continue false - 100 + 1000 100 0 @@ -200,7 +200,7 @@ - 10000 + 9223372036854775806 1 false diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties index f256f5a7dd..ca5969cb7a 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/The Grinder/grinder.properties @@ -1,5 +1,5 @@ grinder.script = grinder.py grinder.threads = 100 grinder.processes = 1 -grinder.runs = 100 +grinder.runs = 1000 grinder.logDirectory = /logs From 3e25eae6513fe63ea36ec29995aeba263ec05f59 Mon Sep 17 00:00:00 2001 From: mikr Date: Tue, 13 Oct 2020 18:46:25 +0200 Subject: [PATCH 0945/1862] JAVA-2136 Fix integration test in spring-jersey module --- spring-jersey/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml index 3c84e9c11e..50d377b73f 100644 --- a/spring-jersey/pom.xml +++ b/spring-jersey/pom.xml @@ -226,7 +226,7 @@ 4.4.9 4.5.5 4.0.0 - 2.25.1 + 2.27.2 3.10.0 1.5.10.RELEASE From eeadbb04f0521eb0db15f908be861320a04ad8f7 Mon Sep 17 00:00:00 2001 From: sharifi Date: Wed, 14 Oct 2020 15:32:29 +0330 Subject: [PATCH 0946/1862] delete the original classes related to separate the directories --- .../DispatchServletApplication.java | 15 ---------- .../conf/WebConf.java | 29 ------------------ .../controller/Controller.java | 15 ---------- .../filter/CustomFilter.java | 30 ------------------- .../listener/CustomListener.java | 22 -------------- .../servlet/CustomServlet.java | 29 ------------------ 6 files changed, 140 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/DispatchServletApplication.java delete mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/conf/WebConf.java delete mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/controller/Controller.java delete mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/filter/CustomFilter.java delete mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/listener/CustomListener.java delete mode 100644 spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/servlet/CustomServlet.java diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/DispatchServletApplication.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/DispatchServletApplication.java deleted file mode 100644 index 4d58715d88..0000000000 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/DispatchServletApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.dispatchservlet; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.web.servlet.ServletComponentScan; -import org.springframework.context.annotation.Configuration; - -@SpringBootApplication -public class DispatchServletApplication { - - public static void main(String[] args) { - SpringApplication.run(DispatchServletApplication.class, args); - } - -} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/conf/WebConf.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/conf/WebConf.java deleted file mode 100644 index 9a1170ca34..0000000000 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/conf/WebConf.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.dispatchservlet.conf; - -import com.baeldung.dispatchservlet.listener.CustomListener; -import com.baeldung.dispatchservlet.servlet.CustomServlet; -import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; -import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import javax.servlet.ServletContextListener; - -@Configuration -public class WebConf { - - @Bean - public ServletRegistrationBean customServletBean() { - ServletRegistrationBean bean = - new ServletRegistrationBean(new CustomServlet(), "/servlet"); - return bean; - } - - @Bean - public ServletListenerRegistrationBean customListenerBean() { - ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean(); - bean.setListener(new CustomListener()); - return bean; - } - -} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/controller/Controller.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/controller/Controller.java deleted file mode 100644 index 14d71c60fb..0000000000 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/controller/Controller.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.dispatchservlet.controller; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping(value = "/") -public class Controller { - - @GetMapping - public String getRequest(){ - return "Baeldung DispatcherServlet"; - } -} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/filter/CustomFilter.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/filter/CustomFilter.java deleted file mode 100644 index 8429fc855f..0000000000 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/filter/CustomFilter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baeldung.dispatchservlet.filter; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.servlet.*; -import java.io.IOException; - -@Component -public class CustomFilter implements Filter { - - Logger logger = LoggerFactory.getLogger(CustomFilter.class); - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - logger.info("CustomFilter is invoked"); - chain.doFilter(request, response); - } - - @Override - public void destroy() { - - } -} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/listener/CustomListener.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/listener/CustomListener.java deleted file mode 100644 index 62b316c012..0000000000 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/listener/CustomListener.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.dispatchservlet.listener; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -public class CustomListener implements ServletContextListener { - - Logger logger = LoggerFactory.getLogger(CustomListener.class); - - @Override - public void contextInitialized(ServletContextEvent sce) { - logger.info("CustomListener is initialized"); - } - - @Override - public void contextDestroyed(ServletContextEvent sce) { - logger.info("CustomListener is destroyed"); - } -} diff --git a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/servlet/CustomServlet.java b/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/servlet/CustomServlet.java deleted file mode 100644 index 2a99e797ce..0000000000 --- a/spring-boot-modules/spring-boot-basic-customization-2/src/main/java/com.baeldung.dispatchservlet/servlet/CustomServlet.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.dispatchservlet.servlet; - -import com.baeldung.dispatchservlet.filter.CustomFilter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -public class CustomServlet extends HttpServlet { - - Logger logger = LoggerFactory.getLogger(CustomServlet.class); - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - logger.info("CustomServlet doGet() method is invoked"); - super.doGet(req, resp); - } - - @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - logger.info("CustomServlet doPost() method is invoked"); - super.doPost(req, resp); - } -} From 5a05897688ce4c64c02f2fc35cb3d4640ed49974 Mon Sep 17 00:00:00 2001 From: Loredana Date: Wed, 14 Oct 2020 16:16:17 +0300 Subject: [PATCH 0947/1862] revert explicit junit, maven version overrides for boot projects --- persistence-modules/flyway-repair/pom.xml | 4 ---- persistence-modules/flyway/pom.xml | 4 ---- persistence-modules/r2dbc/pom.xml | 4 ---- persistence-modules/redis/pom.xml | 4 ---- persistence-modules/spring-boot-mysql/pom.xml | 4 ---- persistence-modules/spring-boot-persistence-h2/pom.xml | 4 ---- .../spring-boot-persistence-mongodb/pom.xml | 4 ---- persistence-modules/spring-boot-persistence/pom.xml | 5 ----- persistence-modules/spring-data-cassandra-reactive/pom.xml | 4 ---- persistence-modules/spring-data-cassandra/pom.xml | 4 ---- persistence-modules/spring-data-cosmosdb/pom.xml | 4 ---- persistence-modules/spring-data-dynamodb/pom.xml | 5 ----- persistence-modules/spring-data-elasticsearch/pom.xml | 5 ----- persistence-modules/spring-data-jdbc/pom.xml | 4 ---- persistence-modules/spring-data-jpa-annotations/pom.xml | 4 ---- persistence-modules/spring-data-jpa-crud/pom.xml | 5 ----- persistence-modules/spring-data-jpa-enterprise/pom.xml | 4 ---- persistence-modules/spring-data-jpa-filtering/pom.xml | 4 ---- persistence-modules/spring-data-jpa-query-2/pom.xml | 4 ---- persistence-modules/spring-data-jpa-query/pom.xml | 4 ---- persistence-modules/spring-data-jpa-repo-2/pom.xml | 4 ---- persistence-modules/spring-data-jpa-repo/pom.xml | 5 +---- persistence-modules/spring-data-keyvalue/pom.xml | 5 +---- persistence-modules/spring-data-mongodb/pom.xml | 4 ---- persistence-modules/spring-data-redis/pom.xml | 5 ----- persistence-modules/spring-data-solr/pom.xml | 4 ---- persistence-modules/spring-jdbc/pom.xml | 7 ------- 27 files changed, 2 insertions(+), 116 deletions(-) diff --git a/persistence-modules/flyway-repair/pom.xml b/persistence-modules/flyway-repair/pom.xml index 82e5d705f9..2c283cfc04 100644 --- a/persistence-modules/flyway-repair/pom.xml +++ b/persistence-modules/flyway-repair/pom.xml @@ -76,10 +76,6 @@ src/main/resources/application-${spring-boot.run.profiles}.properties - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/flyway/pom.xml b/persistence-modules/flyway/pom.xml index 2379f996d7..c4a3363bdc 100644 --- a/persistence-modules/flyway/pom.xml +++ b/persistence-modules/flyway/pom.xml @@ -66,10 +66,6 @@ 5.2.3 5.0.2 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/r2dbc/pom.xml b/persistence-modules/r2dbc/pom.xml index 7083eea64d..01f1b351cd 100644 --- a/persistence-modules/r2dbc/pom.xml +++ b/persistence-modules/r2dbc/pom.xml @@ -69,10 +69,6 @@ 0.8.1.RELEASE 1.4.200 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/redis/pom.xml b/persistence-modules/redis/pom.xml index 9e00566767..fa82bebc64 100644 --- a/persistence-modules/redis/pom.xml +++ b/persistence-modules/redis/pom.xml @@ -62,10 +62,6 @@ 3.3.0 4.1.50.Final - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-boot-mysql/pom.xml b/persistence-modules/spring-boot-mysql/pom.xml index 9b8c6d0028..834d1d1e64 100644 --- a/persistence-modules/spring-boot-mysql/pom.xml +++ b/persistence-modules/spring-boot-mysql/pom.xml @@ -40,10 +40,6 @@ 8.0.12 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-boot-persistence-h2/pom.xml b/persistence-modules/spring-boot-persistence-h2/pom.xml index 23520a3fda..c06c35cfee 100644 --- a/persistence-modules/spring-boot-persistence-h2/pom.xml +++ b/persistence-modules/spring-boot-persistence-h2/pom.xml @@ -47,10 +47,6 @@ com.baeldung.h2db.demo.server.SpringBootApp 1.0.4 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-boot-persistence-mongodb/pom.xml b/persistence-modules/spring-boot-persistence-mongodb/pom.xml index 69ef09356d..5167483aa3 100644 --- a/persistence-modules/spring-boot-persistence-mongodb/pom.xml +++ b/persistence-modules/spring-boot-persistence-mongodb/pom.xml @@ -37,9 +37,5 @@ - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-boot-persistence/pom.xml b/persistence-modules/spring-boot-persistence/pom.xml index b034f6dad9..9e44a7b9c1 100644 --- a/persistence-modules/spring-boot-persistence/pom.xml +++ b/persistence-modules/spring-boot-persistence/pom.xml @@ -76,11 +76,6 @@ 2.23.0 2.0.1.Final - - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-cassandra-reactive/pom.xml b/persistence-modules/spring-data-cassandra-reactive/pom.xml index 42329e03f0..f2f71bceac 100644 --- a/persistence-modules/spring-data-cassandra-reactive/pom.xml +++ b/persistence-modules/spring-data-cassandra-reactive/pom.xml @@ -54,10 +54,6 @@ 2.2.6.RELEASE 3.11.2.0 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-cassandra/pom.xml b/persistence-modules/spring-data-cassandra/pom.xml index a56d067a05..9de1cbf20e 100644 --- a/persistence-modules/spring-data-cassandra/pom.xml +++ b/persistence-modules/spring-data-cassandra/pom.xml @@ -105,10 +105,6 @@ 2.1.9.2 2.0-0 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-cosmosdb/pom.xml b/persistence-modules/spring-data-cosmosdb/pom.xml index 0f9e8ac72f..19a66648b2 100644 --- a/persistence-modules/spring-data-cosmosdb/pom.xml +++ b/persistence-modules/spring-data-cosmosdb/pom.xml @@ -17,10 +17,6 @@ 1.8 2.3.0 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-dynamodb/pom.xml b/persistence-modules/spring-data-dynamodb/pom.xml index 0f4b578088..377e35b635 100644 --- a/persistence-modules/spring-data-dynamodb/pom.xml +++ b/persistence-modules/spring-data-dynamodb/pom.xml @@ -182,11 +182,6 @@ 1.11.86 https://s3-us-west-2.amazonaws.com/dynamodb-local/release 3.1.1 - - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-elasticsearch/pom.xml b/persistence-modules/spring-data-elasticsearch/pom.xml index c94962d39d..6a983145ee 100644 --- a/persistence-modules/spring-data-elasticsearch/pom.xml +++ b/persistence-modules/spring-data-elasticsearch/pom.xml @@ -69,10 +69,5 @@ 1.2.47 0.7 1.15.0 - - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jdbc/pom.xml b/persistence-modules/spring-data-jdbc/pom.xml index eca8037e20..15f8d7fb95 100644 --- a/persistence-modules/spring-data-jdbc/pom.xml +++ b/persistence-modules/spring-data-jdbc/pom.xml @@ -28,9 +28,5 @@ - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-jpa-annotations/pom.xml b/persistence-modules/spring-data-jpa-annotations/pom.xml index ea2fe34f3c..ff30790eaf 100644 --- a/persistence-modules/spring-data-jpa-annotations/pom.xml +++ b/persistence-modules/spring-data-jpa-annotations/pom.xml @@ -73,10 +73,6 @@ 42.2.5 21.0 - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-crud/pom.xml b/persistence-modules/spring-data-jpa-crud/pom.xml index 44944298e0..1708d14fc2 100644 --- a/persistence-modules/spring-data-jpa-crud/pom.xml +++ b/persistence-modules/spring-data-jpa-crud/pom.xml @@ -66,11 +66,6 @@ 1.4.1 21.0 1.12.2 - - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-jpa-enterprise/pom.xml b/persistence-modules/spring-data-jpa-enterprise/pom.xml index 9ecab5feaa..7ff2f00fdf 100644 --- a/persistence-modules/spring-data-jpa-enterprise/pom.xml +++ b/persistence-modules/spring-data-jpa-enterprise/pom.xml @@ -99,10 +99,6 @@ 21.0 1.12.2 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-jpa-filtering/pom.xml b/persistence-modules/spring-data-jpa-filtering/pom.xml index 7448a5a818..25ef68fe4c 100644 --- a/persistence-modules/spring-data-jpa-filtering/pom.xml +++ b/persistence-modules/spring-data-jpa-filtering/pom.xml @@ -73,10 +73,6 @@ 42.2.5 21.0 - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-query-2/pom.xml b/persistence-modules/spring-data-jpa-query-2/pom.xml index abac7b28da..282a1ff83a 100644 --- a/persistence-modules/spring-data-jpa-query-2/pom.xml +++ b/persistence-modules/spring-data-jpa-query-2/pom.xml @@ -84,10 +84,6 @@ - - 2.22.2 - 5.6.2 - 4.13 9.0.0.M26 1.1 21.0 diff --git a/persistence-modules/spring-data-jpa-query/pom.xml b/persistence-modules/spring-data-jpa-query/pom.xml index fe42d4b595..1576fd729d 100644 --- a/persistence-modules/spring-data-jpa-query/pom.xml +++ b/persistence-modules/spring-data-jpa-query/pom.xml @@ -44,10 +44,6 @@ 1.4.1 - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-2/pom.xml b/persistence-modules/spring-data-jpa-repo-2/pom.xml index 98ecdc6645..3be1068d8c 100644 --- a/persistence-modules/spring-data-jpa-repo-2/pom.xml +++ b/persistence-modules/spring-data-jpa-repo-2/pom.xml @@ -44,9 +44,5 @@ 29.0-jre - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo/pom.xml b/persistence-modules/spring-data-jpa-repo/pom.xml index 07514e9771..16a214fd7f 100644 --- a/persistence-modules/spring-data-jpa-repo/pom.xml +++ b/persistence-modules/spring-data-jpa-repo/pom.xml @@ -50,9 +50,6 @@ - - 2.22.2 - 5.6.2 - 4.13 + \ No newline at end of file diff --git a/persistence-modules/spring-data-keyvalue/pom.xml b/persistence-modules/spring-data-keyvalue/pom.xml index 190d6c7445..3aaee2f00c 100644 --- a/persistence-modules/spring-data-keyvalue/pom.xml +++ b/persistence-modules/spring-data-keyvalue/pom.xml @@ -29,9 +29,6 @@ - - 2.22.2 - 5.6.2 - 4.13 + \ No newline at end of file diff --git a/persistence-modules/spring-data-mongodb/pom.xml b/persistence-modules/spring-data-mongodb/pom.xml index a3a81fe450..448b635667 100644 --- a/persistence-modules/spring-data-mongodb/pom.xml +++ b/persistence-modules/spring-data-mongodb/pom.xml @@ -108,10 +108,6 @@ 3.2.0.RELEASE 4.0.5 - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-redis/pom.xml b/persistence-modules/spring-data-redis/pom.xml index 34674dc223..d271df31c7 100644 --- a/persistence-modules/spring-data-redis/pom.xml +++ b/persistence-modules/spring-data-redis/pom.xml @@ -98,11 +98,6 @@ 3.2.4 0.10.0 0.6 - - - 2.22.2 - 5.6.2 - 4.13 diff --git a/persistence-modules/spring-data-solr/pom.xml b/persistence-modules/spring-data-solr/pom.xml index 94a796c466..38b5bf8238 100644 --- a/persistence-modules/spring-data-solr/pom.xml +++ b/persistence-modules/spring-data-solr/pom.xml @@ -46,10 +46,6 @@ 2.0.5.RELEASE - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file diff --git a/persistence-modules/spring-jdbc/pom.xml b/persistence-modules/spring-jdbc/pom.xml index 77200cd66e..8a5786e1a5 100644 --- a/persistence-modules/spring-jdbc/pom.xml +++ b/persistence-modules/spring-jdbc/pom.xml @@ -18,7 +18,6 @@ org.springframework.data spring-data-jdbc - ${spring-data-jdbc.version} org.springframework.boot @@ -36,11 +35,5 @@ - 2.0.3.RELEASE - - - 2.22.2 - 5.6.2 - 4.13 \ No newline at end of file From e3dc0a40d4b16e8bd49d35813f4857f9ef0faff5 Mon Sep 17 00:00:00 2001 From: Loredana Date: Wed, 14 Oct 2020 16:24:30 +0300 Subject: [PATCH 0948/1862] revert explicit junit, maven version overrides for boot projects --- ddd/pom.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ddd/pom.xml b/ddd/pom.xml index a67719f8a6..7d03208802 100644 --- a/ddd/pom.xml +++ b/ddd/pom.xml @@ -104,16 +104,12 @@ org.apache.maven.plugins maven-surefire-plugin - ${maven-surefire-plugin.version} - 2.22.2 - 1.0.1 - 5.6.2 From af0db9610ed916123ddc695266effbb81793203f Mon Sep 17 00:00:00 2001 From: Cristian Stancalau Date: Wed, 14 Oct 2020 18:22:32 +0300 Subject: [PATCH 0949/1862] Fix review suggestions. --- .../exceptions/classcastexception/Animal.java | 6 ++ .../exceptions/classcastexception/Box.java | 14 +++ .../exceptions/classcastexception/Frog.java | 9 ++ .../exceptions/classcastexception/Main.java | 94 ------------------- .../exceptions/classcastexception/Mammal.java | 9 ++ .../classcastexception/Reptile.java | 9 ++ .../CheckedCastsUnitTest.java | 40 ++++++++ .../GenericConversionUnitTest.java | 21 +++++ .../UncheckedConversionUnitTest.java | 17 ++++ 9 files changed, 125 insertions(+), 94 deletions(-) create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Animal.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Box.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java delete mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Mammal.java create mode 100644 core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java create mode 100644 core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java create mode 100644 core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/GenericConversionUnitTest.java create mode 100644 core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/UncheckedConversionUnitTest.java diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Animal.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Animal.java new file mode 100644 index 0000000000..b57f68f053 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Animal.java @@ -0,0 +1,6 @@ +package com.baeldung.exceptions.classcastexception; + +public interface Animal { + + String getName(); +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Box.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Box.java new file mode 100644 index 0000000000..bb67407218 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Box.java @@ -0,0 +1,14 @@ +package com.baeldung.exceptions.classcastexception; + +public class Box { + + private T content; + + public T getContent() { + return content; + } + + public void setContent(T content) { + this.content = content; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java new file mode 100644 index 0000000000..0a0b2d1f63 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Frog.java @@ -0,0 +1,9 @@ +package com.baeldung.exceptions.classcastexception; + +public class Frog extends Reptile { + + @Override + public String getName() { + return super.getName() + ": Frog"; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java deleted file mode 100644 index a92c9c6d74..0000000000 --- a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Main.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.baeldung.exceptions.classcastexception; - -import java.io.Serializable; - -public class Main { - - public static void main(String[] args) { - checkedCasts(); - uncheckedConversion(); - genericConversion(); - } - - private static void checkedCasts() { - Animal animal = new Frog(); - try { - Mammal mammal = (Mammal) animal; - } catch (ClassCastException e) { - System.out.println("A checked downcast to Mammal is incompatible from Frog because Frog is not a subtype of Mammal."); - } - - try { - Serializable serial = (Serializable) animal; - } catch (ClassCastException e) { - System.out.println("A checked cast to Serializable is incompatible from Frog because Frog is not a subtype of Serializable."); - } - - Object primitives = new int[1]; - try { - Integer[] integers = (Integer[]) primitives; - } catch (ClassCastException e) { - System.out.println("A checked cast to Integer[] is incompatible from primitive arrays. Auto-boxing does not work for arrays."); - } - - try { - long[] longs = (long[]) primitives; - } catch (ClassCastException e) { - System.out.println("A checked cast to long[] is incompatible from int[]. Type promotion does not work for arrays."); - } - } - - private static void uncheckedConversion() { - Box originalBox = new Box<>(); - Box raw = originalBox; - raw.setContent(2.5); - Box bound = (Box) raw; - try { - Long content = bound.getContent(); - } catch (ClassCastException e) { - System.out.println("An incompatible element was found in the raw box."); - } - } - - private static void genericConversion() { - try { - String shouldBeNull = convertInstanceOfObject(123); - } catch (ClassCastException e) { - System.out.println("Should have been null, but due to type erasure, inside convertInstanceOfObject, " + - "it will attempt to cast to Object instead of String, so it casts to Object, which is always possible."); - } - } - - public static T convertInstanceOfObject(Object o) { - try { - return (T) o; - } catch (ClassCastException e) { - return null; - } - } - - public interface Animal { - } - - public static class Reptile implements Animal { - } - - public static class Frog extends Reptile { - } - - public static class Mammal implements Animal { - } - - public static class Box { - private T content; - - public T getContent() { - return content; - } - - public void setContent(T content) { - this.content = content; - } - } - -} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Mammal.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Mammal.java new file mode 100644 index 0000000000..2723cc5b7b --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Mammal.java @@ -0,0 +1,9 @@ +package com.baeldung.exceptions.classcastexception; + +public class Mammal implements Animal { + + @Override + public String getName() { + return "Mammal"; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java new file mode 100644 index 0000000000..ed4b0273e5 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/main/java/com/baeldung/exceptions/classcastexception/Reptile.java @@ -0,0 +1,9 @@ +package com.baeldung.exceptions.classcastexception; + +public class Reptile implements Animal { + + @Override + public String getName() { + return "Reptile"; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java new file mode 100644 index 0000000000..7fac000fa8 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/CheckedCastsUnitTest.java @@ -0,0 +1,40 @@ +package com.baeldung.exceptions.classcastexception; + +import org.junit.Test; + +import java.io.Serializable; + +public class CheckedCastsUnitTest { + + @Test(expected = ClassCastException.class) + public void givenBaseTypeVariableReferencingChildInstance_whenCastToIncompatibleSubtype_thenClassCastException() { + Animal animal = new Frog(); + + //A checked downcast to Mammal is incompatible from Frog because Frog is not a subtype of Mammal. + Mammal mammal = (Mammal) animal; + } + + @Test(expected = ClassCastException.class) + public void givenBaseTypeVariableReferencingChildInstance_whenCastToIncompatibleInterface_thenClassCastException() { + Animal animal = new Frog(); + + //A checked cast to Serializable is incompatible from Frog because Frog is not a subtype of Serializable. + Serializable serial = (Serializable) animal; + } + + @Test(expected = ClassCastException.class) + public void givenObjectVariableReferencingPrimitiveArray_whenCastToBoxedTypeArray_thenClassCastException() { + Object primitives = new int[1]; + + //A checked cast to Integer[] is incompatible from primitive arrays. Auto-boxing does not work for arrays. + Integer[] integers = (Integer[]) primitives; + } + + @Test(expected = ClassCastException.class) + public void givenObjectVariableReferencingPrimitiveArray_whenCastToPromotedTypeArray_thenClassCastException() { + Object primitives = new int[1]; + + //A checked cast to long[] is incompatible from int[]. Type promotion does not work for arrays. + long[] longs = (long[]) primitives; + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/GenericConversionUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/GenericConversionUnitTest.java new file mode 100644 index 0000000000..027ece2db7 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/GenericConversionUnitTest.java @@ -0,0 +1,21 @@ +package com.baeldung.exceptions.classcastexception; + +import org.junit.Test; + +public class GenericConversionUnitTest { + + @Test(expected = ClassCastException.class) + public void givenIncompatibleType_whenConvertInstanceOfObject_thenClassCastException() { + // Should have been null, but due to type erasure, inside convertInstanceOfObject, + // it will attempt to cast to Object instead of String, so it casts to Object, which is always possible. + String shouldBeNull = convertInstanceOfObject(123); + } + + public static T convertInstanceOfObject(Object o) { + try { + return (T) o; // Casts to Object due to type erasure + } catch (ClassCastException e) { + return null; // Will never reach this + } + } +} diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/UncheckedConversionUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/UncheckedConversionUnitTest.java new file mode 100644 index 0000000000..60e7d5a147 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/classcastexception/UncheckedConversionUnitTest.java @@ -0,0 +1,17 @@ +package com.baeldung.exceptions.classcastexception; + +import org.junit.Test; + +public class UncheckedConversionUnitTest { + + @Test(expected = ClassCastException.class) + public void givenPollutedGenericType_whenGetProperty_thenClassCastException() { + Box originalBox = new Box<>(); + Box raw = originalBox; + raw.setContent(2.5); + Box bound = (Box) raw; + + //An incompatible element was found in the raw box. + Long content = bound.getContent(); + } +} From bbdf2ae68606b19dedd331453375fadc9dbc315c Mon Sep 17 00:00:00 2001 From: "mateusz.szablak" Date: Thu, 15 Oct 2020 16:08:49 +0200 Subject: [PATCH 0950/1862] BAEL-4212 (String) or .toString()? - code + tests --- .../baeldung/tostring/StringCastUtils.java | 10 ++ .../baeldung/tostring/ToStringUnitTest.java | 92 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/tostring/StringCastUtils.java create mode 100644 core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/tostring/ToStringUnitTest.java diff --git a/core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/tostring/StringCastUtils.java b/core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/tostring/StringCastUtils.java new file mode 100644 index 0000000000..056f961ea4 --- /dev/null +++ b/core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/tostring/StringCastUtils.java @@ -0,0 +1,10 @@ +package com.baeldung.tostring; + +public class StringCastUtils { + public static String castToString(Object object) { + if (object instanceof String) { + return (String) object; + } + return null; + } +} diff --git a/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/tostring/ToStringUnitTest.java b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/tostring/ToStringUnitTest.java new file mode 100644 index 0000000000..88202e1797 --- /dev/null +++ b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/tostring/ToStringUnitTest.java @@ -0,0 +1,92 @@ +package com.baeldung.tostring; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class ToStringUnitTest { + @Test + public void givenString_whenCastToObjectAndString_thenSameAndNoException() { + String input = "baeldung"; + + Object obj = input; + String str = (String) obj; + + assertEquals(obj, str); + assertEquals(str, input); + assertSame(input, str); + } + + @Test(expected = ClassCastException.class) + public void givenIntegerObject_whenCastToObjectAndString_thenCastClassException() { + Integer input = 1234; + + Object obj = input; + String str = (String) obj; + } + + @Test + public void givenNullInteger_whenCastToObjectAndString_thenSameAndNoException() { + Integer input = null; + + Object obj = input; + String str = (String) obj; + + assertEquals(obj, str); + assertEquals(str, input); + assertSame(input, str); + } + + @Test(expected = NullPointerException.class) + public void givenNullInteger_whenToString_thenNullPointerException() { + Integer input = null; + + String str = input.toString(); + } + + @Test + public void givenInteger_whenCastToObject_thenToStringEquals() { + Integer input = 1234; + + Object obj = input; + + assertEquals("1234", input.toString()); + assertEquals("1234", obj.toString()); + assertEquals(input.toString(), obj.toString()); + } + + @Test + public void givenString_whenToString_thenSame() { + String str = "baeldung"; + + assertEquals("baeldung", str.toString()); + assertSame(str, str.toString()); + } + + @Test + public void givenString_whenCastToObject_thenCastToStringReturnsSame() { + String input = "baeldung"; + + Object obj = input; + + assertSame(input, StringCastUtils.castToString(obj)); + } + + @Test + public void givenInteger_whenCastToObject_thenCastToStringReturnsNull() { + Integer input = 1234; + + Object obj = input; + + assertEquals(null, StringCastUtils.castToString(obj)); + } + + @Test + public void givenIntegerNull_whenCastToObject_thenCastToStringReturnsNull() { + Integer input = null; + + Object obj = input; + + assertEquals(null, StringCastUtils.castToString(obj)); + } +} From 84d2b3a0f532302c36e05475859fb42ecfae39bf Mon Sep 17 00:00:00 2001 From: Stephane Landelle Date: Thu, 15 Oct 2020 16:26:35 +0200 Subject: [PATCH 0951/1862] Fix JSON payloads in the Gatling script Motivation: Ids are numbers (Integers), not Strings. Modifications: Remove wrong wrapping double quotes. Result: Less parsing overhead on the server side. --- .../main/resources/scripts/Gatling/GatlingScenario.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala index fc639881f5..e8cc608e42 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala +++ b/testing-modules/load-testing-comparison/src/main/resources/scripts/Gatling/GatlingScenario.scala @@ -16,7 +16,7 @@ class RewardsScenario extends Simulation { exec(http("transactions_add") .post("/transactions/add/") - .body(StringBody(_ => s"""{ "customerRewardsId":null,"customerId":"${randCustId()}","transactionDate":null }""")).asJson + .body(StringBody(_ => s"""{"customerRewardsId":null,"customerId":${randCustId()},"transactionDate":null}""")).asJson .check(jsonPath("$.id").saveAs("txnId")) .check(jsonPath("$.transactionDate").saveAs("txtDate")) .check(jsonPath("$.customerId").saveAs("custId"))) @@ -28,13 +28,13 @@ class RewardsScenario extends Simulation { .doIf("${rwdId.isUndefined()}"){ exec(http("rewards_add") .post("/rewards/add") - .body(StringBody("""{ "customerId": "${custId}" }""")).asJson + .body(StringBody("""{"customerId":${custId}}""")).asJson .check(jsonPath("$.id").saveAs("rwdId"))) } .exec(http("transactions_update") .post("/transactions/add/") - .body(StringBody("""{ "customerRewardsId":"${rwdId}","customerId":"${custId}","transactionDate":"${txtDate}" }""")).asJson) + .body(StringBody("""{"customerRewardsId":${rwdId},"customerId":${custId},"transactionDate":"${txtDate}" }""")).asJson) .exec(http("get_transactions") .get("/transactions/findAll/${rwdId}")) From 061fa3d12a7f7046b253580eca1a75de62ee2451 Mon Sep 17 00:00:00 2001 From: Daniel Strmecki Date: Thu, 15 Oct 2020 16:59:16 +0200 Subject: [PATCH 0952/1862] BAEL-4504: Add finally --- .../baeldung/socket/FindFreePortUnitTest.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java b/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java index d045f753ea..95530ef292 100644 --- a/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java +++ b/core-java-modules/core-java-networking-3/src/test/java/com/baeldung/socket/FindFreePortUnitTest.java @@ -85,22 +85,23 @@ public class FindFreePortUnitTest { } @Test - public void givenNoPortDefined_whenCreatingJettyServer_thenFreePortIsAssigned() { + public void givenNoPortDefined_whenCreatingJettyServer_thenFreePortIsAssigned() throws Exception { Server jettyServer = new Server(); ServerConnector serverConnector = new ServerConnector(jettyServer); jettyServer.addConnector(serverConnector); try { jettyServer.start(); assertThat(serverConnector.getLocalPort()).isGreaterThan(0); - jettyServer.stop(); - jettyServer.destroy(); } catch (Exception e) { fail("Failed to start Jetty server"); + } finally { + jettyServer.stop(); + jettyServer.destroy(); } } @Test - public void givenExplicitFreePort_whenCreatingJettyServer_thenThatPortIsAssigned() { + public void givenExplicitFreePort_whenCreatingJettyServer_thenThatPortIsAssigned() throws Exception { Server jettyServer = new Server(); ServerConnector serverConnector = new ServerConnector(jettyServer); serverConnector.setPort(FREE_PORT_NUMBER); @@ -108,38 +109,41 @@ public class FindFreePortUnitTest { try { jettyServer.start(); assertThat(serverConnector.getLocalPort()).isEqualTo(FREE_PORT_NUMBER); - jettyServer.stop(); - jettyServer.destroy(); } catch (Exception e) { fail("Failed to start Jetty server"); + } finally { + jettyServer.stop(); + jettyServer.destroy(); } } @Test - public void givenPortZero_whenCreatingTomcatServer_thenFreePortIsAssigned() { + public void givenPortZero_whenCreatingTomcatServer_thenFreePortIsAssigned() throws Exception { Tomcat tomcatServer = new Tomcat(); tomcatServer.setPort(0); try { tomcatServer.start(); assertThat(tomcatServer.getConnector().getLocalPort()).isGreaterThan(0); - tomcatServer.stop(); - tomcatServer.destroy(); } catch (LifecycleException e) { fail("Failed to start Tomcat server"); + } finally { + tomcatServer.stop(); + tomcatServer.destroy(); } } @Test - public void givenExplicitFreePort_whenCreatingTomcatServer_thenThatPortIsAssigned() { + public void givenExplicitFreePort_whenCreatingTomcatServer_thenThatPortIsAssigned() throws Exception { Tomcat tomcatServer = new Tomcat(); tomcatServer.setPort(FREE_PORT_NUMBER); try { tomcatServer.start(); assertThat(tomcatServer.getConnector().getLocalPort()).isEqualTo(FREE_PORT_NUMBER); - tomcatServer.stop(); - tomcatServer.destroy(); } catch (LifecycleException e) { fail("Failed to start Tomcat server"); + } finally { + tomcatServer.stop(); + tomcatServer.destroy(); } } From 43feef5b42e2d11b27cd87706ed828bb60dee46e Mon Sep 17 00:00:00 2001 From: Loredana Date: Thu, 15 Oct 2020 19:03:52 +0300 Subject: [PATCH 0953/1862] add indexes to jpa entities --- testing-modules/load-testing-comparison/pom.xml | 2 -- .../baeldung/loadtesting/model/CustomerRewardsAccount.java | 3 +++ .../main/java/com/baeldung/loadtesting/model/Transaction.java | 4 ++++ .../src/main/resources/application.properties | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/testing-modules/load-testing-comparison/pom.xml b/testing-modules/load-testing-comparison/pom.xml index 55e94379db..4c237aeb75 100644 --- a/testing-modules/load-testing-comparison/pom.xml +++ b/testing-modules/load-testing-comparison/pom.xml @@ -37,7 +37,6 @@ com.fasterxml.jackson.core jackson-databind - ${jackson.version} org.springframework.boot @@ -72,7 +71,6 @@ org.springframework.boot spring-boot-maven-plugin - 2.0.5.RELEASE diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java index 0599020700..4d92c93fcb 100644 --- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/CustomerRewardsAccount.java @@ -4,8 +4,11 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.Table; @Entity +@Table(indexes = {@Index(columnList="customerId")}) public class CustomerRewardsAccount { @Id diff --git a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java index 1a6e0d4360..6e2fb39cc6 100644 --- a/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java +++ b/testing-modules/load-testing-comparison/src/main/java/com/baeldung/loadtesting/model/Transaction.java @@ -4,10 +4,14 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.Index; +import javax.persistence.Table; + import java.util.Date; import java.util.Calendar; @Entity +@Table(indexes = {@Index(columnList="customerRewardsId")}) public class Transaction { @Id diff --git a/testing-modules/load-testing-comparison/src/main/resources/application.properties b/testing-modules/load-testing-comparison/src/main/resources/application.properties index 424d3d0290..e2c8cb1879 100644 --- a/testing-modules/load-testing-comparison/src/main/resources/application.properties +++ b/testing-modules/load-testing-comparison/src/main/resources/application.properties @@ -2,6 +2,6 @@ spring.h2.console.enabled=true spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa -spring.datasource.password=password +spring.datasource.password= spring.jpa.database-platform=org.hibernate.dialect.H2Dialect From 1a6ff515fc96b84ac17a491d567ffaa06cb3271a Mon Sep 17 00:00:00 2001 From: AbdallahSawan Date: Thu, 15 Oct 2020 23:21:47 +0300 Subject: [PATCH 0954/1862] The Value of 0xFF Number and Its Uses With & Operation in Java Article by Abdallah Sawan --- .../src/main/java/com/baeldung/Main.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 java-numbers-5/src/main/java/com/baeldung/Main.java diff --git a/java-numbers-5/src/main/java/com/baeldung/Main.java b/java-numbers-5/src/main/java/com/baeldung/Main.java new file mode 100644 index 0000000000..dfc625809d --- /dev/null +++ b/java-numbers-5/src/main/java/com/baeldung/Main.java @@ -0,0 +1,23 @@ +package com.baeldung; + +public class Main { + + public static void main(String[] args) { + int x = 0xff; + System.out.println(x); // output is 255 + + byte y = (byte) 0xff; + System.out.println(y); // output is -1 + + int rgba = 272214023; + int r = rgba >> 24; + int g = rgba >> 16 & 0xFF; + int b = rgba >> 8 & 0xFF; + int a = rgba & 0xFF; + + System.out.println(r); // output is 64 + System.out.println(g); // output is 57 + System.out.println(b); // output is 168 + System.out.println(a); // output is 7 + } +} From 470d4efde85784f1c9e33d3c2947ca00d6607ca6 Mon Sep 17 00:00:00 2001 From: Adrian Maghear Date: Fri, 16 Oct 2020 13:07:22 +0200 Subject: [PATCH 0955/1862] [BAEL-3600] add integration test --- netflix-modules/mantis/pom.xml | 14 ++++ .../netflix/mantis/job/LogAggregationJob.java | 9 ++- .../netflix/mantis/job/LogCollectingJob.java | 11 ++- .../netflix/mantis/model/LogAggregate.java | 6 +- .../job/LogAggregationJobIntegrationTest.java | 56 ++++++++++++++ .../job/LogCollectingJobIntegrationTest.java | 73 +++++++++++++++++++ .../netflix/mantis/job/MantisJobTestBase.java | 49 +++++++++++++ 7 files changed, 212 insertions(+), 6 deletions(-) create mode 100644 netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogAggregationJobIntegrationTest.java create mode 100644 netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogCollectingJobIntegrationTest.java create mode 100644 netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/MantisJobTestBase.java diff --git a/netflix-modules/mantis/pom.xml b/netflix-modules/mantis/pom.xml index 48151c142f..5d9611ccdf 100644 --- a/netflix-modules/mantis/pom.xml +++ b/netflix-modules/mantis/pom.xml @@ -52,6 +52,20 @@ 1.18.12 + + org.springframework + spring-webflux + 5.0.9.RELEASE + test + + + + io.projectreactor.netty + reactor-netty + 0.9.12.RELEASE + test + + diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java index 229d11d39d..7fc514deef 100644 --- a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogAggregationJob.java @@ -9,10 +9,17 @@ import io.mantisrx.runtime.Job; import io.mantisrx.runtime.MantisJob; import io.mantisrx.runtime.MantisJobProvider; import io.mantisrx.runtime.Metadata; +import io.mantisrx.runtime.sink.Sink; import io.mantisrx.runtime.sink.Sinks; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +@NoArgsConstructor +@AllArgsConstructor public class LogAggregationJob extends MantisJobProvider { + private Sink sink = Sinks.eagerSubscribe(Sinks.sse(LogAggregate::toJsonString)); + @Override public Job getJobInstance() { @@ -21,7 +28,7 @@ public class LogAggregationJob extends MantisJobProvider { .stage(new TransformLogStage(), TransformLogStage.stageConfig()) .stage(new GroupLogStage(), GroupLogStage.config()) .stage(new CountLogStage(), CountLogStage.config()) - .sink(Sinks.eagerSubscribe(Sinks.sse(LogAggregate::toJsonString))) + .sink(sink) .metadata(new Metadata.Builder().build()) .create(); diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java index 492f30c43a..34ccf8355a 100644 --- a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/job/LogCollectingJob.java @@ -9,18 +9,23 @@ import io.mantisrx.runtime.MantisJob; import io.mantisrx.runtime.MantisJobProvider; import io.mantisrx.runtime.Metadata; import io.mantisrx.runtime.ScalarToScalar; -import lombok.extern.slf4j.Slf4j; +import io.mantisrx.runtime.sink.Sink; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; -@Slf4j +@NoArgsConstructor +@AllArgsConstructor public class LogCollectingJob extends MantisJobProvider { + private Sink sink = new LogSink(); + @Override public Job getJobInstance() { return MantisJob .source(new RandomLogSource()) .stage(new TransformLogStage(), new ScalarToScalar.Config<>()) - .sink(new LogSink()) + .sink(sink) .metadata(new Metadata.Builder().build()) .create(); diff --git a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java index 0eeb7ea086..e0e3c4f9fa 100644 --- a/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java +++ b/netflix-modules/mantis/src/main/java/com/baeldung/netflix/mantis/model/LogAggregate.java @@ -5,15 +5,17 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.mantisrx.runtime.codec.JsonType; import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.NoArgsConstructor; @Getter +@NoArgsConstructor @AllArgsConstructor public class LogAggregate implements JsonType { private static final ObjectMapper mapper = new ObjectMapper(); - private final Integer count; - private final String level; + private Integer count; + private String level; public String toJsonString() { try { diff --git a/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogAggregationJobIntegrationTest.java b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogAggregationJobIntegrationTest.java new file mode 100644 index 0000000000..b9b16e2146 --- /dev/null +++ b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogAggregationJobIntegrationTest.java @@ -0,0 +1,56 @@ +package com.baeldung.netflix.mantis.job; + +import com.baeldung.netflix.mantis.model.LogAggregate; +import io.mantisrx.runtime.PortRequest; +import io.mantisrx.runtime.sink.Sinks; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static java.util.Arrays.asList; +import static java.util.Optional.of; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class LogAggregationJobIntegrationTest extends MantisJobTestBase { + + private final static int PORT = 7382; + private final static String SINK_URL = "http://localhost:" + PORT; + + @BeforeAll + static void beforeAll() { + start(new LogAggregationJob((context, portRequest, logAggregateObservable) -> { + logAggregateObservable.subscribe(); + Sinks.sse(LogAggregate::toJsonString).call(context, new PortRequest(PORT), logAggregateObservable); + })); + } + + @Override + public String getSinkUrl() { + return SINK_URL; + } + + @Override + public Class getEventType() { + return LogAggregate.class; + } + + @Test + void whenReadingFromSink_thenShouldRetrieveCorrectNumberOfLogAggregates() { + assertEquals(of(5L), sinkStream.take(5).count().blockOptional()); + } + + @Test + void whenReadingFromSink_thenShouldRetrieveLogAggregate() { + assertNotNull(sinkStream.take(1).blockFirst()); + } + + @Test + void whenReadingFromSink_thenShouldRetrieveValidLogAggregate() { + LogAggregate logAggregate = sinkStream.take(1).blockFirst(); + + assertTrue(asList("ERROR", "WARN", "INFO").contains(logAggregate.getLevel())); + assertTrue(logAggregate.getCount() > 0); + } + +} \ No newline at end of file diff --git a/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogCollectingJobIntegrationTest.java b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogCollectingJobIntegrationTest.java new file mode 100644 index 0000000000..87e0c194b5 --- /dev/null +++ b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/LogCollectingJobIntegrationTest.java @@ -0,0 +1,73 @@ +package com.baeldung.netflix.mantis.job; + +import com.baeldung.netflix.mantis.model.LogEvent; +import com.baeldung.netflix.mantis.sink.LogSink; +import io.mantisrx.runtime.Context; +import io.mantisrx.runtime.PortRequest; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import rx.Observable; + +import static java.util.Arrays.asList; +import static java.util.Optional.of; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class LogCollectingJobIntegrationTest extends MantisJobTestBase { + + private final static int PORT = 7381; + private final static String SINK_URL = "http://localhost:" + PORT; + + @BeforeAll + static void beforeAll() { + + start(new LogCollectingJob(new LogSink() { + + @Override + public void call(Context context, PortRequest portRequest, Observable observable) { + super.call(context, new PortRequest(PORT), observable); + } + + })); + + } + + @Override + public String getSinkUrl() { + return SINK_URL; + } + + @Override + public Class getEventType() { + return LogEvent.class; + } + + @Test + void whenReadingFromSink_thenShouldRetrieveCorrectNumberOfLogEvents() { + assertEquals(of(5L), sinkStream.take(5).count().blockOptional()); + } + + @Test + void whenReadingFromSink_thenShouldRetrieveLogEvent() { + assertNotNull(sinkStream.take(1).blockFirst()); + } + + @Test + void whenReadingFromSink_thenShouldRetrieveValidLogEvent() { + LogEvent logEvent = sinkStream.take(1).blockFirst(); + + assertTrue(asList("ERROR", "WARN", "INFO").contains(logEvent.getLevel())); + assertTrue(asList("login attempt", "user created").contains(logEvent.getMessage())); + } + + @Test + void whenReadingFromSink_thenShouldRetrieveFilteredLogEvents() { + getSinkStream(SINK_URL + "?filter=login") + .take(7) + .toStream().forEach( + logEvent -> assertEquals("login attempt", logEvent.getMessage()) + ); + } + +} \ No newline at end of file diff --git a/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/MantisJobTestBase.java b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/MantisJobTestBase.java new file mode 100644 index 0000000000..89425299a4 --- /dev/null +++ b/netflix-modules/mantis/src/test/java/com/baeldung/netflix/mantis/job/MantisJobTestBase.java @@ -0,0 +1,49 @@ +package com.baeldung.netflix.mantis.job; + +import io.mantisrx.runtime.Job; +import io.mantisrx.runtime.MantisJobProvider; +import io.mantisrx.runtime.executor.LocalJobExecutorNetworked; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeEach; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Flux; +import reactor.util.retry.Retry; + +import java.time.Duration; + +public abstract class MantisJobTestBase { + + private static Job jobInstance; + Flux sinkStream; + + public abstract String getSinkUrl(); + public abstract Class getEventType(); + + @BeforeEach + void setUp() { + sinkStream = getSinkStream(getSinkUrl()); + } + + @AfterAll + static void afterAll() { + stopJob(); + } + + protected Flux getSinkStream(String sinkUrl) { + return WebClient.builder().build().get() + .uri(sinkUrl) + .retrieve() + .bodyToFlux(getEventType()) + .retryWhen(Retry.fixedDelay(10, Duration.ofMillis(2000))); + } + + static void start(MantisJobProvider job) { + jobInstance = job.getJobInstance(); + new Thread(() -> LocalJobExecutorNetworked.execute(jobInstance)).start(); + } + + static void stopJob() { + jobInstance.getLifecycle().shutdown(); + } + +} From 5709eee956777f2cbeda0c7721ef6dfdd70c1d25 Mon Sep 17 00:00:00 2001 From: Umang Budhwar Date: Fri, 16 Oct 2020 19:22:25 +0530 Subject: [PATCH 0956/1862] BAEL-4475 (#10151) * Added code for checking if a class is abstract or not. * Renamed test name as per review comments. * Added code to get database URL from Connection object. * Refactored code to break lines. --- .../core-java-persistence-2/pom.xml | 29 +++++++++++++++++++ .../baeldung/getdburl/DBConfiguration.java | 13 +++++++++ .../getdburl/DBConfigurationUnitTest.java | 18 ++++++++++++ persistence-modules/pom.xml | 1 + 4 files changed, 61 insertions(+) create mode 100644 persistence-modules/core-java-persistence-2/pom.xml create mode 100644 persistence-modules/core-java-persistence-2/src/main/java/com/baeldung/getdburl/DBConfiguration.java create mode 100644 persistence-modules/core-java-persistence-2/src/test/java/com/baeldung/getdburl/DBConfigurationUnitTest.java diff --git a/persistence-modules/core-java-persistence-2/pom.xml b/persistence-modules/core-java-persistence-2/pom.xml new file mode 100644 index 0000000000..9845d5009d --- /dev/null +++ b/persistence-modules/core-java-persistence-2/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + com.baeldung.core-java-persistence-2 + core-java-persistence-2 + 0.1.0-SNAPSHOT + core-java-persistence-2 + jar + + + com.baeldung + persistence-modules + 1.0.0-SNAPSHOT + + + + + com.h2database + h2 + ${h2.version} + + + + + 1.4.200 + + + \ No newline at end of file diff --git a/persistence-modules/core-java-persistence-2/src/main/java/com/baeldung/getdburl/DBConfiguration.java b/persistence-modules/core-java-persistence-2/src/main/java/com/baeldung/getdburl/DBConfiguration.java new file mode 100644 index 0000000000..51d3a432ac --- /dev/null +++ b/persistence-modules/core-java-persistence-2/src/main/java/com/baeldung/getdburl/DBConfiguration.java @@ -0,0 +1,13 @@ +package com.baeldung.getdburl; + +import java.sql.Connection; +import java.sql.DriverManager; + +public class DBConfiguration { + + public static Connection getConnection() throws Exception { + Class.forName("org.h2.Driver"); + String url = "jdbc:h2:mem:testdb"; + return DriverManager.getConnection(url, "user", "password"); + } +} diff --git a/persistence-modules/core-java-persistence-2/src/test/java/com/baeldung/getdburl/DBConfigurationUnitTest.java b/persistence-modules/core-java-persistence-2/src/test/java/com/baeldung/getdburl/DBConfigurationUnitTest.java new file mode 100644 index 0000000000..845076f070 --- /dev/null +++ b/persistence-modules/core-java-persistence-2/src/test/java/com/baeldung/getdburl/DBConfigurationUnitTest.java @@ -0,0 +1,18 @@ +package com.baeldung.getdburl; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.sql.Connection; + +import org.junit.jupiter.api.Test; + +class DBConfigurationUnitTest { + + @Test + void givenConnectionObject_whenExtractMetaData_thenGetDbURL() throws Exception { + Connection connection = DBConfiguration.getConnection(); + String dbUrl = connection.getMetaData().getURL(); + assertEquals("jdbc:h2:mem:testdb", dbUrl); + } + +} diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 05ef14f188..c7905a178d 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -17,6 +17,7 @@ apache-bookkeeper apache-cayenne core-java-persistence + core-java-persistence-2 deltaspike elasticsearch flyway From 1c21d3ed2769d0c54709c38ebeba4c74d4901879 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Fri, 16 Oct 2020 19:14:29 +0300 Subject: [PATCH 0957/1862] Update MaxSizeConstraintValidator.java --- .../listvalidation/constraint/MaxSizeConstraintValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java index 524e98a39e..409b6e1ab5 100644 --- a/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java +++ b/spring-mvc-basics-3/src/main/java/com/baeldung/validation/listvalidation/constraint/MaxSizeConstraintValidator.java @@ -11,7 +11,7 @@ public class MaxSizeConstraintValidator implements ConstraintValidator values, ConstraintValidatorContext context) { - return values.size()<=4 + return values.size() <= 4; } } From 90c65b053095848c89d659b969839239bfbe28f7 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 17 Oct 2020 12:36:50 +0300 Subject: [PATCH 0958/1862] fix redis context test --- .../spring/data/redis/config/RedisConfig.java | 1 - .../java/com/baeldung/SpringContextTest.java | 28 +++++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java index 497e1506bd..7fd13d2777 100644 --- a/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java +++ b/persistence-modules/spring-data-redis/src/main/java/com/baeldung/spring/data/redis/config/RedisConfig.java @@ -5,7 +5,6 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; -import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.listener.ChannelTopic; import org.springframework.data.redis.listener.RedisMessageListenerContainer; diff --git a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextTest.java index 4df0cbd0ad..5167e63721 100644 --- a/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextTest.java +++ b/persistence-modules/spring-data-redis/src/test/java/com/baeldung/SpringContextTest.java @@ -1,16 +1,32 @@ package com.baeldung; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; -import com.baeldung.spring.data.redis.config.RedisConfig; +import com.baeldung.spring.data.redis.SpringRedisApplication; -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = RedisConfig.class) +import redis.embedded.RedisServerBuilder; + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringRedisApplication.class) +@DirtiesContext(classMode = ClassMode.BEFORE_CLASS) public class SpringContextTest { + + private static redis.embedded.RedisServer redisServer; + + @BeforeClass + public static void startRedisServer() { + redisServer = new RedisServerBuilder().port(6379).setting("maxmemory 256M").build(); + redisServer.start(); + } + @AfterClass + public static void stopRedisServer() { + redisServer.stop(); + } @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { } From 7d297f344f7c4a0be17a5652a72448e370107241 Mon Sep 17 00:00:00 2001 From: amdegregorio Date: Sat, 17 Oct 2020 08:28:31 -0400 Subject: [PATCH 0959/1862] BAEL-4503 PR/article review feedback --- .../constantspatterns/calculations/MathConstants.java | 6 +++--- .../baeldung/constantspatterns/ConstantPatternUnitTest.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java index a7ecf7aabe..1c9c4172ca 100644 --- a/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java +++ b/core-java-modules/core-java-lang-3/src/main/java/com/baeldung/constantspatterns/calculations/MathConstants.java @@ -2,9 +2,9 @@ package com.baeldung.constantspatterns.calculations; public final class MathConstants { public static final double PI = 3.14159265359; - public static final double GOLDEN_RATIO = 1.6180; - public static final double GRAVITATIONAL_ACCELERATION = 9.8; - public static final double EULERS_NUMBER = 2.7182818284590452353602874713527; + static final double GOLDEN_RATIO = 1.6180; + static final double GRAVITATIONAL_ACCELERATION = 9.8; + static final double EULERS_NUMBER = 2.7182818284590452353602874713527; public enum Operation { ADD, SUBTRACT, DIVIDE, MULTIPLY diff --git a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java index 39cb8f82f9..ba8f237fd3 100644 --- a/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java +++ b/core-java-modules/core-java-lang-3/src/test/java/com/baeldung/constantspatterns/ConstantPatternUnitTest.java @@ -6,7 +6,7 @@ import org.junit.Test; public class ConstantPatternUnitTest { @Test - public void givenTwoNumbersAndAdd_whenCallingCalculatorOperatOneTwoNumbers_correctAnswerReturned() { + public void givenTwoNumbersAndAdd_whenCallingCalculatorOperatOneTwoNumbers_thenCorrectAnswerReturned() { Calculator calculator = new Calculator(); double expected = 4; double answer = calculator.operateOnTwoNumbers(2, 2, Calculator.Operation.ADD); @@ -14,7 +14,7 @@ public class ConstantPatternUnitTest { } @Test - public void givenTwoNumbersAndAdd_whenCallingGeometryCalculatorOperatOneTwoNumbers_correctAnswerReturned() { + public void givenTwoNumbersAndAdd_whenCallingGeometryCalculatorOperatOneTwoNumbers_thenCorrectAnswerReturned() { GeometryCalculator calculator = new GeometryCalculator(); double expected = 4; double answer = calculator.operateOnTwoNumbers(2, 2, GeometryCalculator.Operation.ADD); From 12dcd4e4bb806aedbd4e2022806450096e9a6ff6 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 17 Oct 2020 16:16:00 +0300 Subject: [PATCH 0960/1862] exclude logback, add log4j config file --- spring-boot-modules/spring-boot-mvc-birt/pom.xml | 16 +++++----------- .../src/main/resources/log4j.properties | 9 +++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 spring-boot-modules/spring-boot-mvc-birt/src/main/resources/log4j.properties diff --git a/spring-boot-modules/spring-boot-mvc-birt/pom.xml b/spring-boot-modules/spring-boot-mvc-birt/pom.xml index 0ab744bb26..1e3075dc2d 100644 --- a/spring-boot-modules/spring-boot-mvc-birt/pom.xml +++ b/spring-boot-modules/spring-boot-mvc-birt/pom.xml @@ -5,10 +5,10 @@ 4.0.0 - com.baeldung.spring-boot-modules - spring-boot-modules - 1.0.0-SNAPSHOT - ../ + org.springframework.boot + spring-boot-starter-parent + 2.1.1.RELEASE + spring-boot-mvc-birt @@ -19,10 +19,6 @@ Module For Spring Boot Integration with BIRT - - org.springframework.boot - spring-boot-starter - org.springframework.boot @@ -51,17 +47,14 @@ org.eclipse.birt.runtime_4.8.0-20180626 ${eclipse.birt.runtime.version} - log4j log4j ${log4j.version} - org.projectlombok lombok - ${lombok.version} provided @@ -81,6 +74,7 @@ 1.8 1.8 4.8.0 + 1.2.17 diff --git a/spring-boot-modules/spring-boot-mvc-birt/src/main/resources/log4j.properties b/spring-boot-modules/spring-boot-mvc-birt/src/main/resources/log4j.properties new file mode 100644 index 0000000000..e4fcb01308 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-birt/src/main/resources/log4j.properties @@ -0,0 +1,9 @@ +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 + +# A1 is set to be a ConsoleAppender. +log4j.appender.A1=org.apache.log4j.ConsoleAppender + +# A1 uses PatternLayout. +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 From 07da242830fd1e6864e7569d61fa94e271317ff8 Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 17 Oct 2020 16:19:01 +0300 Subject: [PATCH 0961/1862] add context test, explanation --- spring-boot-modules/spring-boot-mvc-birt/pom.xml | 1 + .../com/baeldung/birt/engine/SpringContextTest.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 spring-boot-modules/spring-boot-mvc-birt/src/test/java/com/baeldung/birt/engine/SpringContextTest.java diff --git a/spring-boot-modules/spring-boot-mvc-birt/pom.xml b/spring-boot-modules/spring-boot-mvc-birt/pom.xml index 1e3075dc2d..4963cc3036 100644 --- a/spring-boot-modules/spring-boot-mvc-birt/pom.xml +++ b/spring-boot-modules/spring-boot-mvc-birt/pom.xml @@ -4,6 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + org.springframework.boot spring-boot-starter-parent diff --git a/spring-boot-modules/spring-boot-mvc-birt/src/test/java/com/baeldung/birt/engine/SpringContextTest.java b/spring-boot-modules/spring-boot-mvc-birt/src/test/java/com/baeldung/birt/engine/SpringContextTest.java new file mode 100644 index 0000000000..5235a494df --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-birt/src/test/java/com/baeldung/birt/engine/SpringContextTest.java @@ -0,0 +1,13 @@ +package com.baeldung.birt.engine; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + + } +} From 000275f9f7d18a482a377b05ec9ca0f06423b234 Mon Sep 17 00:00:00 2001 From: AmitB Date: Sun, 18 Oct 2020 21:29:00 +0530 Subject: [PATCH 0962/1862] [BAEL-4495] - Add test for case when 2nd collection is also hashset (#10175) * [BAEL-4495] Performance of removeAll() in a HashSet * [BAEL-4495] Add unit test for hashset removeAll() * [BAEL-4495] Update test methods to camelCase * [BAEL-4495] Add test for case when 2nd collection is also hashset --- .../removeallperformance/HashSetBenchmark.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java index 8ce58c865e..8f784de26d 100644 --- a/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java +++ b/core-java-modules/core-java-collections-3/src/main/java/com/baeldung/collections/removeallperformance/HashSetBenchmark.java @@ -33,11 +33,15 @@ public class HashSetBenchmark { private List employeeList1 = new ArrayList<>(); private Set employeeSet2 = new HashSet<>(); private List employeeList2 = new ArrayList<>(); + private Set employeeSet3 = new HashSet<>(); + private Set employeeSet4 = new HashSet<>(); private long set1Size = 60000; private long list1Size = 50000; private long set2Size = 50000; private long list2Size = 60000; + private long set3Size = 50000; + private long set4Size = 60000; @Setup(Level.Trial) public void setUp() { @@ -57,6 +61,14 @@ public class HashSetBenchmark { for (long i = 0; i < list2Size; i++) { employeeList2.add(new Employee(i, RandomStringUtils.random(7, true, false))); } + + for (long i = 0; i < set3Size; i++) { + employeeSet3.add(new Employee(i, RandomStringUtils.random(7, true, false))); + } + + for (long i = 0; i < set4Size; i++) { + employeeSet4.add(new Employee(i, RandomStringUtils.random(7, true, false))); + } } @@ -71,6 +83,11 @@ public class HashSetBenchmark { public boolean given_SizeOfHashsetSmallerThanSizeOfCollection_When_RemoveAllFromHashSet_Then_BadPerformance(MyState state) { return state.employeeSet2.removeAll(state.employeeList2); } + + @Benchmark + public boolean given_SizeOfHashsetSmallerThanSizeOfAnotherHashSet_When_RemoveAllFromHashSet_Then_GoodPerformance(MyState state) { + return state.employeeSet3.removeAll(state.employeeSet4); + } public static void main(String[] args) throws Exception { Options options = new OptionsBuilder().include(HashSetBenchmark.class.getSimpleName()) From 41609ee63f1df4b42a1daf537e05dafc1d0f18f7 Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Fri, 16 Oct 2020 23:38:46 +0200 Subject: [PATCH 0963/1862] [BAEL-4533] get class names from a jar --- core-java-modules/core-java-jar/.gitignore | 1 + .../baeldung/jar/GetClassNamesFromJar.java | 43 ++++++++++++++++++ .../jar/GetClassNamesFromJarUnitTest.java | 39 ++++++++++++++++ .../example-jar/stripe-0.0.1-SNAPSHOT.jar | Bin 0 -> 10082 bytes 4 files changed, 83 insertions(+) create mode 100644 core-java-modules/core-java-jar/.gitignore create mode 100644 core-java-modules/core-java-jar/src/main/java/com/baeldung/jar/GetClassNamesFromJar.java create mode 100644 core-java-modules/core-java-jar/src/test/java/com/baeldung/jar/GetClassNamesFromJarUnitTest.java create mode 100644 core-java-modules/core-java-jar/src/test/resources/example-jar/stripe-0.0.1-SNAPSHOT.jar diff --git a/core-java-modules/core-java-jar/.gitignore b/core-java-modules/core-java-jar/.gitignore new file mode 100644 index 0000000000..ba516c02b5 --- /dev/null +++ b/core-java-modules/core-java-jar/.gitignore @@ -0,0 +1 @@ +!src/test/resources/example-jar/stripe-0.0.1-SNAPSHOT.jar diff --git a/core-java-modules/core-java-jar/src/main/java/com/baeldung/jar/GetClassNamesFromJar.java b/core-java-modules/core-java-jar/src/main/java/com/baeldung/jar/GetClassNamesFromJar.java new file mode 100644 index 0000000000..0d8a67dbd6 --- /dev/null +++ b/core-java-modules/core-java-jar/src/main/java/com/baeldung/jar/GetClassNamesFromJar.java @@ -0,0 +1,43 @@ +package com.baeldung.jar; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +public class GetClassNamesFromJar { + + public static Set getClassNamesFromJarFile(File givenFile) throws IOException { + Set classNames = new HashSet<>(); + try (JarFile jarFile = new JarFile(givenFile)) { + Enumeration e = jarFile.entries(); + while (e.hasMoreElements()) { + JarEntry jarEntry = e.nextElement(); + if (jarEntry.getName().endsWith(".class")) { + String className = jarEntry.getName() + .replace("/", ".") + .replace(".class", ""); + classNames.add(className); + } + } + return classNames; + } + } + + public static Set getClassesFromJarFile(File jarFile) throws IOException, ClassNotFoundException { + Set classNames = getClassNamesFromJarFile(jarFile); + Set classes = new HashSet<>(classNames.size()); + try (URLClassLoader cl = URLClassLoader.newInstance(new URL[] { new URL("jar:file:" + jarFile + "!/") })) { + for (String name : classNames) { + Class clazz = cl.loadClass(name); // Loading the class by its name + classes.add(clazz); + } + } + return classes; + } +} diff --git a/core-java-modules/core-java-jar/src/test/java/com/baeldung/jar/GetClassNamesFromJarUnitTest.java b/core-java-modules/core-java-jar/src/test/java/com/baeldung/jar/GetClassNamesFromJarUnitTest.java new file mode 100644 index 0000000000..7af3ff59fd --- /dev/null +++ b/core-java-modules/core-java-jar/src/test/java/com/baeldung/jar/GetClassNamesFromJarUnitTest.java @@ -0,0 +1,39 @@ +package com.baeldung.jar; + +import com.google.common.collect.Sets; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +public class GetClassNamesFromJarUnitTest { + private static final String JAR_PATH = "example-jar/stripe-0.0.1-SNAPSHOT.jar"; + private static final Set EXPECTED_CLASS_NAMES = Sets.newHashSet( + "com.baeldung.stripe.StripeApplication", + "com.baeldung.stripe.ChargeRequest", + "com.baeldung.stripe.StripeService", + "com.baeldung.stripe.ChargeRequest$Currency", + "com.baeldung.stripe.ChargeController", + "com.baeldung.stripe.CheckoutController"); + + @Test + public void givenJarFilePath_whenLoadClassNames_thenGetClassNames() throws IOException, URISyntaxException { + File jarFile = new File(Objects.requireNonNull(getClass().getClassLoader().getResource(JAR_PATH)).toURI()); + Set classNames = GetClassNamesFromJar.getClassNamesFromJarFile(jarFile); + Assert.assertEquals(EXPECTED_CLASS_NAMES, classNames); + } + + @Test + public void givenJarFilePath_whenLoadClass_thenGetClassObjects() throws IOException, ClassNotFoundException, URISyntaxException { + File jarFile = new File(Objects.requireNonNull(getClass().getClassLoader().getResource(JAR_PATH)).toURI()); + Set classes = GetClassNamesFromJar.getClassesFromJarFile(jarFile); + Set names = classes.stream().map(Class::getName).collect(Collectors.toSet()); + Assert.assertEquals(EXPECTED_CLASS_NAMES, names); + } +} diff --git a/core-java-modules/core-java-jar/src/test/resources/example-jar/stripe-0.0.1-SNAPSHOT.jar b/core-java-modules/core-java-jar/src/test/resources/example-jar/stripe-0.0.1-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..213d7f94001cf375a3bfc9b7d4ee0500851e572b GIT binary patch literal 10082 zcmb7K1yqz<*GB0^1f-<9TUuJWTT&Qu$e~NRyOB`3QzWINyBnmWr9ncFf4F+Zi{88b z@2quZ-dS_@b84S`_Pd`gF9ivO0C7{wa^w~Mdie1H5B`=BRTiX|kQHN;|IrK%q7>YW zb5lAS2>#m}TrqxaCL<^-AttJ%%pfCnB-7U`Ek(~Tj4VY@Gtf8qR*`9pb#c{}PI91& zPKsU#4)#-)YAhCQGnrFuiX1IPujWGsTShz(Lq3z+?fO{cyu5;eLGWwpHuj~(arqr z02bCjeLDc?mv%Q(1^@N4K!KkOtStVc1@ey;FZ2OGLwif(|7d!%ZZ}{*n}Y0YO|1bx zCE)&=3#+8X+bwWQ`+E=&h~RIamGKLG19Ju^3!qA*oOvq~Qv2RH#)n0Nl(=$c$rKh2 zNkuz8vl4R4@_jbe~0to@ft|PQ+3u3MC?i(qqhAozGZ{kXJik1y0 zi;iF`3Mv%2>-WYI9x?Z;;AGK=E@WB^`(VOws zl?pF;1OdI6s8@;i^}TCr^T~q*RLG(0^8K=t09BHr`KF@z?KqMM-RI8a`Of53k}wkp z*`i!k7huino<7eemqfUbe|!AEf0}GHS9xZ7!-tyT4bqg@Pp$httoxsu6llS_lzkrp z0uwx}TZOU(fb4;Ge+|t&y4 zf=1W!D9l`$*87fb*DonK`CmF|HZ<}*MfVG%Hh#a*mCnq8p-j9B>ZmK}trJ~y>$gnk zCFeOtl93PJ3Kg~oHhWH;aMBx-F_Z`>Z*uzP4GWy#PiODa2uAOcC0nT5;(U+~Ef}}0 zEojx)?7H4$`dWZHO=4zVuxjB(<&==oO=)rz7RK3jk zoH!Pm_4TSu``VIM?t4l}PyUV!MTMo3?Z;$ckrBi1o#X^oe}?z5x0mzUr(OimUq zAd(hAdFxCOk(n7^m(Nlhx(n&petV3N!P{19py+jJO>fi+*FK>nE<#_qDjf=nT}8rURhdb2#81jSX~1XfPuM{{rC0tQ!B9av)x~|+s=`b2aH&&wwc(xY>UJ=i!>o|&+2?e+o6MU^E`XWzR=K& zmDQ9A@Ycg1#vix3Hh)pylif6w(s`yfufY>C{R%I8Hbs6HbMn~IcP65eahcwv%Hbm# zU>m0N+K&oP#Q13tok|{igo4yg+tGY?{gOu}P&TLfWLHZJnx~*r4>mryWR6tmLb*m@ z^>Ye~g6M)k(7mFRl+o3d(O`7UY=vFBKE2^bQf0-&9MTf-@#sZ|k4loAKqoz6=5)K% z<#TNzS&AR{Ylh!LHK@Cg6EO<)TdYIr2fz{nT|jU5=n&(F3{Vp^#60**2y98X4nN~) zP9R!!G|=JhwFJil<0i78(AnV$$f%!J;2MP*PQxw;I;pHkJn?>HDk+RV>Xj|g4CfzY zy=HyNBX9eHfeqE>F*?5#tDu~G6m0m$x*e6d$H^<{c$xgTvwJ(=F50%P@NJl0?sZ)6 zL&^=mKs(J%IvE<9u)?ndeqKWo7kW|lx-xf$wx0L{J3j;t6}Le?(n9lwl6<4z7W~JF zq`+Q;@)mV3uV#Pasx?NMMrO-wM@gfM!vO(~)cM_IE5+9`9F_!=^LZQ_0|MXj7)nCl zuutCO--VJICn(0weQRr=sR8)*u(D*Z zwzaYb*xH!_K!_;the+08s1Eihw#Y%J4q=t62>x);zTD?d+&+H4n1!4BBNc9yDI9DT zdT*2$4EZOMuk@GY7yP9&1E4+#6sFiKi^q(?heG_&U!Ex4)ETHwG(wk%yhTBUF0y4N zlI=Yrs+QIQHHyP?=;XPuh0x}Wx|ms@!xM!bL^K`(ve#YzXz=x9?+DS;;Im)e3)<#R zGz&L`{iJjUlDJBD|LlPTVqyC?rBJOdba9-FMAfnVHqEAxv+-)p5(6BP$*eutMZw3)hZ+H43wV5FC0*bLB}*$t->byw#EQOfQ>x>WXJH=md2^fgC442T+bUm zsh6m-z@N9y|^W9CI%Ji`chu+RIso@1~rNf1Qmp-{h=7PYkIcp!dXi3xM|+2+K<_3jVi2b z3kxd=O9{L-9p6^XwpMCREL1MKke&vz75NLejhkU?Woy1wE`}ppFMT!HuQgp%v>Km$ zq6n~%Bzj?~{5&qlGci-#&oZmeExj)4Idk!$S;#)}hsmNj>EWVM4dY^S`odxS?Kvs^ zWez=uR=T+QdeFFi$nK8r+gFtHK|rYp*zAlxWi@&)uXDwAO`t`Q`Uz-Fa(cO~5c;j# z$D#zMJ?uE6auM=fXO}b#Zb@o4Hx%WIUGK<2CdPG`cG-;O7^X4C-N@l z!z=5x8oScAo9hz3SESD*;}nnb=t8T8#Y&aQ`8p|N+mnH<2|(Zb$*ca1-Pv)4s_9(p z9zi*oTd9QW;sV7SA*$L$Eq0;KYZmeZ&KB9{ADiRcwm6OPmys;HB*HmaY=@6t7l~2$iT^J zJXs}K*K5l5oeHCRuB2@^AKmV{B`$VLo|jr#XEU}Ads#yDSM~Q{@4?nDprsi-97o(> zu9>H3)w;Ra+-bg9uO}#t{7g+c4GNtuc*Y+9+xSy)hbQIz> zV6`aIc}|rs9GaH+9@eIM`*F;~gF~FS2UW9Fl=sc0QFYz0t)SZxz8dVLs~gA#wvXA; zT?kcU*b_$8H)f1AXXIG7*$g;7oOVY|*V`+W*iSjg9-UwNG!IQZh-+LrnwZ&QGiDt2 zb}&fTD)R9&H_=4SRKCQNGx!2q<3l-<1tH{xq)W&dA)^drZA*zD1|#uLai4Vqb7KRr z=X|4Ns4d#K13B+4Kjp+DEj3aXQ>5V$At0#@YK(mqT*G^DsOg`bHiDhSLqwllFK~5k z;t!z11jzT@6ICil5nqy{eV=`gy}r^Cl3tHV~D84+So#8iZG!6 zI9FWB1|I7pIlXtXA(zZ6f5v=!P}b&I+N*N{Q-#aGd8gNv*lU~dt>PvZPd6sZ_TgsP z=|o#_{ua4iAc?&J?&W0&>pa-0MRPF7W%vm7GE1{7ZMlSGir zX9hmzPD~ngP?g=)pKFFaR8koJpfMse){7fY&ZVo?;whv?Diia_2DSW~I zTOtyIy%yXSxv!ISc!PT&GNbSgHaB*=d2|`Eh*lNBh?RZwtI4@mSo}!Dai{dJeLA_^ zwUkFq#5M=~FfrX6I(pG25|(dIobZIZcd9Ha%SmfTC%$6GRGfHBI7XQmRA0YycnUm{ zZ4y2c?+F=u=phB&u!*a~9e;7hM7v~H49-JBKpcSI0sqZJf4_N^0JaXM27vD-I!wjf z5myx3gCdeHa)+F)A?sr_N0q<})!9nbhofRb^!{uZk+@bi>J*00r`j9ZY^q=){O$sqsq2<(DQ3-e#VY zTqJc%X+}_`Jb<5gQA6*z+g8TVDQD2tV?*kNziW0T-OA@*Ln*CxmYmTVNyobkJ7;2B zuOI6^S%F83#G2jwr8quMGfl-j*nZZ*ZTETj4l~^&{AztC3;21Ev()8AO+?tM#VX^^ zHlvPn;Vr1B*eV~9pcKLhyWm@oFXdJxsdf8y;z84jB^C8av*$_rFUBkAUxpD!ORC{y zXynQ+Dna*Ro%*QC)L_aAWodPO>Zfs}uSI#1`K?j3hvAWQE?}(2WCHTAgVbt9h-(}R zutcDqgMl9Bk8KpUAa{|C^>}bFI-(ITk)N2d&wZC8@FhKaG*=;iLK~{r{$*U{2jAD4 zWKB5t12=uAQTb#yi3oi@@~M2n0LZ}z18DY(bIRLip*WvlhsxGJip2978ehUc-2qM# zz#lq>!9A>{%rPkxG4C=z(`wD}_x7j1P<6OJiQz~e=kJxrAi?54*44A`wuI2R*QM+$ zF~sZ>!abm;+3NmyHqj`NThT4T^=sBE^ycR%m>K>V;jmPuRNHxrh{!6BQ4h$4`;fHM zri`9-qBH^$ix3CN^hY2cFX$(5@{&LAJe?YEwja}D>1(J`#FlNsCGl@>#0b&J3q5IG zcr?bCLzCHxMgTiFJBFaj*9RhW(`R#KmJ>CNxe`2-A|2M)o%kvM>QwlmpL4-9kJi;y zO>fT^ilppN_G$%rskBf!|4aXAbiPnRwfis{gHH~F=MEputTMkgwon%bPM#)-Ijo2? zExT4xE6?T-C6Q%1?eP2)mMAfpAWUSXTY=~qv;woezyF~A@tqt+9gD2QI9wj2b^+{`M zdEXwkYjD@_IaC;t0d5laa-bi+u`nVicn_T+z^y5=1}+TmC28Fe(#rFY?jXOXZ}^^l zmTMz*s!5a{a;c~uGPTL5=9CCgT3Y6ky_V#CkiAMWeLp{Pf-&;SvD?So@GFN#{ESgO zhp>e$ha7eRdC@XLNpzL+hM*&*3=hsb)^KRLWj;CuY*Hs(=j)bq$4Qe*v3Bnz+KXo| z-Hq3NarbYWxaxG{CN{8N?g9?%F#Ug=I5J^-TU&sof%6Y_}L0!y>b5|YDy z@v=M!A=Hb?!y66hMTK9DAzb%z?g*bof?{Q*)MY8YRLZc)m+7ZHPPzdw%NZjSr)yu* zTn8HV<~^?j#NE(dd~AY;{9>yGQzO^ z%pgvz-Kj?5D3BG{lvc`b`(mnbh~B6I6yFoJL~N{Xse$rx6V+wT9dHc1$bd?5wZh&? znkctI;GwE4(eP)&>{5RquQrarWpmR>N;Ud7nsXD(+n!E z&#+|hEuOn~?z<%URUGyke>^0V1zm-D0p-j4|9p+e&naV50c+m?IM_<_pBgA^ zWoc(?1q1?Ye_T_lrfPU9*d7e`&_9%6Bg7V9B1{N)+7uT1O^gW8v!}-uj~Cdp)cU5! zB-vrbza-xZ>V1KN*5As+g;CE7a>H@3es=Ez|0JR1*i{Lr~?_oH+=s;I(c@ za1q1}FWtj7T6B3>Vg+`Ha4E$t)LMqiz%5N?-7xE5kB^ri)F zB}HUUZH~SbURw5-lhy&f$&B-D`o~?nxH=L>+LZfRv*B)g9GR?M#m8JE+lMMtS9U0Q5|b4L%_PJG@g%slxVNgTXQ*|Igyo{~YY#yfZdm6kpD z%o#U>*GsuH2c~UecsnwHvKv?^u=vIAF;JW@6kj1OQk`wbWr_UB+z{(3q?F3oezFQ{ zsWpP3ChigBro%!Qfj2K#hp5zmTsk2J_zR|I1cNJQf~|;`MJ)n?t(foe z0`ixHF>oLXu>;1+d=&BPap^vno4D6KxWLu%Zb;2DeNKKV-=cRZeNM7JWddY%$!k&7 znom0xPKKT$SD9do9p4-iogqV^vBC5V_E&rJ84wDO#Bp>|Q%2eUrldqW1Bzm%3c_Hu zS5M=DV$V#db+Z~#q(303swbx+eO;oH_eIewDT{HNtb}*S3kfOM<#EOKUejOZr-wRT zZIXB8h+W+$&7v+Yt43-wH&9*N6@?i+<}%Pb4yBD3l7J}yGGssJSa4mpXNNSw2$8y% zgs3k7=%qi5aeXTSSJ^MHO`H>!_ddzCWN(tj<*mlhXSuZX>^;1mAg`P-s-zU9_d1zo zUcJT*CuR<^6Gz38+n=9MP@FkDUd4Ow)6k>pc~NfO5@|CobHQ&)Nj;l3XtQglC^*A@ z1lwjq#;afq17jT~SKQ$#AsvN);<+6t`k^x`HS1iuATwBfP0daqvB7Z;x_>oJ z-=nX;nI~m!xrc%ne8SJG=xK+%^)MAMY)qq6L`0dziW1o{h@s6wQ4Jkz@#-2Y=hya99sHpz@#67efX+E`xsO8f)fBAgGi zpP)oO*vnWZ)EalYe`Uh`tm!LF`^r-0Nlh6oak;6&_)-0bImcF_J#Me{nW}v_nK|HV zmOfK$c)$2YN$k(fU4@;@Np|@h=(W! z&vGMaIf;BTJS~fjmYL;Kox>6268sYrab|9kJaL0S-*xr`|6)B=zwl%P%lyPv3rv~; z@l>I~hvC!m*3a7S@3Kl?z3xKtc|1Q6%BPPWro5iF2$exI8oSo2KC6#CjL_L`X&i}e zkQ>zZ=1>wqO++My9my;AF6JTaw;;a`m#t42yn0;@xjhX9CUWL13ljlZTQz1aHoghf zwR?yz2~n%X=&gOaI>yyzZO+TDrxQIdcOa4YY&8wPnod4*@N5($q()%kGSUp7&WZsT z8cYxB5q531XlS}72f&986;z=!1%vu~a8h#VoSg|D9C~Uo%*WumoI*#H28!*IB!mN= zrk|dQod-Jg%29qKd?!vSxlMFWN8n(~ zOG2^&yo>i|zKiHj#+yz1yDNP^Ik(?QP*kwq|0F>z^c?_}|IwKA_r~CGFT>vqAHyAn z@AuwrT!1^h{R!X>4jjZ(J&l4gby)ujIMBQWKCR6E6OJ`_j9@;oL0QHslL@Wih!$-N zlc#$(JvgvXa@>segj8{+Kn<3{7izZ4fq2~P+BNJkWu&|X>bUJu@_Nz}s}3?X9#wyK zaTPfJkPZ_Jzh0-KCF;@+8c{)KW}@Lz&{t$!-Zr z*=)BmCkjuGb{oTlbYI_wIQ-^==67UnWwKSlO1u-NPfU&MW2~ zx|*KbVb2{dsv09&fr)?ZFDlqHSh+i?!qJP>lH2Z^WdFFpPZK+w@gkQ_Zv_y z41x~)C+yVy8WtT-mLpa&`Su-6!Uhc;(drYwo>GcJ=jd6feBJEVH5>VsEi2#jH5JN> zuWBM@5%Si)-;n){`ZXK2U`=rXSI+-gV{Z8nB?q~FDSAmd2^j_P0_A-fI;s8@MF-j* z<$XB@1tvBnCYCZ5_9_+*WorjylzWGvNHsl*A;GLiM?mCbq+=v|pDTPwZ@x?6nvsx0 zDMVf+V9XKdBpO`_q$qhbauO^R%z~&`iyk7$GKwA}~RL)-s;hHlap zz85rz9l@KYpC{^8?9XWoKja{?yl&z}KgE7YYPd!CJ&OPwX8KWXI&KF)|4cl%9qrxx zgzs~>k-HJv0)OA~#=my=;B$XNEd7_nO=`mTa?=yr4~f5R(|?NIq$=Es z>fROoX^#G$=ATm+{>I4iiUK42lE`p7>OT|ww}M$#=eru}fKy^DL-cfQ3%#{D>K#oi%?z)8ho;E5>y^RB!HjZ5#9XyKZW9&RsaA1 literal 0 HcmV?d00001 From 16bd27cab262974d07fc4a84ab9c597c146a9eaf Mon Sep 17 00:00:00 2001 From: Simone Cusimano Date: Tue, 20 Oct 2020 08:51:00 +0200 Subject: [PATCH 0964/1862] Remove gitignore file --- .../gradle-dependency-management/.gitignore | 34 ------------------- 1 file changed, 34 deletions(-) delete mode 100644 gradle/gradle-dependency-management/.gitignore diff --git a/gradle/gradle-dependency-management/.gitignore b/gradle/gradle-dependency-management/.gitignore deleted file mode 100644 index 84695dca6f..0000000000 --- a/gradle/gradle-dependency-management/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -HELP.md -.gradle -build/ -!gradle/wrapper/gradle-wrapper.jar -!**/src/main/**/build/ -!**/src/test/**/build/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr -out/ -!**/src/main/**/out/ -!**/src/test/**/out/ - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ - -### VS Code ### -.vscode/ From 61f2654a9d17591a90026613ba3dd168d2ddc3b7 Mon Sep 17 00:00:00 2001 From: Loredana Date: Tue, 20 Oct 2020 11:16:17 +0300 Subject: [PATCH 0965/1862] update basename for messagesource --- .../com/baeldung/spring/configuration/EmailConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java index 86a7f1162c..7f296ce6a7 100644 --- a/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java +++ b/spring-mvc-basics-2/src/main/java/com/baeldung/spring/configuration/EmailConfiguration.java @@ -119,7 +119,7 @@ public class EmailConfiguration { @Bean public ResourceBundleMessageSource emailMessageSource() { final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); - messageSource.setBasename("/mailMessages"); + messageSource.setBasename("mailMessages"); return messageSource; } From e012de2de98270702e7cdb93227c0c7725d010e6 Mon Sep 17 00:00:00 2001 From: Loredana Date: Tue, 20 Oct 2020 11:42:57 +0300 Subject: [PATCH 0966/1862] add the oidc legacy code back --- spring-security-modules/pom.xml | 1 + .../spring-security-legacy-oidc/README.md | 23 ++++ .../spring-security-legacy-oidc/pom.xml | 58 ++++++++++ .../oidc/GoogleOpenIdConnectConfig.java | 51 +++++++++ .../baeldung/openid/oidc/HomeController.java | 22 ++++ .../openid/oidc/OpenIdConnectFilter.java | 103 ++++++++++++++++++ .../openid/oidc/OpenIdConnectUserDetails.java | 81 ++++++++++++++ .../baeldung/openid/oidc/SecurityConfig.java | 48 ++++++++ .../openid/oidc/SpringOpenidApplication.java | 14 +++ .../src/main/resources/application.properties | 8 ++ .../src/main/resources/logback.xml | 13 +++ .../openid/oidc/SpringContextTest.java | 15 +++ 12 files changed, 437 insertions(+) create mode 100644 spring-security-modules/spring-security-legacy-oidc/README.md create mode 100644 spring-security-modules/spring-security-legacy-oidc/pom.xml create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/GoogleOpenIdConnectConfig.java create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/HomeController.java create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectFilter.java create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectUserDetails.java create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SecurityConfig.java create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SpringOpenidApplication.java create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/main/resources/application.properties create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/main/resources/logback.xml create mode 100644 spring-security-modules/spring-security-legacy-oidc/src/test/java/com/baeldung/openid/oidc/SpringContextTest.java diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index d5c0c0dd6e..0fc2b49fa7 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -28,6 +28,7 @@ spring-security-web-login spring-security-web-persisted-remember-me spring-security-web-sockets + spring-security-legacy-oidc spring-security-oidc spring-security-okta spring-security-web-react diff --git a/spring-security-modules/spring-security-legacy-oidc/README.md b/spring-security-modules/spring-security-legacy-oidc/README.md new file mode 100644 index 0000000000..5e8f391b96 --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/README.md @@ -0,0 +1,23 @@ +## Spring Security OpenID + +This module contains articles about OpenID with Spring Security + +### Relevant articles + +- [Spring Security and OpenID Connect (Legacy)](https://www.baeldung.com/spring-security-openid-connect-legacy) + +### OpenID Connect with Spring Security + +### Run the Project + +``` +mvn spring-boot:run +``` + +### Obtain Google App - Client ID, Secret + +- We need to get client id and client secret by creating a new project at [Google Developer Console](https://console.developers.google.com/project/_/apiui/credential?pli=1) +- We can follow these instructions to register our client application on their platform + +- Once we have the client id and secret, we have to make sure we add them to the YAML files of the project + diff --git a/spring-security-modules/spring-security-legacy-oidc/pom.xml b/spring-security-modules/spring-security-legacy-oidc/pom.xml new file mode 100644 index 0000000000..a4ead0f6e0 --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + spring-security-legacy-oidc + spring-security-legacy-oidc + war + Spring OpenID Connect sample project + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-tomcat + + + + org.springframework.security.oauth + spring-security-oauth2 + ${spring-security-oauth2.version} + + + + org.springframework.security + spring-security-jwt + ${spring-security-jwt.version} + + + + com.auth0 + jwks-rsa + ${jwks-rsa.version} + + + + + 2.2.1.RELEASE + 1.0.9.RELEASE + 0.3.0 + + + diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/GoogleOpenIdConnectConfig.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/GoogleOpenIdConnectConfig.java new file mode 100644 index 0000000000..a9fdcfb286 --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/GoogleOpenIdConnectConfig.java @@ -0,0 +1,51 @@ +package com.baeldung.openid.oidc; + +import java.util.Arrays; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.oauth2.client.OAuth2ClientContext; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; +import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails; +import org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeResourceDetails; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client; + +@Configuration +@EnableOAuth2Client +public class GoogleOpenIdConnectConfig { + @Value("${google.clientId}") + private String clientId; + + @Value("${google.clientSecret}") + private String clientSecret; + + @Value("${google.accessTokenUri}") + private String accessTokenUri; + + @Value("${google.userAuthorizationUri}") + private String userAuthorizationUri; + + @Value("${google.redirectUri}") + private String redirectUri; + + @Bean + public OAuth2ProtectedResourceDetails googleOpenId() { + final AuthorizationCodeResourceDetails details = new AuthorizationCodeResourceDetails(); + details.setClientId(clientId); + details.setClientSecret(clientSecret); + details.setAccessTokenUri(accessTokenUri); + details.setUserAuthorizationUri(userAuthorizationUri); + details.setScope(Arrays.asList("openid", "email")); + details.setPreEstablishedRedirectUri(redirectUri); + details.setUseCurrentUri(false); + return details; + } + + @Bean + public OAuth2RestTemplate googleOpenIdTemplate(final OAuth2ClientContext clientContext) { + final OAuth2RestTemplate template = new OAuth2RestTemplate(googleOpenId(), clientContext); + return template; + } + +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/HomeController.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/HomeController.java new file mode 100644 index 0000000000..3d2e776eca --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/HomeController.java @@ -0,0 +1,22 @@ +package com.baeldung.openid.oidc; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class HomeController { + private final Logger logger = LoggerFactory.getLogger(getClass()); + + @RequestMapping("/") + @ResponseBody + public final String home() { + final String username = SecurityContextHolder.getContext().getAuthentication().getName(); + logger.info(username); + return "Welcome, " + username; + } + +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectFilter.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectFilter.java new file mode 100644 index 0000000000..c0b08bc548 --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectFilter.java @@ -0,0 +1,103 @@ +package com.baeldung.openid.oidc; + +import java.io.IOException; +import java.net.URL; +import java.security.interfaces.RSAPublicKey; +import java.util.Date; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.jwt.Jwt; +import org.springframework.security.jwt.JwtHelper; +import org.springframework.security.jwt.crypto.sign.RsaVerifier; +import org.springframework.security.oauth2.client.OAuth2RestOperations; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; +import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; + +import com.auth0.jwk.Jwk; +import com.auth0.jwk.JwkProvider; +import com.auth0.jwk.UrlJwkProvider; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class OpenIdConnectFilter extends AbstractAuthenticationProcessingFilter { + @Value("${google.clientId}") + private String clientId; + + @Value("${google.issuer}") + private String issuer; + + @Value("${google.jwkUrl}") + private String jwkUrl; + + public OAuth2RestOperations restTemplate; + + public OpenIdConnectFilter(String defaultFilterProcessesUrl) { + super(defaultFilterProcessesUrl); + setAuthenticationManager(new NoopAuthenticationManager()); + } + + @Override + public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { + + OAuth2AccessToken accessToken; + try { + accessToken = restTemplate.getAccessToken(); + } catch (final OAuth2Exception e) { + throw new BadCredentialsException("Could not obtain access token", e); + } + try { + final String idToken = accessToken.getAdditionalInformation().get("id_token").toString(); + String kid = JwtHelper.headers(idToken) + .get("kid"); + final Jwt tokenDecoded = JwtHelper.decodeAndVerify(idToken, verifier(kid)); + final Map authInfo = new ObjectMapper().readValue(tokenDecoded.getClaims(), Map.class); + verifyClaims(authInfo); + final OpenIdConnectUserDetails user = new OpenIdConnectUserDetails(authInfo, accessToken); + return new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities()); + } catch (final Exception e) { + throw new BadCredentialsException("Could not obtain user details from token", e); + } + + } + + public void verifyClaims(Map claims) { + int exp = (int) claims.get("exp"); + Date expireDate = new Date(exp * 1000L); + Date now = new Date(); + if (expireDate.before(now) || !claims.get("iss").equals(issuer) || !claims.get("aud").equals(clientId)) { + throw new RuntimeException("Invalid claims"); + } + } + + + private RsaVerifier verifier(String kid) throws Exception { + JwkProvider provider = new UrlJwkProvider(new URL(jwkUrl)); + Jwk jwk = provider.get(kid); + return new RsaVerifier((RSAPublicKey) jwk.getPublicKey()); + } + + public void setRestTemplate(OAuth2RestTemplate restTemplate2) { + restTemplate = restTemplate2; + + } + + private static class NoopAuthenticationManager implements AuthenticationManager { + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + throw new UnsupportedOperationException("No authentication should be done with this AuthenticationManager"); + } + + } +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectUserDetails.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectUserDetails.java new file mode 100644 index 0000000000..4ff61bcad9 --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/OpenIdConnectUserDetails.java @@ -0,0 +1,81 @@ +package com.baeldung.openid.oidc; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Map; + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.oauth2.common.OAuth2AccessToken; + +public class OpenIdConnectUserDetails implements UserDetails { + + private static final long serialVersionUID = 1L; + + private String userId; + private String username; + private OAuth2AccessToken token; + + public OpenIdConnectUserDetails(Map userInfo, OAuth2AccessToken token) { + this.userId = userInfo.get("sub"); + this.username = userInfo.get("email"); + this.token = token; + } + + @Override + public String getUsername() { + return username; + } + + @Override + public Collection getAuthorities() { + return Arrays.asList(new SimpleGrantedAuthority("ROLE_USER")); + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public OAuth2AccessToken getToken() { + return token; + } + + public void setToken(OAuth2AccessToken token) { + this.token = token; + } + + public void setUsername(String username) { + this.username = username; + } + + @Override + public String getPassword() { + return null; + } + + @Override + public boolean isAccountNonExpired() { + return true; + } + + @Override + public boolean isAccountNonLocked() { + return true; + } + + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @Override + public boolean isEnabled() { + return true; + } + +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SecurityConfig.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SecurityConfig.java new file mode 100644 index 0000000000..fc5397a35b --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SecurityConfig.java @@ -0,0 +1,48 @@ +package com.baeldung.openid.oidc; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; +import org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter; +import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint; +import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter; + +@Configuration +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + @Autowired + private OAuth2RestTemplate restTemplate; + + @Override + public void configure(WebSecurity web) throws Exception { + web.ignoring().antMatchers("/resources/**"); + } + + @Bean + public OpenIdConnectFilter myFilter() { + final OpenIdConnectFilter filter = new OpenIdConnectFilter("/google-login"); + filter.setRestTemplate(restTemplate); + return filter; + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + // @formatter:off + http + .addFilterAfter(new OAuth2ClientContextFilter(), AbstractPreAuthenticatedProcessingFilter.class) + .addFilterAfter(myFilter(), OAuth2ClientContextFilter.class) + .httpBasic().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/google-login")) + .and() + .authorizeRequests() + // .antMatchers("/","/index*").permitAll() + .anyRequest().authenticated() + ; + + // @formatter:on + } +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SpringOpenidApplication.java b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SpringOpenidApplication.java new file mode 100644 index 0000000000..ec686f746d --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/main/java/com/baeldung/openid/oidc/SpringOpenidApplication.java @@ -0,0 +1,14 @@ +package com.baeldung.openid.oidc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +@SpringBootApplication +public class SpringOpenidApplication extends SpringBootServletInitializer { + + public static void main(String[] args) { + SpringApplication.run(SpringOpenidApplication.class, args); + } + +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/resources/application.properties b/spring-security-modules/spring-security-legacy-oidc/src/main/resources/application.properties new file mode 100644 index 0000000000..e9ae90dd10 --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/main/resources/application.properties @@ -0,0 +1,8 @@ +server.port=8081 +google.clientId=475873350264-g1opb20lf2fc60h0o84rrkn972krgkvo.apps.googleusercontent.com +google.clientSecret=GiA1Agf_aSt-bhTrnXjre-5Z +google.accessTokenUri=https://www.googleapis.com/oauth2/v3/token +google.userAuthorizationUri=https://accounts.google.com/o/oauth2/auth +google.redirectUri=http://localhost:8081/google-login +google.issuer=accounts.google.com +google.jwkUrl=https://www.googleapis.com/oauth2/v2/certs \ No newline at end of file diff --git a/spring-security-modules/spring-security-legacy-oidc/src/main/resources/logback.xml b/spring-security-modules/spring-security-legacy-oidc/src/main/resources/logback.xml new file mode 100644 index 0000000000..3b8d0b9964 --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-security-modules/spring-security-legacy-oidc/src/test/java/com/baeldung/openid/oidc/SpringContextTest.java b/spring-security-modules/spring-security-legacy-oidc/src/test/java/com/baeldung/openid/oidc/SpringContextTest.java new file mode 100644 index 0000000000..0a21c5e93f --- /dev/null +++ b/spring-security-modules/spring-security-legacy-oidc/src/test/java/com/baeldung/openid/oidc/SpringContextTest.java @@ -0,0 +1,15 @@ +package com.baeldung.openid.oidc; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringOpenidApplication.class) +public class SpringContextTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} \ No newline at end of file From e16eef77267fe0d7a0bfb105d9e01d8821c899ac Mon Sep 17 00:00:00 2001 From: Loredana Date: Tue, 20 Oct 2020 12:33:13 +0300 Subject: [PATCH 0967/1862] update jpa shared key --- .../hibernate/jpabootstrap/application/Application.java | 2 +- .../baeldung/hibernate/onetoone/sharedkeybased/Address.java | 5 +++-- .../com/baeldung/hibernate/onetoone/sharedkeybased/User.java | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java index f7b8e6bf6d..b547a60b06 100644 --- a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java +++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/jpabootstrap/application/Application.java @@ -8,7 +8,7 @@ public class Application { public static void main(String[] args) { EntityManager entityManager = getJpaEntityManager(); - User user = entityManager.find(User.class, 1); + User user = entityManager.find(User.class, 1l); System.out.println(user); entityManager.getTransaction().begin(); user.setName("John"); diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java index 927516f6bb..e70c62e77b 100644 --- a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java +++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/Address.java @@ -1,9 +1,9 @@ package com.baeldung.hibernate.onetoone.sharedkeybased; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; +import javax.persistence.JoinColumn; import javax.persistence.MapsId; import javax.persistence.OneToOne; import javax.persistence.Table; @@ -13,7 +13,7 @@ import javax.persistence.Table; public class Address { @Id - @Column(name = "id") + @Column(name = "user_id") private Long id; @Column(name = "street") @@ -24,6 +24,7 @@ public class Address { @OneToOne @MapsId + @JoinColumn(name = "user_id") private User user; public Long getId() { diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java index fa00db1271..605671a149 100644 --- a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java +++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/onetoone/sharedkeybased/User.java @@ -8,6 +8,7 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToOne; +import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.Table; @Entity @@ -22,6 +23,7 @@ public class User { private String userName; @OneToOne(mappedBy = "user", cascade = CascadeType.ALL) + @PrimaryKeyJoinColumn private Address address; public Long getId() { From b6dbadc18e4c4408d117adc710963184dea57585 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Tue, 20 Oct 2020 12:41:36 +0300 Subject: [PATCH 0968/1862] Update README.md --- spring-security-modules/spring-security-oidc/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-security-modules/spring-security-oidc/README.md b/spring-security-modules/spring-security-oidc/README.md index ca6053f70f..5e8f391b96 100644 --- a/spring-security-modules/spring-security-oidc/README.md +++ b/spring-security-modules/spring-security-oidc/README.md @@ -4,7 +4,6 @@ This module contains articles about OpenID with Spring Security ### Relevant articles -- [Spring Security and OpenID Connect](https://www.baeldung.com/spring-security-openid-connect) - [Spring Security and OpenID Connect (Legacy)](https://www.baeldung.com/spring-security-openid-connect-legacy) ### OpenID Connect with Spring Security From 3f8591f891725ea65539e1be7b6bc4da2645453d Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Tue, 20 Oct 2020 12:42:29 +0300 Subject: [PATCH 0969/1862] Update README.md --- spring-security-modules/spring-security-legacy-oidc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-legacy-oidc/README.md b/spring-security-modules/spring-security-legacy-oidc/README.md index 5e8f391b96..9d47b35b21 100644 --- a/spring-security-modules/spring-security-legacy-oidc/README.md +++ b/spring-security-modules/spring-security-legacy-oidc/README.md @@ -19,5 +19,5 @@ mvn spring-boot:run - We need to get client id and client secret by creating a new project at [Google Developer Console](https://console.developers.google.com/project/_/apiui/credential?pli=1) - We can follow these instructions to register our client application on their platform -- Once we have the client id and secret, we have to make sure we add them to the YAML files of the project +- Once we have the client id and secret, we have to make sure we add them to the application.properties file. From 0efc73afccbd920ae0e078fea4108b0c87bbca70 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Tue, 20 Oct 2020 13:14:22 +0300 Subject: [PATCH 0970/1862] Update README.md --- spring-security-modules/spring-security-web-sockets/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-sockets/README.md b/spring-security-modules/spring-security-web-sockets/README.md index 14ef0c8b99..76717e2fe6 100644 --- a/spring-security-modules/spring-security-web-sockets/README.md +++ b/spring-security-modules/spring-security-web-sockets/README.md @@ -5,7 +5,7 @@ This module contains articles about WebSockets with Spring Security ### Relevant Articles: - [Intro to Security and WebSockets](https://www.baeldung.com/spring-security-websockets) -- [Spring WebSockets: Build an User Chat](https://www.baeldung.com/spring-websockets-send-message-to-user) +- [Spring WebSockets: Send Messages to a Specific User](https://www.baeldung.com/spring-websockets-send-message-to-user) - [REST vs WebSockets](https://www.baeldung.com/rest-vs-websockets) ### Running This Project: From b8f341a7ae474ead59b3ca9e5410188b6cc83cf4 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 21 Oct 2020 10:19:38 +0800 Subject: [PATCH 0971/1862] Update README.md --- spring-boot-modules/spring-boot-annotations/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-annotations/README.md b/spring-boot-modules/spring-boot-annotations/README.md index a721f28d55..6ead94de86 100644 --- a/spring-boot-modules/spring-boot-annotations/README.md +++ b/spring-boot-modules/spring-boot-annotations/README.md @@ -9,3 +9,4 @@ This module contains articles about Spring Boot annotations - [Spring Web Annotations](https://www.baeldung.com/spring-mvc-annotations) - [Spring Core Annotations](https://www.baeldung.com/spring-core-annotations) - [Spring Bean Annotations](https://www.baeldung.com/spring-bean-annotations) +- [Difference Between @ComponentScan and @EnableAutoConfiguration in Spring Boot](https://www.baeldung.com/spring-componentscan-vs-enableautoconfiguration) From 8af5182f924b8a9f8c750a0137f09632af26a489 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 21 Oct 2020 11:23:19 +0800 Subject: [PATCH 0972/1862] Update README.md --- persistence-modules/spring-persistence-simple/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index 8bef16868d..34211e981e 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -7,6 +7,7 @@ - [Transaction Propagation and Isolation in Spring @Transactional](https://www.baeldung.com/spring-transactional-propagation-isolation) - [JTA Transaction with Spring](https://www.baeldung.com/spring-vs-jta-transactional) - [Test a Mock JNDI Datasource with Spring](https://www.baeldung.com/spring-mock-jndi-datasource) +- [Detecting If a Spring Transaction Is Active](https://www.baeldung.com/spring-transaction-active) ### Eclipse Config After importing the project into Eclipse, you may see the following error: From 3a1bcc1a154e7c168f865766ef9290ec764b6765 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 21 Oct 2020 11:25:34 +0800 Subject: [PATCH 0973/1862] Update README.md --- core-java-modules/core-java-networking-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-networking-2/README.md b/core-java-modules/core-java-networking-2/README.md index fa49c35bf8..9def4c8eb6 100644 --- a/core-java-modules/core-java-networking-2/README.md +++ b/core-java-modules/core-java-networking-2/README.md @@ -14,4 +14,5 @@ This module contains articles about networking in Java - [Handling java.net.ConnectException](https://www.baeldung.com/java-net-connectexception) - [Getting MAC addresses in Java](https://www.baeldung.com/java-mac-address) - [Sending Emails with Attachments in Java](https://www.baeldung.com/java-send-emails-attachments) +- [Finding a Free Port in Java](https://www.baeldung.com/java-free-port) - [[<-- Prev]](/core-java-modules/core-java-networking) From e4430ea67247e4de6a0218a6b7ffdca94025120b Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 21 Oct 2020 11:28:46 +0800 Subject: [PATCH 0974/1862] Create README.md --- persistence-modules/core-java-persistence-2/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 persistence-modules/core-java-persistence-2/README.md diff --git a/persistence-modules/core-java-persistence-2/README.md b/persistence-modules/core-java-persistence-2/README.md new file mode 100644 index 0000000000..467de757ce --- /dev/null +++ b/persistence-modules/core-java-persistence-2/README.md @@ -0,0 +1,3 @@ +### Relevant Articles: + +- [Getting Database URL From JDBC Connection Object](https://www.baeldung.com/jdbc-get-url-from-connection) From dad6426ea1c1e2bcb90f79f36517388cf4f573be Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 21 Oct 2020 11:31:57 +0800 Subject: [PATCH 0975/1862] Update README.md --- apache-spark/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/apache-spark/README.md b/apache-spark/README.md index c60b556d51..3a2d2f4e15 100644 --- a/apache-spark/README.md +++ b/apache-spark/README.md @@ -8,3 +8,4 @@ This module contains articles about Apache Spark - [Building a Data Pipeline with Kafka, Spark Streaming and Cassandra](https://www.baeldung.com/kafka-spark-data-pipeline) - [Machine Learning with Spark MLlib](https://www.baeldung.com/spark-mlib-machine-learning) - [Introduction to Spark Graph Processing with GraphFrames](https://www.baeldung.com/spark-graph-graphframes) +- [Apache Spark: Differences between Dataframes, Datasets and RDDs](https://www.baeldung.com/java-spark-dataframe-dataset-rdd) From 88820fbc6324b2944319559c3a1b665d4e641b7a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 21 Oct 2020 11:37:34 +0800 Subject: [PATCH 0976/1862] Update README.md --- persistence-modules/spring-boot-persistence-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/persistence-modules/spring-boot-persistence-2/README.md b/persistence-modules/spring-boot-persistence-2/README.md index 392218d2bf..e7f32053e4 100644 --- a/persistence-modules/spring-boot-persistence-2/README.md +++ b/persistence-modules/spring-boot-persistence-2/README.md @@ -5,4 +5,5 @@ - [Integrating Spring Boot with HSQLDB](https://www.baeldung.com/spring-boot-hsqldb) - [List of In-Memory Databases](https://www.baeldung.com/java-in-memory-databases) - [Oracle Connection Pooling With Spring](https://www.baeldung.com/spring-oracle-connection-pooling) +- [Object States in Hibernate’s Session](https://www.baeldung.com/hibernate-session-object-states) - More articles: [[<-- prev]](../spring-boot-persistence) From 2bf7f715b04a5d7b2959fcd17fd585c8c2ea127d Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 21 Oct 2020 11:41:32 +0800 Subject: [PATCH 0977/1862] Update README.md --- core-java-modules/core-java-lang-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-3/README.md b/core-java-modules/core-java-lang-3/README.md index 598014bb92..0707d0de98 100644 --- a/core-java-modules/core-java-lang-3/README.md +++ b/core-java-modules/core-java-lang-3/README.md @@ -7,4 +7,5 @@ This module contains articles about core features in the Java language - [When are Static Variables Initialized in Java?](https://www.baeldung.com/java-static-variables-initialization) - [Checking if a Class Exists in Java](https://www.baeldung.com/java-check-class-exists) - [The Difference Between a.getClass() and A.class in Java](https://www.baeldung.com/java-getclass-vs-class) +- [Constants in Java: Patterns and Anti-Patterns](https://www.baeldung.com/java-constants-good-practices) - [[<-- Prev]](/core-java-modules/core-java-lang-2) From 6d65fb29d0376b54011e638eac0b26da6fdfd892 Mon Sep 17 00:00:00 2001 From: Loredana Date: Wed, 21 Oct 2020 11:05:24 +0300 Subject: [PATCH 0978/1862] update h2 in jooq project --- spring-jooq/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-jooq/pom.xml b/spring-jooq/pom.xml index 95418645fa..550d49b5b2 100644 --- a/spring-jooq/pom.xml +++ b/spring-jooq/pom.xml @@ -206,7 +206,7 @@ 1.0.0 1.5 1.0.0 - org.jooq.example.spring.Application + 1.4.198 \ No newline at end of file From a66f2f55efa5be1108d3afb4cd3f8820488995a6 Mon Sep 17 00:00:00 2001 From: Loredana Date: Wed, 21 Oct 2020 14:45:56 +0300 Subject: [PATCH 0979/1862] fix relative path, fix start of kerberos app --- .../spring-security-sso-auth-server/pom.xml | 2 +- .../spring-security-sso-kerberos/pom.xml | 6 +++++- .../spring-security-sso-ui-2/pom.xml | 2 +- .../spring-security-sso-ui/pom.xml | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml index 3537c01e46..20a43eaf04 100644 --- a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml +++ b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-auth-server/pom.xml @@ -8,7 +8,7 @@ com.baeldung - spring-security-sso + spring-security-oauth2-sso 1.0.0-SNAPSHOT diff --git a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml index a67cc4af83..f17ca171a5 100644 --- a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml +++ b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-kerberos/pom.xml @@ -7,7 +7,7 @@ com.baeldung - spring-security-sso + spring-security-oauth2-sso 1.0.0-SNAPSHOT @@ -91,5 +91,9 @@ + + + com.baeldung.intro.Application + \ No newline at end of file diff --git a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml index 0645ba3593..514dd0d0f7 100644 --- a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml +++ b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui-2/pom.xml @@ -8,7 +8,7 @@ com.baeldung - spring-security-sso + spring-security-oauth2-sso 1.0.0-SNAPSHOT diff --git a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml index d34317a4b0..5076b1878b 100644 --- a/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml +++ b/spring-security-modules/spring-security-oauth2-sso/spring-security-sso-ui/pom.xml @@ -8,7 +8,7 @@ com.baeldung - spring-security-sso + spring-security-oauth2-sso 1.0.0-SNAPSHOT From 9f9f0c40f5df741e1e31e2f0af3effc605b2f095 Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Wed, 21 Oct 2020 22:39:43 +0200 Subject: [PATCH 0980/1862] [BAEL-4284] AbstractMethodError --- .../core-java-exceptions-3/pom.xml | 8 +++++++ .../AbstractMethodErrorUnitTest.java | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/abstractmethoderror/AbstractMethodErrorUnitTest.java diff --git a/core-java-modules/core-java-exceptions-3/pom.xml b/core-java-modules/core-java-exceptions-3/pom.xml index b909572afe..8c36fd0af1 100644 --- a/core-java-modules/core-java-exceptions-3/pom.xml +++ b/core-java-modules/core-java-exceptions-3/pom.xml @@ -17,6 +17,14 @@ + + + com.h2database + h2 + 1.4.191 + test + + org.assertj diff --git a/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/abstractmethoderror/AbstractMethodErrorUnitTest.java b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/abstractmethoderror/AbstractMethodErrorUnitTest.java new file mode 100644 index 0000000000..cadc884487 --- /dev/null +++ b/core-java-modules/core-java-exceptions-3/src/test/java/com/baeldung/exceptions/abstractmethoderror/AbstractMethodErrorUnitTest.java @@ -0,0 +1,23 @@ +package com.baeldung.exceptions.abstractmethoderror; + + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +class AbstractMethodErrorUnitTest { + private static final String url = "jdbc:h2:mem:A-DATABASE;INIT=CREATE SCHEMA IF NOT EXISTS myschema"; + private static final String username = "sa"; + + @Test + void givenOldH2Database_whenCallgetSchemaMethod_thenThrowAbstractMethodError() throws SQLException { + Connection conn = DriverManager.getConnection(url, username, ""); + assertNotNull(conn); + Assertions.assertThrows(AbstractMethodError.class, () -> conn.getSchema()); + } +} From b2a3a69b4aa2ca7035f0f95db11fd1a9f6351679 Mon Sep 17 00:00:00 2001 From: AbdallahSawan Date: Thu, 22 Oct 2020 11:19:33 +0300 Subject: [PATCH 0981/1862] The Value of 0xFF Number and Its Uses With & Operation in Java Article by Abdallah Sawan --- .../com/baeldung/number_0xff/Number0xff.java | 20 ++++++++ .../number_0xff/Number0xffUnitTest.java | 49 +++++++++++++++++++ .../src/main/java/com/baeldung/Main.java | 23 --------- 3 files changed, 69 insertions(+), 23 deletions(-) create mode 100644 java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java create mode 100644 java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java delete mode 100644 java-numbers-5/src/main/java/com/baeldung/Main.java diff --git a/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java b/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java new file mode 100644 index 0000000000..2828dccdb3 --- /dev/null +++ b/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java @@ -0,0 +1,20 @@ +package com.baeldung.number_0xff; + +public class Number0xff { + + public static int getRedColor(int rgba) { + return rgba >> 24 & 0xff; + } + + public static int getGreenColor(int rgba) { + return rgba >> 16 & 0xff; + } + + public static int getBlueColor(int rgba) { + return rgba >> 8 & 0xff; + } + + public static int getAlfa(int rgba) { + return rgba >> rgba & 0xff; + } +} diff --git a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java new file mode 100644 index 0000000000..6dc4d03c48 --- /dev/null +++ b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java @@ -0,0 +1,49 @@ +package com.baeldung.number_0xff; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; + +public class Number0xffUtitTest { + + @Test + public void test0xFFAssignedToInteger() { + int x = 0xff; + int expectedValue = 255; + assertEquals(x, expectedValue); + } + + @Test + public void test0xFFAssignedToByte() { + byte y = (byte) 0xff; + int expectedValue = -1; + assertEquals(x, expectedValue); + } + + @Test + public void givenColor_thenExtractRedColor() { + int rgba = 272214023; + int expectedValue = 64; + assertEquals(Number0xff.getRedColor(rgba), expectedValue); + } + + @Test + public void givenColor_thenExtractGreenColor() { + int rgba = 272214023; + int expectedValue = 57; + assertEquals(Number0xff.getGreenColor(rgba), expectedValue); + } + + @Test + public void givenColor_thenExtractBlueColor() { + int rgba = 272214023; + int expectedValue = 168; + assertEquals(Number0xff.getBlueColor(rgba), expectedValue); + } + + @Test + public void givenColor_thenExtractAlfa() { + int rgba = 272214023; + int expectedValue = 7; + assertEquals(Number0xff.getAlfa(rgba), expectedValue); + } +} diff --git a/java-numbers-5/src/main/java/com/baeldung/Main.java b/java-numbers-5/src/main/java/com/baeldung/Main.java deleted file mode 100644 index dfc625809d..0000000000 --- a/java-numbers-5/src/main/java/com/baeldung/Main.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung; - -public class Main { - - public static void main(String[] args) { - int x = 0xff; - System.out.println(x); // output is 255 - - byte y = (byte) 0xff; - System.out.println(y); // output is -1 - - int rgba = 272214023; - int r = rgba >> 24; - int g = rgba >> 16 & 0xFF; - int b = rgba >> 8 & 0xFF; - int a = rgba & 0xFF; - - System.out.println(r); // output is 64 - System.out.println(g); // output is 57 - System.out.println(b); // output is 168 - System.out.println(a); // output is 7 - } -} From 96c386649d48853084ea47c1ebe3b5ae13d10e22 Mon Sep 17 00:00:00 2001 From: mikr Date: Thu, 22 Oct 2020 10:42:10 +0200 Subject: [PATCH 0982/1862] JAVA-2824 Fix tests in Java 9 and above modules --- core-java-modules/core-java-14/pom.xml | 2 + .../ConvertInstantToTimestampUnitTest.java | 10 +++-- .../baeldung/date/StringToDateUnitTest.java | 3 +- .../datetime/DateTimeFormatterUnitTest.java | 40 ++++++++++--------- .../ProcessAPIEnhancementsUnitTest.java | 12 ++---- .../process/ProcessUnderstandingUnitTest.java | 30 -------------- .../ProcessBuilderUnitTest.java | 6 +-- .../screenshot/ScreenshotUnitTest.java | 21 +++++----- .../core-java-time-measurements/pom.xml | 1 + .../baeldung/time/ElapsedTimeUnitTest.java | 8 +++- .../baeldung/time/LocalDateTimeUnitTest.java | 6 +-- pom.xml | 10 ++--- 12 files changed, 64 insertions(+), 85 deletions(-) diff --git a/core-java-modules/core-java-14/pom.xml b/core-java-modules/core-java-14/pom.xml index 96cb6b37e7..e977f39e9d 100644 --- a/core-java-modules/core-java-14/pom.xml +++ b/core-java-modules/core-java-14/pom.xml @@ -44,6 +44,8 @@ ${maven.compiler.release} --enable-preview + 14 + 14 diff --git a/core-java-modules/core-java-datetime-conversion/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java b/core-java-modules/core-java-datetime-conversion/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java index e5fd80285c..bb36dd634e 100644 --- a/core-java-modules/core-java-datetime-conversion/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java +++ b/core-java-modules/core-java-datetime-conversion/src/test/java/com/baeldung/datetime/ConvertInstantToTimestampUnitTest.java @@ -6,6 +6,7 @@ import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.time.Instant; +import java.time.format.DateTimeFormatter; import java.util.TimeZone; import static org.assertj.core.api.Assertions.assertThat; @@ -21,9 +22,12 @@ public class ConvertInstantToTimestampUnitTest { instant = timestamp.toInstant(); assertThat(instant.toEpochMilli()).isEqualTo(timestamp.getTime()); - DateFormat df = DateFormat.getDateTimeInstance(); - df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + formatter = formatter.withZone(TimeZone.getTimeZone("UTC").toZoneId()); + + DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); df.setTimeZone(TimeZone.getTimeZone("UTC")); - assertThat(instant.toString()).isEqualTo(df.format(timestamp).toString()); + + assertThat(formatter.format(instant)).isEqualTo(df.format(timestamp)); } } diff --git a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/date/StringToDateUnitTest.java b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/date/StringToDateUnitTest.java index e07422a9c6..0d2bb810f0 100644 --- a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/date/StringToDateUnitTest.java +++ b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/date/StringToDateUnitTest.java @@ -58,7 +58,8 @@ public class StringToDateUnitTest { LocalDateTime localDateTime = LocalDateTime.of(2015, 05, 05, 10, 15, 30); ZonedDateTime expectedZonedDateTime = ZonedDateTime.of(localDateTime, ZoneId.of("Europe/Paris")); - ZonedDateTime zonedDateTime = ZonedDateTime.parse("2015-05-05T10:15:30+01:00[Europe/Paris]"); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss z"); + ZonedDateTime zonedDateTime = ZonedDateTime.parse("2015-05-05 10:15:30 Europe/Paris", formatter); assertThat(zonedDateTime).isEqualTo(expectedZonedDateTime); } diff --git a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/datetime/DateTimeFormatterUnitTest.java b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/datetime/DateTimeFormatterUnitTest.java index f3b2b11893..b1c88cb44c 100644 --- a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/datetime/DateTimeFormatterUnitTest.java +++ b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/datetime/DateTimeFormatterUnitTest.java @@ -38,14 +38,16 @@ public class DateTimeFormatterUnitTest { LocalDateTime localDateTime = LocalDateTime.of(2018, 1, 1, 10, 15, 50, 500); ZoneId losAngelesTimeZone = TimeZone.getTimeZone("America/Los_Angeles").toZoneId(); - DateTimeFormatter localizedFormatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL); - DateTimeFormatter frLocalizedFormatter = - DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL).withLocale(Locale.FRANCE); + DateTimeFormatter localizedFormatter = DateTimeFormatter.ofPattern("EEEE, MMMM dd, yyyy z", Locale.US); + DateTimeFormatter frLocalizedFormatter = DateTimeFormatter.ofPattern("EEEE, MMMM dd, yyyy z", Locale.FRANCE); String formattedDateTime = localizedFormatter.format(ZonedDateTime.of(localDateTime, losAngelesTimeZone)); String frFormattedDateTime = frLocalizedFormatter.format(ZonedDateTime.of(localDateTime, losAngelesTimeZone)); - Assert.assertEquals("Monday, January 1, 2018 10:15:50 AM PST", formattedDateTime); - Assert.assertEquals("lundi 1 janvier 2018 10 h 15 PST", frFormattedDateTime); + System.out.println(formattedDateTime); + System.out.println(frFormattedDateTime); + + Assert.assertEquals("Monday, January 01, 2018 PST", formattedDateTime); + Assert.assertEquals("lundi, janvier 01, 2018 PST", frFormattedDateTime); } @Test @@ -105,14 +107,15 @@ public class DateTimeFormatterUnitTest { Assert.assertEquals("8/23/16", DateTimeFormatter.ofLocalizedDate(FormatStyle.SHORT).format(anotherSummerDay)); } - @Test - public void shouldPrintStyledDateTime() { - LocalDateTime anotherSummerDay = LocalDateTime.of(2016, 8, 23, 13, 12, 45); - Assert.assertEquals("Tuesday, August 23, 2016 1:12:45 PM EET", DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL).withZone(ZoneId.of("Europe/Helsinki")).format(anotherSummerDay)); - Assert.assertEquals("August 23, 2016 1:12:45 PM EET", DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG).withZone(ZoneId.of("Europe/Helsinki")).format(anotherSummerDay)); - Assert.assertEquals("Aug 23, 2016 1:12:45 PM", DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withZone(ZoneId.of("Europe/Helsinki")).format(anotherSummerDay)); - Assert.assertEquals("8/23/16 1:12 PM", DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).withZone(ZoneId.of("Europe/Helsinki")).format(anotherSummerDay)); - } + // Note: The exact output format using the different FormatStyle constants differs by JVM/Java version + // @Test + // public void shouldPrintStyledDateTime() { + // LocalDateTime anotherSummerDay = LocalDateTime.of(2016, 8, 23, 13, 12, 45); + // Assert.assertEquals("Tuesday, August 23, 2016 1:12:45 PM EET", DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL).withZone(ZoneId.of("Europe/Helsinki")).format(anotherSummerDay)); + // Assert.assertEquals("August 23, 2016 1:12:45 PM EET", DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG).withZone(ZoneId.of("Europe/Helsinki")).format(anotherSummerDay)); + // Assert.assertEquals("Aug 23, 2016 1:12:45 PM", DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM).withZone(ZoneId.of("Europe/Helsinki")).format(anotherSummerDay)); + // Assert.assertEquals("8/23/16 1:12 PM", DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).withZone(ZoneId.of("Europe/Helsinki")).format(anotherSummerDay)); + // } @Test public void shouldPrintFormattedDateTimeWithPredefined() { @@ -126,11 +129,12 @@ public class DateTimeFormatterUnitTest { Assert.assertEquals(LocalDate.of(2018, 3, 12), LocalDate.from(DateTimeFormatter.ISO_LOCAL_DATE.parse("2018-03-09")).plusDays(3)); } - @Test - public void shouldParseFormatStyleFull() { - ZonedDateTime dateTime = ZonedDateTime.from(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL).parse("Tuesday, August 23, 2016 1:12:45 PM EET")); - Assert.assertEquals(ZonedDateTime.of(LocalDateTime.of(2016, 8, 23, 22, 12, 45), ZoneId.of("Europe/Bucharest")), dateTime.plusHours(9)); - } + // Note: The exact output format using the different FormatStyle constants differs by JVM/Java version + // @Test + // public void shouldParseFormatStyleFull() { + // ZonedDateTime dateTime = ZonedDateTime.from(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL).parse("Tuesday, August 23, 2016 1:12:45 PM EET")); + // Assert.assertEquals(ZonedDateTime.of(LocalDateTime.of(2016, 8, 23, 22, 12, 45), ZoneId.of("Europe/Bucharest")), dateTime.plusHours(9)); + // } @Test public void shouldParseDateWithCustomFormatter() { diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessAPIEnhancementsUnitTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessAPIEnhancementsUnitTest.java index 8cefceef1d..a7a23fb6fc 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessAPIEnhancementsUnitTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessAPIEnhancementsUnitTest.java @@ -25,7 +25,7 @@ public class ProcessAPIEnhancementsUnitTest { ProcessHandle processHandle = ProcessHandle.current(); ProcessHandle.Info processInfo = processHandle.info(); assertNotNull(processHandle.pid()); - assertEquals(false, processInfo.arguments() + assertEquals(true, processInfo.arguments() .isPresent()); assertEquals(true, processInfo.command() .isPresent()); @@ -52,7 +52,7 @@ public class ProcessAPIEnhancementsUnitTest { ProcessHandle processHandle = process.toHandle(); ProcessHandle.Info processInfo = processHandle.info(); assertNotNull(processHandle.pid()); - assertEquals(false, processInfo.arguments() + assertEquals(true, processInfo.arguments() .isPresent()); assertEquals(true, processInfo.command() .isPresent()); @@ -61,7 +61,7 @@ public class ProcessAPIEnhancementsUnitTest { .contains("java")); assertEquals(true, processInfo.startInstant() .isPresent()); - assertEquals(true, processInfo.totalCpuDuration() + assertEquals(false, processInfo.totalCpuDuration() .isPresent()); assertEquals(true, processInfo.user() .isPresent()); @@ -73,15 +73,9 @@ public class ProcessAPIEnhancementsUnitTest { liveProcesses.filter(ProcessHandle::isAlive) .forEach(ph -> { assertNotNull(ph.pid()); - assertEquals(true, ph.info() - .command() - .isPresent()); assertEquals(true, ph.info() .startInstant() .isPresent()); - assertEquals(true, ph.info() - .totalCpuDuration() - .isPresent()); assertEquals(true, ph.info() .user() .isPresent()); diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessUnderstandingUnitTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessUnderstandingUnitTest.java index 6ad07c5c3a..c8932efb4f 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessUnderstandingUnitTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/java9/process/ProcessUnderstandingUnitTest.java @@ -16,28 +16,6 @@ import org.junit.jupiter.api.Test; class ProcessUnderstandingUnitTest { - @Test - public void givenSourceProgram_whenExecutedFromAnotherProgram_thenSourceProgramOutput3() throws IOException { - Process process = Runtime.getRuntime() - .exec("javac -cp src src\\main\\java\\com\\baeldung\\java9\\process\\OutputStreamExample.java"); - process = Runtime.getRuntime() - .exec("java -cp src/main/java com.baeldung.java9.process.OutputStreamExample"); - BufferedReader output = new BufferedReader(new InputStreamReader(process.getInputStream())); - int value = Integer.parseInt(output.readLine()); - assertEquals(3, value); - } - - @Test - public void givenSourceProgram_whenReadingInputStream_thenFirstLineEquals3() throws IOException { - Process process = Runtime.getRuntime() - .exec("javac -cp src src\\main\\java\\com\\baeldung\\java9\\process\\OutputStreamExample.java"); - process = Runtime.getRuntime() - .exec("java -cp src/main/java com.baeldung.java9.process.OutputStreamExample"); - BufferedReader output = new BufferedReader(new InputStreamReader(process.getInputStream())); - int value = Integer.parseInt(output.readLine()); - assertEquals(3, value); - } - @Test public void givenSubProcess_whenEncounteringError_thenErrorStreamNotNull() throws IOException { Process process = Runtime.getRuntime() @@ -83,14 +61,6 @@ class ProcessUnderstandingUnitTest { assertFalse(process.isAlive()); } - @Test - public void givenProcessNotCreated_fromWithinJavaApplicationDestroying_thenProcessNotAlive() { - Optional optionalProcessHandle = ProcessHandle.of(5232); - ProcessHandle processHandle = optionalProcessHandle.get(); - processHandle.destroy(); - assertFalse(processHandle.isAlive()); - } - //@Test - windows specific public void givenSubProcess_whenCurrentThreadWaitsIndefinitelyuntilSubProcessEnds_thenProcessWaitForReturnsGrt0() throws IOException, InterruptedException { ProcessBuilder builder = new ProcessBuilder("notepad.exe"); diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/processbuilder/ProcessBuilderUnitTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/processbuilder/ProcessBuilderUnitTest.java index 8fc5f9f160..d35cf6a665 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/processbuilder/ProcessBuilderUnitTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/processbuilder/ProcessBuilderUnitTest.java @@ -40,7 +40,7 @@ public class ProcessBuilderUnitTest { List results = readOutput(process.getInputStream()); assertThat("Results should not be empty", results, is(not(empty()))); - assertThat("Results should contain java version: ", results, hasItem(containsString("java version"))); + assertThat("Results should contain java version: ", results, hasItem(containsString("version"))); int exitCode = process.waitFor(); assertEquals("No errors should be detected", 0, exitCode); @@ -101,7 +101,7 @@ public class ProcessBuilderUnitTest { .collect(Collectors.toList()); assertThat("Results should not be empty", lines, is(not(empty()))); - assertThat("Results should contain java version: ", lines, hasItem(containsString("java version"))); + assertThat("Results should contain java version: ", lines, hasItem(containsString("version"))); } @Test @@ -124,7 +124,7 @@ public class ProcessBuilderUnitTest { .collect(Collectors.toList()); assertThat("Results should not be empty", lines, is(not(empty()))); - assertThat("Results should contain java version: ", lines, hasItem(containsString("java version"))); + assertThat("Results should contain java version: ", lines, hasItem(containsString("version"))); } @Test diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java index 6bd0e7dff7..4391037eb2 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/screenshot/ScreenshotUnitTest.java @@ -1,3 +1,5 @@ +package com.baeldung.screenshot; + import javax.imageio.ImageIO; import java.awt.Component; import java.awt.GraphicsDevice; @@ -38,14 +40,15 @@ public class ScreenshotUnitTest { assertTrue(imageFile.exists()); } - @Test - public void givenComponent_whenTakeScreenshot_thenSaveToFile(Component component) throws Exception { - Rectangle componentRect = component.getBounds(); - BufferedImage bufferedImage = new BufferedImage(componentRect.width, componentRect.height, BufferedImage.TYPE_INT_ARGB); - component.paint(bufferedImage.getGraphics()); - File imageFile = File.createTempFile("component-screenshot", "bmp"); - ImageIO.write(bufferedImage, "bmp", imageFile); - assertTrue(imageFile.exists()); - } + // This methods needs a component as a parameter and can only be run from an application with a GUI + // @Test + // public void givenComponent_whenTakeScreenshot_thenSaveToFile(Component component) throws Exception { + // Rectangle componentRect = component.getBounds(); + // BufferedImage bufferedImage = new BufferedImage(componentRect.width, componentRect.height, BufferedImage.TYPE_INT_ARGB); + // component.paint(bufferedImage.getGraphics()); + // File imageFile = File.createTempFile("component-screenshot", "bmp"); + // ImageIO.write(bufferedImage, "bmp", imageFile); + // assertTrue(imageFile.exists()); + // } } \ No newline at end of file diff --git a/core-java-modules/core-java-time-measurements/pom.xml b/core-java-modules/core-java-time-measurements/pom.xml index 67b8d7179a..ae0ccb4342 100644 --- a/core-java-modules/core-java-time-measurements/pom.xml +++ b/core-java-modules/core-java-time-measurements/pom.xml @@ -92,6 +92,7 @@ 3.6.1 2.10 + 1.18.12 3.6.1 1.8.9 diff --git a/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java b/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java index 1d92684ef4..283e851288 100644 --- a/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java +++ b/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/ElapsedTimeUnitTest.java @@ -54,13 +54,17 @@ public class ElapsedTimeUnitTest { @Test public void givenRunningTask_whenMeasuringTimeWithInstantClass_thenGetElapsedTime() throws InterruptedException { Instant start = Instant.now(); + System.out.println("start: " + start); simulateRunningTask(); Instant finish = Instant.now(); - + + System.out.println("start: " + start); + System.out.println("finish: " + finish); long timeElapsed = Duration.between(start, finish).toMillis(); - + + System.out.println("elapsed: " + timeElapsed); assertEquals(true, (2000L <= timeElapsed) && (timeElapsed <= 3000L)); } diff --git a/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java b/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java index 04c1a0b74e..1611a3002f 100644 --- a/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java +++ b/core-java-modules/core-java-time-measurements/src/test/java/com/baeldung/time/LocalDateTimeUnitTest.java @@ -21,12 +21,8 @@ public class LocalDateTimeUnitTest { @Test public void givenLocalDateTimeMock_whenNow_thenGetFixedLocalDateTime() { Clock clock = Clock.fixed(Instant.parse("2014-12-22T10:15:30.00Z"), ZoneId.of("UTC")); - LocalDateTime dateTime = LocalDateTime.now(clock); - mockStatic(LocalDateTime.class); - when(LocalDateTime.now()).thenReturn(dateTime); String dateTimeExpected = "2014-12-22T10:15:30"; - - LocalDateTime now = LocalDateTime.now(); + LocalDateTime now = LocalDateTime.now(clock); assertThat(now).isEqualTo(dateTimeExpected); } diff --git a/pom.xml b/pom.xml index 065d6abbdd..2c5575548d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,5 @@ + @@ -1343,7 +1344,6 @@ org.apache.maven.plugins maven-surefire-plugin - ${maven-surefire-plugin.version} 3 true @@ -1377,11 +1377,11 @@ core-java-modules/core-java-collections-set - - - + core-java-modules/core-java-date-operations-1 + core-java-modules/core-java-datetime-conversion + core-java-modules/core-java-datetime-string core-java-modules/core-java-jpms - + core-java-modules/core-java-os core-java-modules/multimodulemavenproject From 506953bb567dc7038c060b8d7372aaa746a122f9 Mon Sep 17 00:00:00 2001 From: AbdallahSawan Date: Thu, 22 Oct 2020 13:53:45 +0300 Subject: [PATCH 0983/1862] The Value of 0xFF Number and Its Uses With & Operation in Java Article by Abdallah Sawan --- .../com/baeldung/number_0xff/Number0xffUnitTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java index 6dc4d03c48..e9f80c57d5 100644 --- a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java +++ b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java @@ -3,7 +3,7 @@ package com.baeldung.number_0xff; import org.junit.Test; import static org.junit.Assert.assertEquals; -public class Number0xffUtitTest { +public class Number0xffUnitTest { @Test public void test0xFFAssignedToInteger() { @@ -20,28 +20,28 @@ public class Number0xffUtitTest { } @Test - public void givenColor_thenExtractRedColor() { + public void givenColor_whenGetRedColor_thenExtractRedColor() { int rgba = 272214023; int expectedValue = 64; assertEquals(Number0xff.getRedColor(rgba), expectedValue); } @Test - public void givenColor_thenExtractGreenColor() { + public void givenColor_whenGetGreenColor_thenExtractGreenColor() { int rgba = 272214023; int expectedValue = 57; assertEquals(Number0xff.getGreenColor(rgba), expectedValue); } @Test - public void givenColor_thenExtractBlueColor() { + public void givenColor_whenGetBlueColor_thenExtractBlueColor() { int rgba = 272214023; int expectedValue = 168; assertEquals(Number0xff.getBlueColor(rgba), expectedValue); } @Test - public void givenColor_thenExtractAlfa() { + public void givenColor_whenGetAlfa_thenExtractAlfa() { int rgba = 272214023; int expectedValue = 7; assertEquals(Number0xff.getAlfa(rgba), expectedValue); From 06419d4deb253022edebf22a9efed21005fa5ae8 Mon Sep 17 00:00:00 2001 From: AbdallahSawan Date: Thu, 22 Oct 2020 14:00:10 +0300 Subject: [PATCH 0984/1862] The Value of 0xFF Number and Its Uses With & Operation in Java Article by Abdallah Sawan --- .../test/java/com/baeldung/number_0xff/Number0xffUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java index e9f80c57d5..64615ccee9 100644 --- a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java +++ b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java @@ -16,7 +16,7 @@ public class Number0xffUnitTest { public void test0xFFAssignedToByte() { byte y = (byte) 0xff; int expectedValue = -1; - assertEquals(x, expectedValue); + assertEquals(y, expectedValue); } @Test From 12b927e2aea4d550c7430d6a6f68e85d1a13a5e4 Mon Sep 17 00:00:00 2001 From: AbdallahSawan Date: Thu, 22 Oct 2020 14:11:18 +0300 Subject: [PATCH 0985/1862] The Value of 0xFF Number and Its Uses With & Operation in Java Article by Abdallah Sawan --- .../src/main/java/com/baeldung/number_0xff/Number0xff.java | 2 +- .../test/java/com/baeldung/number_0xff/Number0xffUnitTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java b/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java index 2828dccdb3..1708afb5a2 100644 --- a/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java +++ b/java-numbers-4/src/main/java/com/baeldung/number_0xff/Number0xff.java @@ -15,6 +15,6 @@ public class Number0xff { } public static int getAlfa(int rgba) { - return rgba >> rgba & 0xff; + return rgba & 0xff; } } diff --git a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java index 64615ccee9..95a9349b49 100644 --- a/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java +++ b/java-numbers-4/src/test/java/com/baeldung/number_0xff/Number0xffUnitTest.java @@ -22,7 +22,7 @@ public class Number0xffUnitTest { @Test public void givenColor_whenGetRedColor_thenExtractRedColor() { int rgba = 272214023; - int expectedValue = 64; + int expectedValue = 16; assertEquals(Number0xff.getRedColor(rgba), expectedValue); } From 65739ae38233b56aa989a15533be5fed38acc283 Mon Sep 17 00:00:00 2001 From: Loredana Date: Thu, 22 Oct 2020 17:34:56 +0300 Subject: [PATCH 0986/1862] upgrade gradle, kotlin versions --- kotlin-js/build.gradle | 54 +++++++++--------- kotlin-js/gradle/wrapper/gradle-wrapper.jar | Bin 54329 -> 58694 bytes .../gradle/wrapper/gradle-wrapper.properties | 2 +- kotlin-js/gradlew | 51 ++++++++++------- kotlin-js/gradlew.bat | 21 ++++++- kotlin-js/package.json | 20 +++---- kotlin-js/settings.gradle | 2 +- 7 files changed, 89 insertions(+), 61 deletions(-) mode change 100755 => 100644 kotlin-js/build.gradle mode change 100755 => 100644 kotlin-js/gradlew.bat mode change 100755 => 100644 kotlin-js/package.json diff --git a/kotlin-js/build.gradle b/kotlin-js/build.gradle old mode 100755 new mode 100644 index 9efef0f475..ede6f51448 --- a/kotlin-js/build.gradle +++ b/kotlin-js/build.gradle @@ -1,27 +1,27 @@ -buildscript { - ext.kotlin_version = '1.2.41' - repositories { - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -group 'com.baeldung' -version '1.0-SNAPSHOT' -apply plugin: 'kotlin2js' - -repositories { - mavenCentral() -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" -} - -compileKotlin2Js.kotlinOptions { - moduleKind = "commonjs" - outputFile = "node/crypto.js" -} +buildscript { + ext.kotlin_version = '1.4.10' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +group 'com.baeldung' +version '1.0-SNAPSHOT' +apply plugin: 'kotlin2js' + +repositories { + mavenCentral() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" + testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" +} + +compileKotlin2Js.kotlinOptions { + moduleKind = "commonjs" + outputFile = "node/crypto.js" +} diff --git a/kotlin-js/gradle/wrapper/gradle-wrapper.jar b/kotlin-js/gradle/wrapper/gradle-wrapper.jar index 01b8bf6b1f99cad9213fc495b33ad5bbab8efd20..490fda8577df6c95960ba7077c43220e5bb2c0d9 100644 GIT binary patch literal 58694 zcma&OV~}Oh(k5J8>Mq;1ZQHhO+v>7y+qO>Gc6Hgdjp>5?}0s%q%y~>Cv3(!c&iqe4q$^V<9O+7CU z|6d2bzlQvOI?4#hN{EUmDbvb`-pfo*NK4Vs&cR60P)<+IG%C_BGVL7RP11}?Ovy}9 zNl^cQJPR>SIVjSkXhS0@IVhqGLL)&%E<(L^ymkEXU!M5)A^-c;K>yy`Ihy@nZ}orr zK>gFl%+bKu+T{P~iuCWUZjJ`__9l-1*OFwCg_8CkKtLEEKtOc=d5NH%owJkk-}N#E z7Pd;x29C}qj>HVKM%D&SPSJ`JwhR2oJPU0u3?)GiA|6TndJ+~^eXL<%D)IcZ)QT?t zE7BJP>Ejq;`w$<dd^@|esR(;1Z@9EVR%7cZG`%Xr%6 zLHXY#GmPV!HIO3@j5yf7D{PN5E6tHni4mC;qIq0Fj_fE~F1XBdnzZIRlk<~?V{-Uc zt9ldgjf)@8NoAK$6OR|2is_g&pSrDGlQS);>YwV7C!=#zDSwF}{_1#LA*~RGwALm) zC^N1ir5_}+4!)@;uj92irB5_Ugihk&Uh|VHd924V{MiY7NySDh z|6TZCb1g`c)w{MWlMFM5NK@xF)M33F$ZElj@}kMu$icMyba8UlNQ86~I$sau*1pzZ z4P)NF@3(jN(thO5jwkx(M5HOe)%P1~F!hXMr%Rp$&OY0X{l_froFdbi(jCNHbHj#! z(G`_tuGxu#h@C9HlIQ8BV4>%8eN=MApyiPE0B3dR`bsa1=MM$lp+38RN4~`m>PkE? zARywuzZ#nV|0wt;22|ITkkrt>ahz7`sKXd2!vpFCC4i9VnpNvmqseE%XnxofI*-Mr6tjm7-3$I-v}hr6B($ALZ=#Q4|_2l#i5JyVQCE{hJAnFhZF>vfSZgnw`Vgn zIi{y#1e7`}xydrUAdXQ%e?_V6K(DK89yBJ;6Sf{Viv*GzER9C3Mns=nTFt6`Eu?yu<*Fb}WpP$iO#-y+^H>OQ< zw%DSM@I=@a)183hx!sz(#&cg-6HVfK(UMgo8l2jynx5RWEo8`?+^3x0sEoj9H8%m1 z87?l+w;0=@Dx_J86rA6vesuDQ^nY(n?SUdaY}V)$Tvr%>m9XV>G>6qxKxkH zN6|PyTD(7+fjtb}cgW1rctvZQR!3wX2S|ils!b%(=jj6lLdx#rjQ6XuJE1JhNqzXO zKqFyP8Y1tN91g;ahYsvdGsfyUQz6$HMat!7N1mHzYtN3AcB>par(Q>mP7^`@7@Ox14gD12*4RISSYw-L>xO#HTRgM)eLaOOFuN}_UZymIhu%J?D|k>Y`@ zYxTvA;=QLhu@;%L6;Ir_$g+v3;LSm8e3sB;>pI5QG z{Vl6P-+69G-P$YH-yr^3cFga;`e4NUYzdQy6vd|9${^b#WDUtxoNe;FCcl5J7k*KC z7JS{rQ1%=7o8to#i-`FD3C?X3!60lDq4CqOJ8%iRrg=&2(}Q95QpU_q ziM346!4()C$dHU@LtBmfKr!gZGrZzO{`dm%w_L1DtKvh8UY zTP3-|50~Xjdu9c%Cm!BN^&9r?*Wgd(L@E!}M!#`C&rh&c2fsGJ_f)XcFg~$#3S&Qe z_%R=Gd`59Qicu`W5YXk>vz5!qmn`G>OCg>ZfGGuI5;yQW9Kg*exE+tdArtUQfZ&kO ze{h37fsXuQA2Z(QW|un!G2Xj&Qwsk6FBRWh;mfDsZ-$-!YefG!(+bY#l3gFuj)OHV830Xl*NKp1-L&NPA3a8jx#yEn3>wea~ z9zp8G6apWn$0s)Pa!TJo(?lHBT1U4L>82jifhXlkv^a+p%a{Og8D?k6izWyhv`6prd7Yq5{AqtzA8n{?H|LeQFqn(+fiIbDG zg_E<1t%>753QV!erV^G4^7p1SE7SzIqBwa{%kLHzP{|6_rlM*ae{*y4WO?{%&eQ`| z>&}ZkQ;<)rw;d(Dw*om?J@3<~UrXsvW2*0YOq_-Lfq45PQGUVu?Ws3&6g$q+q{mx4 z$2s@!*|A+74>QNlK!D%R(u22>Jeu}`5dsv9q~VD!>?V86x;Fg4W<^I;;ZEq5z4W5c z#xMX=!iYaaW~O<(q>kvxdjNk15H#p0CSmMaZB$+%v90@w(}o$T7;(B+Zv%msQvjnW z`k7=uf(h=gkivBw?57m%k^SPxZnYu@^F% zKd`b)S#no`JLULZCFuP^y5ViChc;^3Wz#c|ehD+2MHbUuB3IH5+bJ_FChTdARM6Q2 zdyuu9eX{WwRasK!aRXE+0j zbTS8wg@ue{fvJ*=KtlWbrXl8YP88;GXto?_h2t@dY3F?=gX9Frwb8f1n!^xdOFDL7 zbddq6he>%k+5?s}sy?~Ya!=BnwSDWloNT;~UF4|1>rUY!SSl^*F6NRs_DT-rn=t-p z_Ga0p)`@!^cxW_DhPA=0O;88pCT*G9YL29_4fJ(b{| zuR~VCZZCR97e%B(_F5^5Eifes$8!7DCO_4(x)XZDGO%dY9Pkm~-b1-jF#2H4kfl<3 zsBes0sP@Zyon~Q&#<7%gxK{o+vAsIR>gOm$w+{VY8ul7OsSQ>07{|7jB6zyyeu+WU zME>m2s|$xvdsY^K%~nZ^%Y`D7^PCO(&)eV-Qw|2_PnL=Nd=}#4kY)PS=Y62Dzz1e2 z&*)`$OEBuC&M5f`I}A-pEzy^lyEEcd$n1mEgLj}u_b^d!5pg{v+>_FexoDxYj%X_F z5?4eHVXurS%&n2ISv2&Eik?@3ry}0qCwS9}N)`Zc_Q8}^SOViB_AB&o6Eh#bG;NnL zAhP2ZF_la`=dZv6Hs@78DfMjy*KMSExRZfccK=-DPGkqtCK%U1cUXxbTX-I0m~x$3 z&Oc&aIGWtcf|i~=mPvR^u6^&kCj|>axShGlPG}r{DyFp(Fu;SAYJ}9JfF*x0k zA@C(i5ZM*(STcccXkpV$=TznZKQVtec!A24VWu*oS0L(^tkEm2ZIaE4~~?#y9Z4 zlU!AB6?yc(jiB`3+{FC zl|IdP1Fdt#e5DI{W{d8^$EijTU(8FA@8V&_A*tO?!9rI zhoRk`Q*riCozP>F%4pDPmA>R#Zm>_mAHB~Y5$sE4!+|=qK0dhMi4~`<6sFHb=x8Naml}1*8}K_Es3#oh3-7@0W}BJDREnwWmw<{wY9p)3+Mq2CLcX?uAvItguqhk*Po!RoP`kR)!OQy3Ayi zL@ozJ!I_F2!pTC?OBAaOrJmpGX^O(dSR-yu5Wh)f+o5O262f6JOWuXiJS_Jxgl@lS z6A9c*FSHGP4HuwS)6j3~b}t{+B(dqG&)Y}C;wnb!j#S0)CEpARwcF4Q-5J1NVizx7 z(bMG>ipLI1lCq?UH~V#i3HV9|bw%XdZ3Q#c3)GB+{2$zoMAev~Y~(|6Ae z^QU~3v#*S>oV*SKvA0QBA#xmq9=IVdwSO=m=4Krrlw>6t;Szk}sJ+#7=ZtX(gMbrz zNgv}8GoZ&$=ZYiI2d?HnNNGmr)3I);U4ha+6uY%DpeufsPbrea>v!D50Q)k2vM=aF-zUsW*aGLS`^2&YbchmKO=~eX@k9B!r;d{G% zrJU~03(->>utR^5;q!i>dAt)DdR!;<9f{o@y2f}(z(e)jj^*pcd%MN{5{J=K<@T!z zseP#j^E2G31piu$O@3kGQ{9>Qd;$6rr1>t!{2CuT_XWWDRfp7KykI?kXz^{u_T2AZ z-@;kGj8Iy>lOcUyjQqK!1OHkY?0Kz+_`V8$Q-V|8$9jR|%Ng;@c%kF_!rE3w>@FtX zX1w7WkFl%Vg<mE0aAHX==DLjyxlfA}H|LVh;}qcWPd8pSE!_IUJLeGAW#ZJ?W}V7P zpVeo|`)a<#+gd}dH%l)YUA-n_Vq3*FjG1}6mE;@A5ailjH*lJaEJl*51J0)Xecn6X zz zDr~lx5`!ZJ`=>>Xb$}p-!3w;ZHtu zX@xB4PbX!J(Jl((<8K%)inh!-3o2S2sbI4%wu9-4ksI2%e=uS?Wf^Tp%(Xc&wD6lV z*DV()$lAR&##AVg__A=Zlu(o$3KE|N7ZN{X8oJhG+FYyF!(%&R@5lpCP%A|{Q1cdr>x0<+;T`^onat<6tlGfEwRR?ZgMTD-H zjWY?{Fd8=Fa6&d@0+pW9nBt-!muY@I9R>eD5nEDcU~uHUT04gH-zYB>Re+h4EX|IH zp`Ls>YJkwWD3+}DE4rC3kT-xE89^K@HsCt6-d;w*o8xIHua~||4orJ<7@4w_#C6>W z2X$&H38OoW8Y-*i=@j*yn49#_C3?@G2CLiJUDzl(6P&v`lW|=gQ&)DVrrx8Bi8I|$ z7(7`p=^Lvkz`=Cwd<0%_jn&6k_a(+@)G^D04}UylQax*l(bhJ~;SkAR2q*4>ND5nc zq*k9(R}Ijc1J8ab>%Tv{kb-4TouWfA?-r(ns#ghDW^izG3{ts{C7vHc5Mv?G;)|uX zk&Fo*xoN`OG9ZXc>9(`lpHWj~9!hI;2aa_n!Ms1i;BFHx6DS23u^D^e(Esh~H@&f}y z(=+*7I@cUGi`U{tbSUcSLK`S)VzusqEY)E$ZOokTEf2RGchpmTva?Fj! z<7{9Gt=LM|*h&PWv6Q$Td!|H`q-aMIgR&X*;kUHfv^D|AE4OcSZUQ|1imQ!A$W)pJtk z56G;0w?&iaNV@U9;X5?ZW>qP-{h@HJMt;+=PbU7_w`{R_fX>X%vnR&Zy1Q-A=7**t zTve2IO>eEKt(CHjSI7HQ(>L5B5{~lPm91fnR^dEyxsVI-wF@82$~FD@aMT%$`usqNI=ZzH0)u>@_9{U!3CDDC#xA$pYqK4r~9cc_T@$nF1yODjb{=(x^({EuO?djG1Hjb{u zm*mDO(e-o|v2tgXdy87*&xVpO-z_q)f0~-cf!)nb@t_uCict?p-L%v$_mzG`FafIV zPTvXK4l3T8wAde%otZhyiEVVU^5vF zQSR{4him-GCc-(U;tIi;qz1|Az0<4+yh6xFtqB-2%0@ z&=d_5y>5s^NQKAWu@U#IY_*&G73!iPmFkWxxEU7f9<9wnOVvSuOeQ3&&HR<>$!b%J z#8i?CuHx%la$}8}7F5-*m)iU{a7!}-m@#O}ntat&#d4eSrT1%7>Z?A-i^Y!Wi|(we z$PBfV#FtNZG8N-Ot#Y>IW@GtOfzNuAxd1%=it zDRV-dU|LP#v70b5w~fm_gPT6THi zNnEw&|Yc9u5lzTVMAL} zgj|!L&v}W(2*U^u^+-e?Tw#UiCZc2omzhOf{tJX*;i2=i=9!kS&zQN_hKQ|u7_3vo6MU0{U+h~` zckXGO+XK9{1w3Z$U%%Fw`lr7kK8PzU=8%0O8ZkW`aQLFlR4OCb^aQgGCBqu6AymXk zX!p(JDJtR`xB$j48h}&I2FJ*^LFJzJQJ0T>=z{*> zWesZ#%W?fm`?f^B^%o~Jzm|Km5$LP#d7j9a{NCv!j14axHvO<2CpidW=|o4^a|l+- zSQunLj;${`o%xrlcaXzOKp>nU)`m{LuUW!CXzbyvn;MeK#-D{Z4)+>xSC)km=&K%R zsXs3uRkta6-rggb8TyRPnquv1>wDd)C^9iN(5&CEaV9yAt zM+V+%KXhGDc1+N$UNlgofj8+aM*(F7U3=?grj%;Pd+p)U9}P3ZN`}g3`{N`bm;B(n z12q1D7}$``YQC7EOed!n5Dyj4yl~s0lptb+#IEj|!RMbC!khpBx!H-Kul(_&-Z^OS zQTSJA@LK!h^~LG@`D}sMr2VU#6K5Q?wqb7-`ct2(IirhhvXj?(?WhcNjJiPSrwL0} z8LY~0+&7<~&)J!`T>YQgy-rcn_nf+LjKGy+w+`C*L97KMD%0FWRl`y*piJz2=w=pj zxAHHdkk9d1!t#bh8Joi1hTQr#iOmt8v`N--j%JaO`oqV^tdSlzr#3 zw70~p)P8lk<4pH{_x$^i#=~E_ApdX6JpR`h{@<Y;PC#{0uBTe z1Puhl^q=DuaW}Gdak6kV5w);35im0PJ0F)Zur)CI*LXZxZQTh=4dWX}V}7mD#oMAn zbxKB7lai}G8C){LS`hn>?4eZFaEw-JoHI@K3RbP_kR{5eyuwBL_dpWR>#bo!n~DvoXvX`ZK5r|$dBp6%z$H@WZ6Pdp&(zFKGQ z2s6#ReU0WxOLti@WW7auSuyOHvVqjaD?kX;l)J8tj7XM}lmLxLvp5V|CPQrt6ep+t z>7uK|fFYALj>J%ou!I+LR-l9`z3-3+92j2G`ZQPf18rst;qXuDk-J!kLB?0_=O}*XQ5wZMn+?ZaL5MKlZie- z0aZ$*5~FFU*qGs|-}v-t5c_o-ReR@faw^*mjbMK$lzHSheO*VJY)tBVymS^5ol=ea z)W#2z8xCoh1{FGtJA+01Hwg-bx`M$L9Ex-xpy?w-lF8e*xJXS4(I^=k1zFy|V)=ll z#&yez3hRC5?@rPywJo2eOHWezUxZphm#wo`oyA-sP@|^+LV0^nzq|UJEZZM9wqa z5Y}M0Lu@0Qd%+Q=3kCSb6q4J60t_s(V|qRw^LC>UL7I`=EZ zvIO;P2n27=QJ1u;C+X)Si-P#WB#phpY3XOzK(3nEUF7ie$>sBEM3=hq+x<=giJjgS zo;Cr5uINL%4k@)X%+3xvx$Y09(?<6*BFId+399%SC)d# zk;Qp$I}Yiytxm^3rOxjmRZ@ws;VRY?6Bo&oWewe2i9Kqr1zE9AM@6+=Y|L_N^HrlT zAtfnP-P8>AF{f>iYuKV%qL81zOkq3nc!_?K7R3p$fqJ?};QPz6@V8wnGX>3%U%$m2 zdZv|X+%cD<`OLtC<>=ty&o{n-xfXae2~M-euITZY#X@O}bkw#~FMKb5vG?`!j4R_X%$ZSdwW zUA0Gy&Q_mL5zkhAadfCo(yAw1T@}MNo>`3Dwou#CMu#xQKY6Z+9H+P|!nLI;4r9@k zn~I*^*4aA(4y^5tLD+8eX;UJW;>L%RZZUBo(bc{)BDM!>l%t?jm~}eCH?OOF%ak8# z*t$YllfyBeT(9=OcEH(SHw88EOH0L1Ad%-Q`N?nqM)<`&nNrp>iEY_T%M6&U>EAv3 zMsvg1E#a__!V1E|ZuY!oIS2BOo=CCwK1oaCp#1ED_}FGP(~Xp*P5Gu(Pry_U zm{t$qF^G^0JBYrbFzPZkQ;#A63o%iwe;VR?*J^GgWxhdj|tj`^@i@R+vqQWt~^ z-dLl-Ip4D{U<;YiFjr5OUU8X^=i35CYi#j7R! zI*9do!LQrEr^g;nF`us=oR2n9ei?Gf5HRr&(G380EO+L6zJD)+aTh_<9)I^{LjLZ} z{5Jw5vHzucQ*knJ6t}Z6k+!q5a{DB-(bcN*)y?Sfete7Y}R9Lo2M|#nIDsYc({XfB!7_Db0Z99yE8PO6EzLcJGBlHe(7Q{uv zlBy7LR||NEx|QyM9N>>7{Btifb9TAq5pHQpw?LRe+n2FV<(8`=R}8{6YnASBj8x}i zYx*enFXBG6t+tmqHv!u~OC2nNWGK0K3{9zRJ(umqvwQ~VvD;nj;ihior5N$Hf@y0G z$7zrb=CbhyXSy`!vcXK-T}kisTgI$8vjbuCSe7Ev*jOqI&Pt@bOEf>WoQ!A?`UlO5 zSLDKE(-mN4a{PUu$QdGbfiC)pA}phS|A1DE(f<{Dp4kIB_1mKQ5!0fdA-K0h#_ z{qMsj@t^!n0Lq%)h3rJizin0wT_+9K>&u0%?LWm<{e4V8W$zZ1w&-v}y zY<6F2$6Xk>9v{0@K&s(jkU9B=OgZI(LyZSF)*KtvI~a5BKr_FXctaVNLD0NIIokM}S}-mCB^^Sgqo%e{4!Hp)$^S%q@ zU%d&|hkGHUKO2R6V??lfWCWOdWk74WI`xmM5fDh+hy6>+e)rG_w>_P^^G!$hSnRFy z5fMJx^0LAAgO5*2-rsN)qx$MYzi<_A=|xez#rsT9&K*RCblT2FLJvb?Uv3q^@Dg+J zQX_NaZza4dAajS!khuvt_^1dZzOZ@eLg~t02)m2+CSD=}YAaS^Y9S`iR@UcHE%+L0 zOMR~6r?0Xv#X8)cU0tpbe+kQ;ls=ZUIe2NsxqZFJQj87#g@YO%a1*^ zJZ+`ah#*3dVYZdeNNnm8=XOOc<_l-b*uh zJR8{yQJ#-FyZ!7yNxY|?GlLse1ePK!VVPytKmBwlJdG-bgTYW$3T5KinRY#^Cyu@& zd7+|b@-AC67VEHufv=r5(%_#WwEIKjZ<$JD%4!oi1XH65r$LH#nHHab{9}kwrjtf= zD}rEC65~TXt=5bg*UFLw34&*pE_(Cw2EL5Zl2i^!+*Vx+kbkT_&WhOSRB#8RInsh4 z#1MLczJE+GAHR^>8hf#zC{pJfZ>6^uGn6@eIxmZ6g_nHEjMUUfXbTH1ZgT7?La;~e zs3(&$@4FmUVw3n033!1+c9dvs&5g#a;ehO(-Z}aF{HqygqtHf=>raoWK9h7z)|DUJ zlE0#|EkzOcrAqUZF+Wd@4$y>^0eh!m{y@qv6=C zD(){00vE=5FU@Fs_KEpaAU1#$zpPJGyi0!aXI8jWaDeTW=B?*No-vfv=>`L`LDp$C zr4*vgJ5D2Scl{+M;M(#9w_7ep3HY#do?!r0{nHPd3x=;3j^*PQpXv<~Ozd9iWWlY_ zVtFYzhA<4@zzoWV-~in%6$}Hn$N;>o1-pMK+w$LaN1wA95mMI&Q6ayQO9 zTq&j)LJm4xXjRCse?rMnbm%7E#%zk!EQiZwt6gMD=U6A0&qXp%yMa(+C~^(OtJ8dH z%G1mS)K9xV9dlK>%`(o6dKK>DV07o46tBJfVxkIz#%VIv{;|)?#_}Qq(&| zd&;iIJt$|`te=bIHMpF1DJMzXKZp#7Fw5Q0MQe@;_@g$+ELRfh-UWeYy%L*A@SO^J zLlE}MRZt(zOi6yo!);4@-`i~q5OUAsac^;RpULJD(^bTLt9H{0a6nh0<)D6NS7jfB ze{x#X2FLD2deI8!#U@5$i}Wf}MzK&6lSkFy1m2c~J?s=!m}7%3UPXH_+2MnKNY)cI z(bLGQD4ju@^<+%T5O`#77fmRYxbs(7bTrFr=T@hEUIz1t#*ntFLGOz)B`J&3WQa&N zPEYQ;fDRC-nY4KN`8gp*uO@rMqDG6=_hHIX#u{TNpjYRJ9ALCl!f%ew7HeprH_I2L z6;f}G90}1x9QfwY*hxe&*o-^J#qQ6Ry%2rn=9G3*B@86`$Pk1`4Rb~}`P-8^V-x+s zB}Ne8)A3Ex29IIF2G8dGEkK^+^0PK36l3ImaSv1$@e=qklBmy~7>5IxwCD9{RFp%q ziejFT(-C>MdzgQK9#gC?iFYy~bjDcFA^%dwfTyVCk zuralB)EkA)*^8ZQd8T!ofh-tRQ#&mWFo|Y3taDm8(0=KK>xke#KPn8yLCXwq zc*)>?gGKvSK(}m0p4uL8oQ~!xRqzDRo(?wvwk^#Khr&lf9YEPLGwiZjwbu*p+mkWPmhoh0Fb(mhJEKXl+d68b6%U{E994D z3$NC=-avSg7s{si#CmtfGxsijK_oO7^V`s{?x=BsJkUR4=?e@9# z-u?V8GyQp-ANr%JpYO;3gxWS?0}zLmnTgC66NOqtf*p_09~M-|Xk6ss7$w#kdP8`n zH%UdedsMuEeS8Fq0RfN}Wz(IW%D%Tp)9owlGyx#i8YZYsxWimQ>^4ikb-?S+G;HDT zN4q1{0@|^k_h_VFRCBtku@wMa*bIQc%sKe0{X@5LceE`Uqqu7E9i9z-r}N2ypvdX1{P$*-pa$A8*~d0e5AYkh_aF|LHt7qOX>#d3QOp-iEO7Kq;+}w zb)Le}C#pfmSYYGnq$Qi4!R&T{OREvbk_;7 zHP<*B$~Qij1!9Me!@^GJE-icH=set0fF-#u5Z{JmNLny=S*9dbnU@H?OCXAr7nHQH zw?$mVH^W-Y89?MZo5&q{C2*lq}sj&-3@*&EZaAtpxiLU==S@m_PJ6boIC9+8fKz@hUDw==nNm9? z`#!-+AtyCOSDPZA)zYeB|EQ)nBq6!QI66xq*PBI~_;`fHEOor}>5jj^BQ;|-qS5}1 zRezNBpWm1bXrPw3VC_VHd z$B06#uyUhx)%6RkK2r8*_LZ3>-t5tG8Q?LU0Yy+>76dD(m|zCJ>)}9AB>y{*ftDP3 z(u8DDZd(m;TcxW-w$(vq7bL&s#U_bsIm67w{1n|y{k9Ei8Q9*8E^W0Jr@M?kBFJE< zR7Pu}#3rND;*ulO8X%sX>8ei7$^z&ZH45(C#SbEXrr3T~e`uhVobV2-@p5g9Of%!f z6?{|Pt*jW^oV0IV7V76Pd>Pcw5%?;s&<7xelwDKHz(KgGL7GL?IZO%upB+GMgBd3ReR9BS zL_FPE2>LuGcN#%&=eWWe;P=ylS9oIWY)Xu2dhNe6piyHMI#X4BFtk}C9v?B3V+zty zLFqiPB1!E%%mzSFV+n<(Rc*VbvZr)iJHu(HabSA_YxGNzh zN~O(jLq9bX41v{5C8%l%1BRh%NDH7Vx~8nuy;uCeXKo2Do{MzWQyblZsWdk>k0F~t z`~8{PWc86VJ)FDpj!nu))QgHjl7a%ArDrm#3heEHn|;W>xYCocNAqX{J(tD!)~rWu zlRPZ3i5sW;k^^%0SkgV4lypb zqKU2~tqa+!Z<)!?;*50pT&!3xJ7=7^xOO0_FGFw8ZSWlE!BYS2|hqhQT8#x zm2a$OL>CiGV&3;5-sXp>3+g+|p2NdJO>bCRs-qR(EiT&g4v@yhz(N5cU9UibBQ8wM z0gwd4VHEs(Mm@RP(Zi4$LNsH1IhR}R7c9Wd$?_+)r5@aj+!=1-`fU(vr5 z1c+GqAUKulljmu#ig5^SF#{ag10PEzO>6fMjOFM_Le>aUbw>xES_Ow|#~N%FoD{5!xir^;`L1kSb+I^f z?rJ0FZugo~sm)@2rP_8p$_*&{GcA4YyWT=!uriu+ZJ%~_OD4N%!DEtk9SCh+A!w=< z3af%$60rM%vdi%^X2mSb)ae>sk&DI_&+guIC88_Gq|I1_7q#}`9b8X zGj%idjshYiq&AuXp%CXk>zQ3d2Ce9%-?0jr%6-sX3J{*Rgrnj=nJ2`#m`TaW-13kl zS2>w8ehkYEx@ml2JPivxp zIa2l^?)!?Y*=-+jk_t;IMABQ5Uynh&LM^(QB{&VrD7^=pXNowzD9wtMkH_;`H|d0V z*rohM)wDg^EH_&~=1j1*?@~WvMG3lH=m#Btz?6d9$E*V5t~weSf4L%|H?z-^g>Fg` zI_Q+vgHOuz31?mB{v#4(aIP}^+RYU}^%XN}vX_KN=fc{lHc5;0^F2$2A+%}D=gk-) zi1qBh!1%xw*uL=ZzYWm-#W4PV(?-=hNF%1cXpWQ_m=ck1vUdTUs5d@2Jm zV8cXsVsu~*f6=_7@=1 zaV0n2`FeQ{62GMaozYS)v~i10wGoOs+Z8=g$F-6HH1qBbasAkkcZj-}MVz{%xf8`2 z1XJU;&QUY4Hf-I(AG8bX zhu~KqL}TXS6{)DhW=GFkCzMFMSf`Y00e{Gzu2wiS4zB|PczU^tjLhOJUv=i2KuFZHf-&`wi>CU0h_HUxCdaZ`s9J8|7F}9fZXg`UUL}ws7G=*n zImEd-k@tEXU?iKG#2I13*%OX#dXKTUuv1X3{*WEJS41ci+uy=>30LWCv*YfX_A2(M z9lnNAjLIzX=z;g;-=ARa<`z$x)$PYig1|#G;lnOs8-&rB2lT0#e;`EH8qZ_xNvwy7 zo_9>P@SHK(YPu*8r86f==eshYjM3yAPOHDn- zmuW04o02AGMz!S|S32(h560d(IP$;S7LIM(PC7Owwr$&XCbsQNY))+3HYS+ZcHTVq zJm;QsfA`#~_m8fwuI~DFb$@pE-h1t}*HZB7hc-CUM~x6aZ<4v9_Jr-))=El>(rphK z(@wMC$e>^o+cQ(9S+>&JfP;&KM6nff2{RNu;MqE9>L9t^lvzo^*B5>@$TG!gZlh0Z z%us8ys$1~v&&N-gPBvXl5b<#>-@lhAkg_4Ev6#R&r{ObIn=Qki&`wxR_OWj%kU_RW&w#Mxv%x zW|-sJ^jss+;xmxi8?gphNW{^HZ!xF?poe%mgZ>nwlqgvH@TrZ zad5)yJx3T|&$Afl$pkh=7bZAwBdv+tQEP=d3vE#o<&r6h+sTU$64ZZQ0e^Fu9FrnL zN-?**4ta&!+{cP=jt`w)5|dD&CP@-&*BsN#mlbUn!V*(E_gskcQ*%F#Nw#aTkp%x| z8^&g)1d!%Y+`L!Se2s_XzKfonT_BWbn}LQo#YUAx%f7L__h4Xi680GIk)s z8GHm59EYn(@4c&eAO)}0US@((t#0+rNZ680SS<=I^|Y=Yv)b<@n%L20qu7N%V1-k1 z*oxpOj$ZAc>L6T)SZX?Pyr#}Q?B`7ZlBrE1fHHx_Au{q9@ zLxwPOf>*Gtfv6-GYOcT^ZJ7RGEJTVXN=5(;{;{xAV3n`q1Z-USkK626;atcu%dTHU zBewQwrpcZkKoR(iF;fVev&D;m9q)URqvKP*eF9J=A?~0=jn3=_&80vhfBp?6@KUpgyS`kBk(S0@X5Xf%a~?#4Ct5nMB9q~)LP<`G#T-eA z+)6cl1H-2uMP=u<=saDj*;pOggb2(NJO^pW8O<6u^?*eiqn7h)w9{D`TrE1~k?Xuo z(r%NIhw3kcTHS%9nbff>-jK1k^~zr8kypQJ6W+?dkY7YS`Nm z5i;Q23ZpJw(F7|e?)Tm~1bL9IUKx6GC*JpUa_Y00Xs5nyxGmS~b{ zR!(TzwMuC%bB8&O->J82?@C|9V)#i3Aziv7?3Z5}d|0eTTLj*W3?I32?02>Eg=#{> zpAO;KQmA}fx?}j`@@DX-pp6{-YkYY81dkYQ(_B88^-J#rKVh8Wys-;z)LlPu{B)0m zeZr=9{@6=7mrjShh~-=rU}n&B%a7qs1JL_nBa>kJFQ8elV=2!WY1B5t2M5GD5lt|f zSAvTgLUv#8^>CX}cM(i(>(-)dxz;iDvWw5O!)c5)TBoWp3$>3rUI=pH9D1ffeIOUW zDbYx}+)$*+`hT}j226{;=*3(uc*ge(HQpTHM4iD&r<=JVc1(gCy}hK%<(6)^`uY4>Tj6rIHYB zqW5UAzpdS!34#jL;{)Fw{QUgJ~=w`e>PHMsnS1TcIXXHZ&3M~eK5l>Xu zKsoFCd%;X@qk#m-fefH;((&?Y9grF{Al#55A3~L5YF0plJ;G=;Tr^+W-7|6IO;Q+8 z(jAXq$ayf;ZkMZ4(*w?Oh@p8LhC6=8??!%@V(e}%*>fW^Gdn|qZVyvHhcn;7nP7e; z13!D$^-?^#x*6d1)88ft06hVZh%m4w`xR?!cnzuoOj(g9mdE2vbKT@RghJ)XOPj{9 z@)8!#=HRJvG=jDJ77XND;cYsC=CszC!<6GUC=XLuTJ&-QRa~EvJ1rk2+G!*oQJ-rv zDyHVZ{iQN$*5is?dNbqV8|qhc*O15)HGG)f2t9s^Qf|=^iI?0K-Y1iTdr3g=GJp?V z$xZiigo(pndUv;n1xV1r5+5qPf#vQQWw3m&pRT>G&vF( zUfKIQg9%G;R`*OdO#O;nP4o+BElMgmKt<>DmKO1)S$&&!q6#4HnU4||lxfMa-543{ zkyJ+ohEfq{OG3{kZszURE;Rw$%Q;egRKJ%zsVcXx!KIO0*3MFBx83sD=dDVsvc17i zIOZuEaaI~q`@!AR{gEL#Iw}zQpS$K6i&omY2n94@a^sD@tQSO(dA(npgkPs7kGm>;j?$Ia@Q-Xnzz?(tgpkA6VBPNX zE?K%$+e~B{@o>S+P?h6K=XP;caQ=3)I{@ZMNDz)9J2T#5m#h9nXd*33TEH^v7|~i) zeYctF*06eX)*0e{xXaPT!my1$Xq>KPJakJto3xnuT&z zSaL8NwRUFm?&xIMwA~gt4hc3=hAde#vDjQ!I)@;V<9h2YOvi-XzleP!g4blZm|$iV zF%c3G8Cs;FH8|zEczqGSY%F54h`$P_VsmJ6TaXRLc8lSf`Sv%s%6<4+;Wbs-3lya( z=9I>I%97Y~G945O48YaAq6ENPUs%EJvyC! zM4jMgJj}r~@D;cdaQ-j#`5zCRku}42aI<>CgraXuKDr19db~#|@UyM;f-uc!(KDsu z5EA@CsN>^t@oH+0!SALi;ud>`P5mQta+Lh*-#RHJ)Gin%>EaFLSoU`(TG7c|yeFvl zk|Yll%)h-*%WoI6M*j+4xw`OqiDVX{k-^V2{rzCIM9mzNHGP^D={!*P7T)%yDSI5- zkGA4}r3`)#Vl6JFJ3xG)8K;FTtII9o7jNHof_Z_Zc<%@-H4RPpyXudpf)ky zmTH$LFGxaIUGQ;l=>R>?+>ZSCU|@&+Gt@5Bj3w{L{KPpgQ<~)jqx0oNZSv9R&^A42 zzqJr?C#D-n>=9FjM=D=7h_$QO$KQ8*%0%)rI(Npai_JjE9_lBk75BQMI zkk4X5PATWgrub!fb5Hxi8{(Y<(GOO8^HECOA)eanyS{u%leQOkp;1W}_8eH?nPQxW zd#Z+uJfTK>g-TR3WPu~2Ru9A+NkuIICM@PyPmJn(GBZt;xFZNDMbw8`xzl2`(?UC- z#<*=*fo{UOvycb|b&4y0Nm!sHhFMI*Y$Olgh;BG#xBU+yxav82Ejj(ZvQ|64Wwy7I zN=DXx7(V^NTH3YRB4HOu6T5=DW86P`L#Ng!SuT{%&>Cq8>|o8lF^^U%MRU41TT?h& z!uJ$YdbM*2y?#`LJ2)XPoKq`hm$I3R{V5-;@u7!E9tH4sR(`Ab-Qh!|UN-a5fZ?P@2LWRvSv!hOk08;Yy!h&uEI-X}j+&v`X` zkqY%*F@{}DHL*Jgjg2}a54hwEV`63bK4>mL%D^YT|>m1-kX{876BRm&`Y#{$&oz($qWJL}T*tj42k+yu8fa=4b7VUPq()Wb~=L?DU0U-4*Iu^KMZBRByWn-@=_f(4){Or#| zpw}~Ajs6a=z!8_H59lqYlfnS77QY0pHpIz0#)}!EGhypupZeZe@%cv z6Dngnl*SsUy^a`v?>lARi6Yps@%32JpGQvrcd*A8LPLEInBEU2vriGvMqG!jh^=Gj zXvu5zpikqnt*e4&Un_e$2FAB?(yOS0JAzxh@nN?Blqc-)Pv`U}&E5|# z)97-9utpqi*`hR+$;eS)A+KK)CO)V`b?*}z&*+28mDfWI31)sF)tBg6LVlxS z225poL+O|x)5;skkj{rew<}TsDVqFMMLSgd;UK7^clMcObM~IgSq6!eJ($JP!KHPr zBJ&SHi{wLsgMzn1^#kV#_!NO@RG@B5lxBO7WfIAi@o`{_XQg(*{R=@Z(0ij+*i7sK zW5D%_fRN7l6qpytW2K1lUqP&W5jDT!AA9@q<;M!T=CKv*^MP)Er_uLL+Y53>**w7Y zQ!2?^4$wC;Soc!+#~d?Yec;NLdR z{~*hrSQS>UOMBe)1pHe0EsyO@d(IrU4ZiS&jL`wqv6Oqv=HbI^70qu9kn~wGkNL^> z!Pd2)i--+&zp^`#4@*Myg;3r(jt*h@RWgRt70byZr;0Na8n4!bmpuX1&gK=QK!@j< zH2fF7@2s0H0!9%VC-BIp(99@e@<%Ko?BB9uv*xPnZ5dQr z8r7~9cZXv(AZPY^<(X@}GARv&_}mfYA7`vdl=)g2GIyN(<}(b_S_N2--NKp$SgO<3 zRx|EabcjUSB44GaH3Kxmx3SW;E;Eia2Zs5SkbkQ8E%VQqr0J?tQjF~p;nbIXn+D;? zg;t3Jg7A@9U**@aaqs}9;%??Scm{zBIY2ceYAQd*W-hB-!+H&4#yrm*GtT*&#`FXx zGIVm}G<;Pj+h*KQ68S4rcIIGw-mkl039s@O4p9F%TC&&&xRL=N49v2PdBb$MxJoMo zQk8+Sv+F5m{xP1prZvn1=x-Q z&Yox|y&arZrLTm~<%o}VfPV#z+i&{)W5emXhx^g~8>eUe)|Vvwp8-x8d-MOj%@mSk zZ9i{-Hu8m-rfO##y(_Rv;Y@?6%h4Id#6%`7ah+IaQ13o7o>bG&ScMj&KO~QoCmNT6()+oo%B zugV3Da)t>unQq=tbD)FP{JmB~S5QCmb)lq9Fp(*|(UGeXr3kR?k35sKFs{{a*y+h0anA_K@iCi;BR6nFmKHC=@)rMmu=XWS1nVqD*=#${cFJ6<{e=U7!Rbg>Y0b~d#&viX+5m9aNAv=RAMt8=n6a&@t^|2LsKMR7xF z;Cmw>t0<=W2II;doX`p#bcjPV9z&3dhAObzcB9xXMslqr(y!P6+2kG>Eh!rx&ZKmW)Wk~_xh`?neJqVhJk~1eTvRF#ehRwpS>s1{vUx*qf&Jm z$)Wh|lmwYatW@U@*$<14>^|yYwmwFs)C5ke9hG42{gilSU#^ulO`M}`wJ_4*-3 zGb?hfQj_AGQBI?4ghGijqfu>uAYkLK#!^uGUXuctdn8Ae5I7}o+j{9MJiM|sf9Nc{ zuP&Ls@?rMe=IfJo!=iX?9&*4!Yjs5d?0Yx4cIFXrkSHRk17Fc@yM__fyFLLl6O9nT zQqaDXunH;!PpQ7+-&#wJVtJXl8LjIkh)5qmcqhErYrP31w5~#!tS{LYTWGKEtbpE%(hH>qV(!2KMfs#a z?ZzzbDB}(7+NWIiSBQ<_{3>;H;z}uZI;n2PKWJNxM=l;5-^zpu-}+1x|38lS-}6GX z6F=M~bUtHg98X@of>mgCH-&5g6UpXGAla<+g`b&MQANW6D^;zfSzq0mQ)*J%;&tPOYin?J*G7GqmQ=>jvWvOn6E?! z{$(CU7}zChEnl$(>xf`ZdeF2E9Bv=eH&T4HWAOQ!9gBs z{gl^|(78q-ioBS^rR2PEGZLe_4Rl**H(bB?84RHquCEKi8N#29u=Eoh(DV`ZX{+8< z3BIX<`sOFNBziFWS#-X%(e`0C_|Q8;Pw9izjNOF8h|kvmWCmDHM&pANC9MV<wEJ;W{-jXqm!zC+Y@Q1y_lLL zfV^(1{A;L%TWmyI)RPknVUB<4r+d42S(W=%bXd@YB(~d>ABq-E;t)ie6%ouy(Fg`p zuj<=I7^PDs5H+UsG}+GH}zoGt*{yKF&n23C7aW@ z4ydrRtFW-uuAUu@RWe&0c!N4!H;`!n@@t#u zxlGQB4rx(F7#&MKHPy}EI;d+l(G{1KG!ZBE)7)@P!AsUCCCb0IH!P5TW=GoNFcif`NB4en16Cp<7=fhz7^uQAjbJBH>@naf2ueMktmtZ|U|)ICDMN2r`mgMSl=qDwHL;}L-d~El>pf8UJRts_03eTj*hVy6H z5o!>?AcffORZq9!NJNa`-W4wMfe6I{3*rYUhIMA>y|T}KZ56HR5XEs{(|x#SDtP@N z5?12L0W7qfvWl8T-V+u=fkBH8!$}g)7hRs34m7~)^S&Ar zd`Kz7$S2Mz(|5H(Dwn$V7n8K2pqhHQ8!i{G4C~Y6_Ex&Y%EyXdw#Nj}VdG`XCN_1n zFg4;3DGjjUo$%=m@ui%z$JU66QK^qywvLKZpD6ZQ2Ve2VBps8rcvJ6^Cf^#H4?UQ5PW$4;b)55yIY9}@k@48RLtJa>7bofX{EUE7 z?0Cx0PeYbbLAelC-BfqHf_08;{lzC1kwr|a>5{O6*g<~wt6KYPfP5uW0w?VTO!M~Q z6H@n{cONp`{>hVjEIkOV6m^ZP^l;mGz=T&*5&`m84astyZ#XZ6CpH384tt%vSJ zsvYDC5u`D&U_u)1OJ&D2=F*ie-7!%N+V6*qoM6m-zj|}hDZ+@?`mJ10OX3K-`+R0m zNk$^+zBJK7%It=_&sIc}&DT>!LYU{|WPNrp-Nfly8u5&3@(l{!pcPxek3^{L`<9*! zE-0KukkD^^+<&3BNJM$e0=~B$=VQEp@V`L+PsUEL-_%+E_kyR-_mUjr|D1Z2J->y2 zZNHTrzP$=uEKQvy4DG&+4*o5^8Kd?eI>5S#b;NXlSrGVnj3~e^OLe4*Qe7%U#4WiX z)k7h@VHRERR_j{wp8ALHdD6bj&+Dl^?2(MuL9*oTRUI3SQ2jJ4x#!GR~b8F(H6|clt%g_O=v(@*;;5eW{e)CsR{UNDIE{C-1@qe z7NY&S7DeI4?z7tR9LJ$e6za%qLsF(>%M?m1nQQ4htpl?P)yj7_C#Ds5k5F z1h@YlI%a#k9x6}=hs(mkRr-fSrmikEk)Iv6D`S==)-dDVbNK;4F@J7iC(M!K6l<^lm@iXKpYbd7b{_0BDjc9ju~tFH7Qfcgu>A9~3tzmbFnXbS(pWES9955Vbu=iI zX>GH$kbD_?_fRojp{~Mz+%=%RHG!3l(wxQb{zQlW&MTlbr2*9|peUBo#YZ8u!UMPz zJo9lmW3isPrkErmxp&SA4Z4vpe~LLL-w6JUW}f*bf#w6lVyDvUhdK9fX!p#TT3fL+ z7im|;28gcWM)UdfRI;603BWd`d%7#sP0t)qNW*R*WmrD?hg37Zngmu{P;Lm`rlK_> zITGMQH~V(}6l6}TeG5nPEHYI3EHiY}TD%AAQ@%&*Q@w}lLp!VC>E;PCjzgVyNqNmA zYd0t~-pn55?#)1Tc-(xbL07m;Md14bPJOLyoRpLhRx-BtH{Z%<78P>0$olxWy4d9! zncKIDHrWFnBRUUqc`qiz@xrz52u-?2kq~5n$h}&*K?MxJ?xV?vVXvLErROVl7L9s; zedsv`#k1PCWY;`{${N?=R9%uy1P+jKf$&__RLHP zWVH#4;U{}bB4D^B*hm%nhRpQF{4?xW$&|oNp2CUE?Coyj1QI%P|w91%+*lty%ecgZ$I1|mJWq9_c?+4{KElHR%TIU zf+^4^hXY?f0&(|Q5=NG~AhiIVR+(a1gF)Q;L&vH%zPO{yydKt*(f#LehU3CVRIS&* zA1khb+xXe{29|Ggayz;nqv9M8n$JYj?Z!w0Sb}^lq#XQlg~=nkBhYxmlB{huZcL}F zA6sNZgJpJ|laA>P$V#ZhT+&$nvNM2sudEEeUaohc#ab+sC zrj7G)E-#;G-w=I1hTjN@b;lAjX40pR+<>)=n`V_!(JFk*yE zP3nDEs^C9DCSbs8`TV~U17Bmq%9I^$2xWK;N>;W~^^HOu)jQt*LH(-WD@UyR?lk$o z+mZhVgYn<1!ov1;W|rozPKN*0V#Xxdelr-6M$Gf?*Y~BQbHRK-&@B;ni(p_#pe0mg z(1pQKcH#lqe^P^eZVUta>(kWOPSnhH^E-oKtcJzCI^FSuJ zze(PI3_%VP4Fp7k#GyT8c6l?vndL`$$s5Z05+P==upnazJ>&{eIc?MW6fVO34pXfm zmmilQmRYtQ*e*BV>J{aqI%F$j*;=Tdx{msYgM{2Gd`D^TU>~NLKrbqtQDh6KPGcB& zYEY{fj~P1Q zY_vIx8j+W?nOTo{k7|A!vvlK?qYKZnTkm@qV7lWQf#;J@)(qh~m07vHwdQ@701t>}N2> zYt=Q^?p;5oP%enrkvLCarS2rlJ;zjT@1)Ha_28t7T(IMcZi3U?D_dTzMKnR%{b7 zXeWL6f-xfJvhsVNF_?I2^3gmv=2|f7azO~wc+o|=2cR+N_<9sF;vio2z;vtlV7U6o z%q9XNPhjS1Fv)QuRq|0#HVGw&HG!!t0wQo=W>hP)uYZ7o;_qdM=-*`k-Z%4+>VGZ; z{vGL`lv&#q*NFJmy`%{yAIPrAB%*freDk*5cHaNPB~B86YH zIw9gNDz9H+n0&}J-c0V{E(`My-2Nkt0NBY-PjL5r*s48D&j)h7pIpJUb+0ol1F*~` zp1!}vw0*&IA^z*SXZ}pIG9;ySrW01 zpU6d%LB2t@(;)LD!*G(DXK-!R!}Bp1mKS>Uu`^#p z>~WR%dn&;>iuz9Pv3W7EPX~GtnCg$63a-#A$1B7q;ZqH{xws^Pf-V1eO|D zHXE9qC~c)%CS>n>jc?m)ux2hN2UpKIU2hP(X}`Ljjc|CDFH%asVJH&6j5&Rb6aaVeQvSt z6VIX1X(pXAmxL>}wO&QIImzI9LcFhECJ|Mzi1FWhCgS$=^!!D3^vyEEY0HM0>?fsv zz1W(i8*H{v9APY$IW@J9NQ06Y@g$&STTrPC$I1{t0ptDZ=rHjEZnN2BSw{(Pn+6KD zRZ-hjn-KgzRa=ZoUs=W0cAc-}66Rmi)kZgub$G6zPQn>fM&}9X6!J^UsbVFdewj#M zt5erf{g$1$WV`h=0<2Y%iDK|HwH6hSu-8LDPknW`jl$UfmI_z9=GkC(@A$oVsRFl` zMYdksp797E2vzaH-N_%;t@q4}Z;FxZ(y&6&(#;_uzaGV+M%CB= zVNRMN3tj1#%##v%wdYNDfy0)|Q$>JYJ8-6o*K4hcC(;5F=_Mn-l)y@UX$ zt$YU7Q%o3cqwRC6;{vbL1No%d&)=)2$$;SD9a-=PfFh$6P1;*I*d z?C_52JLp$(UF}SCxJXTY+9?uE`@f35}k=i`#4Rk6e@*KDc^(tnQcw(jY^fcG z2hqo(q%7)o0YkX;lCq$o6hgCi3n%i#6vZ7x&_k#aW{QnPk2CWm8yVytzz-Xd_05x& zK3Vo>SFs-R)cf&`{&tL=xJVe`-HvE7&mAL^uj`W z%$d@~HtC6RV)R6}b6PqR$Pa7R8c3d_D4Hqq2NfG(>kTi!rOp%>Lc~n3!5mddW>>pR zt8tmTCxnr(Xk6g2^MqN08AmxcFLP;APA}^V80R_+K#agUx(RR48L2ZQej@XRm?OF3 z&jyIH+L2f<&wdR}X$XB~;2tBIf^AThY(zLA4*i6@9FdbT!Xy~7Ywt-zdi=wCIRuOL z73^T>|0wMU6&500dh%`EqjoMKS;Z+_5iFfnaLNy+B-@vyNWRdcmRaaBUdtQvT_Q17 zTG$aE4SA0iRA}+d@r;k~BwsTn@=r*;LgW8Q~>>Y9oke1Rm(xx!gv){TQFv|25IK_jjLj z_mxH%0-WoyI`)361H|?QVmz7;GfF~EKrTLxMMI`-GF&@Hdq@W!)mBLYniN*qL^iti)BMVHlCJ}6zkOoinJYolUHu!*(WoxKrxmw=1b&YHkFD)8! zM;5~XMl=~kcaLx%$51-XsJ|ZRi6_Vf{D(Kj(u!%R1@wR#`p!%eut#IkZ5eam1QVDF zeNm0!33OmxQ-rjGle>qhyZSvRfes@dC-*e=DD1-j%<$^~4@~AX+5w^Fr{RWL>EbUCcyC%19 z80kOZqZF0@@NNNxjXGN=X>Rfr=1-1OqLD8_LYcQ)$D0 zV4WKz{1eB#jUTU&+IVkxw9Vyx)#iM-{jY_uPY4CEH31MFZZ~+5I%9#6yIyZ(4^4b7 zd{2DvP>-bt9Zlo!MXFM`^@N?@*lM^n=7fmew%Uyz9numNyV{-J;~}``lz9~V9iX8` z1DJAS$ejyK(rPP!r43N(R`R%ay*Te2|MStOXlu&Na7^P-<-+VzRB!bKslVU1OQf;{WQ`}Nd5KDyDEr#7tB zKtpT2-pRh5N~}mdm+@1$<>dYcykdY94tDg4K3xZc?hfwps&VU*3x3>0ejY84MrKTz zQ{<&^lPi{*BCN1_IJ9e@#jCL4n*C;8Tt?+Z>1o$dPh;zywNm4zZ1UtJ&GccwZJcU+H_f@wLdeXfw(8tbE1{K>*X1 ze|9e`K}`)B-$3R$3=j~{{~fvi8H)b}WB$K`vRX}B{oC8@Q;vD8m+>zOv_w97-C}Uj zptN+8q@q-LOlVX|;3^J}OeiCg+1@1BuKe?*R`;8het}DM`|J7FjbK{KPdR!d6w7gD zO|GN!pO4!|Ja2BdXFKwKz}M{Eij2`urapNFP7&kZ!q)E5`811 z_Xf}teCb0lglZkv5g>#=E`*vPgFJd8W}fRPjC0QX=#7PkG2!}>Ei<<9g7{H%jpH%S zJNstSm;lCYoh_D}h>cSujzZYlE0NZj#!l_S$(^EB6S*%@gGHuW z<5$tex}v$HdO|{DmAY=PLn(L+V+MbIN)>nEdB)ISqMDSL{2W?aqO72SCCq${V`~Ze z#PFWr7?X~=08GVa5;MFqMPt$8e*-l$h* zw=_VR1PeIc$LXTeIf3X3_-JoIXLftZMg?JDcnctMTH0aJ`DvU{k}B1JrU(TEqa_F zPLhu~YI`*APCk%*IhBESX!*CLEKTI9vSD9IXLof$a4mLTe?Vowa0cRAGP!J;D)JC( z@n)MB^41Iari`eok4q+2rg;mKqmb)1b@CJ3gf$t{z;o0q4BPVPz_N!Zk0p~iR_&9f ztG4r5U0Fq~2siVlw3h6YEBh_KpiMbas0wAX_B{@z&V@{(7jze4fqf#OP(qSuE|aca zaMu)GD18I+Lq0`_7yC7Vbd44}0`E=pyfUq3poQ-ajw^kZ+BT=gnh{h>him533v+o7 zuI18YU5ZPG>90kTxI(#aFOh~_37&3NK|h?(K7M8_22UIYl$5*-E7X9K++N?J5X3@O z2ym8Yrt5Zekk;S{f3llyqQi)F-ZAq;PkePNF=?`k(ibbbYq)OsFBkC7^H7nb6&bhDx~F#muc#-a(ymv|)2@4)NQw!cgZ|NLJ@N6o#y!T* zi0kdtK#GC8e7m#SA9pSuiE5bOKs^ox%=l6KBL?8Rl;8R~V>7UCaz+Y_hEOZ^fT}$m{$;GJt9$l$m3ax6_ro{OH@r z8LmGIt2C9tM6fNUD<(Y1Q8w(aN2t@VPrjc;dLp9756VNLt9&>pX!L*6kyU=uui9e7 zrQ^&h7Nuk|fa1WH?@{DNg}C&i2BPX$%)+AMi%-ImT2Q_QnRV)3UbO2JW7T-JYoYnU!(}tii1LAN|D(%7cL@IEI0mCT0!t|kd)1KahVC2K z|9L76JA1F#-=|{!eJcN|r2bI={kK#3M*^rokSGIa zWe@gc$gT&!Q!WYqGHNy3PlhBvcjf&X0o_R>a?DGQ`e|uWa)>YuWk(ibM6r_Xpiaq4 zWtcFh6k&ih==f(%+T$`L1EYJ^CeevsviNKGK3iUF&1QI!EZOR4y2d?z{kh!@hfoR4 zR$n!oTq-{w^eSf-ckrX)rp`@DG4(8%e{AtoKlwoHjNIX8hY>P;3y*y_O8XZ8ien=J zQR{%EX3|XA79>Al$+8(rw$Y~9ydiaH!@*{;*H_Weng(B+tJe^@Hh~lm^J?rL_`0$g z%o51AI)M5AP4)R##rWU8U-|zQ>N#rK?x?C*TS+B3tQmUYjh6X32PBq4xJ`|D)tg%M zLwd8z7?Ds5CNhvE8H^bY$XD*~ke$yZo!3P40jio4f0GcqUohXX>C;+gOt>>PizdRd z?{b{G8+tZA!Aj6GmXFD*thAzMDL!h{90}jI=PdjS093DQi3v@l|5~^hKrwR6 zeUbcTjhPDLUg*ao;c>8JN}wB>MOIE^vN22t5147OVW>!BTDvz4xeP$B({i(Po~_BL z9*#5s@;l~%7S3?WkF0}E8>iN+UQZh{-D}3F##`x$+YG@H0vyyD%vY!zsJHcnGrN|& z;j<&E%0i6kwaMT{tjp$m5^V4*+9;13^DDjgaFvvOe3=j2hWU3(PY)kFXvfx#EJF(V zM!l@%;xJuF3pERftbWw~WnR$A&ok4UQ0dISRjNi-j7>!WdGm0^FUmns_uy2DYX1!< zihag3z-a%BI*WE?er9_UTY_Eui-R>cvS1;=N#Bv{mPKKIv5O9iXS- z3|WAAOhFjGB1il&5F9vj6Vm!t99VnZ6v)$mKW$!I)_=41msTtDQ`CAV`azZw#(aSt z5XK052F(2mTOy|hb~KaAM@(Gg9l3=rqXB79Zp!Q>)*)Hhm(8O3s53@BCx_ltYRV=o ztb3!SE4UlbZadeiDcr2NZnT1}MNd0Au}VRHKQ!`nW(2!sPW5ulYI zosR$tFs@ul-q2)^z}}Y;3$Jj4J#kik5ou3xxf)_JL$5C!E%MDFH5fza9unrHXXw5F zHY#AcZSU73&;sy;y;fM_*p0Txd{DmQVYSyT(8Bu@vSLZAPKlVDd&6%bHj%HaV1{=L z91uK99)#H)!*Q6S`Dv))pyUoDkMa0Sllw7Fvb!iKKjbR3>q-@zp>$lcNLt4(&F9yk z!g!~88ulk{z2xgG-3{{il~#8wah-S$PDsv)h$4v?e@iEW{%JRU21>lL%fw8~(DT#^ zywKIPee|O;<3lWQL$hEWAUeA2)~-xA7yV(I(Pe55DMTFD&6fP6bS3JXHE& ze2nS2pMh>pdB%}#XYcS*N|SMQmQ2J&7WZu72OP zj&wXEJHG2^_XZLJUco>yC|q(0L~1fPN+}|}7%$xcp-i$$kXV=D`~$(T`2Y)+8U2yu zvr%Mzd~RzcUfF#X_+uh&RV1fO9P&C;yFTuW5sb%e_xPYEB%AgtaOJ(ztnLEW_Hao2 zZHV-;f-^2epH zxn#@~NOA z11ZBV6tw5T5>Iz^Jb)0%OIlra;qJl^ufG156Ui{A2$qpZ_{^c1^R`+fbi*WT%;He@ zyieltZ{6ivdgz6i=@iEldc;jVS!5E5$rymBrD?v#K?Mr`?ocG-n&lL`@;sMYaM2m6 z)Tt641KSaR_(MIZi0J-0r(53x)8LPvfBwp-{yFxkKiTU)pdB)FGjC~7AfTS_$=v_Y z*Z#MJ`R|V^X!eb+h*>&0yC}OF{rl;vioX)<^+YRtY&IVpwZx%m(G%kbE0AM%G$dMnxO@9U~x`$qY-b?f@fkQ`9pNJeiFRud6ZB~-h_kWX>mCgONAn%y8FDS z1jJ5f3AGpr111cNW(=njoJxN_XIF;t1dO^e0km*ZO?76yVM(*B>Ix?cT=nC+o2XP$ zo!&hK$H9sd8H07(XoY2&7QG(*iL;qrs4U*82`MFg4P0Dzw%rEFXuGLBslk;D|Cf}sL{Bdj9TpChAGEEN*DvCLV(j_N-e zcLNc98=ZJ>3?UluoPSL2QwygpEHOrNp?KEVT77e1i3zzY%Y9lStpis{$m zm(cz{%HDxH)4xj^O$Qy@?AW%`NjkP|cWgVkW81cE+qP}nZ)X0p&N}nVoOeCvGhF+3 z?b@|#SADRMCTILsR4>rrHy4AU0PJ{|)~M^(@q-e3hLdj7_}OdzCb7?6jvhyQy!)3Gv3ELg)6!VjwA<}NC@GK%{NI0 zJT}T#aRk{>TXHs_T?t5eRw>v2ntXC6^p*jkWo`a)WZ0?8&JFWArnx^e@#->FsW0`H zaG;x(iE*;8ugY6Nhw%)c!hpKUyX3jhGA*i6J6@(fUBPL$z{4dz!^d6OL#hN?41I+g z!KjR5!+yZ+z+Y#U0p;s{fV{jmnQyy>%`Eu5GUWo&fsZL97=D~-b_O#00NQ+zO>XS` z6cn1v6jGixMb@=ItgwK*pbiAms3``uBok32wSnIF!(VPSH!Aca2(cTt_k_R zo!iTIMT0nvu%dfM`Tm^UEy_oqiKOy5hANU5*kqB?bbwBoz>e&)X{#5b+bFeY#FB}p zj#JFe|1ix8(itqE%U8Oe9{8p+lmPB#ITX?HhA~WU^`aMeLagZ?{J#$k1(<*Ga=!-# z(r?kozXS&T@4ut}e53yWT>JmB5K8z*I`ZXC(_u$bUyRSI0_sa;;}c3a_~)8{7*#4- z*hR0l-h`v$GUX!Y8S$OAGx`t7Oh5c~5aXowl-+DBh(YT4|& zz2Q~Iz2(b(#FdLc$(X>h-N-=%K&sS{-j3KfIshl~vZ(yd@zZNg`=RANO&IW5GfVZE zs6mU)V!n_RSxggdO;6lhUb4T6hUvzQ$bXz{bZkC4QCxql0E>+~jH^F@J~OC%bQSnw z!dVcM*I_fSE>Yp7Ty9TQ8VjoGh>2rpcziKFwP#ZBOnF7Eb+fb#57*n=S;keHfwc zH49H*3q*cDponQrD`v$M1l5b=n=zY6HiA!3d-3ZhDZ+LzKN9kDW#xrc^yy*`$5>{c zL~=_5`{q}NdlgOp5;!td)>hv&2umQuUJip0G-qJ0O^3tqXGdqmn}Z9DTz4j33Oh6* zRs?8e!2wbIsGfGP{9#WZD|RF{E86KJLEy$vz9KuntCBzNS(>A~j5a$SlK;1USU4_S zB~S;>^=U+8Kqh5?r+Nbfvr>prvVolf25hJ>p9%wx5ew2uyC4l%vXv}jkoT5T@NOml z^@+(g=Fks#f9@XKR3CWI`oEWac$gIO`*&M%ga!iQ{=d%2|J9ZRjEt@AzT>j~_r7Ge zrikzvS+U<-JIh%phK;}dvq;P%#NIq@*-Ro zG795&jLHtK3kt@gsFnVb^geyY&Q#0!O5NK<5l`92U6zg)2z^ixqqM;dD69k{pn5na zjzCXM7%i#qTM&x#D|7;Cs8qI%RB+HS5}ROsznNr@l{c2b$1$=!oSc;%3db4qHN!gG z%>$rEZM~8pIiTEB<|bT*mBLb{tT1uWu6OFJ)KF7(hj^P2rs5QyMx#q_*|BJuoXwJv zyh%!-X{q#YM`heA8Hj!57>5|U9qR_sVak1r z2ZH_d(s!DNqIuDZc5gkw(w^h@n7~LZ82aCz6|aG^n5bXeTCFdW z7m@2Ej5B%8MSD2HAr*BPh~b^9^;NJ~HXJJX7VeGl(#=!DS?r0mNIH^}d}=~&Ui+B^ z_wm)B4@6oIZ9FP|3#qxxW6-_;>b*pN_iexjXi=h}e`(krgGC?N9fbTnyYPYIO6K}B zFA_P-suUrOEb6b`R1i9SkQ*s2Jb7^Y-tOTodB9(}j@~WUg#QJE`jW#~0+;?p-Oyv- zf|?tPS8>)50*6Qh^}EqVu&_nQ+F^C-IvX6tCg-UDYg3UXsv^pjsXxyJD>pVkh$z=?hWh9Cyd8bJRGUUU{A@XK zEFVF%XrUA0yYJ(VcELR{+rh(`Av6SI^lRD?z)AQ$gLvakWpQF`_zp{aqZKUt@U1H2uD*qV*seS(QQ2Dy-oc-O8X zMKUd~h#|T^-6H}`fk?iJx;2kI2$Jj;QIf6%C{vhRVjqTvaHy7Wq*g(r%|c-3w(n|C zr9N;Rs9JfUDeCWJFL}uP;Y0FDf(Wy};!IZ2zFjeU(d+_6MEJlaX*p=3D!D0b>op*k zuYr23N1W0wly8w74c#W1LpXP|?)nWr(3eXs$E(c&PiERe!JWE^z0mm5cg@7F`_!@X za8nQpF$jOM+JDY~nb?BoW=-xIQ22c3TFS?M{R<~rPg$le_1#FXz85*d|IS}UP|x1z z+ey;M%HGW3JB?4_`{vKeW ztvEN4bJui=CcnsQr$FVybke#RDpaIHY{GaczId-A9x@ zD;Gi-lJ9Iau-2o;`eV1*3ztzN3!P`Jxrc)3ocRRAct^jD5E<^lS-Z2}IFL)oUQ<%h z4?B_#BP>07`M}`7ywGkk}UQpFIOvRZx*v_~StXIsHv% zk|F{D@%%dlD`92rZ1oTF`=>D~IOsVT{euA~R8PKHPL!_>)`|SN9}+Q?LbiX7V;y|` zxRlL>%Ik$H(5Pr(Mxx>JnH-I0{je|Ff^ zz-BM|Nl%;W&QA{{-tTu0O+e~5f#GiJBzZraC7MNqDOlr?|LhqN(b;MvwI7GKiU~0K z{eT373oTRU0c$+Rhw4@XlTr&~#ma@bzsx0Wj}{NwfD$q4FH;&|U+$&78LfwdW8CyW z;OP%PLaqA+xw`)8&GY!c(BaeeC9Brzjgx$h5BNTOB+6D5tkg^CsI*KLgPcM%ya0vp zbV@C>a?WQSn!)u=q#cuPB(|i9nbp{($Sdf>!kHiclcaabX4aUu7DhI!LxJ!}0zu6Q zTOuR4jCzAp4HQB~$lx0-I*OxW?+7`C+)yPz2LhTJcEWDtrjrKPGYcx7JOz5>Fq1BbCwdcc~)V(_dWb^W^Cg+d`E znHou4u_BxEZ#{w1)X2Kp1f&31bB$h<4(gDTg@SKrHdbYIH!LCpjoWx$m6H?^Rn_?n zQtIMb-Te>usVOR~oBNm|$%EuM-Al$LI7T(caHlUC_)EwIwb_}nTuQcJOCTkj73b`fRMv9KQcH|un^M#jXkC}A*2{;)>XL4t%9j;TE~jj=;kQxkt|4?2+jG$ zO>MA4Ihwb3fs%0QJ?(xri>|+HFKQwe~VKVDLRp+kcn%p&_N|cAcOg@pMI36hxJ}`pdX&g37 z;cjX3*$bO0ZP)WGjS+*#9BPg-k|%%ld(u(z6#Rs)CdDq3v`;~(3yzuCIThvMSR?)N8k)5*zG&`Z5~4mo5!kDs8X%#wWG=BAOu>f;BBx)i={ZF2%pg&8u9OHu$RwHWi(Zrnb_F!S4}H4Pemup{B?g&x zU#uE<^xzLw!p;7LfV$qJaB~})?F?0goeb3_q^thbL^rZUwm(m}&9u{(G_k#^JTnZ# z?ls#Ol&@v+(`?BLI#?e_JDXMXZ{(A&w5)*9@rU$xbIzoJK{+Kq$9~gGf?d^9H95ge z9~bmk_TQ;pQR=n`mb-!up;6q>rJg5h&~DXGOL10ZCpZElV9+NXAe{ z(U{+>WGl-7n9_cB;esbv`zQd5PGDmtwrS6_?5O|j?f&4!=Swn)P&{DTRm#Q z?lZCaTsQRukADw>9hvymR@=x9j+`A^;gGe7opW<)l3(+nJ@lsz+RXHLf8DN7;}xZk z?qsC(lwIfrLNr`%cX`j&a39Sp*W&E5ABI{ZAa5xsdUx~eii8JeRZF~w%iTbC#CrAF z-f(##d2g%O_TH()d(?*AHm2=rhVJdR;EgIyP9gikuT_JX+bTqZK_f(F?2|1`kjc^R zBzDQ!BZWG%cOfa7HvQaL{Ub@Sf-hnaA$2DxLI5WNxlEM_Y{{$4dSJMYh7u9pnQdxV z4jn2yc%eOWUGmF0IvlC|>3K7RbP86le>*$oQf1o9Hu$U5W?FiyW4x15Ke~2{<~fNTN9&{nZ5ltn)|0&e(%8lU!5}Jn=P4>{Wc_V#@<*& z#iR_5lKis*QVSbHPz*U4gh7_7OW&h{zBrzGiDu1}dlO-OKldzv6xfgM1;iJBv)(xV zL*nOH>}C4e_pM>gMOIgr7fA9zY$T{1XY4SU7$v!*x(F28!b*5-sBQdSve9%p&6M3A zoF)u_&hxDVt(HQi+d30wc#%MI?O*#P7A-(aDiQVoVBc|#+G2bKX3W9;9o8 zD4HbHZV4&TIV&gj0z6v7AXq7b^MENIMn!!BR-tnjn>8c7k|S+hdv8|W%?0CbQ$7B2 z*nZ5BW(Fd9tQJwZVVWzfGE-5!b%f6Gtb7t<-@dIT#=TMz3ERX_;%e*+5i3(E=Fe|ao}{&(4(W{aQ4Aoc)ELdd z5xg&)DFQ19QdauMEM#(&`Aef|XP5yeP7=4gf8P)3_V6z`))+>cj3Zt1W8V+5k z6@?Vs07*I%!{dvD{3k3PvAAMT~6`Iim@M4XaO_%YOCvyx_aZ#OE zEoQCTV=MOnIy3QCDFvy%ko~6YBp3`2U{rdbr*BHVsIz1!_!-at!VxNhO7NC`mw*3v z`Ttu;@xSWcS?XvTO7%Eu&JIN?8S!yGelAjipZZjjL?kL>E`1=KPegVn$cd#Q3 zmrT=BIxi`@g_jH)Xa+_?g2hpyNK%m(2OB8!%k?+{0(O|w)+-aJ*9?afapdUc!Kzrs z{bs76WLj({R!@J8BMHvCo3*s0;2pzhzGX)r8;v!#bHTvh^<3+|+&~E$E|kdCik&Q* zvXm9N43@#(!o=hFvr%fQ&OT-!rqBw$jx?HZJdVPlcdD=K;SDr6uCWgM^>3>bYYyzD zw(m$e)>4rAZ2TKb((Vb1@C$)B zlGwcqUCU-rWbV8uqUIsl`VCcnOj-itFqI_2Vd=!Iq?jNi9x#_YHyx#bWu>p$(+<#3 zm8~w;gB*jg_f08pzm}{qhFqd*D)ma%t4`7=-7rq(#5?lpDE3t^qTn!nJd{~h0E~E- zRQR>Q81&d@rddwej@!YvrbA+RoMKfi;I-d?R$U8^y^k3xwU)Hbm+Y+5OD;`JOia_@ z@eFpvBey;1Twd9l*KHO!*;QK5)5hjZ6$t;DMfiE(0a6m5?s6M|m_vXC)Q4Fs9sn_y zI!or%?trl8Gt;p&}Jf;`yVHP@rsXhgAkueW}cmxLXHXddup{SVk z>^B@F*hxOnbBoJ8BbZ4}yNfh{NlUbMcb;7pL3x^mNLtFPzQXori=YGCNI{)ZAZ2Ki zs3qvR(7N>3nl%-R(nxn9g25ba>ww@!Zk2n&Ba}d16bhv_#ER1_5xYp4v>EZSD=SiN zawHYv%hwEpP%wK16R};MR@m~tu!hMb+v9EDkD&DX5wQI`eh`K1)O`&W>qHzi z!b-DJ&}vPMc~072@*LfJeLTEC`v}F87}68vWOcpLQ|U|l0V(wYixZ*=QHzP%b48F5 zDzkei^(!En6E0%9u}ZGpvth=98Ab7vbAkWtt0*l8ho~bKg&k)N)D{X)Sw;9K%Rymb9ZkXRbICW~F^rHlD@gHfrM)$z@z z$hD#^b4Oa|U>c*}O;;{gCD0tASCj@XM=^K~@*b&A(W9HhBW7}y*>zs`L6&b(Numk+ z?}W2dTTY-k=m`2Mn)4HUL~E6!TYM-44baeHe*R4+@g^O;S2E_999y!?b&i{oCw2p8XKj8~?@*s%WZ!JnBS*(vHBdP{u*jZ;&mPhgW- z$TymUXpLsqmETA3RIEm7PvM~#n2jc{hcz=P?u0)H3}EOmNcTzyZTDabzVJS};Lw~R z^_n%#OhfmE{M47|-{~Pe!$80aEMfivs=~;(cxH+gPUI*ZYK)Fs^CUuPfB%5wwKIf`Er>NFR$wv_^&lqkC2)JPA$tSp%^o25 zAg&XPxP;|y!~aPnY+-Z{-RB5sI)^EdId1W3Ryen*fIbqnZ*#ViWDj((OR4xJM)(;? z@Cf4i$TZxF!ziNG;)MR>mr=gWYsSqO1fHC|%#CXi%S_NF)#i?IVU?g9jGmIR0)3Bq z;tln(pGsuhYpC|QPZ-M*8&b?$?(Qip*nJ?akUU7FF0*UvGnI!R3f3ehEjPhPEH4?iI+hc$O*6CpeI~ z4Sg%6ZtDeiGX3M@Xb0VgXkGxN8nJgs*k=MrN#I7+%!m&e>Y)R!$GXr{Ox1#dMkdI= zlKCh%&BnMT;qlKbqHxO{`^lO_0%GE1Wrg?yydI<3s6he$-Lq$K9S~S3G^v4nX^Z) zB1xZCP}vgY{yApKcg{ysSWd~`b){kFXX{Ue7MRxdIp*Pn%tWiA;G zK}!DfOQSN$&ZWcr5-u-l7x|fv7&wHK*XJt#+uRJnB2FM~@^XCA<8EU7^5gaHgUsjK zVOWSyGNZpfk~vg>rhqFct7@kb;0^O2Xsel9!;mh_$I zaKvjBu*O_)8H>OOS4ydd6g-9Aa_$Ws${Ws6Fz0|USEkulnyRswYM|urnEWUey-5v< zK|YioRQPd{ip*!92N>e3y5>A+Nv3n4toNold<;@)Cpa-}o{A3jKdb?O!_ZABIy-wA ztzaL_l_MAt9Aem+gcuy}HD3IYtK{aB*hzTjXq&0A@uXRXv^;8|0?@Am=!pbiG=C5N zM)McoW~TRnVW3NZq1KJj+xK2C;;K|}6aa~;Hr(bM#K7Rt=}86*!4%lv7!SYq>1?b! zoj=E)44db=!=F?h3B5g#AL`+B*zeH*a^T`<+KZ^BuwjR)kT#^@EDMz<=4WrL{?JQL z(Midu5k`G6nx|MAl2Y&qGSM%%J)+Yw(FWm|z4fu4I z{{3wjNT2C$ql;!i*H5F{3gKU*q?bZrK0;+SlBwYIPElp%gqUQ} zu~PZr#qYvYE(y1#z$@vrcmgY2xRG0o>lUpzY=8Rxlo4QAjRJzT;NnCL<(mUbSdA4= ztVE89jFFMl`L#!Zg%3PXupV$V{iK<4bVwi2|NAg#!f#s}|6Tho-?jh$0}cQ0{CR|dmG3a^sq@LvxXZ)+3$dF}+2P(mIEWS<*7dvo6~{*oVgRl! zQj7D|**X2unoU|<->1K~fm%Nsb}uww1XK5 zPTkQf9B`IX6+xXBtW=vbHP=GNFEGLjjx=4n!T8k>P0Dxgg)8?1odzkeL#&YQ#Ot0b z=PB19V^dl>CF9vFxxuNE`{qHrf083@(u~2?E+QAb|ND4Ak^;V`^p(&%y!)wtA0#DI~1sjPy=Gl=Jk_LKV+s!Y^j?t@%~H!tX2)H zm{hZ!i~RL`v`e690}D)}3FD}V(vmxXyhY%K5Guq{_Mv9?v2lT{bOWg4Zu^7y1ar8n zmAHd)JADf~14}K&Kd>r_R}_x(PBD?%GkD@IDUklYfy|?y1BVdi#9312{)remsr!-H zjW0tu#v*ygyWbLt^s5_5MkpYWOUgiCwk>cCafD`_APTvKBz%WJjzlS-G2A*dS)qkQzz504s~eJE&!(*U_>0mr$HykbwGNoNWwCEjL=c7M*D!Nb`PH zx2NPxryn>XZ%|N7#-LQKLHw1-kG_2=QJ2=JLW=C*nydd_?z&Q5N}%86-u%7SV*Gb- z@Bf(i5)`(qXJx-{k|yJdb?lP{@*FHb*?$CWe>MafB>S6?GqJ~&cUG(*a1pK4j zcf{!2#D*VPQ_jByclkm!s~C_7tTThdil^s=WdwIgp0IA$=lH>9hCTx z5Xr)>@*R|x(DjaQ$DHV74NS`Whn+KWt~fSy84>OBxriMf6kUU4Q-kS1l88`oJ;U37 zBQ0WgFx`l;cSai&{i2YGMjA#*3na}+e^znG8aHDsy4bZf z{#LURLOT3~vp8(Iz0R{4 z(_8XLA)?)amfcWVTsCQ-sSBOwSm)13fLBY`sl!Db%2|ifT=q zA}^pepW;deI;)PQ&|m^3N#3nC$*tDKC&*TfWst8|sxfW&I?b{?nN`JNk9Ca(mhRwR z;e*YDD(uF0O__g-j`;qano_bd|GzAsI+Vubzr}$(&aq;>^uHkxZUTeJ#UKKb;6ZDm zXJ;v)Dg@N3+lUox9T)|rNJr_O>1gvqMG~O-x)ZQ{39k$k* zrcOGGtVyrDyF9^lp_*9wqZg(DHLU6pbt5$?+x}t^@`ZWLSOY9S8qUS0f_DMG--u2U zVVx5|fL}q@Sl3A;632wqbUjvV!&-8wpc7-pG>olAC=&9uR9P+aLa{6Tryv9JHBdyU z`QqpdCu5x$noe5^wes^G-+w6U9@E!NDHQLKi5hO!OIh=Gi{cttNKdQZov`>`$0}qW zwz3-)$gk3`583rGJ_}20tDDcVxc&m|+f<1AbLy?n*OZa;*e5mRaNf1g%?~}~d-9qg z)YnEg7G_l=&u9@fFIBKaalRbC<3=@@*feY>lRsNADQ15TvdRTJZ<)eCYVPqzdL=Ef zN5(>Vd%-(d`|e!KyLWUEG);_E!J-fhAOl=zUcrgVX1&hj`Zz+wvF9Oz%X4gGuONcH z%h?(;os*+5gzz&rd5$4ULvA`P^W&(9fPMjG4QPG?KhaXi@O6O|U0j#gaaIq8)g2TV zw^p{f?V!a@N*#6eiN&o9wm34rAKw#f?N|a+zzc!gN;w?_aaFF$hD3`u9UipKy2=a?eobQF_M*REf$ zj;+{$jx7^GXy!mmwnHMf3B}G*11Dl+ur+U$HV>=|*rWme??d4H)D^+~34-e<&T4fK z9ektGZMEA`+wEVx>}pcQ8=?b3U&4M_&cEw^b7&G~t`IahA*>38X=Dd9PK+d+v5AchxFfgIsaho z3^g-d&4HLt@zfMHx9?onm0BKMiye@&M25!d0|j0nObOP+ni%+TRkv7Sys6+6#71_3 z=3c}|gh*XvU|-!JP`?&KXx|m7=3b=XOQhwATD=v29v@f&3!tGPuaC{Nnek)Hkat;U z8D}L&CC7!O1(_;b_eTUDwOd6z&YPOQpDHX}OEqX&rqBLxbi6Y+6raWRuS~FCMLRMt z&#=5pIeXB!uFvv)dfz7vM;+QgV~i`G1D= z-T1{F=Svc>DCY7thwMnMEmQWBpxlHg7sL~EN*8FEl-J$-QY%K%J<1cYy3$KV zG+EM%8p|KXJPMwGyQmer(9LR9MVP?GkZ=w}PhCJq%Z)LsM&!Gw6`W|6YLt|VXVknn zG+d8xv`&o*XpcrIyO?E>GlQ59W6fo)hgdm&!us+gk&~Z(xzd@ocd|b&VXN{1iqTsr*tppm%|xZev}kgETo?Ip)PrPEKQ`fJY27Z?+iQ zPb+`K9I8RYFXR$~Ml+_RwfhqjPI$G<^2eQukio^mMUAfca=8^`P$}-3av))0#reBX zJO?KRoQN}PfKy6EWE<${E5oA4psTIXI5R3P!`afUEO#@F#cW6?SdJ)pjcBxn{HXms zby#DnxcBA!a)&`0rbZD2SYTN$P0#hKE_J>aS6t>Fk>J=OkHFT(x{~rHi3m`WL<=kn zYqLhsunHC_IFkJ)nD=}RTK!-#DyN3zk?9q}WQ|y1rKvmlPWbjHi7UlXup~E2|PJyPAGVueL7){V%z~!0G zXAH|iVbtT<`S2``Tz}5WNHpQkL-$|7{gJQRQ z{~K-@lS>`6>%9heUPf-y_RL%GwF=+XQ~OK*X5E^AVS9Hz$Yi?j*y$}A5lRJRSrKl( z3QcA!z)W=;sR?}0Mz~&?X z!oKp_GaPNka5j@l=_W8i_Ofa*C=4c}Wn{Tg&f#Kv>KXE-R$KfXiUCcU6VXc% z=8i?pTr4YAqN+|9NHN6(T6PSGByZO+A&`CaMYXfh0S?fVLF)`1*NWI$0?QTU>kd1; zGzWn5_-2B({Gn)x14cpGBq|78lCZr3xPjhMM!`-370O&|EV~3vDVO@igfR9m|9LnF``CmprMnO!UW=7QAFV7bZS z&97u9G63r&&SVh|)l9V;7LLGCY8;X~D^VDNon%jj$@1u7VD2c4OvIF-u>sc%Ihq#3{;M1c1{1p*hfy2MCQDBv0zVR>fl{I|lfOf;-g+=$^M zq0Rs#+yN#^6GhBtw92LZA^WH9cMTdqHT|aKv9`5>skD<(_o8oU-&XLEN{BSkLfhlzuyX9QH{N}qaK6~?EU{Kz zFf*F$WS+nvgybofAOzsSJB2OZAEG_m7vlWn+^D;_jaN7gg(HGtYw~px zw}w`idAI|sf^=i2^*GKT7v~wW-*+2JZJYOB6^uJwuw86RE7aIFD9F(*S)1|L=(x*R zBloIwb9(ht1|YF%8f9femH5?zGAQAwWo zyqo4TV2R=B`U<5m8wAeMHEHpWnOW5wp)I$xr(kkl)R;Oi0isun=y}c-l7LZ7m;lm$ z$q4Iy6Sc&$7dUfcx*n3=`*`*UR zN1JtLOUYS-=7UaFQks;9^B@e^CN+Pz{Jd$gh_F`j>;ZkK-Md1}-@#73aDFjIwBy*d zTlwKK`nqGu3$(>F?Ap8A?q4y9mka`bxGNnAlZNNKWA&(V)8YwF5nmp7j%ul`_QG%4 zaeXBNd7~ytMg3#Xf>6W<>tYbEa%-$6=;P^Sh>aUHZ+e~0RG)Xi3%`rEs8MS8uYqwNdw4SWVkOjZaf` zG5VfUUiPoOG}N6 z<{qp@h!mly6=>7I?*}czyF3Y!CUIt=0}iD^XE&VrDA?Dp@(yuX{qsEJgb&Q}SNvXl zg?HrA?!MH-r4JN!Af3G9!#Qn(6l%OCA`)Ef2g8*M)Z!C4?WMK9NKh2jRTsnTgfut9 zpcZ7xAHd%`iq|80efZ31m3pN9wwBIl#Hqv=X)1r?($L>(#BR+)^)pSgbo+7#q<^S1nr$1&0=q$@M&POX?y?3L&3X z!%^Atu025LgEZ~|-)Cd0=o8K9A{$sT;SHj3M?l{!Er;st5w=T=K2^hJ<$(>&P!j2m zy3~(Qm?r5vh*EGKNLnP31{fhbiIU~c2GX_wqmM}ik7)NF$bEYKH^bK?MD+uJ24Qa=6~Fg-o!gSX*ZYoo{fzTLs$371<;7oLD|PiS3s zz;aIW1HVCV2r*#r`V-0hw_!s4!G4R|L@`u_;)KA?o(p8@$&bkWXV*taO%NC3k? zok=*KA5vswZe|5QOQd*4kD7Db^c|__5C;&|S5MvKdkPtu)vo}DGqDpc097%52V*z( zXp%Esq4?Rzj53SE6hKu;Xc!&LMZPPIj;O-Gnpq&!&u5db7Xi z64ox137#@4w5it68EPn<8RO48KG_2>?+Aa}Qo7fR%&wXJNf2J;Kwm6Opddsyx$gY# zU+b%y*{cBju|sw!wOcY_sMFWX9(C02d(;_YQh1*sH9?j$%`tKJyd(j0PtK#D+KLHI zL;b*n{CZ7IBb}MUGdG3l2vFGJn3TOYJD$Hz2OOy*%!5a{!!0mvok+e+N zaP?Ndm;SO(8-v%yvu#Rr;qFSgZrKJxV^uEnX@L(r4)dZeyh@yRqoi@3M|#Hz`hHN6 zA|8#&oFv8+1F8t(#j1%Ywdn%N2uREt;@bFAF}2zeI2KE&uZr$?-SIwKu<5ThXn_}f z`@RRcJ!3;pKi>mQe)VU5;c)zA@b#dd(J?}$sg0K5L^fIm8%TV4|>Q?qdfMwAh4AM8l8J|tiSF32B4q`!TYj_z!4Lowq99lipY?vlC zJssf0Vy+@In|fg`2sUl$wDGr$XY+4g*%PhDjM^G!Z{H44gwY-ymOqXka)G3ulfWdY ztNvx4oW*}=5^&NGhiS)Vzwb4;K`^*tjj8h$esujKb7&}?V_cU5kQElGgCL<358O^% zcT-EwP>hqb1%_8C_5R4e#7RH zp@tA$bVGG}q@TDR#-_^YT6}Zo5~p_5P%C_pRxwhgkor!;FtNFF#cncoEHm=#?xtY0 z1dHK{(;)5CQJ`0upxdRV?(5PH{JISW%d+@v8FmbTh9n5TXGnM`Cs}{(AbDxaIg&O2 zg<~{fKtj#r91u9PujPqhkFt7tid?IZ={dML<$3sh;A*Hw=VP++12;lVguAyio!na#kaYeX{|8h3_;g*K=UEf zU*{ZR($$Bw*(h;CSO4{alBraU^)52&nxLKUxg=1N5MCBUJ+3a^`9#f?7=4#`&oz?k zoz-#s4C)f8Uk@S*VF!Uc>X}9M`_*gkn0&GI2R*j zUlHUy5b;rLro3?bBLIt%dRd~2lT@kjcfY~OL5ZmTl)ExZyt!)^K#1p>U~rdclk``e z>=zHu6Qp^z%nX2U*RE14f{$U0*Cf)LfBz-c)t%iD%3wxsgHpRPvieqZgEC0IX_Vkd zxh27*KXpXxYD=^PP&EtX{NlX zC%v9)Wz6De((qH}Jqg-g`mwJ!IZ^L?eE2PE9@#9U0T>jD%e^K8-Phz7cZ-bP zU%h91CvGtNYmE{gk=tex+96fK^!I7P7YI3Ma}h)ty%NEN zn}d&kVV1DM4tPht`B!poikUOE396Uy+VE|E*eQuq zoT8M0M&bcREYOX7Q)F5+d!xec;2;H!WO+!r;v#uo402OEt*q%vj)mC@8wg}HO02G( zYG=<5*Vgl3R(5)N@{y+rvBY9CgUHeN`qQLm*3;$@Ez|2z2j3@V_m6j4Kc{5MTf}GG zMS_qp%5n(5$y|Ke#!!7w$4KKAJmhA@sJLcoS}Mv+l^X$2DS9H)ezLP0LfVpNMIPwL2U@Y%%7Q7jPXmGSPlRwa7*y~EkqObIDtyFm)q z-D~m~?At^+db`FvO2uEi2FuK@`RaSN*`T%G!}yA5f-hG1SYtty+Q}}`O^In~cgi>l z=zXVDDNVH?QHtgup3*d46+OEicA^)pIn2`}B}8}{g`msSbzzvq5zHCIjU>OrtmbrG zU26iOxr*A6%_LC(|3nH@ef$16q%glnTl}ob+(w=A9Uk48Pe(F^%ktv(oHC2Ve4|TE zc6J5le1ZqXdLP~+(UY@`Y?r~{B6_Alh8Q{OmhufQSf94*GFtAi(lV<=!6wqxL;jck zOnpR+=HK3Nh}Vv}%LXPzn;0b#^5Afk3y&G)X}NEkE`~TM%tU-P1@^=msCxOyP!IRO zBegW5wZ@10CM!9*_|kF~ZSxrk>r^zyCL|dy9$~*`OX?>1)fL1l(|lW|G!``CEq!N$ zMM)W~G2zDb6wA#)D5OmIMu_&UH_5B%DJ#NKl#R!?QVz>y5jLrK(-JpI6LIGVyD%W9 zg+7;cE40;Rcv9 zkCrUgZ-H}IaC=aY8~7*9+Ny?O=Ep;yso*#-SesEGSa3T&e&DQ`k!p#Zgb<6@KRjgn zG+Z?LoNstww}#+R`Y(?d>>GG^ncorkoKX@REYSTD zQTYHMwNiE~9MM(>u%!3KVR=O=by_thqeFR&Bm;D|lW@>^unOrb^k9yd-=S2LH0S7} z>ae^bwruKEB*7m=)u$5MIo(`)Y+RR5o>9(DDDV623UMVck1##|b`7H%yjK9unoDGkVIKrG*dvN;2S3P_9>ckR6c?7n{s5v!i;dE&<_aDaPA_ zi>Z&SHW^bWYJr-2sb7{WC|0k-a}7>k3)*YgZora(7dVnK7b6?Y7U|>t*u=-aLgC3` zvnz>+QQ_%r^ePEJA5X6^`Ey@^#{dDW(QZr*A_L9Y+QI4?xFXAQ-JDe?&YmeAVN{2b zK0DO+&S-fQWDg`ab0$mQodAEemrA3p{cHbqx{yVqz5Ns6)Rixse^k(i5spvs@22QF zAhsD~>)rC%n(#M+D1!s?DFCBTRfNF~`N7kC8by+1samiHH9dbid%Masz0;p`l^GuF z)taCc0FD9!#^qP3B`G>vZA2db%ma*@6WNWW{*kPq^|f^R%Ee|F-FM69H)u|#Qt{qt zoi{%@b&~<}!vBf99Ef=ih~RNSh2LT6zvdLf+KCi=hu6#d5v7kpppM&Z;F3;`{0FxW z@#nY=LnIjx1?~XD?48~y)>Y&odjWF%6G64~A_3<{rx6>R zqF2ozPyJzzmcF+3AQwJQ@C?KEo|5k3xP%;^ZN*zpQBm5ho(*e)*zn8NzzzG6V?5V0 z2<7tkys|TInay6or7^K(y0ZdwJz|6$blXL}SX7s2es~5{gYwS3d>6k|3V9vz-#G3! zh@|-B?^JP~seJrS$&XAfp`RknZ!pFw@e!a9WgKijDz3K#6@`ifTCWHTa}Tr}n!~;0 zh0~X4_sEKGZZ^}8+X9!T7NazNv{%@nJgpJ8M;Oa zaYo_2Qbk6_j7W15!`+XKC!`+_)IGZ>r6X=buKUkQ*5wXs5}A2D@eYvF0{q(=wm znxEYB{>rdO75{|gy2>`^UB!(y+9acVVRieAMG@Lhf)g>yr+Ccgf8oy1qUO@L$n8@A z;nKV>muW=<*rD@Su=A?nhxTpx>?1>jYOk(ytb|TNwq8q1{;WERaWZi0ov0xFjiIm} z)PkKhn`#2CSuR?p?4)9Vk#`#oL)#q8!B*j3s+x*6kQ~2Pog{K^{k(=xfv{IP9MecW zCB_bMVE;HQS12k5L;tHHjhJ8m%07IN<1N(vQCG+8IilmMo{g$Y5nrPhSx`OH03*55 z;^!ZP!KR|h3~K&8O?uAqKie(}FOYVMt}S-M;FF6%#pX@C<8P!jbk&G&a^_Oj+^2Ys z*1tnnx4eOpd*hgE$xD+(iTw1TaGNs=4*;Pf#P`fd%_%)Jk|eeooma)pR9ka)Ek(PX zq2N$R8sio=D*TQ0BaO+M*8wF-0cR8Bq6vZjr?NAFhjQ!V_)x?Yxmhd9T8#bPWJ^p2 zVbs{=P2C~;GV>Zlkw%u3?OM9&TE|2xMT@t3uSiNEt`MOO*Q>52Wh>pfXJR}YW6XQ{ zJfCN%^ZlJU=RD7Ip3^zMKT-4Q8#0faYOd#r>yK58)sH5XCS>Yj%p1^_p%gSNX4Iai z%;dio52O@`qrWD0>K#6CJvdGFcB%`pA47@W5qIzGe`HRY=O5CK4bZvl6IkJj{#%r? z|A5O4Uo8)Ng;t9f!sRAIsl1a8=TST_Vn(m0i`>XCa0r`>YP-LwxB%^wu8;8+GdQv( zG^usXB?ocI0_)y0MR`T!?Us5ehia8>M~+$sXlUCRovE--QR@;Ys?Ozq9P(Q7ZQ43> zpIo}_{z39UhS{5f8wKSDu+TKfi+#n{O-~4Uk zh*EmSxYYrfwOxCYV}}!zL%2uIc%Oe$XRV@rFeWeka?;Z(XI{}`X?HJGyIgFm@ZX;w zsc2~^A%MTLdqhpoV!jr)}36>dv>Px$jJImpFCzVcs)1b7l%&=qcE;^ zEoSbtk#6sYkpC=iQX(3 z5EUP%LDh0p49U2=$~DIZhi;dDRKwLN8`|PiC-Echa#PXZ|6)S}wWEA@3f!rX>G_!A zphhlmxu@3JVRr3xOWD}*UYv04{*WHt*vT;0@pVLmuu52Mb_Vg9Wg9EUuA2 zl8?Jv5GSU+*{PO$tBpirns`>?!VL-cX@gZO&q)OL%2_8U)8r*4jrGrH`p2zV!T-&| zaf{j)uCI!{A{R9~aJ?$SZ?kk?jfE7FM%1sOCd&S0B(^ckufHtAOetsuspYrqyZ)x8Z8=dG=GG1lcFtKmoxl{>m zAakHGc|f5ZKh>>}F8qu)Y29d2Op+uf?qK|dKPwE!pPkfGl#Sa#?TmJfv}jA5;1`#= zQqplM=!3^!2QZeCx7wu8uWl9!IN85^zrmqGDxsj;TVs=EU)ubiDaD<*@ss- zm%Y-l)9@TN+_0W7Ml5XnEz>_ep>fFIL{5V-n#cCKFhy#0p;!@D!D-=e{(8;*$#2G- z-~F3cHNv>%;D819xg3-F_yHg8bD1W}{1-kQ-da2kMRP?r=@>BD^b5H6=`Lf3y6VPn$`%)-GW}O^kSon7EBP;q9?=n_7O67v9pc>!pQb z)auPuaqG5v3l(E)_GSI_vFY2BtlPgw{(hIMip%d;>9vWnej@q%qMva4iRPI|N7n7w z(!_tL^K*((d428fyiU(eFYzyaICWGnFx_T^a$3(A4p<5kwVtGjOSNa=ey z3;wiIDZDmghb8BsMcSVyT9^W#{YkoGJ9As)0ccff5 zB`U1^TKO@jql!utGX7_6ceT=$mJTWcQ+7_Fk7=jIE7Lu2Ja%~~6K=X$o@5Q7)=`Ao z%Vptz#p~F$l82kO>0*a`LQ8HomkN}$Q0{w8GzfUMX3_$LbiUMT6?eJhshLtmT2m`2 zrK@zuUt8C6$2Zb?u5HM~2xm~H)s1rOJ^3v#{cdG~?xM<+6Lrd(chPMthvmtIcgJoV z-(H!YsUD=t^F)QFU+e|WYBXo`#ht!`&flPI?tga}(nLX13WI~;V?XO(57wx&_pbkw zBgcA$g+wx2w|Xvakrlw=n~x7nWeO7*SwR2(p1`8M*~Ae34SZ&}#$zt|Z%!C%XpOXbpLFv5`sjlu|+#!Pgo9FXG>J~QZn(O%YH zBWQs46dZC)E;!SviJp zefD-koJ?SaKCq_$3t)wALZM_9CQK zGw9iXX^iWLHTQFmME^y==>muB0FYBWAg>aJ#z};63aHSV~ z^&BI1Xx6m%m3k8-P|$7QUIaSpT%uDW?OD?BB+n%~l7+?9t%+Q~hX?=}`?8pcPE~ed z2_t~uEm#W0-QN{N#+ApD+=zZSaBm3ob`3@h+u^Gh4ttNN2s$sX!nzuwp?JOsGoHwj z2@l5>ME8YD3`fUA=$RfY>9hSG4D8@onJ^lTK8T>xz1g7`#v+8NaNr$;IubZHjA0js z2L>_#pi_KLjIjbU(W!eWi-1dyWY}RDad&1C;~9SzVCP+CjBSB%W;hBDGdrDHyErp5 z5X#cSZWs?oRzdJKA&bh!#B=h>1`ELv5fGsjM;8grEB_Ml5nw!Q?T_Fy!`b1Xw-Oi& zJK7`IPZ8{}^QU`YChTvFFb$*GF~83#Ejd(!t%MOOCWZs*(#FDY@nJtyM5ys3r$RH; zGwY5D3&8G^h`_zm90;)SqJ))TM><4FJcR=#j{NChP1sZn(R`H3fhIePF<1&VWkIAq zW^y3K#-asQg8eTLr4LygD9v;SEK4^GSPFI-K%^#fIhF$V7sl;-&O{IvfwyiWBC85G z7MZzT=Na3;D)1g*L}lf9j#XxMO|l*@z#B0U0n~;6Q((CogEzq;QX^ml3_auK-QH(! zYRlFYydetV8<%jvXTLoPZWwqE2_hCzy1W?cwt!a;Ak6maMa=Kjv3M;3Tu%5uArNL? z-SSL!&nS5679sOBE+%t6kqdtVcsdc$>26x21CM6sb)#h-?QyJ literal 54329 zcmagFV|ZrKvM!pAZQHhO+qP}9lTNj?q^^Y^VFp)SH8qbSJ)2BQ2giqeFT zAwqu@)c?v~^Z#E_K}1nTQbJ9gQ9<%vVRAxVj)8FwL5_iTdUB>&m3fhE=kRWl;g`&m z!W5kh{WsV%fO*%je&j+Lv4xxK~zsEYQls$Q-p&dwID|A)!7uWtJF-=Tm1{V@#x*+kUI$=%KUuf2ka zjiZ{oiL1MXE2EjciJM!jrjFNwCh`~hL>iemrqwqnX?T*MX;U>>8yRcZb{Oy+VKZos zLiFKYPw=LcaaQt8tj=eoo3-@bG_342HQ%?jpgAE?KCLEHC+DmjxAfJ%Og^$dpC8Xw zAcp-)tfJm}BPNq_+6m4gBgBm3+CvmL>4|$2N$^Bz7W(}fz1?U-u;nE`+9`KCLuqg} zwNstNM!J4Uw|78&Y9~9>MLf56to!@qGkJw5Thx%zkzj%Ek9Nn1QA@8NBXbwyWC>9H z#EPwjMNYPigE>*Ofz)HfTF&%PFj$U6mCe-AFw$U%-L?~-+nSXHHKkdgC5KJRTF}`G zE_HNdrE}S0zf4j{r_f-V2imSqW?}3w-4=f@o@-q+cZgaAbZ((hn))@|eWWhcT2pLpTpL!;_5*vM=sRL8 zqU##{U#lJKuyqW^X$ETU5ETeEVzhU|1m1750#f}38_5N9)B_2|v@1hUu=Kt7-@dhA zq_`OMgW01n`%1dB*}C)qxC8q;?zPeF_r;>}%JYmlER_1CUbKa07+=TV45~symC*g8 zW-8(gag#cAOuM0B1xG8eTp5HGVLE}+gYTmK=`XVVV*U!>H`~j4+ROIQ+NkN$LY>h4 zqpwdeE_@AX@PL};e5vTn`Ro(EjHVf$;^oiA%@IBQq>R7_D>m2D4OwwEepkg}R_k*M zM-o;+P27087eb+%*+6vWFCo9UEGw>t&WI17Pe7QVuoAoGHdJ(TEQNlJOqnjZ8adCb zI`}op16D@v7UOEo%8E-~m?c8FL1utPYlg@m$q@q7%mQ4?OK1h%ODjTjFvqd!C z-PI?8qX8{a@6d&Lb_X+hKxCImb*3GFemm?W_du5_&EqRq!+H?5#xiX#w$eLti-?E$;Dhu`{R(o>LzM4CjO>ICf z&DMfES#FW7npnbcuqREgjPQM#gs6h>`av_oEWwOJZ2i2|D|0~pYd#WazE2Bbsa}X@ zu;(9fi~%!VcjK6)?_wMAW-YXJAR{QHxrD5g(ou9mR6LPSA4BRG1QSZT6A?kelP_g- zH(JQjLc!`H4N=oLw=f3{+WmPA*s8QEeEUf6Vg}@!xwnsnR0bl~^2GSa5vb!Yl&4!> zWb|KQUsC$lT=3A|7vM9+d;mq=@L%uWKwXiO9}a~gP4s_4Yohc!fKEgV7WbVo>2ITbE*i`a|V!^p@~^<={#?Gz57 zyPWeM2@p>D*FW#W5Q`1`#5NW62XduP1XNO(bhg&cX`-LYZa|m-**bu|>}S;3)eP8_ zpNTnTfm8 ze+7wDH3KJ95p)5tlwk`S7mbD`SqHnYD*6`;gpp8VdHDz%RR_~I_Ar>5)vE-Pgu7^Y z|9Px+>pi3!DV%E%4N;ii0U3VBd2ZJNUY1YC^-e+{DYq+l@cGtmu(H#Oh%ibUBOd?C z{y5jW3v=0eV0r@qMLgv1JjZC|cZ9l9Q)k1lLgm))UR@#FrJd>w^`+iy$c9F@ic-|q zVHe@S2UAnc5VY_U4253QJxm&Ip!XKP8WNcnx9^cQ;KH6PlW8%pSihSH2(@{2m_o+m zr((MvBja2ctg0d0&U5XTD;5?d?h%JcRJp{_1BQW1xu&BrA3(a4Fh9hon-ly$pyeHq zG&;6q?m%NJ36K1Sq_=fdP(4f{Hop;_G_(i?sPzvB zDM}>*(uOsY0I1j^{$yn3#U(;B*g4cy$-1DTOkh3P!LQ;lJlP%jY8}Nya=h8$XD~%Y zbV&HJ%eCD9nui-0cw!+n`V~p6VCRqh5fRX z8`GbdZ@73r7~myQLBW%db;+BI?c-a>Y)m-FW~M=1^|<21_Sh9RT3iGbO{o-hpN%d6 z7%++#WekoBOP^d0$$|5npPe>u3PLvX_gjH2x(?{&z{jJ2tAOWTznPxv-pAv<*V7r$ z6&glt>7CAClWz6FEi3bToz-soY^{ScrjwVPV51=>n->c(NJngMj6TyHty`bfkF1hc zkJS%A@cL~QV0-aK4>Id!9dh7>0IV;1J9(myDO+gv76L3NLMUm9XyPauvNu$S<)-|F zZS}(kK_WnB)Cl`U?jsdYfAV4nrgzIF@+%1U8$poW&h^c6>kCx3;||fS1_7JvQT~CV zQ8Js+!p)3oW>Df(-}uqC`Tcd%E7GdJ0p}kYj5j8NKMp(KUs9u7?jQ94C)}0rba($~ zqyBx$(1ae^HEDG`Zc@-rXk1cqc7v0wibOR4qpgRDt#>-*8N3P;uKV0CgJE2SP>#8h z=+;i_CGlv+B^+$5a}SicVaSeaNn29K`C&=}`=#Nj&WJP9Xhz4mVa<+yP6hkrq1vo= z1rX4qg8dc4pmEvq%NAkpMK>mf2g?tg_1k2%v}<3`$6~Wlq@ItJ*PhHPoEh1Yi>v57 z4k0JMO)*=S`tKvR5gb-(VTEo>5Y>DZJZzgR+j6{Y`kd|jCVrg!>2hVjz({kZR z`dLlKhoqT!aI8=S+fVp(5*Dn6RrbpyO~0+?fy;bm$0jmTN|t5i6rxqr4=O}dY+ROd zo9Et|x}!u*xi~>-y>!M^+f&jc;IAsGiM_^}+4|pHRn{LThFFpD{bZ|TA*wcGm}XV^ zr*C6~@^5X-*R%FrHIgo-hJTBcyQ|3QEj+cSqp#>&t`ZzB?cXM6S(lRQw$I2?m5=wd z78ki`R?%;o%VUhXH?Z#(uwAn9$m`npJ=cA+lHGk@T7qq_M6Zoy1Lm9E0UUysN)I_x zW__OAqvku^>`J&CB=ie@yNWsaFmem}#L3T(x?a`oZ+$;3O-icj2(5z72Hnj=9Z0w% z<2#q-R=>hig*(t0^v)eGq2DHC%GymE-_j1WwBVGoU=GORGjtaqr0BNigOCqyt;O(S zKG+DoBsZU~okF<7ahjS}bzwXxbAxFfQAk&O@>LsZMsZ`?N?|CDWM(vOm%B3CBPC3o z%2t@%H$fwur}SSnckUm0-k)mOtht`?nwsDz=2#v=RBPGg39i#%odKq{K^;bTD!6A9 zskz$}t)sU^=a#jLZP@I=bPo?f-L}wpMs{Tc!m7-bi!Ldqj3EA~V;4(dltJmTXqH0r z%HAWKGutEc9vOo3P6Q;JdC^YTnby->VZ6&X8f{obffZ??1(cm&L2h7q)*w**+sE6dG*;(H|_Q!WxU{g)CeoT z(KY&bv!Usc|m+Fqfmk;h&RNF|LWuNZ!+DdX*L=s-=_iH=@i` z?Z+Okq^cFO4}_n|G*!)Wl_i%qiMBaH8(WuXtgI7EO=M>=i_+;MDjf3aY~6S9w0K zUuDO7O5Ta6+k40~xh~)D{=L&?Y0?c$s9cw*Ufe18)zzk%#ZY>Tr^|e%8KPb0ht`b( zuP@8#Ox@nQIqz9}AbW0RzE`Cf>39bOWz5N3qzS}ocxI=o$W|(nD~@EhW13Rj5nAp; zu2obEJa=kGC*#3=MkdkWy_%RKcN=?g$7!AZ8vBYKr$ePY(8aIQ&yRPlQ=mudv#q$q z4%WzAx=B{i)UdLFx4os?rZp6poShD7Vc&mSD@RdBJ=_m^&OlkEE1DFU@csgKcBifJ zz4N7+XEJhYzzO=86 z#%eBQZ$Nsf2+X0XPHUNmg#(sNt^NW1Y0|M(${e<0kW6f2q5M!2YE|hSEQ*X-%qo(V zHaFwyGZ0on=I{=fhe<=zo{=Og-_(to3?cvL4m6PymtNsdDINsBh8m>a%!5o3s(en) z=1I z6O+YNertC|OFNqd6P=$gMyvmfa`w~p9*gKDESFqNBy(~Zw3TFDYh}$iudn)9HxPBi zdokK@o~nu?%imcURr5Y~?6oo_JBe}t|pU5qjai|#JDyG=i^V~7+a{dEnO<(y>ahND#_X_fcEBNiZ)uc&%1HVtx8Ts z*H_Btvx^IhkfOB#{szN*n6;y05A>3eARDXslaE>tnLa>+`V&cgho?ED+&vv5KJszf zG4@G;7i;4_bVvZ>!mli3j7~tPgybF5|J6=Lt`u$D%X0l}#iY9nOXH@(%FFJLtzb%p zzHfABnSs;v-9(&nzbZytLiqqDIWzn>JQDk#JULcE5CyPq_m#4QV!}3421haQ+LcfO*>r;rg6K|r#5Sh|y@h1ao%Cl)t*u`4 zMTP!deC?aL7uTxm5^nUv#q2vS-5QbBKP|drbDXS%erB>fYM84Kpk^au99-BQBZR z7CDynflrIAi&ahza+kUryju5LR_}-Z27g)jqOc(!Lx9y)e z{cYc&_r947s9pteaa4}dc|!$$N9+M38sUr7h(%@Ehq`4HJtTpA>B8CLNO__@%(F5d z`SmX5jbux6i#qc}xOhumzbAELh*Mfr2SW99=WNOZRZgoCU4A2|4i|ZVFQt6qEhH#B zK_9G;&h*LO6tB`5dXRSBF0hq0tk{2q__aCKXYkP#9n^)@cq}`&Lo)1KM{W+>5mSed zKp~=}$p7>~nK@va`vN{mYzWN1(tE=u2BZhga5(VtPKk(*TvE&zmn5vSbjo zZLVobTl%;t@6;4SsZ>5+U-XEGUZGG;+~|V(pE&qqrp_f~{_1h@5ZrNETqe{bt9ioZ z#Qn~gWCH!t#Ha^n&fT2?{`}D@s4?9kXj;E;lWV9Zw8_4yM0Qg-6YSsKgvQ*fF{#Pq z{=(nyV>#*`RloBVCs;Lp*R1PBIQOY=EK4CQa*BD0MsYcg=opP?8;xYQDSAJBeJpw5 zPBc_Ft9?;<0?pBhCmOtWU*pN*;CkjJ_}qVic`}V@$TwFi15!mF1*m2wVX+>5p%(+R zQ~JUW*zWkalde{90@2v+oVlkxOZFihE&ZJ){c?hX3L2@R7jk*xjYtHi=}qb+4B(XJ z$gYcNudR~4Kz_WRq8eS((>ALWCO)&R-MXE+YxDn9V#X{_H@j616<|P(8h(7z?q*r+ zmpqR#7+g$cT@e&(%_|ipI&A%9+47%30TLY(yuf&*knx1wNx|%*H^;YB%ftt%5>QM= z^i;*6_KTSRzQm%qz*>cK&EISvF^ovbS4|R%)zKhTH_2K>jP3mBGn5{95&G9^a#4|K zv+!>fIsR8z{^x4)FIr*cYT@Q4Z{y}};rLHL+atCgHbfX*;+k&37DIgENn&=k(*lKD zG;uL-KAdLn*JQ?@r6Q!0V$xXP=J2i~;_+i3|F;_En;oAMG|I-RX#FwnmU&G}w`7R{ z788CrR-g1DW4h_`&$Z`ctN~{A)Hv_-Bl!%+pfif8wN32rMD zJDs$eVWBYQx1&2sCdB0!vU5~uf)=vy*{}t{2VBpcz<+~h0wb7F3?V^44*&83Z2#F` z32!rd4>uc63rQP$3lTH3zb-47IGR}f)8kZ4JvX#toIpXH`L%NnPDE~$QI1)0)|HS4 zVcITo$$oWWwCN@E-5h>N?Hua!N9CYb6f8vTFd>h3q5Jg-lCI6y%vu{Z_Uf z$MU{{^o~;nD_@m2|E{J)q;|BK7rx%`m``+OqZAqAVj-Dy+pD4-S3xK?($>wn5bi90CFAQ+ACd;&m6DQB8_o zjAq^=eUYc1o{#+p+ zn;K<)Pn*4u742P!;H^E3^Qu%2dM{2slouc$AN_3V^M7H_KY3H)#n7qd5_p~Za7zAj|s9{l)RdbV9e||_67`#Tu*c<8!I=zb@ z(MSvQ9;Wrkq6d)!9afh+G`!f$Ip!F<4ADdc*OY-y7BZMsau%y?EN6*hW4mOF%Q~bw z2==Z3^~?q<1GTeS>xGN-?CHZ7a#M4kDL zQxQr~1ZMzCSKFK5+32C%+C1kE#(2L=15AR!er7GKbp?Xd1qkkGipx5Q~FI-6zt< z*PTpeVI)Ngnnyaz5noIIgNZtb4bQdKG{Bs~&tf)?nM$a;7>r36djllw%hQxeCXeW^ z(i6@TEIuxD<2ulwLTt|&gZP%Ei+l!(%p5Yij6U(H#HMkqM8U$@OKB|5@vUiuY^d6X zW}fP3;Kps6051OEO(|JzmVU6SX(8q>*yf*x5QoxDK={PH^F?!VCzES_Qs>()_y|jg6LJlJWp;L zKM*g5DK7>W_*uv}{0WUB0>MHZ#oJZmO!b3MjEc}VhsLD~;E-qNNd?x7Q6~v zR=0$u>Zc2Xr}>x_5$-s#l!oz6I>W?lw;m9Ae{Tf9eMX;TI-Wf_mZ6sVrMnY#F}cDd z%CV*}fDsXUF7Vbw>PuDaGhu631+3|{xp<@Kl|%WxU+vuLlcrklMC!Aq+7n~I3cmQ! z`e3cA!XUEGdEPSu``&lZEKD1IKO(-VGvcnSc153m(i!8ohi`)N2n>U_BemYJ`uY>8B*Epj!oXRLV}XK}>D*^DHQ7?NY*&LJ9VSo`Ogi9J zGa;clWI8vIQqkngv2>xKd91K>?0`Sw;E&TMg&6dcd20|FcTsnUT7Yn{oI5V4@Ow~m zz#k~8TM!A9L7T!|colrC0P2WKZW7PNj_X4MfESbt<-soq*0LzShZ}fyUx!(xIIDwx zRHt^_GAWe0-Vm~bDZ(}XG%E+`XhKpPlMBo*5q_z$BGxYef8O!ToS8aT8pmjbPq)nV z%x*PF5ZuSHRJqJ!`5<4xC*xb2vC?7u1iljB_*iUGl6+yPyjn?F?GOF2_KW&gOkJ?w z3e^qc-te;zez`H$rsUCE0<@7PKGW?7sT1SPYWId|FJ8H`uEdNu4YJjre`8F*D}6Wh z|FQ`xf7yiphHIAkU&OYCn}w^ilY@o4larl?^M7&8YI;hzBIsX|i3UrLsx{QDKwCX< zy;a>yjfJ6!sz`NcVi+a!Fqk^VE^{6G53L?@Tif|j!3QZ0fk9QeUq8CWI;OmO-Hs+F zuZ4sHLA3{}LR2Qlyo+{d@?;`tpp6YB^BMoJt?&MHFY!JQwoa0nTSD+#Ku^4b{5SZVFwU9<~APYbaLO zu~Z)nS#dxI-5lmS-Bnw!(u15by(80LlC@|ynj{TzW)XcspC*}z0~8VRZq>#Z49G`I zgl|C#H&=}n-ajxfo{=pxPV(L*7g}gHET9b*s=cGV7VFa<;Htgjk>KyW@S!|z`lR1( zGSYkEl&@-bZ*d2WQ~hw3NpP=YNHF^XC{TMG$Gn+{b6pZn+5=<()>C!N^jncl0w6BJ zdHdnmSEGK5BlMeZD!v4t5m7ct7{k~$1Ie3GLFoHjAH*b?++s<|=yTF+^I&jT#zuMx z)MLhU+;LFk8bse|_{j+d*a=&cm2}M?*arjBPnfPgLwv)86D$6L zLJ0wPul7IenMvVAK$z^q5<^!)7aI|<&GGEbOr=E;UmGOIa}yO~EIr5xWU_(ol$&fa zR5E(2vB?S3EvJglTXdU#@qfDbCYs#82Yo^aZN6`{Ex#M)easBTe_J8utXu(fY1j|R z9o(sQbj$bKU{IjyhosYahY{63>}$9_+hWxB3j}VQkJ@2$D@vpeRSldU?&7I;qd2MF zSYmJ>zA(@N_iK}m*AMPIJG#Y&1KR)6`LJ83qg~`Do3v^B0>fU&wUx(qefuTgzFED{sJ65!iw{F2}1fQ3= ziFIP{kezQxmlx-!yo+sC4PEtG#K=5VM9YIN0z9~c4XTX?*4e@m;hFM!zVo>A`#566 z>f&3g94lJ{r)QJ5m7Xe3SLau_lOpL;A($wsjHR`;xTXgIiZ#o&vt~ zGR6KdU$FFbLfZCC3AEu$b`tj!9XgOGLSV=QPIYW zjI!hSP#?8pn0@ezuenOzoka8!8~jXTbiJ6+ZuItsWW03uzASFyn*zV2kIgPFR$Yzm zE<$cZlF>R8?Nr2_i?KiripBc+TGgJvG@vRTY2o?(_Di}D30!k&CT`>+7ry2!!iC*X z<@=U0_C#16=PN7bB39w+zPwDOHX}h20Ap);dx}kjXX0-QkRk=cr};GYsjSvyLZa-t zzHONWddi*)RDUH@RTAsGB_#&O+QJaaL+H<<9LLSE+nB@eGF1fALwjVOl8X_sdOYme z0lk!X=S(@25=TZHR7LlPp}fY~yNeThMIjD}pd9+q=j<_inh0$>mIzWVY+Z9p<{D^#0Xk+b_@eNSiR8;KzSZ#7lUsk~NGMcB8C2c=m2l5paHPq`q{S(kdA7Z1a zyfk2Y;w?^t`?@yC5Pz9&pzo}Hc#}mLgDmhKV|PJ3lKOY(Km@Fi2AV~CuET*YfUi}u zfInZnqDX(<#vaS<^fszuR=l)AbqG{}9{rnyx?PbZz3Pyu!eSJK`uwkJU!ORQXy4x83r!PNgOyD33}}L=>xX_93l6njNTuqL8J{l%*3FVn3MG4&Fv*`lBXZ z?=;kn6HTT^#SrPX-N)4EZiIZI!0ByXTWy;;J-Tht{jq1mjh`DSy7yGjHxIaY%*sTx zuy9#9CqE#qi>1misx=KRWm=qx4rk|}vd+LMY3M`ow8)}m$3Ggv&)Ri*ON+}<^P%T5 z_7JPVPfdM=Pv-oH<tecoE}(0O7|YZc*d8`Uv_M*3Rzv7$yZnJE6N_W=AQ3_BgU_TjA_T?a)U1csCmJ&YqMp-lJe`y6>N zt++Bi;ZMOD%%1c&-Q;bKsYg!SmS^#J@8UFY|G3!rtyaTFb!5@e(@l?1t(87ln8rG? z--$1)YC~vWnXiW3GXm`FNSyzu!m$qT=Eldf$sMl#PEfGmzQs^oUd=GIQfj(X=}dw+ zT*oa0*oS%@cLgvB&PKIQ=Ok?>x#c#dC#sQifgMwtAG^l3D9nIg(Zqi;D%807TtUUCL3_;kjyte#cAg?S%e4S2W>9^A(uy8Ss0Tc++ZTjJw1 z&Em2g!3lo@LlDyri(P^I8BPpn$RE7n*q9Q-c^>rfOMM6Pd5671I=ZBjAvpj8oIi$! zl0exNl(>NIiQpX~FRS9UgK|0l#s@#)p4?^?XAz}Gjb1?4Qe4?j&cL$C8u}n)?A@YC zfmbSM`Hl5pQFwv$CQBF=_$Sq zxsV?BHI5bGZTk?B6B&KLdIN-40S426X3j_|ceLla*M3}3gx3(_7MVY1++4mzhH#7# zD>2gTHy*%i$~}mqc#gK83288SKp@y3wz1L_e8fF$Rb}ex+`(h)j}%~Ld^3DUZkgez zOUNy^%>>HHE|-y$V@B}-M|_{h!vXpk01xaD%{l{oQ|~+^>rR*rv9iQen5t?{BHg|% zR`;S|KtUb!X<22RTBA4AAUM6#M?=w5VY-hEV)b`!y1^mPNEoy2K)a>OyA?Q~Q*&(O zRzQI~y_W=IPi?-OJX*&&8dvY0zWM2%yXdFI!D-n@6FsG)pEYdJbuA`g4yy;qrgR?G z8Mj7gv1oiWq)+_$GqqQ$(ZM@#|0j7})=#$S&hZwdoijFI4aCFLVI3tMH5fLreZ;KD zqA`)0l~D2tuIBYOy+LGw&hJ5OyE+@cnZ0L5+;yo2pIMdt@4$r^5Y!x7nHs{@>|W(MzJjATyWGNwZ^4j+EPU0RpAl-oTM@u{lx*i0^yyWPfHt6QwPvYpk9xFMWfBFt!+Gu6TlAmr zeQ#PX71vzN*_-xh&__N`IXv6`>CgV#eA_%e@7wjgkj8jlKzO~Ic6g$cT`^W{R{606 zCDP~+NVZ6DMO$jhL~#+!g*$T!XW63#(ngDn#Qwy71yj^gazS{e;3jGRM0HedGD@pt z?(ln3pCUA(ekqAvvnKy0G@?-|-dh=eS%4Civ&c}s%wF@0K5Bltaq^2Os1n6Z3%?-Q zAlC4goQ&vK6TpgtzkHVt*1!tBYt-`|5HLV1V7*#45Vb+GACuU+QB&hZ=N_flPy0TY zR^HIrdskB#<$aU;HY(K{a3(OQa$0<9qH(oa)lg@Uf>M5g2W0U5 zk!JSlhrw8quBx9A>RJ6}=;W&wt@2E$7J=9SVHsdC?K(L(KACb#z)@C$xXD8^!7|uv zZh$6fkq)aoD}^79VqdJ!Nz-8$IrU(_-&^cHBI;4 z^$B+1aPe|LG)C55LjP;jab{dTf$0~xbXS9!!QdcmDYLbL^jvxu2y*qnx2%jbL%rB z{aP85qBJe#(&O~Prk%IJARcdEypZ)vah%ZZ%;Zk{eW(U)Bx7VlzgOi8)x z`rh4l`@l_Ada7z&yUK>ZF;i6YLGwI*Sg#Fk#Qr0Jg&VLax(nNN$u-XJ5=MsP3|(lEdIOJ7|(x3iY;ea)5#BW*mDV%^=8qOeYO&gIdJVuLLN3cFaN=xZtFB=b zH{l)PZl_j^u+qx@89}gAQW7ofb+k)QwX=aegihossZq*+@PlCpb$rpp>Cbk9UJO<~ zDjlXQ_Ig#W0zdD3&*ei(FwlN#3b%FSR%&M^ywF@Fr>d~do@-kIS$e%wkIVfJ|Ohh=zc zF&Rnic^|>@R%v?@jO}a9;nY3Qrg_!xC=ZWUcYiA5R+|2nsM*$+c$TOs6pm!}Z}dfM zGeBhMGWw3$6KZXav^>YNA=r6Es>p<6HRYcZY)z{>yasbC81A*G-le8~QoV;rtKnkx z;+os8BvEe?0A6W*a#dOudsv3aWs?d% z0oNngyVMjavLjtjiG`!007#?62ClTqqU$@kIY`=x^$2e>iqIy1>o|@Tw@)P)B8_1$r#6>DB_5 zmaOaoE~^9TolgDgooKFuEFB#klSF%9-~d2~_|kQ0Y{Ek=HH5yq9s zDq#1S551c`kSiWPZbweN^A4kWiP#Qg6er1}HcKv{fxb1*BULboD0fwfaNM_<55>qM zETZ8TJDO4V)=aPp_eQjX%||Ud<>wkIzvDlpNjqW>I}W!-j7M^TNe5JIFh#-}zAV!$ICOju8Kx)N z0vLtzDdy*rQN!7r>Xz7rLw8J-(GzQlYYVH$WK#F`i_i^qVlzTNAh>gBWKV@XC$T-` z3|kj#iCquDhiO7NKum07i|<-NuVsX}Q}mIP$jBJDMfUiaWR3c|F_kWBMw0_Sr|6h4 zk`_r5=0&rCR^*tOy$A8K;@|NqwncjZ>Y-75vlpxq%Cl3EgH`}^^~=u zoll6xxY@a>0f%Ddpi;=cY}fyG!K2N-dEyXXmUP5u){4VnyS^T4?pjN@Ot4zjL(Puw z_U#wMH2Z#8Pts{olG5Dy0tZj;N@;fHheu>YKYQU=4Bk|wcD9MbA`3O4bj$hNRHwzb zSLcG0SLV%zywdbuwl(^E_!@&)TdXge4O{MRWk2RKOt@!8E{$BU-AH(@4{gxs=YAz9LIob|Hzto0}9cWoz6Tp2x0&xi#$ zHh$dwO&UCR1Ob2w00-2eG7d4=cN(Y>0R#$q8?||q@iTi+7-w-xR%uMr&StFIthC<# zvK(aPduwuNB}oJUV8+Zl)%cnfsHI%4`;x6XW^UF^e4s3Z@S<&EV8?56Wya;HNs0E> z`$0dgRdiUz9RO9Au3RmYq>K#G=X%*_dUbSJHP`lSfBaN8t-~@F>)BL1RT*9I851A3 z<-+Gb#_QRX>~av#Ni<#zLswtu-c6{jGHR>wflhKLzC4P@b%8&~u)fosoNjk4r#GvC zlU#UU9&0Hv;d%g72Wq?Ym<&&vtA3AB##L}=ZjiTR4hh7J)e>ei} zt*u+>h%MwN`%3}b4wYpV=QwbY!jwfIj#{me)TDOG`?tI!%l=AwL2G@9I~}?_dA5g6 zCKgK(;6Q0&P&K21Tx~k=o6jwV{dI_G+Ba*Zts|Tl6q1zeC?iYJTb{hel*x>^wb|2RkHkU$!+S4OU4ZOKPZjV>9OVsqNnv5jK8TRAE$A&^yRwK zj-MJ3Pl?)KA~fq#*K~W0l4$0=8GRx^9+?w z!QT8*-)w|S^B0)ZeY5gZPI2G(QtQf?DjuK(s^$rMA!C%P22vynZY4SuOE=wX2f8$R z)A}mzJi4WJnZ`!bHG1=$lwaxm!GOnRbR15F$nRC-M*H<*VfF|pQw(;tbSfp({>9^5 zw_M1-SJ9eGF~m(0dvp*P8uaA0Yw+EkP-SWqu zqal$hK8SmM7#Mrs0@OD+%_J%H*bMyZiWAZdsIBj#lkZ!l2c&IpLu(5^T0Ge5PHzR} zn;TXs$+IQ_&;O~u=Jz+XE0wbOy`=6>m9JVG} zJ~Kp1e5m?K3x@@>!D)piw^eMIHjD4RebtR`|IlckplP1;r21wTi8v((KqNqn%2CB< zifaQc&T}*M&0i|LW^LgdjIaX|o~I$`owHolRqeH_CFrqCUCleN130&vH}dK|^kC>) z-r2P~mApHotL4dRX$25lIcRh_*kJaxi^%ZN5-GAAMOxfB!6flLPY-p&QzL9TE%ho( zRwftE3sy5<*^)qYzKkL|rE>n@hyr;xPqncY6QJ8125!MWr`UCWuC~A#G1AqF1@V$kv>@NBvN&2ygy*{QvxolkRRb%Ui zsmKROR%{*g*WjUUod@@cS^4eF^}yQ1>;WlGwOli z+Y$(8I`0(^d|w>{eaf!_BBM;NpCoeem2>J}82*!em=}}ymoXk>QEfJ>G(3LNA2-46 z5PGvjr)Xh9>aSe>vEzM*>xp{tJyZox1ZRl}QjcvX2TEgNc^(_-hir@Es>NySoa1g^ zFow_twnHdx(j?Q_3q51t3XI7YlJ4_q&(0#)&a+RUy{IcBq?)eaWo*=H2UUVIqtp&lW9JTJiP&u zw8+4vo~_IJXZIJb_U^&=GI1nSD%e;P!c{kZALNCm5c%%oF+I3DrA63_@4)(v4(t~JiddILp7jmoy+>cD~ivwoctFfEL zP*#2Rx?_&bCpX26MBgp^4G>@h`Hxc(lnqyj!*t>9sOBcXN(hTwEDpn^X{x!!gPX?1 z*uM$}cYRwHXuf+gYTB}gDTcw{TXSOUU$S?8BeP&sc!Lc{{pEv}x#ELX>6*ipI1#>8 zKes$bHjiJ1OygZge_ak^Hz#k;=od1wZ=o71ba7oClBMq>Uk6hVq|ePPt)@FM5bW$I z;d2Or@wBjbTyZj|;+iHp%Bo!Vy(X3YM-}lasMItEV_QrP-Kk_J4C>)L&I3Xxj=E?| zsAF(IfVQ4w+dRRnJ>)}o^3_012YYgFWE)5TT=l2657*L8_u1KC>Y-R{7w^S&A^X^U}h20jpS zQsdeaA#WIE*<8KG*oXc~$izYilTc#z{5xhpXmdT-YUnGh9v4c#lrHG6X82F2-t35} zB`jo$HjKe~E*W$=g|j&P>70_cI`GnOQ;Jp*JK#CT zuEGCn{8A@bC)~0%wsEv?O^hSZF*iqjO~_h|>xv>PO+?525Nw2472(yqS>(#R)D7O( zg)Zrj9n9$}=~b00=Wjf?E418qP-@8%MQ%PBiCTX=$B)e5cHFDu$LnOeJ~NC;xmOk# z>z&TbsK>Qzk)!88lNI8fOE2$Uxso^j*1fz>6Ot49y@=po)j4hbTIcVR`ePHpuJSfp zxaD^Dn3X}Na3@<_Pc>a;-|^Pon(>|ytG_+U^8j_JxP=_d>L$Hj?|0lz>_qQ#a|$+( z(x=Lipuc8p4^}1EQhI|TubffZvB~lu$zz9ao%T?%ZLyV5S9}cLeT?c} z>yCN9<04NRi~1oR)CiBakoNhY9BPnv)kw%*iv8vdr&&VgLGIs(-FbJ?d_gfbL2={- zBk4lkdPk~7+jIxd4{M(-W1AC_WcN&Oza@jZoj zaE*9Y;g83#m(OhA!w~LNfUJNUuRz*H-=$s*z+q+;snKPRm9EptejugC-@7-a-}Tz0 z@KHra#Y@OXK+KsaSN9WiGf?&jlZ!V7L||%KHP;SLksMFfjkeIMf<1e~t?!G3{n)H8 zQAlFY#QwfKuj;l@<$YDATAk;%PtD%B(0<|8>rXU< zJ66rkAVW_~Dj!7JGdGGi4NFuE?7ZafdMxIh65Sz7yQoA7fBZCE@WwysB=+`kT^LFX zz8#FlSA5)6FG9(qL3~A24mpzL@@2D#>0J7mMS1T*9UJ zvOq!!a(%IYY69+h45CE?(&v9H4FCr>gK0>mK~F}5RdOuH2{4|}k@5XpsX7+LZo^Qa4sH5`eUj>iffoBVm+ zz4Mtf`h?NW$*q1yr|}E&eNl)J``SZvTf6Qr*&S%tVv_OBpbjnA0&Vz#(;QmGiq-k! zgS0br4I&+^2mgA15*~Cd00cXLYOLA#Ep}_)eED>m+K@JTPr_|lSN}(OzFXQSBc6fM z@f-%2;1@BzhZa*LFV z-LrLmkmB%<<&jEURBEW>soaZ*rSIJNwaV%-RSaCZi4X)qYy^PxZ=oL?6N-5OGOMD2 z;q_JK?zkwQ@b3~ln&sDtT5SpW9a0q+5Gm|fpVY2|zqlNYBR}E5+ahgdj!CvK$Tlk0 z9g$5N;aar=CqMsudQV>yb4l@hN(9Jcc=1(|OHsqH6|g=K-WBd8GxZ`AkT?OO z-z_Ued-??Z*R4~L7jwJ%-`s~FK|qNAJ;EmIVDVpk{Lr7T4l{}vL)|GuUuswe9c5F| zv*5%u01hlv08?00Vpwyk*Q&&fY8k6MjOfpZfKa@F-^6d=Zv|0@&4_544RP5(s|4VPVP-f>%u(J@23BHqo2=zJ#v9g=F!cP((h zpt0|(s++ej?|$;2PE%+kc6JMmJjDW)3BXvBK!h!E`8Y&*7hS{c_Z?4SFP&Y<3evqf z9-ke+bSj$%Pk{CJlJbWwlBg^mEC^@%Ou?o>*|O)rl&`KIbHrjcpqsc$Zqt0^^F-gU2O=BusO+(Op}!jNzLMc zT;0YT%$@ClS%V+6lMTfhuzzxomoat=1H?1$5Ei7&M|gxo`~{UiV5w64Np6xV zVK^nL$)#^tjhCpTQMspXI({TW^U5h&Wi1Jl8g?P1YCV4=%ZYyjSo#5$SX&`r&1PyC zzc;uzCd)VTIih|8eNqFNeBMe#j_FS6rq81b>5?aXg+E#&$m++Gz9<+2)h=K(xtn}F ziV{rmu+Y>A)qvF}ms}4X^Isy!M&1%$E!rTO~5(p+8{U6#hWu>(Ll1}eD64Xa>~73A*538wry?v$vW z>^O#FRdbj(k0Nr&)U`Tl(4PI*%IV~;ZcI2z&rmq=(k^}zGOYZF3b2~Klpzd2eZJl> zB=MOLwI1{$RxQ7Y4e30&yOx?BvAvDkTBvWPpl4V8B7o>4SJn*+h1Ms&fHso%XLN5j z-zEwT%dTefp~)J_C8;Q6i$t!dnlh-!%haR1X_NuYUuP-)`IGWjwzAvp!9@h`kPZhf zwLwFk{m3arCdx8rD~K2`42mIN4}m%OQ|f)4kf%pL?Af5Ul<3M2fv>;nlhEPR8b)u} zIV*2-wyyD%%) zl$G@KrC#cUwoL?YdQyf9WH)@gWB{jd5w4evI& zOFF)p_D8>;3-N1z6mES!OPe>B^<;9xsh)){Cw$Vs-ez5nXS95NOr3s$IU;>VZSzKn zBvub8_J~I%(DozZW@{)Vp37-zevxMRZ8$8iRfwHmYvyjOxIOAF2FUngKj289!(uxY zaClWm!%x&teKmr^ABrvZ(ikx{{I-lEzw5&4t3P0eX%M~>$wG0ZjA4Mb&op+0$#SO_ z--R`>X!aqFu^F|a!{Up-iF(K+alKB{MNMs>e(i@Tpy+7Z-dK%IEjQFO(G+2mOb@BO zP>WHlS#fSQm0et)bG8^ZDScGnh-qRKIFz zfUdnk=m){ej0i(VBd@RLtRq3Ep=>&2zZ2%&vvf?Iex01hx1X!8U+?>ER;yJlR-2q4 z;Y@hzhEC=d+Le%=esE>OQ!Q|E%6yG3V_2*uh&_nguPcZ{q?DNq8h_2ahaP6=pP-+x zK!(ve(yfoYC+n(_+chiJ6N(ZaN+XSZ{|H{TR1J_s8x4jpis-Z-rlRvRK#U%SMJ(`C z?T2 zF(NNfO_&W%2roEC2j#v*(nRgl1X)V-USp-H|CwFNs?n@&vpRcj@W@xCJwR6@T!jt377?XjZ06=`d*MFyTdyvW!`mQm~t3luzYzvh^F zM|V}rO>IlBjZc}9Z zd$&!tthvr>5)m;5;96LWiAV0?t)7suqdh0cZis`^Pyg@?t>Ms~7{nCU;z`Xl+raSr zXpp=W1oHB*98s!Tpw=R5C)O{{Inl>9l7M*kq%#w9a$6N~v?BY2GKOVRkXYCgg*d

    <5G2M1WZP5 zzqSuO91lJod(SBDDw<*sX(+F6Uq~YAeYV#2A;XQu_p=N5X+#cmu19Qk>QAnV=k!?wbk5I;tDWgFc}0NkvC*G=V+Yh1cyeJVq~9czZiDXe+S=VfL2g`LWo8om z$Y~FQc6MFjV-t1Y`^D9XMwY*U_re2R?&(O~68T&D4S{X`6JYU-pz=}ew-)V0AOUT1 zVOkHAB-8uBcRjLvz<9HS#a@X*Kc@|W)nyiSgi|u5$Md|P()%2(?olGg@ypoJwp6>m z*dnfjjWC>?_1p;%1brqZyDRR;8EntVA92EJ3ByOxj6a+bhPl z;a?m4rQAV1@QU^#M1HX)0+}A<7TCO`ZR_RzF}X9-M>cRLyN4C+lCk2)kT^3gN^`IT zNP~fAm(wyIoR+l^lQDA(e1Yv}&$I!n?&*p6?lZcQ+vGLLd~fM)qt}wsbf3r=tmVYe zl)ntf#E!P7wlakP9MXS7m0nsAmqxZ*)#j;M&0De`oNmFgi$ov#!`6^4)iQyxg5Iuj zjLAhzQ)r`^hf7`*1`Rh`X;LVBtDSz@0T?kkT1o!ijeyTGt5vc^Cd*tmNgiNo^EaWvaC8$e+nb_{W01j3%=1Y&92YacjCi>eNbwk%-gPQ@H-+4xskQ}f_c=jg^S-# zYFBDf)2?@5cy@^@FHK5$YdAK9cI;!?Jgd}25lOW%xbCJ>By3=HiK@1EM+I46A)Lsd zeT|ZH;KlCml=@;5+hfYf>QNOr^XNH%J-lvev)$Omy8MZ`!{`j>(J5cG&ZXXgv)TaF zg;cz99i$4CX_@3MIb?GL0s*8J=3`#P(jXF(_(6DXZjc@(@h&=M&JG)9&Te1?(^XMW zjjC_70|b=9hB6pKQi`S^Ls7JyJw^@P>Ko^&q8F&?>6i;#CbxUiLz1ZH4lNyd@QACd zu>{!sqjB!2Dg}pbAXD>d!3jW}=5aN0b;rw*W>*PAxm7D)aw(c*RX2@bTGEI|RRp}vw7;NR2wa;rXN{L{Q#=Fa z$x@ms6pqb>!8AuV(prv>|aU8oWV={C&$c zMa=p=CDNOC2tISZcd8~18GN5oTbKY+Vrq;3_obJlfSKRMk;Hdp1`y`&LNSOqeauR_ z^j*Ojl3Ohzb5-a49A8s|UnM*NM8tg}BJXdci5%h&;$afbmRpN0&~9rCnBA`#lG!p zc{(9Y?A0Y9yo?wSYn>iigf~KP$0*@bGZ>*YM4&D;@{<%Gg5^uUJGRrV4 z(aZOGB&{_0f*O=Oi0k{@8vN^BU>s3jJRS&CJOl3o|BE{FAA&a#2YYiX3pZz@|Go-F z|Fly;7eX2OTs>R}<`4RwpHFs9nwh)B28*o5qK1Ge=_^w0m`uJOv!=&!tzt#Save(C zgKU=Bsgql|`ui(e1KVxR`?>Dx>(rD1$iWp&m`v)3A!j5(6vBm*z|aKm*T*)mo(W;R zNGo2`KM!^SS7+*9YxTm6YMm_oSrLceqN*nDOAtagULuZl5Q<7mOnB@Hq&P|#9y{5B z!2x+2s<%Cv2Aa0+u{bjZXS);#IFPk(Ph-K7K?3i|4ro> zRbqJoiOEYo(Im^((r}U4b8nvo_>4<`)ut`24?ILnglT;Pd&U}$lV3U$F9#PD(O=yV zgNNA=GW|(E=&m_1;uaNmipQe?pon4{T=zK!N!2_CJL0E*R^XXIKf*wi!>@l}3_P9Z zF~JyMbW!+n-+>!u=A1ESxzkJy$DRuG+$oioG7(@Et|xVbJ#BCt;J43Nvj@MKvTxzy zMmjNuc#LXBxFAwIGZJk~^!q$*`FME}yKE8d1f5Mp}KHNq(@=Z8YxV}0@;YS~|SpGg$_jG7>_8WWYcVx#4SxpzlV9N4aO>K{c z$P?a_fyDzGX$Of3@ykvedGd<@-R;M^Shlj*SswJLD+j@hi_&_>6WZ}#AYLR0iWMK|A zH_NBeu(tMyG=6VO-=Pb>-Q#$F*or}KmEGg*-n?vWQREURdB#+6AvOj*I%!R-4E_2$ zU5n9m>RWs|Wr;h2DaO&mFBdDb-Z{APGQx$(L`if?C|njd*fC=rTS%{o69U|meRvu?N;Z|Y zbT|ojL>j;q*?xXmnHH#3R4O-59NV1j=uapkK7}6@Wo*^Nd#(;$iuGsb;H315xh3pl zHaJ>h-_$hdNl{+|Zb%DZH%ES;*P*v0#}g|vrKm9;j-9e1M4qX@zkl&5OiwnCz=tb6 zz<6HXD+rGIVpGtkb{Q^LIgExOm zz?I|oO9)!BOLW#krLmWvX5(k!h{i>ots*EhpvAE;06K|u_c~y{#b|UxQ*O@Ks=bca z^_F0a@61j3I(Ziv{xLb8AXQj3;R{f_l6a#H5ukg5rxwF9A$?Qp-Mo54`N-SKc}fWp z0T)-L@V$$&my;l#Ha{O@!fK4-FSA)L&3<${Hcwa7ue`=f&YsXY(NgeDU#sRlT3+9J z6;(^(sjSK@3?oMo$%L-nqy*E;3pb0nZLx6 z;h5)T$y8GXK1DS-F@bGun8|J(v-9o=42&nLJy#}M5D0T^5VWBNn$RpC zZzG6Bt66VY4_?W=PX$DMpKAI!d`INr) zkMB{XPQ<52rvWVQqgI0OL_NWxoe`xxw&X8yVftdODPj5|t}S6*VMqN$-h9)1MBe0N zYq?g0+e8fJCoAksr0af1)FYtz?Me!Cxn`gUx&|T;)695GG6HF7!Kg1zzRf_{VWv^bo81v4$?F6u2g|wxHc6eJQAg&V z#%0DnWm2Rmu71rPJ8#xFUNFC*V{+N_qqFH@gYRLZ6C?GAcVRi>^n3zQxORPG)$-B~ z%_oB?-%Zf7d*Fe;cf%tQwcGv2S?rD$Z&>QC2X^vwYjnr5pa5u#38cHCt4G3|efuci z@3z=#A13`+ztmp;%zjXwPY_aq-;isu*hecWWX_=Z8paSqq7;XYnUjK*T>c4~PR4W7 z#C*%_H&tfGx`Y$w7`dXvVhmovDnT>btmy~SLf>>~84jkoQ%cv=MMb+a{JV&t0+1`I z32g_Y@yDhKe|K^PevP~MiiVl{Ou7^Mt9{lOnXEQ`xY^6L8D$705GON{!1?1&YJEl#fTf5Z)da=yiEQ zGgtC-soFGOEBEB~ZF_{7b(76En>d}mI~XIwNw{e>=Fv)sgcw@qOsykWr?+qAOZSVrQfg}TNI ztKNG)1SRrAt6#Q?(me%)>&A_^DM`pL>J{2xu>xa$3d@90xR61TQDl@fu%_85DuUUA za9tn64?At;{`BAW6oykwntxHeDpXsV#{tmt5RqdN7LtcF4vR~_kZNT|wqyR#z^Xcd zFdymVRZvyLfTpBT>w9<)Ozv@;Yk@dOSVWbbtm^y@@C>?flP^EgQPAwsy75bveo=}T zFxl(f)s)j(0#N_>Or(xEuV(n$M+`#;Pc$1@OjXEJZumkaekVqgP_i}p`oTx;terTx zZpT+0dpUya2hqlf`SpXN{}>PfhajNk_J0`H|2<5E;U5Vh4F8er z;RxLSFgpGhkU>W?IwdW~NZTyOBrQ84H7_?gviIf71l`EETodG9a1!8e{jW?DpwjL? zGEM&eCzwoZt^P*8KHZ$B<%{I}>46IT%jJ3AnnB5P%D2E2Z_ z1M!vr#8r}1|KTqWA4%67ZdbMW2YJ81b(KF&SQ2L1Qn(y-=J${p?xLMx3W7*MK;LFQ z6Z`aU;;mTL4XrrE;HY*Rkh6N%?qviUGNAKiCB~!P}Z->IpO6E(gGd7I#eDuT7j|?nZ zK}I(EJ>$Kb&@338M~O+em9(L!+=0zBR;JAQesx|3?Ok90)D1aS9P?yTh6Poh8Cr4X zk3zc=f2rE7jj+aP7nUsr@~?^EGP>Q>h#NHS?F{Cn`g-gD<8F&dqOh-0sa%pfL`b+1 zUsF*4a~)KGb4te&K0}bE>z3yb8% zibb5Q%Sfiv7feb1r0tfmiMv z@^4XYwg@KZI=;`wC)`1jUA9Kv{HKe2t$WmRcR4y8)VAFjRi zaz&O7Y2tDmc5+SX(bj6yGHYk$dBkWc96u3u&F)2yEE~*i0F%t9Kg^L6MJSb&?wrXi zGSc;_rln$!^ybwYBeacEFRsVGq-&4uC{F)*Y;<0y7~USXswMo>j4?~5%Zm!m@i@-> zXzi82sa-vpU{6MFRktJy+E0j#w`f`>Lbog{zP|9~hg(r{RCa!uGe>Yl536cn$;ouH za#@8XMvS-kddc1`!1LVq;h57~zV`7IYR}pp3u!JtE6Q67 zq3H9ZUcWPm2V4IukS}MCHSdF0qg2@~ufNx9+VMjQP&exiG_u9TZAeAEj*jw($G)zL zq9%#v{wVyOAC4A~AF=dPX|M}MZV)s(qI9@aIK?Pe+~ch|>QYb+78lDF*Nxz2-vpRbtQ*F4$0fDbvNM#CCatgQ@z1+EZWrt z2dZfywXkiW=no5jus-92>gXn5rFQ-COvKyegmL=4+NPzw6o@a?wGE-1Bt;pCHe;34K%Z z-FnOb%!nH;)gX+!a3nCk?5(f1HaWZBMmmC@lc({dUah+E;NOros{?ui1zPC-Q0);w zEbJmdE$oU$AVGQPdm{?xxI_0CKNG$LbY*i?YRQ$(&;NiA#h@DCxC(U@AJ$Yt}}^xt-EC_ z4!;QlLkjvSOhdx!bR~W|Ezmuf6A#@T`2tsjkr>TvW*lFCMY>Na_v8+{Y|=MCu1P8y z89vPiH5+CKcG-5lzk0oY>~aJC_0+4rS@c@ZVKLAp`G-sJB$$)^4*A!B zmcf}lIw|VxV9NSoJ8Ag3CwN&d7`|@>&B|l9G8tXT^BDHOUPrtC70NgwN4${$k~d_4 zJ@eo6%YQnOgq$th?0{h`KnqYa$Nz@vlHw<%!C5du6<*j1nwquk=uY}B8r7f|lY+v7 zm|JU$US08ugor8E$h3wH$c&i~;guC|3-tqJy#T;v(g( zBZtPMSyv%jzf->435yM(-UfyHq_D=6;ouL4!ZoD+xI5uCM5ay2m)RPmm$I}h>()hS zO!0gzMxc`BPkUZ)WXaXam%1;)gedA7SM8~8yIy@6TPg!hR0=T>4$Zxd)j&P-pXeSF z9W`lg6@~YDhd19B9ETv(%er^Xp8Yj@AuFVR_8t*KS;6VHkEDKI#!@l!l3v6`W1`1~ zP{C@keuV4Q`Rjc08lx?zmT$e$!3esc9&$XZf4nRL(Z*@keUbk!GZi(2Bmyq*saOD? z3Q$V<*P-X1p2}aQmuMw9nSMbOzuASsxten7DKd6A@ftZ=NhJ(0IM|Jr<91uAul4JR zADqY^AOVT3a(NIxg|U;fyc#ZnSzw2cr}#a5lZ38>nP{05D)7~ad7JPhw!LqOwATXtRhK!w0X4HgS1i<%AxbFmGJx9?sEURV+S{k~g zGYF$IWSlQonq6}e;B(X(sIH|;52+(LYW}v_gBcp|x%rEAVB`5LXg_d5{Q5tMDu0_2 z|LOm$@K2?lrLNF=mr%YP|U-t)~9bqd+wHb4KuPmNK<}PK6e@aosGZK57=Zt+kcszVOSbe;`E^dN! ze7`ha3WUUU7(nS0{?@!}{0+-VO4A{7+nL~UOPW9_P(6^GL0h${SLtqG!} zKl~Ng5#@Sy?65wk9z*3SA`Dpd4b4T^@C8Fhd8O)k_4%0RZL5?#b~jmgU+0|DB%0Z) zql-cPC>A9HPjdOTpPC` zQwvF}uB5kG$Xr4XnaH#ruSjM*xG?_hT7y3G+8Ox`flzU^QIgb_>2&-f+XB6MDr-na zSi#S+c!ToK84<&m6sCiGTd^8pNdXo+$3^l3FL_E`0 z>8it5YIDxtTp2Tm(?}FX^w{fbfgh7>^8mtvN>9fWgFN_*a1P`Gz*dyOZF{OV7BC#j zQV=FQM5m>47xXgapI$WbPM5V`V<7J9tD)oz@d~MDoM`R^Y6-Na(lO~uvZlpu?;zw6 zVO1faor3dg#JEb5Q*gz4<W8tgC3nE2BG2jeIQs1)<{In&7hJ39x=;ih;CJDy)>0S1at*7n?Wr0ahYCpFjZ|@u91Zl7( zv;CSBRC65-6f+*JPf4p1UZ)k=XivKTX6_bWT~7V#rq0Xjas6hMO!HJN8GdpBKg_$B zwDHJF6;z?h<;GXFZan8W{XFNPpOj!(&I1`&kWO86p?Xz`a$`7qV7Xqev|7nn_lQuX ziGpU1MMYt&5dE2A62iX3;*0WzNB9*nSTzI%62A+N?f?;S>N@8M=|ef3gtQTIA*=yq zQAAjOqa!CkHOQo4?TsqrrsJLclXcP?dlAVv?v`}YUjo1Htt;6djP@NPFH+&p1I+f_ z)Y279{7OWomY8baT(4TAOlz1OyD{4P?(DGv3XyJTA2IXe=kqD)^h(@*E3{I~w;ws8 z)ZWv7E)pbEM zd3MOXRH3mQhks9 zv6{s;k0y5vrcjXaVfw8^>YyPo=oIqd5IGI{)+TZq5Z5O&hXAw%ZlL}^6FugH;-%vP zAaKFtt3i^ag226=f0YjzdPn6|4(C2sC5wHFX{7QF!tG1E-JFA`>eZ`}$ymcRJK?0c zN363o{&ir)QySOFY0vcu6)kX#;l??|7o{HBDVJN+17rt|w3;(C_1b>d;g9Gp=8YVl zYTtA52@!7AUEkTm@P&h#eg+F*lR zQ7iotZTcMR1frJ0*V@Hw__~CL>_~2H2cCtuzYIUD24=Cv!1j6s{QS!v=PzwQ(a0HS zBKx04KA}-Ue+%9d`?PG*hIij@54RDSQpA7|>qYVIrK_G6%6;#ZkR}NjUgmGju)2F`>|WJoljo)DJgZr4eo1k1i1+o z1D{>^RlpIY8OUaOEf5EBu%a&~c5aWnqM zxBpJq98f=%M^{4mm~5`CWl%)nFR64U{(chmST&2jp+-r z3675V<;Qi-kJud%oWnCLdaU-)xTnMM%rx%Jw6v@=J|Ir=4n-1Z23r-EVf91CGMGNz zb~wyv4V{H-hkr3j3WbGnComiqmS0vn?n?5v2`Vi>{Ip3OZUEPN7N8XeUtF)Ry6>y> zvn0BTLCiqGroFu|m2zG-;Xb6;W`UyLw)@v}H&(M}XCEVXZQoWF=Ykr5lX3XWwyNyF z#jHv)A*L~2BZ4lX?AlN3X#axMwOC)PoVy^6lCGse9bkGjb=qz%kDa6}MOmSwK`cVO zt(e*MW-x}XtU?GY5}9{MKhRhYOlLhJE5=ca+-RmO04^ z66z{40J=s=ey9OCdc(RCzy zd7Zr1%!y3}MG(D=wM_ebhXnJ@MLi7cImDkhm0y{d-Vm81j`0mbi4lF=eirlr)oW~a zCd?26&j^m4AeXEsIUXiTal)+SPM4)HX%%YWF1?(FV47BaA`h9m67S9x>hWMVHx~Hg z1meUYoLL(p@b3?x|9DgWeI|AJ`Ia84*P{Mb%H$ZRROouR4wZhOPX15=KiBMHl!^JnCt$Az`KiH^_d>cev&f zaG2>cWf$=A@&GP~DubsgYb|L~o)cn5h%2`i^!2)bzOTw2UR!>q5^r&2Vy}JaWFUQE04v>2;Z@ZPwXr?y&G(B^@&y zsd6kC=hHdKV>!NDLIj+3rgZJ|dF`%N$DNd;B)9BbiT9Ju^Wt%%u}SvfM^=|q-nxDG zuWCQG9e#~Q5cyf8@y76#kkR^}{c<_KnZ0QsZcAT|YLRo~&tU|N@BjxOuy`#>`X~Q< z?R?-Gsk$$!oo(BveQLlUrcL#eirhgBLh`qHEMg`+sR1`A=1QX7)ZLMRT+GBy?&mM8 zQG^z-!Oa&J-k7I(3_2#Q6Bg=NX<|@X&+YMIOzfEO2$6Mnh}YV!m!e^__{W@-CTprr zbdh3f=BeCD$gHwCrmwgM3LAv3!Mh$wM)~KWzp^w)Cu6roO7uUG5z*}i0_0j47}pK; ztN530`ScGatLOL06~zO)Qmuv`h!gq5l#wx(EliKe&rz-5qH(hb1*fB#B+q`9=jLp@ zOa2)>JTl7ovxMbrif`Xe9;+fqB1K#l=Dv!iT;xF zdkCvS>C5q|O;}ns3AgoE({Ua-zNT-9_5|P0iANmC6O76Sq_(AN?UeEQJ>#b54fi3k zFmh+P%b1x3^)0M;QxXLP!BZ^h|AhOde*{9A=f3|Xq*JAs^Y{eViF|=EBfS6L%k4ip zk+7M$gEKI3?bQg?H3zaE@;cyv9kv;cqK$VxQbFEsy^iM{XXW0@2|DOu$!-k zSFl}Y=jt-VaT>Cx*KQnHTyXt}f9XswFB9ibYh+k2J!ofO+nD?1iw@mwtrqI4_i?nE zhLkPp41ED62me}J<`3RN80#vjW;wt`pP?%oQ!oqy7`miL>d-35a=qotK$p{IzeSk# ze_$CFYp_zIkrPFVaW^s#U4xT1lI^A0IBe~Y<4uS%zSV=wcuLr%gQT=&5$&K*bwqx| zWzCMiz>7t^Et@9CRUm9E+@hy~sBpm9fri$sE1zgLU((1?Yg{N1Sars=DiW&~Zw=3I zi7y)&oTC?UWD2w97xQ&5vx zRXEBGeJ(I?Y}eR0_O{$~)bMJRTsNUPIfR!xU9PE7A>AMNr_wbrFK>&vVw=Y;RH zO$mlpmMsQ}-FQ2cSj7s7GpC+~^Q~dC?y>M}%!-3kq(F3hGWo9B-Gn02AwUgJ>Z-pKOaj zysJBQx{1>Va=*e@sLb2z&RmQ7ira;aBijM-xQ&cpR>X3wP^foXM~u1>sv9xOjzZpX z0K;EGouSYD~oQ&lAafj3~EaXfFShC+>VsRlEMa9cg9i zFxhCKO}K0ax6g4@DEA?dg{mo>s+~RPI^ybb^u--^nTF>**0l5R9pocwB?_K)BG_)S zyLb&k%XZhBVr7U$wlhMqwL)_r&&n%*N$}~qijbkfM|dIWP{MyLx}X&}ES?}7i;9bW zmTVK@zR)7kE2+L42Q`n4m0VVg5l5(W`SC9HsfrLZ=v%lpef=Gj)W59VTLe+Z$8T8i z4V%5+T0t8LnM&H>Rsm5C%qpWBFqgTwL{=_4mE{S3EnBXknM&u8n}A^IIM4$s3m(Rd z>zq=CP-!9p9es2C*)_hoL@tDYABn+o#*l;6@7;knWIyDrt5EuakO99S$}n((Fj4y} zD!VvuRzghcE{!s;jC*<_H$y6!6QpePo2A3ZbX*ZzRnQq*b%KK^NF^z96CHaWmzU@f z#j;y?X=UP&+YS3kZx7;{ zDA{9(wfz7GF`1A6iB6fnXu0?&d|^p|6)%3$aG0Uor~8o? z*e}u#qz7Ri?8Uxp4m_u{a@%bztvz-BzewR6bh*1Xp+G=tQGpcy|4V_&*aOqu|32CM zz3r*E8o8SNea2hYJpLQ-_}R&M9^%@AMx&`1H8aDx4j%-gE+baf2+9zI*+Pmt+v{39 zDZ3Ix_vPYSc;Y;yn68kW4CG>PE5RoaV0n@#eVmk?p$u&Fy&KDTy!f^Hy6&^-H*)#u zdrSCTJPJw?(hLf56%2;_3n|ujUSJOU8VPOTlDULwt0jS@j^t1WS z!n7dZIoT+|O9hFUUMbID4Ec$!cc($DuQWkocVRcYSikFeM&RZ=?BW)mG4?fh#)KVG zcJ!<=-8{&MdE)+}?C8s{k@l49I|Zwswy^ZN3;E!FKyglY~Aq?4m74P-0)sMTGXqd5(S<-(DjjM z&7dL-Mr8jhUCAG$5^mI<|%`;JI5FVUnNj!VO2?Jiqa|c2;4^n!R z`5KK0hyB*F4w%cJ@Un6GC{mY&r%g`OX|1w2$B7wxu97%<@~9>NlXYd9RMF2UM>(z0 zouu4*+u+1*k;+nFPk%ly!nuMBgH4sL5Z`@Rok&?Ef=JrTmvBAS1h?C0)ty5+yEFRz zY$G=coQtNmT@1O5uk#_MQM1&bPPnspy5#>=_7%WcEL*n$;t3FUcXxMpcXxMpA@1(( z32}FUxI1xoH;5;M_i@j?f6mF_p3Cd1DTb=dTK#qJneN`*d+pvYD*L?M(1O%DEmB>$ zs6n;@Lcm9c7=l6J&J(yBnm#+MxMvd-VKqae7;H7p-th(nwc}?ov%$8ckwY%n{RAF3 zTl^SF7qIWdSa7%WJ@B^V-wD|Z)9IQkl$xF>ebi>0AwBv5oh5$D*C*Pyj?j_*pT*IMgu3 z$p#f0_da0~Wq(H~yP##oQ}x66iYFc0O@JFgyB>ul@qz{&<14#Jy@myMM^N%oy0r|b zDPBoU!Y$vUxi%_kPeb4Hrc>;Zd^sftawKla0o|3mk@B)339@&p6inAo(Su3qlK2a) zf?EU`oSg^?f`?y=@Vaq4Dps8HLHW zIe~fHkXwT>@)r+5W7#pW$gzbbaJ$9e;W-u#VF?D=gsFfFlBJ5wR>SB;+f)sFJsYJ| z29l2Ykg+#1|INd=uj3&d)m@usb;VbGnoI1RHvva@?i&>sP&;Lt!ZY=e!=d-yZ;QV% zP@(f)+{|<*XDq%mvYKwIazn8HS`~mW%9+B|`&x*n?Y$@l{uy@ z^XxQnuny+p0JG0h)#^7}C|Btyp7=P#A2ed1vP0KGw9+~-^y4~S$bRm3gCT{+7Z<(A zJ&tg=7X|uKPKd6%z@IcZ@FgQe=rS&&1|O!s#>B_z!M_^B`O(SqE>|x- zh{~)$RW_~jXj)}mO>_PZvGdD|vtN44=Tp!oCP0>)gYeJ;n*&^BZG{$>y%Yb|L zeBUI#470!F`GM-U$?+~k+g9lj5C-P_i1%c3Zbo!@EjMJDoxQ7%jHHKeMVw&_(aoL? z%*h*aIt9-De$J>ZRLa7aWcLn<=%D+u0}RV9ys#TBGLAE%Vh`LWjWUi`Q3kpW;bd)YD~f(#$jfNdx}lOAq=#J*aV zz;K>I?)4feI+HrrrhDVkjePq;L7r87;&vm|7qaN z_>XhM8GU6I5tSr3O2W4W%m6wDH#=l32!%LRho(~*d3GfA6v-ND^0trp-qZs(B(ewD z3y3@ZV!2`DZ6b6c(Ftqg-s715;=lZqGF>H+z+c&7NeDz!We+7WNk>X*b7OZmlcTnf z{C1CB67e@xbWprDhN+t!B%4od#|>yQA$5mBM>XdhP?1U^%aD&^=PYWQEY*8Mr%h~R zOVzrd9}6RSl}Lt42r166_*s|U<1}`{l(H}m8H=D+oG>*=+=W^%IMB&CHZ-?)78G2b z)9kj_ldMecB_65eV&R+(yQ$2`ol&&7$&ns_{%A6cC2C*C6dY7qyWrHSYyOBl$0=$> z-YgkNlH{1MR-FXx7rD=4;l%6Ub3OMx9)A|Y7KLnvb`5OB?hLb#o@Wu(k|;_b!fbq( zX|rh*D3ICnZF{5ipmz8`5UV3Otwcso0I#;Q(@w+Pyj&Qa(}Uq2O(AcLU(T`+x_&~?CFLly*`fdP6NU5A|ygPXM>}(+) zkTRUw*cD<% zzFnMeB(A4A9{|Zx2*#!sRCFTk2|AMy5+@z8ws0L-{mt(9;H#}EGePUWxLabB_fFcp zLiT)TDLUXPbV2$Cde<9gv4=;u5aQ$kc9|GE2?AQZsS~D%AR`}qP?-kS_bd>C2r(I; zOc&r~HB7tUOQgZOpH&7C&q%N612f?t(MAe(B z@A!iZi)0qo^Nyb`#9DkzKjoI4rR1ghi1wJU5Tejt!ISGE93m@qDNYd|gg9(s|8-&G zcMnsX0=@2qQQ__ujux#EJ=veg&?3U<`tIWk~F=vm+WTviUvueFk&J@TcoGO{~C%6NiiNJ*0FJBQ!3Ab zm59ILI24e8!=;-k%yEf~YqN_UJ8k z0GVIS0n^8Yc)UK1eQne}<0XqzHkkTl*8VrWr zo}y?WN5@TL*1p>@MrUtxq0Vki($sn_!&;gR2e$?F4^pe@J_BQS&K3{4n+f7tZX4wQn z*Z#0eBs&H8_t`w^?ZYx=BGgyUI;H$i*t%(~8BRZ4gH+nJT0R-3lzdn4JY=xfs!YpF zQdi3kV|NTMB}uxx^KP!`=S(}{s*kfb?6w^OZpU?Wa~7f@Q^pV}+L@9kfDE`c@h5T* zY@@@?HJI)j;Y#l8z|k8y#lNTh2r?s=X_!+jny>OsA7NM~(rh3Tj7?e&pD!Jm28*UL zmRgopf0sV~MzaHDTW!bPMNcymg=!OS2bD@6Z+)R#227ET3s+2m-(W$xXBE#L$Whsi zjz6P+4cGBQkJY*vc1voifsTD}?H$&NoN^<=zK~75d|WSU4Jaw`!GoPr$b>4AjbMy+ z%4;Kt7#wwi)gyzL$R97(N?-cKygLClUk{bBPjSMLdm|MG-;oz70mGNDus zdGOi}L59=uz=VR2nIux^(D85f)1|tK&c!z1KS6tgYd^jgg6lT^5h42tZCn#Q-9k>H zVby-zby2o_GjI!zKn8ZuQ`asmp6R@=FR9kJ_Vja#I#=wtQWTes>INZynAoj$5 zN^9Ws&hvDhu*lY=De$Zby12$N&1#U2W1OHzuh;fSZH4igQodAG1K*;%>P9emF7PPD z>XZ&_hiFcX9rBXQ8-#bgSQ!5coh=(>^8gL%iOnnR>{_O#bF>l+6yZQ4R42{Sd#c7G zHy!)|g^tmtT4$YEk9PUIM8h)r?0_f=aam-`koGL&0Zp*c3H2SvrSr60s|0VtFPF^) z-$}3C94MKB)r#398;v@)bMN#qH}-%XAyJ_V&k@k+GHJ^+YA<*xmxN8qT6xd+3@i$( z0`?f(la@NGP*H0PT#Od3C6>0hxarvSr3G;0P=rG^v=nB5sfJ}9&klYZ>G1BM2({El zg0i|%d~|f2e(yWsh%r)XsV~Fm`F*Gsm;yTQV)dW!c8^WHRfk~@iC$w^h=ICTD!DD;~TIlIoVUh*r@aS|%Ae3Io zU~>^l$P8{6Ro~g26!@NToOZ(^5f8p`*6ovpcQdIDf%)?{NPPwHB>l*f_prp9XDCM8 zG`(I8xl|w{x(c`}T_;LJ!%h6L=N=zglX2Ea+2%Q8^GA>jow-M>0w{XIE-yz|?~M+; zeZO2F3QK@>(rqR|i7J^!1YGH^9MK~IQPD}R<6^~VZWErnek^xHV>ZdiPc4wesiYVL z2~8l7^g)X$kd}HC74!Y=Uq^xre22Osz!|W@zsoB9dT;2Dx8iSuK!Tj+Pgy0-TGd)7 zNy)m@P3Le@AyO*@Z2~+K9t2;=7>-*e(ZG`dBPAnZLhl^zBIy9G+c)=lq0UUNV4+N% zu*Nc4_cDh$ou3}Re}`U&(e^N?I_T~#42li13_LDYm`bNLC~>z0ZG^o6=IDdbIf+XFTfe>SeLw4UzaK#4CM4HNOs- zz>VBRkL@*A7+XY8%De)|BYE<%pe~JzZN-EU4-s_P9eINA^Qvy3z?DOTlkS!kfBG_7 zg{L6N2(=3y=iY)kang=0jClzAWZqf+fDMy-MH&Px&6X36P^!0gj%Z0JLvg~oB$9Z| zgl=6_$4LSD#(2t{Eg=2|v_{w7op+)>ehcvio@*>XM!kz+xfJees9(ObmZ~rVGH>K zWaiBlWGEV{JU=KQ>{!0+EDe-+Z#pO zv{^R<7A^gloN;Tx$g`N*Z5OG!5gN^Xj=2<4D;k1QuN5N{4O`Pfjo3Ht_RRYSzsnhTK?YUf)z4WjNY z>R04WTIh4N(RbY*hPsjKGhKu;&WI)D53RhTUOT}#QBDfUh%lJSy88oqBFX)1pt>;M z>{NTkPPk8#}DUO;#AV8I7ZQsC?Wzxn|3ubiQYI|Fn_g4r)%eNZ~ zSvTYKS*9Bcw{!=C$=1` zGQ~1D97;N!8rzKPX5WoqDHosZIKjc!MS+Q9ItJK?6Wd%STS2H!*A#a4t5 zJ-Rz_`n>>Up%|81tJR2KND<6Uoe82l={J~r*D5c_bThxVxJ<}?b0Sy}L1u|Yk=e&t z0b5c2X(#x^^fI)l<2=3b=|1OH_)-2beVEH9IzpS*Es0!4Or+xE$%zdgY+VTK2}#fpxSPtD^1a6Z)S%5eqVDzs`rL1U;Zep@^Y zWf#dJzp_iWP{z=UEepfZ4ltYMb^%H7_m4Pu81CP@Ra)ds+|Oi~a>Xi(RBCy2dTu-R z$dw(E?$QJUA3tTIf;uZq!^?_edu~bltHs!5WPM-U=R74UsBwN&nus2c?`XAzNUYY|fasp?z$nFwXQYnT`iSR<=N`1~h3#L#lF-Fc1D#UZhC2IXZ{#IDYl_r8 z?+BRvo_fPGAXi+bPVzp=nKTvN_v*xCrb^n=3cQ~No{JzfPo@YWh=7K(M_$Jk*+9u* zEY4Ww3A|JQ`+$z(hec&3&3wxV{q>D{fj!Euy2>tla^LP_2T8`St2em~qQp zm{Tk<>V3ecaP1ghn}kzS7VtKksV*27X+;Y6#I$urr=25xuC=AIP7#Jp+)L67G6>EZ zA~n}qEWm6A8GOK!3q9Yw*Z07R(qr{YBOo5&4#pD_O(O^y0a{UlC6w@ZalAN0Rq_E0 zVA!pI-6^`?nb7`y(3W5OsoVJ^MT!7r57Jm{FS{(GWAWwAh$dBpffjcOZUpPv$tTc} zv~jnA{+|18GmMDq7VK6Sb=-2nzz^7TDiixA{mf%8eQC|x>*=)((3}twJCoh~V4m3) zM5fwDbrTpnYR`lIO7Il7Eq@)St{h>Nllv+5Hk2FAE8fdD*YT|zJix?!cZ-=Uqqieb z-~swMc+yvTu(h?fT4K_UuVDqTup3%((3Q!0*Tfwyl`3e27*p{$ zaJMMF-Pb=3imlQ*%M6q5dh3tT+^%wG_r)q5?yHvrYAmc-zUo*HtP&qP#@bfcX~jwn!$k~XyC#Ox9i7dO7b4}b^f zrVEPkeD%)l0-c_gazzFf=__#Q6Pwv_V=B^h=)CYCUszS6g!}T!r&pL)E*+2C z5KCcctx6Otpf@x~7wZz*>qB_JwO!uI@9wL0_F>QAtg3fvwj*#_AKvsaD?!gcj+zp) zl2mC)yiuumO+?R2`iiVpf_E|9&}83;^&95y96F6T#E1}DY!|^IW|pf-3G0l zE&_r{24TQAa`1xj3JMev)B_J-K2MTo{nyRKWjV#+O}2ah2DZ>qnYF_O{a6Gy{aLJi#hWo3YT3U7yVxoNrUyw31163sHsCUQG|rriZFeoTcP` zFV<&;-;5x0n`rqMjx2^_7y)dHPV@tJC*jHQo!~1h`#z)Gu7m@0@z*e?o|S#5#Ht~%GC|r zd?EY_E0XKUQ2o7*e3D9{Lt7s#x~`hjzwQ{TYw;Fq8la&)%4Vj_N@ivmaSNw9X3M$MAG97a&m1SODLZ-#$~7&@ zrB~0E+38b6sfezlmhDej*KRVbzptE0Xg%$xpjqoeL;-LwmKIR#%+EZ7U|&;9rS6lo8u9iOD;-3HF{Gm=EL@W zG8L9&8=FxGHICO+MX@lC?DpY4GAE9!S+7hKsTmr8%hFI9QGI4sCj&?Of-yA98KvLsP z|k5cP?Z zay4&3t8e5RgA_@c7z{RX6d`;{B~l03#AD@RJD1{;4x93d7mD15wnFLi^LI%`Z~6@ zq9}|AG1Lq-1~Fb{1b?}bFLaSnWm!7L)P8#%g{{}}u@Q`4N{s3LiD4kSqTnM8UNN4XQi57LZRzkkL9+rJ{_?juO;cZL=MIT2H1q-=Tt1G666hVaPojp^(AM>6 zDQQf0_>1u=rvT+6(5 zAQR5%mlLdhkl4MpIyY0GN9VrGYkq?1sF8F(VeB0u3{p`h6IgEBC}Jr!^-)@5@<8s( zXyiL`ENayjlbGx}3q2T;y&|@~&$+T=hN0iS4BAARQ_JBclEeBW7}$3lx|!Ee&vs&o z=A4b##+t=rylLD-dc(X)^d?KbmU^9uZ)zXbIPC%pD{s(>p9*fu8&(?$LE67%%b-e) z!IU|lpUpK`<&YPqJnj5wb8(;a)JoC~+Kb`Fq-HL<>X@DYPqu4t9tLfS9C>Kn*Ho zl3Zz2y8;bCi@KYchQ;1JTPXL`ZMCb4R7fLlP_qKJ`aTs3H2Q6`g3GdtURX%yk`~xS z#|RDc0Y|%b+$^QYCSEG~ZF;*rT;@T=Ko6uwRJ&RasW^4$W<^nS^v|}UmIHe`P{(x| zI&y@A&b6=G2#r*st8^|19`Yw20=}MF9@@6zIuB%!vd7J%E|@zK(MRvFif-szGX^db zIvb}^{t9g(lZhLP&h6;2p>69mWE3ss6di_-KeYjPVskOMEu?5m_A>;o`6 z5ot9G8pI8Jwi@yJExKVZVw-3FD7TW3Ya{_*rS5+LicF^BX(Mq)H&l_B5o9^ zpcL6s^X}J-_9RAs(wk7s1J$cjO~jo*4l3!1V)$J+_j7t8g4A=ab`L(-{#G?z>z@KneXt&ZOv>m);*lTA}gRhYxtJt;0QZ<#l+OWu6(%(tdZ`LkXb}TQjhal;1vd{D+b@g7G z25i;qgu#ieYC?Fa?iwzeLiJa|vAU1AggN5q{?O?J9YU|xHi}PZb<6>I7->aWA4Y7-|a+7)RQagGQn@cj+ED7h6!b>XIIVI=iT(