Program: 4541
Project: 4541
Buggy source:
@Test public void testProperties() throws Exception {
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getProperties(app1).size());
    Assert.assertEquals(0,dataset.getProperties(flow1).size());
    Assert.assertEquals(0,dataset.getProperties(dataset1).size());
    Assert.assertEquals(0,dataset.getProperties(stream1).size());
    Assert.assertEquals(0,dataset.getProperties(view1).size());
    Assert.assertEquals(0,dataset.getProperties(artifact1).size());
    Assert.assertEquals(0,dataset.getProperties(fileEntity).size());
    Assert.assertEquals(0,dataset.getProperties(partitionFileEntity).size());
    Assert.assertEquals(0,dataset.getProperties(jarEntity).size());
  }
);
  txnl.execute(() -> {
    dataset.setProperty(app1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(dataset1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(stream1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(stream1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(view1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(view1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(artifact1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(artifact1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(fileEntity,"String_Node_Str","String_Node_Str");
    dataset.setProperty(partitionFileEntity,"String_Node_Str","String_Node_Str");
    dataset.setProperty(jarEntity,"String_Node_Str","String_Node_Str");
  }
);
  txnl.execute(() -> {
    Map<String,String> properties=dataset.getProperties(app1);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),properties);
  }
);
  txnl.execute(() -> dataset.removeProperties(app1,"String_Node_Str"));
  txnl.execute(() -> {
    Map<String,String> properties=dataset.getProperties(jarEntity);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),properties);
  }
);
  txnl.execute(() -> dataset.removeProperties(jarEntity,"String_Node_Str"));
  txnl.execute(() -> {
    Assert.assertNull(dataset.getProperty(app1,"String_Node_Str"));
    MetadataEntry result=dataset.getProperty(flow1,"String_Node_Str");
    MetadataEntry expected=new MetadataEntry(flow1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),dataset.getProperties(flow1));
  }
);
  txnl.execute(() -> dataset.removeProperties(flow1,"String_Node_Str"));
  txnl.execute(() -> {
    Map<String,String> properties=dataset.getProperties(flow1);
    Assert.assertEquals(1,properties.size());
    Assert.assertEquals("String_Node_Str",properties.get("String_Node_Str"));
  }
);
  txnl.execute(() -> dataset.removeProperties(flow1));
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getProperties(flow1).size());
    Assert.assertEquals(0,dataset.getProperties(jarEntity).size());
    MetadataEntry expected=new MetadataEntry(dataset1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,dataset.getProperty(dataset1,"String_Node_Str"));
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),dataset.getProperties(stream1));
    Map<String,String> properties=dataset.getProperties(artifact1);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),properties);
    MetadataEntry result=dataset.getProperty(artifact1,"String_Node_Str");
    expected=new MetadataEntry(artifact1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
    properties=dataset.getProperties(view1);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),properties);
    result=dataset.getProperty(view1,"String_Node_Str");
    expected=new MetadataEntry(view1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
    result=dataset.getProperty(fileEntity,"String_Node_Str");
    expected=new MetadataEntry(fileEntity,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
    result=dataset.getProperty(partitionFileEntity,"String_Node_Str");
    expected=new MetadataEntry(partitionFileEntity,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
  }
);
  txnl.execute(() -> dataset.setProperty(stream1,"String_Node_Str","String_Node_Str"));
  txnl.execute(() -> Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),dataset.getProperties(stream1)));
  txnl.execute(() -> {
    dataset.removeProperties(app1);
    dataset.removeProperties(flow1);
    dataset.removeProperties(dataset1);
    dataset.removeProperties(stream1);
    dataset.removeProperties(artifact1);
    dataset.removeProperties(view1);
    dataset.removeProperties(fileEntity);
    dataset.removeProperties(partitionFileEntity);
  }
);
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getProperties(app1).size());
    Assert.assertEquals(0,dataset.getProperties(flow1).size());
    Assert.assertEquals(0,dataset.getProperties(dataset1).size());
    Assert.assertEquals(0,dataset.getProperties(stream1).size());
    Assert.assertEquals(0,dataset.getProperties(view1).size());
    Assert.assertEquals(0,dataset.getProperties(artifact1).size());
    Assert.assertEquals(0,dataset.getProperties(fileEntity).size());
    Assert.assertEquals(0,dataset.getProperties(partitionFileEntity).size());
    Assert.assertEquals(0,dataset.getProperties(jarEntity).size());
  }
);
}

