From 9f9dc8770a239dd41d9618df2f7bc950f62e93b6 Mon Sep 17 00:00:00 2001 From: Doha2012 Date: Sat, 22 Apr 2017 19:58:20 +0200 Subject: [PATCH] cleanup generated files (#1705) * upgrade to spring boot 1.5.2 * add full update to REST API * modify ratings controller * upgrade herold * fix integration test * fix integration test * minor fix * fix integration test * fix integration test * minor cleanup * minor cleanup * remove log4j properties * use standard logbook.xml * remove log4j dependencies * remove commons-logging * merge * fix conflict * exclude commons-logging dependency * cleanup * minor fix * minor fix * fix dependency issues * Revert "fix dependency issues" This reverts commit 83bf1f9fd2e1a9a55f9cacb085669568b06b49ec. * fix dependency issues * minor fix * minor fix * minor fix * cleanup generated files --- .gitignore | 2 + .../com/baeldung/cxf/aegis/BaeldungTest.java | 10 ++ .../java/com/baeldung/jexcel/JExcelTest.java | 8 + .../com/baeldung/poi/excel/ExcelTest.java | 8 + apache-poi/temp.xls | Bin 13824 -> 0 bytes apache-poi/temp.xlsx | Bin 3492 -> 0 bytes jaxb/pom.xml | 3 + .../com/baeldung/jaxb/gen/ObjectFactory.java | 48 ++++++ .../com/baeldung/jaxb/gen/UserRequest.java | 87 ++++++++++ .../com/baeldung/jaxb/gen/UserResponse.java | 149 ++++++++++++++++++ .../com/baeldung/jaxb/gen/package-info.java | 2 + .../java/org/w3/_2001/xmlschema/Adapter1.java | 23 +++ .../shell/simple/SimpleCLIUnitTest.java | 40 +++-- 13 files changed, 358 insertions(+), 22 deletions(-) delete mode 100644 apache-poi/temp.xls delete mode 100644 apache-poi/temp.xlsx create mode 100644 jaxb/src/main/java/com/baeldung/jaxb/gen/ObjectFactory.java create mode 100644 jaxb/src/main/java/com/baeldung/jaxb/gen/UserRequest.java create mode 100644 jaxb/src/main/java/com/baeldung/jaxb/gen/UserResponse.java create mode 100644 jaxb/src/main/java/com/baeldung/jaxb/gen/package-info.java create mode 100644 jaxb/src/main/java/org/w3/_2001/xmlschema/Adapter1.java diff --git a/.gitignore b/.gitignore index f3fa30f3e3..60c38ed8f5 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ spring-openid/src/main/resources/application.properties .recommenders/ /spring-hibernate4/nbproject/ spring-security-openid/src/main/resources/application.properties + +spring-all/*.log diff --git a/apache-cxf/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungTest.java b/apache-cxf/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungTest.java index 559de037a9..935b283cb4 100644 --- a/apache-cxf/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungTest.java +++ b/apache-cxf/cxf-aegis/src/test/java/com/baeldung/cxf/aegis/BaeldungTest.java @@ -3,8 +3,10 @@ package com.baeldung.cxf.aegis; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import org.junit.After; import org.junit.Test; +import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.lang.reflect.Type; @@ -90,4 +92,12 @@ public class BaeldungTest { xmlReader.close(); return courseRepo; } + + @After + public void cleanup(){ + File testFile = new File(fileName); + if (testFile.exists()) { + testFile.delete(); + } + } } \ No newline at end of file diff --git a/apache-poi/src/test/java/com/baeldung/jexcel/JExcelTest.java b/apache-poi/src/test/java/com/baeldung/jexcel/JExcelTest.java index 8ee465be34..72272913d5 100644 --- a/apache-poi/src/test/java/com/baeldung/jexcel/JExcelTest.java +++ b/apache-poi/src/test/java/com/baeldung/jexcel/JExcelTest.java @@ -19,6 +19,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.Before; +import org.junit.After; public class JExcelTest { @@ -53,4 +54,11 @@ public class JExcelTest { .get(1)); } + @After + public void cleanup(){ + File testFile = new File(fileLocation); + if (testFile.exists()) { + testFile.delete(); + } + } } \ No newline at end of file diff --git a/apache-poi/src/test/java/com/baeldung/poi/excel/ExcelTest.java b/apache-poi/src/test/java/com/baeldung/poi/excel/ExcelTest.java index 34fa64dd94..ad36f46f02 100644 --- a/apache-poi/src/test/java/com/baeldung/poi/excel/ExcelTest.java +++ b/apache-poi/src/test/java/com/baeldung/poi/excel/ExcelTest.java @@ -16,6 +16,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.Before; +import org.junit.After; public class ExcelTest { @@ -50,4 +51,11 @@ public class ExcelTest { .get(1)); } + @After + public void cleanup(){ + File testFile = new File(fileLocation); + if (testFile.exists()) { + testFile.delete(); + } + } } \ No newline at end of file diff --git a/apache-poi/temp.xls b/apache-poi/temp.xls deleted file mode 100644 index 1fad76d88d4842cfa56a936fc6b33786ade3291f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13824 zcmeHOOG{Nz6#n*o==F8IULTbdT#CR{M6*Jod_)cu3Q3{{Lis91%@DJK!rN)X+;>{y#nO@hC8;m1@{TC-}B@)&|BFiWMvaEP!Qun=0)+f@=d<1rL6Z7LUMc^D>W6b8@6 zc{U2+x-rS27dWh!eWQH92s|Dphgv?mn1lCIZ=r6bPEi-K`mdeDn%7QI$lvVjR)@`G z;3aE`9@b*YA(U#nOpj~=F)Tm&^8VOBPum&AYZb3kc~g-zZAy7LUb{&S4;pT;XCWfK zDp_x-^=*}N*ogvSehH)A)jPkv*cNDqleCTDy3UPgO{xEp48_$%=z=~i7UHW_+xnH1 zRfAx1;6jW;3$Ybt#E&MpbBs+~OP|uh?EPxebz!)$Fi~(c77%&Em0b{@zFb0ePW55_N28;n?z!)$Fi~(c7 z7%&Em0b{@zFb0ePW55_N28;n?z!)$Fi~(c77%&Emfz8Q)B$-NrsicTXdaPs}OAe|0 z3?Tn?NIIHPD NgSqGGUtRz7{{s%gg0TPq diff --git a/apache-poi/temp.xlsx b/apache-poi/temp.xlsx deleted file mode 100644 index 431a8a662c2cacd3363a1593bc24df699ae34c98..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3492 zcmaJ@dpwhW8+M*Um`n~iM=Hg}LRd~C%vqC?P6B5s`PR_x;(=`>X5uJlpffbAO-jecjjhzArljCl`o~mzS6A4h(O}#sUGx zvuiLKgH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WV(4koTkJC{rIM zB?0rXRtg1#2aT*a7Q%jO5OmioGFYU>y>u|oAb`42?6I(?2U58q zc1&$ZoS7Su@ts`8&U^nT62brG77~F$|4ix@$=Y@t3{03?8R5 zsR+=wD68$r`c%dDNH#_ZDh;fROzOZ+M(gKTIrsz0IyH6F1z&|k*A{YB9yE4$ed+q0 zHX%dP63-OA8Fzb^p?rUAGr0r!5$4ehi<|uM>|{&$ZB3g+V12naU3aWiCF3}z+KHy| zT=@mLHG@7qX5nWe;rp=gZn18>H`*k*@8}P_K2A&(aqCIVt3Bfv;q06jbLq;04-$x9 zTQc=^aw1M44(^D^xNvHkbX!>}8-CnoFI96YG2;~aWz?Ggp&xd2lxrxr-sCii;(=k! zkv>Ie=7d6Q8*(IlFFkFC?d#KK4O z_c1NucQHq)N9V_hZtPwr+GkX>6RySZK38QHn6%*iip&r${Etmd_*a3$ zu)%)rSgapYw<+lm+cq!|A9fCZMz8jzBA5MDwL1>=LU>xOddlGI)LE;p-VO^fl&3C? z7B&Y%Rj1ZzLW$Tgh% zaS6N}5PE>*aM`73taeBatW=%%gr?-#UJ-+xDHwDp0N9#HEYRa~4y2CXSRy@0qZm34 z-q`c{{c4}&w~g{^FTMGxg|l}FA>3_F&YXSN4XH{@0kZc4a*vaFVKd>7PzUct%;P%E&{ zvO8SPZ7w9nef=VN`S=u=)k6z5lR5V`LFE3m!e3KxYba|^VRqC_-~c~ESv$zqVAd1IY&)As=KUG`n ${basedir}/src/main/java false + true + true + false diff --git a/jaxb/src/main/java/com/baeldung/jaxb/gen/ObjectFactory.java b/jaxb/src/main/java/com/baeldung/jaxb/gen/ObjectFactory.java new file mode 100644 index 0000000000..0a3da677ce --- /dev/null +++ b/jaxb/src/main/java/com/baeldung/jaxb/gen/ObjectFactory.java @@ -0,0 +1,48 @@ + +package com.baeldung.jaxb.gen; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.baeldung.jaxb.gen package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.jaxb.gen + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link UserRequest } + * + */ + public UserRequest createUserRequest() { + return new UserRequest(); + } + + /** + * Create an instance of {@link UserResponse } + * + */ + public UserResponse createUserResponse() { + return new UserResponse(); + } + +} diff --git a/jaxb/src/main/java/com/baeldung/jaxb/gen/UserRequest.java b/jaxb/src/main/java/com/baeldung/jaxb/gen/UserRequest.java new file mode 100644 index 0000000000..1c1abc61a6 --- /dev/null +++ b/jaxb/src/main/java/com/baeldung/jaxb/gen/UserRequest.java @@ -0,0 +1,87 @@ + +package com.baeldung.jaxb.gen; + +import java.io.Serializable; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for UserRequest complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="UserRequest">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "UserRequest", propOrder = { + "id", + "name" +}) +@XmlRootElement(name = "userRequest") +public class UserRequest + implements Serializable +{ + + private final static long serialVersionUID = -1L; + protected int id; + @XmlElement(required = true) + protected String name; + + /** + * Gets the value of the id property. + * + */ + public int getId() { + return id; + } + + /** + * Sets the value of the id property. + * + */ + public void setId(int value) { + this.id = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/jaxb/src/main/java/com/baeldung/jaxb/gen/UserResponse.java b/jaxb/src/main/java/com/baeldung/jaxb/gen/UserResponse.java new file mode 100644 index 0000000000..b80405e4a9 --- /dev/null +++ b/jaxb/src/main/java/com/baeldung/jaxb/gen/UserResponse.java @@ -0,0 +1,149 @@ + +package com.baeldung.jaxb.gen; + +import java.io.Serializable; +import java.util.Calendar; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.w3._2001.xmlschema.Adapter1; + + +/** + *

Java class for UserResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="UserResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="gender" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="created" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "UserResponse", propOrder = { + "id", + "name", + "gender", + "created" +}) +@XmlRootElement(name = "userResponse") +public class UserResponse + implements Serializable +{ + + private final static long serialVersionUID = -1L; + protected int id; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String gender; + @XmlElement(required = true, type = String.class) + @XmlJavaTypeAdapter(Adapter1 .class) + @XmlSchemaType(name = "dateTime") + protected Calendar created; + + /** + * Gets the value of the id property. + * + */ + public int getId() { + return id; + } + + /** + * Sets the value of the id property. + * + */ + public void setId(int value) { + this.id = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the gender property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGender() { + return gender; + } + + /** + * Sets the value of the gender property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGender(String value) { + this.gender = value; + } + + /** + * Gets the value of the created property. + * + * @return + * possible object is + * {@link String } + * + */ + public Calendar getCreated() { + return created; + } + + /** + * Sets the value of the created property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCreated(Calendar value) { + this.created = value; + } + +} diff --git a/jaxb/src/main/java/com/baeldung/jaxb/gen/package-info.java b/jaxb/src/main/java/com/baeldung/jaxb/gen/package-info.java new file mode 100644 index 0000000000..639d00179c --- /dev/null +++ b/jaxb/src/main/java/com/baeldung/jaxb/gen/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/jaxb/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.baeldung.jaxb.gen; diff --git a/jaxb/src/main/java/org/w3/_2001/xmlschema/Adapter1.java b/jaxb/src/main/java/org/w3/_2001/xmlschema/Adapter1.java new file mode 100644 index 0000000000..54b3c360dc --- /dev/null +++ b/jaxb/src/main/java/org/w3/_2001/xmlschema/Adapter1.java @@ -0,0 +1,23 @@ + +package org.w3._2001.xmlschema; + +import java.util.Calendar; +import javax.xml.bind.annotation.adapters.XmlAdapter; + +public class Adapter1 + extends XmlAdapter +{ + + + public Calendar unmarshal(String value) { + return (javax.xml.bind.DatatypeConverter.parseDateTime(value)); + } + + public String marshal(Calendar value) { + if (value == null) { + return null; + } + return (javax.xml.bind.DatatypeConverter.printDateTime(value)); + } + +} diff --git a/spring-all/src/test/java/org/baeldung/shell/simple/SimpleCLIUnitTest.java b/spring-all/src/test/java/org/baeldung/shell/simple/SimpleCLIUnitTest.java index 0353083943..cc5ac863b5 100644 --- a/spring-all/src/test/java/org/baeldung/shell/simple/SimpleCLIUnitTest.java +++ b/spring-all/src/test/java/org/baeldung/shell/simple/SimpleCLIUnitTest.java @@ -1,6 +1,7 @@ package org.baeldung.shell.simple; import java.io.File; + import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -15,13 +16,18 @@ public class SimpleCLIUnitTest { @BeforeClass public static void startUp() throws InterruptedException { - Bootstrap bootstrap = new Bootstrap(); + final Bootstrap bootstrap = new Bootstrap(); shell = bootstrap.getJLineShellComponent(); } @AfterClass public static void shutdown() { shell.stop(); + // delete contents.txt + final File testFile = new File("contents.txt"); + if (testFile.exists()) { + testFile.delete(); + } } public static JLineShellComponent getShell() { @@ -31,7 +37,7 @@ public class SimpleCLIUnitTest { @Test public void givenCommandConfig_whenExecutingWebGetCommand_thenCorrectResult() { - CommandResult resultWebSave = shell.executeCommand("web-get --url https://www.google.com"); + final CommandResult resultWebSave = shell.executeCommand("web-get --url https://www.google.com"); Assert.assertTrue(resultWebSave.isSuccess()); } @@ -40,37 +46,27 @@ public class SimpleCLIUnitTest { public void givenCommandConfig_whenExecutingWebSaveCommand_thenCorrectResult() { shell.executeCommand("admin-enable"); - CommandResult result = shell.executeCommand("web-save --url https://www.google.com --out contents.txt"); + final CommandResult result = shell.executeCommand("web-save --url https://www.google.com --out contents.txt"); - Assert.assertArrayEquals( - new boolean[]{ - result.isSuccess(), - new File("contents.txt").exists()}, - new boolean[]{true, true}); + Assert.assertArrayEquals(new boolean[] { result.isSuccess(), new File("contents.txt").exists() }, new boolean[] { true, true }); } @Test public void givenCommandConfig_whenAdminEnableCommandExecuted_thenCorrectAvailability() { - - CommandResult resultAdminDisable = shell.executeCommand("admin-disable"); - CommandResult resultWebSaveUnavailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt"); - CommandResult resultAdminEnable = shell.executeCommand("admin-enable"); - CommandResult resultWebSaveAvailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt"); - Assert.assertArrayEquals( - new boolean[]{ - resultAdminDisable.isSuccess(), - resultWebSaveUnavailable.isSuccess(), - resultAdminEnable.isSuccess(), - resultWebSaveAvailable.isSuccess()}, - new boolean[]{true, false, true, true}); + final CommandResult resultAdminDisable = shell.executeCommand("admin-disable"); + final CommandResult resultWebSaveUnavailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt"); + final CommandResult resultAdminEnable = shell.executeCommand("admin-enable"); + final CommandResult resultWebSaveAvailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt"); + + Assert.assertArrayEquals(new boolean[] { resultAdminDisable.isSuccess(), resultWebSaveUnavailable.isSuccess(), resultAdminEnable.isSuccess(), resultWebSaveAvailable.isSuccess() }, new boolean[] { true, false, true, true }); } @Test public void givenCommandConfig_whenWebSaveCommandExecutedNoOutArgument_thenError() { shell.executeCommand("admin-enable"); - CommandResult resultWebSave = shell.executeCommand("web-save --url https://www.google.com"); + final CommandResult resultWebSave = shell.executeCommand("web-save --url https://www.google.com"); Assert.assertEquals(resultWebSave.isSuccess(), false); } @@ -78,7 +74,7 @@ public class SimpleCLIUnitTest { @Test public void givenCommandConfig_whenExecutingWebGetCommandWithDefaultArgument_thenCorrectResult() { - CommandResult result = shell.executeCommand("web-get https://www.google.com"); + final CommandResult result = shell.executeCommand("web-get https://www.google.com"); Assert.assertEquals(result.isSuccess(), true); }