changed LOG and log to logger for standardizing logging
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/bc33c88d Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/bc33c88d Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/bc33c88d Branch: refs/heads/master Commit: bc33c88ddbed75736f65e36f899b6ad2dfa8fe19 Parents: f9aab91 Author: Jeff West <[email protected]> Authored: Thu Jan 7 16:39:44 2016 -0800 Committer: Jeff West <[email protected]> Committed: Thu Jan 7 16:39:44 2016 -0800 ---------------------------------------------------------------------- .../batch/service/JobSchedulerService.java | 55 +++++---- .../batch/service/SchedulerServiceImpl.java | 30 ++--- .../usergrid/count/Slf4JBatchSubmitter.java | 6 +- .../org/apache/usergrid/utils/MapUtils.java | 2 +- .../org/apache/usergrid/utils/UUIDUtils.java | 5 +- .../org/apache/usergrid/AbstractCoreIT.java | 6 +- .../org/apache/usergrid/CoreApplication.java | 11 +- .../org/apache/usergrid/CoreITSetupImpl.java | 12 +- .../usergrid/batch/job/TestJobListenerTest.java | 6 +- .../count/BatchCountParallelismTest.java | 11 +- .../locking/cassandra/HectorLockManagerIT.java | 10 +- .../SingleNodeLockTestSingleNode.java | 10 +- .../java/org/apache/usergrid/mq/MessagesIT.java | 62 +++++----- .../org/apache/usergrid/mq/QueuePathsTest.java | 18 +-- .../usergrid/persistence/CollectionIT.java | 118 +++++++++---------- .../usergrid/persistence/CoreSchemaManager.java | 11 +- .../apache/usergrid/persistence/CounterIT.java | 32 ++--- .../persistence/EntityConnectionsIT.java | 46 ++++---- .../persistence/EntityDictionaryIT.java | 24 ++-- .../usergrid/persistence/EntityManagerIT.java | 76 ++++++------ .../org/apache/usergrid/persistence/GeoIT.java | 21 ++-- .../persistence/GeoQueryBooleanTest.java | 7 +- .../apache/usergrid/persistence/IndexIT.java | 43 +++---- .../apache/usergrid/persistence/SchemaTest.java | 18 +-- .../query/IntersectionTransitivePagingIT.java | 4 +- .../query/IntersectionUnionPagingIT.java | 12 +- .../persistence/query/IteratingQueryIT.java | 104 ++++++++-------- .../persistence/query/NotSubPropertyIT.java | 8 +- .../apache/usergrid/utils/IndexUtilsTest.java | 6 +- .../apache/usergrid/utils/JsonUtilsTest.java | 4 +- .../apache/usergrid/utils/ListUtilsTest.java | 6 +- .../org/apache/usergrid/utils/MapUtilsTest.java | 6 +- .../apache/usergrid/utils/TestInflector.java | 6 +- .../EntityCollectionManagerStressTest.java | 9 +- .../changelog/ChangeLogGeneratorImplTest.java | 8 +- .../stage/write/WriteOptimisticVerifyTest.java | 4 +- .../migration/data/AbstractMigrationPlugin.java | 6 +- .../persistence/core/astyanax/TestUtils.java | 6 +- .../persistence/core/rx/OrderedMergeTest.java | 38 +++--- .../graph/impl/stage/EdgeDeleteRepairImpl.java | 12 +- .../shard/impl/NodeShardAllocationImpl.java | 14 +-- .../shard/impl/ShardGroupCompactionImpl.java | 30 +++-- .../persistence/graph/GraphManagerLoadTest.java | 11 +- .../graph/GraphManagerShardConsistencyIT.java | 35 +++--- .../graph/GraphManagerStressTest.java | 10 +- .../graph/impl/NodeDeleteListenerTest.java | 6 +- .../serialization/EdgeSerializationTest.java | 5 +- .../graph/serialization/TestCount.java | 4 +- .../persistence/index/impl/EntityIndexTest.java | 12 +- .../usergrid/launcher/EmbeddedServerHelper.java | 10 +- .../apache/usergrid/rest/PartialUpdateTest.java | 8 +- .../org/apache/usergrid/rest/TomcatRuntime.java | 12 +- .../applications/assets/AssetResourceIT.java | 10 +- .../applications/assets/AwsAssetResourceIT.java | 12 +- .../collection/users/UserResourceIT.java | 13 +- .../users/extensions/TestResource.java | 5 +- .../applications/queries/AndOrQueryTest.java | 6 +- .../rest/applications/queries/OrderByTest.java | 8 +- .../applications/queries/QueryTestBase.java | 4 +- .../services/notifications/JobScheduler.java | 9 +- .../notifications/NotificationsService.java | 12 +- .../services/notifications/QueueListener.java | 49 ++++---- .../services/notifications/TaskManager.java | 43 +++---- .../impl/ApplicationQueueManagerImpl.java | 82 +++++++------ .../services/notifications/wns/WNSAdapter.java | 7 +- .../usergrid/services/queues/QueueListener.java | 35 +++--- .../org/apache/usergrid/NewOrgAppAdminRule.java | 4 +- .../org/apache/usergrid/ServiceApplication.java | 14 +-- .../apache/usergrid/management/EmailFlowIT.java | 22 ++-- .../org/apache/usergrid/management/RoleIT.java | 8 +- .../cassandra/ManagementServiceIT.java | 12 +- .../security/tokens/TokenServiceIT.java | 10 +- .../usergrid/services/ServiceInvocationIT.java | 4 +- .../java/org/apache/usergrid/TomcatMain.java | 10 +- .../usergrid/cassandra/AvailablePortFinder.java | 18 +-- .../usergrid/cassandra/CassandraResource.java | 6 +- .../usergrid/cassandra/ClearShiroSubject.java | 8 +- .../usergrid/cassandra/SpringResource.java | 10 +- .../usergrid/cassandra/SpringResourceTest.java | 10 +- .../apache/usergrid/tools/WarehouseExport.java | 18 +-- .../apache/usergrid/tools/WarehouseUpsert.java | 30 ++--- .../websocket/WebSocketChannelHandler.java | 16 +-- 82 files changed, 740 insertions(+), 791 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/main/java/org/apache/usergrid/batch/service/JobSchedulerService.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/batch/service/JobSchedulerService.java b/stack/core/src/main/java/org/apache/usergrid/batch/service/JobSchedulerService.java index ce6422c..50bd9bc 100644 --- a/stack/core/src/main/java/org/apache/usergrid/batch/service/JobSchedulerService.java +++ b/stack/core/src/main/java/org/apache/usergrid/batch/service/JobSchedulerService.java @@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import com.google.inject.Injector; -import org.apache.usergrid.corepersistence.CpSetup; import org.apache.usergrid.persistence.core.metrics.MetricsFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +55,7 @@ import com.google.common.util.concurrent.MoreExecutors; public class JobSchedulerService extends AbstractScheduledService { protected static final long DEFAULT_DELAY = 1000; - private static final Logger LOG = LoggerFactory.getLogger( JobSchedulerService.class ); + private static final Logger logger = LoggerFactory.getLogger( JobSchedulerService.class ); private long interval = DEFAULT_DELAY; private int workerSize = 1; @@ -94,7 +93,7 @@ public class JobSchedulerService extends AbstractScheduledService { failCounter = metricsFactory.getCounter( JobSchedulerService.class, "scheduler.failed_jobs" ); try { - LOG.info( "Running one check iteration ..." ); + logger.info( "Running one check iteration ..." ); List<JobDescriptor> activeJobs; // run until there are no more active jobs @@ -102,8 +101,8 @@ public class JobSchedulerService extends AbstractScheduledService { // get the semaphore if we can. This means we have space for at least 1 // job - if ( LOG.isDebugEnabled() ) { - LOG.debug( "About to acquire semaphore. Capacity is {}", capacitySemaphore.availablePermits() ); + if ( logger.isDebugEnabled() ) { + logger.debug( "About to acquire semaphore. Capacity is {}", capacitySemaphore.availablePermits() ); } capacitySemaphore.acquire(); @@ -113,30 +112,30 @@ public class JobSchedulerService extends AbstractScheduledService { int capacity = capacitySemaphore.availablePermits(); - if (LOG.isDebugEnabled()) { - LOG.debug("Capacity is {}", capacity); + if (logger.isDebugEnabled()) { + logger.debug("Capacity is {}", capacity); } activeJobs = jobAccessor.getJobs( capacity ); // nothing to do, we don't have any jobs to run if ( activeJobs.size() == 0 ) { - if (LOG.isDebugEnabled()) { - LOG.debug("No jobs returned. Exiting run loop"); + if (logger.isDebugEnabled()) { + logger.debug("No jobs returned. Exiting run loop"); } return; } for ( JobDescriptor jd : activeJobs ) { - LOG.info( "Submitting work for {}", jd ); + logger.info( "Submitting work for {}", jd ); submitWork( jd ); - LOG.info( "Work submitted for {}", jd ); + logger.info( "Work submitted for {}", jd ); } } } catch ( Throwable t ) { - if (LOG.isDebugEnabled()) { - LOG.debug("Scheduler run failed, error is", t); + if (logger.isDebugEnabled()) { + logger.debug("Scheduler run failed, error is", t); } } } @@ -163,7 +162,7 @@ public class JobSchedulerService extends AbstractScheduledService { job = jobFactory.jobsFrom( jobDescriptor ); } catch ( JobNotFoundException e ) { - LOG.error( "Could not create jobs", e ); + logger.error( "Could not create jobs", e ); return; } @@ -185,7 +184,7 @@ public class JobSchedulerService extends AbstractScheduledService { capacitySemaphore.acquire(); } catch ( InterruptedException e ) { - LOG.error( "Unable to acquire semaphore capacity before submitting job", e ); + logger.error( "Unable to acquire semaphore capacity before submitting job", e ); //just return, they'll get picked up again later return; } @@ -198,8 +197,8 @@ public class JobSchedulerService extends AbstractScheduledService { @Override public Void call() throws Exception { - if (LOG.isDebugEnabled()) { - LOG.debug("Starting the job with job id {}", execution.getJobId()); + if (logger.isDebugEnabled()) { + logger.debug("Starting the job with job id {}", execution.getJobId()); } runCounter.inc(); @@ -216,7 +215,7 @@ public class JobSchedulerService extends AbstractScheduledService { catch ( Exception t ) { //we purposefully swallow all exceptions here, we don't want it to effect the outcome //of finally popping this job from the queue - LOG.error( "Unable to invoke dead event on job", t ); + logger.error( "Unable to invoke dead event on job", t ); } return null; @@ -227,7 +226,7 @@ public class JobSchedulerService extends AbstractScheduledService { // TODO wrap and throw specifically typed exception for onFailure, // needs jobId - LOG.info( "Starting job {} with execution data {}", job, execution ); + logger.info( "Starting job {} with execution data {}", job, execution ); job.execute( execution ); @@ -247,8 +246,8 @@ public class JobSchedulerService extends AbstractScheduledService { * Release semaphore first in case there are other problems with communicating with Cassandra */ - if (LOG.isDebugEnabled()) { - LOG.debug("Job succeeded with the job id {}", execution.getJobId()); + if (logger.isDebugEnabled()) { + logger.debug("Job succeeded with the job id {}", execution.getJobId()); } capacitySemaphore.release(); timer.stop(); @@ -258,7 +257,7 @@ public class JobSchedulerService extends AbstractScheduledService { //TODO, refactor into the execution itself for checking if done if ( execution.getStatus() == Status.IN_PROGRESS ) { - LOG.info( "Successful completion of bulkJob {}", execution ); + logger.info( "Successful completion of bulkJob {}", execution ); execution.completed(); } @@ -277,14 +276,14 @@ public class JobSchedulerService extends AbstractScheduledService { /** * Release semaphore first in case there are other problems with communicating with Cassandra */ - LOG.error( "Job failed with the job id {}", execution.getJobId() ); + logger.error( "Job failed with the job id {}", execution.getJobId() ); capacitySemaphore.release(); timer.stop(); runCounter.dec(); failCounter.inc(); - LOG.error( "Failed execution for bulkJob", throwable ); + logger.error( "Failed execution for bulkJob", throwable ); // mark it as failed if ( execution.getStatus() == Status.IN_PROGRESS ) { execution.failed(); @@ -374,11 +373,11 @@ public class JobSchedulerService extends AbstractScheduledService { .listeningDecorator( Executors.newScheduledThreadPool( workerSize, JobThreadFactory.INSTANCE ) ); capacitySemaphore = new Semaphore( workerSize ); - LOG.info( "Starting executor pool. Capacity is {}", workerSize ); + logger.info( "Starting executor pool. Capacity is {}", workerSize ); super.startUp(); - LOG.info( "Job Scheduler started" ); + logger.info( "Job Scheduler started" ); } @@ -389,11 +388,11 @@ public class JobSchedulerService extends AbstractScheduledService { */ @Override protected void shutDown() throws Exception { - LOG.info( "Shutting down job scheduler" ); + logger.info( "Shutting down job scheduler" ); service.shutdown(); - LOG.info( "Job scheduler shut down" ); + logger.info( "Job scheduler shut down" ); super.shutDown(); } http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/main/java/org/apache/usergrid/batch/service/SchedulerServiceImpl.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/batch/service/SchedulerServiceImpl.java b/stack/core/src/main/java/org/apache/usergrid/batch/service/SchedulerServiceImpl.java index d69cbb1..b0a5f08 100644 --- a/stack/core/src/main/java/org/apache/usergrid/batch/service/SchedulerServiceImpl.java +++ b/stack/core/src/main/java/org/apache/usergrid/batch/service/SchedulerServiceImpl.java @@ -62,7 +62,7 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR private static final String JOB_NAME = "jobName"; - private static final Logger LOG = LoggerFactory.getLogger( SchedulerServiceImpl.class ); + private static final Logger logger = LoggerFactory.getLogger( SchedulerServiceImpl.class ); private static final String DEFAULT_QUEUE_NAME = "/jobs"; @@ -144,8 +144,8 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR * as discarded */ try { - if (LOG.isDebugEnabled()) { - LOG.debug("deleteJob {}", jobId); + if (logger.isDebugEnabled()) { + logger.debug("deleteJob {}", jobId); } getEm().delete( new SimpleEntityRef( Schema.getDefaultSchema().getEntityType(JobData.class), jobId ) ); @@ -189,7 +189,7 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR * still fire. Ignore this job */ if ( data == null || stats == null ) { - LOG.info( "Received job with data id '{}' from the queue, but no data was found. Dropping job", + logger.info( "Received job with data id '{}' from the queue, but no data was found. Dropping job", jobUuid ); getQm().deleteTransaction( jobQueueName, job.getTransaction(), null ); @@ -210,7 +210,7 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR // log and skip. This is a catastrophic runtime error if we see an // exception here. We don't want to cause job loss, so leave the job in // the Q. - LOG.error( + logger.error( "Unable to retrieve job data for jobname {}, job id {}, stats id {}. Skipping to avoid job " + "loss", new Object[] { jobName, jobUuid, statsUuid, e } ); } @@ -222,8 +222,8 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR @Override public void heartbeat( JobRuntime execution, long delay ) { - if (LOG.isDebugEnabled()) { - LOG.debug("renew transaction {}", execution.getTransactionId()); + if (logger.isDebugEnabled()) { + logger.debug("renew transaction {}", execution.getTransactionId()); } try { // @TODO - what's the point to this sychronized block on an argument? @@ -232,13 +232,13 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR new QueueQuery().withTimeout( delay ) ); execution.setTransactionId( newId ); - if (LOG.isDebugEnabled()) { - LOG.debug("renewed transaction {}", newId); + if (logger.isDebugEnabled()) { + logger.debug("renewed transaction {}", newId); } } } catch ( TransactionNotFoundException e ) { - LOG.error( "Could not renew transaction", e ); + logger.error( "Could not renew transaction", e ); throw new JobRuntimeException( "Could not renew transaction during heartbeat", e ); } } @@ -284,10 +284,10 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR // we're done. Mark the transaction as complete and delete the job info if ( jobStatus == Status.COMPLETED ) { - LOG.info( "Job {} is complete id: {}", data.getJobName(), bulkJobExecution.getTransactionId() ); + logger.info( "Job {} is complete id: {}", data.getJobName(), bulkJobExecution.getTransactionId() ); getQm().deleteTransaction( jobQueueName, bulkJobExecution.getTransactionId(), null ); - if (LOG.isDebugEnabled()) { - LOG.debug("delete job data {}", data.getUuid()); + if (logger.isDebugEnabled()) { + logger.debug("delete job data {}", data.getUuid()); } getEm().delete( data ); } @@ -295,7 +295,7 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR // the job failed too many times. Delete the transaction to prevent it // running again and save it for querying later else if ( jobStatus == Status.DEAD ) { - LOG.warn( "Job {} is dead. Removing", data.getJobName() ); + logger.warn( "Job {} is dead. Removing", data.getJobName() ); getQm().deleteTransaction( jobQueueName, bulkJobExecution.getTransactionId(), null ); getEm().update( data ); } @@ -305,7 +305,7 @@ public class SchedulerServiceImpl implements SchedulerService, JobAccessor, JobR getEm().update( data ); } - LOG.info( "Updating stats for job {}", data.getJobName() ); + logger.info( "Updating stats for job {}", data.getJobName() ); getEm().update( stat ); } http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/main/java/org/apache/usergrid/count/Slf4JBatchSubmitter.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/count/Slf4JBatchSubmitter.java b/stack/core/src/main/java/org/apache/usergrid/count/Slf4JBatchSubmitter.java index 68f3b32..2058454 100644 --- a/stack/core/src/main/java/org/apache/usergrid/count/Slf4JBatchSubmitter.java +++ b/stack/core/src/main/java/org/apache/usergrid/count/Slf4JBatchSubmitter.java @@ -42,7 +42,7 @@ public class Slf4JBatchSubmitter implements BatchSubmitter { // TODO custom logger for printing counts // - should be configed programatically - private static final Logger log = LoggerFactory.getLogger( Slf4JBatchSubmitter.class ); + private static final Logger logger = LoggerFactory.getLogger( Slf4JBatchSubmitter.class ); private int threadCount = 3; @@ -62,7 +62,7 @@ public class Slf4JBatchSubmitter implements BatchSubmitter { // TODO perhaps this could be pushed down further into CountProducer Impl? // - this would leave generic submitter class for ( Count c : counts ) { - log.info( "found count {}", c ); + logger.info( "found count {}", c ); } timer.stop(); return true; @@ -72,7 +72,7 @@ public class Slf4JBatchSubmitter implements BatchSubmitter { public void shutdown() { - log.warn( "Shutdown Slf4jBatchSubmitter" ); + logger.warn( "Shutdown Slf4jBatchSubmitter" ); executor.shutdown(); } } http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/main/java/org/apache/usergrid/utils/MapUtils.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/utils/MapUtils.java b/stack/core/src/main/java/org/apache/usergrid/utils/MapUtils.java index 12da2e0..2d0f0e3 100644 --- a/stack/core/src/main/java/org/apache/usergrid/utils/MapUtils.java +++ b/stack/core/src/main/java/org/apache/usergrid/utils/MapUtils.java @@ -136,7 +136,7 @@ public class MapUtils extends org.apache.commons.collections.MapUtils { v = ( V ) map.get( k ); } catch ( ClassCastException e ) { - //LOG.war( "Map value {} was not the expected class", map.get( k ), e ); + //logger.war( "Map value {} was not the expected class", map.get( k ), e ); } return v; http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/main/java/org/apache/usergrid/utils/UUIDUtils.java ---------------------------------------------------------------------- diff --git a/stack/core/src/main/java/org/apache/usergrid/utils/UUIDUtils.java b/stack/core/src/main/java/org/apache/usergrid/utils/UUIDUtils.java index adde4b6..a43049d 100644 --- a/stack/core/src/main/java/org/apache/usergrid/utils/UUIDUtils.java +++ b/stack/core/src/main/java/org/apache/usergrid/utils/UUIDUtils.java @@ -21,7 +21,6 @@ import java.util.Collections; import java.util.List; import java.util.Random; import java.util.UUID; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.ReentrantLock; @@ -47,7 +46,7 @@ import static org.apache.usergrid.utils.ConversionUtils.uuid; public class UUIDUtils { - private static final Logger LOG = LoggerFactory.getLogger( UUIDUtils.class ); + private static final Logger logger = LoggerFactory.getLogger( UUIDUtils.class ); private static final int[] MICROS = new int[1000]; @@ -324,7 +323,7 @@ public class UUIDUtils { uuid = UUID.fromString( s ); } catch ( Exception e ) { - LOG.info( "Could not convert String {} into a UUID", s, e ); + logger.info( "Could not convert String {} into a UUID", s, e ); } return uuid; } http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java index 53ad348..3c7a368 100644 --- a/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java +++ b/stack/core/src/test/java/org/apache/usergrid/AbstractCoreIT.java @@ -27,7 +27,7 @@ import org.apache.usergrid.utils.JsonUtils; public abstract class AbstractCoreIT { - private static final Logger LOG = LoggerFactory.getLogger( AbstractCoreIT.class ); + private static final Logger logger = LoggerFactory.getLogger( AbstractCoreIT.class ); @ClassRule public static CoreITSetup setup = new CoreITSetupImpl( ); @@ -38,8 +38,8 @@ public abstract class AbstractCoreIT { public void dump( String name, Object obj ) { - if ( obj != null && LOG.isInfoEnabled() ) { - LOG.info( name + ":\n" + JsonUtils.mapToFormattedJsonString( obj ) ); + if ( obj != null && logger.isInfoEnabled() ) { + logger.info( name + ":\n" + JsonUtils.mapToFormattedJsonString( obj ) ); } } } http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java b/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java index fa48939..9046f02 100644 --- a/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java +++ b/stack/core/src/test/java/org/apache/usergrid/CoreApplication.java @@ -18,17 +18,12 @@ package org.apache.usergrid; import java.util.*; -import java.util.concurrent.ExecutionException; import com.google.inject.Injector; import org.apache.usergrid.corepersistence.index.IndexLocationStrategyFactory; import org.apache.usergrid.corepersistence.service.ApplicationService; import org.apache.usergrid.corepersistence.util.CpNamingUtils; import org.apache.usergrid.persistence.index.*; -import org.apache.usergrid.persistence.index.utils.MapUtils; -import org.apache.usergrid.persistence.model.entity.Id; -import org.apache.usergrid.persistence.model.entity.SimpleId; -import org.apache.usergrid.utils.InflectionUtils; import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; @@ -49,7 +44,7 @@ import static junit.framework.Assert.assertNotNull; public class CoreApplication implements Application, TestRule { - private static final Logger LOG = LoggerFactory.getLogger( CoreApplication.class ); + private static final Logger logger = LoggerFactory.getLogger( CoreApplication.class ); protected UUID id; protected String appName; protected String orgName; @@ -153,7 +148,7 @@ public class CoreApplication implements Application, TestRule { protected void after( Description description ) { - LOG.info("Test {}: finish with application", description.getDisplayName()); + logger.info("Test {}: finish with application", description.getDisplayName()); // try { // setup.getEmf().getEntityManager(id).().get(); @@ -184,7 +179,7 @@ public class CoreApplication implements Application, TestRule { ); assertNotNull(em); - LOG.info( "Created new application {} in organization {}", appName, orgName ); + logger.info( "Created new application {} in organization {}", appName, orgName ); // //wait for the index before proceeding // em.refreshIndex(); http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java index d2129a4..6f9b384 100644 --- a/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java +++ b/stack/core/src/test/java/org/apache/usergrid/CoreITSetupImpl.java @@ -23,11 +23,9 @@ import org.apache.usergrid.corepersistence.service.ApplicationService; import org.apache.usergrid.mq.QueueManagerFactory; import org.apache.usergrid.persistence.Entity; import org.apache.usergrid.persistence.EntityManagerFactory; -import org.apache.usergrid.persistence.IndexBucketLocator; import org.apache.usergrid.persistence.cassandra.CassandraService; import org.apache.usergrid.setup.ConcurrentProcessSingleton; import org.apache.usergrid.utils.JsonUtils; -import org.apache.usergrid.utils.UUIDUtils; import org.junit.runner.Description; import org.junit.runners.model.Statement; import org.slf4j.Logger; @@ -37,7 +35,7 @@ import java.util.UUID; public class CoreITSetupImpl implements CoreITSetup, TestEntityIndex { - private static final Logger LOG = LoggerFactory.getLogger( CoreITSetupImpl.class ); + private static final Logger logger = LoggerFactory.getLogger( CoreITSetupImpl.class ); private final Injector injector; protected EntityManagerFactory emf; @@ -88,7 +86,7 @@ public class CoreITSetupImpl implements CoreITSetup, TestEntityIndex { * @throws Throwable if setup fails (which will disable {@code after} */ protected void before( Description description ) throws Throwable { - LOG.info( "Setting up for {}", description.getDisplayName() ); + logger.info( "Setting up for {}", description.getDisplayName() ); @@ -99,7 +97,7 @@ public class CoreITSetupImpl implements CoreITSetup, TestEntityIndex { /** Override to tear down your specific external resource. */ protected void after( Description description ) { - LOG.info( "Tearing down for {}", description.getDisplayName() ); + logger.info( "Tearing down for {}", description.getDisplayName() ); } @@ -136,8 +134,8 @@ public class CoreITSetupImpl implements CoreITSetup, TestEntityIndex { @Override public void dump( String name, Object obj ) { - if ( obj != null && LOG.isInfoEnabled() ) { - LOG.info( name + ":\n" + JsonUtils.mapToFormattedJsonString( obj ) ); + if ( obj != null && logger.isInfoEnabled() ) { + logger.info( name + ":\n" + JsonUtils.mapToFormattedJsonString( obj ) ); } } http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/batch/job/TestJobListenerTest.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/batch/job/TestJobListenerTest.java b/stack/core/src/test/java/org/apache/usergrid/batch/job/TestJobListenerTest.java index 96364da..8c01062 100644 --- a/stack/core/src/test/java/org/apache/usergrid/batch/job/TestJobListenerTest.java +++ b/stack/core/src/test/java/org/apache/usergrid/batch/job/TestJobListenerTest.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertTrue; * Tests the TestJobListener. */ public class TestJobListenerTest { - private static final Logger LOG = LoggerFactory.getLogger( TestJobListenerTest.class ); + private static final Logger logger = LoggerFactory.getLogger( TestJobListenerTest.class ); JobExecution jobExecution = new JobExecution() { @Override public JobData getJobData() { @@ -113,7 +113,7 @@ public class TestJobListenerTest { listener.setExpected( 100 ); listener.blockTilDone( waitTime ); long elapsedTime = System.currentTimeMillis() - startTime; - LOG.info( "IdleOut in {} millis", elapsedTime ); + logger.info( "IdleOut in {} millis", elapsedTime ); // assertTrue( elapsedTime >= ( 1000L + TestJobListener.WAIT_MAX_MILLIS ) ); assertTrue("Elapsed time: " + elapsedTime + " fails to be greater than idle wait time: " + waitTime, elapsedTime>= waitTime ); } @@ -132,7 +132,7 @@ public class TestJobListenerTest { Thread.sleep( 100 ); } catch ( InterruptedException e ) { - LOG.warn( "Thread got interrupted", e ); + logger.warn( "Thread got interrupted", e ); } for ( int ii = 0; ii < 1000; ii++ ) { listener.onSuccess( jobExecution ); http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/count/BatchCountParallelismTest.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/count/BatchCountParallelismTest.java b/stack/core/src/test/java/org/apache/usergrid/count/BatchCountParallelismTest.java index 78c58a4..1db916c 100644 --- a/stack/core/src/test/java/org/apache/usergrid/count/BatchCountParallelismTest.java +++ b/stack/core/src/test/java/org/apache/usergrid/count/BatchCountParallelismTest.java @@ -30,7 +30,6 @@ import java.util.concurrent.atomic.AtomicLong; import org.apache.usergrid.ExperimentalTest; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; import org.slf4j.Logger; @@ -45,7 +44,7 @@ import static org.junit.Assert.assertEquals; @net.jcip.annotations.NotThreadSafe public class BatchCountParallelismTest { - private static final Logger LOG = LoggerFactory.getLogger( BatchCountParallelismTest.class ); + private static final Logger logger = LoggerFactory.getLogger( BatchCountParallelismTest.class ); private ExecutorService exec = Executors.newFixedThreadPool( 24 ); private SimpleBatcher batcher; private StubSubmitter submitter = new StubSubmitter(); @@ -89,21 +88,21 @@ public class BatchCountParallelismTest { Count count = new Count( "Counter", "k1", "counter1", 1 ); batcher.add( count ); } - LOG.info( "Task iteration # {} : ", c ); + logger.info( "Task iteration # {} : ", c ); cdl.countDown(); return true; } } ) ); } batcher.add( new Count( "Counter", "k1", "counter1", 1 ) ); - LOG.info( "size: " + calls.size() ); + logger.info( "size: " + calls.size() ); cdl.await(); // exec.awaitTermination(2,TimeUnit.SECONDS); exec.shutdown(); while (! exec.awaitTermination( 3, TimeUnit.SECONDS ) ) { - LOG.warn("jobs not yet finished, wait again"); + logger.warn("jobs not yet finished, wait again"); } // we should have 100 total invocations of AbstractBatcher#add @@ -138,7 +137,7 @@ public class BatchCountParallelismTest { @Override public Future<?> submit( Collection<Count> counts ) { - LOG.info( "submitted: " + counts.size() ); + logger.info( "submitted: " + counts.size() ); counted.addAndGet( counts.size() ); submit.incrementAndGet(); return null; http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java b/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java index 8351cb2..34b2154 100644 --- a/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java +++ b/stack/core/src/test/java/org/apache/usergrid/locking/cassandra/HectorLockManagerIT.java @@ -46,7 +46,7 @@ import static org.junit.Assert.assertTrue; public class HectorLockManagerIT extends AbstractCoreIT { - private static final Logger LOG = LoggerFactory.getLogger( HectorLockManagerIT.class ); + private static final Logger logger = LoggerFactory.getLogger( HectorLockManagerIT.class ); private static LockManager manager; private static ExecutorService pool; @@ -89,7 +89,7 @@ public class HectorLockManagerIT extends AbstractCoreIT { final UUID application = UUID.randomUUID(); final UUID entity = UUID.randomUUID(); - LOG.info( "Locking:" + application.toString() + "/" + entity.toString() ); + logger.info( "Locking:" + application.toString() + "/" + entity.toString() ); // Lock a node twice to test re-entrancy and validate. Lock lock = manager.createLock( application, entity.toString() ); @@ -107,7 +107,7 @@ public class HectorLockManagerIT extends AbstractCoreIT { assertFalse( wasLocked ); // Unlock completely - LOG.info( "Releasing lock:" + application.toString() + "/" + entity.toString() ); + logger.info( "Releasing lock:" + application.toString() + "/" + entity.toString() ); lock.unlock(); // Try to effectively get the lock from the thread since the current one has @@ -124,7 +124,7 @@ public class HectorLockManagerIT extends AbstractCoreIT { final UUID entity = UUID.randomUUID(); final UUID entity2 = UUID.randomUUID(); - LOG.info( "Locking:" + application.toString() + "/" + entity.toString() ); + logger.info( "Locking:" + application.toString() + "/" + entity.toString() ); // Acquire to locks. One of them twice. Lock lock = manager.createLock( application, entity.toString() ); @@ -135,7 +135,7 @@ public class HectorLockManagerIT extends AbstractCoreIT { second.lock(); // Cleanup the locks for main thread - LOG.info( "Cleaning up locks for current thread..." ); + logger.info( "Cleaning up locks for current thread..." ); lock.unlock(); lock.unlock(); http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java b/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java index b6d58d7..db1defd 100644 --- a/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java +++ b/stack/core/src/test/java/org/apache/usergrid/locking/singlenode/SingleNodeLockTestSingleNode.java @@ -41,7 +41,7 @@ import static org.junit.Assert.assertTrue; public class SingleNodeLockTestSingleNode { - private static final Logger LOG = LoggerFactory.getLogger( SingleNodeLockTestSingleNode.class ); + private static final Logger logger = LoggerFactory.getLogger( SingleNodeLockTestSingleNode.class ); private LockManager manager; @@ -72,7 +72,7 @@ public class SingleNodeLockTestSingleNode { final UUID application = UUID.randomUUID(); final UUID entity = UUID.randomUUID(); - LOG.info( "Locking:" + application.toString() + "/" + entity.toString() ); + logger.info( "Locking:" + application.toString() + "/" + entity.toString() ); // Lock a node twice to test reentrancy and validate. Lock lock = manager.createLock( application, entity.toString() ); @@ -91,7 +91,7 @@ public class SingleNodeLockTestSingleNode { Assert.assertEquals( false, wasLocked ); // Unlock completely - LOG.info( "Releasing lock:" + application.toString() + "/" + entity.toString() ); + logger.info( "Releasing lock:" + application.toString() + "/" + entity.toString() ); lock.unlock(); // Try to effectively get the lock from the thread since the current one has @@ -109,7 +109,7 @@ public class SingleNodeLockTestSingleNode { final UUID entity = UUID.randomUUID(); final UUID entity2 = UUID.randomUUID(); - LOG.info( "Locking:" + application.toString() + "/" + entity.toString() ); + logger.info( "Locking:" + application.toString() + "/" + entity.toString() ); // Acquire to locks. One of them twice. Lock lock = manager.createLock( application, entity.toString() ); @@ -120,7 +120,7 @@ public class SingleNodeLockTestSingleNode { second.lock(); // Cleanup the locks for main thread - LOG.info( "Cleaning up locks for current thread..." ); + logger.info( "Cleaning up locks for current thread..." ); lock.unlock(); lock.unlock(); http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java b/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java index 52ca4d8..2edb012 100644 --- a/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java +++ b/stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java @@ -38,7 +38,7 @@ import static org.junit.Assert.assertTrue; public class MessagesIT extends AbstractCoreIT { - private static final Logger LOG = LoggerFactory.getLogger( MessagesIT.class ); + private static final Logger logger = LoggerFactory.getLogger( MessagesIT.class ); @Rule public ImmediateCounterRule counterRule = new ImmediateCounterRule( ); @@ -51,32 +51,32 @@ public class MessagesIT extends AbstractCoreIT { @Ignore("Pending https://issues.apache.org/jira/browse/USERGRID-1116. ") @Test public void testMessages() throws Exception { - LOG.info( "MessagesIT.testMessages" ); + logger.info( "MessagesIT.testMessages" ); Message message = new Message(); message.setStringProperty( "foo", "bar" ); - LOG.info( JsonUtils.mapToFormattedJsonString( message ) ); + logger.info( JsonUtils.mapToFormattedJsonString( message ) ); - LOG.info( "Posting message #1 to queue /foo/bar" ); + logger.info( "Posting message #1 to queue /foo/bar" ); QueueManager qm = app.getQm(); qm.postToQueue( "/foo/bar", message ); - LOG.info( "Getting message #1" ); + logger.info( "Getting message #1" ); message = qm.getMessage( message.getUuid() ); - LOG.info( JsonUtils.mapToFormattedJsonString( message ) ); + logger.info( JsonUtils.mapToFormattedJsonString( message ) ); - LOG.info( "Getting message from /foo/bar, should be message #1" ); + logger.info( "Getting message from /foo/bar, should be message #1" ); QueueResults messages = qm.getFromQueue( "/foo/bar", null ); - LOG.info( JsonUtils.mapToFormattedJsonString( messages ) ); + logger.info( JsonUtils.mapToFormattedJsonString( messages ) ); assertEquals( 1, messages.size() ); - LOG.info( "Getting message from /foo/bar, should empty" ); + logger.info( "Getting message from /foo/bar, should empty" ); messages = qm.getFromQueue( "/foo/bar", null ); - LOG.info( JsonUtils.mapToFormattedJsonString( messages ) ); + logger.info( JsonUtils.mapToFormattedJsonString( messages ) ); assertEquals( 0, messages.size() ); message = new Message(); @@ -88,21 +88,21 @@ public class MessagesIT extends AbstractCoreIT { qm.postToQueue( "/foo/bar", message ); /* messages = qm.getFromQueue("/foo/bar", null); - LOG.info(JsonUtils.mapToFormattedJsonString(messages)); + logger.info(JsonUtils.mapToFormattedJsonString(messages)); assertEquals(1, messages.size()); messages = qm.getFromQueue("/foo/bar", null); - LOG.info(JsonUtils.mapToFormattedJsonString(messages)); + logger.info(JsonUtils.mapToFormattedJsonString(messages)); assertEquals(1, messages.size()); messages = qm.getFromQueue("/foo/bar", null); - LOG.info(JsonUtils.mapToFormattedJsonString(messages)); + logger.info(JsonUtils.mapToFormattedJsonString(messages)); assertEquals(0, messages.size()); messages = qm.getFromQueue("/foo/bar", new QueueQuery().withPosition(QueuePosition.END) .withPreviousCount(3)); - LOG.info(JsonUtils.mapToFormattedJsonString(messages)); + logger.info(JsonUtils.mapToFormattedJsonString(messages)); assertEquals(3, messages.size()); */ @@ -110,8 +110,8 @@ public class MessagesIT extends AbstractCoreIT { //TODO Re-evaluate queues and make a cleaner interface // Map<String, Long> counters = qm.getQueueCounters( "/" ); -// LOG.info( "dumping counters...." + counters ); -// LOG.info( JsonUtils.mapToFormattedJsonString( counters ) ); +// logger.info( "dumping counters...." + counters ); +// logger.info( JsonUtils.mapToFormattedJsonString( counters ) ); // assertEquals( 1, counters.size() ); // assertNotNull( counters.get( "/foo/bar/" ) ); // assertEquals( new Long( 3 ), counters.get( "/foo/bar/" ) ); @@ -126,47 +126,47 @@ public class MessagesIT extends AbstractCoreIT { Map<String, Object> properties = new HashMap<String, Object>(); properties.put( "foo", "alpha" ); Queue q = qm.updateQueue( "/foo/1/", properties ); - LOG.info( JsonUtils.mapToFormattedJsonString( q ) ); + logger.info( JsonUtils.mapToFormattedJsonString( q ) ); q = qm.getQueue( "/foo/1/" ); - LOG.info( JsonUtils.mapToFormattedJsonString( q ) ); + logger.info( JsonUtils.mapToFormattedJsonString( q ) ); assertEquals( "alpha", q.getStringProperty( "foo" ) ); properties = new HashMap<String, Object>(); properties.put( "foo", "bravo" ); q = qm.updateQueue( "/foo/2/", properties ); - LOG.info( JsonUtils.mapToFormattedJsonString( q ) ); + logger.info( JsonUtils.mapToFormattedJsonString( q ) ); properties = new HashMap<String, Object>(); properties.put( "foo", "charlie" ); q = qm.updateQueue( "/foo/3/", properties ); - LOG.info( JsonUtils.mapToFormattedJsonString( q ) ); + logger.info( JsonUtils.mapToFormattedJsonString( q ) ); qm.subscribeToQueue( "/pubtest/", "/foo/1/" ); qm.subscribeToQueue( "/pubtest/", "/foo/2/" ); qm.subscribeToQueue( "/pubtest/", "/foo/3/" ); QueueSet results = qm.searchSubscribers( "/pubtest/", Query.findForProperty( "foo", "bravo" ) ); - LOG.info( JsonUtils.mapToFormattedJsonString( results ) ); + logger.info( JsonUtils.mapToFormattedJsonString( results ) ); assertEquals( 1, results.size() ); properties = new HashMap<String, Object>(); properties.put( "foo", "delta" ); q = qm.updateQueue( "/foo/2/", properties ); - LOG.info( JsonUtils.mapToFormattedJsonString( q ) ); + logger.info( JsonUtils.mapToFormattedJsonString( q ) ); results = qm.searchSubscribers( "/pubtest/", Query.findForProperty( "foo", "bravo" ) ); - LOG.info( JsonUtils.mapToFormattedJsonString( results ) ); + logger.info( JsonUtils.mapToFormattedJsonString( results ) ); assertEquals( 0, results.size() ); results = qm.searchSubscribers( "/pubtest/", Query.findForProperty( "foo", "delta" ) ); - LOG.info( JsonUtils.mapToFormattedJsonString( results ) ); + logger.info( JsonUtils.mapToFormattedJsonString( results ) ); assertEquals( 1, results.size() ); qm.unsubscribeFromQueue( "/pubtest/", "/foo/2/" ); results = qm.searchSubscribers( "/pubtest/", Query.findForProperty( "foo", "delta" ) ); - LOG.info( JsonUtils.mapToFormattedJsonString( results ) ); + logger.info( JsonUtils.mapToFormattedJsonString( results ) ); assertEquals( 0, results.size() ); } @@ -174,7 +174,7 @@ public class MessagesIT extends AbstractCoreIT { @Ignore("Pending https://issues.apache.org/jira/browse/USERGRID-1116. ") @Test public void testConsumer() throws Exception { - LOG.info( "Creating messages" ); + logger.info( "Creating messages" ); QueueManager qm = app.getQm(); Message message; @@ -183,14 +183,14 @@ public class MessagesIT extends AbstractCoreIT { message = new Message(); message.setStringProperty( "foo", "bar" + i ); - LOG.info( "Posting message #" + i + " to queue /foo/bar: " + message.getUuid() ); + logger.info( "Posting message #" + i + " to queue /foo/bar: " + message.getUuid() ); qm.postToQueue( "/foo/bar", message ); } for ( int i = 0; i < 11; i++ ) { QueueResults messages = qm.getFromQueue( "/foo/bar", new QueueQuery().withConsumer( "consumer1" ) ); - LOG.info( JsonUtils.mapToFormattedJsonString( messages ) ); + logger.info( JsonUtils.mapToFormattedJsonString( messages ) ); if ( i < 10 ) { assertEquals( 1, messages.size() ); assertEquals( "bar" + i, messages.getMessages().get( 0 ).getStringProperty( "foo" ) ); @@ -202,7 +202,7 @@ public class MessagesIT extends AbstractCoreIT { for ( int i = 0; i < 11; i++ ) { QueueResults messages = qm.getFromQueue( "/foo/bar", new QueueQuery().withConsumer( "consumer2" ) ); - LOG.info( JsonUtils.mapToFormattedJsonString( messages ) ); + logger.info( JsonUtils.mapToFormattedJsonString( messages ) ); if ( i < 10 ) { assertEquals( 1, messages.size() ); assertEquals( "bar" + i, messages.getMessages().get( 0 ).getStringProperty( "foo" ) ); @@ -228,7 +228,7 @@ public class MessagesIT extends AbstractCoreIT { // create 2 messages Message message = new Message(); message.setStringProperty( "foo", "bar" ); - LOG.info( "Posting message to queue " + queuePath + ": " + message.getUuid() ); + logger.info( "Posting message to queue " + queuePath + ": " + message.getUuid() ); Message posted1 = qm.postToQueue( queuePath, message ); assertTrue( qm.hasMessagesInQueue( queuePath, null ) ); @@ -237,7 +237,7 @@ public class MessagesIT extends AbstractCoreIT { message = new Message(); message.setStringProperty( "foo", "bar" ); - LOG.info( "Posting message to queue " + queuePath + ": " + message.getUuid() ); + logger.info( "Posting message to queue " + queuePath + ": " + message.getUuid() ); Message posted2 = qm.postToQueue( queuePath, message ); assertTrue( qm.hasMessagesInQueue( queuePath, null ) ); http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/mq/QueuePathsTest.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/mq/QueuePathsTest.java b/stack/core/src/test/java/org/apache/usergrid/mq/QueuePathsTest.java index a53576e..86dc8bc 100644 --- a/stack/core/src/test/java/org/apache/usergrid/mq/QueuePathsTest.java +++ b/stack/core/src/test/java/org/apache/usergrid/mq/QueuePathsTest.java @@ -28,7 +28,7 @@ import static org.apache.usergrid.utils.JsonUtils.mapToFormattedJsonString; public class QueuePathsTest { - private static final Logger LOG = LoggerFactory.getLogger( QueuePathsTest.class ); + private static final Logger logger = LoggerFactory.getLogger( QueuePathsTest.class ); @Test @@ -36,13 +36,13 @@ public class QueuePathsTest { // tests should not be written like this: what's the point? If it's // code coverage this is still bad. public void testPaths() throws Exception { - LOG.info( normalizeQueuePath( "a/b/c" ) ); - LOG.info( normalizeQueuePath( "a/b/c/" ) ); - LOG.info( normalizeQueuePath( "/a/b/c" ) ); - LOG.info( normalizeQueuePath( "/////a/b/c" ) ); - LOG.info( normalizeQueuePath( "/" ) ); - - LOG.info( mapToFormattedJsonString( getQueueParentPaths( "/a/b/c" ) ) ); - LOG.info( mapToFormattedJsonString( getQueueParentPaths( "/" ) ) ); + logger.info( normalizeQueuePath( "a/b/c" ) ); + logger.info( normalizeQueuePath( "a/b/c/" ) ); + logger.info( normalizeQueuePath( "/a/b/c" ) ); + logger.info( normalizeQueuePath( "/////a/b/c" ) ); + logger.info( normalizeQueuePath( "/" ) ); + + logger.info( mapToFormattedJsonString( getQueueParentPaths( "/a/b/c" ) ) ); + logger.info( mapToFormattedJsonString( getQueueParentPaths( "/" ) ) ); } } http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java index 1c67cc7..3305e0e 100644 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java +++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CollectionIT.java @@ -33,8 +33,6 @@ import org.apache.usergrid.persistence.exceptions.DuplicateUniquePropertyExistsE import org.apache.usergrid.persistence.index.query.Identifier; import org.apache.usergrid.utils.JsonUtils; import org.apache.usergrid.utils.UUIDUtils; -import rx.Observable; -import rx.schedulers.Schedulers; import static org.apache.usergrid.utils.MapUtils.hashMap; import static org.junit.Assert.assertEquals; @@ -48,7 +46,7 @@ import static org.junit.Assert.fail; //@UseModules({ GuiceModule.class }) public class CollectionIT extends AbstractCoreIT { - private static final Logger LOG = LoggerFactory.getLogger( CollectionIT.class ); + private static final Logger logger = LoggerFactory.getLogger( CollectionIT.class ); @Rule public Application app = new CoreApplication( setup ); @@ -57,7 +55,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testSimpleCrud() throws Exception { - LOG.debug( "testSimpleCrud" ); + logger.debug( "testSimpleCrud" ); app.put( "username", "edanuff" ); app.put( "email", "[email protected]" ); @@ -75,7 +73,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testCollection() throws Exception { - LOG.debug( "testCollection" ); + logger.debug( "testCollection" ); app.put( "username", "edanuff" ); app.put( "email", "[email protected]" ); @@ -96,13 +94,13 @@ public class CollectionIT extends AbstractCoreIT { Entity activity = app.create( "activity" ); assertNotNull( activity ); - LOG.info( "" + activity.getClass() ); - LOG.info( JsonUtils.mapToFormattedJsonString( activity ) ); + logger.info( "" + activity.getClass() ); + logger.info( JsonUtils.mapToFormattedJsonString( activity ) ); activity = app.get( activity.getUuid(), activity.getType() ); - LOG.info( "Activity class = {}", activity.getClass() ); - LOG.info( JsonUtils.mapToFormattedJsonString( activity ) ); + logger.info( "Activity class = {}", activity.getClass() ); + logger.info( JsonUtils.mapToFormattedJsonString( activity ) ); app.addToCollection( user, "activities", activity ); @@ -170,7 +168,7 @@ public class CollectionIT extends AbstractCoreIT { r = app.searchCollection( user, "activities", query ); assertEquals( 3, r.size() ); entities = r.getEntities(); - LOG.info( JsonUtils.mapToFormattedJsonString( entities ) ); + logger.info( JsonUtils.mapToFormattedJsonString( entities ) ); assertEquals( entities.get( 0 ).getUuid(), activity2.getUuid() ); assertEquals( entities.get( 1 ).getUuid(), activity.getUuid() ); assertEquals( entities.get( 2 ).getUuid(), activity3.getUuid() ); @@ -202,7 +200,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void containsTest() throws Exception { - LOG.debug("testCollection"); + logger.debug("testCollection"); app.put("username", "edanuff"); app.put("email", "[email protected]"); @@ -223,13 +221,13 @@ public class CollectionIT extends AbstractCoreIT { Entity activity = app.create("activity"); assertNotNull(activity); - LOG.info("" + activity.getClass()); - LOG.info(JsonUtils.mapToFormattedJsonString(activity)); + logger.info("" + activity.getClass()); + logger.info(JsonUtils.mapToFormattedJsonString(activity)); activity = app.get(activity.getUuid(), activity.getType()); - LOG.info("Activity class = {}", activity.getClass()); - LOG.info(JsonUtils.mapToFormattedJsonString(activity)); + logger.info("Activity class = {}", activity.getClass()); + logger.info(JsonUtils.mapToFormattedJsonString(activity)); app.addToCollection(user, "activities", activity); @@ -281,7 +279,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void userFirstNameSearch() throws Exception { - LOG.debug( "userFirstNameSearch" ); + logger.debug( "userFirstNameSearch" ); EntityManager em = app.getEntityManager(); @@ -341,7 +339,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void userMiddleNameSearch() throws Exception { - LOG.debug( "userMiddleNameSearch" ); + logger.debug( "userMiddleNameSearch" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -373,7 +371,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void userLastNameSearch() throws Exception { - LOG.debug( "userLastNameSearch" ); + logger.debug( "userLastNameSearch" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -405,7 +403,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testGroups() throws Exception { - LOG.debug("testGroups"); + logger.debug("testGroups"); EntityManager em = app.getEntityManager(); assertNotNull(em); @@ -443,7 +441,7 @@ public class CollectionIT extends AbstractCoreIT { Results r = em.searchCollectionConsistent( group, "users", query.withResultsLevel( Level.LINKED_PROPERTIES ),1 ); - LOG.info(JsonUtils.mapToFormattedJsonString(r.getEntities())); + logger.info(JsonUtils.mapToFormattedJsonString(r.getEntities())); assertEquals(1, r.size()); assertTrue(r.getEntities().get(0).getUuid().equals(user1.getUuid())); @@ -456,7 +454,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void groupNameSearch() throws Exception { - LOG.debug( "groupNameSearch" ); + logger.debug( "groupNameSearch" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -488,7 +486,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void groupTitleSearch() throws Exception { - LOG.debug( "groupTitleSearch" ); + logger.debug( "groupTitleSearch" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -521,7 +519,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testSubkeys() throws Exception { - LOG.debug( "testSubkeys" ); + logger.debug( "testSubkeys" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -566,14 +564,14 @@ public class CollectionIT extends AbstractCoreIT { final Query query = Query.fromQL( "verb = 'post'" ); Results r = em.searchCollection(user, "activities", query); - LOG.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); + logger.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); assertEquals( 2, r.size() ); } @Test public void emptyQuery() throws Exception { - LOG.debug( "emptyQuery" ); + logger.debug( "emptyQuery" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -616,7 +614,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void emptyQueryReverse() throws Exception { - LOG.debug( "emptyQueryReverse" ); + logger.debug( "emptyQueryReverse" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -660,7 +658,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void orQuery() throws Exception { - LOG.debug( "orQuery" ); + logger.debug( "orQuery" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -739,7 +737,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void andQuery() throws Exception { - LOG.debug( "andQuery" ); + logger.debug( "andQuery" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -800,7 +798,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void notQuery() throws Exception { - LOG.debug( "notQuery" ); + logger.debug( "notQuery" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -931,7 +929,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testKeywordsOrQuery() throws Exception { - LOG.debug( "testKeywordsOrQuery" ); + logger.debug( "testKeywordsOrQuery" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -955,14 +953,14 @@ public class CollectionIT extends AbstractCoreIT { Query query = Query.fromQL( "select * where keywords contains 'hot' or title contains 'hot'" ); Results r = em.searchCollection( em.getApplicationRef(), "games", query ); - LOG.info(JsonUtils.mapToFormattedJsonString(r.getEntities())); + logger.info(JsonUtils.mapToFormattedJsonString(r.getEntities())); assertEquals( 3, r.size() ); } @Test public void testKeywordsAndQuery() throws Exception { - LOG.debug( "testKeywordsOrQuery" ); + logger.debug( "testKeywordsOrQuery" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -986,7 +984,7 @@ public class CollectionIT extends AbstractCoreIT { Query query = Query.fromQL( "select * where keywords contains 'new' and title contains 'extreme'" ); Results r = em.searchCollection( em.getApplicationRef(), "games", query ); - LOG.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); + logger.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); assertEquals(2, r.size()); assertEquals( thirdGame.getUuid(), r.getEntities().get( 0 ).getUuid() ); @@ -996,7 +994,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void pagingAfterDelete() throws Exception { - LOG.debug( "pagingAfterDelete" ); + logger.debug( "pagingAfterDelete" ); EntityManager em = app.getEntityManager(); @@ -1020,7 +1018,7 @@ public class CollectionIT extends AbstractCoreIT { Results r = em.searchCollection( em.getApplicationRef(), "objects", query ); - LOG.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); + logger.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); assertEquals( initialSize, r.size() ); @@ -1080,7 +1078,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void pagingLessThanWithCriteria() throws Exception { - LOG.debug( "pagingLessThanWithCriteria" ); + logger.debug( "pagingLessThanWithCriteria" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1108,7 +1106,7 @@ public class CollectionIT extends AbstractCoreIT { r = em.searchCollection( em.getApplicationRef(), "pages", query ); - LOG.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); + logger.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); assertEquals( pageSize, r.size() ); @@ -1130,7 +1128,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void pagingGreaterThanWithCriteria() throws Exception { - LOG.debug( "pagingGreaterThanWithCriteria" ); + logger.debug( "pagingGreaterThanWithCriteria" ); EntityManager em = app.getEntityManager(); @@ -1162,7 +1160,7 @@ public class CollectionIT extends AbstractCoreIT { r = em.searchCollection( em.getApplicationRef(), "pages", query ); - LOG.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); + logger.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); assertEquals( pageSize, r.size() ); @@ -1187,7 +1185,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void pagingWithBoundsCriteria() throws Exception { - LOG.debug( "pagingWithBoundsCriteria" ); + logger.debug( "pagingWithBoundsCriteria" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1217,7 +1215,7 @@ public class CollectionIT extends AbstractCoreIT { r = em.searchCollection( em.getApplicationRef(), "pages", query ); - LOG.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); + logger.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); assertEquals( pageSize, r.size() ); @@ -1240,7 +1238,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testPagingWithGetNextResults() throws Exception { - LOG.debug( "testPagingWithGetNextResults" ); + logger.debug( "testPagingWithGetNextResults" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1268,7 +1266,7 @@ public class CollectionIT extends AbstractCoreIT { // check they're all the same before deletion for ( int i = 1; i < 10; i++ ) { - LOG.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); + logger.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); assertEquals( pageSize, r.size() ); @@ -1280,7 +1278,7 @@ public class CollectionIT extends AbstractCoreIT { assertEquals( entityId, returnedId ); } - LOG.info( "collection loop "+i ); + logger.info( "collection loop "+i ); r = r.getNextPageResults(); } @@ -1296,7 +1294,7 @@ public class CollectionIT extends AbstractCoreIT { EntityManager em = app.getEntityManager(); assertNotNull( em ); - LOG.debug( "subpropertyQuerying" ); + logger.debug( "subpropertyQuerying" ); Map<String, Object> root = new HashMap<String, Object>(); @@ -1346,7 +1344,7 @@ public class CollectionIT extends AbstractCoreIT { public void arrayQuerying() throws Exception { EntityManager em = app.getEntityManager(); assertNotNull( em ); - LOG.debug( "arrayQuerying" ); + logger.debug( "arrayQuerying" ); Map<String, Object> root = new HashMap<String, Object>(); @@ -1409,7 +1407,7 @@ public class CollectionIT extends AbstractCoreIT { EntityManager em = app.getEntityManager(); assertNotNull( em ); - LOG.debug( "stringWithSpaces" ); + logger.debug( "stringWithSpaces" ); Map<String, Object> props = new HashMap<String, Object>(); @@ -1432,7 +1430,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testSelectTerms() throws Exception { - LOG.debug( "testSelectTerms" ); + logger.debug( "testSelectTerms" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1462,7 +1460,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testRedefineTerms() throws Exception { - LOG.debug( "testRedefineTerms" ); + logger.debug( "testRedefineTerms" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1494,7 +1492,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testSelectEmailViaConnection() throws Exception { - LOG.debug( "testSelectEmailViaConnection" ); + logger.debug( "testSelectEmailViaConnection" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1549,7 +1547,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void testNotQueryAnd() throws Exception { - LOG.debug( "testNotQueryAnd" ); + logger.debug( "testNotQueryAnd" ); EntityManager em = app.getEntityManager(); @@ -1614,7 +1612,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void runtimeTypeCorrect() throws Exception { - LOG.debug( "runtimeTypeCorrect" ); + logger.debug( "runtimeTypeCorrect" ); EntityManager em = app.getEntityManager(); @@ -1638,7 +1636,7 @@ public class CollectionIT extends AbstractCoreIT { Results r = em.getCollection( em.getApplicationRef(), "users", null, 50, Level.ALL_PROPERTIES, false ); - LOG.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); + logger.info( JsonUtils.mapToFormattedJsonString( r.getEntities() ) ); assertEquals( size, r.size() ); @@ -1654,7 +1652,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void badOrderByBadGrammarAsc() throws Exception { - LOG.debug( "badOrderByBadGrammarAsc" ); + logger.debug( "badOrderByBadGrammarAsc" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1684,7 +1682,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void badOrderByBadGrammarDesc() throws Exception { - LOG.debug( "badOrderByBadGrammarDesc" ); + logger.debug( "badOrderByBadGrammarDesc" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1715,7 +1713,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void uuidIdentifierTest() throws Exception { - LOG.debug( "uuidIdentifierTest" ); + logger.debug( "uuidIdentifierTest" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1746,7 +1744,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void nameIdentifierTest() throws Exception { - LOG.debug( "nameIdentifierTest" ); + logger.debug( "nameIdentifierTest" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1780,7 +1778,7 @@ public class CollectionIT extends AbstractCoreIT { @Test public void emailIdentifierTest() throws Exception { - LOG.debug( "emailIdentifierTest" ); + logger.debug( "emailIdentifierTest" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1814,7 +1812,7 @@ public class CollectionIT extends AbstractCoreIT { @Test( expected = DuplicateUniquePropertyExistsException.class ) public void duplicateIdentifierTest() throws Exception { - LOG.debug( "duplicateIdentifierTest" ); + logger.debug( "duplicateIdentifierTest" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); @@ -1836,7 +1834,7 @@ public class CollectionIT extends AbstractCoreIT { @Test( expected = DuplicateUniquePropertyExistsException.class ) public void duplicateNameTest() throws Exception { - LOG.debug( "duplicateNameTest" ); + logger.debug( "duplicateNameTest" ); EntityManager em = app.getEntityManager(); assertNotNull( em ); http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java index e9de76e..5f8f2f2 100644 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java +++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CoreSchemaManager.java @@ -17,7 +17,6 @@ package org.apache.usergrid.persistence; -import org.junit.Ignore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,7 +33,7 @@ import me.prettyprint.hector.api.Cluster; /** @author zznate */ public class CoreSchemaManager implements SchemaManager { - private static final Logger LOG = LoggerFactory.getLogger( CoreSchemaManager.class ); + private static final Logger logger = LoggerFactory.getLogger( CoreSchemaManager.class ); private final Setup setup; private final Cluster cluster; @@ -52,7 +51,7 @@ public class CoreSchemaManager implements SchemaManager { setup.initSubsystems(); } catch ( Exception ex ) { - LOG.error( "Could not setup usergrid core schema", ex ); + logger.error( "Could not setup usergrid core schema", ex ); throw new RuntimeException( "Could not setup usergrid core schema", ex ); } } @@ -74,7 +73,7 @@ public class CoreSchemaManager implements SchemaManager { } catch ( Exception ex ) { - LOG.error( "Could not create default applications", ex ); + logger.error( "Could not create default applications", ex ); throw new RuntimeException("Could not create default applications", ex ); } } @@ -82,7 +81,7 @@ public class CoreSchemaManager implements SchemaManager { @Override public void destroy() { - LOG.info( "dropping keyspaces" ); + logger.info( "dropping keyspaces" ); try { cluster.dropKeyspace( CassandraService.getApplicationKeyspace() ); } @@ -98,7 +97,7 @@ public class CoreSchemaManager implements SchemaManager { //swallow if it just doesn't exist } - LOG.info( "keyspaces dropped" ); + logger.info( "keyspaces dropped" ); final EsProvider provider = http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java index 77dacf2..7330367 100644 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java +++ b/stack/core/src/test/java/org/apache/usergrid/persistence/CounterIT.java @@ -47,7 +47,7 @@ import static org.junit.Assert.assertNotNull; @NotThreadSafe public class CounterIT extends AbstractCoreIT { - private static final Logger LOG = LoggerFactory.getLogger( CounterIT.class ); + private static final Logger logger = LoggerFactory.getLogger( CounterIT.class ); @Rule public ImmediateCounterRule counterRule = new ImmediateCounterRule(); @@ -65,7 +65,7 @@ public class CounterIT extends AbstractCoreIT { @Test public void testIncrementAndDecrement() throws Exception { - LOG.info( "CounterIT.testIncrementAndDecrement" ); + logger.info( "CounterIT.testIncrementAndDecrement" ); EntityManager em = app.getEntityManager(); @@ -85,7 +85,7 @@ public class CounterIT extends AbstractCoreIT { userProperties.put( "email", "test-email" ); User user = ( User ) em.create( uuid, "user", userProperties ).toTypedEntity(); - LOG.debug( "user={}", user ); + logger.debug( "user={}", user ); em.refreshIndex(); @@ -103,7 +103,7 @@ public class CounterIT extends AbstractCoreIT { @Test public void testCounters() throws Exception { - LOG.info( "CounterIT.testCounters" ); + logger.info( "CounterIT.testCounters" ); EntityManager em = app.getEntityManager(); @@ -132,19 +132,19 @@ public class CounterIT extends AbstractCoreIT { Results r = em.getAggregateCounters( null, null, null, "visits", CounterResolution.SIX_HOUR, ts, System.currentTimeMillis(), false ); - LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) ); + logger.info( JsonUtils.mapToJsonString( r.getCounters() ) ); r = em.getAggregateCounters( user1, null, null, "visits", CounterResolution.SIX_HOUR, ts, System.currentTimeMillis(), false ); - LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) ); + logger.info( JsonUtils.mapToJsonString( r.getCounters() ) ); r = em.getAggregateCounters( user1, null, null, "visits", CounterResolution.SIX_HOUR, ts, System.currentTimeMillis(), true ); - LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) ); + logger.info( JsonUtils.mapToJsonString( r.getCounters() ) ); r = em.getAggregateCounters( user1, null, null, "visits", CounterResolution.ALL, ts, System.currentTimeMillis(), false ); - LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) ); + logger.info( JsonUtils.mapToJsonString( r.getCounters() ) ); for ( int i = 0; i < 10; i++ ) { event = new Event(); @@ -155,7 +155,7 @@ public class CounterIT extends AbstractCoreIT { r = em.getAggregateCounters( null, null, null, "clicks", CounterResolution.HALF_HOUR, ts, System.currentTimeMillis(), true ); - LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) ); + logger.info( JsonUtils.mapToJsonString( r.getCounters() ) ); Query query = new Query(); query.addCounterFilter( "clicks:*:*:*" ); @@ -165,13 +165,13 @@ public class CounterIT extends AbstractCoreIT { query.setResolution( CounterResolution.SIX_HOUR ); query.setPad( true ); r = em.getAggregateCounters( query ); - LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) ); + logger.info( JsonUtils.mapToJsonString( r.getCounters() ) ); - LOG.info( JsonUtils.mapToJsonString( em.getCounterNames() ) ); + logger.info( JsonUtils.mapToJsonString( em.getCounterNames() ) ); Map<String, Long> counts = em.getApplicationCounters(); - LOG.info( "counts map: " + JsonUtils.mapToJsonString( counts ) ); + logger.info( "counts map: " + JsonUtils.mapToJsonString( counts ) ); assertEquals( new Long( 10 ), counts.get( "clicks" ) ); assertEquals( new Long( 200 ), counts.get( "visits" ) ); @@ -243,7 +243,7 @@ public class CounterIT extends AbstractCoreIT { // em.create(event); counts = em.getApplicationCounters(); - LOG.info( JsonUtils.mapToJsonString( counts ) ); + logger.info( JsonUtils.mapToJsonString( counts ) ); assertNotNull( counts.get( "admin.logins" ) ); assertEquals( 1, counts.get( "admin.logins" ).longValue() - originalAdminLoginsCount ); @@ -254,18 +254,18 @@ public class CounterIT extends AbstractCoreIT { Results r = em.getAggregateCounters( null, null, null, "admin.logins", CounterResolution.ALL, ts, System.currentTimeMillis(), false ); - LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) ); + logger.info( JsonUtils.mapToJsonString( r.getCounters() ) ); assertEquals( 1, r.getCounters().get( 0 ).getValues().get( 0 ).getValue() - originalAdminLoginsCount ); r = em.getAggregateCounters( query ); - LOG.info( JsonUtils.mapToJsonString( r.getCounters() ) ); + logger.info( JsonUtils.mapToJsonString( r.getCounters() ) ); assertEquals( 1, r.getCounters().get( 0 ).getValues().get( 0 ).getValue() - originalCount ); } @Test public void testTimedFlush() throws Exception { - LOG.info( "CounterIT.testCounters" ); + logger.info( "CounterIT.testCounters" ); EntityManager em = app.getEntityManager(); http://git-wip-us.apache.org/repos/asf/usergrid/blob/bc33c88d/stack/core/src/test/java/org/apache/usergrid/persistence/EntityConnectionsIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/EntityConnectionsIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/EntityConnectionsIT.java index f5d3ce4..be2f06e 100644 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/EntityConnectionsIT.java +++ b/stack/core/src/test/java/org/apache/usergrid/persistence/EntityConnectionsIT.java @@ -17,14 +17,12 @@ package org.apache.usergrid.persistence; -import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.UUID; -import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,7 +37,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; public class EntityConnectionsIT extends AbstractCoreIT { - private static final Logger LOG = LoggerFactory.getLogger( EntityConnectionsIT.class ); + private static final Logger logger = LoggerFactory.getLogger( EntityConnectionsIT.class ); public EntityConnectionsIT() { @@ -89,49 +87,49 @@ public class EntityConnectionsIT extends AbstractCoreIT { final UUID applicationId = app.getId(); assertNotNull( em ); - LOG.info( "\n\nCreating Cat entity A with name of Dylan\n" ); + logger.info( "\n\nCreating Cat entity A with name of Dylan\n" ); Map<String, Object> properties = new LinkedHashMap<String, Object>(); properties.put( "name", "Dylan" ); Entity catA = em.create( "cat", properties ); assertNotNull( catA ); - LOG.info( "\n\nEntity A created with id " + catA.getUuid() + "\n" ); + logger.info( "\n\nEntity A created with id " + catA.getUuid() + "\n" ); // Do entity get by id for id of cat entity A - LOG.info( "\n\nLooking up cat with id " + catA.getUuid() + "\n" ); + logger.info( "\n\nLooking up cat with id " + catA.getUuid() + "\n" ); Entity cat = em.get( catA ); assertNotNull( cat ); - LOG.info( "\n\nFound entity " + cat.getUuid() + " of type " + cat.getType() + " with name " + cat + logger.info( "\n\nFound entity " + cat.getUuid() + " of type " + cat.getType() + " with name " + cat .getProperty( "name" ) + "\n" ); // Create cat entity B - LOG.info( "\n\nCreating cat entity B with name of Nico\n" ); + logger.info( "\n\nCreating cat entity B with name of Nico\n" ); properties = new LinkedHashMap<String, Object>(); properties.put( "name", "Nico" ); Entity catB = em.create( "cat", properties ); assertNotNull( catB ); - LOG.info( "\n\nEntity B created with id " + catB.getUuid() + "\n" ); + logger.info( "\n\nEntity B created with id " + catB.getUuid() + "\n" ); // Create award entity A - LOG.info( "\n\nCreating award entity with name of 'best cat'\n" ); + logger.info( "\n\nCreating award entity with name of 'best cat'\n" ); properties = new LinkedHashMap<String, Object>(); properties.put( "name", "Best Cat Ever" ); Entity awardA = em.create( "award", properties ); assertNotNull( awardA ); - LOG.info( "\n\nEntity created with id " + awardA.getUuid() + "\n" ); + logger.info( "\n\nEntity created with id " + awardA.getUuid() + "\n" ); // Establish connection from cat A to cat B - LOG.info( "\n\nConnecting " + catA.getUuid() + " \"likes\" " + catB.getUuid() + "\n" ); + logger.info( "\n\nConnecting " + catA.getUuid() + " \"likes\" " + catB.getUuid() + "\n" ); em.createConnection( catA, "likes", catB ); // Establish connection from award A to cat B - LOG.info( "\n\nConnecting " + awardA.getUuid() + " \"awarded\" " + catB.getUuid() + "\n" ); + logger.info( "\n\nConnecting " + awardA.getUuid() + " \"awarded\" " + catB.getUuid() + "\n" ); em.createConnection( awardA, "awarded", catB ); app.refreshIndex(); @@ -140,19 +138,19 @@ public class EntityConnectionsIT extends AbstractCoreIT { // Thread.sleep(5000); - LOG.info( "Find all connections for cat A: " + catA.getUuid() ); + logger.info( "Find all connections for cat A: " + catA.getUuid() ); testEntityConnections( applicationId, catA.getUuid(), "likes", "cat", 1 ); // List forward connections for award A - LOG.info( "Find all connections for award A: " + awardA.getUuid() ); + logger.info( "Find all connections for award A: " + awardA.getUuid() ); testEntityConnections( applicationId, awardA.getUuid(),"awarded", "award", 1 ); // Establish connection from award A to cat A - LOG.info( "\n\nConnecting " + awardA.getUuid() + " \"awarded\" " + catA.getUuid() + "\n" ); + logger.info( "\n\nConnecting " + awardA.getUuid() + " \"awarded\" " + catA.getUuid() + "\n" ); em.createConnection( awardA, "awarded", catA ); app.refreshIndex(); @@ -173,22 +171,22 @@ public class EntityConnectionsIT extends AbstractCoreIT { testApplicationCollections( applicationId, "awards", 1 ); - LOG.info( "\n\nSearching Award A for recipients with the name Dylan\n" ); + logger.info( "\n\nSearching Award A for recipients with the name Dylan\n" ); } public Map<String, Map<String, List<UUID>>> testEntityConnections( UUID applicationId, UUID entityId, String connectionType, String entityType, int expectedCount ) throws Exception { - LOG.info( "----------------------------------------------------" ); - LOG.info( "Checking connections for " + entityId.toString() ); + logger.info( "----------------------------------------------------" ); + logger.info( "Checking connections for " + entityId.toString() ); EntityManager em = setup.getEmf().getEntityManager( applicationId ); Entity en = em.get( new SimpleEntityRef( entityType, entityId)); Results results = em.getTargetEntities(en, connectionType, null, Level.REFS); - LOG.info( "----------------------------------------------------" ); + logger.info( "----------------------------------------------------" ); assertEquals( "Expected " + expectedCount + " connections", expectedCount, results.getConnections().size() ); // return connections; @@ -207,8 +205,8 @@ public class EntityConnectionsIT extends AbstractCoreIT { public List<UUID> testEntityCollections( UUID applicationId, UUID entityId, String entityType, String collectionName, int expectedCount ) throws Exception { - LOG.info( "----------------------------------------------------" ); - LOG.info( "Checking collection " + collectionName + " for " + entityId.toString() ); + logger.info( "----------------------------------------------------" ); + logger.info( "Checking collection " + collectionName + " for " + entityId.toString() ); EntityManager em = setup.getEmf().getEntityManager( applicationId ); Entity en = em.get( new SimpleEntityRef( entityType, entityId )); @@ -216,9 +214,9 @@ public class EntityConnectionsIT extends AbstractCoreIT { int i = 0; Results entities = em.getCollection( en, collectionName, null, 100, Level.IDS, false ); for ( UUID id : entities.getIds() ) { - LOG.info( ( i++ ) + " " + id.toString() ); + logger.info( ( i++ ) + " " + id.toString() ); } - LOG.info( "----------------------------------------------------" ); + logger.info( "----------------------------------------------------" ); assertEquals( "Expected " + expectedCount + " connections", expectedCount, entities.getIds() != null ? entities.getIds().size() : 0 ); // return connections;
