Repository: incubator-juneau Updated Branches: refs/heads/master 7a39c7cc7 -> 7231baab1
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java index 0872206..8f1ed5a 100755 --- a/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/urlencoding/UrlEncodingSerializerTest.java @@ -447,48 +447,48 @@ public class UrlEncodingSerializerTest { String e = "f1=bar&f2=bar&f2=baz"; assertEquals(e, r); } - + @Test public void testParseParameterObjectMap() throws Exception { String in = "(name='foo bar')"; - + ObjectMap r = UrlEncodingParser.DEFAULT.parse(PartType.QUERY, in, BeanContext.DEFAULT.createSession().getClassMeta(ObjectMap.class)); - + assertEquals("{name:'foo bar'}", JsonSerializer.DEFAULT_LAX.toString(r)); } - + //==================================================================================================== // Test URLENC_paramFormat == PLAINTEXT. //==================================================================================================== @Test public void testPlainTextParams() throws Exception { WriterSerializer s = UrlEncodingSerializer.DEFAULT.builder().plainTextParams().build(); - + assertEquals("_value=foo", s.serialize("foo")); assertEquals("_value='foo'", s.serialize("'foo'")); assertEquals("_value=(foo)", s.serialize("(foo)")); assertEquals("_value=@(foo)", s.serialize("@(foo)")); - + Map<String,Object> m = new AMap<String,Object>() .append("foo", "foo") .append("'foo'", "'foo'") .append("(foo)", "(foo)") .append("@(foo)", "@(foo)"); assertEquals("foo=foo&'foo'='foo'&(foo)=(foo)&@(foo)=@(foo)", s.serialize(m)); - + List<String> l = new AList<String>().appendAll("foo", "'foo'", "(foo)", "@(foo)"); assertEquals("0=foo&1='foo'&2=(foo)&3=@(foo)", s.serialize(l)); - + A a = new A(); assertEquals("'foo'='foo'&(foo)=(foo)&@(foo)=@(foo)&foo=foo", s.serialize(a)); } - + @Bean(sort=true) public static class A { - + @BeanProperty(name="foo") public String f1 = "foo"; - + @BeanProperty(name="'foo'") public String f2 = "'foo'"; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java index 9c003d9..dd268e2 100755 --- a/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/ClassUtilsTest.java @@ -120,13 +120,13 @@ public class ClassUtilsTest { public void getClassFromReadableName() throws Exception { fail("Not implemented"); } - + //==================================================================================================== // findPublicMethod //==================================================================================================== @Test public void testFindPublicMethod() { - + assertNotNull(findPublicMethod(B.class, "m1", void.class)); assertNull(findPublicMethod(B.class, "m1", int.class)); @@ -134,21 +134,21 @@ public class ClassUtilsTest { assertNull(findPublicMethod(B.class, "m3", void.class)); assertNotNull(findPublicMethod(B.class, "m3", int.class)); - + assertNotNull(findPublicMethod(B.class, "m4", CharSequence.class)); assertNotNull(findPublicMethod(B.class, "m4", Object.class)); assertNull(findPublicMethod(B.class, "m4", String.class)); - + assertNotNull(findPublicMethod(B.class, "m5", void.class, int.class, CharSequence.class)); assertNotNull(findPublicMethod(B.class, "m5", void.class, int.class, String.class)); assertNull(findPublicMethod(B.class, "m5", void.class, int.class, Object.class)); - + assertNull(findPublicMethod(B.class, "m5", void.class, int.class)); assertNull(findPublicMethod(B.class, "m5", void.class, int.class, CharSequence.class, CharSequence.class)); } - + public static class B { - + public void m1() {}; protected void m2() {}; public int m3() { return 0; } @@ -156,8 +156,8 @@ public class ClassUtilsTest { public void m5(int f1, CharSequence f2) {} } - - + + //==================================================================================================== // getMethodAnnotation //==================================================================================================== @@ -168,7 +168,7 @@ public class ClassUtilsTest { assertEquals("a3", getMethodAnnotation(TestAnnotation.class, CI3.class.getMethod("a3", CharSequence.class)).value()); assertEquals("a4", getMethodAnnotation(TestAnnotation.class, CI3.class.getMethod("a4")).value()); } - + public static interface CI1 { @TestAnnotation("a1") void a1(); @@ -176,15 +176,19 @@ public class ClassUtilsTest { void a2(); @TestAnnotation("a3") void a3(CharSequence foo); - + void a4(); } - + public static class CI2 implements CI1 { + @Override public void a1() {} + @Override @TestAnnotation("a2b") public void a2() {} + @Override public void a3(CharSequence s) {} + @Override public void a4() {} } @@ -192,10 +196,11 @@ public class ClassUtilsTest { @Override public void a1() {} @Override public void a2() {} + @Override @TestAnnotation("a4") public void a4() {} } - + @Target(METHOD) @Retention(RUNTIME) public @interface TestAnnotation { @@ -213,7 +218,7 @@ public class ClassUtilsTest { s.add(c.getSimpleName()); } assertObjectEquals("['CA1','CA2','CA3','CB','CC','CD']", s); - + s = new TreeSet<String>(); for (Iterator<Class<?>> i = ClassUtils.getParentClasses(CD.class, true, false); i.hasNext();) { Class<?> c = i.next(); @@ -227,7 +232,7 @@ public class ClassUtilsTest { s.add(c.getSimpleName()); } assertObjectEquals("['CA1','CA2','CA3','CB','CC','CD']", s); - + s = new TreeSet<String>(); for (Iterator<Class<?>> i = ClassUtils.getParentClasses(CD.class, false, false); i.hasNext();) { Class<?> c = i.next(); @@ -235,7 +240,7 @@ public class ClassUtilsTest { } assertObjectEquals("['CB','CC','CD']", s); } - + static interface CA1 {} static interface CA2 extends CA1 {} static interface CA3 {} @@ -250,18 +255,18 @@ public class ClassUtilsTest { @Test public void getParentMethodsParentFirst() throws Exception { Set<String> s = new TreeSet<String>(); - for (Method m : ClassUtils.getAllMethods(DD.class, true)) + for (Method m : ClassUtils.getAllMethods(DD.class, true)) if (! m.getName().startsWith("$")) s.add(m.getDeclaringClass().getSimpleName() + '.' + m.getName()); assertObjectEquals("['DA1.da1','DA2.da2','DB.da1','DB.db','DC.da2','DC.dc','DD.da2','DD.dd']", s); s = new TreeSet<String>(); - for (Method m : ClassUtils.getAllMethods(DD.class, false)) + for (Method m : ClassUtils.getAllMethods(DD.class, false)) if (! m.getName().startsWith("$")) s.add(m.getDeclaringClass().getSimpleName() + '.' + m.getName()); assertObjectEquals("['DA1.da1','DA2.da2','DB.da1','DB.db','DC.da2','DC.dc','DD.da2','DD.dd']", s); } - + static interface DA1 { void da1(); } @@ -271,14 +276,17 @@ public class ClassUtilsTest { static interface DA3 {} static interface DA4 {} static abstract class DB implements DA1, DA2 { + @Override public void da1() {} public void db() {} } static class DC extends DB implements DA3 { + @Override public void da2() {} public void dc() {} } static class DD extends DC { + @Override public void da2() {} public void dd() {} } @@ -302,7 +310,7 @@ public class ClassUtilsTest { } assertObjectEquals("['EA.a1','EB.a1','EB.b1']", s); } - + static class EA { int a1; } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java index 5ed3609..bb8e11b 100755 --- a/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/PojoQueryTest.java @@ -261,7 +261,7 @@ public class PojoQueryTest { BeanSession session = BeanContext.DEFAULT.createSession(); SearchArgs sa; List results; - + List<C> in = new AList<C>() .append(new C(1)) .append(new C(2)) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java index 243c905..2f0aec3 100755 --- a/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java @@ -717,7 +717,7 @@ public class StringUtilsTest { assertObjectEquals("{'a=':'1'}", splitMap("a\\==1", ',', '=', true)); assertObjectEquals("{'a\\\\':'1'}", splitMap("a\\\\=1", ',', '=', true)); } - + //==================================================================================================== // isAbsoluteUri(String) //==================================================================================================== http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/utils/StringVarResolverTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/StringVarResolverTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/StringVarResolverTest.java index 14d9ed5..364e233 100755 --- a/juneau-core-test/src/test/java/org/apache/juneau/utils/StringVarResolverTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/StringVarResolverTest.java @@ -231,7 +231,7 @@ public class StringVarResolverTest { } VarResolver vr = vrb.build(); - + // These should all be unchanged. in = "$@{foobar}"; assertEquals(in, vr.resolve(in)); @@ -280,7 +280,7 @@ public class StringVarResolverTest { vrb.vars(AlwaysNullVar.class); vr = vrb.build(); - + in = "$A{xxx}"; assertEquals("", vr.resolve(in)); in = "x$A{xxx}"; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java index d5fd0f4..8e3b43b 100644 --- a/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextResolutionComboTest.java @@ -83,7 +83,7 @@ public class UriContextResolutionComboTest { { /* 3 */ "Happy-4", input( - "http://host:port","/context","/resource","/path", + "http://host:port","/context","/resource","/path", "/" ), results( @@ -98,7 +98,7 @@ public class UriContextResolutionComboTest { { /* 4 */ "Happy-5", input( - "http://host:port","/context","/resource","/path", + "http://host:port","/context","/resource","/path", "foobar" ), results( @@ -113,7 +113,7 @@ public class UriContextResolutionComboTest { { /* 5 */ "Happy-6", input( - "http://host:port","/context","/resource","/path", + "http://host:port","/context","/resource","/path", "" ), results( @@ -128,7 +128,7 @@ public class UriContextResolutionComboTest { { /* 6 */ "Happy-7", input( - "http://host:port","/context","/resource","/path", + "http://host:port","/context","/resource","/path", "context:/foo" ), results( @@ -143,7 +143,7 @@ public class UriContextResolutionComboTest { { /* 7 */ "Happy-8", input( - "http://host:port","/context","/resource","/path", + "http://host:port","/context","/resource","/path", "context:/" ), results( @@ -158,7 +158,7 @@ public class UriContextResolutionComboTest { { /* 8 */ "Happy-9", input( - "http://host:port","/context","/resource","/path", + "http://host:port","/context","/resource","/path", "servlet:/foo" ), results( @@ -173,7 +173,7 @@ public class UriContextResolutionComboTest { { /* 9 */ "Happy-10", input( - "http://host:port","/context","/resource","/path", + "http://host:port","/context","/resource","/path", "servlet:/" ), results( @@ -185,7 +185,7 @@ public class UriContextResolutionComboTest { "/context/resource" ) }, - + // Multiple context and resource parts { /* 10 */ "MultiContextResource-1", @@ -337,7 +337,7 @@ public class UriContextResolutionComboTest { "/c1/c2/r1/r2" ) }, - + // No authority given { /* 20 */ "NoAuthority-1", @@ -489,7 +489,7 @@ public class UriContextResolutionComboTest { "/context/resource" ) }, - + // No authority or context given { /* 30 */ "NoAuthorityOrContext-1", @@ -793,7 +793,7 @@ public class UriContextResolutionComboTest { "/" ) }, - + // No context or resource given. { /* 50 */ "NoContextOrResource-1", @@ -945,13 +945,13 @@ public class UriContextResolutionComboTest { "/" ) }, - }); + }); } - + public static Input input(String authority, String context, String resource, String path, String uri) { return new Input(authority, context, resource, path, uri); } - + public static Results results(String eAbsResource, String eAbsPathInfo, String eRrResource, String eRrPathInfo, String eNoneResource, String eNonePathInfo) { return new Results(eAbsResource, eAbsPathInfo, eRrResource, eRrPathInfo, eNoneResource, eNonePathInfo); } @@ -959,7 +959,7 @@ public class UriContextResolutionComboTest { public static class Input { private final String uri; private final String authority, context, resource, path; - + public Input(String authority, String context, String resource, String path, String uri) { this.authority = authority; this.context = context; @@ -968,10 +968,10 @@ public class UriContextResolutionComboTest { this.uri = uri; } } - + public static class Results { private final String aResource, aPathInfo, rrResource, rrPathInfo, nResource, nPathInfo; - + public Results(String aResource, String aPathInfo, String rrResource, String rrPathInfo, String nResource, String nPathInfo) { this.aResource = aResource; this.aPathInfo = aPathInfo; @@ -981,32 +981,32 @@ public class UriContextResolutionComboTest { this.nPathInfo = nPathInfo; } } - + private String label; private Input in; private Results r; - + public UriContextResolutionComboTest(String label, Input in, Results r) throws Exception { this.label = label; this.in = in; this.r = r; } - + @Test public void a01_testAbsoluteResource() { assertEquals(r.aResource, new UriResolver(ABSOLUTE, RESOURCE, new UriContext(in.authority, in.context, in.resource, in.path)).resolve(in.uri), "{0}: testAbsolute() failed", label); - } - + } + @Test public void a02_testAppendAbsoluteResource() { assertEquals(r.aResource, new UriResolver(ABSOLUTE, RESOURCE, new UriContext(in.authority, in.context, in.resource, in.path)).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label); } - + @Test public void a03_testAbsolutePathInfo() { assertEquals(r.aPathInfo, new UriResolver(ABSOLUTE, PATH_INFO, new UriContext(in.authority, in.context, in.resource, in.path)).resolve(in.uri), "{0}: testAbsolute() failed", label); - } - + } + @Test public void a04_testAppendAbsolutePathInfo() { assertEquals(r.aPathInfo, new UriResolver(ABSOLUTE, PATH_INFO, new UriContext(in.authority, in.context, in.resource, in.path)).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label); @@ -1015,8 +1015,8 @@ public class UriContextResolutionComboTest { @Test public void a05_testRootRelativeResource() { assertEquals(r.rrResource, new UriResolver(ROOT_RELATIVE, RESOURCE, new UriContext(in.authority, in.context, in.resource, in.path)).resolve(in.uri), "{0}: testAbsolute() failed", label); - } - + } + @Test public void a06_testAppendRootRelativeResource() { assertEquals(r.rrResource, new UriResolver(ROOT_RELATIVE, RESOURCE, new UriContext(in.authority, in.context, in.resource, in.path)).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label); @@ -1025,8 +1025,8 @@ public class UriContextResolutionComboTest { @Test public void a07_testRootRelativePathInfo() { assertEquals(r.rrPathInfo, new UriResolver(ROOT_RELATIVE, PATH_INFO, new UriContext(in.authority, in.context, in.resource, in.path)).resolve(in.uri), "{0}: testAbsolute() failed", label); - } - + } + @Test public void a08_testAppendRootRelativePathInfo() { assertEquals(r.rrPathInfo, new UriResolver(ROOT_RELATIVE, PATH_INFO, new UriContext(in.authority, in.context, in.resource, in.path)).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label); @@ -1035,8 +1035,8 @@ public class UriContextResolutionComboTest { @Test public void a09_testNoneResource() { assertEquals(r.nResource, new UriResolver(NONE, RESOURCE, new UriContext(in.authority, in.context, in.resource, in.path)).resolve(in.uri), "{0}: testAbsolute() failed", label); - } - + } + @Test public void a10_testAppendNoneResource() { assertEquals(r.nResource, new UriResolver(NONE, RESOURCE, new UriContext(in.authority, in.context, in.resource, in.path)).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label); @@ -1045,8 +1045,8 @@ public class UriContextResolutionComboTest { @Test public void a11_testNonePathInfo() { assertEquals(r.nPathInfo, new UriResolver(NONE, PATH_INFO, new UriContext(in.authority, in.context, in.resource, in.path)).resolve(in.uri), "{0}: testAbsolute() failed", label); - } - + } + @Test public void a12_testAppendNonePathInfo() { assertEquals(r.nPathInfo, new UriResolver(NONE, PATH_INFO, new UriContext(in.authority, in.context, in.resource, in.path)).append(new StringBuilder(), in.uri).toString(), "{0}: testAbsolute() failed", label); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java b/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java index 9b94944..408c594 100644 --- a/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/utils/UriContextUriComboTest.java @@ -183,30 +183,30 @@ public class UriContextUriComboTest { "/" ) }, - }); + }); } - + public static Input input(String authority, String context, String resource, String path) { return new Input(authority, context, resource, path); } - - public static Results results(String eAbsoluteAuthority, String eAbsoluteContext, String eAbsoluteResource, String eAbsolutePath, + + public static Results results(String eAbsoluteAuthority, String eAbsoluteContext, String eAbsoluteResource, String eAbsolutePath, String eRootRelativeContext, String eRootRelativeResource, String eRootRelativePath) { return new Results(eAbsoluteAuthority, eAbsoluteContext, eAbsoluteResource, eAbsolutePath, eRootRelativeContext, eRootRelativeResource, eRootRelativePath); } public static class Input { private final UriContext uriContext; - + public Input(String authority, String context, String resource, String path) { this.uriContext = new UriContext(authority, context, resource, path); } } - + public static class Results { private final String eAbsoluteAuthority, eAbsoluteContext, eAbsoluteResource, eAbsolutePath, eRootRelativeContext, eRootRelativeResource, eRootRelativePath; - - public Results(String eAbsoluteAuthority, String eAbsoluteContext, String eAbsoluteResource, String eAbsolutePath, + + public Results(String eAbsoluteAuthority, String eAbsoluteContext, String eAbsoluteResource, String eAbsolutePath, String eRootRelativeContext, String eRootRelativeResource, String eRootRelativePath) { this.eAbsoluteAuthority = eAbsoluteAuthority; this.eAbsoluteContext = eAbsoluteContext; @@ -221,13 +221,13 @@ public class UriContextUriComboTest { private String label; private Input in; private Results r; - + public UriContextUriComboTest(String label, Input in, Results r) throws Exception { this.label = label; this.in = in; this.r = r; } - + @Test public void a1_testAbsoluteAuthority() { assertEquals(r.eAbsoluteAuthority, in.uriContext.getAbsoluteAuthority(), "{0}: testAbsoluteAuthority() failed", label); @@ -237,27 +237,27 @@ public class UriContextUriComboTest { public void a2_testAbsoluteContext() { assertEquals(r.eAbsoluteContext, in.uriContext.getAbsoluteContextRoot(), "{0}: testAbsoluteContext() failed", label); } - + @Test public void a3_testAbsoluteResource() { assertEquals(r.eAbsoluteResource, in.uriContext.getAbsoluteServletPath(), "{0}: testAbsoluteResource() failed", label); } - + @Test public void a4_testAbsolutePath() { assertEquals(r.eAbsolutePath, in.uriContext.getAbsolutePathInfo(), "{0}: testAbsolutePath() failed", label); } - + @Test public void a5_testRootRelativeContext() { assertEquals(r.eRootRelativeContext, in.uriContext.getRootRelativeContextRoot(), "{0}: testRootRelativeContext() failed", label); } - + @Test public void a6_testRootRelativeResource() { assertEquals(r.eRootRelativeResource, in.uriContext.getRootRelativeServletPath(), "{0}: testRootRelativeResource() failed", label); } - + @Test public void a7_testRootRelativePath() { assertEquals(r.eRootRelativePath, in.uriContext.getRootRelativePathInfo(), "{0}: testRootRelativePath() failed", label); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java b/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java index ec7bcf4..8ca9c37 100644 --- a/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/xml/BasicXmlTest.java @@ -1659,21 +1659,21 @@ public class BasicXmlTest { return this; } } - + public static class BeanWithWhitespaceTextFields { @Xml(format=XmlFormat.TEXT) public String a; - + public BeanWithWhitespaceTextFields init(String s) { a = s; return this; } } - + public static class BeanWithWhitespaceTextPwsFields { @Xml(format=XmlFormat.TEXT_PWS) public String a; - + public BeanWithWhitespaceTextPwsFields init(String s) { a = s; return this; @@ -1683,7 +1683,7 @@ public class BasicXmlTest { public static class BeanWithWhitespaceMixedFields { @Xml(format=XmlFormat.MIXED) public String[] a; - + public BeanWithWhitespaceMixedFields init(String[] s) { a = s; return this; @@ -1693,7 +1693,7 @@ public class BasicXmlTest { public static class BeanWithWhitespaceMixedPwsFields { @Xml(format=XmlFormat.MIXED_PWS) public String[] a; - + public BeanWithWhitespaceMixedPwsFields init(String[] s) { a = s; return this; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonParserTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonParserTest.java b/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonParserTest.java index 73e1e4e1..becaff9 100755 --- a/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonParserTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/xml/CommonParserTest.java @@ -166,7 +166,7 @@ public class CommonParserTest { // XML parser may or may not support line numbers. assertTrue(MyParserListener.events.get(0).startsWith("unknownProperty,")); } - + public static class MyParserListener extends ParserListener { final static List<String> events = new LinkedList<String>(); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java ---------------------------------------------------------------------- diff --git a/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java b/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java index c9a4fbe..ffcca5a 100755 --- a/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java +++ b/juneau-core-test/src/test/java/org/apache/juneau/xml/XmlTest.java @@ -296,7 +296,7 @@ public class XmlTest { public static class J1 { @BeanProperty(properties="f2") public List<J2> f1 = new AList<J2>().append(new J2()); } - + @Bean(typeName="bar") public static class J2 { public int f2 = 2; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/AddressBook.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/AddressBook.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/AddressBook.java index ede24f2..72c1473 100755 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/AddressBook.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/AddressBook.java @@ -35,7 +35,7 @@ public class AddressBook extends LinkedList<Person> implements IAddressBook { public AddressBook(URI uri) throws Exception { this.uri = uri; } - + @Override /* IAddressBook */ public void init() throws Exception { clear(); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java index e120a67..983ecb1 100755 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/addressbook/IAddressBook.java @@ -22,7 +22,7 @@ import org.apache.juneau.remoteable.*; */ @Remoteable public interface IAddressBook { - + /** Initialize this address book with preset entries */ void init() throws Exception; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java index 31a845c..4147570 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/DirectoryResource.java @@ -50,7 +50,7 @@ import org.apache.juneau.utils.*; public class DirectoryResource extends Resource { private static final long serialVersionUID = 1L; - + private File rootDir; // The root directory // Settings enabled through servlet init parameters http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/FileSpaceResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/FileSpaceResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/FileSpaceResource.java index 8cd48ce..e985f72 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/FileSpaceResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/FileSpaceResource.java @@ -49,7 +49,7 @@ public class FileSpaceResource extends Resource { new FileSpace("E:", 100000000, 97500000), new FileSpace("F:", 100000000, 5000000) }; - + /** * Our bean class being serialized. * Properties are listed to ensure order across all JVMs. @@ -59,7 +59,7 @@ public class FileSpaceResource extends Resource { private final String drive; private final long total, available; - + public FileSpace(String drive, long total, long available) { this.drive = drive; this.total = total; @@ -83,7 +83,7 @@ public class FileSpaceResource extends Resource { public float getPctFull() { return ((100 * available) / total); } - + @Html(render=FileSpaceStatusRender.class) public FileSpaceStatus getStatus() { float pf = getPctFull(); @@ -94,11 +94,11 @@ public class FileSpaceResource extends Resource { return FileSpaceStatus.SEVERE; } } - + public static enum FileSpaceStatus { OK, WARNING, SEVERE; } - + public static class FileSpacePctRender extends HtmlRender<Float> { @Override @@ -112,15 +112,15 @@ public class FileSpaceResource extends Resource { @Override public Object getContent(SerializerSession session, Float value) { - if (value >= 90) + if (value >= 90) return div( - String.format("%.0f%%", value), + String.format("%.0f%%", value), style("@keyframes color_change { from { background-color: red; } to { background-color: yellow; }") ); return String.format("%.0f%%", value); } } - + public static class FileSpaceStatusRender extends HtmlRender<FileSpaceStatus> { @Override http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java index 8c4bd8c..df23b15 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/MethodExampleResource.java @@ -39,7 +39,7 @@ import org.apache.juneau.utils.*; ) public class MethodExampleResource extends Resource { private static final long serialVersionUID = 1L; - + private static final UUID SAMPLE_UUID = UUID.fromString("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); private static final String SAMPLE_UUID_STRING = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"; @@ -53,7 +53,7 @@ public class MethodExampleResource extends Resource { }; } - /** + /** * Methodology #1 - GET request using annotated attributes. * This approach uses annotated parameters for retrieving input. */ @@ -87,7 +87,7 @@ public class MethodExampleResource extends Resource { .append("header-doNotTrack", doNotTrack); } - /** + /** * Methodology #2 - GET request using methods on RestRequest and RestResponse. * This approach uses low-level request/response objects to perform the same as above. */ @@ -96,7 +96,7 @@ public class MethodExampleResource extends Resource { RestRequest req, // A direct subclass of HttpServletRequest. RestResponse res // A direct subclass of HttpServletResponse. ) throws Exception { - + // HTTP method. String method = req.getMethod(); @@ -136,7 +136,7 @@ public class MethodExampleResource extends Resource { res.setOutput(m); } - /** + /** * Methodology #3 - GET request using special objects. * This approach uses intermediate-level APIs. * The framework recognizes the parameter types and knows how to resolve them. @@ -180,5 +180,5 @@ public class MethodExampleResource extends Resource { .append("header-lang", lang) .append("header-accept", accept) .append("header-doNotTrack", doNotTrack); - } + } } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java index a24e6ee..9702326 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PetStoreResource.java @@ -54,19 +54,19 @@ public class PetStoreResource extends Resource { // Our database. private Map<Integer,Pet> petDB; - + @Override /* Servlet */ public synchronized void init(RestConfig config) throws Exception { // Load our database from a local JSON file. petDB = JsonParser.DEFAULT.parse(getClass().getResourceAsStream("PetStore.json"), LinkedHashMap.class, Integer.class, Pet.class); super.init(config); } - + // Exclude the 'breed' and 'getsAlongWith' properties from the beans. @RestMethod( - name="GET", - path="/", - summary="The complete list of pets in the store", + name="GET", + path="/", + summary="The complete list of pets in the store", bpExcludes="{Pet:'breed,getsAlongWith'}", converters=Queryable.class ) @@ -82,33 +82,33 @@ public class PetStoreResource extends Resource { // Our bean class. public static class Pet { - + @Html(link="servlet:/{id}") // Creates a hyperlink in HTML view. @NameProperty // Links the parent key to this bean. public int id; - + public String name; public Kind kind; public String breed; public List<Kind> getsAlongWith; - + @BeanProperty(format="$%.2f") // Renders price in dollars. public float price; - + @BeanProperty(swap=DateSwap.RFC2822D.class) // Renders dates in RFC2822 format. public Date birthDate; - + public int getAge() { Calendar c = new GregorianCalendar(); c.setTime(birthDate); - return new GregorianCalendar().get(Calendar.YEAR) - c.get(Calendar.YEAR); + return new GregorianCalendar().get(Calendar.YEAR) - c.get(Calendar.YEAR); } } - + @Html(render=KindRender.class) // Render as an icon in HTML. public static enum Kind { - CAT, - DOG, + CAT, + DOG, BIRD, FISH, MOUSE, http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java index 0121c84..b56f55b 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/PhotosResource.java @@ -107,7 +107,7 @@ public class PhotosResource extends Resource { photos.put(id, new Photo(id, image)); return "OK"; } - + /** POST request handler */ @RestMethod(name="POST", path="/", parsers=ImageParser.class, summary="Add a photo") public Photo setPhoto(@Body BufferedImage image) throws Exception { http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java index 54a5415..9406e88 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SqlQueryResource.java @@ -60,7 +60,7 @@ public class SqlQueryResource extends Resource { allowUpdates = cf.getBoolean("SqlQueryResource/allowUpdates", false); allowTempUpdates = cf.getBoolean("SqlQueryResource/allowTempUpdates", false); includeRowNums = cf.getBoolean("SqlQueryResource/includeRowNums", false); - + try { Class.forName(driver).newInstance(); } catch (Exception e) { @@ -120,7 +120,7 @@ public class SqlQueryResource extends Resource { // Don't try to submit empty input. if (isEmpty(in.sql)) return results; - + if (in.pos < 1 || in.pos > 10000) throw new RestException(SC_BAD_REQUEST, "Invalid value for position. Must be between 1-10000"); if (in.limit < 1 || in.limit > 10000) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java index 1adb401..3b97926 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/SystemPropertiesResource.java @@ -2,7 +2,7 @@ // * 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 * +// * with the License. You may obtain a copy of the License at * // * * // * http://www.apache.org/licenses/LICENSE-2.0 * // * * @@ -27,12 +27,12 @@ import org.apache.juneau.rest.annotation.Body; @RestResource( path="/systemProperties", - + // Title and description that show up on HTML rendition page. // Also used in Swagger doc. title="System properties resource", description="REST interface for performing CRUD operations on system properties.", - + // Links on the HTML rendition page. // "request:/..." URIs are relative to the request URI. // "servlet:/..." URIs are relative to the servlet URI. @@ -45,19 +45,19 @@ import org.apache.juneau.rest.annotation.Body; + "</div>", css="aside {display:table-caption;}" ), - + // Properties that get applied to all serializers and parsers. properties={ // Use single quotes. @Property(name=SERIALIZER_quoteChar, value="'") }, - + // Our stylesheet for the HTML rendition. stylesheet="styles/devops.css", - + // Support GZIP encoding on Accept-Encoding header. encoders=GzipEncoder.class, - + swagger=@ResourceSwagger( contact="{name:'John Smith',email:'[email protected]'}", license="{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}", @@ -106,7 +106,7 @@ public class SystemPropertiesResource extends Resource { public String getSystemProperty(@Path String propertyName) throws Throwable { return System.getProperty(propertyName); } - + @RestMethod( name="PUT", path="/{propertyName}", summary="Replace system property", @@ -122,7 +122,7 @@ public class SystemPropertiesResource extends Resource { headers={ @Parameter(name="Location", description="The root URL of this resource.") } - ), + ), @Response(value=403, description="User is not an admin.") } ) @@ -147,7 +147,7 @@ public class SystemPropertiesResource extends Resource { headers={ @Parameter(name="Location", description="The root URL of this resource.") } - ), + ), @Response(value=403, description="Unauthorized: User is not an admin.") } ) @@ -171,7 +171,7 @@ public class SystemPropertiesResource extends Resource { headers={ @Parameter(name="Location", description="The root URL of this resource.") } - ), + ), @Response(value=403, description="Unauthorized: User is not an admin") } ) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java index 2e98fdf..ea84e95 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java @@ -35,7 +35,7 @@ import org.apache.juneau.rest.client.*; ) public class TumblrParserResource extends Resource { private static final long serialVersionUID = 1L; - + private static final int MAX_POSTS = 100; @RestMethod(name="GET", path="/", summary="Get the instructions page") http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java index 81278b2..0bade0e 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java @@ -42,7 +42,7 @@ import org.apache.juneau.utils.*; @RestResource( path="/addressBook", messages="nls/AddressBookResource", - + // Links on the HTML rendition page. // "request:/..." URIs are relative to the request URI. // "servlet:/..." URIs are relative to the servlet URI. @@ -63,41 +63,41 @@ import org.apache.juneau.utils.*; + "</div>", footer="$W{poweredByJuneau}" ), - + // Widgets for $W variables above. widgets={ PoweredByJuneauWidget.class, ContentTypeLinksColumnWidget.class }, - + // Properties that get applied to all serializers and parsers. properties={ - + // Allow INIT as a method parameter. @Property(name=REST_allowMethodParam, value="*"), // Use single quotes. @Property(name=SERIALIZER_quoteChar, value="'"), - + // Make RDF/XML readable. @Property(name=RDF_rdfxml_tab, value="5"), - + // Make RDF parsable by adding a root node. @Property(name=RDF_addRootProperty, value="true"), - + // Make URIs absolute so that we can easily reference them on the client side. @Property(name=SERIALIZER_uriResolution, value="ABSOLUTE"), - + // Make the anchor text on URLs be just the path relative to the servlet. @Property(name=HTML_uriAnchorText, value="SERVLET_RELATIVE") }, - + // Our stylesheet for the HTML rendition. stylesheet="styles/devops.css", - + // Support GZIP encoding on Accept-Encoding header. encoders=GzipEncoder.class, - + // Swagger info. swagger=@ResourceSwagger( contact="{name:'John Smith',email:'[email protected]'}", http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java index a9093cf..99829f7 100644 --- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java +++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/AddressBookResourceTest.java @@ -71,7 +71,7 @@ public class AddressBookResourceTest extends RestTestcase { } } - + //==================================================================================================== // Get AddressBookResource as JSON //==================================================================================================== @@ -91,7 +91,7 @@ public class AddressBookResourceTest extends RestTestcase { +"\n isCurrent: false" +"\n }" +"\n ]" - +"\n}"; + +"\n}"; JsonParser p = new JsonParserBuilder().pojoSwaps(CalendarSwap.DateMedium.class).build(); Person person = p.parse(in, Person.class); if (debug) System.err.println(person); @@ -270,7 +270,7 @@ public class AddressBookResourceTest extends RestTestcase { List<Person> people; IAddressBook ab = client.getRemoteableProxy(IAddressBook.class, "/addressBook/proxy"); - + // Reinitialize the resource ab.init(); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java index b0ac910..24d3f8a 100644 --- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java +++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/RootResourcesTest.java @@ -64,7 +64,7 @@ public class RootResourcesTest extends RestTestcase { String s = x2.getObjectMap("info").getString("description"); if (debug) System.err.println(s); assertTrue(s, s.startsWith("Example of a router resource page")); - + client.closeQuietly(); } @@ -84,7 +84,7 @@ public class RootResourcesTest extends RestTestcase { String s = x2.getObjectMap("info").getString("description"); if (debug) System.err.println(s); assertTrue(s, s.startsWith("Example of a router resource page")); - + client.closeQuietly(); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java index cbdce58..9fd8d5b 100644 --- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java +++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SampleRemoteableServicesResourceTest.java @@ -27,7 +27,7 @@ import org.junit.*; public class SampleRemoteableServicesResourceTest extends RestTestcase { static RestClient[] clients; - + private static String path = SamplesMicroservice.getURI().getPath() + "/addressBook/proxy"; @BeforeClass http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesMicroservice.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesMicroservice.java b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesMicroservice.java index 21538ed..a9af029 100644 --- a/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesMicroservice.java +++ b/juneau-examples-rest/src/test/java/org/apache/juneau/examples/rest/SamplesMicroservice.java @@ -2,7 +2,7 @@ // * 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 * +// * with the License. You may obtain a copy of the License at * // * * // * http://www.apache.org/licenses/LICENSE-2.0 * // * * @@ -66,7 +66,7 @@ public class SamplesMicroservice { startMicroservice(); return microserviceURI; } - + /** * Stops the microservice. */ @@ -80,7 +80,7 @@ public class SamplesMicroservice { System.err.println(e); // NOT DEBUG } } - + /** * Create a new HTTP client. */ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java index 4ca8551..12c0a9d 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/Microservice.java @@ -95,7 +95,7 @@ public abstract class Microservice { private static Args args; private static ConfigFile cf; private static ManifestFile mf; - + private String cfPath; /** @@ -107,7 +107,7 @@ public abstract class Microservice { protected Microservice(String...args) throws Exception { Microservice.args = new Args(args); } - + /** * Specifies the path of the config file for this microservice. * <p> @@ -119,7 +119,7 @@ public abstract class Microservice { * (e.g. <js>"java -jar myjar.jar"</js> will look for <js>"myjar.cfg"</js>). * </ol> * If this path does not exist, a {@link FileNotFoundException} will be thrown from the {@link #start()} command. - * + * * @param cfPath The absolute or relative path of the config file. * @param create Create the file if it doesn't exist. * @return This object (for method chaining). @@ -136,7 +136,7 @@ public abstract class Microservice { this.cfPath = cfPath; return this; } - + /** * Specifies the config file for this microservice. * <p> @@ -161,7 +161,7 @@ public abstract class Microservice { * is located in the project root. * <li>Using the class loader for this class to find the file at the URL <js>"META-INF/MANIFEST.MF"</js>. * </ol> - * + * * @param mf The manifest file of this microservice. * @return This object (for method chaining). */ @@ -172,7 +172,7 @@ public abstract class Microservice { /** * Convenience method for specifying the manifest contents directly. - * + * * @param contents The lines in the manifest file. * @return This object (for method chaining). * @throws IOException @@ -185,7 +185,7 @@ public abstract class Microservice { /** * Same as {@link #setManifest(Manifest)} except specified through a {@link File} object. - * + * * @param f The manifest file of this microservice. * @return This object (for method chaining). * @throws IOException If a problem occurred while trying to read the manifest file. @@ -197,7 +197,7 @@ public abstract class Microservice { /** * Same as {@link #setManifest(Manifest)} except finds and loads the manifest file of the jar file that the specified class is contained within. - * + * * @param c The class whose jar file contains the manifest to use for this microservice. * @return This object (for method chaining). * @throws IOException If a problem occurred while trying to read the manifest file. @@ -223,7 +223,7 @@ public abstract class Microservice { * </ul> * <p> * Subclasses can override this method to provide their own variables. - * + * * <h5 class='section'>Example:</h5> * <p class='bcode'> * <jd>/** @@ -295,7 +295,7 @@ public abstract class Microservice { * String variables defined by {@link #createVarResolver()} are automatically resolved when using this method. * <p> * This method can be called from the class constructor. - * + * * <h5 class='section'>Example:</h5> * <p class='bcode'> * <cc>#--------------------------</cc> @@ -373,7 +373,7 @@ public abstract class Microservice { * and entries converted to simple strings. * <p> * This method can be called from the class constructor. - * + * * <h5 class='section'>Example:</h5> * <p class='bcode'> * <jc>// Get Main-Class from manifest file.</jc> @@ -389,7 +389,7 @@ public abstract class Microservice { return mf; } - + //-------------------------------------------------------------------------------- // Abstract lifecycle methods. //-------------------------------------------------------------------------------- @@ -405,7 +405,7 @@ public abstract class Microservice { * @throws Exception */ public Microservice start() throws Exception { - + // -------------------------------------------------------------------------------- // Try to get the manifest file if it wasn't already set. // -------------------------------------------------------------------------------- @@ -443,7 +443,7 @@ public abstract class Microservice { ConfigFileBuilder cfb = new ConfigFileBuilder(); if (cfPath != null) cf = cfb.build(cfPath).getResolving(createVarResolver().build()); - + // -------------------------------------------------------------------------------- // Find config file. // Can either be passed in as first parameter, or we discover it using @@ -493,7 +493,7 @@ public abstract class Microservice { onConfigChange(cf, changes); } }); - + // -------------------------------------------------------------------------------- // Add exit listeners. // -------------------------------------------------------------------------------- @@ -544,7 +544,7 @@ public abstract class Microservice { * Default implementation simply calls {@link #onStop()}. * <p> * Overridden methods MUST call this method LAST so that the {@link #onStop()} method is called. - * + * * @return This object (for method chaining). */ public Microservice stop() { @@ -560,7 +560,7 @@ public abstract class Microservice { System.exit(2); } - + //-------------------------------------------------------------------------------- // Lifecycle listener methods. // Subclasses can override these methods to run code on certain events. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java index 931d4d9..6765849 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java @@ -99,7 +99,7 @@ public class RestMicroservice extends Microservice { super(args); } - + //-------------------------------------------------------------------------------- // Methods implemented on Microservice API //-------------------------------------------------------------------------------- @@ -147,11 +147,11 @@ public class RestMicroservice extends Microservice { return this; } - + //-------------------------------------------------------------------------------- // RestMicroservice API methods. //-------------------------------------------------------------------------------- - + /** * Returns the port that this microservice started up on. * @return The port that this microservice started up on. @@ -342,7 +342,7 @@ public class RestMicroservice extends Microservice { ConfigFile cf = getConfig(); ObjectMap mf = getManifest(); - + int[] ports = cf.getObjectWithDefault("REST/port", mf.get(int[].class, "Rest-Port", new int[]{8000}), int[].class); port = findOpenPort(ports); @@ -350,7 +350,7 @@ public class RestMicroservice extends Microservice { System.err.println("Open port not found. Tried " + JsonSerializer.DEFAULT_LAX.toString(ports)); System.exit(1); } - + contextPath = cf.getString("REST/contextPath", mf.getString("Rest-ContextPath", "/")); if (cf.getBoolean("REST/useSsl")) { @@ -397,7 +397,7 @@ public class RestMicroservice extends Microservice { return server; } - + private static int findOpenPort(int[] ports) { for (int port : ports) { try { @@ -416,7 +416,7 @@ public class RestMicroservice extends Microservice { * Method used to start the Jetty server created by {@link #createServer()}. * <p> * Subclasses can override this method to customize server startup. - * + * * @return The port that this server started on. * @throws Exception */ @@ -544,7 +544,7 @@ public class RestMicroservice extends Microservice { } } - + //-------------------------------------------------------------------------------- // Lifecycle listener methods. //-------------------------------------------------------------------------------- @@ -584,17 +584,17 @@ public class RestMicroservice extends Microservice { */ protected void onPostStopServer() {} - + //-------------------------------------------------------------------------------- // Overridden methods. //-------------------------------------------------------------------------------- - + @Override /* Microservice */ public RestMicroservice setConfig(String cfPath, boolean create) throws IOException { super.setConfig(cfPath, create); return this; } - + @Override /* Microservice */ public RestMicroservice setConfig(ConfigFile cf) { super.setConfig(cf); @@ -624,7 +624,7 @@ public class RestMicroservice extends Microservice { super.setManifest(c); return this; } - + //-------------------------------------------------------------------------------- // Other methods. //-------------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java index b2353b0..3bee423 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java @@ -63,12 +63,12 @@ public class LogsResource extends Resource { return f.isDirectory() || f.getName().endsWith(".log"); } }; - + @Override /* RestServlet */ public synchronized void init(RestConfig config) throws Exception { super.init(config); ConfigFile cf = config.getConfigFile(); - + logDir = new File(cf.getString("Logging/logDir", ".")); leFormatter = new LogEntryFormatter( cf.getString("Logging/format", "[{date} {level}] {msg}%n"), @@ -88,12 +88,12 @@ public class LogsResource extends Resource { * @throws Exception */ @RestMethod( - name="GET", - path="/*", + name="GET", + path="/*", swagger=@MethodSwagger( responses={@Response(200),@Response(404)} ) - ) + ) public Object getFileOrDirectory(RestRequest req, RestResponse res, @Properties ObjectMap properties, @PathRemainder String path) throws Exception { File f = getFile(path); @@ -132,7 +132,7 @@ public class LogsResource extends Resource { * @throws Exception */ @RestMethod( - name="VIEW", + name="VIEW", path="/*", swagger=@MethodSwagger( responses={@Response(200),@Response(404)} @@ -211,9 +211,9 @@ public class LogsResource extends Resource { * @throws Exception */ @RestMethod( - name="PARSE", - path="/*", - converters=Queryable.class, + name="PARSE", + path="/*", + converters=Queryable.class, swagger=@MethodSwagger( responses={@Response(200),@Response(404)} ) @@ -238,8 +238,8 @@ public class LogsResource extends Resource { * @throws Exception */ @RestMethod( - name="DOWNLOAD", - path="/*", + name="DOWNLOAD", + path="/*", swagger=@MethodSwagger( responses={@Response(200),@Response(404)} ) @@ -264,7 +264,7 @@ public class LogsResource extends Resource { * @throws Exception */ @RestMethod( - name="DELETE", + name="DELETE", path="/*", swagger=@MethodSwagger( responses={@Response(200),@Response(404)} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java ---------------------------------------------------------------------- diff --git a/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java b/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java index 6e0e008..7ec2633 100644 --- a/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java +++ b/juneau-rest-jaxrs/src/main/java/org/apache/juneau/rest/jaxrs/BaseProvider.java @@ -47,7 +47,7 @@ public class BaseProvider implements MessageBodyReader<Object>, MessageBodyWrite try { properties = new ObjectMap(); JuneauProvider jp = getClass().getAnnotation(JuneauProvider.class); - + for (Property p : jp.properties()) properties.put(p.name(), p.value()); for (String p : jp.flags()) @@ -66,7 +66,7 @@ public class BaseProvider implements MessageBodyReader<Object>, MessageBodyWrite .pojoSwaps(jp.pojoSwaps()) .properties(properties) .build(); - + } catch (Exception e) { throw new RuntimeException(e); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java ---------------------------------------------------------------------- diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java index 0fdcb58..53c3e93 100644 --- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java +++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/SwappedPojoSwap.java @@ -2,7 +2,7 @@ // * 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 * +// * with the License. You may obtain a copy of the License at * // * * // * http://www.apache.org/licenses/LICENSE-2.0 * // * * http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java ---------------------------------------------------------------------- diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java index 8061b6d..06facf7 100644 --- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java +++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/pojos/TestEnum.java @@ -2,7 +2,7 @@ // * 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 * +// * with the License. You may obtain a copy of the License at * // * * // * http://www.apache.org/licenses/LICENSE-2.0 * // * * http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/7231baab/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java ---------------------------------------------------------------------- diff --git a/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java b/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java index a77766d..e631bbe 100644 --- a/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java +++ b/juneau-rest/src/main/java/org/apache/juneau/rest/RestRequest.java @@ -248,10 +248,10 @@ public final class RestRequest extends HttpServletRequestWrapper { public ObjectMap getProperties() { return this.properties; } - + /** * Shortcut for calling <code>getProperties().append(name, value);</code> fluently. - * + * * @param name The property name. * @param value The property value. * @return This object (for method chaining).
