Package org.apache.avro.ipc.specific

Examples of org.apache.avro.ipc.specific.Person


    Assert.assertFalse(builder.hasFriends());
    Assert.assertNull(builder.getFriends());
    Assert.assertFalse(builder.hasLanguages());
    Assert.assertNull(builder.getLanguages());
   
    Person person = builder.build();
    Assert.assertEquals("James Gosling", person.getName().toString());
    Assert.assertEquals(new Integer(1955), person.getYearOfBirth());
    Assert.assertEquals("US", person.getCountry().toString())// country should default to "US"
    Assert.assertEquals("CA", person.getState().toString());
    Assert.assertNotNull(person.getFriends())// friends should default to an empty list
    Assert.assertEquals(0, person.getFriends().size());
    Assert.assertNotNull(person.getLanguages()); // Languages should now be "English" and "Java"
    Assert.assertEquals(2, person.getLanguages().size());
    Assert.assertEquals("English", person.getLanguages().get(0).toString());
    Assert.assertEquals("Java", person.getLanguages().get(1).toString());
   
    // Test copy constructors:
    Assert.assertEquals(builder, Person.newBuilder(builder));
    Assert.assertEquals(person, Person.newBuilder(person).build());
   
    Person.Builder builderCopy = Person.newBuilder(person);
    Assert.assertEquals("James Gosling", builderCopy.getName().toString());
    Assert.assertEquals(new Integer(1955), builderCopy.getYearOfBirth());
    Assert.assertEquals("US", builderCopy.getCountry().toString())// country should default to "US"
    Assert.assertEquals("CA", builderCopy.getState().toString());
    Assert.assertNotNull(builderCopy.getFriends())// friends should default to an empty list
    Assert.assertEquals(0, builderCopy.getFriends().size());
   
    // Test clearing fields:
    builderCopy.clearFriends().clearCountry();
    Assert.assertFalse(builderCopy.hasFriends());
    Assert.assertFalse(builderCopy.hasCountry());
    Assert.assertNull(builderCopy.getFriends());
    Assert.assertNull(builderCopy.getCountry());
    Person person2 = builderCopy.build();
    Assert.assertNotNull(person2.getFriends());
    Assert.assertTrue(person2.getFriends().isEmpty());
  }
View Full Code Here


    int count = 1000000;
    List<Person> friends = new ArrayList<Person>(0);
    List<String> languages = new ArrayList<String>(Arrays.asList(new String[] { "English", "Java" }));
    long startTimeNanos = System.nanoTime();
    for (int ii = 0; ii < count; ii++) {
      Person person = new Person();
      person.name = "James Gosling";
      person.year_of_birth = 1955;
      person.state = "CA";
      person.country = "US";
      person.friends = friends;
View Full Code Here

    Assert.assertFalse(builder.hasFriends());
    Assert.assertNull(builder.getFriends());
    Assert.assertFalse(builder.hasLanguages());
    Assert.assertNull(builder.getLanguages());
   
    Person person = builder.build();
    Assert.assertEquals("James Gosling", person.getName().toString());
    Assert.assertEquals(new Integer(1955), person.getYearOfBirth());
    Assert.assertEquals("US", person.getCountry().toString())// country should default to "US"
    Assert.assertEquals("CA", person.getState().toString());
    Assert.assertNotNull(person.getFriends())// friends should default to an empty list
    Assert.assertEquals(0, person.getFriends().size());
    Assert.assertNotNull(person.getLanguages()); // Languages should now be "English" and "Java"
    Assert.assertEquals(2, person.getLanguages().size());
    Assert.assertEquals("English", person.getLanguages().get(0).toString());
    Assert.assertEquals("Java", person.getLanguages().get(1).toString());
   
    // Test copy constructors:
    Assert.assertEquals(builder, Person.newBuilder(builder));
    Assert.assertEquals(person, Person.newBuilder(person).build());
   
    Person.Builder builderCopy = Person.newBuilder(person);
    Assert.assertEquals("James Gosling", builderCopy.getName().toString());
    Assert.assertEquals(new Integer(1955), builderCopy.getYearOfBirth());
    Assert.assertEquals("US", builderCopy.getCountry().toString())// country should default to "US"
    Assert.assertEquals("CA", builderCopy.getState().toString());
    Assert.assertNotNull(builderCopy.getFriends())// friends should default to an empty list
    Assert.assertEquals(0, builderCopy.getFriends().size());
   
    // Test clearing fields:
    builderCopy.clearFriends().clearCountry();
    Assert.assertFalse(builderCopy.hasFriends());
    Assert.assertFalse(builderCopy.hasCountry());
    Assert.assertNull(builderCopy.getFriends());
    Assert.assertNull(builderCopy.getCountry());
    Person person2 = builderCopy.build();
    Assert.assertNotNull(person2.getFriends());
    Assert.assertTrue(person2.getFriends().isEmpty());
  }
