killbill-aplcache
Details
bin/db-helper 126(+125 -1)
diff --git a/bin/db-helper b/bin/db-helper
old mode 100644
new mode 100755
index 3134267..fd639eb
--- a/bin/db-helper
+++ b/bin/db-helper
@@ -1,2 +1,126 @@
-#!/bin/bash -eu
+#! /usr/bin/env bash
+
+###################################################################################
+# #
+# Copyright 2010-2011 Ning, Inc. #
+# #
+# Ning 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. #
+# #
+###################################################################################
+
+set -x
+
+HERE=`cd \`dirname $0\`; pwd`
+TOP=$HERE/..
+
+POM="$TOP/pom.xml"
+
+ACTION=
+DATABASE="killbill"
+USER="root"
+PWD="root"
+TEST_ALSO=
+
+function usage() {
+ echo -n "./db_helper "
+ echo -n " -a <create|clean>"
+ echo -n " -d database_name (default = killbill)"
+ echo -n " -u user_name (default = root)"
+ echo -n " -p password (default = root)"
+ echo -n " -t (also include test ddl)"
+ echo -n "-h this message"
+ echo
+ exit 1
+}
+
+function get_modules() {
+ local modules=`grep module $POM | grep -v modules | cut -d '>' -f 2 | cut -d '<' -f 1`
+ echo $modules
+}
+
+function find_test_ddl() {
+
+ local modules=`get_modules`
+ local ddl_test=
+
+ local cur_ddl=
+ for m in $modules; do
+ cur_ddl=`find $m/src/test/resources/ -name ddl_test.sql 2>/dev/null`
+ ddl_test="$ddl_test $cur_ddl"
+ done
+ echo "$ddl_test"
+
+}
+function find_src_ddl() {
+
+ local modules=`get_modules`
+ local ddl_src=
+
+ local cur_ddl=
+ for m in $modules; do
+ cur_ddl=`find $m/src/main/resources/ -name ddl.sql 2>/dev/null`
+ ddl_src="$ddl_src $cur_ddl"
+ done
+ echo "$ddl_src"
+}
+
+function create_ddl_file() {
+ local ddls=`find_src_ddl`
+ local test_ddls=
+ if [ ! -z $TEST_ALSO ]; then
+ test_ddls=`find_test_ddl`
+ ddls="$ddls $test_ddls"
+ fi
+
+ local tmp="/tmp/ddl.$$"
+ touch $tmp
+ echo "use $DATABASE;" >> $tmp
+ echo "" >> $tmp
+ for d in $ddls; do
+ cat $d >> $tmp
+ echo "" >> $tmp
+ done
+ echo $tmp
+}
+
+while getopts ":a:d:u:pt" options; do
+ case $options in
+ a ) ACTION=$OPTARG;;
+ d ) DATABASE=$OPTARG;;
+ u ) USER=$OPTARG;;
+ p ) PWD=$OPTARG;;
+ t ) TEST_ALSO=1;;
+ h ) usage;;
+ * ) usage;;
+ esac
+done
+
+
+
+if [ -z $ACTION ]; then
+ echo "Need to specify an action <CREATE|CLEAN>"
+ usage
+fi
+
+
+if [ $ACTION=="create" ]; then
+ DDL_FILE=`create_ddl_file`
+ echo "Applying new schema $tmp to database $DATABASE"
+ mysql -u $USER --password=$PWD < $DDL_FILE
+fi
+
+if [ $ACTION=="clean" ]; then
+ echo "Not implemented yet"
+ exit 1
+fi
\ No newline at end of file
bin/start-server 91(+78 -13)
diff --git a/bin/start-server b/bin/start-server
index 8b87f3d..bc60df8 100755
--- a/bin/start-server
+++ b/bin/start-server
@@ -1,33 +1,98 @@
#! /usr/bin/env bash
+###################################################################################
+# #
+# Copyright 2010-2011 Ning, Inc. #
+# #
+# Ning 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. #
+# #
+###################################################################################
+
+
HERE=`cd \`dirname $0\`; pwd`
TOP=$HERE/..
SERVER=$TOP/server
PROPERTIES="$SERVER/src/main/resources/killbill-server.properties"
-#DEBUG_OPTS_ECLIPSE=
DEBUG_OPTS_ECLIPSE=" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=12345 "
+DEBUG_OPTS_ECLIPSE_WAIT=" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=12345 "
+
OPTS_ECLIPSE=" -Xmx2048m -XX:+UseConcMarkSweepGC -XX:MaxPermSize=128m "
LOG="$SERVER/src/main/resources/log4j.xml"
+# From Argument Options
PORT=8080
+START=
+DEBUG=
+WAIT_DEBUGGER=
-OPTS=
-for PROP in `cat $PROPERTIES | grep =`; do
- K=`echo $PROP | awk ' BEGIN {FS="="} { print $1 }'`
- V=`echo $PROP | awk 'BEGIN {FS="="} { print $2 }'`
- OPTS="$OPTS -D$K=$V"
-done
+function usage() {
+ echo -n "./start-server "
+ echo -n " -s (start server)"
+ echo -n " -d (debugger turned on)"
+ echo -n " -w (along with -d, wait for debugger before starting)"
+ echo -n " -p <port_number> default 8080"
+ echo -n "-h this message"
+ exit 1
+}
-START_CMD="mvn $OPTS -Dlog4j.configuration=file://$LOG -Dning.jmx.http.port=$PORT -Dxn.host.external.port=$PORT -DjettyPort=$PORT -Dxn.server.port=$PORT jetty:run"
+function build_properties() {
+ local opts=
+ local prop=
+ for prop in `cat $PROPERTIES | grep =`; do
+ local k=`echo $prop | awk ' BEGIN {FS="="} { print $1 }'`
+ local v=`echo $prop | awk 'BEGIN {FS="="} { print $2 }'`
+ opts="$opts -D$k=$v"
+ done
+ echo $opts
+}
-echo "Starting IRS:"
-echo "$START_CMD"
+function start() {
+ local opts=`build_properties`
+ local start_cmd="mvn $opts -Dlog4j.configuration=file://$LOG -Dning.jmx.http.port=$PORT -Dxn.host.external.port=$PORT -DjettyPort=$PORT -Dxn.server.port=$PORT jetty:run"
-export MAVEN_OPTS=" -Duser.timezone=UTC $OPTS_ECLIPSE $DEBUG_OPTS_ECLIPSE"
+ local debug_opts_eclipse=
+ if [ ! -z $DEBUG ]; then
+ if [ ! -z $WAIT_DEBUGGER ]; then
+ debug_opts_eclipse=$DEBUG_OPTS_ECLIPSE_WAIT
+ else
+ debug_opts_eclipse=$DEBUG_OPTS_ECLIPSE
+ fi
+ fi
+ export MAVEN_OPTS=" -Duser.timezone=UTC $OPTS_ECLIPSE $debug_opts_eclipse"
+
+ echo "Starting IRS MAVEN_OPTS = $MAVEN_OPTS"
+ echo "$start_cmd"
+ cd $SERVER
+ $start_cmd
+}
+
+
+while getopts ":pswdh" options; do
+ case $options in
+ s ) START=1;;
+ d ) DEBUG=1;;
+ w ) WAIT_DEBUGGER=1;;
+ p ) PORT=$OPTARG;;
+ h ) usage;;
+ * ) usage;;
+ esac
+done
-cd $SERVER
-$START_CMD
+if [ ! -z $START ]; then
+ echo "coucouc"
+ start
+fi
\ No newline at end of file
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
index d34d0ac..4b983e9 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
@@ -60,7 +60,7 @@ public class AccountResource {
}
@GET
- @Path("/{accountId:\\w+}")
+ @Path("/{accountId:\\w+-\\w+-\\w+-\\w+-\\w+}")
@Produces(APPLICATION_JSON)
public Response getAccount(@PathParam("accountId") String accountId) {
Account account = accountApi.getAccountById(UUID.fromString(accountId));
@@ -109,7 +109,7 @@ public class AccountResource {
@PUT
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
- @Path("/{accountId:\\w+}")
+ @Path("/{accountId:\\w+-\\w+-\\w+-\\w+-\\w+}")
public Response updateAccount(AccountJson json, @PathParam("accountId") String accountId) {
try {
AccountData data = json.toAccountData();
@@ -123,7 +123,7 @@ public class AccountResource {
// Not supported
@DELETE
- @Path("/{accountId:\\w+}")
+ @Path("/{accountId:\\w+-\\w+-\\w+-\\w+-\\w+}")
@Produces(APPLICATION_JSON)
public Response cancelAccount(@PathParam("accountId") String accountId) {
/*
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/BundleResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/BundleResource.java
index 07a7517..ba9405e 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/BundleResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/BundleResource.java
@@ -34,7 +34,7 @@ import com.ning.billing.jaxrs.json.BundleJson;
public class BundleResource {
@GET
- @Path("/{bundleId:\\w+}")
+ @Path("/{bundleId:\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+}")
@Produces(APPLICATION_JSON)
public Response getBundle(@PathParam("bundleId") String bundleId) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/BundleTimelineResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/BundleTimelineResource.java
index 93a1f23..6386a5b 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/BundleTimelineResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/BundleTimelineResource.java
@@ -32,7 +32,7 @@ import javax.ws.rs.core.Response.Status;
public class BundleTimelineResource {
@GET
- @Path("/{bundleId:\\w+}")
+ @Path("/{bundleId:\\\\w+-\\\\w+-\\\\w+-\\\\w+-\\\\w+}")
@Produces(APPLICATION_JSON)
public Response getBundleTimeline(@PathParam("bundleId") String bundleId) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
@@ -41,7 +41,7 @@ public class BundleTimelineResource {
@POST
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
- @Path("/{bundleId:\\w+}/repair")
+ @Path("/{bundleId:\\w+-\\w+-\\w+-\\w+-\\w+}/repair")
public Response repairBundleTineline(BundleTimelineResource bundle,
@PathParam("bundleId") String bundleId) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/InvoiceResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/InvoiceResource.java
index 1db336e..e5a1c97 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/InvoiceResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/InvoiceResource.java
@@ -44,14 +44,14 @@ public class InvoiceResource {
}
@GET
- @Path("/{invoiceId:\\w+}")
+ @Path("/{invoiceId:\\w+-\\w+-\\w+-\\w+-\\w+}")
@Produces(APPLICATION_JSON)
public Response getInvoice(@PathParam("invoiceId") String accountId) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
@POST
- @Path("/{accountId:\\w+}")
+ @Path("/{accountId:\\w+-\\w+-\\w+-\\w+-\\w+}")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
public Response createFutureInvoice(InvoiceJson invoice,
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentResource.java
index f68874d..c2f5391 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentResource.java
@@ -36,14 +36,14 @@ public class PaymentResource {
@GET
- @Path("/{invoiceId:\\w+}")
+ @Path("/{invoiceId:\\w+-\\w+-\\w+-\\w+-\\w+}")
@Produces(APPLICATION_JSON)
public Response getPayments(@PathParam("invoiceId") String invoiceId) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
@GET
- @Path("/account/{accountId:\\w+}")
+ @Path("/account/{accountId:\\w+-\\w+-\\w+-\\w+-\\w+}")
@Produces(APPLICATION_JSON)
public Response getAllPayments(@PathParam("accountId") String accountId) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
@@ -52,7 +52,7 @@ public class PaymentResource {
@POST
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
- @Path("/{invoiceId:\\w+}")
+ @Path("/{invoiceId:\\w+-\\w+-\\w+-\\w+-\\w+}")
public Response createInstantPayment(PaymentJson payment,
@PathParam("invoiceId") String invoiceId,
@QueryParam("last4CC") String last4CC,
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/SubscriptionResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/SubscriptionResource.java
index ee3c200..943ef50 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/SubscriptionResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/SubscriptionResource.java
@@ -39,7 +39,7 @@ import com.ning.billing.jaxrs.json.SubscriptionJson;
public class SubscriptionResource {
@GET
- @Path("/{subscriptionId:\\w+}")
+ @Path("/{subscriptionId:\\w+-\\w+-\\w+-\\w+-\\w+}")
@Produces(APPLICATION_JSON)
public Response getSubscription(@PathParam("subscriptionId") String subscriptionId) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
@@ -56,7 +56,7 @@ public class SubscriptionResource {
@PUT
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
- @Path("/{subscriptionId:\\w+}")
+ @Path("/{subscriptionId:\\w+-\\w+-\\w+-\\w+-\\w+}")
public Response changeSubscriptionPlan(SubscriptionJson subscription,
@PathParam("subscriptionId") String subscriptionId,
@QueryParam("requestedDate") String requestedDate) {
@@ -64,14 +64,14 @@ public class SubscriptionResource {
}
@PUT
- @Path("/{subscriptionId:\\w+}/uncancel")
+ @Path("/{subscriptionId:\\w+-\\w+-\\w+-\\w+-\\w+}/uncancel")
@Produces(APPLICATION_JSON)
public Response uncancelSubscriptionPlan(@PathParam("subscriptionId") String subscriptionId) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
}
@DELETE
- @Path("/{subscriptionId:\\w+}")
+ @Path("/{subscriptionId:\\w+-\\w+-\\w+-\\w+-\\w+}")
@Produces(APPLICATION_JSON)
public Response cancelSubscriptionPlan(@PathParam("subscriptionId") String subscriptionId,
@QueryParam("requestedDate") String requestedDate) {
server/pom.xml 76(+0 -76)
diff --git a/server/pom.xml b/server/pom.xml
index 7653948..6352893 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -238,82 +238,6 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <profiles>
- <profile>
- <!-- Ning specific -->
- <id>pulse-build</id>
- <properties>
- <jettyWebroot>root</jettyWebroot>
- </properties>
- <activation>
- <property>
- <name>env</name>
- <value>pulse-build</value>
- </property>
- </activation>
- <dependencies>
- <dependency><!-- For LogLevelCounterAppender -->
- <groupId>com.ning.jetty</groupId>
- <artifactId>ning-service-skeleton-log4j</artifactId>
- <version>${skeleton.version}</version>
- <classifier>selfcontained</classifier>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>ning.core</groupId>
- <artifactId>galaxy-deploy-scripts</artifactId>
- <version>13.0.4</version>
- <type>tar.gz</type>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>ning.galaxy</groupId>
- <artifactId>galaxy-library</artifactId>
- <version>2.4.1</version>
- <type>tar.gz</type>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>ning.jetty</groupId>
- <artifactId>ning-jetty-distribution</artifactId>
- <version>7.5.1-NING-1.0.1</version>
- <type>tar.gz</type>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>ning.maven</groupId>
- <artifactId>default-assemblies</artifactId>
- <version>2.1.0</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>assemble-irs</id>
- <goals>
- <goal>single</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptorRefs>
- <descriptorRef>default-jetty7-war-assembly</descriptorRef>
- </descriptorRefs>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
<build>
<plugins>
<plugin>