Search in sources :

Example 1 with TrackingKey2StringMapper

use of org.commonjava.indy.folo.data.idxmodel.TrackingKey2StringMapper in project indy by Commonjava.

the class TrackingKey2StringMapperTest method testMapper.

@Test
public void testMapper() throws IOException {
    TrackingKey2StringMapper mapper = new TrackingKey2StringMapper();
    TrackingKey key = new TrackingKey(TEST_ID);
    Assert.assertTrue(mapper.isSupportedType(TrackingKey.class));
    Assert.assertFalse(mapper.isSupportedType(Object.class));
    Assert.assertFalse(mapper.isSupportedType(TrackedContent.class));
    Assert.assertTrue(mapper.isSupportedType(WrappedByteArray.class));
    Object genKey = mapper.getKeyMapping(TEST_ID);
    Assert.assertEquals(key, genKey);
    String genId = mapper.getStringMapping(key);
    Assert.assertEquals(TEST_ID, genId);
    WrappedByteArray array = bytesOfTrackingKey(key);
    genId = mapper.getStringMapping(array);
    Assert.assertEquals(TEST_ID, genId);
}
Also used : WrappedByteArray(org.infinispan.commons.marshall.WrappedByteArray) TrackedContent(org.commonjava.indy.folo.model.TrackedContent) TrackingKey2StringMapper(org.commonjava.indy.folo.data.idxmodel.TrackingKey2StringMapper) TrackingKey(org.commonjava.indy.folo.model.TrackingKey) Test(org.junit.Test)

Aggregations

TrackingKey2StringMapper (org.commonjava.indy.folo.data.idxmodel.TrackingKey2StringMapper)1 TrackedContent (org.commonjava.indy.folo.model.TrackedContent)1 TrackingKey (org.commonjava.indy.folo.model.TrackingKey)1 WrappedByteArray (org.infinispan.commons.marshall.WrappedByteArray)1 Test (org.junit.Test)1