| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.replication.ReplicationTestCase; |
| | |
| | | |
| | | // Check add(AttributeValue val, ChangeNumber CN) |
| | | attrInfo1.add(att, updateTime); |
| | | ArrayList<AttrValueHistorical> values1 = attrInfo1.getValuesHistorical(); |
| | | Map<AttrValueHistorical,AttrValueHistorical> values1 = attrInfo1.getValuesHistorical(); |
| | | assertTrue(values1.size() == 1); |
| | | AttrValueHistorical valueInfo1 = new AttrValueHistorical(att, updateTime, null); |
| | | assertTrue(values1.get(0).equals(valueInfo1)); |
| | | assertTrue(values1.containsKey(valueInfo1)); |
| | | |
| | | // Check constructor with parameter |
| | | AttrValueHistorical valueInfo2 = new AttrValueHistorical(att, updateTime, deleteTime); |
| | | ArrayList<AttrValueHistorical> values = new ArrayList<AttrValueHistorical>(); |
| | | values.add(valueInfo2); |
| | | HashMap<AttrValueHistorical,AttrValueHistorical> values = new HashMap<AttrValueHistorical,AttrValueHistorical>(); |
| | | values.put(valueInfo2,valueInfo2); |
| | | AttrHistoricalMultiple attrInfo2 = new AttrHistoricalMultiple(deleteTime, updateTime, values); |
| | | |
| | | // Check equality |
| | |
| | | // Check constructor with time parameter and not Value |
| | | AttrHistoricalMultiple attrInfo3 = new AttrHistoricalMultiple(deleteTime, updateTime, null); |
| | | attrInfo3.add(att, updateTime); |
| | | ArrayList<AttrValueHistorical> values3 = attrInfo3.getValuesHistorical(); |
| | | Map<AttrValueHistorical,AttrValueHistorical> values3 = attrInfo3.getValuesHistorical(); |
| | | assertTrue(values3.size() == 1); |
| | | valueInfo1 = new AttrValueHistorical(att, updateTime, null); |
| | | assertTrue(values3.get(0).equals(valueInfo1)); |
| | | assertTrue(values3.containsKey(valueInfo1)); |
| | | |
| | | // Check duplicate |
| | | AttrHistoricalMultiple attrInfo4 = attrInfo3.duplicate(); |
| | | ArrayList<AttrValueHistorical> values4 = attrInfo4.getValuesHistorical(); |
| | | Map<AttrValueHistorical,AttrValueHistorical> values4 = attrInfo4.getValuesHistorical(); |
| | | assertTrue(attrInfo4.getDeleteTime().compareTo(attrInfo3.getDeleteTime())==0); |
| | | assertEquals(values4.size(), values3.size()); |
| | | |