You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2017/09/08 23:28:07 UTC
[14/33] incubator-juneau git commit: Microservice should be in it's
own group.
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java b/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
deleted file mode 100755
index 1a813d9..0000000
--- a/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java
+++ /dev/null
@@ -1,348 +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.microservice.resources;
-
-import static javax.servlet.http.HttpServletResponse.*;
-import static org.apache.juneau.html.HtmlDocSerializerContext.*;
-import static org.apache.juneau.rest.RestContext.*;
-import static org.apache.juneau.rest.annotation.HookEvent.*;
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.io.*;
-import java.net.URI;
-import java.nio.charset.*;
-import java.util.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.dto.*;
-import org.apache.juneau.ini.*;
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.rest.annotation.Properties;
-import org.apache.juneau.rest.converters.*;
-import org.apache.juneau.transforms.*;
-
-/**
- * REST resource for viewing and accessing log files.
- */
-@RestResource(
- path="/logs",
- title="Log files",
- description="Log files from this service",
- properties={
- @Property(name=HTML_uriAnchorText, value=PROPERTY_NAME),
- },
- flags={REST_allowMethodParam},
- pojoSwaps={
- IteratorSwap.class, // Allows Iterators and Iterables to be serialized.
- DateSwap.ISO8601DT.class // Serialize Date objects as ISO8601 strings.
- }
-)
-@SuppressWarnings("nls")
-public class LogsResource extends Resource {
- private static final long serialVersionUID = 1L;
-
- private File logDir;
- private LogEntryFormatter leFormatter;
-
- private final FileFilter filter = new FileFilter() {
- @Override /* FileFilter */
- public boolean accept(File f) {
- return f.isDirectory() || f.getName().endsWith(".log");
- }
- };
-
- /**
- * Initializes the log directory and formatter.
- *
- * @param config The resource config.
- * @throws Exception
- */
- @RestHook(INIT)
- public void init(RestConfig config) throws Exception {
- ConfigFile cf = config.getConfigFile();
-
- logDir = new File(cf.getString("Logging/logDir", "."));
- leFormatter = new LogEntryFormatter(
- cf.getString("Logging/format", "[{date} {level}] {msg}%n"),
- cf.getString("Logging/dateFormat", "yyyy.MM.dd hh:mm:ss"),
- cf.getBoolean("Logging/useStackTraceHashes")
- );
- }
-
- /**
- * [GET /*] - Get file details or directory listing.
- *
- * @param req The HTTP request
- * @param res The HTTP response
- * @param properties The writable properties for setting the descriptions.
- * @param path The log file path.
- * @return The log file.
- * @throws Exception
- */
- @RestMethod(
- 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);
-
- if (f.isDirectory()) {
- Set<FileResource> l = new TreeSet<FileResource>(new FileResourceComparator());
- File[] files = f.listFiles(filter);
- if (files != null) {
- for (File fc : files) {
- URI fUrl = new URI("servlet:/" + fc.getName());
- l.add(new FileResource(fc, fUrl));
- }
- }
- return l;
- }
-
- return new FileResource(f, new URI("servlet:/"));
- }
-
- /**
- * [VIEW /*] - Retrieve the contents of a log file.
- *
- * @param req The HTTP request.
- * @param res The HTTP response.
- * @param path The log file path.
- * @param properties The writable properties for setting the descriptions.
- * @param highlight If <code>true</code>, add color highlighting based on severity.
- * @param start Optional start timestamp. Don't print lines logged before the specified timestamp. Example: "&start=2014-01-23 11:25:47".
- * @param end Optional end timestamp. Don't print lines logged after the specified timestamp. Example: "&end=2014-01-23 11:25:47".
- * @param thread Optional thread name filter. Only show log entries with the specified thread name. Example: "&thread=pool-33-thread-1".
- * @param loggers Optional logger filter. Only show log entries if they were produced by one of the specified loggers (simple class name). Example: "&loggers=(LinkIndexService,LinkIndexRestService)".
- * @param severity Optional severity filter. Only show log entries with the specified severity. Example: "&severity=(ERROR,WARN)".
- * @throws Exception
- */
- @RestMethod(
- name="VIEW",
- path="/*",
- swagger=@MethodSwagger(
- responses={@Response(200),@Response(404)}
- )
- )
- @SuppressWarnings("nls")
- public void viewFile(RestRequest req, RestResponse res, @PathRemainder String path, @Properties ObjectMap properties, @Query("highlight") boolean highlight, @Query("start") String start, @Query("end") String end, @Query("thread") String thread, @Query("loggers") String[] loggers, @Query("severity") String[] severity) throws Exception {
-
- File f = getFile(path);
- if (f.isDirectory())
- throw new RestException(SC_METHOD_NOT_ALLOWED, "View not available on directories");
-
- Date startDate = parseISO8601Date(start), endDate = parseISO8601Date(end);
-
- if (! highlight) {
- Object o = getReader(f, startDate, endDate, thread, loggers, severity);
- res.setContentType("text/plain");
- if (o instanceof Reader)
- res.setOutput(o);
- else {
- LogParser p = (LogParser)o;
- Writer w = res.getNegotiatedWriter();
- try {
- p.writeTo(w);
- } finally {
- w.flush();
- w.close();
- }
- }
- return;
- }
-
- res.setContentType("text/html");
- PrintWriter w = res.getNegotiatedWriter();
- try {
- w.println("<html><body style='font-family:monospace;font-size:8pt;white-space:pre;'>");
- LogParser lp = getLogParser(f, startDate, endDate, thread, loggers, severity);
- try {
- if (! lp.hasNext())
- w.append("<span style='color:gray'>[EMPTY]</span>");
- else for (LogParser.Entry le : lp) {
- char s = le.severity.charAt(0);
- String color = "black";
- //SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST
- if (s == 'I')
- color = "#006400";
- else if (s == 'W')
- color = "#CC8400";
- else if (s == 'E' || s == 'S')
- color = "#DD0000";
- else if (s == 'D' || s == 'F' || s == 'T')
- color = "#000064";
- w.append("<span style='color:").append(color).append("'>");
- le.appendHtml(w).append("</span>");
- }
- w.append("</body></html>");
- } finally {
- lp.close();
- }
- } finally {
- w.close();
- }
- }
-
- /**
- * [VIEW /*] - Retrieve the contents of a log file as parsed entries.
- *
- * @param req The HTTP request.
- * @param path The log file path.
- * @param start Optional start timestamp. Don't print lines logged before the specified timestamp. Example: "&start=2014-01-23 11:25:47".
- * @param end Optional end timestamp. Don't print lines logged after the specified timestamp. Example: "&end=2014-01-23 11:25:47".
- * @param thread Optional thread name filter. Only show log entries with the specified thread name. Example: "&thread=pool-33-thread-1".
- * @param loggers Optional logger filter. Only show log entries if they were produced by one of the specified loggers (simple class name). Example: "&loggers=(LinkIndexService,LinkIndexRestService)".
- * @param severity Optional severity filter. Only show log entries with the specified severity. Example: "&severity=(ERROR,WARN)".
- * @return The parsed contents of the log file.
- * @throws Exception
- */
- @RestMethod(
- name="PARSE",
- path="/*",
- converters=Queryable.class,
- swagger=@MethodSwagger(
- responses={@Response(200),@Response(404)}
- )
- )
- public LogParser viewParsedEntries(RestRequest req, @PathRemainder String path, @Query("start") String start, @Query("end") String end, @Query("thread") String thread, @Query("loggers") String[] loggers, @Query("severity") String[] severity) throws Exception {
-
- File f = getFile(path);
- Date startDate = parseISO8601Date(start), endDate = parseISO8601Date(end);
-
- if (f.isDirectory())
- throw new RestException(SC_METHOD_NOT_ALLOWED, "View not available on directories");
-
- return getLogParser(f, startDate, endDate, thread, loggers, severity);
- }
-
- /**
- * [DOWNLOAD /*] - Download file.
- *
- * @param res The HTTP response.
- * @param path The log file path.
- * @return The contents of the log file.
- * @throws Exception
- */
- @RestMethod(
- name="DOWNLOAD",
- path="/*",
- swagger=@MethodSwagger(
- responses={@Response(200),@Response(404)}
- )
- )
- public Object downloadFile(RestResponse res, @PathRemainder String path) throws Exception {
-
- File f = getFile(path);
-
- if (f.isDirectory())
- throw new RestException(SC_METHOD_NOT_ALLOWED, "Download not available on directories");
-
- res.setContentType("application/octet-stream");
- res.setContentLength((int)f.length());
- return new FileInputStream(f);
- }
-
- /**
- * [DELETE /*] - Delete a file.
- *
- * @param path The log file path.
- * @return A redirect object to the root.
- * @throws Exception
- */
- @RestMethod(
- name="DELETE",
- path="/*",
- swagger=@MethodSwagger(
- responses={@Response(200),@Response(404)}
- )
- )
- public Object deleteFile(@PathRemainder String path) throws Exception {
-
- File f = getFile(path);
-
- if (f.isDirectory())
- throw new RestException(SC_BAD_REQUEST, "Delete not available on directories.");
-
- if (f.canWrite())
- if (! f.delete())
- throw new RestException(SC_FORBIDDEN, "Could not delete file.");
-
- return new Redirect(path + "/..");
- }
-
- private static BufferedReader getReader(File f) throws IOException {
- return new BufferedReader(new InputStreamReader(new FileInputStream(f), Charset.defaultCharset()));
- }
-
- private File getFile(String path) {
- if (path != null && path.indexOf("..") != -1)
- throw new RestException(SC_NOT_FOUND, "File not found.");
- File f = (path == null ? logDir : new File(logDir.getAbsolutePath() + '/' + path));
- if (filter.accept(f))
- return f;
- throw new RestException(SC_NOT_FOUND, "File not found.");
- }
-
- /**
- * File bean.
- */
- @SuppressWarnings("javadoc")
- public static class FileResource {
- private File f;
- public String type;
- public Object name;
- public Long size;
- @BeanProperty(swap=DateSwap.DateTimeMedium.class) public Date lastModified;
- public URI view, highlighted, parsed, download, delete;
-
- public FileResource(File f, URI uri) throws Exception {
- this.f = f;
- this.type = (f.isDirectory() ? "dir" : "file");
- this.name = f.isDirectory() ? new Link(f.getName(), uri.toString()) : f.getName();
- this.size = f.isDirectory() ? null : f.length();
- this.lastModified = new Date(f.lastModified());
- if (f.canRead() && ! f.isDirectory()) {
- this.view = new URI(uri + "?method=VIEW");
- this.highlighted = new URI(uri + "?method=VIEW&highlight=true");
- this.parsed = new URI(uri + "?method=PARSE");
- this.download = new URI(uri + "?method=DOWNLOAD");
- this.delete = new URI(uri + "?method=DELETE");
- }
- }
- }
-
- private static class FileResourceComparator implements Comparator<FileResource>, Serializable {
- private static final long serialVersionUID = 1L;
- @Override /* Comparator */
- public int compare(FileResource o1, FileResource o2) {
- int c = o1.type.compareTo(o2.type);
- return c != 0 ? c : o1.f.getName().compareTo(o2.f.getName());
- }
- }
-
- private Object getReader(File f, final Date start, final Date end, final String thread, final String[] loggers, final String[] severity) throws IOException {
- if (start == null && end == null && thread == null && loggers == null)
- return getReader(f);
- return getLogParser(f, start, end, thread, loggers, severity);
- }
-
- private LogParser getLogParser(File f, final Date start, final Date end, final String thread, final String[] loggers, final String[] severity) throws IOException {
- return new LogParser(leFormatter, f, start, end, thread, loggers, severity);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java b/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java
deleted file mode 100755
index 4122d6a..0000000
--- a/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/SampleRootResource.java
+++ /dev/null
@@ -1,29 +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.microservice.resources;
-
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * Sample root REST resource.
- */
-@RestResource(
- path="/",
- title="Sample Root Resource",
- description="This is a sample router page",
- children={ConfigResource.class,LogsResource.class}
-)
-public class SampleRootResource extends ResourceGroup {
- private static final long serialVersionUID = 1L;
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java b/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
deleted file mode 100755
index 5ef8d9f..0000000
--- a/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ShutdownResource.java
+++ /dev/null
@@ -1,52 +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.microservice.resources;
-
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * Provides the capability to shut down this REST microservice through a REST call.
- */
-@RestResource(
- path="/shutdown",
- title="Shut down this resource"
-)
-public class ShutdownResource extends Resource {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * [GET /] - Shutdown this resource.
- *
- * @return The string <js>"OK"</js>.
- * @throws Exception
- */
- @RestMethod(name="GET", path="/", description="Show contents of config file.")
- public String shutdown() throws Exception {
- new Thread(
- new Runnable() {
- @Override /* Runnable */
- public void run() {
- try {
- Thread.sleep(1000);
- System.exit(0);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- ).start();
- return "OK";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/package.html
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/package.html b/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/package.html
deleted file mode 100755
index 422f5d2..0000000
--- a/juneau-rest/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/package.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE HTML>
-<!--
-/***************************************************************************************************************************
- * 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.
- *
- ***************************************************************************************************************************/
- -->
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <style type="text/css">
- /* For viewing in Page Designer */
- @IMPORT url("../javadoc.css");
- body {
- margin: 20px;
- }
- </style>
-</head>
-<body>
-<p>Predefined Microservice Resources</p>
-</body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-microservice/src/test/java/.gitignore
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-microservice/src/test/java/.gitignore b/juneau-rest/juneau-microservice/src/test/java/.gitignore
deleted file mode 100644
index 8a0051a..0000000
--- a/juneau-rest/juneau-microservice/src/test/java/.gitignore
+++ /dev/null
@@ -1,12 +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. *
- ***************************************************************************************************************************
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/.classpath
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/.classpath b/juneau-rest/juneau-rest-test/.classpath
deleted file mode 100644
index 0060db7..0000000
--- a/juneau-rest/juneau-rest-test/.classpath
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/classes" path="src/main/java">
- <attributes>
- <attribute name="optional" value="true"/>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
- <attributes>
- <attribute name="maven.pomderived" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/.gitignore
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/.gitignore b/juneau-rest/juneau-rest-test/.gitignore
deleted file mode 100644
index d274d47..0000000
--- a/juneau-rest/juneau-rest-test/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/target/
-/.settings/
-/.DS_Store
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/.project
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/.project b/juneau-rest/juneau-rest-test/.project
deleted file mode 100644
index 3648ed0..0000000
--- a/juneau-rest/juneau-rest-test/.project
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>juneau-rest-test</name>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/jetty.xml
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/jetty.xml b/juneau-rest/juneau-rest-test/jetty.xml
deleted file mode 100644
index 76d9e2d..0000000
--- a/juneau-rest/juneau-rest-test/jetty.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-
-<Configure id="ExampleServer" class="org.eclipse.jetty.server.Server">
-
- <Set name="connectors">
- <Array type="org.eclipse.jetty.server.Connector">
- <Item>
- <New class="org.eclipse.jetty.server.ServerConnector">
- <Arg>
- <Ref refid="ExampleServer" />
- </Arg>
- <Set name="port">10001</Set>
- </New>
- </Item>
- </Array>
- </Set>
-
- <New id="context" class="org.eclipse.jetty.servlet.ServletContextHandler">
- <Set name="contextPath">/</Set>
- <Call name="addServlet">
- <Arg>org.apache.juneau.rest.test.Root</Arg>
- <Arg>/*</Arg>
- </Call>
- <Set name="sessionHandler">
- <New class="org.eclipse.jetty.server.session.SessionHandler" />
- </Set>
- </New>
-
- <Set name="handler">
- <New class="org.eclipse.jetty.server.handler.HandlerCollection">
- <Set name="handlers">
- <Array type="org.eclipse.jetty.server.Handler">
- <Item>
- <Ref refid="context" />
- </Item>
- <Item>
- <New class="org.eclipse.jetty.server.handler.DefaultHandler" />
- </Item>
- </Array>
- </Set>
- </New>
- </Set>
-</Configure>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/juneau-microservice-test.launch
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/juneau-microservice-test.launch b/juneau-rest/juneau-rest-test/juneau-microservice-test.launch
new file mode 100644
index 0000000..4af27b6
--- /dev/null
+++ b/juneau-rest/juneau-rest-test/juneau-microservice-test.launch
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/juneau-microservice-test"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.debug.ui.CONSIDER_INHERITED_MAIN" value="true"/>
+<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.juneau.microservice.RestMicroservice"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="juneau-microservice-test.cfg"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="juneau-microservice-test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+</launchConfiguration>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/juneau-rest-test.cfg
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/juneau-rest-test.cfg b/juneau-rest/juneau-rest-test/juneau-rest-test.cfg
deleted file mode 100644
index 5009719..0000000
--- a/juneau-rest/juneau-rest-test/juneau-rest-test.cfg
+++ /dev/null
@@ -1,58 +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]
-
-jettyXml = jetty.xml
-
-# 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
-
-#================================================================================
-# Logger settings
-# See FileHandler Java class for details.
-#================================================================================
-[Logging]
-logDir = $S{user.dir}/target/logs
-logFile = test.%g.log
-dateFormat = yyyy.MM.dd hh:mm:ss
-format = [{date} {level}] {msg}%n
-append = false
-limit = 10M
-count = 5
-levels = { com.foo.team:'INFO' }
-useStackTraceHashes = true
-consoleLevel = WARNING
-
-[Test]
-int1 = 1
-int2 = [1,2,3]
-int3 = $C{Test/int1, -1}
-int4 = $C{Test/int3, -1}
-int5 = $C{XXX, -1}
-boolean1 = true
-boolean2 = [true,true]
-path = $E{PATH}
-testManifestEntry = $MF{Test-Entry}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/juneau-rest-test.launch
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/juneau-rest-test.launch b/juneau-rest/juneau-rest-test/juneau-rest-test.launch
deleted file mode 100644
index 7fb0a57..0000000
--- a/juneau-rest/juneau-rest-test/juneau-rest-test.launch
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/juneau-microservice/src/main/java/org/apache/juneau/microservice/RestMicroservice.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.debug.ui.CONSIDER_INHERITED_MAIN" value="true"/>
-<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
-<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.juneau.microservice.RestMicroservice"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="juneau-rest-test.cfg"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="juneau-rest-test"/>
-<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
-</launchConfiguration>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/pom.xml
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/pom.xml b/juneau-rest/juneau-rest-test/pom.xml
deleted file mode 100644
index 90205b6..0000000
--- a/juneau-rest/juneau-rest-test/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ***************************************************************************************************************************
- * 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. *
- ***************************************************************************************************************************
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-rest</artifactId>
- <version>6.3.2-incubating-SNAPSHOT</version>
- </parent>
-
- <artifactId>juneau-rest-test</artifactId>
- <name>Apache Juneau REST Tests</name>
- <description>Tests for Juneau Client and Server.</description>
-
- <properties>
- <maven.javadoc.skip>true</maven.javadoc.skip>
-
- <!-- Java 8 required because Jetty requires it. -->
- <maven.compiler.source>1.8</maven.compiler.source>
- <maven.compiler.target>1.8</maven.compiler.target>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-examples-rest</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-rest-server-jaxrs</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.juneau</groupId>
- <artifactId>juneau-marshall-rdf</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>
- **/_TestSuite.java
- </include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/AcceptCharsetResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/AcceptCharsetResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/AcceptCharsetResource.java
deleted file mode 100644
index 2281896..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/AcceptCharsetResource.java
+++ /dev/null
@@ -1,94 +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.test;
-
-import static org.apache.juneau.rest.RestContext.*;
-
-import java.io.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.parser.*;
-import org.apache.juneau.plaintext.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testAcceptCharset",
- serializers={PlainTextSerializer.class},
- properties={
- // Some versions of Jetty default to ISO8601, so specify UTF-8 for test consistency.
- @Property(name=REST_defaultCharset,value="utf-8")
- }
-)
-public class AcceptCharsetResource extends RestServlet {
- private static final long serialVersionUID = 1L;
-
- //====================================================================================================
- // Test that Q-values are being resolved correctly.
- //====================================================================================================
- @RestMethod(name="GET", path="/testQValues")
- public String testQValues() {
- return "foo";
- }
-
- //====================================================================================================
- // Validate various Accept-Charset variations.
- //====================================================================================================
- @RestMethod(name="PUT", path="/testCharsetOnResponse", parsers=TestParser.class, serializers=TestSerializer.class)
- public String testCharsetOnResponse(@Body String in) {
- return in;
- }
-
- public static class TestParser extends InputStreamParser {
-
- public TestParser(PropertyStore propertyStore) {
- super(propertyStore, "text/plain");
- }
-
- @Override /* Parser */
- public InputStreamParserSession createSession(ParserSessionArgs args) {
- return new InputStreamParserSession(args) {
-
- @Override /* ParserSession */
- @SuppressWarnings("unchecked")
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
- return (T)getStringProperty("characterEncoding");
- }
- };
- }
- }
-
- public static class TestSerializer extends OutputStreamSerializer {
-
- public TestSerializer(PropertyStore propertyStore) {
- super(propertyStore, "text/plain");
- }
-
- @Override /* Serializer */
- public OutputStreamSerializerSession createSession(SerializerSessionArgs args) {
- return new OutputStreamSerializerSession(args) {
-
- @Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
- Writer w = new OutputStreamWriter(out.getOutputStream());
- w.append(o.toString()).append('/').append(getStringProperty("characterEncoding"));
- w.flush();
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/BeanContextPropertiesResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/BeanContextPropertiesResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/BeanContextPropertiesResource.java
deleted file mode 100644
index f5479b8..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/BeanContextPropertiesResource.java
+++ /dev/null
@@ -1,44 +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.test;
-
-import java.io.*;
-import java.util.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.transforms.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testBeanContext",
- pojoSwaps=DateSwap.ISO8601DTZ.class
-)
-public class BeanContextPropertiesResource extends RestServletDefault {
- private static final long serialVersionUID = 1L;
-
- //====================================================================================================
- // Validate that transforms defined on class transform to underlying bean context.
- //====================================================================================================
- @RestMethod(name="GET", path="/testClassTransforms/{d1}")
- public Reader testClassTransforms(@Path("d1") Date d1, @Query("d2") Date d2, @Header("X-D3") Date d3) throws Exception {
- DateSwap df = DateSwap.ISO8601DTZ.class.newInstance();
- BeanSession session = BeanContext.DEFAULT.createSession();
- return new StringReader(
- "d1="+df.swap(session, d1)+",d2="+df.swap(session, d2)+",d3="+df.swap(session, d3)+""
- );
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/BpiResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/BpiResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/BpiResource.java
deleted file mode 100644
index 4c6373e..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/BpiResource.java
+++ /dev/null
@@ -1,140 +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.test;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testBpi"
-)
-public class BpiResource extends ResourceJena {
- private static final long serialVersionUID = 1L;
-
- //====================================================================================================
- // Validates that the @RestMethod(bpIncludes,bpExcludes) properties work.
- //====================================================================================================
-
- @RestMethod(name="GET", path="/test/a1", bpi="MyBeanA: a,_b")
- public Object testA1() throws Exception {
- return new MyBeanA().init();
- }
-
- @RestMethod(name="GET", path="/test/a2", bpi="MyBeanA: a")
- public Object testA2() throws Exception {
- return new MyBeanA().init();
- }
-
- @RestMethod(name="GET", path="/test/a3", bpi="MyBeanA: _b")
- public Object testA3() throws Exception {
- return new MyBeanA().init();
- }
-
- @RestMethod(name="GET", path="/test/a4", bpi="MyBeanA: a")
- public Object testA4() throws Exception {
- return new MyBeanA().init();
- }
-
- @RestMethod(name="GET", path="/test/a5", bpi="MyBeanA: _b")
- public Object testA5() throws Exception {
- return new MyBeanA().init();
- }
-
- @RestMethod(name="GET", path="/test/a6", bpi="MyBeanA: a,_b")
- public Object testA6() throws Exception {
- return new MyBeanA().init();
- }
-
- @RestMethod(name="GET", path="/test/b1", bpi="MyBeanB: a,_b")
- public Object testB1() throws Exception {
- return new MyBeanB().init();
- }
-
- @RestMethod(name="GET", path="/test/b2", bpi="MyBeanB: a")
- public Object testB2() throws Exception {
- return new MyBeanB().init();
- }
-
- @RestMethod(name="GET", path="/test/b3", bpi="MyBeanB: _b")
- public Object testB3() throws Exception {
- return new MyBeanB().init();
- }
-
- @RestMethod(name="GET", path="/test/b4", bpi="MyBeanB: a")
- public Object testB4() throws Exception {
- return new MyBeanB().init();
- }
-
- @RestMethod(name="GET", path="/test/b5", bpi="MyBeanB: _b'")
- public Object testB5() throws Exception {
- return new MyBeanB().init();
- }
-
- @RestMethod(name="GET", path="/test/b6", bpi="MyBeanB: a,_b")
- public Object testB6() throws Exception {
- return new MyBeanB().init();
- }
-
- @RestMethod(name="GET", path="/test/c1", bpi="*: a")
- public Object testC1() throws Exception {
- return new MyBeanA().init();
- }
-
- @RestMethod(name="GET", path="/test/c2", bpi="org.apache.juneau.rest.test.BpIncludesResource$MyBeanA: a")
- public Object testC2() throws Exception {
- return new MyBeanA().init();
- }
-
- // Should not match.
- @RestMethod(name="GET", path="/test/d1", bpi="MyBean: a")
- public Object testD1() throws Exception {
- return new MyBeanA().init();
- }
-
- // Should not match.
- @RestMethod(name="GET", path="/test/d2", bpi="MyBean*: a")
- public Object testD2() throws Exception {
- return new MyBeanA().init();
- }
-
- //-------------------------------------------------------------------------------------------------------------------
- // Beans
- //-------------------------------------------------------------------------------------------------------------------
-
- public static class MyBeanA {
- public int a;
- @BeanProperty("_b") public String b;
-
- MyBeanA init() {
- a = 1;
- b = "foo";
- return this;
- }
- }
-
- @Bean(properties="_b,a")
- public static class MyBeanB {
- public int a;
- @BeanProperty("_b") public String b;
-
- MyBeanB init() {
- a = 1;
- b = "foo";
- return this;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/CallbackStringsResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/CallbackStringsResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/CallbackStringsResource.java
deleted file mode 100644
index 74038b3..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/CallbackStringsResource.java
+++ /dev/null
@@ -1,53 +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.test;
-
-import java.util.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testCallback"
-)
-public class CallbackStringsResource extends RestServletDefault {
- private static final long serialVersionUID = 1L;
-
- //====================================================================================================
- // Test GET
- //====================================================================================================
- @RestMethod(name="GET", path="/")
- public ObjectMap test1(RestRequest req) throws Exception {
- return new ObjectMap().append("method","GET").append("headers", getFooHeaders(req)).append("content", req.getBody().asString());
- }
-
- //====================================================================================================
- // Test PUT
- //====================================================================================================
- @RestMethod(name="PUT", path="/")
- public ObjectMap testCharsetOnResponse(RestRequest req) throws Exception {
- return new ObjectMap().append("method","PUT").append("headers", getFooHeaders(req)).append("content", req.getBody().asString());
- }
-
- private Map<String,Object> getFooHeaders(RestRequest req) {
- Map<String,Object> m = new TreeMap<String,Object>();
- for (Map.Entry<String,String[]> e : req.getHeaders().entrySet())
- if (e.getKey().startsWith("Foo-"))
- m.put(e.getKey(), e.getValue()[0]);
- return m;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/CharsetEncodingsResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/CharsetEncodingsResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/CharsetEncodingsResource.java
deleted file mode 100644
index d9906f4..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/CharsetEncodingsResource.java
+++ /dev/null
@@ -1,75 +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.test;
-
-import static org.apache.juneau.internal.IOUtils.*;
-
-import org.apache.juneau.*;
-import org.apache.juneau.parser.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-import org.apache.juneau.serializer.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testCharsetEncodings",
- defaultRequestHeaders={"Accept: text/s", "Content-Type: text/p"},
- parsers={CharsetEncodingsResource.CtParser.class}, serializers={CharsetEncodingsResource.ASerializer.class}
-)
-public class CharsetEncodingsResource extends RestServlet {
- private static final long serialVersionUID = 1L;
-
- public static class CtParser extends ReaderParser {
-
- public CtParser(PropertyStore propertyStore) {
- super(propertyStore, "text/p");
- }
-
- @Override /* Parser */
- public ReaderParserSession createSession(ParserSessionArgs args) {
- return new ReaderParserSession(args) {
-
- @Override /* ParserSession */
- @SuppressWarnings("unchecked")
- protected <T> T doParse(ParserPipe pipe, ClassMeta<T> type) throws Exception {
- return (T)read(pipe.getReader());
- }
- };
- }
- }
-
- public static class ASerializer extends WriterSerializer {
-
- public ASerializer(PropertyStore propertyStore) {
- super(propertyStore, "text/s");
- }
-
- @Override /* Serializer */
- public WriterSerializerSession createSession(SerializerSessionArgs args) {
- return new WriterSerializerSession(args) {
-
- @Override /* SerializerSession */
- protected void doSerialize(SerializerPipe out, Object o) throws Exception {
- out.getWriter().write(o.toString());
- }
- };
- }
- }
-
- @RestMethod(name="PUT", path="/")
- public String test1(RestRequest req, @Body String in) {
- return req.getCharacterEncoding() + "/" + in + "/" + req.getCharacterEncoding();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ClientFuturesResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ClientFuturesResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ClientFuturesResource.java
deleted file mode 100644
index 0a4202a..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ClientFuturesResource.java
+++ /dev/null
@@ -1,35 +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.test;
-
-import org.apache.juneau.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testClientFutures"
-)
-public class ClientFuturesResource extends RestServletDefault {
- private static final long serialVersionUID = 1L;
-
- //====================================================================================================
- // Test GET
- //====================================================================================================
- @RestMethod(name="GET", path="/")
- public ObjectMap test1(RestRequest req) throws Exception {
- return new ObjectMap().append("foo","bar");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ClientVersionResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ClientVersionResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ClientVersionResource.java
deleted file mode 100644
index 231304c..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ClientVersionResource.java
+++ /dev/null
@@ -1,93 +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.test;
-
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testClientVersion",
- children={
- ClientVersionResource.DefaultHeader.class,
- ClientVersionResource.CustomHeader.class
- }
-)
-@SuppressWarnings("serial")
-public class ClientVersionResource extends Resource {
-
- @RestResource(
- path="/defaultHeader"
- )
- public static class DefaultHeader extends Resource {
-
- @RestMethod(name="GET", path="/")
- public String test0() {
- return "no-version";
- }
-
- @RestMethod(name="GET", path="/", clientVersion="[0.0,1.0)")
- public String test1() {
- return "[0.0,1.0)";
- }
-
- @RestMethod(name="GET", path="/", clientVersion="[1.0,1.0]")
- public String test2() {
- return "[1.0,1.0]";
- }
-
- @RestMethod(name="GET", path="/", clientVersion="[1.1,2)")
- public String test3() {
- return "[1.1,2)";
- }
-
- @RestMethod(name="GET", path="/", clientVersion="2")
- public String test4() {
- return "2";
- }
- }
-
- @RestResource(
- path="/customHeader",
- clientVersionHeader="Custom-Client-Version"
- )
- public static class CustomHeader extends Resource {
-
- @RestMethod(name="GET", path="/")
- public String test0() {
- return "no-version";
- }
-
- @RestMethod(name="GET", path="/", clientVersion="[0.0,1.0)")
- public String test1() {
- return "[0.0,1.0)";
- }
-
- @RestMethod(name="GET", path="/", clientVersion="[1.0,1.0]")
- public String test2() {
- return "[1.0,1.0]";
- }
-
- @RestMethod(name="GET", path="/", clientVersion="[1.1,2)")
- public String test3() {
- return "[1.1,2)";
- }
-
- @RestMethod(name="GET", path="/", clientVersion="2")
- public String test4() {
- return "2";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ConfigResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ConfigResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ConfigResource.java
deleted file mode 100644
index d766290..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ConfigResource.java
+++ /dev/null
@@ -1,38 +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.test;
-
-import org.apache.juneau.ini.*;
-import org.apache.juneau.microservice.*;
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testConfig"
-)
-@SuppressWarnings("serial")
-public class ConfigResource extends Resource {
-
- @RestMethod(name="GET", path="/")
- public ConfigFile test1(RestRequest req) {
- return req.getConfigFile();
- }
-
- @RestMethod(name="GET", path="/{key}/{class}")
- public Object test2(RestRequest req, @Path("key") String key, @Path("class") Class<?> c) throws Exception {
- return req.getConfigFile().getObject(key, c);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ContentResource.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ContentResource.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ContentResource.java
deleted file mode 100644
index 6575ec9..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/ContentResource.java
+++ /dev/null
@@ -1,81 +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.test;
-
-import static org.apache.juneau.rest.RestContext.*;
-
-import java.util.*;
-
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * JUnit automated testcase resource.
- */
-@RestResource(
- path="/testContent",
- properties={
- @Property(name=REST_allowMethodParam, value="*")
- }
-)
-public class ContentResource extends RestServletDefault {
- private static final long serialVersionUID = 1L;
-
- //====================================================================================================
- // Basic tests
- //====================================================================================================
- @RestMethod(name="POST", path="/boolean")
- public boolean testBool(@Body boolean b) {
- return b;
- }
-
- @RestMethod(name="POST", path="/Boolean")
- public Boolean testBoolean(@Body Boolean b) {
- return b;
- }
-
- @RestMethod(name="POST", path="/int")
- public int testInt(@Body int i) {
- return i;
- }
-
- @RestMethod(name="POST", path="/Integer")
- public Integer testInteger(@Body Integer i) {
- return i;
- }
-
- @RestMethod(name="POST", path="/float")
- public float testFloat(@Body float f) {
- return f;
- }
-
- @RestMethod(name="POST", path="/Float")
- public Float testFloat2(@Body Float f) {
- return f;
- }
-
- @RestMethod(name="POST", path="/Map")
- public TreeMap<String,String> testMap(@Body TreeMap<String,String> m) {
- return m;
- }
-
- @RestMethod(name="POST", path="/B")
- public DTO2s.B testPojo1(@Body DTO2s.B b) {
- return b;
- }
-
- @RestMethod(name="POST", path="/C")
- public DTO2s.C testPojo2(@Body DTO2s.C c) {
- return c;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/750916a9/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java
----------------------------------------------------------------------
diff --git a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java b/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java
deleted file mode 100644
index 262d34c..0000000
--- a/juneau-rest/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/DTO2s.java
+++ /dev/null
@@ -1,138 +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.test;
-
-import java.util.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.urlencoding.annotation.*;
-import org.apache.juneau.utils.*;
-
-public class DTO2s {
-
- @Bean(sort=true)
- public static class A {
- public String a;
- public int b;
- public boolean c;
-
- public static A create() {
- A t = new A();
- t.a = "a";
- t.b = 1;
- t.c = true;
- return t;
- }
-
- }
-
- @Bean(sort=true)
- public static class B {
- public String[] f01;
- public List<String> f02;
- public int[] f03;
- public List<Integer> f04;
- public String[][] f05;
- public List<String[]> f06;
- public A[] f07;
- public List<A> f08;
- public A[][] f09;
- public List<List<A>> f10;
-
- private String[] f11;
- private List<String> f12;
- private int[] f13;
- private List<Integer> f14;
- private String[][] f15;
- private List<String[]> f16;
- private A[] f17;
- private List<A> f18;
- private A[][] f19;
- private List<List<A>> f20;
-
- public String[] getF11() { return f11; }
- public List<String> getF12() { return f12; }
- public int[] getF13() { return f13; }
- public List<Integer> getF14() { return f14; }
- public String[][] getF15() { return f15; }
- public List<String[]> getF16() { return f16; }
- public A[] getF17() { return f17; }
- public List<A> getF18() { return f18; }
- public A[][] getF19() { return f19; }
- public List<List<A>> getF20() { return f20; }
-
- public void setF11(String[] f11) { this.f11 = f11; }
- public void setF12(List<String> f12) { this.f12 = f12; }
- public void setF13(int[] f13) { this.f13 = f13; }
- public void setF14(List<Integer> f14) { this.f14 = f14; }
- public void setF15(String[][] f15) { this.f15 = f15; }
- public void setF16(List<String[]> f16) { this.f16 = f16; }
- public void setF17(A[] f17) { this.f17 = f17; }
- public void setF18(List<A> f18) { this.f18 = f18; }
- public void setF19(A[][] f19) { this.f19 = f19; }
- public void setF20(List<List<A>> f20) { this.f20 = f20; }
-
- static B create() {
- B t = new B();
- t.f01 = new String[]{"a","b"};
- t.f02 = new AList<String>().append("c").append("d");
- t.f03 = new int[]{1,2};
- t.f04 = new AList<Integer>().append(3).append(4);
- t.f05 = new String[][]{{"e","f"},{"g","h"}};
- t.f06 = new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"});
- t.f07 = new A[]{A.create(),A.create()};
- t.f08 = new AList<A>().append(A.create()).append(A.create());
- t.f09 = new A[][]{{A.create()},{A.create()}};
- t.f10 = new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create()));
- t.setF11(new String[]{"a","b"});
- t.setF12(new AList<String>().append("c").append("d"));
- t.setF13(new int[]{1,2});
- t.setF14(new AList<Integer>().append(3).append(4));
- t.setF15(new String[][]{{"e","f"},{"g","h"}});
- t.setF16(new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"}));
- t.setF17(new A[]{A.create(),A.create()});
- t.setF18(new AList<A>().append(A.create()).append(A.create()));
- t.setF19(new A[][]{{A.create()},{A.create()}});
- t.setF20(new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create())));
- return t;
- }
- }
-
- @UrlEncoding(expandedParams=true)
- public static class C extends B {
- static C create() {
- C t = new C();
- t.f01 = new String[]{"a","b"};
- t.f02 = new AList<String>().append("c").append("d");
- t.f03 = new int[]{1,2};
- t.f04 = new AList<Integer>().append(3).append(4);
- t.f05 = new String[][]{{"e","f"},{"g","h"}};
- t.f06 = new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"});
- t.f07 = new A[]{A.create(),A.create()};
- t.f08 = new AList<A>().append(A.create()).append(A.create());
- t.f09 = new A[][]{{A.create()},{A.create()}};
- t.f10 = new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create()));
- t.setF11(new String[]{"a","b"});
- t.setF12(new AList<String>().append("c").append("d"));
- t.setF13(new int[]{1,2});
- t.setF14(new AList<Integer>().append(3).append(4));
- t.setF15(new String[][]{{"e","f"},{"g","h"}});
- t.setF16(new AList<String[]>().append(new String[]{"i","j"}).append(new String[]{"k","l"}));
- t.setF17(new A[]{A.create(),A.create()});
- t.setF18(new AList<A>().append(A.create()).append(A.create()));
- t.setF19(new A[][]{{A.create()},{A.create()}});
- t.setF20(new AList<List<A>>().append(Arrays.asList(A.create())).append(Arrays.asList(A.create())));
- return t;
- }
- }
-}