Package com.linkedin.restli.examples.groups.api

Examples of com.linkedin.restli.examples.groups.api.Group


  }

  @Test
  public void testDiffFromNull() throws Exception
  {
    Group g1 = new Group();
    Group g2 = new Group(g1.data().copy());
    g2.setId(42);
    g2.setName("Some Group");
    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$set={id=42, name=Some Group}}");
  }
View Full Code Here


  }

  @Test
  public void testDiffFromNullNested() throws Exception
  {
    Group g1 = new Group();
    Group g2 = new Group(g1.data().copy());
    Location loc = new Location();
    loc.setLatitude(42.0f);
    loc.setLongitude(17.0f);
    g2.setLocation(loc);
    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$set={location={longitude=17.0, latitude=42.0}}}");
  }
View Full Code Here

  }

  @Test
  public void testDiffFromOverwrittenNested() throws Exception
  {
    Group g1 = new Group();
    Location loc1 = new Location();
    loc1.setLatitude(0.0f);
    loc1.setLongitude(0.0f);
    g1.setLocation(loc1);

    Group g2 = new Group(g1.data().copy());
    Location loc2 = new Location();
    loc2.setLatitude(42.0f);
    loc2.setLongitude(17.0f);
    g2.setLocation(loc2);
    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{location={$set={longitude=17.0, latitude=42.0}}}");
  }
View Full Code Here

  }

  @Test
  void testDiffFromNonNull() throws Exception
  {
    Group g1 = new Group();
    g1.setId(17);
    g1.setDescription("Some description");

    Group g2 = new Group(g1.data().copy());
    g2.setId(42);
    g2.setName("Some Group");
    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$set={id=42, name=Some Group}}");
  }
View Full Code Here

  }

  @Test
  void testDiffRemove() throws Exception
  {
    Group g1 = new Group();
    g1.setId(17);
    g1.setDescription("Some description");
    Group g2 = new Group(g1.data().copy());
    g2.removeDescription();
    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$delete=[description]}");
  }
View Full Code Here

  }

  @Test
  void testRoundtripDeleteField() throws Exception
  {
    Group g1 = new Group();
    g1.setId(17);
    g1.setDescription("Some description");
    Group g2 = new Group(g1.data().copy());
    g2.removeDescription();
    PatchTree update = PatchCreator.diff(g1, g2);

    assertEquals(update.toString(), "{$delete=[description]}");
    assertFalse(g1.equals(g2));
View Full Code Here

  }

  @Test
  void testRoundtripAddFields() throws Exception
  {
    Group g1 = new Group();
    g1.setId(17);
    g1.setDescription("Some description");

    Group g2 = new Group(g1.data().copy());
    g2.setId(42);
    g2.setName("Some Group");
    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$set={id=42, name=Some Group}}");
    assertFalse(g1.equals(g2));

    DataComplexProcessor processor = new DataComplexProcessor(new Patch(), update.getDataMap(), g1.data());
View Full Code Here

  }

  @Test
  void testRoundtripAddEscapedField() throws Exception
  {
    Group g1 = new Group();
    g1.setId(17);
    g1.setDescription("Some description");

    Group g2 = new Group(g1.data().copy());
    g2.data().put("$foo", "value");
    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$set={$foo=value}}");
    assertFalse(g1.equals(g2));

    DataComplexProcessor processor = new DataComplexProcessor(new Patch(), update.getDataMap(), g1.data());
View Full Code Here

  }

  @Test(groups = {TestConstants.TESTNG_GROUP_KNOWN_ISSUE})
  void testRoundtripModifyEscapedField() throws Exception
  {
    Group g1 = new Group();
    g1.data().put("$foo", new DataMap());

    Group g2 = new Group(g1.data().copy());
    ((DataMap)g2.data().get("$foo")).put("bar", 42);
    PatchTree update = PatchCreator.diff(g1, g2);
    assertEquals(update.toString(), "{$$foo={$set={bar=42}}}");
    assertFalse(g1.equals(g2));

    DataComplexProcessor processor = new DataComplexProcessor(new Patch(), update.getDataMap(), g1.data());
View Full Code Here

  }

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestGroupsBuilderDataProviderNonEntity")
  public void testEntityCreate(ProtocolVersion version, String expectedUri) throws IOException, RestException
  {
    Request<EmptyRecord> request = new GroupsBuilders().create().input(new Group()).build();
    checkRequestBuilder(request, ResourceMethod.CREATE, CreateResponseDecoder.class, expectedUri, new Group(), version);
  }
View Full Code Here

TOP

Related Classes of com.linkedin.restli.examples.groups.api.Group

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.