test enhancements
Change-Id: I28ac2733e6e1ee96810a47500d59d6b54aab3157
diff --git a/core/store/dist/src/test/java/org/onosproject/store/flowobjective/impl/DistributedFlowObjectiveStoreTest.java b/core/store/dist/src/test/java/org/onosproject/store/flowobjective/impl/DistributedFlowObjectiveStoreTest.java
index 93c40ec..535a095 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/flowobjective/impl/DistributedFlowObjectiveStoreTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/flowobjective/impl/DistributedFlowObjectiveStoreTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-present Open Networking Laboratory
+ * Copyright 2017-present Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,8 +24,14 @@
import org.onosproject.store.service.TestStorageService;
import com.google.common.base.Charsets;
+
+import java.util.Collections;
+
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Unit tests for distributed flow objective store.
@@ -49,15 +55,28 @@
@Test
public void testFlowObjectiveStore() {
+ NextGroup group1 = new DefaultNextGroup("1".getBytes(Charsets.US_ASCII));
NextGroup group2 = new DefaultNextGroup("2".getBytes(Charsets.US_ASCII));
int group1Id = store.allocateNextId();
int group2Id = store.allocateNextId();
NextGroup group1add = store.getNextGroup(group1Id);
assertThat(group1add, nullValue());
+ NextGroup dif = store.getNextGroup(3);
+ assertThat(dif, is(nullValue()));
+
+ store.putNextGroup(group1Id, group1);
store.putNextGroup(group2Id, group2);
NextGroup group2Query = store.getNextGroup(group2Id);
assertThat(group2Query.data(), is(group2.data()));
+ assertTrue(store.getAllGroups().containsKey(group2Id));
+ assertTrue(store.getAllGroups().containsKey(group1Id));
+
+ store.removeNextGroup(group2Id);
+ assertTrue(store.getAllGroups().containsKey(group1Id));
+ assertFalse(store.getAllGroups().containsKey(group2Id));
+ store.removeNextGroup(group1Id);
+ assertEquals(store.getAllGroups(), Collections.emptyMap());
}
-}
+}
\ No newline at end of file