You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by GitBox <gi...@apache.org> on 2019/05/22 20:56:48 UTC

[GitHub] [metron] merrimanr commented on a change in pull request #1399: METRON-2073: Create in-memory use case for enrichment with map type and flatfile summarizer

merrimanr commented on a change in pull request #1399: METRON-2073: Create in-memory use case for enrichment with map type and flatfile summarizer
URL: https://github.com/apache/metron/pull/1399#discussion_r286684010
 
 

 ##########
 File path: metron-platform/metron-enrichment/metron-enrichment-common/src/test/java/org/apache/metron/enrichment/cache/ObjectCacheTest.java
 ##########
 @@ -0,0 +1,113 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.metron.enrichment.cache;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.metron.common.utils.SerDeUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class ObjectCacheTest {
+
+  @Rule
+  public ExpectedException thrown = ExpectedException.none();
+
+  FileSystem fs;
+  List<String> data;
+  ObjectCache cache;
+
+  @Before
+  public void setup() throws IOException {
+    fs = FileSystem.get(new Configuration());
+    data = new ArrayList<>();
+    {
+      data.add("apache");
+      data.add("metron");
+      data.add("is");
+      data.add("great");
+    }
+    cache = new ObjectCache();
+  }
+
+  @Test
+  public void test() throws Exception {
+    String filename = "target/ogt/test.ser";
+    Assert.assertTrue(cache.getCache() == null || !cache.getCache().asMap().containsKey(filename));
 
 Review comment:
   You are correct, this was preexisting.  Happy to make your suggested changes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services