This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 846770e  JUNEAU-140 Provide initial contents of PetStore modules.
846770e is described below

commit 846770ecf398092a45c1fbccecfb8526b2a8c261
Author: JamesBognar <[email protected]>
AuthorDate: Sun Sep 8 20:53:49 2019 -0400

    JUNEAU-140 Provide initial contents of PetStore modules.
---
 .../src/main/java/org/apache/juneau/ClassMeta.java |  2 --
 .../java/org/apache/juneau/petstore/PetStore.java  |  4 ++--
 .../org/apache/juneau/petstore/dto/CreatePet.java  | 27 +++-------------------
 .../java/org/apache/juneau/petstore/dto/Pet.java   | 25 +-------------------
 .../org/apache/juneau/petstore/dto/UpdatePet.java  | 15 ++++--------
 .../main/java/org/apache/juneau/petstore/Main.java |  4 +++-
 .../org/apache/juneau/petstore/init/Pets.json      |  2 +-
 .../juneau/petstore/rest/PetStoreResource.java     |  8 +++++--
 8 files changed, 20 insertions(+), 67 deletions(-)

diff --git 
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java 
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
index 741f19d..b3e1de1 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/ClassMeta.java
@@ -488,8 +488,6 @@ public final class ClassMeta<T> implements Type {
                        }
 
                        for (MethodInfo m : ci.getDeclaredMethods()) {
-                               if (ci.getSimpleName().equals("Order"))
-                                       System.err.println();
                                if (m.hasAnnotation(Example.class)) {
                                        if (! (m.isStatic() && 
m.hasFuzzyParamTypes(BeanSession.class) && 
ci.isParentOf(m.getReturnType().inner())))
                                                throw new 
ClassMetaRuntimeException(c, "@Example used on invalid method ''{0}''.  Must be 
static and return an instance of the declaring class.", m);
diff --git 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java
 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java
index cbaeaa3..8bdfd47 100644
--- 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java
+++ 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/PetStore.java
@@ -80,7 +80,7 @@ public interface PetStore {
         * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
         * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header 
specified.
         */
-       @RemoteMethod /* method and path inferred from method name */
+       @RemoteMethod(method=POST, path="/pet")
        public long createPet(
                @Body(
                        description="Pet object to add to the store"
@@ -302,7 +302,7 @@ public interface PetStore {
         * @throws NotAcceptable Unsupported <c>Accept</c> header specified.
         * @throws UnsupportedMediaType Unsupported <c>Content-Type</c> header 
specified.
         */
-       @RemoteMethod
+       @RemoteMethod(method=POST, path="/user")
        public Ok createUser(
                @Body(
                        description="Created user object"
diff --git 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreatePet.java
 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreatePet.java
index 024eb3e..2064cc2 100644
--- 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreatePet.java
+++ 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/CreatePet.java
@@ -22,7 +22,7 @@ import org.apache.juneau.jsonschema.annotation.*;
  *     <li class='extlink'>{@source}
  * </ul>
  */
-@Bean(fluentSetters=true, properties="name,price,species,tags,photo")
+@Bean(fluentSetters=true, properties="name,price,species,tags")
 public class CreatePet {
 
        @Schema(description="Pet name.", minLength=3, maxLength=50)
@@ -37,10 +37,6 @@ public class CreatePet {
        @Schema(description="Pet attributes.", example="friendly,smart")
        private String[] tags;
 
-       @Schema(description="Photo URL.")
-       @URI
-       private String photo;
-
        /**
         * Constructor.
         *
@@ -50,12 +46,11 @@ public class CreatePet {
         * @param tags The <bc>tags</bc> property value.
         * @param photo The <bc>photo</bc> property value.
         */
-       public CreatePet(String name, float price, Species species, String[] 
tags, String photo) {
+       public CreatePet(String name, float price, Species species, String[] 
tags) {
                this.name = name;
                this.price = price;
                this.species = species;
                this.tags = tags;
-               this.photo = photo;
        }
 
        /**
@@ -131,22 +126,6 @@ public class CreatePet {
                return this;
        }
 
-       /**
-        * @return The <bc>photo</bc> property value.
-        */
-       public String getPhoto() {
-               return photo;
-       }
-
-       /**
-        * @param value The <bc>photo</bc> property value.
-        * @return This object (for method chaining).
-        */
-       public CreatePet photo(String value) {
-               this.photo = value;
-               return this;
-       }
-
        
//-----------------------------------------------------------------------------------------------------------------
        // Other
        
//-----------------------------------------------------------------------------------------------------------------
@@ -155,6 +134,6 @@ public class CreatePet {
         * @return An example POJO.
         */
        public static CreatePet example() {
-               return new CreatePet("Doggie", 9.99f, Species.DOG, new 
String[]{"smart","friendly"}, null);
+               return new CreatePet("Doggie", 9.99f, Species.DOG, new 
String[]{"smart","friendly"});
        }
 }
diff --git 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java
 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java
index e2f53fc..cb9dff0 100644
--- 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java
+++ 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/Pet.java
@@ -31,7 +31,7 @@ import org.apache.juneau.serializer.*;
  *     <li class='extlink'>{@source}
  * </ul>
  */
-@Bean(typeName="Pet", fluentSetters=true, 
properties="id,species,name,tags,price,status,photo")
+@Bean(typeName="Pet", fluentSetters=true, 
properties="id,species,name,tags,price,status")
 @Entity(name="PetstorePet")
 public class Pet {
 
@@ -61,11 +61,6 @@ public class Pet {
        @Schema(description="Pet species.")
        private PetStatus status;
 
-       @Column
-       @Schema(description="Photo URL.")
-       @URI
-       private String photo;
-
        /**
         * Applies the specified data to this object.
         *
@@ -77,7 +72,6 @@ public class Pet {
                this.price = x.getPrice();
                this.species = x.getSpecies();
                this.tags = x.getTags() == null ? null : 
Arrays.asList(x.getTags());
-               this.photo = x.getPhoto();
                return this;
        }
 
@@ -94,7 +88,6 @@ public class Pet {
                this.species = x.getSpecies();
                this.tags = Arrays.asList(x.getTags());
                this.status = x.getStatus();
-               this.photo = x.getPhoto();
                return this;
        }
 
@@ -208,22 +201,6 @@ public class Pet {
        }
 
        /**
-        * @return The <bc>photo</jc> property value.
-        */
-       public String getPhoto() {
-               return photo;
-       }
-
-       /**
-        * @param value The <bc>photo</jc> property value.
-        * @return This object (for method chaining).
-        */
-       public Pet photo(String value) {
-               this.photo = value;
-               return this;
-       }
-
-       /**
         * @param statuses The statuses to match against.
         * @return <jk>true</jk> if this pet matches at least one of the 
specified statuses.
         */
diff --git 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UpdatePet.java
 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UpdatePet.java
index a6842dd..d4b671f 100644
--- 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UpdatePet.java
+++ 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-api/src/main/java/org/apache/juneau/petstore/dto/UpdatePet.java
@@ -22,7 +22,7 @@ import org.apache.juneau.jsonschema.annotation.*;
  *     <li class='extlink'>{@source}
  * </ul>
  */
-@Bean(fluentSetters=true, properties="id,name,price,species,tags,photo,status")
+@Bean(fluentSetters=true, properties="id,name,price,species,tags,status")
 public class UpdatePet extends CreatePet {
 
        @Schema(description="Pet identifier.", minimum="1")
@@ -40,10 +40,9 @@ public class UpdatePet extends CreatePet {
         * @param species The <bc>species</bc> property value.
         * @param tags The <bc>tags</bc> property value.
         * @param status The <bc>status</bc> property value.
-        * @param photo The <bc>photo</bc> property value.
         */
-       public UpdatePet(long id, String name, float price, Species species, 
String[] tags, PetStatus status, String photo) {
-               super(name, price, species, tags, photo);
+       public UpdatePet(long id, String name, float price, Species species, 
String[] tags, PetStatus status) {
+               super(name, price, species, tags);
                this.id = id;
                this.status = status;
        }
@@ -113,17 +112,11 @@ public class UpdatePet extends CreatePet {
                return this;
        }
 
-       @Override
-       public UpdatePet photo(String value) {
-               super.photo(value);
-               return this;
-       }
-
        
//-----------------------------------------------------------------------------------------------------------------
        // Other
        
//-----------------------------------------------------------------------------------------------------------------
 
        public static UpdatePet example() {
-               return new UpdatePet(123, "Doggie", 9.99f, Species.DOG, new 
String[]{"smart","friendly"}, PetStatus.SOLD, null);
+               return new UpdatePet(123, "Doggie", 9.99f, Species.DOG, new 
String[]{"smart","friendly"}, PetStatus.SOLD);
        }
 }
diff --git 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/java/org/apache/juneau/petstore/Main.java
 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/java/org/apache/juneau/petstore/Main.java
index e038a52..d005383 100644
--- 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/java/org/apache/juneau/petstore/Main.java
+++ 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/java/org/apache/juneau/petstore/Main.java
@@ -48,7 +48,7 @@ public class Main {
                        SimpleJson.DEFAULT_READABLE.println(pets);
 
                        // Initialize the application through REST calls.
-                       init(new PrintWriter(System.err), petStore);
+                       init(new PrintWriter(System.out), petStore);
 
                } catch (Exception e) {
                        e.printStackTrace();
@@ -94,6 +94,8 @@ public class Main {
                        ps.createUser(x);
                        w.println(format("Created user:  username={0}", 
x.getUsername()));
                }
+
+               w.flush();
        }
 
        
//-----------------------------------------------------------------------------------------------------------------
diff --git 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Pets.json
 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Pets.json
index a78bf19..c0aa31f 100644
--- 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Pets.json
+++ 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-client/src/main/resources/org/apache/juneau/petstore/init/Pets.json
@@ -12,7 +12,7 @@
 // 
***************************************************************************************************************************
 
 [
-       {species:'CAT', name:'Mr. Frisky', price:39.99, tags:['friendly'], 
status:'AVAILABLE', photo:'/petstore/photos/cat'},
+       {species:'CAT', name:'Mr. Frisky', price:39.99, tags:['friendly'], 
status:'AVAILABLE'},
        {species:'DOG', name:'Kibbles', price:99.99, tags:['loyal'], 
status:'AVAILABLE'},
        {species:'RABBIT', name:'Hoppy', price:49.99, tags:['friendly','smells 
nice'], status:'AVAILABLE'},
        {species:'RABBIT', name:'Hoppy 2', price:49.99, status:'AVAILABLE'},
diff --git 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java
 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java
index 66c42b5..d44fab7 100644
--- 
a/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java
+++ 
b/juneau-examples/juneau-examples-petstore/juneau-examples-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java
@@ -97,6 +97,8 @@ import org.apache.juneau.rest.converters.*;
                }
        ),
        staticFiles={"htdocs:/htdocs"}  // Expose static files in htdocs 
subpackage.
+
+       ,debug="true"
 )
 @HtmlDocConfig(
        widgets={
@@ -159,8 +161,6 @@ public class PetStoreResource extends BasicRest implements 
PetStore {
                        .append("pet", "All pets in the store")
                        .append("store", "Orders and inventory")
                        .append("user", "Petstore users")
-                       .append("photos", "Photos service")
-                       .append("sql", "SQL query service")
                ;
        }
 
@@ -207,6 +207,8 @@ public class PetStoreResource extends BasicRest implements 
PetStore {
 
        @Override /* PetStore */
        @RestMethod(
+               name=POST,
+               path="/pet",
                summary="Add a new pet to the store",
                swagger=@MethodSwagger(
                        tags="pet",
@@ -439,6 +441,8 @@ public class PetStoreResource extends BasicRest implements 
PetStore {
 
        @Override
        @RestMethod(
+               name=POST,
+               path="/user",
                summary="Create user",
                description="This can only be done by the logged in user.",
                swagger=@MethodSwagger(

Reply via email to