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_r287051648
##########
File path:
metron-platform/metron-enrichment/metron-enrichment-common/src/test/java/org/apache/metron/enrichment/stellar/ObjectGetTest.java
##########
@@ -18,73 +18,88 @@
package org.apache.metron.enrichment.stellar;
-import com.google.common.collect.ImmutableMap;
-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.apache.metron.stellar.common.utils.StellarProcessorUtils;
-import org.junit.Assert;
+import org.apache.metron.enrichment.cache.ObjectCache;
+import org.apache.metron.enrichment.cache.ObjectCacheConfig;
+import org.apache.metron.stellar.dsl.Context;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
-import java.io.BufferedOutputStream;
-import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.powermock.api.mockito.PowerMockito.whenNew;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ObjectGet.class, ObjectCache.class})
public class ObjectGetTest {
- FileSystem fs;
- List<String> data;
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private ObjectGet objectGet;
+ private ObjectCache objectCache;
+ private Context context;
@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");
- }
+ public void setup() throws Exception {
+ objectGet = new ObjectGet();
+ objectCache = mock(ObjectCache.class);
Review comment:
Now that we're setting defaults in the `ObjectCacheConfig` constructor, all
of this is much simpler. There is no need to populate cache settings as the
defaults will work in most cases. Now the `Create an arbitrary cache
configuration` step can be done by just creating a new `ObjectCacheConfig`
object. You would still have to initialize the cache by calling
`ObjectCache.initialize()` and provide a custom test Loader though.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services