You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@usergrid.apache.org by tnine <gi...@git.apache.org> on 2015/02/16 18:35:35 UTC

[GitHub] incubator-usergrid pull request: Usergrid 273

GitHub user tnine opened a pull request:

    https://github.com/apache/incubator-usergrid/pull/160

    Usergrid 273

    Fixes several bugs and upgrades our test infrastructure.  Some key changes.  
    
    1) Indexes are deleted after tests
    2) Before a JVM starts, Cassandra and ES are changed
    3) Aquillian is now used to test the REST tier (not yet complete)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/incubator-usergrid USERGRID-273

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-usergrid/pull/160.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #160
    
----
commit fc419e748958e11f59b7cba835aaeb38ca965ca4
Author: Todd Nine <tn...@apigee.com>
Date:   2014-12-11T20:47:30Z

    Fixes counter flush configuration issues during parallel tests

commit 61a81d5744428246152318eb8f06f9946541ae84
Author: Todd Nine <tn...@apigee.com>
Date:   2014-12-12T21:12:35Z

    Cleaned up threading model and CassandraResource.

commit 938855f8b9c060a8b325d362f91679a0f421012e
Author: Todd Nine <tn...@apigee.com>
Date:   2014-12-12T21:13:59Z

    Created a multi process barrier and lock utility.  This will be used in our listeners to initialize and clean Cassandra.

commit e916d6d6aa228cd2b1dac882b305933a6b38a1d9
Author: Todd Nine <tn...@apigee.com>
Date:   2014-12-12T21:18:16Z

    Renamed CassandraResource to SpringResource, since it really initializes spring, not cassandra

commit 4ac86c9e87dd180c68bf92b21ecc0cf7b3d7b866
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-05T17:13:47Z

    WIP of refactor

commit 5aca048f4e984977158ecde6021e3d34ca358907
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-07T23:29:21Z

    Completed first pass with new runner.

commit d2e5da60f95eac0f14861b72ba7817fd37eee568
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-20T21:55:17Z

    Changed barriers to sockets

commit d35cba68b51b9e34f33d19f6b70139aaee2acce4
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-20T23:15:11Z

    Changed barrier back to file.  File is now named uniquely per build to avoid collisions.

commit e80df0d5a50a92fabe8898173d8c9db1559bc5af
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-21T22:58:12Z

    Refactored Guice Injector to be a spring bean
    
    Modified setup lifecycle to seperate system configuration from column family initialization
    
    Added index delete to post test invocation

commit 1fbe3e54d27e1a9666626a55f2857654c957f8f9
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-23T00:04:18Z

    Removed concurrent annotations
    
    Refactored singleton to include transitive dependencies on initialization. Class rule order not guaranteed VM versions.

commit 79f6bb6236955779cb664b72738153439fab6d0b
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-23T00:29:00Z

    Removed concurrent from services and REST

commit b6134986567c941fc074f608a5d6aa539e5a125b
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-23T01:12:55Z

    Core tests passing

commit 4402feb17072ef386280d7c9e58d4cd017b49904
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-23T16:30:43Z

    Updated to use method fork counts
    
    Updated service tests to support parallelism

commit f55c6cb2aa9e8259bcd9a1b00221857ce754d014
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-24T00:39:33Z

    Fixes broken tests
    
    Fixes shiro realm setter
    
    Fixes migration bug where drop followed by create returns NotFoundException, not BadRequestException
    
    Fixes services test harness to pass consistently

commit e5b6cc1bdf6afbc34b9f06b14b7b8119b046e7b9
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-27T02:27:15Z

    First pass with cargo. The container starts correctly.
    
    Need to move tests to integration test phase and start/stop automatically.

commit bc6fec485a38b4354143e08f058a3d29906860fd
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-27T04:10:22Z

    Finished test refactor to integration tests.

commit b3951eefc87761739829032ec694cba67bdb0899
Author: Todd Nine <tn...@apigee.com>
Date:   2015-01-27T21:21:59Z

    Added JVM args for remote debugging

commit 02852a74a902a4abb287516b927b03406525ae15
Author: Todd Nine <tn...@apigee.com>
Date:   2015-02-11T21:17:36Z

    Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into USERGRID-273
    
    Conflicts:
    	stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
    	stack/core/src/main/java/org/apache/usergrid/corepersistence/HybridEntityManagerFactory.java
    	stack/core/src/main/java/org/apache/usergrid/persistence/EntityManagerFactory.java
    	stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImpl.java
    	stack/core/src/test/java/org/apache/usergrid/persistence/cassandra/EntityManagerFactoryImplIT.java

commit 05e06671cce05610395de0934fc89ba1b185104f
Author: Todd Nine <tn...@apigee.com>
Date:   2015-02-11T21:18:07Z

    Fixed index alias cache invalidation

