use of uk.gov.gchq.gaffer.data.element.LazyProperties in project Gaffer by gchq.
the class AccumuloEdgeValueLoaderTest method shouldLoadAllValuePropertiesWhenGetProperty.
@Test
public void shouldLoadAllValuePropertiesWhenGetProperty() throws SerialisationException {
// Given
final String group = TestGroups.EDGE;
final Key key = mock(Key.class);
final Value value = mock(Value.class);
final AccumuloElementConverter converter = mock(AccumuloElementConverter.class);
final Schema schema = createSchema();
final AccumuloEdgeValueLoader loader = new AccumuloEdgeValueLoader(group, key, value, converter, schema, false);
final LazyProperties lazyProperties = mock(LazyProperties.class);
final Properties properties = mock(Properties.class);
given(converter.getPropertiesFromValue(group, value)).willReturn(properties);
given(properties.get(TestPropertyNames.PROP_3)).willReturn("propValue3");
// When
final Object property = loader.getProperty(TestPropertyNames.PROP_3, lazyProperties);
// Then
assertEquals("propValue3", property);
verify(lazyProperties).putAll(properties);
verify(converter, never()).getElementId(key, false);
verify(converter, never()).getPropertiesFromColumnVisibility(Mockito.eq(group), Mockito.any(byte[].class));
verify(converter, never()).getPropertiesFromTimestamp(Mockito.eq(group), Mockito.anyLong());
verify(converter, never()).getPropertiesFromColumnQualifier(Mockito.eq(group), Mockito.any(byte[].class));
}
use of uk.gov.gchq.gaffer.data.element.LazyProperties in project Gaffer by gchq.
the class AccumuloEdgeValueLoaderTest method shouldLoadAllTimestampPropertiesWhenGetTimestampProperty.
@Test
public void shouldLoadAllTimestampPropertiesWhenGetTimestampProperty() throws SerialisationException {
// Given
final String group = TestGroups.EDGE;
final Key key = mock(Key.class);
final Value value = mock(Value.class);
final AccumuloElementConverter converter = mock(AccumuloElementConverter.class);
final Schema schema = createSchema();
final AccumuloEdgeValueLoader loader = new AccumuloEdgeValueLoader(group, key, value, converter, schema, false);
final LazyProperties lazyProperties = mock(LazyProperties.class);
final Properties properties = mock(Properties.class);
final Long timestamp = 10L;
given(key.getTimestamp()).willReturn(timestamp);
given(converter.getPropertiesFromTimestamp(group, timestamp)).willReturn(properties);
given(properties.get(TestPropertyNames.TIMESTAMP)).willReturn(timestamp);
// When
final Object property = loader.getProperty(TestPropertyNames.TIMESTAMP, lazyProperties);
// Then
assertEquals(timestamp, property);
verify(lazyProperties).putAll(properties);
verify(converter, never()).getElementId(key, false);
verify(converter, never()).getPropertiesFromColumnQualifier(Mockito.eq(group), Mockito.any(byte[].class));
verify(converter, never()).getPropertiesFromColumnVisibility(Mockito.eq(group), Mockito.any(byte[].class));
verify(converter, never()).getPropertiesFromValue(Mockito.eq(group), Mockito.any(Value.class));
}
use of uk.gov.gchq.gaffer.data.element.LazyProperties in project Gaffer by gchq.
the class AccumuloEntityValueLoaderTest method shouldLoadAllTimestampPropertiesWhenGetTimestampProperty.
@Test
public void shouldLoadAllTimestampPropertiesWhenGetTimestampProperty() throws SerialisationException {
// Given
final String group = TestGroups.ENTITY;
final Key key = mock(Key.class);
final Value value = mock(Value.class);
final AccumuloElementConverter converter = mock(AccumuloElementConverter.class);
final Schema schema = createSchema();
final AccumuloEntityValueLoader loader = new AccumuloEntityValueLoader(group, key, value, converter, schema);
final LazyProperties lazyProperties = mock(LazyProperties.class);
final Properties properties = mock(Properties.class);
final Long timestamp = 10L;
given(key.getTimestamp()).willReturn(timestamp);
given(converter.getPropertiesFromTimestamp(group, timestamp)).willReturn(properties);
given(properties.get(TestPropertyNames.TIMESTAMP)).willReturn(timestamp);
// When
final Object property = loader.getProperty(TestPropertyNames.TIMESTAMP, lazyProperties);
// Then
assertEquals(timestamp, property);
verify(lazyProperties).putAll(properties);
verify(converter, never()).getElementId(key, false);
verify(converter, never()).getPropertiesFromColumnQualifier(Mockito.eq(group), Mockito.any(byte[].class));
verify(converter, never()).getPropertiesFromColumnVisibility(Mockito.eq(group), Mockito.any(byte[].class));
verify(converter, never()).getPropertiesFromValue(Mockito.eq(group), Mockito.any(Value.class));
}
Aggregations