Search in sources :

Example 6 with Person

use of org.hl7.fhir.dstu3.model.Person in project compss by bsc-wdc.

the class Tasks method writePscos.

public static void writePscos(PscoDistroStream<Person> pds, int sleepTime) throws BackendException {
    // Create several new files and add them to the stream when written
    for (int i = 0; i < Main.NUM_OBJECTS; ++i) {
        // Create new object
        String name = BASE_NAME + UUID.randomUUID();
        Person p = new Person(name, i);
        String id = "person_" + UUID.randomUUID().toString();
        p.makePersistent(id);
        // Manually persist object to storage
        try {
            StorageManager.persist(p);
        } catch (StorageException e) {
            System.err.println(ERROR_PERSIST);
            e.printStackTrace();
        }
        // Publish to stream
        System.out.println("SENDING PSCO: " + p.getID());
        System.out.println(" - Name: " + p.getName());
        System.out.println(" - Value: " + p.getAge());
        pds.publish(p);
        // Sleep some time to delay production
        try {
            Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
    // Send end event when finished
    System.out.println("Requesting stream closure");
    try {
        Thread.sleep(sleepTime * 2);
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
    }
    pds.close();
}
Also used : Person(model.Person) StorageException(storage.StorageException)

Example 7 with Person

use of org.hl7.fhir.dstu3.model.Person in project compss by bsc-wdc.

the class Tasks method writePscosList.

public static void writePscosList(PscoDistroStream<Person> pds, int sleepTime) throws BackendException {
    // Create several new files and add them to the stream when written
    for (int i = 0; i < Main.NUM_BATCHES; ++i) {
        // Create list of objects
        List<Person> objects = new ArrayList<>();
        for (int j = 0; j < Main.NUM_OBJECTS; ++j) {
            // Create new object
            String name = BASE_NAME + UUID.randomUUID();
            Person p = new Person(name, i);
            String id = "person_" + UUID.randomUUID().toString();
            p.makePersistent(id);
            // Manually persist object to storage
            try {
                StorageManager.persist(p);
            } catch (StorageException e) {
                System.err.println(ERROR_PERSIST);
                e.printStackTrace();
            }
            objects.add(p);
        }
        // Publish to stream
        System.out.println("SENDING PSCOS: ");
        for (Person p : objects) {
            System.out.println(" - Name: " + p.getName());
            System.out.println(" - Value: " + p.getAge());
        }
        pds.publish(objects);
        // Sleep some time to delay production
        try {
            Thread.sleep(sleepTime);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
    // Send end event when finished
    System.out.println("Requesting stream closure");
    pds.close();
}
Also used : ArrayList(java.util.ArrayList) Person(model.Person) StorageException(storage.StorageException)

Example 8 with Person

use of org.hl7.fhir.dstu3.model.Person in project compss by bsc-wdc.

the class Internal method testPSCOInOut.

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

Example 9 with Person

use of org.hl7.fhir.dstu3.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 10 with Person

use of org.hl7.fhir.dstu3.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)

Aggregations

Test (org.junit.Test)181 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)54 Date (java.util.Date)50 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)48 Person (org.hl7.fhir.r4.model.Person)47 Person (model.Person)44 Person (com.google.api.services.people.v1.model.Person)38 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)37 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)32 Reference (org.hl7.fhir.r4.model.Reference)31 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)30 StringParam (ca.uhn.fhir.rest.param.StringParam)30 VCard (ezvcard.VCard)30 Person (org.openmrs.Person)29 EmailAddress (com.google.api.services.people.v1.model.EmailAddress)23 List (java.util.List)22 Collectors (java.util.stream.Collectors)22 Person (org.hl7.fhir.dstu3.model.Person)22 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)22 DocumentReference (org.hl7.fhir.r4.model.DocumentReference)21