You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2016/11/29 15:26:27 UTC
[1/4] usergrid-qakka git commit: Initial commit
Repository: usergrid-qakka
Updated Branches:
refs/heads/master [created] 8b2a63faf
Initial commit
Project: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/commit/9c18cc65
Tree: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/tree/9c18cc65
Diff: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/diff/9c18cc65
Branch: refs/heads/master
Commit: 9c18cc653500005ac5653be515873cd6dd91b80f
Parents:
Author: David M. Johnson <sn...@apache.org>
Authored: Fri Nov 18 10:57:41 2016 -0500
Committer: David M. Johnson <sn...@apache.org>
Committed: Fri Nov 18 10:57:41 2016 -0500
----------------------------------------------------------------------
.gitignore | 12 ++++
LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
README.md | 2 +
3 files changed, 215 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/9c18cc65/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..32858aa
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/9c18cc65/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8dada3e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed 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/usergrid-qakka/blob/9c18cc65/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1056ce4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# qakka
+Standalone version of Usergrid's Qakka distributed & multi-region queue service
[2/4] usergrid-qakka git commit: Qakka web code extracted from
Usergrid Queue package, allows Qakka to run as a standalone service
Posted by sn...@apache.org.
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/test/resources/qakka.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/qakka.properties b/src/test/resources/qakka.properties
new file mode 100644
index 0000000..94bfeff
--- /dev/null
+++ b/src/test/resources/qakka.properties
@@ -0,0 +1,68 @@
+# 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.
+
+
+# Properties for JUnit tests
+
+queue.standalone=true
+
+usergrid.cluster_name=Test Cluster
+
+usergrid.cluster.hostname=localhost
+
+# Comma-separated list of regions to be considered
+usergrid.cluster.region.list=us-east
+
+# The regions of this local instance of Usergrid
+usergrid.cluster.region.local=us-east
+
+# Comma-separated lists of cluster seeds each with format {region}:{hostname}
+usergrid.cluster.seeds=us-east:localhost
+
+# Port used for cluster communications.
+usergrid.cluster.port=3545
+
+queue.inmemory.cache=true
+
+queue.num.actors=50
+queue.sender.num.actors=100
+queue.writer.num.actors=100
+
+queue.send.timeout.seconds=5
+queue.get.timeout.seconds=5
+
+# set shard size and times low for testing purposes
+queue.shard.max.size=10
+queue.shard.allocation.check.frequency.millis=1000
+queue.shard.allocation.advance.time.millis=200
+
+# set low for testing purposes
+queue.shard.counter.max-in-memory=50
+queue.message.counter.max-in-memory=50
+
+queue.long.polling.time.millis=2000
+
+cassandra.hosts=localhost
+
+cassandra.keyspace.application=qakka_test_application
+
+cassandra.keyspace.queue-message=qakka_test_queue_messages
+
+cassandra.keyspace-drop-and-create=true
+
+#cassandra.connections=30
+cassandra.timeout.pool=20000
[3/4] usergrid-qakka git commit: Qakka web code extracted from
Usergrid Queue package, allows Qakka to run as a standalone service
Posted by sn...@apache.org.
Qakka web code extracted from Usergrid Queue package, allows Qakka to run as a standalone service
Project: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/commit/873f9093
Tree: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/tree/873f9093
Diff: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/diff/873f9093
Branch: refs/heads/master
Commit: 873f9093215052cd33111bc8462744f694ea5b36
Parents: 9c18cc6
Author: Dave Johnson <sn...@apache.org>
Authored: Tue Nov 29 10:25:20 2016 -0500
Committer: Dave Johnson <sn...@apache.org>
Committed: Tue Nov 29 10:25:20 2016 -0500
----------------------------------------------------------------------
.gitignore | 1 +
pom.xml | 177 ++++++++
.../persistence/qakka/api/ApiResponse.java | 68 +++
.../persistence/qakka/api/QueueResource.java | 420 ++++++++++++++++++
.../persistence/qakka/api/StatusResource.java | 82 ++++
.../qakka/api/impl/BadRequestMapper.java | 43 ++
.../qakka/api/impl/GuiceFeature.java | 45 ++
.../qakka/api/impl/GuiceWebModule.java | 40 ++
.../qakka/api/impl/JacksonProvider.java | 44 ++
.../qakka/api/impl/JerseyResourceConfig.java | 31 ++
.../qakka/api/impl/NotFoundMapper.java | 43 ++
.../qakka/api/impl/QakkaStandaloneModule.java | 48 ++
.../qakka/api/impl/StartupListener.java | 71 +++
src/main/webapp/WEB-INF/web.xml | 51 +++
.../persistence/qakka/KeyspaceDropper.java | 79 ++++
.../persistence/qakka/api/AbstractRestTest.java | 65 +++
.../persistence/qakka/api/PerformanceTest.java | 148 +++++++
.../qakka/api/QueueResourceTest.java | 443 +++++++++++++++++++
src/test/resources/cassandra.yaml | 53 +++
src/test/resources/log4j.properties | 39 ++
src/test/resources/qakka-duck.jpg | Bin 0 -> 11188 bytes
src/test/resources/qakka.properties | 68 +++
22 files changed, 2059 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 32858aa..17961ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
+*.log
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..88bc813
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,177 @@
+
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.usergrid</groupId>
+ <artifactId>qakka-web</artifactId>
+ <name>Qakka Standalone Webapp</name>
+
+ <packaging>war</packaging>
+ <version>1.0-SNAPSHOT</version>
+
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <servlet.version>3.0.1</servlet.version>
+ <jersey.version>2.21</jersey.version>
+ <guice-bridge.version>2.4.0</guice-bridge.version>
+ <guice.version>4.0-beta5</guice.version>
+ </properties>
+
+
+ <build>
+
+ <pluginManagement>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <archiveClasses>true</archiveClasses>
+ <attachClasses>true</attachClasses>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ <configuration>
+ <forkCount>0</forkCount>
+ <threadCount>0</threadCount>
+ <argLine>
+ -Xms2G -Xmx4G -Dlog4j.configuration=file:${basedir}/src/test/resources/log4j.properties
+ </argLine>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.3</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ <fork>true</fork>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/**</include>
+ </includes>
+ </testResource>
+ </testResources>
+
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.usergrid</groupId>
+ <artifactId>queue</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ <classifier>classes</classifier>
+ <type>jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cassandra</groupId>
+ <artifactId>cassandra-all</artifactId>
+ <version>2.1.9</version>
+ <exclusions>
+ <exclusion>
+ <groupId>net.jpountz.lz4</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ <exclusion>
+ <artifactId>netty</artifactId>
+ <groupId>io.netty</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>logback-classic</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- Java EE & Jersey -->
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>${servlet.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+
+ <!-- added for Guice Jersey integration -->
+ <dependency>
+ <groupId>org.glassfish.hk2</groupId>
+ <artifactId>guice-bridge</artifactId>
+ <version>${guice-bridge.version}</version>
+ </dependency>
+
+ <!-- added for Guice Jersey integration -->
+ <dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-servlet</artifactId>
+ <version>${guice.version}</version>
+ </dependency>
+
+ <!-- added to enable logging from within Jersey -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jul-to-slf4j</artifactId>
+ <version>1.7.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.jersey.test-framework.providers</groupId>
+ <artifactId>jersey-test-framework-provider-jetty</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
+
+
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java
new file mode 100644
index 0000000..c2c0910
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/ApiResponse.java
@@ -0,0 +1,68 @@
+/*
+ * 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.usergrid.persistence.qakka.api;
+
+import org.apache.usergrid.persistence.qakka.core.Queue;
+import org.apache.usergrid.persistence.qakka.core.QueueMessage;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Collection;
+
+
+@XmlRootElement
+public class ApiResponse {
+
+ private String message;
+ private Integer count;
+ private Collection<Queue> queues;
+ private Collection<QueueMessage> queueMessages;
+
+ public Collection<Queue> getQueues() {
+ return queues;
+ }
+
+ public void setQueues(Collection<Queue> queues) {
+ this.queues = queues;
+ }
+
+ public Collection<QueueMessage> getQueueMessages() {
+ return queueMessages;
+ }
+
+ public void setQueueMessages(Collection<QueueMessage> queueMessages) {
+ this.queueMessages = queueMessages;
+ }
+
+ public Integer getCount() {
+ return count;
+ }
+
+ public void setCount(Integer count) {
+ this.count = count;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java
new file mode 100644
index 0000000..1770c8b
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/QueueResource.java
@@ -0,0 +1,420 @@
+/*
+ * 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.usergrid.persistence.qakka.api;
+
+import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream;
+import com.google.common.base.Preconditions;
+import com.google.common.io.ByteStreams;
+import org.apache.usergrid.persistence.qakka.core.*;
+import org.apache.usergrid.persistence.qakka.exceptions.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.ws.rs.*;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+
+@Path("queues")
+public class QueueResource {
+ private static final Logger logger = LoggerFactory.getLogger( QueueResource.class );
+
+ private final QueueManager queueManager;
+ private final QueueMessageManager queueMessageManager;
+ private final URIStrategy uriStrategy;
+ private final Regions regions;
+
+
+ @Inject
+ public QueueResource(
+ QueueManager queueManager,
+ QueueMessageManager queueMessageManager,
+ URIStrategy uriStrategy,
+ Regions regions ) {
+
+ this.queueManager = queueManager;
+ this.queueMessageManager = queueMessageManager;
+ this.uriStrategy = uriStrategy;
+ this.regions = regions;
+ }
+
+
+ @POST
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response createQueue(Queue queue ) throws Exception {
+
+ Preconditions.checkArgument(queue != null, "Queue configuration is required");
+ Preconditions.checkArgument(!QakkaUtils.isNullOrEmpty(queue.getName()), "Queue name is required");
+
+ queueManager.createQueue(queue);
+
+ ApiResponse apiResponse = new ApiResponse();
+ apiResponse.setQueues( Collections.singletonList(queue) );
+ return Response.created( uriStrategy.queueURI( queue.getName() )).entity(apiResponse).build();
+ }
+
+
+ @PUT
+ @Path( "{queueName}/config" )
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response updateQueueConfig( @PathParam("queueName") String queueName, Queue queue) {
+
+ Preconditions.checkArgument(!QakkaUtils.isNullOrEmpty(queueName), "Queue name is required");
+ Preconditions.checkArgument(queue != null, "Queue configuration is required");
+
+ queue.setName(queueName);
+ queueManager.updateQueueConfig(queue);
+
+ ApiResponse apiResponse = new ApiResponse();
+ apiResponse.setQueues( Collections.singletonList(queue) );
+ return Response.ok().entity(apiResponse).build();
+ }
+
+
+ @DELETE
+ @Path( "{queueName}" )
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response deleteQueue( @PathParam("queueName") String queueName,
+ @QueryParam("confirm") @DefaultValue("false") Boolean confirmedParam) {
+
+ Preconditions.checkArgument(!QakkaUtils.isNullOrEmpty(queueName), "Queue name is required");
+ Preconditions.checkArgument(confirmedParam != null, "Confirm parameter is required");
+
+ ApiResponse apiResponse = new ApiResponse();
+
+ if ( confirmedParam ) {
+ queueManager.deleteQueue( queueName );
+ return Response.ok().entity( apiResponse ).build();
+ }
+
+ apiResponse.setMessage( "confirm parameter must be true" );
+ return Response.status( Response.Status.BAD_REQUEST ).entity( apiResponse ).build();
+ }
+
+
+ @GET
+ @Path( "{queueName}/config" )
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response getQueueConfig( @PathParam("queueName") String queueName) {
+
+ Preconditions.checkArgument(!QakkaUtils.isNullOrEmpty(queueName), "Queue name is required");
+
+ ApiResponse apiResponse = new ApiResponse();
+ Queue queue = queueManager.getQueueConfig( queueName );
+ if ( queue != null ) {
+ apiResponse.setQueues( Collections.singletonList(queue) );
+ return Response.ok().entity(apiResponse).build();
+ }
+ return Response.status( Response.Status.NOT_FOUND ).build();
+ }
+
+
+ @GET
+ @Produces({MediaType.APPLICATION_JSON})
+ public List<String> getListOfQueues() {
+
+ // TODO: create design to handle large number of queues, e.g. paging and/or hierarchy of queues
+
+ // TODO: create design to support multi-tenant usage, authentication, etc.
+
+ return queueManager.getListOfQueues();
+ }
+
+
+ @GET
+ @Path( "{queueName}/stats" )
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response getQueueStats( @PathParam("queueName") String queueName) throws Exception {
+ // TODO: implement GET /queues/{queueName}/stats
+ throw new UnsupportedOperationException();
+ }
+
+
+ Long convertDelayParameter(String delayParam) {
+ Long delayMs = 0L;
+ if (!QakkaUtils.isNullOrEmpty(delayParam)) {
+ switch (delayParam.toUpperCase()) {
+ case "NONE":
+ case "":
+ delayMs = 0L;
+ break;
+ default:
+ try {
+ delayMs = Long.parseLong(delayParam);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Invalid delay parameter");
+ }
+ break;
+ }
+ }
+ return delayMs;
+ }
+
+ Long convertExpirationParameter(String expirationParam) throws IllegalArgumentException {
+ Long expirationSecs = null;
+ if (!QakkaUtils.isNullOrEmpty(expirationParam)) {
+ switch (expirationParam.toUpperCase()) {
+ case "NEVER":
+ case "":
+ expirationSecs = null;
+ break;
+ default:
+ try {
+ expirationSecs = Long.parseLong(expirationParam);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Invalid expiration parameter");
+ }
+ break;
+ }
+ }
+ return expirationSecs;
+ }
+
+
+ /**
+ * Send a queue message with a JSON payload.
+ *
+ * @param queueName Name of queue to target (queue must exist)
+ * @param regionsParam Comma-separated list of regions to send to
+ * @param delayParam Delay (ms) before sending message (not yet supported)
+ * @param expirationParam Time (ms) after which message will expire (not yet supported)
+ * @param messageBody JSON payload in string form
+ */
+ @POST
+ @Path( "{queueName}/messages" )
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response sendMessageJson(
+ @PathParam("queueName") String queueName,
+ @QueryParam("regions" ) @DefaultValue("") String regionsParam,
+ @QueryParam("delay") @DefaultValue("") String delayParam,
+ @QueryParam("expiration") @DefaultValue("") String expirationParam,
+ String messageBody) throws Exception {
+
+ return sendMessage( queueName, regionsParam, delayParam, expirationParam,
+ MediaType.APPLICATION_JSON, ByteBuffer.wrap( messageBody.getBytes() ) );
+ }
+
+
+ /**
+ * Send a queue message with a binary data payload.
+ *
+ * @param queueName Name of queue to target (queue must exist)
+ * @param regionsParam Comma-separated list of regions to send to
+ * @param delayParam Delay (ms) before sending message (not yet supported)
+ * @param expirationParam Time (ms) after which message will expire (not yet supported)
+ * @param actualContentType Content type of messageBody data (if not application/octet-stream)
+ * @param messageBody Binary data that is the payload of the queue message
+ */
+ @POST
+ @Path( "{queueName}/messages" )
+ @Consumes(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response sendMessageBinary(
+ @PathParam("queueName") String queueName,
+ @QueryParam("regions" ) @DefaultValue("") String regionsParam,
+ @QueryParam("delay") @DefaultValue("") String delayParam,
+ @QueryParam("expiration") @DefaultValue("") String expirationParam,
+ @QueryParam("contentType") String actualContentType,
+ byte[] messageBody) throws Exception {
+
+ String contentType = actualContentType != null ? actualContentType : MediaType.APPLICATION_OCTET_STREAM;
+
+ return sendMessage( queueName, regionsParam, delayParam, expirationParam,
+ contentType, ByteBuffer.wrap( messageBody ) );
+ }
+
+
+ private Response sendMessage( String queueName,
+ String regionsParam,
+ String delayParam,
+ String expirationParam,
+ String contentType,
+ ByteBuffer byteBuffer) {
+
+ if ( queueManager.getQueueConfig( queueName ) == null ) {
+ throw new NotFoundException( "Queue " + queueName + " not found" ) ;
+ }
+
+ Preconditions.checkArgument( !QakkaUtils.isNullOrEmpty( queueName ), "Queue name is required" );
+
+ // if regions, delay or expiration are empty string, would get the defaults from the queue
+ if (regionsParam.equals( "" )) {
+ regionsParam = Regions.LOCAL;
+ }
+
+ Long delayMs = convertDelayParameter( delayParam );
+
+ Long expirationSecs = convertExpirationParameter( expirationParam );
+
+ List<String> regionList = regions.getRegions( regionsParam );
+
+ queueMessageManager.sendMessages( queueName, regionList, delayMs, expirationSecs,
+ contentType, byteBuffer );
+
+ ApiResponse apiResponse = new ApiResponse();
+ apiResponse.setCount( 1 );
+ return Response.ok().entity( apiResponse ).build();
+
+ }
+
+
+ @GET
+ @Path( "{queueName}/messages" )
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response getNextMessages( @PathParam("queueName") String queueName,
+ @QueryParam("count") @DefaultValue("1") String countParam) throws Exception {
+
+ Preconditions.checkArgument( !QakkaUtils.isNullOrEmpty( queueName ), "Queue name is required" );
+
+ int count = 1;
+ try {
+ count = Integer.parseInt( countParam );
+ } catch (Exception e) {
+ throw new IllegalArgumentException( "Invalid count parameter" );
+ }
+ if (count <= 0) {
+ // invalid count
+ throw new IllegalArgumentException( "Count must be >= 1" );
+ }
+
+ List<QueueMessage> messages = queueMessageManager.getNextMessages( queueName, count );
+
+ ApiResponse apiResponse = new ApiResponse();
+
+ if (messages != null && !messages.isEmpty()) {
+ apiResponse.setQueueMessages( messages );
+
+ } else { // always return queueMessages field
+ apiResponse.setQueueMessages( Collections.EMPTY_LIST );
+ }
+ apiResponse.setCount( apiResponse.getQueueMessages().size() );
+ return Response.ok().entity( apiResponse ).build();
+ }
+
+
+ @DELETE
+ @Path( "{queueName}/messages/{queueMessageId}" )
+ @Produces({MediaType.APPLICATION_JSON})
+ public Response ackMessage( @PathParam("queueName") String queueName,
+ @PathParam("queueMessageId") String queueMessageId) throws Exception {
+
+ Preconditions.checkArgument( !QakkaUtils.isNullOrEmpty( queueName ), "Queue name is required" );
+
+ UUID messageUuid;
+ try {
+ messageUuid = UUID.fromString( queueMessageId );
+ } catch (Exception e) {
+ throw new IllegalArgumentException( "Invalid queue message UUID" );
+ }
+ queueMessageManager.ackMessage( queueName, messageUuid );
+
+ ApiResponse apiResponse = new ApiResponse();
+ return Response.ok().entity( apiResponse ).build();
+ }
+
+
+ @GET
+ @Path( "{queueName}/data/{queueMessageId}" )
+ public Response getMessageData(
+ @PathParam("queueName") String queueName,
+ @PathParam("queueMessageId") String queueMessageIdParam ) {
+
+ Preconditions.checkArgument(!QakkaUtils.isNullOrEmpty(queueName), "Queue name is required");
+
+ UUID queueMessageId;
+ try {
+ queueMessageId = UUID.fromString(queueMessageIdParam);
+ }
+ catch (Exception e) {
+ throw new IllegalArgumentException("Invalid queue message UUID");
+ }
+
+ QueueMessage message = queueMessageManager.getMessage( queueName, queueMessageId );
+ if ( message == null ) {
+ throw new NotFoundException(
+ "Message not found for queueName: " + queueName + " queue message id: " + queueMessageId );
+ }
+
+ ByteBuffer messageData = queueMessageManager.getMessageData( message.getMessageId() );
+ if ( messageData == null ) {
+ throw new NotFoundException( "Message data not found queueName: " + queueName
+ + " queue message id: " + queueMessageId + " message id: " + message.getMessageId() );
+ }
+
+ ByteBufferBackedInputStream input = new ByteBufferBackedInputStream( messageData );
+
+ StreamingOutput stream = output -> {
+ try {
+ ByteStreams.copy(input, output);
+ } catch (Exception e) {
+ throw new WebApplicationException(e);
+ }
+ };
+
+ return Response.ok( stream ).header( "Content-Type", message.getContentType() ).build();
+ }
+
+
+// @PUT
+// @Path( "{queueName}/messages/{queueMessageId}" )
+// @Produces({MediaType.APPLICATION_JSON})
+// public Response requeueMessage( @PathParam("queueName") String queueName,
+// @PathParam("queueMessageId") String queueMessageIdParam,
+// @QueryParam("delay") @DefaultValue("") String delayParam) throws Exception {
+//
+// Preconditions.checkArgument(!QakkaUtils.isNullOrEmpty(queueName), "Queue name is required");
+//
+// UUID queueMessageId;
+// try {
+// queueMessageId = UUID.fromString(queueMessageIdParam);
+// }
+// catch (Exception e) {
+// throw new IllegalArgumentException("Invalid message UUID");
+// }
+// Long delayMs = convertDelayParameter(delayParam);
+//
+// queueMessageManager.requeueMessage(queueName, queueMessageId, delayMs);
+//
+// ApiResponse apiResponse = new ApiResponse();
+// return Response.ok().entity(apiResponse).build();
+// }
+//
+//
+// @DELETE
+// @Path( "{queueName}/messages" )
+// @Produces({MediaType.APPLICATION_JSON})
+// public Response clearMessages( @PathParam("queueName") String queueName,
+// @QueryParam("confirm") @DefaultValue("false") Boolean confirmed) throws Exception {
+//
+// // TODO: implement DELETE /queues/{queueName}/messages"
+// throw new UnsupportedOperationException();
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java
new file mode 100644
index 0000000..1d1c836
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/StatusResource.java
@@ -0,0 +1,82 @@
+/*
+ * 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.usergrid.persistence.qakka.api;
+
+import com.codahale.metrics.Timer;
+import com.google.inject.servlet.RequestScoped;
+import org.apache.usergrid.persistence.qakka.App;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.text.DecimalFormat;
+import java.util.HashMap;
+import java.util.SortedSet;
+
+
+@Path("status")
+@RequestScoped
+public class StatusResource {
+ private static final Logger logger = LoggerFactory.getLogger( StatusResource.class );
+
+ private App app;
+
+ @Inject
+ public StatusResource( App app ) {
+ this.app = app;
+ }
+
+ @GET
+ @Produces( MediaType.APPLICATION_JSON )
+ public Object status() {
+
+ final DecimalFormat format = new DecimalFormat("##.###");
+ final long nano = 1000000000;
+
+ return new HashMap<String, Object>() {{
+ put( "name", "Qakka" );
+ try {
+ put( "host", InetAddress.getLocalHost().getHostName() );
+ } catch (UnknownHostException e) {
+ put( "host", "unknown" );
+ }
+ SortedSet<String> names = app.getMetricRegistry().getNames();
+ for (String name : names) {
+ Timer t = app.getMetricRegistry().timer( name );
+ put( name, new HashMap<String, Object>() {{
+ put( "count", "" + t.getCount() );
+ put( "mean_rate", "" + format.format( t.getMeanRate() ) );
+ put( "one_minute_rate", "" + format.format( t.getOneMinuteRate() ) );
+ put( "five_minute_rate", "" + format.format( t.getFiveMinuteRate() ) );
+ put( "mean", "" + format.format( t.getSnapshot().getMean() / nano ) );
+ put( "min", "" + format.format( (double) t.getSnapshot().getMin() / nano ) );
+ put( "max", "" + format.format( (double) t.getSnapshot().getMax() / nano ) );
+ }} );
+ }
+ }};
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/BadRequestMapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/BadRequestMapper.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/BadRequestMapper.java
new file mode 100644
index 0000000..88d6394
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/BadRequestMapper.java
@@ -0,0 +1,43 @@
+/*
+ * 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.usergrid.persistence.qakka.api.impl;
+
+import org.apache.usergrid.persistence.qakka.api.ApiResponse;
+import org.apache.usergrid.persistence.qakka.exceptions.BadRequestException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+
+@Provider
+public class BadRequestMapper implements ExceptionMapper<BadRequestException> {
+
+ public Response toResponse( BadRequestException ex ) {
+
+ ApiResponse apiResponse = new ApiResponse();
+ apiResponse.setMessage( ex.getMessage() );
+
+ return Response.status(400).entity( apiResponse ).type( MediaType.APPLICATION_JSON ).build();
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/GuiceFeature.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/GuiceFeature.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/GuiceFeature.java
new file mode 100644
index 0000000..a3485d0
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/GuiceFeature.java
@@ -0,0 +1,45 @@
+/*
+ * 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.usergrid.persistence.qakka.api.impl;
+
+import org.glassfish.hk2.api.ServiceLocator;
+import org.glassfish.jersey.ServiceLocatorProvider;
+import org.jvnet.hk2.guice.bridge.api.GuiceBridge;
+import org.jvnet.hk2.guice.bridge.api.GuiceIntoHK2Bridge;
+
+import javax.ws.rs.core.Feature;
+import javax.ws.rs.core.FeatureContext;
+import javax.ws.rs.ext.Provider;
+
+
+@Provider
+public class GuiceFeature implements Feature {
+
+ @Override
+ public boolean configure(FeatureContext context) {
+
+ ServiceLocator serviceLocator = ServiceLocatorProvider.getServiceLocator( context );
+ GuiceBridge.getGuiceBridge().initializeGuiceBridge( serviceLocator );
+
+ GuiceIntoHK2Bridge guiceBridge = serviceLocator.getService( GuiceIntoHK2Bridge.class );
+ guiceBridge.bridgeGuiceInjector( StartupListener.INJECTOR );
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/GuiceWebModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/GuiceWebModule.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/GuiceWebModule.java
new file mode 100644
index 0000000..eaf6d21
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/GuiceWebModule.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. 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. For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
+package org.apache.usergrid.persistence.qakka.api.impl;
+
+import com.google.inject.AbstractModule;
+import org.apache.usergrid.persistence.actorsystem.ActorSystemModule;
+import org.apache.usergrid.persistence.core.guice.CommonModule;
+import org.apache.usergrid.persistence.qakka.QakkaModule;
+
+
+/**
+ * Created by Dave Johnson (snoopdave@apache.org) on 9/14/16.
+ */
+public class GuiceWebModule extends AbstractModule {
+
+
+ @Override
+ protected void configure() {
+ install( new CommonModule() );
+ install( new ActorSystemModule() );
+ install( new QakkaStandaloneModule() );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/JacksonProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/JacksonProvider.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/JacksonProvider.java
new file mode 100644
index 0000000..b1400ca
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/JacksonProvider.java
@@ -0,0 +1,44 @@
+/*
+ * 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.usergrid.persistence.qakka.api.impl;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
+
+
+@Provider
+public class JacksonProvider implements ContextResolver<ObjectMapper> {
+ final ObjectMapper mapper;
+
+ public JacksonProvider() {
+ mapper = new ObjectMapper();
+ mapper.enable( SerializationFeature.INDENT_OUTPUT );
+ mapper.setSerializationInclusion( JsonInclude.Include.NON_NULL );
+ }
+
+ @Override
+ public ObjectMapper getContext(final Class<?> type) {
+ return mapper;
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/JerseyResourceConfig.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/JerseyResourceConfig.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/JerseyResourceConfig.java
new file mode 100644
index 0000000..86cfe05
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/JerseyResourceConfig.java
@@ -0,0 +1,31 @@
+/*
+ * 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.usergrid.persistence.qakka.api.impl;
+
+import org.glassfish.jersey.server.ResourceConfig;
+
+
+public class JerseyResourceConfig extends ResourceConfig {
+
+ public JerseyResourceConfig() {
+ packages( "org.apache.usergrid.persistence.qakka.api" );
+ }
+}
+
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/NotFoundMapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/NotFoundMapper.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/NotFoundMapper.java
new file mode 100644
index 0000000..2725766
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/NotFoundMapper.java
@@ -0,0 +1,43 @@
+/*
+ * 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.usergrid.persistence.qakka.api.impl;
+
+import org.apache.usergrid.persistence.qakka.api.ApiResponse;
+import org.apache.usergrid.persistence.qakka.exceptions.NotFoundException;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+
+@Provider
+public class NotFoundMapper implements ExceptionMapper<NotFoundException> {
+
+ public Response toResponse( NotFoundException ex ) {
+
+ ApiResponse apiResponse = new ApiResponse();
+ apiResponse.setMessage( ex.getMessage() );
+
+ return Response.status(404).entity( apiResponse ).type( MediaType.APPLICATION_JSON ).build();
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/QakkaStandaloneModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/QakkaStandaloneModule.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/QakkaStandaloneModule.java
new file mode 100644
index 0000000..9d8e8a7
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/QakkaStandaloneModule.java
@@ -0,0 +1,48 @@
+/*
+ * 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.usergrid.persistence.qakka.api.impl;
+
+import com.google.inject.AbstractModule;
+import com.netflix.config.ConfigurationManager;
+import org.apache.usergrid.persistence.qakka.QakkaModule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Created by Dave Johnson (snoopdave@apache.org) on 11/28/16.
+ */
+public class QakkaStandaloneModule extends AbstractModule {
+ private static final Logger logger = LoggerFactory.getLogger( QakkaModule.class );
+
+ static {
+ try {
+ // load properties from one properties file using Netflix Archaius so that GuicyFig will see them
+ ConfigurationManager.loadCascadedPropertiesFromResources( "qakka" );
+ } catch (Throwable t) {
+ logger.error("Unable to load qakka.properties");
+ }
+ }
+
+ @Override
+ protected void configure() {
+ install( new QakkaModule() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/StartupListener.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/StartupListener.java b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/StartupListener.java
new file mode 100644
index 0000000..4711536
--- /dev/null
+++ b/src/main/java/org/apache/usergrid/persistence/qakka/api/impl/StartupListener.java
@@ -0,0 +1,71 @@
+/*
+ * 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.usergrid.persistence.qakka.api.impl;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.servlet.GuiceServletContextListener;
+import com.google.inject.servlet.ServletModule;
+import org.apache.usergrid.persistence.qakka.App;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import java.util.logging.LogManager;
+
+
+public class StartupListener extends GuiceServletContextListener {
+ private static final Logger logger = LoggerFactory.getLogger( StartupListener.class );
+
+ public static App APP = null;
+
+ public static Injector INJECTOR = null;
+
+ static {
+
+ try {
+ LogManager.getLogManager().reset();
+ SLF4JBridgeHandler.install();
+
+ logger.info("Setting up injector");
+
+ INJECTOR = Guice.createInjector( new ServletModule() {
+ @Override
+ protected void configureServlets() {
+ install( new GuiceWebModule() );
+ }
+ } );
+
+ APP = INJECTOR.getInstance( App.class );
+
+ APP.start();
+
+ } catch ( Throwable t ) {
+ logger.error("Error static initializing StartupListener class", t);
+ }
+
+ }
+
+ @Override
+ protected Injector getInjector() {
+ return INJECTOR;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..cc94f07
--- /dev/null
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,51 @@
+<?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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
+
+ <display-name>qakka</display-name>
+
+ <listener>
+ <listener-class>org.apache.usergrid.persistence.qakka.api.impl.StartupListener</listener-class>
+ </listener>
+
+ <filter>
+ <filter-name>qakka</filter-name>
+ <filter-class>org.glassfish.jersey.servlet.ServletContainer</filter-class>
+
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.apache.usergrid.persistence.qakka.api.impl.JerseyResourceConfig</param-value>
+ </init-param>
+
+ <init-param>
+ <param-name>jersey.config.server.tracing.type</param-name>
+ <!-- allowed values are OFF, ON_DEMAND, ALL -->
+ <param-value>OFF</param-value>
+ </init-param>
+
+ </filter>
+
+ <filter-mapping>
+ <filter-name>qakka</filter-name>
+ <url-pattern>/api/*</url-pattern>
+ </filter-mapping>
+
+</web-app>
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/test/java/org/apache/usergrid/persistence/qakka/KeyspaceDropper.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/usergrid/persistence/qakka/KeyspaceDropper.java b/src/test/java/org/apache/usergrid/persistence/qakka/KeyspaceDropper.java
new file mode 100644
index 0000000..0fdaf73
--- /dev/null
+++ b/src/test/java/org/apache/usergrid/persistence/qakka/KeyspaceDropper.java
@@ -0,0 +1,79 @@
+/*
+ * 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.usergrid.persistence.qakka;
+
+import com.datastax.driver.core.Cluster;
+import com.datastax.driver.core.ConsistencyLevel;
+import com.datastax.driver.core.QueryOptions;
+import com.datastax.driver.core.Session;
+import org.apache.usergrid.persistence.qakka.App;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Properties;
+
+
+/**
+ * Created by Dave Johnson (snoopdave@apache.org) on 9/9/16.
+ */
+public class KeyspaceDropper {
+
+ private static final Logger logger = LoggerFactory.getLogger( KeyspaceDropper.class );
+
+ static { dropTestKeyspaces(); }
+
+
+ public static void dropTestKeyspaces() {
+
+ String propsFileName = "qakka.properties";
+
+ Properties props = new Properties();
+ try {
+ props.load( App.class.getResourceAsStream( "/" + propsFileName ) );
+ } catch (IOException e) {
+ throw new RuntimeException( "Unable to load " + propsFileName + " file!" );
+ }
+
+ String keyspaceApp = (String)props.get("cassandra.keyspace.application");
+ String keyspaceQueue = (String)props.get("cassandra.keyspace.queue-message");
+ String hosts[] = props.getProperty( "cassandra.hosts", "127.0.0.1" ).split(",");
+ int port = Integer.parseInt( props.getProperty( "cassandra.port", "9042" ));
+
+ dropTestKeyspace( keyspaceApp, hosts, port );
+ dropTestKeyspace( keyspaceQueue, hosts, port );
+ }
+
+ public static void dropTestKeyspace( String keyspace, String[] hosts, int port ) {
+
+ Cluster.Builder builder = Cluster.builder();
+ for ( String host : hosts ) {
+ builder = builder.addContactPoint( host ).withPort( port );
+ }
+
+ final QueryOptions queryOptions = new QueryOptions().setConsistencyLevel( ConsistencyLevel.LOCAL_QUORUM );
+ builder.withQueryOptions( queryOptions );
+ Cluster cluster = builder.build();
+
+ Session session = cluster.connect();
+ logger.info("Dropping test keyspace: {}", keyspace);
+ session.execute( "DROP KEYSPACE IF EXISTS " + keyspace );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/test/java/org/apache/usergrid/persistence/qakka/api/AbstractRestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/usergrid/persistence/qakka/api/AbstractRestTest.java b/src/test/java/org/apache/usergrid/persistence/qakka/api/AbstractRestTest.java
new file mode 100644
index 0000000..c3c9c5b
--- /dev/null
+++ b/src/test/java/org/apache/usergrid/persistence/qakka/api/AbstractRestTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.usergrid.persistence.qakka.api;
+
+
+import org.apache.usergrid.persistence.qakka.KeyspaceDropper;
+import org.apache.usergrid.persistence.qakka.api.impl.JerseyResourceConfig;
+import org.apache.usergrid.persistence.qakka.api.impl.StartupListener;
+import org.glassfish.jersey.test.DeploymentContext;
+import org.glassfish.jersey.test.JerseyTest;
+import org.glassfish.jersey.test.ServletDeploymentContext;
+import org.junit.BeforeClass;
+
+import javax.ws.rs.core.Application;
+
+
+abstract public class AbstractRestTest extends JerseyTest {
+
+ static Application app;
+
+ static DeploymentContext context = null;
+
+ static { new KeyspaceDropper(); }
+
+
+ @BeforeClass
+ public static void startCassandra() throws Exception {
+ // Once upon a time the tests used
+ //EmbeddedCassandraServerHelper.startEmbeddedCassandra("/cassandra.yaml");
+ }
+
+ @Override
+ protected Application configure() {
+ if ( app == null ) {
+ app = new JerseyResourceConfig();
+ }
+ return app;
+ }
+
+ @Override
+ protected DeploymentContext configureDeployment() {
+ if ( context == null ) {
+ context = ServletDeploymentContext.builder( configure() ) .addListener( StartupListener.class ).build();
+ }
+ return context;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/test/java/org/apache/usergrid/persistence/qakka/api/PerformanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/usergrid/persistence/qakka/api/PerformanceTest.java b/src/test/java/org/apache/usergrid/persistence/qakka/api/PerformanceTest.java
new file mode 100644
index 0000000..617706b
--- /dev/null
+++ b/src/test/java/org/apache/usergrid/persistence/qakka/api/PerformanceTest.java
@@ -0,0 +1,148 @@
+/*
+ * 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.usergrid.persistence.qakka.api;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.usergrid.persistence.qakka.core.QueueMessage;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.net.URISyntaxException;
+import java.util.*;
+
+
+public class PerformanceTest {
+ private static final Logger logger = LoggerFactory.getLogger( PerformanceTest.class );
+
+
+ @Test
+ @Ignore("needs external Tomcat and Cassandra")
+ public void testSendAndGetMessagePerformance() throws URISyntaxException, JsonProcessingException {
+
+ Client client = ClientBuilder.newClient();
+
+ WebTarget target = client.target("http://macsnoopdave2013:8080/api/");
+
+ // create a queue
+
+ String queueName = "pt_queue_" + RandomStringUtils.randomAlphanumeric( 10 );
+ Map<String, Object> queueMap = new HashMap<String, Object>() {{ put("name", queueName); }};
+ target.path("queues").request().post( Entity.entity( queueMap, MediaType.APPLICATION_JSON_TYPE));
+
+ // send some messages
+ int numMessages = 20000;
+
+ {
+ ObjectMapper mapper = new ObjectMapper();
+ List<Long> times = new ArrayList<>( numMessages );
+ int errorCount = 0;
+ int counter = 0;
+
+ for (int i = 0; i < numMessages; i++) {
+
+ final int number = i;
+ Map<String, Object> messageMap = new HashMap<String, Object>() {{
+ put( "message", "this is message #" + number );
+ put( "valid", true );
+ }};
+ String body = mapper.writeValueAsString( messageMap );
+
+ long startTime = System.currentTimeMillis();
+ Response post = target.path( "queues" ).path( queueName ).path( "messages" )
+ .request().post( Entity.entity( body, MediaType.APPLICATION_OCTET_STREAM_TYPE ) );
+ long stopTime = System.currentTimeMillis();
+ times.add( stopTime - startTime );
+
+ if ( post.getStatus() != 200 ) {
+ errorCount++;
+ }
+
+ if ( ++counter % 500 == 0 ) {
+ logger.debug("Sent {} messages with error count {}", counter, errorCount);
+ }
+
+ try { Thread.sleep(5); } catch ( Exception intentionallyIgnored ) {};
+ }
+
+ Long total = times.stream().mapToLong( time -> time ).sum();
+ Long max = times.stream().max( Comparator.comparing( time -> time ) ).get();
+ Long min = times.stream().min( Comparator.comparing( time -> time ) ).get();
+ Double average = times.stream().mapToLong( time -> time ).average().getAsDouble();
+
+ logger.debug( "\n>>>>>>> Total send time {}ms, min {}ms, max {}ms, average {}ms errors {}\n\n",
+ total, min, max, average, errorCount );
+ }
+
+ // get all messages, checking for dups
+
+ {
+ Set<UUID> messageIds = new HashSet<>();
+ List<Long> times = new ArrayList<>( numMessages );
+ int errorCount = 0;
+ int counter = 0;
+
+ for (int j = 0; j < numMessages; j++) {
+
+ long startTime = System.currentTimeMillis();
+ Response response = target.path( "queues" ).path( queueName ).path( "messages" ).request().get();
+ long stopTime = System.currentTimeMillis();
+ times.add( stopTime - startTime );
+
+ if ( ++counter % 500 == 0 ) {
+ logger.debug("Got {} messages with error count {}", counter, errorCount);
+ }
+
+ if ( response .getStatus() != 200 ) {
+ errorCount++;
+ continue;
+ }
+
+ ApiResponse apiResponse = response.readEntity( ApiResponse.class );
+ QueueMessage queueMessage = apiResponse.getQueueMessages().iterator().next();
+
+ if (messageIds.contains( queueMessage.getQueueMessageId() )) {
+ Assert.fail( "Message fetched twice: " + queueMessage.getQueueMessageId() );
+ } else {
+ messageIds.add( queueMessage.getQueueMessageId() );
+ }
+ }
+ Assert.assertEquals( numMessages, messageIds.size() );
+
+ Long total = times.stream().mapToLong( time -> time ).sum();
+ Long max = times.stream().max( Comparator.comparing( time -> time ) ).get();
+ Long min = times.stream().min( Comparator.comparing( time -> time ) ).get();
+ Double average = times.stream().mapToLong( time -> time ).average().getAsDouble();
+
+ logger.debug( "\n>>>>>>> Total get time {}ms, min {}ms, max {}ms, average {}ms errors {}\n\n",
+ total, min, max, average, errorCount );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/test/java/org/apache/usergrid/persistence/qakka/api/QueueResourceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/usergrid/persistence/qakka/api/QueueResourceTest.java b/src/test/java/org/apache/usergrid/persistence/qakka/api/QueueResourceTest.java
new file mode 100644
index 0000000..88e3d67
--- /dev/null
+++ b/src/test/java/org/apache/usergrid/persistence/qakka/api/QueueResourceTest.java
@@ -0,0 +1,443 @@
+/*
+ * 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.usergrid.persistence.qakka.api;
+
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.io.ByteStreams;
+import com.google.inject.Injector;
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.usergrid.persistence.qakka.QakkaFig;
+import org.apache.usergrid.persistence.qakka.api.impl.StartupListener;
+import org.apache.usergrid.persistence.qakka.core.QueueMessage;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.util.*;
+
+import static org.junit.Assert.fail;
+
+
+public class QueueResourceTest extends AbstractRestTest {
+ private static final Logger logger = LoggerFactory.getLogger( QueueResourceTest.class );
+
+ static private final TypeReference<Map<String,Object>> jsonMapTypeRef
+ = new TypeReference<Map<String,Object>>() {};
+
+ @Test
+ public void testCreateQueue() throws URISyntaxException {
+
+ // create a queue
+
+ String queueName = "qrt_create_" + RandomStringUtils.randomAlphanumeric( 10 );
+ Map<String, Object> queueMap = new HashMap<String, Object>() {{
+ put("name", queueName);
+ }};
+ Response response = target("queues").request()
+ .post( Entity.entity( queueMap, MediaType.APPLICATION_JSON_TYPE));
+
+ Assert.assertEquals( 201, response.getStatus() );
+ URIStrategy uriStrategy = StartupListener.INJECTOR.getInstance( URIStrategy.class );
+ Assert.assertEquals( uriStrategy.queueURI( queueName ).toString(), response.getHeaderString( "location" ) );
+
+ // get queue by name
+
+ response = target("queues").path( queueName ).path( "config" ).request().get();
+ Assert.assertEquals( 200, response.getStatus() );
+ ApiResponse apiResponse = response.readEntity( ApiResponse.class );
+ Assert.assertNotNull( apiResponse.getQueues() );
+ Assert.assertFalse( apiResponse.getQueues().isEmpty() );
+ Assert.assertEquals( 1, apiResponse.getQueues().size() );
+ Assert.assertEquals( queueName, apiResponse.getQueues().iterator().next().getName() );
+
+ response = target("queues").path( queueName ).queryParam( "confirm", true ).request().delete();
+ Assert.assertEquals( 200, response.getStatus() );
+ }
+
+
+ @Test
+ public void testDeleteQueue() throws URISyntaxException {
+
+ // create a queue
+
+ String queueName = "qrt_delete_" + RandomStringUtils.randomAlphanumeric( 10 );
+ Map<String, Object> queueMap = new HashMap<String, Object>() {{ put("name", queueName); }};
+ Response response = target("queues").request()
+ .post( Entity.entity( queueMap, MediaType.APPLICATION_JSON_TYPE));
+
+ Assert.assertEquals( 201, response.getStatus() );
+ URIStrategy uriStrategy = StartupListener.INJECTOR.getInstance( URIStrategy.class );
+ Assert.assertEquals( uriStrategy.queueURI( queueName ).toString(), response.getHeaderString( "location" ) );
+
+ // delete queue without confirm = true, should fail with bad request
+
+ response = target("queues").path( queueName ).request().delete();
+ Assert.assertEquals( 400, response.getStatus() );
+
+ // delete queue with confirm = true
+
+ response = target("queues").path( queueName ).queryParam( "confirm", true ).request().delete();
+ Assert.assertEquals( 200, response.getStatus() );
+
+ // cannot get queue by name
+
+ response = target("queues").path( queueName ).path( "config" ).request().get();
+ Assert.assertEquals( 404, response.getStatus() );
+ }
+
+
+ @Test
+ public void testSendMessageToBadQueue() throws URISyntaxException, JsonProcessingException, InterruptedException {
+
+ String queueName = "bogus_queue_is_bogus";
+ Map<String, Object> messageMap = new HashMap<String, Object>() {{ put("dummy_prop", "dummy_value"); }};
+ ObjectMapper mapper = new ObjectMapper();
+ String body = mapper.writeValueAsString( messageMap );
+
+ Response response = target("queues").path( queueName ).path( "messages" )
+ .request().post( Entity.entity( body, MediaType.APPLICATION_OCTET_STREAM_TYPE ));
+
+ Assert.assertEquals( 404, response.getStatus() );
+ }
+
+
+ @Test
+ public void testSendJsonMessagesAsJson() throws URISyntaxException, IOException, InterruptedException {
+ sendJsonMessages( true );
+ }
+
+
+ @Test
+ public void testSendMessagesJsonAsOctetStream() throws URISyntaxException, IOException, InterruptedException {
+ sendJsonMessages( false );
+ }
+
+
+ /**
+ * Send 100 JSON payload messages to queue.
+ * @param asJson True to send with content-type header 'application/json'
+ * False to send with content-type header 'application/octet stream'
+ */
+ private void sendJsonMessages( boolean asJson ) throws URISyntaxException, IOException, InterruptedException {
+
+ // create a queue
+
+ String queueName = "qrt_json_" + RandomStringUtils.randomAlphanumeric( 10 );
+ Map<String, Object> queueMap = new HashMap<String, Object>() {{
+ put( "name", queueName );
+ }};
+ target( "queues" ).request().post( Entity.entity( queueMap, MediaType.APPLICATION_JSON_TYPE ) );
+
+ try {
+
+ // send some messages
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ int numMessages = 100;
+ for (int i = 0; i < numMessages; i++) {
+
+ final int number = i;
+ Map<String, Object> messageMap = new HashMap<String, Object>() {{
+ put( "message", "this is message #" + number );
+ put( "valid", true );
+ }};
+ String body = mapper.writeValueAsString( messageMap );
+
+ Response response;
+ if (asJson) {
+ response = target( "queues" ).path( queueName ).path( "messages" )
+ .request().post( Entity.entity( body, MediaType.APPLICATION_JSON ) );
+ } else {
+ response = target( "queues" ).path( queueName ).path( "messages" )
+ .queryParam( "contentType", MediaType.APPLICATION_JSON )
+ .request().post( Entity.entity( body, MediaType.APPLICATION_OCTET_STREAM ) );
+ }
+
+ Assert.assertEquals( 200, response.getStatus() );
+ }
+
+ // get all messages, checking for dups
+
+ checkJsonMessages( queueName, numMessages );
+
+ } finally {
+ Response response = target( "queues" ).path( queueName ).queryParam( "confirm", true ).request().delete();
+ Assert.assertEquals( 200, response.getStatus() );
+ }
+ }
+
+
+ private Set<UUID> checkJsonMessages( String queueName, int numMessages ) throws IOException {
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ Set<UUID> messageIds = new HashSet<>();
+ for ( int j=0; j<numMessages; j++ ) {
+
+ int retries = 0;
+ int maxRetries = 10;
+ ApiResponse apiResponse = null;
+ while ( retries++ < maxRetries ) {
+ Response response = target( "queues" ).path( queueName ).path( "messages" ).request().get();
+ apiResponse = response.readEntity( ApiResponse.class );
+ if ( !apiResponse.getQueueMessages().isEmpty() ) {
+ break;
+ }
+ try { Thread.sleep(500); } catch (Exception ignored) {}
+ }
+
+ Assert.assertNotNull( apiResponse );
+ Assert.assertNotNull( apiResponse.getQueueMessages() );
+ Assert.assertEquals( 1, apiResponse.getQueueMessages().size() );
+
+ QueueMessage queueMessage = apiResponse.getQueueMessages().iterator().next();
+ Map<String, Object> payload = mapper.readValue( queueMessage.getData(), jsonMapTypeRef );
+
+ Assert.assertEquals( queueName, queueMessage.getQueueName() );
+ Assert.assertNull( queueMessage.getHref() );
+ Assert.assertEquals( true, payload.get("valid") );
+
+ if (messageIds.contains( queueMessage.getQueueMessageId() )) {
+ Assert.fail("Message fetched twice: " + queueMessage.getQueueMessageId() );
+ } else {
+ messageIds.add( queueMessage.getQueueMessageId() );
+ }
+ }
+ Assert.assertEquals( numMessages, messageIds.size() );
+
+ return messageIds;
+ }
+
+
+ @Test
+ public void testSendBinaryMessages() throws URISyntaxException, IOException, InterruptedException {
+
+ // create a queue
+
+ String queueName = "qrt_binarty_" + RandomStringUtils.randomAlphanumeric( 10 );
+ Map<String, Object> queueMap = new HashMap<String, Object>() {{
+ put( "name", queueName );
+ }};
+ target( "queues" ).request().post( Entity.entity( queueMap, MediaType.APPLICATION_JSON_TYPE ) );
+
+ try {
+
+ // send messages each with image/jpg payload
+
+ InputStream is = getClass().getResourceAsStream( "/qakka-duck.jpg" );
+ byte[] bytes = ByteStreams.toByteArray( is );
+
+ int numMessages = 100;
+ for (int i = 0; i < numMessages; i++) {
+
+ Response response = target( "queues" ).path( queueName ).path( "messages" )
+ .queryParam( "contentType", "image/jpg" )
+ .request()
+ .post( Entity.entity( bytes, MediaType.APPLICATION_OCTET_STREAM ) );
+
+ Assert.assertEquals( 200, response.getStatus() );
+ }
+
+ // get all messages, checking for dups
+
+ checkBinaryMessages( queueName, numMessages );
+
+ } finally {
+ Response response = target( "queues" ).path( queueName ).queryParam( "confirm", true ).request().delete();
+ Assert.assertEquals( 200, response.getStatus() );
+ }
+ }
+
+
+ private Set<UUID> checkBinaryMessages( String queueName, int numMessages ) throws IOException {
+
+ Set<UUID> messageIds = new HashSet<>();
+ for ( int j=0; j<numMessages; j++ ) {
+
+ Response response = target( "queues" ).path( queueName ).path( "messages" ).request().get();
+
+ ApiResponse apiResponse = response.readEntity( ApiResponse.class );
+ Assert.assertNotNull( apiResponse.getQueueMessages() );
+ Assert.assertFalse( apiResponse.getQueueMessages().isEmpty() );
+ Assert.assertEquals( 1, apiResponse.getQueueMessages().size() );
+
+ QueueMessage queueMessage = apiResponse.getQueueMessages().iterator().next();
+
+ // no data in a binary message
+ Assert.assertNull( queueMessage.getData() );
+
+ // data can be found at HREF provided
+ Assert.assertNotNull( queueMessage.getHref() );
+
+ Response binaryResponse = target("queues")
+ .path( queueName ).path("data").path( queueMessage.getQueueMessageId().toString() )
+ .request().accept( "image/jpg" ).get();
+
+ Assert.assertEquals( 200, binaryResponse.getStatus() );
+ InputStream is = binaryResponse.readEntity( InputStream.class );
+
+ byte[] imageBytes = ByteStreams.toByteArray( is );
+ Assert.assertEquals( 11188, imageBytes.length);
+
+ if (messageIds.contains( queueMessage.getQueueMessageId() )) {
+ fail("Message fetched twice: " + queueMessage.getQueueMessageId() );
+ } else {
+ messageIds.add( queueMessage.getQueueMessageId() );
+ }
+ }
+ Assert.assertEquals( numMessages, messageIds.size() );
+
+ return messageIds;
+ }
+
+
+ @Test
+ public void testSendMessageAckAndTimeout() throws URISyntaxException, IOException, InterruptedException {
+
+ // create a queue
+
+ String queueName = "qrt_timeout_" + RandomStringUtils.randomAlphanumeric( 10 );
+ Map<String, Object> queueMap = new HashMap<String, Object>() {{ put("name", queueName); }};
+ target("queues").request().post( Entity.entity( queueMap, MediaType.APPLICATION_JSON_TYPE));
+
+ try {
+
+ // send some messages
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ int numMessages = 100;
+ for (int i = 0; i < numMessages; i++) {
+
+ final int number = i;
+ Map<String, Object> messageMap = new HashMap<String, Object>() {{
+ put( "message", "this is message #" + number );
+ put( "valid", true );
+ }};
+ String body = mapper.writeValueAsString( messageMap );
+
+ Response response = target( "queues" ).path( queueName ).path( "messages" )
+ .request().post( Entity.entity( body, MediaType.APPLICATION_JSON ) );
+
+ Assert.assertEquals( 200, response.getStatus() );
+ }
+
+ // get all messages, checking for dups
+
+ Set<UUID> messageIds = checkJsonMessages( queueName, numMessages );
+
+ // there should be no more messages available
+
+ Response response = target( "queues" ).path( queueName ).path( "messages" ).request().get();
+ ApiResponse apiResponse = response.readEntity( ApiResponse.class );
+ Assert.assertNotNull( apiResponse.getQueueMessages() );
+ Assert.assertTrue( apiResponse.getQueueMessages().isEmpty() );
+
+ // ack half of the messages
+
+ int count = 0;
+ Set<UUID> ackedIds = new HashSet<>();
+ for (UUID queueMessageId : messageIds) {
+ response = target( "queues" )
+ .path( queueName ).path( "messages" ).path( queueMessageId.toString() ).request().delete();
+ Assert.assertEquals( 200, response.getStatus() );
+ ackedIds.add( queueMessageId );
+ if (++count >= numMessages / 2) {
+ break;
+ }
+ }
+ messageIds.removeAll( ackedIds );
+
+ // wait for remaining of the messages to timeout
+
+ QakkaFig qakkaFig = StartupListener.INJECTOR.getInstance( QakkaFig.class );
+ Thread.sleep( 2 * qakkaFig.getQueueTimeoutSeconds() * 1000 );
+
+ // now, the remaining messages cannot be acked because they timed out
+
+ for (UUID queueMessageId : messageIds) {
+ response = target( "queues" )
+ .path( queueName ).path( "messages" ).path( queueMessageId.toString() ).request().delete();
+ Assert.assertEquals( 400, response.getStatus() );
+ }
+
+ // and, those same messages should be available again in the queue
+
+ checkJsonMessages( queueName, numMessages / 2 );
+
+ } finally {
+ Response response = target( "queues" ).path( queueName ).queryParam( "confirm", true ).request().delete();
+ Assert.assertEquals( 200, response.getStatus() );
+ }
+ }
+
+
+ @Test
+ public void testConvertDelayParameter() {
+
+ Injector injector = StartupListener.INJECTOR;
+ QueueResource queueResource = injector.getInstance( QueueResource.class );
+
+ Assert.assertEquals( 0L, queueResource.convertDelayParameter( "" ).longValue() );
+ Assert.assertEquals( 0L, queueResource.convertDelayParameter( "0" ).longValue() );
+ Assert.assertEquals( 0L, queueResource.convertDelayParameter( "NONE" ).longValue() );
+ Assert.assertEquals( 5L, queueResource.convertDelayParameter( "5" ).longValue() );
+
+ try {
+ queueResource.convertDelayParameter( "bogus value" );
+ fail("Expected exception on bad value");
+ } catch ( IllegalArgumentException expected ) {
+ // pass
+ }
+ }
+
+ @Test
+ public void testConvertExpirationParameter() {
+
+ Injector injector = StartupListener.INJECTOR;
+ QueueResource queueResource = injector.getInstance( QueueResource.class );
+
+ Assert.assertNull( queueResource.convertExpirationParameter( "" ) );
+ Assert.assertNull( queueResource.convertExpirationParameter( "NEVER" ) );
+
+ Assert.assertEquals( 5L, queueResource.convertExpirationParameter( "5" ).longValue() );
+
+ try {
+ queueResource.convertExpirationParameter( "bogus value" );
+ fail("Expected exception on bad value");
+ } catch ( IllegalArgumentException expected ) {
+ // pass
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/test/resources/cassandra.yaml
----------------------------------------------------------------------
diff --git a/src/test/resources/cassandra.yaml b/src/test/resources/cassandra.yaml
new file mode 100644
index 0000000..e97bf00
--- /dev/null
+++ b/src/test/resources/cassandra.yaml
@@ -0,0 +1,53 @@
+
+cluster_name: 'Embedded Test Cluster'
+
+# ports
+storage_port: 7075
+listen_address: localhost
+rpc_address: localhost
+rpc_port: 9160
+native_transport_port: 9042
+
+# data files
+data_file_directories:
+ - target/embeddedCassandra/data
+commitlog_directory: target/embeddedCassandra/commitlog
+saved_caches_directory: target/embeddedCassandra/saved_caches
+
+# native transport!
+start_native_transport: true
+
+# other stuff
+start_rpc: true
+initial_token:
+auto_bootstrap: false
+hinted_handoff_enabled: true
+authenticator: org.apache.cassandra.auth.AllowAllAuthenticator
+partitioner: org.apache.cassandra.dht.RandomPartitioner
+seed_provider:
+ - class_name: org.apache.cassandra.locator.SimpleSeedProvider
+ parameters:
+ - seeds: "127.0.0.1"
+commitlog_sync: periodic
+commitlog_sync_period_in_ms: 10000
+disk_access_mode: auto
+concurrent_reads: 2
+concurrent_writes: 4
+rpc_keepalive: true
+thrift_framed_transport_size_in_mb: 15
+thrift_max_message_length_in_mb: 16
+snapshot_before_compaction: false
+column_index_size_in_kb: 64
+endpoint_snitch: org.apache.cassandra.locator.SimpleSnitch
+dynamic_snitch: true
+dynamic_snitch_update_interval_in_ms: 100
+dynamic_snitch_reset_interval_in_ms: 600000
+dynamic_snitch_badness_threshold: 0.0
+request_scheduler: org.apache.cassandra.scheduler.NoScheduler
+server_encryption_options:
+ internode_encryption: none
+ keystore: conf/.keystore
+ keystore_password: cassandra
+ truststore: conf/.truststore
+ truststore_password: cassandra
+index_interval: 128
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties
new file mode 100644
index 0000000..894bf63
--- /dev/null
+++ b/src/test/resources/log4j.properties
@@ -0,0 +1,39 @@
+# 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.
+
+log4j.rootLogger=ERROR,stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p (%t) %c{1} - %m%n
+
+log4j.logger.org.apache.cassandra=WARN
+log4j.logger.org.glassfish=WARN
+
+log4j.logger.org.apache.usergrid.persistence.qakka=DEBUG
+log4j.logger.org.apache.usergrid.persistence.queue=INFO
+log4j.logger.org.apache.usergrid.corepersistence.asyncevents=INFO
+
+#log4j.logger.org.apache.usergrid.persistence.qakka.serialization.queuemessages=TRACE
+log4j.logger.org.apache.usergrid.persistence.qakka.serialization.sharding=INFO
+#log4j.logger.org.apache.usergrid.persistence.qakka.distributed.actors=TRACE
+log4j.logger.org.apache.usergrid.persistence.qakka.distributed.actors.ShardAllocator=INFO
+
+log4j.logger.org.safehaus.guicyfig.GuicyFigModule=ERROR
+log4j.logger.org.safehaus.guicyfig=ERROR
+
+
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/873f9093/src/test/resources/qakka-duck.jpg
----------------------------------------------------------------------
diff --git a/src/test/resources/qakka-duck.jpg b/src/test/resources/qakka-duck.jpg
new file mode 100644
index 0000000..8a0e0a2
Binary files /dev/null and b/src/test/resources/qakka-duck.jpg differ
[4/4] usergrid-qakka git commit: Missing header
Posted by sn...@apache.org.
Missing header
Project: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/commit/8b2a63fa
Tree: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/tree/8b2a63fa
Diff: http://git-wip-us.apache.org/repos/asf/usergrid-qakka/diff/8b2a63fa
Branch: refs/heads/master
Commit: 8b2a63faf59183a952272f1865a6d0c1de59e7ae
Parents: 873f909
Author: Dave Johnson <sn...@apache.org>
Authored: Tue Nov 29 10:25:57 2016 -0500
Committer: Dave Johnson <sn...@apache.org>
Committed: Tue Nov 29 10:25:57 2016 -0500
----------------------------------------------------------------------
.gitignore | 2 ++
pom.xml | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/8b2a63fa/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 17961ff..070afd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*.log
+qakka-web.iml
+.DS_Store
http://git-wip-us.apache.org/repos/asf/usergrid-qakka/blob/8b2a63fa/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 88bc813..0e994b5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,3 +1,22 @@
+<?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/maven-v4_0_0.xsd">