Skip to content

Commit 87dffd7

Browse files
committed
Use LongHashMap to serialize, plus testing
1 parent 4c1afe3 commit 87dffd7

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceJobSupportImpl.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ public void testSerializeWithMap() throws Exception
320320
js1._cachedObjects.put("cachedString", "foo");
321321
js1._cachedObjects.put("cachedLong", 2L);
322322

323+
LongHashMap<Long> longMap = new LongHashMap<>();
324+
longMap.put(1L, 2L);
325+
326+
js1._cachedObjects.put("cachedLongMap", longMap);
327+
323328
ObjectMapper mapper = PipelineJob.createObjectMapper();
324329

325330
StringWriter writer = new StringWriter();
@@ -341,10 +346,13 @@ public void testSerializeWithMap() throws Exception
341346
//NOTE: this is not serializing properly. the keys are serialized as Strings
342347
Map serializedMap = deserialized.getCachedObject("cachedMap", mapper.getTypeFactory().constructParametricType(Map.class, Integer.class, Integer.class));
343348
assertEquals("Map not serialized properly", 1, serializedMap.size());
344-
345-
//TODO: determine if we can coax jackson into serializing these properly
346349
assertEquals("Object not serialized with correct key type", Integer.class, serializedMap.keySet().iterator().next().getClass());
347350
assertNotNull("Map keys not serialized properly", serializedMap.get(1));
351+
352+
LongHashMap<Long> serializedLongMap = (LongHashMap<Long>)deserialized.getCachedObject("cachedLongMap", LongHashMap.class);
353+
assertEquals("LongMap not serialized properly", 1, serializedLongMap.size());
354+
assertEquals("Object not serialized with correct key type", Long.class, serializedLongMap.keySet().iterator().next().getClass());
355+
assertNotNull("LongMap keys not serialized properly", serializedLongMap.get(1L));
348356
}
349357

350358
@Test

singlecell/src/org/labkey/singlecell/run/NimbleAlignmentStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private File createNimbleBam(AlignmentOutputImpl output, Readset rs, List<File>
116116

117117
private File getCachedLoupeFile(Readset rs, boolean throwIfNotFound) throws PipelineJobException
118118
{
119-
Map<Long, Long> map = getPipelineCtx().getSequenceSupport().getCachedObject(CACHE_KEY, PipelineJob.createObjectMapper().getTypeFactory().constructParametricType(LongHashMap.class, Long.class, Long.class));
119+
LongHashMap<Long> map = getPipelineCtx().getSequenceSupport().getCachedObject(CACHE_KEY, LongHashMap.class);
120120
Long dataId = map.get(rs.getReadsetId());
121121
if (dataId == null)
122122
{

0 commit comments

Comments
 (0)