-/*\r
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.statistics.flowcache;\r
-\r
-import static org.junit.Assert.assertEquals;\r
-import static org.junit.Assert.assertNotNull;\r
-import static org.junit.Assert.fail;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.HasDirection;\r
-\r
-public class FlowCacheTest {\r
-\r
- private static final String KEY_1 = "key_1";\r
- private static final String KEY_2 = "key_2";\r
- private static final String NAME_1 = "name_1";\r
- private static final HasDirection.Direction direction = HasDirection.Direction.Bidirectional;\r
- private static final String VALUE_1 = "value_1";\r
- private static FlowCacheDefinition flowCacheDefinition;\r
- private List<String> keysValues;\r
- private String json;\r
-\r
- @Before\r
- public void init() {\r
- keysValues = new ArrayList<>();\r
- keysValues.add(KEY_1);\r
- keysValues.add(KEY_2);\r
-\r
- FlowCacheDefinition.FlowCacheDefinitionBuilder flowCacheDefinitionBuilder = FlowCacheDefinition.builder();\r
- flowCacheDefinitionBuilder.getKeysBuilder().setValues(keysValues);\r
- flowCacheDefinition = flowCacheDefinitionBuilder.setValue(VALUE_1).setLog(true).build();\r
-\r
- json = "{\"keys\":\"" + KEY_1 + "," + KEY_2 + "\"," + "\"value\":\"" + VALUE_1 + "\","\r
- + "\"filter\":\"\",\"log\":true}";\r
- }\r
-\r
- @Test\r
- public void testBuilder() {\r
- FlowCache.FlowCacheBuilder builder = null;\r
- try {\r
- builder = FlowCache.builder();\r
- } catch (Exception e) {\r
- fail("Exception thrown: " + e.getMessage());\r
- }\r
- assertNotNull(builder);\r
- }\r
-\r
- @Test\r
- public void testConstructor_Implicitely() {\r
- FlowCache flowCache =\r
- FlowCache.builder().setDefinition(flowCacheDefinition).setDirection(direction).setName(NAME_1).build();\r
-\r
- assertEquals(keysValues.size(), flowCache.getKeyNum());\r
- assertEquals(keysValues.get(0), flowCache.getKeyNames()[0]);\r
- assertEquals(keysValues.get(1), flowCache.getKeyNames()[1]);\r
- assertEquals(FlowCache.API_FLOW + NAME_1 + FlowCache.SUFFIX_JSON, flowCache.getPath());\r
- assertEquals(json, flowCache.getJsonDefinition());\r
-\r
- }\r
-}\r
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.statistics.flowcache;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.HasDirection;
+
+public class FlowCacheTest {
+
+ private static final String KEY_1 = "key_1";
+ private static final String KEY_2 = "key_2";
+ private static final String NAME_1 = "name_1";
+ private static final HasDirection.Direction direction = HasDirection.Direction.Bidirectional;
+ private static final String VALUE_1 = "value_1";
+ private static FlowCacheDefinition flowCacheDefinition;
+ private List<String> keysValues;
+ private String json;
+
+ @Before
+ public void init() {
+ keysValues = new ArrayList<>();
+ keysValues.add(KEY_1);
+ keysValues.add(KEY_2);
+
+ FlowCacheDefinition.FlowCacheDefinitionBuilder flowCacheDefinitionBuilder = FlowCacheDefinition.builder();
+ flowCacheDefinitionBuilder.getKeysBuilder().setValues(keysValues);
+ flowCacheDefinition = flowCacheDefinitionBuilder.setValue(VALUE_1).setLog(true).build();
+
+ json = "{\"keys\":\"" + KEY_1 + "," + KEY_2 + "\"," + "\"value\":\"" + VALUE_1 + "\","
+ + "\"filter\":\"\",\"log\":true}";
+ }
+
+ @Test
+ public void testBuilder() {
+ FlowCache.FlowCacheBuilder builder = null;
+ try {
+ builder = FlowCache.builder();
+ } catch (Exception e) {
+ fail("Exception thrown: " + e.getMessage());
+ }
+ assertNotNull(builder);
+ }
+
+ @Test
+ public void testConstructor_Implicitely() {
+ FlowCache flowCache =
+ FlowCache.builder().setDefinition(flowCacheDefinition).setDirection(direction).setName(NAME_1).build();
+
+ assertEquals(keysValues.size(), flowCache.getKeyNum());
+ assertEquals(keysValues.get(0), flowCache.getKeyNames()[0]);
+ assertEquals(keysValues.get(1), flowCache.getKeyNames()[1]);
+ assertEquals(FlowCache.API_FLOW + NAME_1 + FlowCache.SUFFIX_JSON, flowCache.getPath());
+ assertEquals(json, flowCache.getJsonDefinition());
+
+ }
+}