Fixed version (ground truth):
@Test public void testProperties() throws Exception {
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getProperties(app1).size());
    Assert.assertEquals(0,dataset.getProperties(flow1).size());
    Assert.assertEquals(0,dataset.getProperties(dataset1).size());
    Assert.assertEquals(0,dataset.getProperties(stream1).size());
    Assert.assertEquals(0,dataset.getProperties(view1).size());
    Assert.assertEquals(0,dataset.getProperties(artifact1).size());
    Assert.assertEquals(0,dataset.getProperties(fileEntity).size());
    Assert.assertEquals(0,dataset.getProperties(partitionFileEntity).size());
    Assert.assertEquals(0,dataset.getProperties(jarEntity).size());
  }
);
  txnl.execute(() -> {
    dataset.setProperty(app1,"String_Node_Str","String_Node_Str");
    MetadataChange metadataChange=dataset.setProperty(flow1,Collections.emptyMap());
    Assert.assertEquals(metadataChange.getExisting(),new Metadata(flow1,Collections.emptyMap(),Collections.emptySet()));
    Assert.assertEquals(metadataChange.getLatest(),new Metadata(flow1,Collections.emptyMap(),Collections.emptySet()));
    metadataChange=dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(new Metadata(flow1),metadataChange.getExisting());
    Assert.assertEquals(new Metadata(flow1,ImmutableMap.of("String_Node_Str","String_Node_Str"),Collections.emptySet()),metadataChange.getLatest());
    metadataChange=dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(new Metadata(flow1,ImmutableMap.of("String_Node_Str","String_Node_Str"),Collections.emptySet()),metadataChange.getExisting());
    Assert.assertEquals(new Metadata(flow1,ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),Collections.emptySet()),metadataChange.getLatest());
    dataset.setProperty(dataset1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(stream1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(stream1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(view1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(view1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(artifact1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(artifact1,"String_Node_Str","String_Node_Str");
    dataset.setProperty(fileEntity,"String_Node_Str","String_Node_Str");
    dataset.setProperty(partitionFileEntity,"String_Node_Str","String_Node_Str");
    dataset.setProperty(jarEntity,"String_Node_Str","String_Node_Str");
  }
);
  txnl.execute(() -> {
    Map<String,String> properties=dataset.getProperties(app1);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),properties);
  }
);
  txnl.execute(() -> dataset.removeProperties(app1,"String_Node_Str"));
  txnl.execute(() -> {
    Map<String,String> properties=dataset.getProperties(jarEntity);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str"),properties);
  }
);
  txnl.execute(() -> dataset.removeProperties(jarEntity,"String_Node_Str"));
  txnl.execute(() -> {
    Assert.assertNull(dataset.getProperty(app1,"String_Node_Str"));
    MetadataEntry result=dataset.getProperty(flow1,"String_Node_Str");
    MetadataEntry expected=new MetadataEntry(flow1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),dataset.getProperties(flow1));
  }
);
  txnl.execute(() -> dataset.removeProperties(flow1,"String_Node_Str"));
  txnl.execute(() -> {
    Map<String,String> properties=dataset.getProperties(flow1);
    Assert.assertEquals(1,properties.size());
    Assert.assertEquals("String_Node_Str",properties.get("String_Node_Str"));
  }
);
  txnl.execute(() -> dataset.removeProperties(flow1));
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getProperties(flow1).size());
    Assert.assertEquals(0,dataset.getProperties(jarEntity).size());
    MetadataEntry expected=new MetadataEntry(dataset1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,dataset.getProperty(dataset1,"String_Node_Str"));
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),dataset.getProperties(stream1));
    Map<String,String> properties=dataset.getProperties(artifact1);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),properties);
    MetadataEntry result=dataset.getProperty(artifact1,"String_Node_Str");
    expected=new MetadataEntry(artifact1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
    properties=dataset.getProperties(view1);
    Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),properties);
    result=dataset.getProperty(view1,"String_Node_Str");
    expected=new MetadataEntry(view1,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
    result=dataset.getProperty(fileEntity,"String_Node_Str");
    expected=new MetadataEntry(fileEntity,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
    result=dataset.getProperty(partitionFileEntity,"String_Node_Str");
    expected=new MetadataEntry(partitionFileEntity,"String_Node_Str","String_Node_Str");
    Assert.assertEquals(expected,result);
  }
);
  txnl.execute(() -> dataset.setProperty(stream1,"String_Node_Str","String_Node_Str"));
  txnl.execute(() -> Assert.assertEquals(ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),dataset.getProperties(stream1)));
  txnl.execute(() -> {
    dataset.removeProperties(app1);
    dataset.removeProperties(flow1);
    dataset.removeProperties(dataset1);
    dataset.removeProperties(stream1);
    dataset.removeProperties(artifact1);
    dataset.removeProperties(view1);
    dataset.removeProperties(fileEntity);
    dataset.removeProperties(partitionFileEntity);
  }
);
  txnl.execute(() -> {
    Assert.assertEquals(0,dataset.getProperties(app1).size());
    Assert.assertEquals(0,dataset.getProperties(flow1).size());
    Assert.assertEquals(0,dataset.getProperties(dataset1).size());
    Assert.assertEquals(0,dataset.getProperties(stream1).size());
    Assert.assertEquals(0,dataset.getProperties(view1).size());
    Assert.assertEquals(0,dataset.getProperties(artifact1).size());
    Assert.assertEquals(0,dataset.getProperties(fileEntity).size());
    Assert.assertEquals(0,dataset.getProperties(partitionFileEntity).size());
    Assert.assertEquals(0,dataset.getProperties(jarEntity).size());
  }
);
}