You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2015/11/18 00:47:24 UTC
[09/21] usergrid git commit: Fix spelling error in class names.
Fix spelling error in class names.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/f62e0aa5
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/f62e0aa5
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/f62e0aa5
Branch: refs/heads/master
Commit: f62e0aa5869785b459571cab306579ca21bf0be1
Parents: 1385366
Author: Dave Johnson <sn...@apache.org>
Authored: Tue Nov 17 07:51:29 2015 -0500
Committer: Dave Johnson <sn...@apache.org>
Committed: Tue Nov 17 07:51:29 2015 -0500
----------------------------------------------------------------------
.../usergrid/batch/job/OnlyOnceExceution.java | 123 -----------------
.../usergrid/batch/job/OnlyOnceExecution.java | 122 +++++++++++++++++
.../job/OnlyOnceUnlockOnFailExceution.java | 133 -------------------
.../job/OnlyOnceUnlockOnFailExecution.java | 132 ++++++++++++++++++
4 files changed, 254 insertions(+), 256 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f62e0aa5/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceExceution.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceExceution.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceExceution.java
deleted file mode 100644
index 6109f1f..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceExceution.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.batch.job;
-
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Ignore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import org.apache.usergrid.batch.JobExecution;
-
-
-/**
- * A job that will sleep for the amount of time specified. Used to check that our counter is only ever run once.
- *
- * @author tnine
- */
-@Component("onlyOnceExceution")
-@Ignore("Not a test")
-public class OnlyOnceExceution extends OnlyOnceJob {
-
- private static final Logger logger = LoggerFactory.getLogger( OnlyOnceExceution.class );
-
- private CountDownLatch latch = null;
- private CountDownLatch sleptLatch = new CountDownLatch( 1 );
- private long timeout;
- private boolean slept = false;
- private long delay;
-
-
- /**
- *
- */
- public OnlyOnceExceution() {
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.usergrid.batch.job.OnlyOnceJob#doJob(org.apache.usergrid.batch.JobExecution)
- */
- @Override
- protected void doJob( JobExecution execution ) throws Exception {
- logger.info( "Running only once execution" );
-
- latch.countDown();
-
-
- if ( !slept ) {
- logger.info( "Sleeping in only once execution" );
- Thread.sleep( timeout );
- slept = true;
- sleptLatch.countDown();
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.batch.job.OnlyOnceJob#getDelay(org.apache.usergrid.batch.JobExecution)
- */
- @Override
- protected long getDelay( JobExecution execution ) throws Exception {
- return delay;
- }
-
-
- public void setDelay( long delay ) {
- this.delay = delay;
- }
-
-
- public void setLatch( int calls ) {
- latch = new CountDownLatch( calls );
- }
-
-
- public boolean waitForCount( long timeout, TimeUnit unit ) throws InterruptedException {
- return latch.await( timeout, unit );
- }
-
-
- public boolean waitForSleep( long timeout, TimeUnit unit ) throws InterruptedException {
- return sleptLatch.await( timeout, unit );
- }
-
-
- /** @return the timeout */
- public long getTimeout() {
- return timeout;
- }
-
-
- /** @param timeout the timeout to set */
- public void setTimeout( long timeout ) {
- this.timeout = timeout;
- }
-
-
- @Override
- public void dead( final JobExecution execution ) throws Exception {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f62e0aa5/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceExecution.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceExecution.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceExecution.java
new file mode 100644
index 0000000..ed9e8f4
--- /dev/null
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceExecution.java
@@ -0,0 +1,122 @@
+/*
+ * 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.batch.job;
+
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Ignore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import org.apache.usergrid.batch.JobExecution;
+
+
+/**
+ * A job that will sleep for the amount of time specified. Used to check that our counter is only ever run once.
+ *
+ * @author tnine
+ */
+@Component("onlyOnceExecution")
+public class OnlyOnceExecution extends OnlyOnceJob {
+
+ private static final Logger logger = LoggerFactory.getLogger( OnlyOnceExecution.class );
+
+ private CountDownLatch latch = null;
+ private CountDownLatch sleptLatch = new CountDownLatch( 1 );
+ private long timeout;
+ private boolean slept = false;
+ private long delay;
+
+
+ /**
+ *
+ */
+ public OnlyOnceExecution() {
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.usergrid.batch.job.OnlyOnceJob#doJob(org.apache.usergrid.batch.JobExecution)
+ */
+ @Override
+ protected void doJob( JobExecution execution ) throws Exception {
+ logger.info( "Running only once execution" );
+
+ latch.countDown();
+
+
+ if ( !slept ) {
+ logger.info( "Sleeping in only once execution" );
+ Thread.sleep( timeout );
+ slept = true;
+ sleptLatch.countDown();
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.usergrid.batch.job.OnlyOnceJob#getDelay(org.apache.usergrid.batch.JobExecution)
+ */
+ @Override
+ protected long getDelay( JobExecution execution ) throws Exception {
+ return delay;
+ }
+
+
+ public void setDelay( long delay ) {
+ this.delay = delay;
+ }
+
+
+ public void setLatch( int calls ) {
+ latch = new CountDownLatch( calls );
+ }
+
+
+ public boolean waitForCount( long timeout, TimeUnit unit ) throws InterruptedException {
+ return latch.await( timeout, unit );
+ }
+
+
+ public boolean waitForSleep( long timeout, TimeUnit unit ) throws InterruptedException {
+ return sleptLatch.await( timeout, unit );
+ }
+
+
+ /** @return the timeout */
+ public long getTimeout() {
+ return timeout;
+ }
+
+
+ /** @param timeout the timeout to set */
+ public void setTimeout( long timeout ) {
+ this.timeout = timeout;
+ }
+
+
+ @Override
+ public void dead( final JobExecution execution ) throws Exception {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f62e0aa5/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceUnlockOnFailExceution.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceUnlockOnFailExceution.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceUnlockOnFailExceution.java
deleted file mode 100644
index 6dd826a..0000000
--- a/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceUnlockOnFailExceution.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.batch.job;
-
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.Ignore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import org.apache.usergrid.batch.JobExecution;
-
-
-/**
- * A job that will sleep for the amount of time specified. Used to check that our counter is only ever run once. Checks
- * the lock is released on fail
- *
- * @author tnine
- */
-@Component("onlyOnceUnlockOnFailExceution")
-@Ignore("Not a test")
-public class OnlyOnceUnlockOnFailExceution extends OnlyOnceJob {
-
- private static final Logger logger = LoggerFactory.getLogger( OnlyOnceUnlockOnFailExceution.class );
-
- private CountDownLatch latch = null;
- private CountDownLatch exception = new CountDownLatch( 1 );
- private CountDownLatch completed = new CountDownLatch( 1 );
- private long timeout;
- private boolean slept = false;
- private long delay;
-
-
- /**
- *
- */
- public OnlyOnceUnlockOnFailExceution() {
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.usergrid.batch.job.OnlyOnceJob#doJob(org.apache.usergrid.batch.JobExecution)
- */
- @Override
- protected void doJob( JobExecution execution ) throws Exception {
- logger.info( "Running only once execution" );
-
-
- latch.countDown();
-
- if ( !slept ) {
- logger.info( "Sleeping in only once execution" );
- Thread.sleep( timeout );
- slept = true;
- exception.countDown();
- throw new RuntimeException( "I failed to run correctly, I should be retried" );
- }
-
- completed.countDown();
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.batch.job.OnlyOnceJob#getDelay(org.apache.usergrid.batch.JobExecution)
- */
- @Override
- protected long getDelay( JobExecution execution ) throws Exception {
- return delay;
- }
-
-
- public void setDelay( long delay ) {
- this.delay = delay;
- }
-
-
- public void setLatch( int calls ) {
- latch = new CountDownLatch( calls );
- }
-
-
- public boolean waitForCount( long timeout, TimeUnit unit ) throws InterruptedException {
- return latch.await( timeout, unit );
- }
-
-
- public boolean waitForException( long timeout, TimeUnit unit ) throws InterruptedException {
- return exception.await( timeout, unit );
- }
-
-
- public boolean waitForCompletion( long timeout, TimeUnit unit ) throws InterruptedException {
- return completed.await( timeout, unit );
- }
-
-
- /** @return the timeout */
- public long getTimeout() {
- return timeout;
- }
-
-
- /** @param timeout the timeout to set */
- public void setTimeout( long timeout ) {
- this.timeout = timeout;
- }
-
-
- @Override
- public void dead( final JobExecution execution ) throws Exception {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/usergrid/blob/f62e0aa5/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceUnlockOnFailExecution.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceUnlockOnFailExecution.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceUnlockOnFailExecution.java
new file mode 100644
index 0000000..53fde15
--- /dev/null
+++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/OnlyOnceUnlockOnFailExecution.java
@@ -0,0 +1,132 @@
+/*
+ * 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.batch.job;
+
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Ignore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import org.apache.usergrid.batch.JobExecution;
+
+
+/**
+ * A job that will sleep for the amount of time specified. Used to check that our counter is only ever run once. Checks
+ * the lock is released on fail
+ *
+ * @author tnine
+ */
+@Component("onlyOnceUnlockOnFailExecution")
+public class OnlyOnceUnlockOnFailExecution extends OnlyOnceJob {
+
+ private static final Logger logger = LoggerFactory.getLogger( OnlyOnceUnlockOnFailExecution.class );
+
+ private CountDownLatch latch = null;
+ private CountDownLatch exception = new CountDownLatch( 1 );
+ private CountDownLatch completed = new CountDownLatch( 1 );
+ private long timeout;
+ private boolean slept = false;
+ private long delay;
+
+
+ /**
+ *
+ */
+ public OnlyOnceUnlockOnFailExecution() {
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.usergrid.batch.job.OnlyOnceJob#doJob(org.apache.usergrid.batch.JobExecution)
+ */
+ @Override
+ protected void doJob( JobExecution execution ) throws Exception {
+ logger.info( "Running only once execution" );
+
+
+ latch.countDown();
+
+ if ( !slept ) {
+ logger.info( "Sleeping in only once execution" );
+ Thread.sleep( timeout );
+ slept = true;
+ exception.countDown();
+ throw new RuntimeException( "I failed to run correctly, I should be retried" );
+ }
+
+ completed.countDown();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.usergrid.batch.job.OnlyOnceJob#getDelay(org.apache.usergrid.batch.JobExecution)
+ */
+ @Override
+ protected long getDelay( JobExecution execution ) throws Exception {
+ return delay;
+ }
+
+
+ public void setDelay( long delay ) {
+ this.delay = delay;
+ }
+
+
+ public void setLatch( int calls ) {
+ latch = new CountDownLatch( calls );
+ }
+
+
+ public boolean waitForCount( long timeout, TimeUnit unit ) throws InterruptedException {
+ return latch.await( timeout, unit );
+ }
+
+
+ public boolean waitForException( long timeout, TimeUnit unit ) throws InterruptedException {
+ return exception.await( timeout, unit );
+ }
+
+
+ public boolean waitForCompletion( long timeout, TimeUnit unit ) throws InterruptedException {
+ return completed.await( timeout, unit );
+ }
+
+
+ /** @return the timeout */
+ public long getTimeout() {
+ return timeout;
+ }
+
+
+ /** @param timeout the timeout to set */
+ public void setTimeout( long timeout ) {
+ this.timeout = timeout;
+ }
+
+
+ @Override
+ public void dead( final JobExecution execution ) throws Exception {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}