@Test
public void testDeleteHistoricalLegacyStreamingPropertyValueData_mixOfOldAndNew() throws Exception {
String vertexId = "v1";
graph.prepareVertex(vertexId, VISIBILITY_EMPTY)
.save(AUTHORIZATIONS_EMPTY);
graph.flush();
long timestamp = new Date().getTime();
String propertyKey = "prefix";
String propertyName = "prop1";
String propertyValue1 = "Hello1";
String propertyValue2 = "Hello2";
addLegacySPVData(vertexId, timestamp - 100, propertyKey, propertyName, propertyValue1);
StreamingPropertyValue newSpv = StreamingPropertyValue.create(propertyValue2);
getGraph().getVertex("v1", AUTHORIZATIONS_EMPTY)
.addPropertyValue(propertyKey, propertyName, newSpv, VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY);
getGraph().flush();
new DeleteHistoricalLegacyStreamingPropertyValueData(getGraph())
.execute(
new DeleteHistoricalLegacyStreamingPropertyValueData.Options()
.setDryRun(false)
.setVersionsToKeep(1),
AUTHORIZATIONS_EMPTY
);
Vertex v1 = graph.getVertex(vertexId, AUTHORIZATIONS_EMPTY);
StreamingPropertyValue spv = (StreamingPropertyValue) v1.getPropertyValue(propertyKey, propertyName);
assertNotNull("spv should not be null", spv);
assertEquals(propertyValue2, IOUtils.toString(spv.getInputStream()));
}