Search in sources :

Example 1 with Person

use of sqlite.feature.many2many.case7.Person in project modello by codehaus-plexus.

the class OneToManyAssociationVerifier method testMap.

private void testMap() {
    ListSetMapProperties foo = new ListSetMapProperties();
    Integer i1 = new Integer(1);
    Integer i2 = new Integer(2);
    Person person1 = new Person();
    Person person2 = new Person();
    foo.addMap(i1, person1);
    Assert.assertEquals("map.size", 1, foo.getMap().size());
    foo.addMap(i1, person1);
    Assert.assertEquals("map.size", 1, foo.getMap().size());
    foo.addMap(i2, person2);
    Assert.assertEquals("map.size", 2, foo.getMap().size());
}
Also used : ListSetMapProperties(org.codehaus.modello.association.package1.ListSetMapProperties) Person(org.codehaus.modello.association.package1.Person)

Example 2 with Person

use of sqlite.feature.many2many.case7.Person in project modello by codehaus-plexus.

the class OneToManyAssociationVerifier method testProperty.

private void testProperty() {
    ListSetMapProperties foo = new ListSetMapProperties();
    String i1 = "1";
    String i2 = "2";
    Person person1 = new Person();
    Person person2 = new Person();
    foo.addProperty(i1, person1);
    Assert.assertEquals("properties.size", 1, foo.getProperties().size());
    foo.addProperty(i1, person1);
    Assert.assertEquals("properties.size", 1, foo.getProperties().size());
    foo.addProperty(i2, person2);
    Assert.assertEquals("properties.size", 2, foo.getProperties().size());
}
Also used : ListSetMapProperties(org.codehaus.modello.association.package1.ListSetMapProperties) Person(org.codehaus.modello.association.package1.Person)

Example 3 with Person

use of sqlite.feature.many2many.case7.Person in project modello by codehaus-plexus.

the class OneToManyAssociationVerifier method verify.

public void verify() {
    // ----------------------------------------------------------------------
    // 
    // ----------------------------------------------------------------------
    Person person = new Person();
    Location location = new Location();
    location.getPersons().add(person);
    Assert.assertNotNull("Location.persons == null", location.getPersons());
    Assert.assertEquals("Location.persons.length != 1", 1, location.getPersons().size());
    Assert.assertEquals("Location.persons[0]", person, location.getPersons().get(0));
    // ----------------------------------------------------------------------
    // 
    // ----------------------------------------------------------------------
    person = new Person();
    location = new Location();
    person.setLocation(location);
    Assert.assertNotNull("Location.persons == null", location.getPersons());
    Assert.assertEquals("Location.persons.length != 1", 1, location.getPersons().size());
    Assert.assertEquals("Location.persons[0]", person, location.getPersons().get(0));
    // ----------------------------------------------------------------------
    // 
    // ----------------------------------------------------------------------
    testList();
    testMap();
    testProperty();
    testSet();
}
Also used : Person(org.codehaus.modello.association.package1.Person) Location(org.codehaus.modello.association.package2.Location)

Example 4 with Person

use of sqlite.feature.many2many.case7.Person in project modello by codehaus-plexus.

the class InterfaceAssociationVerifier method verify.

public void verify() throws Exception {
    Location location = new Location();
    IPerson person = new Person();
    // check List<IPerson> persons attribute getters/setters
    location.addPerson(person);
    List<IPerson> persons = location.getPersons();
    location.setPersons(new ArrayList<IPerson>(persons));
    location.removePerson(person);
    // check Set<IPerson> relatives attribute getters/setters
    location.addRelative(person);
    Set<IPerson> relatives = location.getRelatives();
    location.setRelatives(new HashSet<IPerson>(relatives));
    location.removeRelative(person);
    IPerson mother = new Person();
    location.setMother(mother);
    Assert.assertNotNull(location.getMother());
    location.setMother(null);
    Assert.assertNull(location.getMother());
}
Also used : IPerson(org.codehaus.modello.ifaceassociation.package1.IPerson) IPerson(org.codehaus.modello.ifaceassociation.package1.IPerson) Person(org.codehaus.modello.ifaceassociation.package1.Person) Location(org.codehaus.modello.ifaceassociation.package1.Location)

Example 5 with Person

use of sqlite.feature.many2many.case7.Person in project universal-db by teamapps-org.

the class DeleteTest method testDeleteRecord.

@Test
public void testDeleteRecord() {
    Person.getAll().forEach(p -> p.delete());
    Person p1 = Person.create().setLastName("p1").save();
    assertTrue(p1.isStored());
    assertEquals(1, Person.getCount());
    p1.delete();
    assertEquals(0, Person.getCount());
    assertFalse(p1.isStored());
}
Also used : Person(org.teamapps.datamodel.testdb1.Person) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)81 Person (org.orcid.jaxb.model.record_v2.Person)60 Email (org.orcid.jaxb.model.record_v2.Email)36 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)32 Address (org.orcid.jaxb.model.record_v2.Address)31 Emails (org.orcid.jaxb.model.record_v2.Emails)31 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)31 Keyword (org.orcid.jaxb.model.record_v2.Keyword)30 Name (org.orcid.jaxb.model.record_v2.Name)28 Addresses (org.orcid.jaxb.model.record_v2.Addresses)26 Biography (org.orcid.jaxb.model.record_v2.Biography)26 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)26 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)26 Keywords (org.orcid.jaxb.model.record_v2.Keywords)25 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)25 Record (org.orcid.jaxb.model.record_v2.Record)22 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)20 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)15 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)14