http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/addressbook/nls/AddressBookResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/addressbook/nls/AddressBookResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/addressbook/nls/AddressBookResource.properties deleted file mode 100644 index 61aec3e..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/addressbook/nls/AddressBookResource.properties +++ /dev/null @@ -1,89 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -title = AddressBook sample resource -description = Proof-of-concept resource that shows off the capabilities of working with POJO resources - -getRoot.summary = Get root page -getRoot.description = Jumping off page for top-level Person and Address beans. - -doInit.summary = Reinitialize this resource -doInit.description = Resets the address book to the original contents. -doInit.res.200.description = Returns the string "OK" - -getAllPeople.summary = Get all people in the address book -getAllPeople.res.200.description = Returns a serialized List<Person> -getAllPeople.res.200.examples = {'text/json':"[\n\t{\n\t\turi:'http://hostname/addressBook/person/1',\n\t\taddressBookUri:'http://localhost/addressBook',\n\t\tid:1,\n\t\tname:'John Smith',\n\t\tbirthDate:'Jan 1, 2000',\n\t\taddresses:[\n\t\t\t{\n\t\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\t\tid:1,\n\t\t\t\tstreet:'101 Main St',\n\t\t\t\tcity:'Anywhere',\n\t\t\t\tstate:'NY',\n\t\t\t\tzip:12345,\n\t\t\t\tisCurrent:true\n\t\t\t}\n\t\t]\n\t}\n]"} - -getPerson.summary = Get a single person by ID -getPerson.req.path.id.description = Person ID -getPerson.req.path.id.type = integer -getPerson.res.200.description = Returns a serialized Person bean -getPerson.res.200.examples = {'text/json':"{\n\turi:'http://hostname/addressBook/person/1',\n\taddressBookUri:'http://localhost/addressBook',\n\tid:1,\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\tid:1,\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"} -getPerson.res.404.description = Person ID not found - -getAllAddresses.summary = Get all addresses in the address book -getAllAddresses.res.200.description = Returns a serialized List<Address> -getAllAddresses.res.200.examples = {'text/json':"[\n\t{\n\t\turi:'http://localhost/addressBook/addresses/1',\n\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\tid:1,\n\t\tstreet:'101 Main St',\n\t\tcity:'Anywhere',\n\t\tstate:'NY',\n\t\tzip:12345,\n\t\tisCurrent:true\n\t}\n]"} - -getAddress.summary = Get a single address by ID -getAddress.req.path.id.description = Address ID -getAddress.req.path.id.type = integer -getAddress.res.200.description = Returns a serialized Address bean -getAddress.res.200.examples = {'text/json':"{\n\turi:'http://localhost/addressBook/addresses/1',\n\tpersonUri:'http://localhost/addressBook/people/1',\n\tid:1,\n\tstreet:'101 Main St',\n\tcity:'Anywhere',\n\tstate:'NY',\n\tzip:12345,\n\tisCurrent:true\n}"} -getAddress.res.404.description = Address ID not found - -createPerson.summary = Create a new Person bean -createPerson.req.body.description = Serialized CreatePerson bean -createPerson.req.body.schema = {example:"{\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"} -createPerson.res.307.header.Location.description = URL of new person - -createAddress.summary = Create a new Address bean -createAddress.req.path.id.description = Person ID -createAddress.req.path.id.type = integer -createAddress.req.body.schema = {example:"{\n\tstreet:'101 Main St',\n\tcity:'Anywhere',\n\tstate:'NY',\n\tzip:12345,\n\tisCurrent:true\n}"} -createAddress.res.307.header.Location.description = URL of new address - -deletePerson.summary = Delete a Person bean -deletePerson.req.path.id.description = Person ID -deletePerson.req.path.id.type = integer -deletePerson.res.200.description = Returns the string "DELETE successful" -deletePerson.res.404.description = Person ID not found - -deleteAddress.summary = Delete an Address bean -deleteAddress.req.path.id.description = Address ID -deleteAddress.res.200.description = Returns the string "DELETE successful" -deleteAddress.res.404.description = Address ID not found - -updatePerson.summary = Change property on Person bean -updatePerson.req.path.id.description = Person ID -updatePerson.req.path.id.type = integer -updatePerson.req.body.description = Any object matching the field -updatePerson.res.200.description = Returns the string "PUT successful" -updatePerson.res.400.description = Invalid object type used -updatePerson.res.404.description = Person ID not found - -updateAddress.summary = Change property on Address bean -updateAddress.req.path.id.description = Address ID -updateAddress.req.path.id.type = integer -updateAddress.req.body.description = Any object matching the field -updateAddress.res.200.description = Returns the string "PUT successful" -updateAddress.res.400.description = Invalid object type used -updateAddress.res.404.description = Address ID not found - -getOptions.summary = View resource options - -getCognosData.summary = Get data in Cognos/XML format -getCognosData.res.200.description = Returns a serialized DataSet - -otherNotes = GZip support enabled. Public methods can be invoked by using the &Method URL parameter. 'text/cognos+xml' support available under root resource only \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/averycutecat.jpg ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/averycutecat.jpg b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/averycutecat.jpg deleted file mode 100644 index 9760674..0000000 Binary files a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/averycutecat.jpg and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/htdocs/code-highlighting.css ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/htdocs/code-highlighting.css b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/htdocs/code-highlighting.css deleted file mode 100644 index a016a6c..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/htdocs/code-highlighting.css +++ /dev/null @@ -1,136 +0,0 @@ -/*************************************************************************************************************************** - * 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 * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations under the License. * - ***************************************************************************************************************************/ -code, -tt, -pre, -dt code { - font-size: 9pt; -} - -/*--- Bordered code ---*/ -p.bcode { - font-size: 9pt; - white-space: pre; - border: 1px solid black; - margin: 10px 20px; - padding: 10px; - border-radius: 10px; - overflow: hidden; - font-family: monospace; - background-color: #f8f8f8; - border-color: #cccccc; - -moz-tab-size: 3; - tab-size: 3; - -o-tab-size: 3; -} - -.fixedWidth { - max-width: 800px; -} - -/* Override padding bottom in javadoc comments. */ -.blockList p.bcode { - padding-bottom: 0px !important; -} - -/*--- Unbordered code ---*/ -p.code { - font-size: 9pt; - white-space: pre; - font-family: monospace; - padding-bottom: 15px; - margin: -15px; -} - -td.code { - font-size: 9pt; - white-space: pre; - font-family: monospace; -} - -table.code { - font-size: 9pt; - white-space: pre; - font-family: monospace; -} - -/*--- Java code effects ---*/ -jc,jd,jt,jk,js,jf,jsf,jsm,ja { - font-size: 9pt; - white-space: pre; - font-family: monospace; -} -/* Comment */ -jc { - color: green; -} -/* Javadoc comment */ -jd { - color: #3f5fbf; -} -/* Javadoc tag */ -jt { - color: #7f9fbf; - font-weight: bold; -} -/* Primitive */ -jk { - color: #7f0055; - font-weight: bold; -} -/* String */ -js { - color: blue; -} -/* Field */ -jf { - color: blue; -} -/* Static field */ -jsf { - color: blue; - font-style: italic; -} -/* Static method */ -jsm { - font-style: italic; -} -/* Annotation */ -ja { - color: grey; -} - -/*--- XML code effects ---*/ -xt,xa,xc,xs { - font-size: 9pt; - white-space: pre; - font-family: monospace; -} - -xt { - color: DarkCyan; -} - -xa { - color: purple; -} - -xc { - color: mediumblue; -} - -xs { - color: blue; - font-style: italic; -} - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/AtomFeedResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/AtomFeedResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/AtomFeedResource.properties deleted file mode 100644 index 7ff4a44..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/AtomFeedResource.properties +++ /dev/null @@ -1,21 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# AtomFeedResource labels -#-------------------------------------------------------------------------------- -title = Sample ATOM feed resource -description = Sample resource that shows how to render ATOM feeds -getFeed = Get the sample ATOM feed -setFeed = Overwrite the sample ATOM feed -doOptions = Show resource options http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/CodeFormatterResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/CodeFormatterResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/CodeFormatterResource.properties deleted file mode 100644 index ac2f236..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/CodeFormatterResource.properties +++ /dev/null @@ -1,18 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# CodeFormatterResource labels -#-------------------------------------------------------------------------------- -title = Code Formatter -description = Utility for generating HTML code-formatted source code http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/HelloWorldResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/HelloWorldResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/HelloWorldResource.properties deleted file mode 100644 index 7c8f03d..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/HelloWorldResource.properties +++ /dev/null @@ -1,19 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# HelloWorldResource labels -#-------------------------------------------------------------------------------- -title = Hello World sample resource -description = Simplest possible resource -sayHello = Responds with "Hello world!" http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/JsonSchemaResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/JsonSchemaResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/JsonSchemaResource.properties deleted file mode 100644 index 1a486a9..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/JsonSchemaResource.properties +++ /dev/null @@ -1,20 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# JsonSchemaResource labels -#-------------------------------------------------------------------------------- -title = Sample resource that shows how to generate JSON-Schema documents -getSchema = Get the JSON-Schema document -setSchema = Overwrite the JSON-Schema document -doOptions = Show resource options http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/MethodExampleResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/MethodExampleResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/MethodExampleResource.properties deleted file mode 100644 index be0bcf1..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/MethodExampleResource.properties +++ /dev/null @@ -1,37 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# MethodExampleResource labels -#-------------------------------------------------------------------------------- -title = A simple REST method example resource -doGetExample.summary = Sample GET method -doGetExample1.summary = Sample GET using annotations -doGetExample1.req.path.a1.description = Sample variable -doGetExample1.req.path.a2.description = Sample variable -doGetExample1.req.path.a3.description = Sample variable -doGetExample1.req.query.p1.description = Sample parameter -doGetExample1.req.query.p2.description = Sample parameter -doGetExample1.req.query.p3.description = Sample parameter -doGetExample1.req.header.Accept-Language.description = Sample header -doGetExample1.req.header.DNT.description = Sample header -doGetExample2.summary = Sample GET using Java APIs -doGetExample2.req.path.a1.description = Sample variable -doGetExample2.req.path.a2.description = Sample variable -doGetExample2.req.path.a3.description = Sample variable -doGetExample2.req.query.p1.description = Sample parameter -doGetExample2.req.query.p2.description = Sample parameter -doGetExample2.req.query.p3.description = Sample parameter -doGetExample2.req.header.Accept-Language.description = Sample header -doGetExample2.req.header.DNT.description = Sample header -getOptions.summary = Get these options http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/PhotosResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/PhotosResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/PhotosResource.properties deleted file mode 100644 index 93f7f7d..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/PhotosResource.properties +++ /dev/null @@ -1,24 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# PhotosResource labels -#-------------------------------------------------------------------------------- -title = Sample resource that allows images to be uploaded and retrieved. -getAllPhotos = Show the list of all currently loaded photos -getPhoto = Get a photo by ID -addPhoto = Add a photo -setPhoto = Overwrite a photo by ID -deletePhoto = Delete a photo by ID -doOptions = Show resource options - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RequestEchoResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RequestEchoResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RequestEchoResource.properties deleted file mode 100644 index db7641c..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RequestEchoResource.properties +++ /dev/null @@ -1,19 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# RequestEchoResource labels -#-------------------------------------------------------------------------------- -title = Echos the current HttpServletRequest object back to the browser. -doGet = Serializes the incoming HttpServletRequest object. - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RootResources.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RootResources.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RootResources.properties deleted file mode 100644 index 301057d..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RootResources.properties +++ /dev/null @@ -1,18 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# RootResources labels -#-------------------------------------------------------------------------------- -title = Root resources -description = This is an example of a router resource that is used to access other resources. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SampleRemoteableServlet.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SampleRemoteableServlet.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SampleRemoteableServlet.properties deleted file mode 100644 index 48fd5ce..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SampleRemoteableServlet.properties +++ /dev/null @@ -1,17 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# SampleRemoteableServlet labels -#-------------------------------------------------------------------------------- -title = Sample resource that demonstrates the remotable API http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SourceResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SourceResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SourceResource.properties deleted file mode 100644 index 363f00a..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SourceResource.properties +++ /dev/null @@ -1,19 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# SourceResource labels -#-------------------------------------------------------------------------------- -title = Servlet for viewing source code on classes whose Java files are present on the classpath. -getSource = View source on the specified classes. - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SqlQueryResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SqlQueryResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SqlQueryResource.properties deleted file mode 100644 index 527ca93..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SqlQueryResource.properties +++ /dev/null @@ -1,19 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# SqlQueryResource labels -#-------------------------------------------------------------------------------- -title = Sample resource that shows how to serialize SQL ResultSets -doGet = Display the query entry page -doPost = Execute one or more queries http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TempDirResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TempDirResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TempDirResource.properties deleted file mode 100644 index 94c009e..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TempDirResource.properties +++ /dev/null @@ -1,18 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# TempDirResource labels -#-------------------------------------------------------------------------------- -title = Temp Directory View Service -description = View and download files in the '$S{java.io.tmpdir}' directory. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TumblrParserResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TumblrParserResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TumblrParserResource.properties deleted file mode 100644 index 28a3e72..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TumblrParserResource.properties +++ /dev/null @@ -1,19 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# SqlQueryResource labels -#-------------------------------------------------------------------------------- -title = Tumblr blog parser service -getInstructions = Get the instructions page -parseBlog = Parse the specified blog http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/UrlEncodedFormResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/UrlEncodedFormResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/UrlEncodedFormResource.properties deleted file mode 100644 index c7015c3..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/UrlEncodedFormResource.properties +++ /dev/null @@ -1,22 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# UrlEncodedFormResource labels -#-------------------------------------------------------------------------------- -title = URL-Encoded Form Post Example -description = Shows how URL-Encoded form input can be loaded into POJOs. POJO is simply echoed back. -aString = A String: -aNumber = A Number: -aDate = A Date: -submit = submit \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/main/resources/samples.cfg ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/samples.cfg b/juneau-samples/src/main/resources/samples.cfg deleted file mode 100755 index 758e6b8..0000000 --- a/juneau-samples/src/main/resources/samples.cfg +++ /dev/null @@ -1,143 +0,0 @@ -# *************************************************************************************************************************** -# * 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 * -# * * -# * http://www.apache.org/licenses/LICENSE-2.0 * -# * * -# * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -# * specific language governing permissions and limitations under the License. * -# *************************************************************************************************************************** - -#================================================================================ -# Basic configuration file for SaaS microservices -# Subprojects can use this as a starting point. -#================================================================================ - -#================================================================================ -# REST settings -#================================================================================ -[REST] - -port = 10000 - -# Authentication: NONE, BASIC. -authType = NONE - -# The BASIC auth username, password, and realm -loginUser = -loginPassword = -authRealm = - -# Stylesheet to use for HTML views. -# The default options are: -# - styles/juneau.css -# - styles/devops.css -# Other stylesheets can be referenced relative to the servlet package or working -# directory. -stylesheet = styles/devops.css - -# What to do when the config file is saved. -# Possible values: -# NOTHING - Don't do anything. -# RESTART_SERVER - Restart the Jetty server. -# RESTART_SERVICE - Shutdown and exit with code '3'. -saveConfigAction = RESTART_SERVER - -# Enable SSL support. -useSsl = false - -#================================================================================ -# Bean properties on the org.eclipse.jetty.util.ssl.SslSocketFactory class -#-------------------------------------------------------------------------------- -# Ignored if REST/useSsl is false. -# Specify any of the following fields: -# allowRenegotiate (boolean) -# certAlias (String) -# crlPath (String) -# enableCRLDP (boolean) -# enableOCSP (boolean) -# excludeCipherSuites (String[]) -# excludeProtocols (String[]) -# includeCipherSuites (String[]) -# includeProtocols (String...) -# keyManagerPassword (String) -# keyStore (String) -# keyStorePassword (String) -# keyStorePath (String) -# keyStoreProvider (String) -# keyStoreType (String) -# maxCertPathLength (int) -# needClientAuth (boolean) -# ocspResponderURL (String) -# protocol (String) -# provider (String) -# secureRandomAlgorithm (String) -# sessionCachingEnabled (boolean) -# sslKeyManagerFactoryAlgorithm (String) -# sslSessionCacheSize (int) -# sslSessionTimeout (int) -# trustAll (boolean) -# trustManagerFactoryAlgorithm (String) -# trustStore (String) -# trustStorePassword (String) -# trustStoreProvider (String) -# trustStoreType (String) -# validateCerts (boolean) -# validatePeerCerts (boolean) -# wantClientAuth (boolean) -#================================================================================ -[REST-SslContextFactory] -keyStorePath = client_keystore.jks -keyStorePassword* = {HRAaRQoT} -excludeCipherSuites = TLS_DHE.*, TLS_EDH.* -excludeProtocols = SSLv3 -allowRenegotiate = false - -#================================================================================ -# Logger settings -# See FileHandler Java class for details. -#================================================================================ -[Logging] -logDir = logs -logFile = sample.%g.log -dateFormat = yyyy.MM.dd hh:mm:ss -format = [{date} {level}] {msg}%n -append = false -limit = 10M -count = 5 -levels = { org.apache.juneau:'INFO' } -useStackTraceHashes = true -consoleLevel = WARNING - -#================================================================================ -# System properties -#-------------------------------------------------------------------------------- -# These are arbitrary system properties that can be set during startup. -#================================================================================ -[SystemProperties] - -# Configure Jetty for StdErrLog Logging -org.eclipse.jetty.util.log.class = org.eclipse.jetty.util.log.StrErrLog - -# Jetty logging level -org.eclipse.jetty.LEVEL = WARN - -#================================================================================ -# DockerRegistryResource properties -#================================================================================ -[DockerRegistry] -url = http://docker.apache.org:5000/v1 - -#================================================================================ -# SqlQueryResource properties -#================================================================================ -[SqlQueryResource] -driver = org.apache.derby.jdbc.EmbeddedDriver -connectionUrl = jdbc:derby:C:/testDB;create=true -allowTempUpdates = true -includeRowNums = true - - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/test/java/org/apache/juneau/rest/samples/AddressBookResourceTest.java ---------------------------------------------------------------------- diff --git a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/AddressBookResourceTest.java b/juneau-samples/src/test/java/org/apache/juneau/rest/samples/AddressBookResourceTest.java deleted file mode 100644 index 8522838..0000000 --- a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/AddressBookResourceTest.java +++ /dev/null @@ -1,231 +0,0 @@ -// *************************************************************************************************************************** -// * 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 * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.rest.samples; - -import static org.apache.juneau.rest.samples.TestUtils.*; -import static org.junit.Assert.*; - -import java.util.*; - -import org.apache.juneau.*; -import org.apache.juneau.html.*; -import org.apache.juneau.internal.*; -import org.apache.juneau.json.*; -import org.apache.juneau.rest.client.*; -import org.apache.juneau.samples.addressbook.*; -import org.apache.juneau.transforms.*; -import org.apache.juneau.xml.*; -import org.junit.*; - -@SuppressWarnings({"serial"}) -public class AddressBookResourceTest { - - private static boolean debug = false; - - static RestClient[] clients; - - @BeforeClass - public static void beforeClass() throws Exception { - clients = new RestClient[] { - new SamplesRestClient(JsonSerializer.class, JsonParser.class), - new SamplesRestClient(XmlSerializer.class, XmlParser.class), - new SamplesRestClient(HtmlSerializer.class, HtmlParser.class).setAccept("text/html+stripped"), - new SamplesRestClient(XmlSerializer.class, HtmlParser.class).setAccept("text/html+stripped") - }; - for (RestClient c : clients) { - c.getSerializer().addPojoSwaps(CalendarSwap.DateMedium.class); - c.getParser().addPojoSwaps(CalendarSwap.DateMedium.class); - c.getSerializer().setProperty(XmlSerializerContext.XML_autoDetectNamespaces, true); - } - } - - @AfterClass - public static void afterClass() { - for (RestClient c : clients) { - c.closeQuietly(); - } - } - - //==================================================================================================== - // Get AddressBookResource as JSON - //==================================================================================================== - @Test - public void testBasic() throws Exception { - String in = IOUtils.read(getClass().getResourceAsStream("/org/apache/juneau/server/test/AddressBookResource_test0Test.json")); - JsonParser p = new JsonParser().addPojoSwaps(CalendarSwap.DateMedium.class); - Person person = p.parse(in, Person.class); - if (debug) System.err.println(person); - } - - // A list of People objects. - public static class PersonList extends LinkedList<Person> {} - - //==================================================================================================== - // PojoRest tests - //==================================================================================================== - @Test - public void testPojoRest() throws Exception { - for (RestClient client : clients) { - int rc; - Person p; - List<Person> people; - - // Reinitialize the resource - rc = client.doGet("/addressBook?method=init").run(); - assertEquals(200, rc); - - // Simple GETs - people = client.doGet("/addressBook/people").getResponse(PersonList.class); - assertEquals("Barack Obama", people.get(0).name); - assertEquals(76638, people.get(1).addresses.get(0).zip); - - // PUT a simple String field - p = people.get(0); - rc = client.doPut(p.uri+"/name", "foo").run(); - assertEquals(200, rc); - String name = client.doGet(p.uri+"/name").getResponse(String.class); - assertEquals("foo", name); - p = client.doGet(p.uri).getResponse(Person.class); - assertEquals("foo", p.name); - - // POST an address as JSON - CreateAddress ca = new CreateAddress("a1","b1","c1",1,false); - Address a = client.doPost(p.uri + "/addresses", new ObjectMap(BeanContext.DEFAULT.createSession().toBeanMap(ca))).getResponse(Address.class); - assertEquals("a1", a.street); - a = client.doGet(a.uri).getResponse(Address.class); - assertEquals("a1", a.street); - assertEquals(1, a.zip); - assertFalse(a.isCurrent); - - // POST an address as a bean - ca = new CreateAddress("a2","b2","c2",2,true); - a = client.doPost(p.uri + "/addresses", ca).getResponse(Address.class); - assertEquals("a2", a.street); - a = client.doGet(a.uri).getResponse(Address.class); - assertEquals("a2", a.street); - assertEquals(2, a.zip); - assertTrue(a.isCurrent); - - // POST a person - CreatePerson billClinton = new CreatePerson("Bill Clinton", AddressBook.toCalendar("Aug 19, 1946"), - new CreateAddress("a3","b3","c3",3,false) - ); - rc = client.doPost("/addressBook/people", billClinton).run(); - assertEquals(200, rc); - people = client.doGet("/addressBook/people").getResponse(PersonList.class); - p = people.get(2); - assertEquals(3, people.size()); - assertEquals("Bill Clinton", p.name); - - // DELETE an address - rc = client.doDelete(p.addresses.get(0).uri).run(); - assertEquals(200, rc); - people = client.doGet("/addressBook/people").getResponse(PersonList.class); - p = people.get(2); - assertEquals(0, p.addresses.size()); - - // DELETE a person - rc = client.doDelete(p.uri).run(); - assertEquals(200, rc); - people = client.doGet("/addressBook/people").getResponse(PersonList.class); - assertEquals(2, people.size()); - - // Reinitialize the resource - rc = client.doGet("/addressBook?method=init").run(); - assertEquals(200, rc); - } - } - - //==================================================================================================== - // PojoQuery tests - //==================================================================================================== - @Test - public void testPojoQuery() throws Exception { - - for (RestClient client : clients) { - RestCall r; - List<Person> people; - - // Reinitialize the resource - int rc = client.doGet("/addressBook?method=init").run(); - assertEquals(200, rc); - - r = client.doGet("/addressBook/people?q=(name=B*)"); - people = r.getResponse(PersonList.class); - assertEquals(1, people.size()); - assertEquals("Barack Obama", people.get(0).name); - - r = client.doGet("/addressBook/people?q=(name='Barack+Obama')"); - people = r.getResponse(PersonList.class); - assertEquals(1, people.size()); - assertEquals("Barack Obama", people.get(0).name); - - r = client.doGet("/addressBook/people?q=(name='Barack%20Obama')"); - people = r.getResponse(PersonList.class); - assertEquals(1, people.size()); - assertEquals("Barack Obama", people.get(0).name); - - r = client.doGet("/addressBook/people?v=(name,birthDate)"); - people = r.getResponse(PersonList.class); - assertEquals("Barack Obama", people.get(0).name); - assertTrue(people.get(0).getAge() > 10); - assertEquals(0, people.get(0).addresses.size()); - - r = client.doGet("/addressBook/people?v=(addresses,birthDate)"); - people = r.getResponse(PersonList.class); - assertNull(people.get(0).name); - assertTrue(people.get(0).getAge() > 10); - assertEquals(2, people.get(0).addresses.size()); - - r = client.doGet("/addressBook/people?s=($o(age=d))"); - people = r.getResponse(PersonList.class); - assertTrue(people.get(0).getAge() > 10); - r = client.doGet("/addressBook/people?s=(age)"); - people = r.getResponse(PersonList.class); - assertTrue(people.get(0).getAge() > 10); - r = client.doGet("/addressBook/people?s=($o(age=a))"); - people = r.getResponse(PersonList.class); - assertTrue(people.get(0).getAge() > 10); - - r = client.doGet("/addressBook/people?p=1&l=1"); - people = r.getResponse(PersonList.class); - assertEquals(1, people.size()); - assertTrue(people.get(0).getAge() > 10); - } - } - - //==================================================================================================== - // PojoIntrospector tests - //==================================================================================================== - @Test - public void testPojoIntrospector() throws Exception { - - for (RestClient client : clients) { - - List<Person> people; - - // Reinitialize the resource - int rc = client.doGet("/addressBook?method=init").run(); - assertEquals(200, rc); - - // Simple GETs - people = client.doGet("/addressBook/people").getResponse(PersonList.class); - Person p = people.get(0); - int length = client.doGet(p.uri+"/name?invokeMethod=length").getResponse(Integer.class); - assertEquals(12, length); - - String[] tokens = client.doGet(p.uri+"/name?invokeMethod=split(java.lang.String,int)&invokeArgs=['a',3]").getResponse(String[].class); - assertObjectEquals("['B','r','ck Obama']", tokens); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/test/java/org/apache/juneau/rest/samples/CT_AddressBookResource_test0.json ---------------------------------------------------------------------- diff --git a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/CT_AddressBookResource_test0.json b/juneau-samples/src/test/java/org/apache/juneau/rest/samples/CT_AddressBookResource_test0.json deleted file mode 100644 index f8cc23f..0000000 --- a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/CT_AddressBookResource_test0.json +++ /dev/null @@ -1,26 +0,0 @@ -// *************************************************************************************************************************** -// * 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 * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -{ - name: "Bill Clinton", - age: 66, - birthDate: "Aug 19, 1946", - addresses: [ - { - street: "a3", - city: "b3", - state: "c3", - zip: 3, - isCurrent: false - } - ] -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/test/java/org/apache/juneau/rest/samples/RootResourcesTest.java ---------------------------------------------------------------------- diff --git a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/RootResourcesTest.java b/juneau-samples/src/test/java/org/apache/juneau/rest/samples/RootResourcesTest.java deleted file mode 100644 index 3a4433c..0000000 --- a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/RootResourcesTest.java +++ /dev/null @@ -1,147 +0,0 @@ -// *************************************************************************************************************************** -// * 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 * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.rest.samples; - -import static org.junit.Assert.*; - -import java.net.*; - -import org.apache.juneau.*; -import org.apache.juneau.dto.swagger.*; -import org.apache.juneau.html.*; -import org.apache.juneau.json.*; -import org.apache.juneau.rest.client.*; -import org.apache.juneau.rest.labels.*; -import org.apache.juneau.xml.*; -import org.junit.*; - -public class RootResourcesTest { - - private static String path = URI.create(Constants.getSampleUrl()).getPath(); // /jazz/juneau/sample - private static boolean debug = false; - - private static RestClient jsonClient; - - @BeforeClass - public static void beforeClass() { - jsonClient = new SamplesRestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT); - } - - @AfterClass - public static void afterClass() { - jsonClient.closeQuietly(); - } - - //==================================================================================================== - // text/json - //==================================================================================================== - @Test - public void testJson() throws Exception { - RestClient client = new SamplesRestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT); - RestCall r = client.doGet(""); - ResourceDescription[] x = r.getResponse(ResourceDescription[].class); - assertEquals("helloWorld", x[0].getName().getName()); - assertEquals(path + "/helloWorld", x[0].getName().getHref()); - assertEquals("Hello World sample resource", x[0].getDescription()); - - r = jsonClient.doOptions(""); - ObjectMap x2 = r.getResponse(ObjectMap.class); - String s = x2.getObjectMap("info").getString("description"); - if (debug) System.err.println(s); - assertTrue(s, s.startsWith("This is an example")); - - client.closeQuietly(); - } - - //==================================================================================================== - // text/xml - //==================================================================================================== - @Test - public void testXml() throws Exception { - RestClient client = new SamplesRestClient().setParser(XmlParser.DEFAULT); - RestCall r = client.doGet(""); - ResourceDescription[] x = r.getResponse(ResourceDescription[].class); - assertEquals("helloWorld", x[0].getName().getName()); - assertEquals(path + "/helloWorld", x[0].getName().getHref()); - assertEquals("Hello World sample resource", x[0].getDescription()); - - r = jsonClient.doOptions(""); - ObjectMap x2 = r.getResponse(ObjectMap.class); - String s = x2.getObjectMap("info").getString("description"); - if (debug) System.err.println(s); - assertTrue(s, s.startsWith("This is an example")); - - client.closeQuietly(); - } - - //==================================================================================================== - // text/html+stripped - //==================================================================================================== - @Test - public void testHtmlStripped() throws Exception { - RestClient client = new SamplesRestClient().setParser(HtmlParser.DEFAULT).setAccept("text/html+stripped"); - RestCall r = client.doGet(""); - ResourceDescription[] x = r.getResponse(ResourceDescription[].class); - assertEquals("helloWorld", x[0].getName().getName()); - assertTrue(x[0].getName().getHref().endsWith("/helloWorld")); - assertEquals("Hello World sample resource", x[0].getDescription()); - - r = jsonClient.doOptions("").setHeader("Accept", "text/json"); - ObjectMap x2 = r.getResponse(ObjectMap.class); - String s = x2.getObjectMap("info").getString("description"); - if (debug) System.err.println(s); - assertTrue(s, s.startsWith("This is an example")); - - client.closeQuietly(); - } - - //==================================================================================================== - // /htdoces/styles.css - //==================================================================================================== - @Test - public void testStyleSheet() throws Exception { - RestClient client = new SamplesRestClient().setAccept("text/css"); - RestCall r = client.doGet("/style.css"); - String css = r.getResponseAsString(); - if (debug) System.err.println(css); - assertTrue(css, css.indexOf("table {") != -1); - - client.closeQuietly(); - } - - //==================================================================================================== - // application/json+schema - //==================================================================================================== - @Test - public void testJsonSchema() throws Exception { - RestClient client = new SamplesRestClient().setParser(JsonParser.DEFAULT).setAccept("text/json+schema"); - RestCall r = client.doGet(""); - ObjectMap m = r.getResponse(ObjectMap.class); - if (debug) System.err.println(m); - assertEquals("org.apache.juneau.rest.labels.ChildResourceDescriptions<org.apache.juneau.rest.labels.ResourceDescription>", m.getString("description")); - assertEquals("org.apache.juneau.rest.labels.ResourceDescription", m.getObjectMap("items").getString("description")); - - client.closeQuietly(); - } - - //==================================================================================================== - // OPTIONS page - //==================================================================================================== - @Test - public void testOptionsPage() throws Exception { - RestCall r = jsonClient.doOptions(""); - Swagger o = r.getResponse(Swagger.class); - if (debug) System.err.println(o); - assertEquals("This is an example of a router resource that is used to access other resources.", o.getInfo().getDescription()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/test/java/org/apache/juneau/rest/samples/SampleRemoteableServicesResourceTest.java ---------------------------------------------------------------------- diff --git a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/SampleRemoteableServicesResourceTest.java b/juneau-samples/src/test/java/org/apache/juneau/rest/samples/SampleRemoteableServicesResourceTest.java deleted file mode 100644 index ec191dd..0000000 --- a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/SampleRemoteableServicesResourceTest.java +++ /dev/null @@ -1,69 +0,0 @@ -// *************************************************************************************************************************** -// * 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 * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.rest.samples; - -import static org.junit.Assert.*; - -import org.apache.juneau.json.*; -import org.apache.juneau.rest.client.*; -import org.apache.juneau.samples.addressbook.*; -import org.apache.juneau.transforms.*; -import org.apache.juneau.urlencoding.*; -import org.apache.juneau.xml.*; -import org.junit.*; - -public class SampleRemoteableServicesResourceTest { - - static RestClient[] clients; - - @BeforeClass - public static void beforeClass() throws Exception { - clients = new RestClient[] { - new SamplesRestClient(JsonSerializer.class, JsonParser.class), - new SamplesRestClient(XmlSerializer.class, XmlParser.class), -// TODO - broken? new TestRestClient(HtmlSerializer.class, HtmlParser.class).setAccept("text/html+stripped"), - new SamplesRestClient(UonSerializer.class, UonParser.class), - }; - for (RestClient c : clients) { - c.addPojoSwaps(CalendarSwap.DateMedium.class); - c.setRemoteableServletUri("/remoteable"); - c.setProperty(XmlSerializerContext.XML_autoDetectNamespaces, true); - } - } - - @AfterClass - public static void afterClass() { - for (RestClient c : clients) { - c.closeQuietly(); - } - } - - //==================================================================================================== - // Get AddressBookResource as JSON - //==================================================================================================== - @Test - public void testBasic() throws Exception { - for (RestClient client : clients) { - IAddressBook ab = client.getRemoteableProxy(IAddressBook.class); - Person p = ab.createPerson( - new CreatePerson("Test Person", - AddressBook.toCalendar("Aug 1, 1999"), - new CreateAddress("Test street", "Test city", "Test state", 12345, true)) - ); - assertEquals( - "{id:x,name:'Test Person',birthDate:'Aug 1, 1999',addresses:[{id:x,street:'Test street',city:'Test city',state:'Test state',zip:12345,isCurrent:true}],age:x}", - JsonSerializer.DEFAULT_LAX.toString(p).replaceAll("id:\\d+", "id:x").replaceAll("age:\\d+", "age:x")); - } - } - -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/test/java/org/apache/juneau/rest/samples/SamplesRestClient.java ---------------------------------------------------------------------- diff --git a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/SamplesRestClient.java b/juneau-samples/src/test/java/org/apache/juneau/rest/samples/SamplesRestClient.java deleted file mode 100644 index 9b18ad3..0000000 --- a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/SamplesRestClient.java +++ /dev/null @@ -1,69 +0,0 @@ -// *************************************************************************************************************************** -// * 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 * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.rest.samples; - -import java.security.*; - -import javax.net.ssl.*; - -import org.apache.http.conn.ssl.*; -import org.apache.http.impl.client.*; -import org.apache.juneau.parser.*; -import org.apache.juneau.rest.client.*; -import org.apache.juneau.serializer.*; - -/** - * REST client with lenient SSL support and lax redirection strategy. - */ -public class SamplesRestClient extends RestClient { - - public SamplesRestClient(Class<? extends Serializer> s, Class<? extends Parser> p) throws InstantiationException { - super(s,p); - setRootUrl(Constants.getSampleUrl()); - } - - public SamplesRestClient(Serializer s, Parser p) { - super(s,p); - setRootUrl(Constants.getSampleUrl()); - } - - public SamplesRestClient() { - setRootUrl(Constants.getSampleUrl()); - } - - public SamplesRestClient(CloseableHttpClient c) { - super(c); - setRootUrl(Constants.getSampleUrl()); - } - - public static SSLConnectionSocketFactory getSSLSocketFactory() throws Exception { - SSLContext sslContext = SSLContext.getInstance("SSL"); - TrustManager tm = new SimpleX509TrustManager(true); - sslContext.init(null, new TrustManager[]{tm}, new SecureRandom()); - return new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier()); - } - - @Override /* RestClient */ - protected CloseableHttpClient createHttpClient() throws Exception { - try { - return HttpClients.custom().setSSLSocketFactory(getSSLSocketFactory()).setRedirectStrategy(new LaxRedirectStrategy()).build(); - } catch (KeyStoreException e) { - throw new RuntimeException(e); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } catch (Throwable e) { - e.printStackTrace(); - return null; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/e3d95284/juneau-samples/src/test/java/org/apache/juneau/rest/samples/TestMultiPartFormPostsTest.java ---------------------------------------------------------------------- diff --git a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/TestMultiPartFormPostsTest.java b/juneau-samples/src/test/java/org/apache/juneau/rest/samples/TestMultiPartFormPostsTest.java deleted file mode 100644 index 4a2bd1b..0000000 --- a/juneau-samples/src/test/java/org/apache/juneau/rest/samples/TestMultiPartFormPostsTest.java +++ /dev/null @@ -1,47 +0,0 @@ -// *************************************************************************************************************************** -// * 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 * -// * * -// * http://www.apache.org/licenses/LICENSE-2.0 * -// * * -// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * -// * specific language governing permissions and limitations under the License. * -// *************************************************************************************************************************** -package org.apache.juneau.rest.samples; - -import static org.junit.Assert.*; - -import java.io.*; - -import org.apache.http.*; -import org.apache.http.entity.mime.*; -import org.apache.juneau.internal.*; -import org.apache.juneau.rest.client.*; -import org.apache.juneau.utils.*; -import org.junit.*; - -public class TestMultiPartFormPostsTest { - - private static String URL = "/tempDir"; - boolean debug = false; - - //==================================================================================================== - // Test that RestClient can handle multi-part form posts. - //==================================================================================================== - @Test - public void testUpload() throws Exception { - RestClient client = new SamplesRestClient(); - File f = FileUtils.createTempFile("testMultiPartFormPosts.txt"); - IOPipe.create(new StringReader("test!"), new FileWriter(f)).closeOut().run(); - HttpEntity entity = MultipartEntityBuilder.create().addBinaryBody(f.getName(), f).build(); - client.doPost(URL + "/upload", entity); - - String downloaded = client.doGet(URL + '/' + f.getName() + "?method=VIEW").getResponseAsString(); - assertEquals("test!", downloaded); - - client.closeQuietly(); - } -} \ No newline at end of file
