You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/08/22 16:16:23 UTC

[87/95] [abbrv] git commit: completed parallels with RxJava

completed parallels with RxJava


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b0e333fe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b0e333fe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b0e333fe

Branch: refs/heads/import-feature
Commit: b0e333fef9d50b217f7ab27338759c0b567e3868
Parents: d4fb25b
Author: Harish Rajagopal <hr...@apigee.com>
Authored: Tue Aug 5 15:29:59 2014 -0700
Committer: Harish Rajagopal <hr...@apigee.com>
Committed: Tue Aug 5 15:29:59 2014 -0700

----------------------------------------------------------------------
 .../management/importUG/ImportServiceImpl.java  | 26 ++------------------
 .../management/cassandra/ImportServiceIT.java   | 10 ++++----
 2 files changed, 7 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b0e333fe/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java
index 901b396..c76420e 100644
--- a/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/management/importUG/ImportServiceImpl.java
@@ -560,20 +560,6 @@ public class ImportServiceImpl implements ImportService {
             public void call(WriteEvent writeEvent) {
                 writeEvent.doWrite(em);
             }
-//            @Override
-//            public void call(EntityWrapper jsonEntity){
-//                try {
-//                            em.create(jsonEntity.entityUuid, jsonEntity.entityType, jsonEntity.properties);
-//                            em.getRef(jsonEntity.entityUuid);
-//
-//
-//                    System.out.println("Emitting UUID " + jsonEntity.entityUuid + " on thread " + Thread.currentThread().getName() );
-//
-//                }catch (Exception e) {
-//                    System.out.println("something went wrong while creating this - " + e);
-//
-//                }
-//            }
 
         };
 
@@ -609,7 +595,6 @@ public class ImportServiceImpl implements ImportService {
         public void doWrite(EntityManager em) {
             try {
                 em.create(entityUuid, entityType, properties);
-                em.getRef(entityUuid);
                 System.out.println("Emitting UUID " + entityUuid + " on thread " + Thread.currentThread().getName() );
                 }catch (Exception e) {
                     System.out.println("something went wrong while creating this - " + e);
@@ -707,7 +692,6 @@ public class ImportServiceImpl implements ImportService {
                                     EntityRef entryRef = new SimpleEntityRef(UUID.fromString(entryId));
                                     entityWrapper = new ConnectionEvent(ownerEntityRef, connectionType, entryRef);
                                     subscriber.onNext(entityWrapper);
-                                    subscriber.onCompleted();
                                 }
                             }
                         }
@@ -721,11 +705,11 @@ public class ImportServiceImpl implements ImportService {
 
                                 jp.nextToken();
 
-                                @SuppressWarnings("unchecked") Map<String, Object> dictionary = jp.readValueAs(HashMap.class);
+                                Map<String, Object> dictionary = jp.readValueAs(HashMap.class);
                                 entityWrapper = new DictionaryEvent(ownerEntityRef, dictionaryName, dictionary);
                                 subscriber.onNext(entityWrapper);
-                                subscriber.onCompleted();
                             }
+                            subscriber.onCompleted();
                         } else {
                             // Regular collections
                             jp.nextToken(); // START_OBJECT
@@ -752,8 +736,6 @@ public class ImportServiceImpl implements ImportService {
                             entityWrapper = new EntityEvent(UUID.fromString(entityUuid), entityType, properties);
                             subscriber.onNext(entityWrapper);
                             ownerEntityRef = new SimpleEntityRef(entityType,UUID.fromString(entityUuid));
-                          //  ownerEntityRef = em.getRef(UUID.fromString(entityUuid));
-                            subscriber.onCompleted();
                         }
                     } catch (IllegalArgumentException e) {
                         // skip illegal entity UUID and go to next one
@@ -777,12 +759,8 @@ public class ImportServiceImpl implements ImportService {
                         entityCount = 0;
                     }
                 }
-
-
             } catch (Exception e) {
                 System.out.println("something went wrong in observable json parser - " + e);
-
-
             }
 
         }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b0e333fe/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ImportServiceIT.java
----------------------------------------------------------------------
diff --git a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ImportServiceIT.java b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ImportServiceIT.java
index 04d1310..7e1f8cc 100644
--- a/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ImportServiceIT.java
+++ b/stack/services/src/test/java/org/apache/usergrid/management/cassandra/ImportServiceIT.java
@@ -124,9 +124,9 @@ public class ImportServiceIT {
         //creates entities
         for ( int i = 0; i < 5; i++ ) {
             userProperties = new LinkedHashMap<String, Object>();
-            userProperties.put( "username", "yabauser" + i );
-            userProperties.put( "email", "yavauser" + i + "@test.com" );
-            entity[i] = em.create( "yabas", userProperties );
+            userProperties.put( "username", "user" + i );
+            userProperties.put( "email", "user" + i + "@test.com" );
+            entity[i] = em.create( "users", userProperties );
         }
 
         //creates test connections between first 2 users
@@ -140,7 +140,7 @@ public class ImportServiceIT {
 
         payload.put( "organizationId",  organization.getUuid());
         payload.put( "applicationId", applicationId );
-        payload.put("collectionName", "yabas");
+        payload.put("collectionName", "users");
 
         // schdeule the export job
         UUID exportUUID = exportService.schedule( payload );
@@ -183,7 +183,7 @@ public class ImportServiceIT {
 
             //check if entities are actually updated i.e. created and modified should be different
             //EntityManager em = setup.getEmf().getEntityManager(applicationId);
-            Results collections = em.getCollection(applicationId, "yabas", null, Results.Level.ALL_PROPERTIES);
+            Results collections = em.getCollection(applicationId, "users", null, Results.Level.ALL_PROPERTIES);
             List<Entity> entities = collections.getEntities();
 
             // check if connections are created for only the 1st 2 entities in user collection