SchemaReplicationTest.java revision 6c5c0af35aabc59a56c71e9c9296a7398a3e9176
/*
* 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 2012-2015 ForgeRock AS.
*/
/** Test for the schema replication. */
@SuppressWarnings("javadoc")
public class SchemaReplicationTest extends ReplicationTestCase
{
private int replServerPort;
/** Set up the environment for performing the tests in this Class. */
{
super.setUp();
// This test suite depends on having the schema available.
// Create an internal connection
// Change log
+ "objectClass: top\n"
+ "objectClass: ds-cfg-replication-server\n"
+ "cn: Replication Server\n"
+ "ds-cfg-replication-db-directory: SchemaReplicationTest\n"
+ "ds-cfg-replication-server-id: 105\n";
// suffix synchronized
+ "objectClass: top\n"
+ "objectClass: ds-cfg-replication-domain\n"
+ "ds-cfg-base-dn: cn=schema\n"
+ "ds-cfg-server-id: 1\n";
}
/** Checks that changes done to the schema are pushed to the replicationServer clients. */
@Test
public void pushSchemaChange() throws Exception
{
try
{
// Modify the schema
"( 2.5.44.77.33 NAME 'dummy' )");
// See if the client has received the msg
/* Now cleanup the schema for the next test */
// See if the client has received the msg
}
finally
{
}
}
{
}
/**
* Checks that changes to the schema pushed to the replicationServer
* are received and correctly replayed by replication plugin.
*/
public void replaySchemaChange() throws Exception
{
try
{
"The modification has not been correctly replayed.");
}
finally
{
}
}
/**
* Checks that changes done to the schema files are pushed to the
* ReplicationServers and that the ServerState is updated in the schema
* file.
*/
public void pushSchemaFilesChange() throws Exception
{
try
{
// create a schema change Notification
"( 2.5.44.76.35 NAME 'push' )");
{
}
// receive the message on the broker side.
// check that the schema files were updated with the new ServerState.
// by checking that the CSN of msg we just received has been
// added to the user schema file.
// build the string to find in the schema file
// open the schema file
// it is necessary to loop on this check because the state is not
// written immediately but only every so often.
.toTimer();
{
{
return null;
}
});
} finally
{
}
}
private File getSchemaFile()
{
}
{
}
private void assertModReceived(Modification mod, final DN baseDN, ModifyMsg modMsg) throws Exception
{
{
}
.as("The received mod does not contain the original change")
}
{
}
}