HistoricalCsnOrderingTest.java revision a89f7014aeb71dba5c94404dfea7eb89e7eeee74
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS
*/
/**
* Test the usage of the historical data of the replication.
*/
@SuppressWarnings("javadoc")
public class HistoricalCsnOrderingTest extends ReplicationTestCase
{
private final int serverId = 123;
private static class TestBroker extends ReplicationBroker
{
{
}
{
}
}
private MatchingRule getRule()
{
.syntaxOID("1.3.6.1.4.1.1466.115.121.1.40")
.addToSchema()
}
/**
* Check the basic comparator on the HistoricalCsnOrderingMatchingRule.
*/
@Test
public void basicRuleTest() throws Exception
{
// Creates a rule
}
/**
* Test that we can retrieve the entries that were missed by
* a replication server and can re-build operations from the historical
* informations.
*/
@Test
public void buildAndPublishMissingChangesOneEntryTest() throws Exception
{
final int serverId = 123;
// Create Replication Server and Domain
try
{
final AttributeType histType =
// Add the first test entry.
"dn: cn=test1," + baseDN,
"displayname: Test1",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: test1",
"sn: test"
);
// Perform a first modification to update the historical attribute
"dn: cn=test1," + baseDN,
"changetype: modify",
"add: description",
"description: foo");
// Read the entry back to get its historical and included CSN
// Perform a 2nd modification to update the hist attribute with
// a second value
"dn: cn=test1," + baseDN,
"changetype: modify",
"add: description",
"description: bar");
}
// Build a CSN from the first modification
opList = new LinkedList<>();
}
finally
{
}
}
/**
* Test that we can retrieve the entries that were missed by
* a replication server and can re-build operations from the historical
* informations.
*/
@Test
public void buildAndPublishMissingChangesSeveralEntriesTest() throws Exception
{
// Create Replication Server and Domain
try
{
// Add 3 entries.
"dn: " + dnTest3,
"displayname: Test1",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: test1",
"sn: test"
);
"dn: " + dnTest1,
"displayname: Test1",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: test1",
"sn: test"
);
"dn: " + dnTest2,
"displayname: Test1",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"cn: test1",
"sn: test"
);
// Perform modifications on the 2 entries
"dn: cn=test2," + baseDN,
"changetype: modify",
"add: description",
"description: foo");
"dn: cn=test1," + baseDN,
"changetype: modify",
"add: description",
"description: foo");
// Call the buildAndPublishMissingChanges and check that this method
// correctly generates the 4 operations in the correct order.
}
finally
{
}
}
{
return replicationServer;
}
throws DirectoryException, ConfigException
{
return replicationDomain;
}
}