commit 9b11860230124e511a3f39e9e77e81f4e01ab411
Author: Todd Nine <tn...@apigee.com>
Date:   2015-02-12T23:41:12Z

    First pass for refactoring tomcat

commit 75a8361cd425608a70ae325cde1f62cb179cfbed
Author: Todd Nine <tn...@apigee.com>
Date:   2015-02-13T03:55:31Z

    First pass at embedded tomcat.  Experiencing classloading issues.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24769821
  
    --- Diff: stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java ---
    @@ -39,23 +39,33 @@
     import org.apache.usergrid.java.client.Client;
     import static org.apache.usergrid.utils.JsonUtils.mapToFormattedJsonString;
     import static org.apache.usergrid.utils.MapUtils.hashMap;
    +
    +import org.jboss.arquillian.container.test.api.Deployment;
    +import org.jboss.arquillian.junit.Arquillian;
    +import org.jboss.shrinkwrap.api.Archive;
    +import org.jboss.shrinkwrap.api.ShrinkWrap;
    +import org.jboss.shrinkwrap.api.spec.WebArchive;
    +import org.jboss.shrinkwrap.resolver.api.maven.Maven;
    +import org.jboss.shrinkwrap.resolver.api.maven.archive.importer.MavenImporter;
     import org.junit.AfterClass;
     import static org.junit.Assert.assertNull;
     import static org.junit.Assert.assertTrue;
     import org.junit.Before;
     import org.junit.ClassRule;
    +import org.junit.runner.RunWith;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     
     /**
    - * Base class for testing Usergrid Jersey-based REST API. Implementations should model the 
    - * paths mapped, not the method names. For example, to test the the "password" mapping on 
    - * applications.users.UserResource for a PUT method, the test method(s) should following the 
    + * Base class for testing Usergrid Jersey-based REST API. Implementations should model the
    + * paths mapped, not the method names. For example, to test the the "password" mapping on
    + * applications.users.UserResource for a PUT method, the test method(s) should following the
      * following naming convention: test_[HTTP verb]_[action mapping]_[ok|fail][_[specific
      * failure condition if multiple]
      */
    -//@Concurrent()
    +//
    +@RunWith( Arquillian.class )
     public abstract class AbstractRestIT extends JerseyTest {
    --- End diff --
    
    Soon AbstractRestIt will be depreciated once the rest tests have been converted over. Is all we need is the createTestArchieve method to work with arquillian?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-usergrid/pull/160


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by tnine <gi...@git.apache.org>.
Github user tnine commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24773689
  
    --- Diff: stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java ---
    @@ -100,13 +102,16 @@ public void testMessages() throws Exception {
     		LOG.info(JsonUtils.mapToFormattedJsonString(messages));
     		assertEquals(3, messages.size());
     */
    -        TimeUnit.SECONDS.sleep( 2 );
    -        Map<String, Long> counters = qm.getQueueCounters( "/" );
    -        LOG.info( "dumping counters...." + counters );
    -        LOG.info( JsonUtils.mapToFormattedJsonString( counters ) );
    -        assertEquals( 1, counters.size() );
    -        assertNotNull( counters.get( "/foo/bar/" ) );
    -        assertEquals( new Long( 3 ), counters.get( "/foo/bar/" ) );
    +
    +        //wait for counters for flush\
    +
    +        //TODO Re-evaluate queues and make a cleaner interface
    --- End diff --
    
    Yeah, Queue is generally broken. IMHO this feature (queues) should be removed from 2.0 completely since it's unstable at best.  We should focus on entities and graph first, then build our Queue features.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24765428
  
    --- Diff: stack/core/src/main/java/org/apache/usergrid/corepersistence/CpSetup.java ---
    @@ -61,151 +59,106 @@
     
         private static final Logger logger = LoggerFactory.getLogger( CpSetup.class );
     
    -    private static Injector injector = null;
    -    private static EntityManagerFactory emf;
    +
    +    private final Injector injector;
    +
     
         private final CassandraService cass;
     
    +    private final EntityManagerFactory emf;
    +
     
         /**
          * Instantiates a new setup object.
          *
          * @param emf the emf
          */
    -    public CpSetup( EntityManagerFactory emf, CassandraService cass ) {
    +    public CpSetup( final EntityManagerFactory emf, final CassandraService cassandraService, final Injector injector ) {
             this.emf = emf;
    -        this.cass = cass;
    -    }
    -
    -
    -    public static Injector getInjector() {
    -        if ( injector == null ) {
    -            injector = Guice.createInjector( new GuiceModule( emf ) ); 
    -        }
    -        return injector;
    +        this.cass = cassandraService;
    +        this.injector = injector;
         }
     
     
         @Override
         public void init() throws Exception {
    -        cass.init();
    -
    -        try {
    -            logger.info("Loading Core Persistence properties");
    -
    -            String hostsString = "";
    -            CassandraHost[] hosts = cass.getCassandraHostConfigurator().buildCassandraHosts();
    -            if ( hosts.length == 0 ) {
    -                throw new RuntimeException("Fatal error: no Cassandra hosts configured");
    -            }
    -            String sep = "";
    -            for ( CassandraHost host : hosts ) {
    -                if (StringUtils.isEmpty(host.getHost())) {
    -                    throw new RuntimeException("Fatal error: Cassandra hostname cannot be empty");
    -                }
    -                hostsString = hostsString + sep + host.getHost();
    -                sep = ",";
    -            }
    -
    -            logger.info("hostsString: " + hostsString);
    +        //a no op, creating the injector creates the connections
     
    -            Properties cpProps = new Properties();
    +    }
     
    -            // Some Usergrid properties must be mapped to Core Persistence properties
    -            cpProps.put("cassandra.hosts", hostsString);
    -            cpProps.put("cassandra.port", hosts[0].getPort());
    -            cpProps.put("cassandra.cluster_name", cass.getProperties().get("cassandra.cluster"));
     
    -            String cassRemoteString = (String)cass.getProperties().get("cassandra.use_remote"); 
    -            if ( cassRemoteString != null && cassRemoteString.equals("false")) {
    -                cpProps.put("cassandra.embedded", "true");
    -            } else {
    -                cpProps.put("cassandra.embedded", "false");
    -            }
    +    public void createDefaultApplications() throws Exception {
     
    -            cpProps.put("collections.keyspace.strategy.class", 
    -                    cass.getProperties().get("cassandra.keyspace.strategy"));
    +        setupSystemKeyspace();
     
    -            cpProps.put("collections.keyspace.strategy.options",
    -                    cass.getProperties().get("cassandra.keyspace.replication"));
    +        setupStaticKeyspace();
     
    +        //force the EMF creation of indexes before creating the default applications
    +        emf.refreshIndex();
     
    -            logger.debug("Set Cassandra properties for Core Persistence: " + cpProps.toString() );
    +        injector.getInstance( DataMigrationManager.class ).migrate();
     
    -            // Make all Usergrid properties into Core Persistence config
    -            cpProps.putAll( cass.getProperties() );
    -            //logger.debug("All properties fed to Core Persistence: " + cpProps.toString() );
    +        logger.info( "Setting up default applications" );
     
    -            ConfigurationManager.loadProperties( cpProps );
    +        try {
    +            emf.initializeApplication( DEFAULT_ORGANIZATION, emf.getDefaultAppId(), DEFAULT_APPLICATION, null );
             }
    -        catch ( Exception e ) {
    -            throw new RuntimeException( "Fatal error loading configuration.", e );
    +        catch ( ApplicationAlreadyExistsException ex ) {
    +            logger.warn( "Application {}/{} already exists", DEFAULT_ORGANIZATION, DEFAULT_APPLICATION );
    +        }
    +        catch ( OrganizationAlreadyExistsException oaee ) {
    +            logger.warn( "Organization {} already exists", DEFAULT_ORGANIZATION );
             }
     
    -        Injector injector = CpSetup.getInjector();
    -        MigrationManager m = injector.getInstance( MigrationManager.class );
             try {
    -            m.migrate();
    -        } catch (MigrationException ex) {
    -            throw new RuntimeException("Error migrating Core Persistence", ex);
    +            emf.initializeApplication( DEFAULT_ORGANIZATION, emf.getManagementAppId(), MANAGEMENT_APPLICATION, null );
    +        }
    +        catch ( ApplicationAlreadyExistsException ex ) {
    +            logger.warn( "Application {}/{} already exists", DEFAULT_ORGANIZATION, MANAGEMENT_APPLICATION );
    +        }
    +        catch ( OrganizationAlreadyExistsException oaee ) {
    +            logger.warn( "Organization {} already exists", DEFAULT_ORGANIZATION );
             }
    -
    -        setupSystemKeyspace();
    -
    -        setupStaticKeyspace();
    -
    -        //force the EMF creation of indexes before creating the default applications
    -        emf.refreshIndex();
    -
    -        createDefaultApplications();
         }
     
     
    -    public void createDefaultApplications() throws Exception {
    -
    -        logger.info("Setting up default applications");
    -
    +    /**
    +     * Perform migration of the 2.0 code
    +     */
    +    private void migrate() {
    +        MigrationManager m = injector.getInstance( MigrationManager.class );
             try {
    -            emf.initializeApplication( DEFAULT_ORGANIZATION,
    -                    emf.getDefaultAppId(), DEFAULT_APPLICATION, null );
    -        } catch (ApplicationAlreadyExistsException ex) {
    -            logger.warn("Application {}/{} already exists", 
    -                    DEFAULT_ORGANIZATION, DEFAULT_APPLICATION);
    +            m.migrate();
             }
    -
    -        try {
    -            emf.initializeApplication( DEFAULT_ORGANIZATION,
    -                    emf.getManagementAppId(), MANAGEMENT_APPLICATION, null );
    -        } catch (ApplicationAlreadyExistsException ex) {
    -            logger.warn("Application {}/{} already exists", 
    -                    DEFAULT_ORGANIZATION, MANAGEMENT_APPLICATION);
    +        catch ( MigrationException ex ) {
    +            throw new RuntimeException( "Error migrating Core Persistence", ex );
             }
         }
     
     
    -
    -    
         @Override
         public void setupSystemKeyspace() throws Exception {
     
             logger.info( "Initialize system keyspace" );
     
    -        cass.createColumnFamily( SYSTEM_KEYSPACE, createColumnFamilyDefinition( 
    -                SYSTEM_KEYSPACE, APPLICATIONS_CF, ComparatorType.BYTESTYPE ) );
    +        migrate();
     
    -        cass.createColumnFamily( SYSTEM_KEYSPACE, createColumnFamilyDefinition( 
    -                SYSTEM_KEYSPACE, PROPERTIES_CF, ComparatorType.BYTESTYPE ) );
    +        cass.createColumnFamily( SYSTEM_KEYSPACE,
    --- End diff --
    
    Is there a way to check that we've already created these keyspaces? That way it won't show the exception when we try to recreate already existing keyspaces?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by tnine <gi...@git.apache.org>.
Github user tnine commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24773747
  
    --- Diff: stack/rest/src/test/java/org/apache/usergrid/rest/AbstractRestIT.java ---
    @@ -39,23 +39,33 @@
     import org.apache.usergrid.java.client.Client;
     import static org.apache.usergrid.utils.JsonUtils.mapToFormattedJsonString;
     import static org.apache.usergrid.utils.MapUtils.hashMap;
    +
    +import org.jboss.arquillian.container.test.api.Deployment;
    +import org.jboss.arquillian.junit.Arquillian;
    +import org.jboss.shrinkwrap.api.Archive;
    +import org.jboss.shrinkwrap.api.ShrinkWrap;
    +import org.jboss.shrinkwrap.api.spec.WebArchive;
    +import org.jboss.shrinkwrap.resolver.api.maven.Maven;
    +import org.jboss.shrinkwrap.resolver.api.maven.archive.importer.MavenImporter;
     import org.junit.AfterClass;
     import static org.junit.Assert.assertNull;
     import static org.junit.Assert.assertTrue;
     import org.junit.Before;
     import org.junit.ClassRule;
    +import org.junit.runner.RunWith;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     
     /**
    - * Base class for testing Usergrid Jersey-based REST API. Implementations should model the 
    - * paths mapped, not the method names. For example, to test the the "password" mapping on 
    - * applications.users.UserResource for a PUT method, the test method(s) should following the 
    + * Base class for testing Usergrid Jersey-based REST API. Implementations should model the
    + * paths mapped, not the method names. For example, to test the the "password" mapping on
    + * applications.users.UserResource for a PUT method, the test method(s) should following the
      * following naming convention: test_[HTTP verb]_[action mapping]_[ok|fail][_[specific
      * failure condition if multiple]
      */
    -//@Concurrent()
    +//
    +@RunWith( Arquillian.class )
     public abstract class AbstractRestIT extends JerseyTest {
    --- End diff --
    
    Yeah, just the @RunwithAttribute and the static method telling it how to create the testable archive.  Everything else is encapsulated within the arquillian.xml file


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by tnine <gi...@git.apache.org>.
Github user tnine commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24773714
  
    --- Diff: stack/pom.xml ---
    @@ -1451,375 +1462,80 @@
       </dependencies>
     
       <build>
    -    <pluginManagement>
    -      <plugins>
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>sonar-maven-plugin</artifactId>
    -          <version>2.1</version>
    -        </plugin>
    -
    -        <!--
    -                <plugin>
    -                  <groupId>com.structure101.java</groupId>
    -                  <artifactId>maven-structure101-plugin</artifactId>
    -                  <version>1.1</version>
    -                </plugin>
    -        -->
    -        <plugin>
    -          <groupId>org.antlr</groupId>
    -          <artifactId>antlr3-maven-plugin</artifactId>
    -          <version>${antlr.version}</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>antlr-maven-plugin</artifactId>
    -          <version>2.2</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-antrun-plugin</artifactId>
    -          <version>1.7</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-assembly-plugin</artifactId>
    -          <version>2.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-changes-plugin</artifactId>
    -          <version>2.6</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-checkstyle-plugin</artifactId>
    -          <version>2.10</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-clean-plugin</artifactId>
    -          <version>2.4.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-compiler-plugin</artifactId>
    -          <version>3.1</version>
    -          <configuration>
    -            <source>1.7</source>
    -            <target>1.7</target>
    -            <optimize>true</optimize>
    -            <showDeprecation>true</showDeprecation>
    -            <debug>true</debug>
    -            <!-- uncomment when building for more detailed profiling information <debuglevel>lines,vars,source</debuglevel> -->
    -            <encoding>UTF-8</encoding>
    -            <showWarnings>true</showWarnings>
    -          </configuration>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-dependency-plugin</artifactId>
    -          <version>2.8</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-deploy-plugin</artifactId>
    -          <version>2.7</version>
    -          <inherited>true</inherited>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-docck-plugin</artifactId>
    -          <version>1.0</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-ear-plugin</artifactId>
    -          <version>2.6</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-eclipse-plugin</artifactId>
    -          <version>2.9</version>
    -          <inherited>true</inherited>
    -          <configuration>
    -            <downloadSources>true</downloadSources>
    -            <downloadJavadocs>true</downloadJavadocs>
    -          </configuration>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-ejb-plugin</artifactId>
    -          <version>2.3</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-enforcer-plugin</artifactId>
    -          <version>1.3.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-gpg-plugin</artifactId>
    -          <version>1.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-install-plugin</artifactId>
    -          <version>2.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-jar-plugin</artifactId>
    -          <version>2.4</version>
    -          <executions>
    -            <execution>
    -              <id>test-jar-execution</id>
    -              <phase>package</phase>
    -              <goals>
    -                <goal>test-jar</goal>
    -              </goals>
    -              <configuration>
    -              </configuration>
    -            </execution>
    -          </executions>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-javadoc-plugin</artifactId>
    -          <version>2.8</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-jxr-plugin</artifactId>
    -          <version>2.3</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-plugin-plugin</artifactId>
    -          <version>2.9</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-pmd-plugin</artifactId>
    -          <version>2.6</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-project-info-reports-plugin</artifactId>
    -          <version>2.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-release-plugin</artifactId>
    -          <version>2.4.1</version>
    -        </plugin>
     
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-remote-resources-plugin</artifactId>
    -          <version>1.2.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-resources-plugin</artifactId>
    -          <version>2.6</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-scm-plugin</artifactId>
    -          <version>1.5</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-shade-plugin</artifactId>
    -          <version>2.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-site-plugin</artifactId>
    -          <version>3.3</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-source-plugin</artifactId>
    -          <version>2.2.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-stage-plugin</artifactId>
    -          <version>1.0-alpha-2</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-surefire-report-plugin</artifactId>
    -          <version>2.7</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-surefire-plugin</artifactId>
    -          <version>2.7</version>
    -          <configuration>
    -              <parallel>${usergrid.it.parallel}</parallel>
    -              <forkCount>${usergrid.it.forkCount}</forkCount>
    -              <reuseForks>${usergrid.it.reuseForks}</reuseForks>
    -              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
    -          </configuration>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-war-plugin</artifactId>
    -          <version>2.1.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.geronimo.genesis.plugins</groupId>
    -          <artifactId>tools-maven-plugin</artifactId>
    -          <version>1.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.xbean</groupId>
    -          <artifactId>maven-xbean-plugin</artifactId>
    -          <version>3.8</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.codehaus.modello</groupId>
    -          <artifactId>modello-maven-plugin</artifactId>
    -          <version>1.5</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>build-helper-maven-plugin</artifactId>
    -          <version>1.7</version>
    -        </plugin>
    +    <plugins>
     
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>clirr-maven-plugin</artifactId>
    -          <version>2.3</version>
    -        </plugin>
     
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>dashboard-maven-plugin</artifactId>
    -          <version>1.0.0-beta-1</version>
    -        </plugin>
    +                <!--
    +                        <plugin>
    +                          <groupId>com.structure101.java</groupId>
    +                          <artifactId>maven-structure101-plugin</artifactId>
    +                          <version>1.1</version>
    +                        </plugin>
    +                -->
     
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>findbugs-maven-plugin</artifactId>
    -          <version>2.3.2</version>
    -          <configuration>
    -            <xmlOutput>false</xmlOutput>
    -          </configuration>
    -        </plugin>
     
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>javancss-maven-plugin</artifactId>
    -          <version>2.0</version>
    -        </plugin>
    +                <plugin>
    +                  <groupId>org.apache.maven.plugins</groupId>
    +                  <artifactId>maven-compiler-plugin</artifactId>
    +                  <version>3.2</version>
    +                  <configuration>
    +                    <source>1.7</source>
    --- End diff --
    
    Nah, just requires the source to be 1.7 compatible.  IF we build it with 1.8, we're still good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24767640
  
    --- Diff: stack/core/src/test/java/org/apache/usergrid/mq/MessagesIT.java ---
    @@ -100,13 +102,16 @@ public void testMessages() throws Exception {
     		LOG.info(JsonUtils.mapToFormattedJsonString(messages));
     		assertEquals(3, messages.size());
     */
    -        TimeUnit.SECONDS.sleep( 2 );
    -        Map<String, Long> counters = qm.getQueueCounters( "/" );
    -        LOG.info( "dumping counters...." + counters );
    -        LOG.info( JsonUtils.mapToFormattedJsonString( counters ) );
    -        assertEquals( 1, counters.size() );
    -        assertNotNull( counters.get( "/foo/bar/" ) );
    -        assertEquals( new Long( 3 ), counters.get( "/foo/bar/" ) );
    +
    +        //wait for counters for flush\
    +
    +        //TODO Re-evaluate queues and make a cleaner interface
    --- End diff --
    
    So currently there is no way to get counters from the queue in this branch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24769333
  
    --- Diff: stack/pom.xml ---
    @@ -1451,375 +1462,80 @@
       </dependencies>
     
       <build>
    -    <pluginManagement>
    -      <plugins>
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>sonar-maven-plugin</artifactId>
    -          <version>2.1</version>
    -        </plugin>
    -
    -        <!--
    -                <plugin>
    -                  <groupId>com.structure101.java</groupId>
    -                  <artifactId>maven-structure101-plugin</artifactId>
    -                  <version>1.1</version>
    -                </plugin>
    -        -->
    -        <plugin>
    -          <groupId>org.antlr</groupId>
    -          <artifactId>antlr3-maven-plugin</artifactId>
    -          <version>${antlr.version}</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>antlr-maven-plugin</artifactId>
    -          <version>2.2</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-antrun-plugin</artifactId>
    -          <version>1.7</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-assembly-plugin</artifactId>
    -          <version>2.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-changes-plugin</artifactId>
    -          <version>2.6</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-checkstyle-plugin</artifactId>
    -          <version>2.10</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-clean-plugin</artifactId>
    -          <version>2.4.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-compiler-plugin</artifactId>
    -          <version>3.1</version>
    -          <configuration>
    -            <source>1.7</source>
    -            <target>1.7</target>
    -            <optimize>true</optimize>
    -            <showDeprecation>true</showDeprecation>
    -            <debug>true</debug>
    -            <!-- uncomment when building for more detailed profiling information <debuglevel>lines,vars,source</debuglevel> -->
    -            <encoding>UTF-8</encoding>
    -            <showWarnings>true</showWarnings>
    -          </configuration>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-dependency-plugin</artifactId>
    -          <version>2.8</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-deploy-plugin</artifactId>
    -          <version>2.7</version>
    -          <inherited>true</inherited>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-docck-plugin</artifactId>
    -          <version>1.0</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-ear-plugin</artifactId>
    -          <version>2.6</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-eclipse-plugin</artifactId>
    -          <version>2.9</version>
    -          <inherited>true</inherited>
    -          <configuration>
    -            <downloadSources>true</downloadSources>
    -            <downloadJavadocs>true</downloadJavadocs>
    -          </configuration>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-ejb-plugin</artifactId>
    -          <version>2.3</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-enforcer-plugin</artifactId>
    -          <version>1.3.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-gpg-plugin</artifactId>
    -          <version>1.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-install-plugin</artifactId>
    -          <version>2.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-jar-plugin</artifactId>
    -          <version>2.4</version>
    -          <executions>
    -            <execution>
    -              <id>test-jar-execution</id>
    -              <phase>package</phase>
    -              <goals>
    -                <goal>test-jar</goal>
    -              </goals>
    -              <configuration>
    -              </configuration>
    -            </execution>
    -          </executions>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-javadoc-plugin</artifactId>
    -          <version>2.8</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-jxr-plugin</artifactId>
    -          <version>2.3</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-plugin-plugin</artifactId>
    -          <version>2.9</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-pmd-plugin</artifactId>
    -          <version>2.6</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-project-info-reports-plugin</artifactId>
    -          <version>2.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-release-plugin</artifactId>
    -          <version>2.4.1</version>
    -        </plugin>
     
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-remote-resources-plugin</artifactId>
    -          <version>1.2.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-resources-plugin</artifactId>
    -          <version>2.6</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-scm-plugin</artifactId>
    -          <version>1.5</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-shade-plugin</artifactId>
    -          <version>2.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-site-plugin</artifactId>
    -          <version>3.3</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-source-plugin</artifactId>
    -          <version>2.2.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-stage-plugin</artifactId>
    -          <version>1.0-alpha-2</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-surefire-report-plugin</artifactId>
    -          <version>2.7</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-surefire-plugin</artifactId>
    -          <version>2.7</version>
    -          <configuration>
    -              <parallel>${usergrid.it.parallel}</parallel>
    -              <forkCount>${usergrid.it.forkCount}</forkCount>
    -              <reuseForks>${usergrid.it.reuseForks}</reuseForks>
    -              <argLine>-Xmx${ug.heapmax} -Xms${ug.heapmin} -javaagent:${settings.localRepository}/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar ${ug.argline}</argLine>
    -          </configuration>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.maven.plugins</groupId>
    -          <artifactId>maven-war-plugin</artifactId>
    -          <version>2.1.1</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.geronimo.genesis.plugins</groupId>
    -          <artifactId>tools-maven-plugin</artifactId>
    -          <version>1.4</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.apache.xbean</groupId>
    -          <artifactId>maven-xbean-plugin</artifactId>
    -          <version>3.8</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.codehaus.modello</groupId>
    -          <artifactId>modello-maven-plugin</artifactId>
    -          <version>1.5</version>
    -        </plugin>
    -
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>build-helper-maven-plugin</artifactId>
    -          <version>1.7</version>
    -        </plugin>
    +    <plugins>
     
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>clirr-maven-plugin</artifactId>
    -          <version>2.3</version>
    -        </plugin>
     
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>dashboard-maven-plugin</artifactId>
    -          <version>1.0.0-beta-1</version>
    -        </plugin>
    +                <!--
    +                        <plugin>
    +                          <groupId>com.structure101.java</groupId>
    +                          <artifactId>maven-structure101-plugin</artifactId>
    +                          <version>1.1</version>
    +                        </plugin>
    +                -->
     
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>findbugs-maven-plugin</artifactId>
    -          <version>2.3.2</version>
    -          <configuration>
    -            <xmlOutput>false</xmlOutput>
    -          </configuration>
    -        </plugin>
     
    -        <plugin>
    -          <groupId>org.codehaus.mojo</groupId>
    -          <artifactId>javancss-maven-plugin</artifactId>
    -          <version>2.0</version>
    -        </plugin>
    +                <plugin>
    +                  <groupId>org.apache.maven.plugins</groupId>
    +                  <artifactId>maven-compiler-plugin</artifactId>
    +                  <version>3.2</version>
    +                  <configuration>
    +                    <source>1.7</source>
    --- End diff --
    
    Is this for jdk 1.7? Would this cause incompatibilities in 1.8 when we eventually make the switch?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by tnine <gi...@git.apache.org>.
Github user tnine commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24773634
  
    --- Diff: stack/core/src/main/resources/usergrid-core-context.xml ---
    @@ -69,21 +69,21 @@
     
         <bean id="loadBalancingPolicy" class="me.prettyprint.cassandra.connection.DynamicLoadBalancingPolicy"/>
     
    -	<!--  locking for a single node -->	
    -<!--	<bean name="lockManager" 
    +	<!--  locking for a single node -->
    +<!--	<bean name="lockManager"
             class="org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl" />-->
    -	
    +
     	<!--  hector based locks -->
    -	<!-- Note that if this is deployed in a production cluster, the RF on the keyspace 
    -    MUST be updated to use an odd number for it's replication Factor.  Even numbers can 
    +	<!-- Note that if this is deployed in a production cluster, the RF on the keyspace
    --- End diff --
    
    Agreed.  We need to rework our system system as well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24766502
  
    --- Diff: stack/core/src/main/resources/usergrid-core-context.xml ---
    @@ -69,21 +69,21 @@
     
         <bean id="loadBalancingPolicy" class="me.prettyprint.cassandra.connection.DynamicLoadBalancingPolicy"/>
     
    -	<!--  locking for a single node -->	
    -<!--	<bean name="lockManager" 
    +	<!--  locking for a single node -->
    +<!--	<bean name="lockManager"
             class="org.apache.usergrid.locking.singlenode.SingleNodeLockManagerImpl" />-->
    -	
    +
     	<!--  hector based locks -->
    -	<!-- Note that if this is deployed in a production cluster, the RF on the keyspace 
    -    MUST be updated to use an odd number for it's replication Factor.  Even numbers can 
    +	<!-- Note that if this is deployed in a production cluster, the RF on the keyspace
    --- End diff --
    
    This should probably be documented in bold somewhere as part of a UG setup.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24765926
  
    --- Diff: stack/core/src/main/java/org/apache/usergrid/corepersistence/GuiceFactory.java ---
    @@ -0,0 +1,159 @@
    +/*
    + * 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.corepersistence;
    +
    +
    +import java.util.Properties;
    +
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import org.springframework.beans.BeansException;
    +import org.springframework.beans.factory.FactoryBean;
    +import org.springframework.context.ApplicationContext;
    +import org.springframework.context.ApplicationContextAware;
    +
    +import org.apache.commons.lang.StringUtils;
    +
    +import org.apache.usergrid.persistence.cassandra.CassandraService;
    +
    +import com.google.inject.Guice;
    +import com.google.inject.Injector;
    +import com.google.inject.Singleton;
    +import com.netflix.config.ConfigurationManager;
    +
    +import me.prettyprint.cassandra.service.CassandraHost;
    +
    +
    +/**
    + * Factory for configuring Guice then returning it
    + */
    +@Singleton
    +public class GuiceFactory implements FactoryBean<Injector>, ApplicationContextAware {
    +
    +    private static final Logger logger = LoggerFactory.getLogger( GuiceFactory.class );
    +
    +
    +    private final CassandraService cass;
    +
    +    private final Properties systemProperties;
    +
    +
    +    private ApplicationContext applicationContext;
    +
    +    private Injector injector;
    +
    +
    +
    +    public GuiceFactory( final CassandraService cass, final Properties systemProperties ) {
    +        this.cass = cass;
    +        this.systemProperties = systemProperties;
    +    }
    +
    +
    +    @Override
    +    public Injector getObject() throws Exception {
    +
    +        if ( this.injector != null ) {
    +            return injector;
    +        }
    +
    +
    +        try {
    +
    +            cass.init();
    +            logger.info( "Loading Core Persistence properties" );
    +
    +            String hostsString = "";
    +            CassandraHost[] hosts = cass.getCassandraHostConfigurator().buildCassandraHosts();
    +            if ( hosts.length == 0 ) {
    +                throw new RuntimeException( "Fatal error: no Cassandra hosts configured" );
    +            }
    +            String sep = "";
    +            for ( CassandraHost host : hosts ) {
    +                if ( StringUtils.isEmpty( host.getHost() ) ) {
    +                    throw new RuntimeException( "Fatal error: Cassandra hostname cannot be empty" );
    +                }
    +                hostsString = hostsString + sep + host.getHost();
    +                sep = ",";
    +            }
    +
    +            logger.info( "hostsString: " + hostsString );
    +
    +            Properties cpProps = new Properties();
    +
    +            // Some Usergrid properties must be mapped to Core Persistence properties
    +            cpProps.put( "cassandra.hosts", hostsString );
    +            cpProps.put( "cassandra.port", hosts[0].getPort() );
    +            cpProps.put( "cassandra.cluster_name", cass.getProperties().get( "cassandra.cluster" ) );
    +
    +            String cassRemoteString = ( String ) cass.getProperties().get( "cassandra.use_remote" );
    +            if ( cassRemoteString != null && cassRemoteString.equals( "false" ) ) {
    +                cpProps.put( "cassandra.embedded", "true" );
    +            }
    +            else {
    +                cpProps.put( "cassandra.embedded", "false" );
    +            }
    +
    +            cpProps.put( "collections.keyspace.strategy.class",
    +                cass.getProperties().get( "cassandra.keyspace.strategy" ) );
    +
    +            cpProps.put( "collections.keyspace.strategy.options",
    +                cass.getProperties().get( "cassandra.keyspace.replication" ) );
    +
    +
    +            logger.debug( "Set Cassandra properties for Core Persistence: " + cpProps.toString() );
    +
    +            // Make all Usergrid properties into Core Persistence config
    +            cpProps.putAll( cass.getProperties() );
    +            cpProps.putAll( systemProperties );
    +            //logger.debug("All properties fed to Core Persistence: " + cpProps.toString() );
    +
    +
    +
    +            ConfigurationManager.loadProperties( cpProps );
    +        }
    +        catch ( Exception e ) {
    +            throw new RuntimeException( "Fatal error loading configuration.", e );
    +        }
    +
    +        //this is seriously fugly, and needs removed
    +        injector = Guice.createInjector( new GuiceModule( applicationContext ) );
    --- End diff --
    
    Could we separate this out? It seems like a method called getObject shouldn't do configuration loading either.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-usergrid pull request: Usergrid 273

Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:

    https://github.com/apache/incubator-usergrid/pull/160#discussion_r24766544
  
    --- Diff: stack/core/src/main/resources/usergrid-core-context.xml ---
    @@ -91,7 +91,14 @@
     		<property name="sessionTimeout" value="2000"/>
     		<property name="maxAttempts" value="10"/>
     	</bean>  -->
    -	
    +
    +
    +    <bean id="injector"
    +   		class="org.apache.usergrid.corepersistence.GuiceFactory">
    +   		<constructor-arg ref="cassandraService" />
    +        <constructor-arg ref="properties" />
    +   	</bean>
    +
     	<bean id="cassandraService"
    --- End diff --
    
    (sadpanda) inconsistant spacing


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---