Search in sources :

Example 41 with Person

use of com.google.api.services.people.v1.model.Person in project compss by bsc-wdc.

the class Internal method testPSCOInOutTaskPersisted.

private static void testPSCOInOutTaskPersisted() {
    Person p = new Person("PName2", 2, 2);
    String id = InternalImpl.taskPSCOInOutTaskPersisted(p);
    String name = p.getName();
    int age = p.getAge();
    int numC = p.getNumComputers();
    System.out.println("[LOG][PSCO_INOUT_TP] Person " + name + " with age " + age + " has " + numC + " computers");
    System.out.println("[LOG][PSCO_INOUT_TP] BeginId = " + id + " EndId = " + p.getID());
}
Also used : Person(model.Person)

Example 42 with Person

use of com.google.api.services.people.v1.model.Person in project compss by bsc-wdc.

the class Internal method testPSCOTargetTaskPersisted.

private static void testPSCOTargetTaskPersisted() {
    String id = "person_" + UUID.randomUUID().toString();
    Person p = new Person("PName1", 1, 1);
    p.taskPSCOTargetTaskPersisted(id);
    String name = p.getName();
    int age = p.getAge();
    int numC = p.getNumComputers();
    System.out.println("[LOG][PSCO_TARGET_TP] Person " + name + " with age " + age + " has " + numC + " computers");
    System.out.println("[LOG][PSCO_TARGET_TP] BeginId = null EndId = " + p.getID());
}
Also used : Person(model.Person)

Example 43 with Person

use of com.google.api.services.people.v1.model.Person in project compss by bsc-wdc.

the class Internal method testPSCOTarget.

private static void testPSCOTarget() {
    String id = "person_" + UUID.randomUUID().toString();
    Person p = new Person("PName1", 1, 1);
    p.makePersistent(id);
    // Invoke 2 times to check if parameter is well returned from worker
    p.taskPSCOTarget();
    p.taskPSCOTarget();
    String name = p.getName();
    int age = p.getAge();
    int numC = p.getNumComputers();
    System.out.println("[LOG][PSCO_TARGET] Person " + name + " with age " + age + " has " + numC + " computers");
    System.out.println("[LOG][PSCO_TARGET] BeginId = " + id + " EndId = " + p.getID());
}
Also used : Person(model.Person)

Example 44 with Person

use of com.google.api.services.people.v1.model.Person in project compss by bsc-wdc.

the class Internal method testPSCOReturnNoTaskPersisted.

private static void testPSCOReturnNoTaskPersisted() {
    Person p = InternalImpl.taskPSCOReturnNoTaskPersisted("PName3", 3, 3);
    String name = p.getName();
    int age = p.getAge();
    int numC = p.getNumComputers();
    System.out.println("[LOG][PSCO_RETURN_NTP] Person " + name + " with age " + age + " has " + numC + " computers");
    System.out.println("[LOG][PSCO_RETURN_NTP] BeginId = null EndId = " + p.getID());
}
Also used : Person(model.Person)

Example 45 with Person

use of com.google.api.services.people.v1.model.Person in project compss by bsc-wdc.

the class Internal method testMergeReduce.

public static void testMergeReduce() {
    // Init
    Person[] people = new Person[4];
    for (int i = 0; i < people.length; ++i) {
        String id = "person_" + UUID.randomUUID().toString();
        System.out.println("[LOG][PSCO_MR] Person " + i + " BeginId = " + id);
        people[i] = new Person("PName" + i, i, i);
        people[i].makePersistent(id);
    }
    // Map
    for (int i = 0; i < people.length; ++i) {
        people[i] = InternalImpl.taskMap("NewName" + i, people[i]);
    }
    // Reduce
    LinkedList<Integer> q = new LinkedList<Integer>();
    for (int i = 0; i < people.length; i++) {
        q.add(i);
    }
    int x = 0;
    while (!q.isEmpty()) {
        x = q.poll();
        int y;
        if (!q.isEmpty()) {
            y = q.poll();
            people[x] = InternalImpl.taskReduce(people[x], people[y]);
            q.add(x);
        }
    }
    // Get (sync) and write result
    Person p1 = people[0];
    String name = p1.getName();
    int age = p1.getAge();
    int numC = p1.getNumComputers();
    System.out.println("[LOG][PSCO_MR] Person " + name + " with age " + age + " has " + numC + " computers");
    System.out.println("[LOG][PSCO_MR] EndId = " + p1.getID());
}
Also used : Person(model.Person) LinkedList(java.util.LinkedList)

Aggregations

Person (com.google.api.services.people.v1.model.Person)25 VCard (ezvcard.VCard)20 Test (org.junit.Test)16 EmailAddress (com.google.api.services.people.v1.model.EmailAddress)15 Name (com.google.api.services.people.v1.model.Name)13 PhoneNumber (com.google.api.services.people.v1.model.PhoneNumber)13 Email (ezvcard.property.Email)13 StructuredName (ezvcard.property.StructuredName)13 Telephone (ezvcard.property.Telephone)13 Person (model.Person)13 List (java.util.List)12 Collectors (java.util.stream.Collectors)12 Truth.assertThat (com.google.common.truth.Truth.assertThat)10 Pair (com.google.gdata.util.common.base.Pair)10 Collections (java.util.Collections)10 Function (java.util.function.Function)10 Address (com.google.api.services.people.v1.model.Address)9 Nullable (com.google.gdata.util.common.base.Nullable)8 Before (org.junit.Before)8 LinkedList (java.util.LinkedList)6