Search in sources :

Example 1 with DeleteHistoricalLegacyStreamingPropertyValueData

use of org.vertexium.accumulo.tools.DeleteHistoricalLegacyStreamingPropertyValueData in project vertexium by visallo.

the class AccumuloGraphTestBase method testDeleteHistoricalLegacyStreamingPropertyValueData_mixOfOldAndNew.

@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);
    // verify we can still retrieve it
    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()));
}
Also used : StreamingPropertyValue(org.vertexium.property.StreamingPropertyValue) DeleteHistoricalLegacyStreamingPropertyValueData(org.vertexium.accumulo.tools.DeleteHistoricalLegacyStreamingPropertyValueData) Test(org.junit.Test)

Example 2 with DeleteHistoricalLegacyStreamingPropertyValueData

use of org.vertexium.accumulo.tools.DeleteHistoricalLegacyStreamingPropertyValueData in project vertexium by visallo.

the class AccumuloGraphTestBase method testDeleteHistoricalLegacyStreamingPropertyValueData_keysWithCommonPrefix.

@Test
public void testDeleteHistoricalLegacyStreamingPropertyValueData_keysWithCommonPrefix() throws Exception {
    String vertexId = "v1";
    graph.prepareVertex(vertexId, VISIBILITY_EMPTY).save(AUTHORIZATIONS_EMPTY);
    graph.flush();
    long timestamp = new Date().getTime();
    String propertyKey1 = "prefix";
    String propertyKey2 = "prefixSuffix";
    String propertyName = "prop1";
    String propertyValue = "Hello";
    addLegacySPVData(vertexId, timestamp, propertyKey1, propertyName, propertyValue);
    addLegacySPVData(vertexId, timestamp, propertyKey2, propertyName, propertyValue);
    getGraph().flush();
    new DeleteHistoricalLegacyStreamingPropertyValueData(getGraph()).execute(new DeleteHistoricalLegacyStreamingPropertyValueData.Options().setDryRun(false).setVersionsToKeep(1), AUTHORIZATIONS_EMPTY);
    // verify we can still retrieve it
    Vertex v1 = graph.getVertex(vertexId, AUTHORIZATIONS_EMPTY);
    StreamingPropertyValue spv = (StreamingPropertyValue) v1.getPropertyValue(propertyKey1, propertyName);
    assertNotNull("spv should not be null", spv);
    assertEquals(propertyValue, IOUtils.toString(spv.getInputStream()));
    spv = (StreamingPropertyValue) v1.getPropertyValue(propertyKey2, propertyName);
    assertNotNull("spv should not be null", spv);
    assertEquals(propertyValue, IOUtils.toString(spv.getInputStream()));
}
Also used : StreamingPropertyValue(org.vertexium.property.StreamingPropertyValue) DeleteHistoricalLegacyStreamingPropertyValueData(org.vertexium.accumulo.tools.DeleteHistoricalLegacyStreamingPropertyValueData) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 DeleteHistoricalLegacyStreamingPropertyValueData (org.vertexium.accumulo.tools.DeleteHistoricalLegacyStreamingPropertyValueData)2 StreamingPropertyValue (org.vertexium.property.StreamingPropertyValue)2