View Full Code Here

    int count = 1000000;
    List<Person> friends = new ArrayList<Person>(0);
    List<String> languages = new ArrayList<String>(Arrays.asList(new String[] { "English", "Java" }));
    long startTimeNanos = System.nanoTime();
    for (int ii = 0; ii < count; ii++) {
      Person person = new Person();
      person.name = "James Gosling";
      person.year_of_birth = 1955;
      person.state = "CA";
      person.country = "US";
      person.friends = friends;
View Full Code Here

    Assert.assertFalse(builder.hasFriends());
    Assert.assertNull(builder.getFriends());
    Assert.assertFalse(builder.hasLanguages());
    Assert.assertNull(builder.getLanguages());
   
    Person person = builder.build();
    Assert.assertEquals("James Gosling", person.getName().toString());
    Assert.assertEquals(new Integer(1955), person.getYearOfBirth());
    Assert.assertEquals("US", person.getCountry().toString())// country should default to "US"
    Assert.assertEquals("CA", person.getState().toString());
    Assert.assertNotNull(person.getFriends())// friends should default to an empty list
    Assert.assertEquals(0, person.getFriends().size());
    Assert.assertNotNull(person.getLanguages()); // Languages should now be "English" and "Java"
    Assert.assertEquals(2, person.getLanguages().size());
    Assert.assertEquals("English", person.getLanguages().get(0).toString());
    Assert.assertEquals("Java", person.getLanguages().get(1).toString());
   
    // Test copy constructors:
    Assert.assertEquals(builder, Person.newBuilder(builder));
    Assert.assertEquals(person, Person.newBuilder(person).build());
   
    Person.Builder builderCopy = Person.newBuilder(person);
    Assert.assertEquals("James Gosling", builderCopy.getName().toString());
    Assert.assertEquals(new Integer(1955), builderCopy.getYearOfBirth());
    Assert.assertEquals("US", builderCopy.getCountry().toString())// country should default to "US"
    Assert.assertEquals("CA", builderCopy.getState().toString());
    Assert.assertNotNull(builderCopy.getFriends())// friends should default to an empty list
    Assert.assertEquals(0, builderCopy.getFriends().size());
   
    // Test clearing fields:
    builderCopy.clearFriends().clearCountry();
    Assert.assertFalse(builderCopy.hasFriends());
    Assert.assertFalse(builderCopy.hasCountry());
    Assert.assertNull(builderCopy.getFriends());
    Assert.assertNull(builderCopy.getCountry());
    Person person2 = builderCopy.build();
    Assert.assertNotNull(person2.getFriends());
    Assert.assertTrue(person2.getFriends().isEmpty());
  }
View Full Code Here

    int count = 1000000;
    List<Person> friends = new ArrayList<Person>(0);
    List<String> languages = new ArrayList<String>(Arrays.asList(new String[] { "English", "Java" }));
    long startTimeNanos = System.nanoTime();
    for (int ii = 0; ii < count; ii++) {
      Person person = new Person();
      person.name = "James Gosling";
      person.year_of_birth = 1955;
      person.state = "CA";
      person.country = "US";
      person.friends = friends;
View Full Code Here

    Assert.assertFalse(builder.hasFriends());
    Assert.assertNull(builder.getFriends());
    Assert.assertFalse(builder.hasLanguages());
    Assert.assertNull(builder.getLanguages());
   
    Person person = builder.build();
    Assert.assertEquals("James Gosling", person.getName().toString());
    Assert.assertEquals(new Integer(1955), person.getYearOfBirth());
    Assert.assertEquals("US", person.getCountry().toString())// country should default to "US"
    Assert.assertEquals("CA", person.getState().toString());
    Assert.assertNotNull(person.getFriends())// friends should default to an empty list
    Assert.assertEquals(0, person.getFriends().size());
    Assert.assertNotNull(person.getLanguages()); // Languages should now be "English" and "Java"
    Assert.assertEquals(2, person.getLanguages().size());
    Assert.assertEquals("English", person.getLanguages().get(0).toString());
    Assert.assertEquals("Java", person.getLanguages().get(1).toString());
   
    // Test copy constructors:
    Assert.assertEquals(builder, Person.newBuilder(builder));
    Assert.assertEquals(person, Person.newBuilder(person).build());
   
    Person.Builder builderCopy = Person.newBuilder(person);
    Assert.assertEquals("James Gosling", builderCopy.getName().toString());
    Assert.assertEquals(new Integer(1955), builderCopy.getYearOfBirth());
    Assert.assertEquals("US", builderCopy.getCountry().toString())// country should default to "US"
    Assert.assertEquals("CA", builderCopy.getState().toString());
    Assert.assertNotNull(builderCopy.getFriends())// friends should default to an empty list
    Assert.assertEquals(0, builderCopy.getFriends().size());
   
    // Test clearing fields:
    builderCopy.clearFriends().clearCountry();
    Assert.assertFalse(builderCopy.hasFriends());
    Assert.assertFalse(builderCopy.hasCountry());
    Assert.assertNull(builderCopy.getFriends());
    Assert.assertNull(builderCopy.getCountry());
    Person person2 = builderCopy.build();
    Assert.assertNotNull(person2.getFriends());
    Assert.assertTrue(person2.getFriends().isEmpty());
  }
View Full Code Here

    int count = 1000000;
    List<Person> friends = new ArrayList<Person>(0);
    List<CharSequence> languages = new ArrayList<CharSequence>(Arrays.asList(new CharSequence[] { "English", "Java" }));
    long startTimeNanos = System.nanoTime();
    for (int ii = 0; ii < count; ii++) {
      Person person = new Person();
      person.name = "James Gosling";
      person.year_of_birth = 1955;
      person.state = "CA";
      person.country = "US";
      person.friends = friends;
View Full Code Here

TOP

Related Classes of org.apache.avro.ipc.specific.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.